Obsidean_VM/.obsidian/plugins/copilot/main.js

1713 lines
3.4 MiB
Raw Blame History

This file contains invisible Unicode characters

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

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

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var _Wt=Object.create;var RU=Object.defineProperty;var vWt=Object.getOwnPropertyDescriptor;var wWt=Object.getOwnPropertyNames;var SWt=Object.getPrototypeOf,xWt=Object.prototype.hasOwnProperty;var ZLe=t=>{throw TypeError(t)};var CWt=(t,e,r)=>e in t?RU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var O=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),$f=(t,e)=>{for(var r in e)RU(t,r,{get:e[r],enumerable:!0})},XLe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of wWt(e))!xWt.call(t,o)&&o!==r&&RU(t,o,{get:()=>e[o],enumerable:!(n=vWt(e,o))||n.enumerable});return t};var $=(t,e,r)=>(r=t!=null?_Wt(SWt(t)):{},XLe(e||!t||!t.__esModule?RU(r,"default",{value:t,enumerable:!0}):r,t)),Al=t=>XLe(RU({},"__esModule",{value:!0}),t);var lc=(t,e,r)=>CWt(t,typeof e!="symbol"?e+"":e,r),OWt=(t,e,r)=>e.has(t)||ZLe("Cannot "+r);var QLe=(t,e,r)=>e.has(t)?ZLe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var eFe=(t,e,r)=>(OWt(t,e,"access private method"),r);var Ule,zle,hN,Hle=O(()=>{Ule="{copilot-selection}",zle=50,hN=[{name:"Fix grammar and spelling",prompt:"Fix the grammar and spelling of {}. Preserve all formatting, line breaks, and special characters. Do not add or remove any content. Return only the corrected text.",showInContextMenu:!0},{name:"Translate to Chinese",prompt:`Translate {} into Chinese:
1. Preserve the meaning and tone
2. Maintain appropriate cultural context
3. Keep formatting and structure
Return only the translated text.`,showInContextMenu:!0},{name:"Summarize",prompt:"Create a bullet-point summary of {}. Each bullet point should capture a key point. Return only the bullet-point summary.",showInContextMenu:!0},{name:"Simplify",prompt:"Simplify {} to a 6th-grade reading level (ages 11-12). Use simple sentences, common words, and clear explanations. Maintain the original key concepts. Return only the simplified text.",showInContextMenu:!0},{name:"Emojify",prompt:`Add relevant emojis to enhance {}. Follow these rules:
1. Insert emojis at natural breaks in the text
2. Never place two emojis next to each other
3. Keep all original text unchanged
4. Choose emojis that match the context and tone
Return only the emojified text.`,showInContextMenu:!0},{name:"Make shorter",prompt:`Reduce {} to half its length while preserving these elements:
1. Main ideas and key points
2. Essential details
3. Original tone and style
Return only the shortened text.`,showInContextMenu:!0},{name:"Make longer",prompt:`Expand {} to twice its length by:
1. Adding relevant details and examples
2. Elaborating on key points
3. Maintaining the original tone and style
Return only the expanded text.`,showInContextMenu:!0},{name:"Generate table of contents",prompt:"Generate a hierarchical table of contents for {}. Use appropriate heading levels (H1, H2, H3, etc.). Include page numbers if present. Return only the table of contents.",showInContextMenu:!1},{name:"Generate glossary",prompt:'Create a glossary of important terms, concepts, and phrases from {}. Format each entry as "Term: Definition". Sort entries alphabetically. Return only the glossary.',showInContextMenu:!1},{name:"Remove URLs",prompt:"Remove all URLs from {}. Preserve all other content and formatting. URLs may be in various formats (http, https, www). Return only the text with URLs removed.",showInContextMenu:!1},{name:"Rewrite as tweet",prompt:`Rewrite {} as a single tweet with these requirements:
1. Maximum 280 characters
2. Use concise, impactful language
3. Maintain the core message
Return only the tweet text.`,showInContextMenu:!1},{name:"Rewrite as tweet thread",prompt:`Convert {} into a Twitter thread following these rules:
1. Each tweet must be under 240 characters
2. Start with "THREAD START" on its own line
3. Separate tweets with "
---
"
4. End with "THREAD END" on its own line
5. Make content engaging and clear
Return only the formatted thread.`,showInContextMenu:!1},{name:"Explain like I am 5",prompt:`Explain {} in simple terms that a 5-year-old would understand:
1. Use basic vocabulary
2. Include simple analogies
3. Break down complex concepts
Return only the simplified explanation.`,showInContextMenu:!1},{name:"Rewrite as press release",prompt:`Transform {} into a professional press release:
1. Use formal, journalistic style
2. Include headline and dateline
3. Follow inverted pyramid structure
Return only the press release format.`,showInContextMenu:!1}]});function Vle(){if(!oW&&(oW=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!oW))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oW(PWt)}var oW,PWt,tFe=O(()=>{PWt=new Uint8Array(16)});function rFe(t,e=0){return cc[t[e+0]]+cc[t[e+1]]+cc[t[e+2]]+cc[t[e+3]]+"-"+cc[t[e+4]]+cc[t[e+5]]+"-"+cc[t[e+6]]+cc[t[e+7]]+"-"+cc[t[e+8]]+cc[t[e+9]]+"-"+cc[t[e+10]]+cc[t[e+11]]+cc[t[e+12]]+cc[t[e+13]]+cc[t[e+14]]+cc[t[e+15]]}var cc,nFe=O(()=>{cc=[];for(let t=0;t<256;++t)cc.push((t+256).toString(16).slice(1))});var EWt,Wle,oFe=O(()=>{EWt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Wle={randomUUID:EWt}});function TWt(t,e,r){if(Wle.randomUUID&&!e&&!t)return Wle.randomUUID();t=t||{};let n=t.random||(t.rng||Vle)();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 rFe(n)}var GI,iFe=O(()=>{oFe();tFe();nFe();GI=TWt});var iW=O(()=>{iFe()});function IWt(t){lFe=t}function aW(){return lFe}function ot(t,e){let r=aW(),n=sW({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===bN?void 0:bN].filter(o=>!!o)});t.common.issues.push(n)}function uW(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 cFe(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 Br(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 fFe(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 JWt(t){return new RegExp(`^${fFe(t)}$`)}function pFe(t){let e=`${dFe}T${fFe(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 GWt(t,e){return!!((e==="v4"||!e)&&qWt.test(t)||(e==="v6"||!e)&&zWt.test(t))}function YWt(t,e){if(!FWt.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 ZWt(t,e){return!!((e==="v4"||!e)&&UWt.test(t)||(e==="v6"||!e)&&HWt.test(t))}function XWt(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 gN(t){if(t instanceof qf){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Bf.create(gN(n))}return new qf({...t._def,shape:()=>e})}else return t instanceof Cx?new Cx({...t._def,type:gN(t.element)}):t instanceof Bf?Bf.create(gN(t.unwrap())):t instanceof eb?eb.create(gN(t.unwrap())):t instanceof Qy?Qy.create(t.items.map(e=>gN(e))):t}function Zle(t,e){let r=Sx(t),n=Sx(e);if(t===e)return{valid:!0,data:t};if(r===ct.object&&n===ct.object){let o=Vn.objectKeys(e),i=Vn.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=Zle(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===ct.array&&n===ct.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=Zle(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===ct.date&&n===ct.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function mFe(t,e){return new sM({values:t,typeName:se.ZodEnum,...Br(e)})}function sFe(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function hFe(t,e={},r){return t?TP.create().superRefine((n,o)=>{var i,a;let s=t(n);if(s instanceof Promise)return s.then(u=>{var l,c;if(!u){let d=sFe(e,n),f=(c=(l=d.fatal)!==null&&l!==void 0?l:r)!==null&&c!==void 0?c:!0;o.addIssue({code:"custom",...d,fatal:f})}});if(!s){let u=sFe(e,n),l=(a=(i=u.fatal)!==null&&i!==void 0?i:r)!==null&&a!==void 0?a:!0;o.addIssue({code:"custom",...u,fatal:l})}}):TP.create()}var Vn,Jle,ct,Sx,De,AWt,qp,bN,lFe,sW,MWt,sd,cr,yN,Xd,Gle,Yle,YI,NU,Tt,jU,DU,Vm,aFe,qr,RWt,jWt,DWt,NWt,LWt,FWt,kWt,$Wt,BWt,Kle,qWt,UWt,zWt,HWt,VWt,WWt,dFe,KWt,EP,ZI,XI,QI,eM,_N,tM,rM,TP,xx,Pg,vN,Cx,qf,nM,wx,lW,oM,Qy,cW,wN,SN,dW,iM,aM,sM,uM,AP,Up,Bf,eb,lM,cM,xN,QWt,LU,FU,dM,e9t,se,t9t,gFe,yFe,r9t,n9t,bFe,o9t,i9t,a9t,s9t,u9t,l9t,c9t,d9t,f9t,p9t,m9t,h9t,g9t,y9t,b9t,_9t,v9t,w9t,S9t,x9t,C9t,O9t,P9t,E9t,uFe,T9t,A9t,I9t,M9t,R9t,j9t,D9t,N9t,L9t,Ur,ud=O(()=>{(function(t){t.assertEqual=o=>o;function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Vn||(Vn={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Jle||(Jle={}));ct=Vn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Sx=t=>{switch(typeof t){case"undefined":return ct.undefined;case"string":return ct.string;case"number":return isNaN(t)?ct.nan:ct.number;case"boolean":return ct.boolean;case"function":return ct.function;case"bigint":return ct.bigint;case"symbol":return ct.symbol;case"object":return Array.isArray(t)?ct.array:t===null?ct.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ct.promise:typeof Map<"u"&&t instanceof Map?ct.map:typeof Set<"u"&&t instanceof Set?ct.set:typeof Date<"u"&&t instanceof Date?ct.date:ct.object;default:return ct.unknown}},De=Vn.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"]),AWt=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),qp=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],u++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Vn.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()}};qp.create=t=>new qp(t);bN=(t,e)=>{let r;switch(t.code){case De.invalid_type:t.received===ct.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case De.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Vn.jsonStringifyReplacer)}`;break;case De.unrecognized_keys:r=`Unrecognized key(s) in object: ${Vn.joinValues(t.keys,", ")}`;break;case De.invalid_union:r="Invalid input";break;case De.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Vn.joinValues(t.options)}`;break;case De.invalid_enum_value:r=`Invalid enum value. Expected ${Vn.joinValues(t.options)}, received '${t.received}'`;break;case De.invalid_arguments:r="Invalid function arguments";break;case De.invalid_return_type:r="Invalid function return type";break;case De.invalid_date:r="Invalid date";break;case De.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}"`:Vn.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case De.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 De.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 De.custom:r="Invalid input";break;case De.invalid_intersection_types:r="Intersection results could not be merged";break;case De.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case De.not_finite:r="Number must be finite";break;default:r=e.defaultError,Vn.assertNever(t)}return{message:r}},lFe=bN;sW=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}},MWt=[];sd=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return cr;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return cr;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}}},cr=Object.freeze({status:"aborted"}),yN=t=>({status:"dirty",value:t}),Xd=t=>({status:"valid",value:t}),Gle=t=>t.status==="aborted",Yle=t=>t.status==="dirty",YI=t=>t.status==="valid",NU=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})(Tt||(Tt={}));Vm=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}},aFe=(t,e)=>{if(YI(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 qp(t.common.issues);return this._error=r,this._error}}};qr=class{get description(){return this._def.description}_getType(e){return Sx(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Sx(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new sd,ctx:{common:e.parent.common,data:e.data,parsedType:Sx(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(NU(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:Sx(e)},i=this._parseSync({data:e,path:o.path,parent:o});return aFe(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:Sx(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:o});return YI(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=>YI(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:Sx(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(NU(o)?o:Promise.resolve(o));return aFe(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.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 Up({schema:this,typeName:se.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 Bf.create(this,this._def)}nullable(){return eb.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Cx.create(this)}promise(){return AP.create(this,this._def)}or(e){return nM.create([this,e],this._def)}and(e){return oM.create(this,e,this._def)}transform(e){return new Up({...Br(this._def),schema:this,typeName:se.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new lM({...Br(this._def),innerType:this,defaultValue:r,typeName:se.ZodDefault})}brand(){return new LU({typeName:se.ZodBranded,type:this,...Br(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new cM({...Br(this._def),innerType:this,catchValue:r,typeName:se.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return FU.create(this,e)}readonly(){return dM.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},RWt=/^c[^\s-]{8,}$/i,jWt=/^[0-9a-z]+$/,DWt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,NWt=/^[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,LWt=/^[a-z0-9_-]{21}$/i,FWt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,kWt=/^[-+]?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)?)??$/,$Wt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,BWt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",qWt=/^(?:(?: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])$/,UWt=/^(?:(?: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])$/,zWt=/^(([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]))$/,HWt=/^(([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])$/,VWt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,WWt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dFe="((\\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])))",KWt=new RegExp(`^${dFe}$`);EP=class t extends qr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ct.string){let i=this._getOrReturnCtx(e);return ot(i,{code:De.invalid_type,expected:ct.string,received:i.parsedType}),cr}let n=new sd,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),ot(o,{code:De.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),ot(o,{code:De.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?ot(o,{code:De.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ot(o,{code:De.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")$Wt.test(e.data)||(o=this._getOrReturnCtx(e,o),ot(o,{validation:"email",code:De.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Kle||(Kle=new RegExp(BWt,"u")),Kle.test(e.data)||(o=this._getOrReturnCtx(e,o),ot(o,{validation:"emoji",code:De.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")NWt.test(e.data)||(o=this._getOrReturnCtx(e,o),ot(o,{validation:"uuid",code:De.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")LWt.test(e.data)||(o=this._getOrReturnCtx(e,o),ot(o,{validation:"nanoid",code:De.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")RWt.test(e.data)||(o=this._getOrReturnCtx(e,o),ot(o,{validation:"cuid",code:De.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")jWt.test(e.data)||(o=this._getOrReturnCtx(e,o),ot(o,{validation:"cuid2",code:De.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")DWt.test(e.data)||(o=this._getOrReturnCtx(e,o),ot(o,{validation:"ulid",code:De.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),ot(o,{validation:"url",code:De.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),ot(o,{validation:"regex",code:De.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),ot(o,{code:De.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),ot(o,{code:De.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),ot(o,{code:De.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?pFe(i).test(e.data)||(o=this._getOrReturnCtx(e,o),ot(o,{code:De.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?KWt.test(e.data)||(o=this._getOrReturnCtx(e,o),ot(o,{code:De.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?JWt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),ot(o,{code:De.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?kWt.test(e.data)||(o=this._getOrReturnCtx(e,o),ot(o,{validation:"duration",code:De.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?GWt(e.data,i.version)||(o=this._getOrReturnCtx(e,o),ot(o,{validation:"ip",code:De.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?YWt(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),ot(o,{validation:"jwt",code:De.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?ZWt(e.data,i.version)||(o=this._getOrReturnCtx(e,o),ot(o,{validation:"cidr",code:De.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?VWt.test(e.data)||(o=this._getOrReturnCtx(e,o),ot(o,{validation:"base64",code:De.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?WWt.test(e.data)||(o=this._getOrReturnCtx(e,o),ot(o,{validation:"base64url",code:De.invalid_string,message:i.message}),n.dirty()):Vn.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:De.invalid_string,...Tt.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Tt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Tt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Tt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Tt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Tt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Tt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Tt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Tt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Tt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Tt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Tt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Tt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Tt.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,...Tt.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,...Tt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Tt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Tt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Tt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Tt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Tt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Tt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Tt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Tt.errToObj(r)})}nonempty(e){return this.min(1,Tt.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};EP.create=t=>{var e;return new EP({checks:[],typeName:se.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Br(t)})};ZI=class t extends qr{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)!==ct.number){let i=this._getOrReturnCtx(e);return ot(i,{code:De.invalid_type,expected:ct.number,received:i.parsedType}),cr}let n,o=new sd;for(let i of this._def.checks)i.kind==="int"?Vn.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ot(n,{code:De.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),ot(n,{code:De.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),ot(n,{code:De.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?XWt(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),ot(n,{code:De.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),ot(n,{code:De.not_finite,message:i.message}),o.dirty()):Vn.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Tt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Tt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Tt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Tt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Tt.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Tt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Tt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Tt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Tt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Tt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Tt.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"&&Vn.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)}};ZI.create=t=>new ZI({checks:[],typeName:se.ZodNumber,coerce:t?.coerce||!1,...Br(t)});XI=class t extends qr{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)!==ct.bigint)return this._getInvalidInput(e);let n,o=new sd;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),ot(n,{code:De.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),ot(n,{code:De.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),ot(n,{code:De.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Vn.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ot(r,{code:De.invalid_type,expected:ct.bigint,received:r.parsedType}),cr}gte(e,r){return this.setLimit("min",e,!0,Tt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Tt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Tt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Tt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Tt.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Tt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Tt.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}};XI.create=t=>{var e;return new XI({checks:[],typeName:se.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Br(t)})};QI=class extends qr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ct.boolean){let n=this._getOrReturnCtx(e);return ot(n,{code:De.invalid_type,expected:ct.boolean,received:n.parsedType}),cr}return Xd(e.data)}};QI.create=t=>new QI({typeName:se.ZodBoolean,coerce:t?.coerce||!1,...Br(t)});eM=class t extends qr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ct.date){let i=this._getOrReturnCtx(e);return ot(i,{code:De.invalid_type,expected:ct.date,received:i.parsedType}),cr}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ot(i,{code:De.invalid_date}),cr}let n=new sd,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),ot(o,{code:De.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),ot(o,{code:De.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Vn.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Tt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Tt.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}};eM.create=t=>new eM({checks:[],coerce:t?.coerce||!1,typeName:se.ZodDate,...Br(t)});_N=class extends qr{_parse(e){if(this._getType(e)!==ct.symbol){let n=this._getOrReturnCtx(e);return ot(n,{code:De.invalid_type,expected:ct.symbol,received:n.parsedType}),cr}return Xd(e.data)}};_N.create=t=>new _N({typeName:se.ZodSymbol,...Br(t)});tM=class extends qr{_parse(e){if(this._getType(e)!==ct.undefined){let n=this._getOrReturnCtx(e);return ot(n,{code:De.invalid_type,expected:ct.undefined,received:n.parsedType}),cr}return Xd(e.data)}};tM.create=t=>new tM({typeName:se.ZodUndefined,...Br(t)});rM=class extends qr{_parse(e){if(this._getType(e)!==ct.null){let n=this._getOrReturnCtx(e);return ot(n,{code:De.invalid_type,expected:ct.null,received:n.parsedType}),cr}return Xd(e.data)}};rM.create=t=>new rM({typeName:se.ZodNull,...Br(t)});TP=class extends qr{constructor(){super(...arguments),this._any=!0}_parse(e){return Xd(e.data)}};TP.create=t=>new TP({typeName:se.ZodAny,...Br(t)});xx=class extends qr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Xd(e.data)}};xx.create=t=>new xx({typeName:se.ZodUnknown,...Br(t)});Pg=class extends qr{_parse(e){let r=this._getOrReturnCtx(e);return ot(r,{code:De.invalid_type,expected:ct.never,received:r.parsedType}),cr}};Pg.create=t=>new Pg({typeName:se.ZodNever,...Br(t)});vN=class extends qr{_parse(e){if(this._getType(e)!==ct.undefined){let n=this._getOrReturnCtx(e);return ot(n,{code:De.invalid_type,expected:ct.void,received:n.parsedType}),cr}return Xd(e.data)}};vN.create=t=>new vN({typeName:se.ZodVoid,...Br(t)});Cx=class t extends qr{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==ct.array)return ot(r,{code:De.invalid_type,expected:ct.array,received:r.parsedType}),cr;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(ot(r,{code:a?De.too_big:De.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&&(ot(r,{code:De.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&&(ot(r,{code:De.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 Vm(r,a,r.path,s)))).then(a=>sd.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Vm(r,a,r.path,s)));return sd.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Tt.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Tt.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Tt.toString(r)}})}nonempty(e){return this.min(1,e)}};Cx.create=(t,e)=>new Cx({type:t,minLength:null,maxLength:null,exactLength:null,typeName:se.ZodArray,...Br(e)});qf=class t extends qr{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=Vn.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==ct.object){let l=this._getOrReturnCtx(e);return ot(l,{code:De.invalid_type,expected:ct.object,received:l.parsedType}),cr}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Pg&&this._def.unknownKeys==="strip"))for(let l in o.data)a.includes(l)||s.push(l);let u=[];for(let l of a){let c=i[l],d=o.data[l];u.push({key:{status:"valid",value:l},value:c._parse(new Vm(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Pg){let l=this._def.unknownKeys;if(l==="passthrough")for(let c of s)u.push({key:{status:"valid",value:c},value:{status:"valid",value:o.data[c]}});else if(l==="strict")s.length>0&&(ot(o,{code:De.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 Vm(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=>sd.mergeObjectSync(n,l)):sd.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Tt.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,i,a,s;let u=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=Tt.errToObj(e).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:se.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return Vn.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return Vn.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return gN(this)}partial(e){let r={};return Vn.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return Vn.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Bf;)i=i._def.innerType;r[n]=i}}),new t({...this._def,shape:()=>r})}keyof(){return mFe(Vn.objectKeys(this.shape))}};qf.create=(t,e)=>new qf({shape:()=>t,unknownKeys:"strip",catchall:Pg.create(),typeName:se.ZodObject,...Br(e)});qf.strictCreate=(t,e)=>new qf({shape:()=>t,unknownKeys:"strict",catchall:Pg.create(),typeName:se.ZodObject,...Br(e)});qf.lazycreate=(t,e)=>new qf({shape:t,unknownKeys:"strip",catchall:Pg.create(),typeName:se.ZodObject,...Br(e)});nM=class extends qr{_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 qp(s.ctx.common.issues));return ot(r,{code:De.invalid_union,unionErrors:a}),cr}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 qp(u));return ot(r,{code:De.invalid_union,unionErrors:s}),cr}}get options(){return this._def.options}};nM.create=(t,e)=>new nM({options:t,typeName:se.ZodUnion,...Br(e)});wx=t=>t instanceof iM?wx(t.schema):t instanceof Up?wx(t.innerType()):t instanceof aM?[t.value]:t instanceof sM?t.options:t instanceof uM?Vn.objectValues(t.enum):t instanceof lM?wx(t._def.innerType):t instanceof tM?[void 0]:t instanceof rM?[null]:t instanceof Bf?[void 0,...wx(t.unwrap())]:t instanceof eb?[null,...wx(t.unwrap())]:t instanceof LU||t instanceof dM?wx(t.unwrap()):t instanceof cM?wx(t._def.innerType):[],lW=class t extends qr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ct.object)return ot(r,{code:De.invalid_type,expected:ct.object,received:r.parsedType}),cr;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}):(ot(r,{code:De.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),cr)}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=wx(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new t({typeName:se.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Br(n)})}};oM=class extends qr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(Gle(i)||Gle(a))return cr;let s=Zle(i.value,a.value);return s.valid?((Yle(i)||Yle(a))&&r.dirty(),{status:r.value,value:s.data}):(ot(n,{code:De.invalid_intersection_types}),cr)};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}))}};oM.create=(t,e,r)=>new oM({left:t,right:e,typeName:se.ZodIntersection,...Br(r)});Qy=class t extends qr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ct.array)return ot(n,{code:De.invalid_type,expected:ct.array,received:n.parsedType}),cr;if(n.data.length<this._def.items.length)return ot(n,{code:De.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),cr;!this._def.rest&&n.data.length>this._def.items.length&&(ot(n,{code:De.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 Vm(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>sd.mergeArray(r,a)):sd.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Qy.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qy({items:t,typeName:se.ZodTuple,rest:null,...Br(e)})};cW=class t extends qr{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!==ct.object)return ot(n,{code:De.invalid_type,expected:ct.object,received:n.parsedType}),cr;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Vm(n,s,n.path,s)),value:a._parse(new Vm(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?sd.mergeObjectAsync(r,o):sd.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof qr?new t({keyType:e,valueType:r,typeName:se.ZodRecord,...Br(n)}):new t({keyType:EP.create(),valueType:e,typeName:se.ZodRecord,...Br(r)})}},wN=class extends qr{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!==ct.map)return ot(n,{code:De.invalid_type,expected:ct.map,received:n.parsedType}),cr;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new Vm(n,s,n.path,[l,"key"])),value:i._parse(new Vm(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 cr;(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 cr;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};wN.create=(t,e,r)=>new wN({valueType:e,keyType:t,typeName:se.ZodMap,...Br(r)});SN=class t extends qr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ct.set)return ot(n,{code:De.invalid_type,expected:ct.set,received:n.parsedType}),cr;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ot(n,{code:De.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&&(ot(n,{code:De.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 cr;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 Vm(n,u,n.path,l)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:Tt.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Tt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};SN.create=(t,e)=>new SN({valueType:t,minSize:null,maxSize:null,typeName:se.ZodSet,...Br(e)});dW=class t extends qr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ct.function)return ot(r,{code:De.invalid_type,expected:ct.function,received:r.parsedType}),cr;function n(s,u){return sW({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,aW(),bN].filter(l=>!!l),issueData:{code:De.invalid_arguments,argumentsError:u}})}function o(s,u){return sW({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,aW(),bN].filter(l=>!!l),issueData:{code:De.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof AP){let s=this;return Xd(async function(...u){let l=new qp([]),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 Xd(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new qp([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new qp([o(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Qy.create(e).rest(xx.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Qy.create([]).rest(xx.create()),returns:r||xx.create(),typeName:se.ZodFunction,...Br(n)})}},iM=class extends qr{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})}};iM.create=(t,e)=>new iM({getter:t,typeName:se.ZodLazy,...Br(e)});aM=class extends qr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ot(r,{received:r.data,code:De.invalid_literal,expected:this._def.value}),cr}return{status:"valid",value:e.data}}get value(){return this._def.value}};aM.create=(t,e)=>new aM({value:t,typeName:se.ZodLiteral,...Br(e)});sM=class t extends qr{constructor(){super(...arguments),jU.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return ot(r,{expected:Vn.joinValues(n),received:r.parsedType,code:De.invalid_type}),cr}if(uW(this,jU,"f")||cFe(this,jU,new Set(this._def.values),"f"),!uW(this,jU,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return ot(r,{received:r.data,code:De.invalid_enum_value,options:n}),cr}return Xd(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};jU=new WeakMap;sM.create=mFe;uM=class extends qr{constructor(){super(...arguments),DU.set(this,void 0)}_parse(e){let r=Vn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ct.string&&n.parsedType!==ct.number){let o=Vn.objectValues(r);return ot(n,{expected:Vn.joinValues(o),received:n.parsedType,code:De.invalid_type}),cr}if(uW(this,DU,"f")||cFe(this,DU,new Set(Vn.getValidEnumValues(this._def.values)),"f"),!uW(this,DU,"f").has(e.data)){let o=Vn.objectValues(r);return ot(n,{received:n.data,code:De.invalid_enum_value,options:o}),cr}return Xd(e.data)}get enum(){return this._def.values}};DU=new WeakMap;uM.create=(t,e)=>new uM({values:t,typeName:se.ZodNativeEnum,...Br(e)});AP=class extends qr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ct.promise&&r.common.async===!1)return ot(r,{code:De.invalid_type,expected:ct.promise,received:r.parsedType}),cr;let n=r.parsedType===ct.promise?r.data:Promise.resolve(r.data);return Xd(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};AP.create=(t,e)=>new AP({type:t,typeName:se.ZodPromise,...Br(e)});Up=class extends qr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===se.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=>{ot(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 cr;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?cr:u.status==="dirty"||r.value==="dirty"?yN(u.value):u});{if(r.value==="aborted")return cr;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?cr:s.status==="dirty"||r.value==="dirty"?yN(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"?cr:(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"?cr:(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(!YI(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=>YI(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);Vn.assertNever(o)}};Up.create=(t,e,r)=>new Up({schema:t,typeName:se.ZodEffects,effect:e,...Br(r)});Up.createWithPreprocess=(t,e,r)=>new Up({schema:e,effect:{type:"preprocess",transform:t},typeName:se.ZodEffects,...Br(r)});Bf=class extends qr{_parse(e){return this._getType(e)===ct.undefined?Xd(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bf.create=(t,e)=>new Bf({innerType:t,typeName:se.ZodOptional,...Br(e)});eb=class extends qr{_parse(e){return this._getType(e)===ct.null?Xd(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};eb.create=(t,e)=>new eb({innerType:t,typeName:se.ZodNullable,...Br(e)});lM=class extends qr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===ct.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};lM.create=(t,e)=>new lM({innerType:t,typeName:se.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Br(e)});cM=class extends qr{_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 NU(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new qp(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new qp(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};cM.create=(t,e)=>new cM({innerType:t,typeName:se.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Br(e)});xN=class extends qr{_parse(e){if(this._getType(e)!==ct.nan){let n=this._getOrReturnCtx(e);return ot(n,{code:De.invalid_type,expected:ct.nan,received:n.parsedType}),cr}return{status:"valid",value:e.data}}};xN.create=t=>new xN({typeName:se.ZodNaN,...Br(t)});QWt=Symbol("zod_brand"),LU=class extends qr{_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}},FU=class t extends qr{_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"?cr:i.status==="dirty"?(r.dirty(),yN(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"?cr:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:se.ZodPipeline})}},dM=class extends qr{_parse(e){let r=this._def.innerType._parse(e),n=o=>(YI(o)&&(o.value=Object.freeze(o.value)),o);return NU(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};dM.create=(t,e)=>new dM({innerType:t,typeName:se.ZodReadonly,...Br(e)});e9t={object:qf.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"})(se||(se={}));t9t=(t,e={message:`Input not instance of ${t.name}`})=>hFe(r=>r instanceof t,e),gFe=EP.create,yFe=ZI.create,r9t=xN.create,n9t=XI.create,bFe=QI.create,o9t=eM.create,i9t=_N.create,a9t=tM.create,s9t=rM.create,u9t=TP.create,l9t=xx.create,c9t=Pg.create,d9t=vN.create,f9t=Cx.create,p9t=qf.create,m9t=qf.strictCreate,h9t=nM.create,g9t=lW.create,y9t=oM.create,b9t=Qy.create,_9t=cW.create,v9t=wN.create,w9t=SN.create,S9t=dW.create,x9t=iM.create,C9t=aM.create,O9t=sM.create,P9t=uM.create,E9t=AP.create,uFe=Up.create,T9t=Bf.create,A9t=eb.create,I9t=Up.createWithPreprocess,M9t=FU.create,R9t=()=>gFe().optional(),j9t=()=>yFe().optional(),D9t=()=>bFe().optional(),N9t={string:t=>EP.create({...t,coerce:!0}),number:t=>ZI.create({...t,coerce:!0}),boolean:t=>QI.create({...t,coerce:!0}),bigint:t=>XI.create({...t,coerce:!0}),date:t=>eM.create({...t,coerce:!0})},L9t=cr,Ur=Object.freeze({__proto__:null,defaultErrorMap:bN,setErrorMap:IWt,getErrorMap:aW,makeIssue:sW,EMPTY_PATH:MWt,addIssueToContext:ot,ParseStatus:sd,INVALID:cr,DIRTY:yN,OK:Xd,isAborted:Gle,isDirty:Yle,isValid:YI,isAsync:NU,get util(){return Vn},get objectUtil(){return Jle},ZodParsedType:ct,getParsedType:Sx,ZodType:qr,datetimeRegex:pFe,ZodString:EP,ZodNumber:ZI,ZodBigInt:XI,ZodBoolean:QI,ZodDate:eM,ZodSymbol:_N,ZodUndefined:tM,ZodNull:rM,ZodAny:TP,ZodUnknown:xx,ZodNever:Pg,ZodVoid:vN,ZodArray:Cx,ZodObject:qf,ZodUnion:nM,ZodDiscriminatedUnion:lW,ZodIntersection:oM,ZodTuple:Qy,ZodRecord:cW,ZodMap:wN,ZodSet:SN,ZodFunction:dW,ZodLazy:iM,ZodLiteral:aM,ZodEnum:sM,ZodNativeEnum:uM,ZodPromise:AP,ZodEffects:Up,ZodTransformer:Up,ZodOptional:Bf,ZodNullable:eb,ZodDefault:lM,ZodCatch:cM,ZodNaN:xN,BRAND:QWt,ZodBranded:LU,ZodPipeline:FU,ZodReadonly:dM,custom:hFe,Schema:qr,ZodSchema:qr,late:e9t,get ZodFirstPartyTypeKind(){return se},coerce:N9t,any:u9t,array:f9t,bigint:n9t,boolean:bFe,date:o9t,discriminatedUnion:g9t,effect:uFe,enum:O9t,function:S9t,instanceof:t9t,intersection:y9t,lazy:x9t,literal:C9t,map:v9t,nan:r9t,nativeEnum:P9t,never:c9t,null:s9t,nullable:A9t,number:yFe,object:p9t,oboolean:D9t,onumber:j9t,optional:T9t,ostring:R9t,pipeline:M9t,preprocess:I9t,promise:E9t,record:_9t,set:w9t,strictObject:m9t,string:gFe,symbol:i9t,transformer:uFe,tuple:b9t,undefined:a9t,union:h9t,unknown:l9t,void:d9t,NEVER:L9t,ZodIssueCode:De,quotelessJson:AWt,ZodError:qp})});var vFe=v((v0n,_Fe)=>{function Wm(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))}_Fe.exports=Wm;Wm.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Wm.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Wm.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};Wm.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)};Wm.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Wm.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Wm.prototype.start=Wm.prototype.try;Wm.prototype.errors=function(){return this._errors};Wm.prototype.attempts=function(){return this._attempts};Wm.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 wFe=v(fM=>{var F9t=vFe();fM.operation=function(t){var e=fM.timeouts(t);return new F9t(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};fM.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};fM.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};fM.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=fM.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 xFe=v((S0n,SFe)=>{SFe.exports=wFe()});var mW=v((x0n,pW)=>{"use strict";var k9t=xFe(),$9t=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],fW=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}},B9t=(t,e,r)=>{let n=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=n,t},q9t=t=>$9t.includes(t),CFe=(t,e)=>new Promise((r,n)=>{e={onFailedAttempt:()=>{},retries:10,...e};let o=k9t.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 fW)o.stop(),n(a.originalError);else if(a instanceof TypeError&&!q9t(a.message))o.stop(),n(a);else{B9t(a,i,e);try{await e.onFailedAttempt(a)}catch(s){n(s);return}o.retry(a)||n(o.mainError())}}})});pW.exports=CFe;pW.exports.default=CFe;pW.exports.AbortError=fW});var OFe,PFe=O(()=>{OFe=/^(?:[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 U9t(t){return typeof t=="string"&&OFe.test(t)}var IP,EFe=O(()=>{PFe();IP=U9t});function TFe(t,e=0){return(dc[t[e+0]]+dc[t[e+1]]+dc[t[e+2]]+dc[t[e+3]]+"-"+dc[t[e+4]]+dc[t[e+5]]+"-"+dc[t[e+6]]+dc[t[e+7]]+"-"+dc[t[e+8]]+dc[t[e+9]]+"-"+dc[t[e+10]]+dc[t[e+11]]+dc[t[e+12]]+dc[t[e+13]]+dc[t[e+14]]+dc[t[e+15]]).toLowerCase()}var dc,hW,AFe=O(()=>{dc=[];for(hW=0;hW<256;++hW)dc.push((hW+256).toString(16).slice(1))});function Xle(){if(!gW&&(gW=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!gW))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return gW(z9t)}var gW,z9t,IFe=O(()=>{z9t=new Uint8Array(16)});var H9t,Qle,MFe=O(()=>{H9t=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Qle={randomUUID:H9t}});function V9t(t,e,r){if(Qle.randomUUID&&!e&&!t)return Qle.randomUUID();t=t||{};var n=t.random||(t.rng||Xle)();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 TFe(n)}var Za,RFe=O(()=>{MFe();IFe();AFe();Za=V9t});var MP=O(()=>{RFe();EFe()});var DFe=v((L0n,ece)=>{"use strict";var W9t=Object.prototype.hasOwnProperty,Qd="~";function kU(){}Object.create&&(kU.prototype=Object.create(null),new kU().__proto__||(Qd=!1));function K9t(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function jFe(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new K9t(r,n||t,o),a=Qd?Qd+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 bW(t,e){--t._eventsCount===0?t._events=new kU:delete t._events[e]}function ld(){this._events=new kU,this._eventsCount=0}ld.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)W9t.call(r,n)&&e.push(Qd?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};ld.prototype.listeners=function(e){var r=Qd?Qd+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};ld.prototype.listenerCount=function(e){var r=Qd?Qd+e:e,n=this._events[r];return n?n.fn?1:n.length:0};ld.prototype.emit=function(e,r,n,o,i,a){var s=Qd?Qd+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};ld.prototype.on=function(e,r,n){return jFe(this,e,r,n,!1)};ld.prototype.once=function(e,r,n){return jFe(this,e,r,n,!0)};ld.prototype.removeListener=function(e,r,n,o){var i=Qd?Qd+e:e;if(!this._events[i])return this;if(!r)return bW(this,i),this;var a=this._events[i];if(a.fn)a.fn===r&&(!o||a.once)&&(!n||a.context===n)&&bW(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:bW(this,i)}return this};ld.prototype.removeAllListeners=function(e){var r;return e?(r=Qd?Qd+e:e,this._events[r]&&bW(this,r)):(this._events=new kU,this._eventsCount=0),this};ld.prototype.off=ld.prototype.removeListener;ld.prototype.addListener=ld.prototype.on;ld.prefixed=Qd;ld.EventEmitter=ld;typeof ece<"u"&&(ece.exports=ld)});var LFe=v((F0n,NFe)=>{"use strict";NFe.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 kFe=v((k0n,vW)=>{"use strict";var J9t=LFe(),_W=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},FFe=(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 _W(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);J9t(t.then(n,o),()=>{clearTimeout(i)})});vW.exports=FFe;vW.exports.default=FFe;vW.exports.TimeoutError=_W});var $Fe=v(tce=>{"use strict";Object.defineProperty(tce,"__esModule",{value:!0});function G9t(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}tce.default=G9t});var BFe=v(nce=>{"use strict";Object.defineProperty(nce,"__esModule",{value:!0});var Y9t=$Fe(),rce=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=Y9t.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}};nce.default=rce});var SW=v(ice=>{"use strict";Object.defineProperty(ice,"__esModule",{value:!0});var Z9t=DFe(),qFe=kFe(),X9t=BFe(),wW=()=>{},Q9t=new qFe.TimeoutError,oce=class extends Z9t{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=wW,this._resolveIdle=wW,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:X9t.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=wW,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=wW,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():qFe.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(Q9t)});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}};ice.default=oce});var eKt,tKt,Nt,xW=O(()=>{$U();eKt=(...t)=>fetch(...t),tKt=Symbol.for("ls:fetch_implementation"),Nt=t=>async(...e)=>{if(t||Uf("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[tKt]??eKt)(...e);return(t||Uf("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r}});var UFe,CW,rKt,nKt,BU,zFe=O(()=>{UFe=$(mW(),1),CW=$(SW(),1);xW();rKt=[400,401,403,404,405,406,407,408],nKt=[409],BU=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.debug=e.debug,"default"in CW.default?this.queue=new CW.default.default({concurrency:this.maxConcurrency}):this.queue=new CW.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){let n=this.onFailedResponseHook;return this.queue.add(()=>(0,UFe.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(rKt.includes(+a))throw o;if(nKt.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(()=>Nt(this.debug)(...e).then(r=>r.ok?r:Promise.reject(r)))}}});function ace(t){return typeof t?._getType=="function"}function sce(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 HFe=O(()=>{});function zr(t,e){if(!IP(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}var VFe=O(()=>{MP()});function OW(t){WFe[t]||(console.warn(t),WFe[t]=!0)}var WFe,uce=O(()=>{WFe={}});var qU=v((G0n,KFe)=>{var oKt="2.0.0",iKt=Number.MAX_SAFE_INTEGER||9007199254740991,aKt=16,sKt=250,uKt=["major","premajor","minor","preminor","patch","prepatch","prerelease"];KFe.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:aKt,MAX_SAFE_BUILD_LENGTH:sKt,MAX_SAFE_INTEGER:iKt,RELEASE_TYPES:uKt,SEMVER_SPEC_VERSION:oKt,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var UU=v((Y0n,JFe)=>{var lKt=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};JFe.exports=lKt});var CN=v((Ox,GFe)=>{var{MAX_SAFE_COMPONENT_LENGTH:lce,MAX_SAFE_BUILD_LENGTH:cKt,MAX_LENGTH:dKt}=qU(),fKt=UU();Ox=GFe.exports={};var pKt=Ox.re=[],mKt=Ox.safeRe=[],pt=Ox.src=[],mt=Ox.t={},hKt=0,cce="[a-zA-Z0-9-]",gKt=[["\\s",1],["\\d",dKt],[cce,cKt]],yKt=t=>{for(let[e,r]of gKt)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},jr=(t,e,r)=>{let n=yKt(e),o=hKt++;fKt(t,o,e),mt[t]=o,pt[o]=e,pKt[o]=new RegExp(e,r?"g":void 0),mKt[o]=new RegExp(n,r?"g":void 0)};jr("NUMERICIDENTIFIER","0|[1-9]\\d*");jr("NUMERICIDENTIFIERLOOSE","\\d+");jr("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${cce}*`);jr("MAINVERSION",`(${pt[mt.NUMERICIDENTIFIER]})\\.(${pt[mt.NUMERICIDENTIFIER]})\\.(${pt[mt.NUMERICIDENTIFIER]})`);jr("MAINVERSIONLOOSE",`(${pt[mt.NUMERICIDENTIFIERLOOSE]})\\.(${pt[mt.NUMERICIDENTIFIERLOOSE]})\\.(${pt[mt.NUMERICIDENTIFIERLOOSE]})`);jr("PRERELEASEIDENTIFIER",`(?:${pt[mt.NUMERICIDENTIFIER]}|${pt[mt.NONNUMERICIDENTIFIER]})`);jr("PRERELEASEIDENTIFIERLOOSE",`(?:${pt[mt.NUMERICIDENTIFIERLOOSE]}|${pt[mt.NONNUMERICIDENTIFIER]})`);jr("PRERELEASE",`(?:-(${pt[mt.PRERELEASEIDENTIFIER]}(?:\\.${pt[mt.PRERELEASEIDENTIFIER]})*))`);jr("PRERELEASELOOSE",`(?:-?(${pt[mt.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${pt[mt.PRERELEASEIDENTIFIERLOOSE]})*))`);jr("BUILDIDENTIFIER",`${cce}+`);jr("BUILD",`(?:\\+(${pt[mt.BUILDIDENTIFIER]}(?:\\.${pt[mt.BUILDIDENTIFIER]})*))`);jr("FULLPLAIN",`v?${pt[mt.MAINVERSION]}${pt[mt.PRERELEASE]}?${pt[mt.BUILD]}?`);jr("FULL",`^${pt[mt.FULLPLAIN]}$`);jr("LOOSEPLAIN",`[v=\\s]*${pt[mt.MAINVERSIONLOOSE]}${pt[mt.PRERELEASELOOSE]}?${pt[mt.BUILD]}?`);jr("LOOSE",`^${pt[mt.LOOSEPLAIN]}$`);jr("GTLT","((?:<|>)?=?)");jr("XRANGEIDENTIFIERLOOSE",`${pt[mt.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);jr("XRANGEIDENTIFIER",`${pt[mt.NUMERICIDENTIFIER]}|x|X|\\*`);jr("XRANGEPLAIN",`[v=\\s]*(${pt[mt.XRANGEIDENTIFIER]})(?:\\.(${pt[mt.XRANGEIDENTIFIER]})(?:\\.(${pt[mt.XRANGEIDENTIFIER]})(?:${pt[mt.PRERELEASE]})?${pt[mt.BUILD]}?)?)?`);jr("XRANGEPLAINLOOSE",`[v=\\s]*(${pt[mt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${pt[mt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${pt[mt.XRANGEIDENTIFIERLOOSE]})(?:${pt[mt.PRERELEASELOOSE]})?${pt[mt.BUILD]}?)?)?`);jr("XRANGE",`^${pt[mt.GTLT]}\\s*${pt[mt.XRANGEPLAIN]}$`);jr("XRANGELOOSE",`^${pt[mt.GTLT]}\\s*${pt[mt.XRANGEPLAINLOOSE]}$`);jr("COERCEPLAIN",`(^|[^\\d])(\\d{1,${lce}})(?:\\.(\\d{1,${lce}}))?(?:\\.(\\d{1,${lce}}))?`);jr("COERCE",`${pt[mt.COERCEPLAIN]}(?:$|[^\\d])`);jr("COERCEFULL",pt[mt.COERCEPLAIN]+`(?:${pt[mt.PRERELEASE]})?(?:${pt[mt.BUILD]})?(?:$|[^\\d])`);jr("COERCERTL",pt[mt.COERCE],!0);jr("COERCERTLFULL",pt[mt.COERCEFULL],!0);jr("LONETILDE","(?:~>?)");jr("TILDETRIM",`(\\s*)${pt[mt.LONETILDE]}\\s+`,!0);Ox.tildeTrimReplace="$1~";jr("TILDE",`^${pt[mt.LONETILDE]}${pt[mt.XRANGEPLAIN]}$`);jr("TILDELOOSE",`^${pt[mt.LONETILDE]}${pt[mt.XRANGEPLAINLOOSE]}$`);jr("LONECARET","(?:\\^)");jr("CARETTRIM",`(\\s*)${pt[mt.LONECARET]}\\s+`,!0);Ox.caretTrimReplace="$1^";jr("CARET",`^${pt[mt.LONECARET]}${pt[mt.XRANGEPLAIN]}$`);jr("CARETLOOSE",`^${pt[mt.LONECARET]}${pt[mt.XRANGEPLAINLOOSE]}$`);jr("COMPARATORLOOSE",`^${pt[mt.GTLT]}\\s*(${pt[mt.LOOSEPLAIN]})$|^$`);jr("COMPARATOR",`^${pt[mt.GTLT]}\\s*(${pt[mt.FULLPLAIN]})$|^$`);jr("COMPARATORTRIM",`(\\s*)${pt[mt.GTLT]}\\s*(${pt[mt.LOOSEPLAIN]}|${pt[mt.XRANGEPLAIN]})`,!0);Ox.comparatorTrimReplace="$1$2$3";jr("HYPHENRANGE",`^\\s*(${pt[mt.XRANGEPLAIN]})\\s+-\\s+(${pt[mt.XRANGEPLAIN]})\\s*$`);jr("HYPHENRANGELOOSE",`^\\s*(${pt[mt.XRANGEPLAINLOOSE]})\\s+-\\s+(${pt[mt.XRANGEPLAINLOOSE]})\\s*$`);jr("STAR","(<|>)?=?\\s*\\*");jr("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");jr("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var PW=v((Z0n,YFe)=>{var bKt=Object.freeze({loose:!0}),_Kt=Object.freeze({}),vKt=t=>t?typeof t!="object"?bKt:t:_Kt;YFe.exports=vKt});var dce=v((X0n,QFe)=>{var ZFe=/^[0-9]+$/,XFe=(t,e)=>{let r=ZFe.test(t),n=ZFe.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},wKt=(t,e)=>XFe(e,t);QFe.exports={compareIdentifiers:XFe,rcompareIdentifiers:wKt}});var cd=v((Q0n,nke)=>{var EW=UU(),{MAX_LENGTH:eke,MAX_SAFE_INTEGER:TW}=qU(),{safeRe:tke,t:rke}=CN(),SKt=PW(),{compareIdentifiers:ON}=dce(),fce=class t{constructor(e,r){if(r=SKt(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>eke)throw new TypeError(`version is longer than ${eke} characters`);EW("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?tke[rke.LOOSE]:tke[rke.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>TW||this.major<0)throw new TypeError("Invalid major version");if(this.minor>TW||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>TW||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<TW)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(EW("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),ON(this.major,e.major)||ON(this.minor,e.minor)||ON(this.patch,e.patch)}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(EW("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 ON(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(EW("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 ON(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]),ON(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}};nke.exports=fce});var pM=v((eSn,ike)=>{var oke=cd(),xKt=(t,e,r=!1)=>{if(t instanceof oke)return t;try{return new oke(t,e)}catch(n){if(!r)return null;throw n}};ike.exports=xKt});var ske=v((tSn,ake)=>{var CKt=pM(),OKt=(t,e)=>{let r=CKt(t,e);return r?r.version:null};ake.exports=OKt});var lke=v((rSn,uke)=>{var PKt=pM(),EKt=(t,e)=>{let r=PKt(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};uke.exports=EKt});var fke=v((nSn,dke)=>{var cke=cd(),TKt=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new cke(t instanceof cke?t.version:t,r).inc(e,n,o).version}catch{return null}};dke.exports=TKt});var hke=v((oSn,mke)=>{var pke=pM(),AKt=(t,e)=>{let r=pke(t,null,!0),n=pke(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"};mke.exports=AKt});var yke=v((iSn,gke)=>{var IKt=cd(),MKt=(t,e)=>new IKt(t,e).major;gke.exports=MKt});var _ke=v((aSn,bke)=>{var RKt=cd(),jKt=(t,e)=>new RKt(t,e).minor;bke.exports=jKt});var wke=v((sSn,vke)=>{var DKt=cd(),NKt=(t,e)=>new DKt(t,e).patch;vke.exports=NKt});var xke=v((uSn,Ske)=>{var LKt=pM(),FKt=(t,e)=>{let r=LKt(t,e);return r&&r.prerelease.length?r.prerelease:null};Ske.exports=FKt});var Km=v((lSn,Oke)=>{var Cke=cd(),kKt=(t,e,r)=>new Cke(t,r).compare(new Cke(e,r));Oke.exports=kKt});var Eke=v((cSn,Pke)=>{var $Kt=Km(),BKt=(t,e,r)=>$Kt(e,t,r);Pke.exports=BKt});var Ake=v((dSn,Tke)=>{var qKt=Km(),UKt=(t,e)=>qKt(t,e,!0);Tke.exports=UKt});var AW=v((fSn,Mke)=>{var Ike=cd(),zKt=(t,e,r)=>{let n=new Ike(t,r),o=new Ike(e,r);return n.compare(o)||n.compareBuild(o)};Mke.exports=zKt});var jke=v((pSn,Rke)=>{var HKt=AW(),VKt=(t,e)=>t.sort((r,n)=>HKt(r,n,e));Rke.exports=VKt});var Nke=v((mSn,Dke)=>{var WKt=AW(),KKt=(t,e)=>t.sort((r,n)=>WKt(n,r,e));Dke.exports=KKt});var zU=v((hSn,Lke)=>{var JKt=Km(),GKt=(t,e,r)=>JKt(t,e,r)>0;Lke.exports=GKt});var IW=v((gSn,Fke)=>{var YKt=Km(),ZKt=(t,e,r)=>YKt(t,e,r)<0;Fke.exports=ZKt});var pce=v((ySn,kke)=>{var XKt=Km(),QKt=(t,e,r)=>XKt(t,e,r)===0;kke.exports=QKt});var mce=v((bSn,$ke)=>{var eJt=Km(),tJt=(t,e,r)=>eJt(t,e,r)!==0;$ke.exports=tJt});var MW=v((_Sn,Bke)=>{var rJt=Km(),nJt=(t,e,r)=>rJt(t,e,r)>=0;Bke.exports=nJt});var RW=v((vSn,qke)=>{var oJt=Km(),iJt=(t,e,r)=>oJt(t,e,r)<=0;qke.exports=iJt});var hce=v((wSn,Uke)=>{var aJt=pce(),sJt=mce(),uJt=zU(),lJt=MW(),cJt=IW(),dJt=RW(),fJt=(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 aJt(t,r,n);case"!=":return sJt(t,r,n);case">":return uJt(t,r,n);case">=":return lJt(t,r,n);case"<":return cJt(t,r,n);case"<=":return dJt(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};Uke.exports=fJt});var Hke=v((SSn,zke)=>{var pJt=cd(),mJt=pM(),{safeRe:jW,t:DW}=CN(),hJt=(t,e)=>{if(t instanceof pJt)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?jW[DW.COERCEFULL]:jW[DW.COERCE]);else{let u=e.includePrerelease?jW[DW.COERCERTLFULL]:jW[DW.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 mJt(`${n}.${o}.${i}${a}${s}`,e)};zke.exports=hJt});var Wke=v((xSn,Vke)=>{var gce=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}};Vke.exports=gce});var Jm=v((CSn,Yke)=>{var gJt=/\s+/g,yce=class t{constructor(e,r){if(r=bJt(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof bce)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(gJt," "),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=>!Jke(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&&OJt(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&&xJt)|(this.options.loose&&CJt))+":"+e,o=Kke.get(n);if(o)return o;let i=this.options.loose,a=i?zf[ef.HYPHENRANGELOOSE]:zf[ef.HYPHENRANGE];e=e.replace(a,NJt(this.options.includePrerelease)),zi("hyphen replace",e),e=e.replace(zf[ef.COMPARATORTRIM],vJt),zi("comparator trim",e),e=e.replace(zf[ef.TILDETRIM],wJt),zi("tilde trim",e),e=e.replace(zf[ef.CARETTRIM],SJt),zi("caret trim",e);let s=e.split(" ").map(d=>PJt(d,this.options)).join(" ").split(/\s+/).map(d=>DJt(d,this.options));i&&(s=s.filter(d=>(zi("loose invalid filter",d,this.options),!!d.match(zf[ef.COMPARATORLOOSE])))),zi("range list",s);let u=new Map,l=s.map(d=>new bce(d,this.options));for(let d of l){if(Jke(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return Kke.set(n,c),c}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>Gke(n,r)&&e.set.some(o=>Gke(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 _Jt(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(LJt(this.set[r],e,this.options))return!0;return!1}};Yke.exports=yce;var yJt=Wke(),Kke=new yJt,bJt=PW(),bce=HU(),zi=UU(),_Jt=cd(),{safeRe:zf,t:ef,comparatorTrimReplace:vJt,tildeTrimReplace:wJt,caretTrimReplace:SJt}=CN(),{FLAG_INCLUDE_PRERELEASE:xJt,FLAG_LOOSE:CJt}=qU(),Jke=t=>t.value==="<0.0.0-0",OJt=t=>t.value==="",Gke=(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},PJt=(t,e)=>(zi("comp",t,e),t=AJt(t,e),zi("caret",t),t=EJt(t,e),zi("tildes",t),t=MJt(t,e),zi("xrange",t),t=jJt(t,e),zi("stars",t),t),tf=t=>!t||t.toLowerCase()==="x"||t==="*",EJt=(t,e)=>t.trim().split(/\s+/).map(r=>TJt(r,e)).join(" "),TJt=(t,e)=>{let r=e.loose?zf[ef.TILDELOOSE]:zf[ef.TILDE];return t.replace(r,(n,o,i,a,s)=>{zi("tilde",t,n,o,i,a,s);let u;return tf(o)?u="":tf(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:tf(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(zi("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,zi("tilde return",u),u})},AJt=(t,e)=>t.trim().split(/\s+/).map(r=>IJt(r,e)).join(" "),IJt=(t,e)=>{zi("caret",t,e);let r=e.loose?zf[ef.CARETLOOSE]:zf[ef.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{zi("caret",t,o,i,a,s,u);let l;return tf(i)?l="":tf(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:tf(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(zi("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`):(zi("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`),zi("caret return",l),l})},MJt=(t,e)=>(zi("replaceXRanges",t,e),t.split(/\s+/).map(r=>RJt(r,e)).join(" ")),RJt=(t,e)=>{t=t.trim();let r=e.loose?zf[ef.XRANGELOOSE]:zf[ef.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{zi("xRange",t,n,o,i,a,s,u);let l=tf(i),c=l||tf(a),d=c||tf(s),f=d;return o==="="&&f&&(o=""),u=e.includePrerelease?"-0":"",l?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&f?(c&&(a=0),s=0,o===">"?(o=">=",c?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):o==="<="&&(o="<",c?i=+i+1:a=+a+1),o==="<"&&(u="-0"),n=`${o+i}.${a}.${s}${u}`):c?n=`>=${i}.0.0${u} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${u} <${i}.${+a+1}.0-0`),zi("xRange return",n),n})},jJt=(t,e)=>(zi("replaceStars",t,e),t.trim().replace(zf[ef.STAR],"")),DJt=(t,e)=>(zi("replaceGTE0",t,e),t.trim().replace(zf[e.includePrerelease?ef.GTE0PRE:ef.GTE0],"")),NJt=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(tf(n)?r="":tf(o)?r=`>=${n}.0.0${t?"-0":""}`:tf(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,tf(l)?u="":tf(c)?u=`<${+l+1}.0.0-0`:tf(d)?u=`<${l}.${+c+1}.0-0`:f?u=`<=${l}.${c}.${d}-${f}`:t?u=`<${l}.${c}.${+d+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),LJt=(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(zi(t[n].semver),t[n].semver!==bce.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 HU=v((OSn,r$e)=>{var VU=Symbol("SemVer ANY"),wce=class t{static get ANY(){return VU}constructor(e,r){if(r=Zke(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),vce("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===VU?this.value="":this.value=this.operator+this.semver.version,vce("comp",this)}parse(e){let r=this.options.loose?Xke[Qke.COMPARATORLOOSE]:Xke[Qke.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 e$e(n[2],this.options.loose):this.semver=VU}toString(){return this.value}test(e){if(vce("Comparator.test",e,this.options.loose),this.semver===VU||e===VU)return!0;if(typeof e=="string")try{e=new e$e(e,this.options)}catch{return!1}return _ce(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new t$e(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new t$e(this.value,r).test(e.semver):(r=Zke(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("=")||_ce(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||_ce(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};r$e.exports=wce;var Zke=PW(),{safeRe:Xke,t:Qke}=CN(),_ce=hce(),vce=UU(),e$e=cd(),t$e=Jm()});var WU=v((PSn,n$e)=>{var FJt=Jm(),kJt=(t,e,r)=>{try{e=new FJt(e,r)}catch{return!1}return e.test(t)};n$e.exports=kJt});var i$e=v((ESn,o$e)=>{var $Jt=Jm(),BJt=(t,e)=>new $Jt(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));o$e.exports=BJt});var s$e=v((TSn,a$e)=>{var qJt=cd(),UJt=Jm(),zJt=(t,e,r)=>{let n=null,o=null,i=null;try{i=new UJt(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new qJt(n,r))}),n};a$e.exports=zJt});var l$e=v((ASn,u$e)=>{var HJt=cd(),VJt=Jm(),WJt=(t,e,r)=>{let n=null,o=null,i=null;try{i=new VJt(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new HJt(n,r))}),n};u$e.exports=WJt});var f$e=v((ISn,d$e)=>{var Sce=cd(),KJt=Jm(),c$e=zU(),JJt=(t,e)=>{t=new KJt(t,e);let r=new Sce("0.0.0");if(t.test(r)||(r=new Sce("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 Sce(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||c$e(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||c$e(r,i))&&(r=i)}return r&&t.test(r)?r:null};d$e.exports=JJt});var m$e=v((MSn,p$e)=>{var GJt=Jm(),YJt=(t,e)=>{try{return new GJt(t,e).range||"*"}catch{return null}};p$e.exports=YJt});var NW=v((RSn,b$e)=>{var ZJt=cd(),y$e=HU(),{ANY:XJt}=y$e,QJt=Jm(),eGt=WU(),h$e=zU(),g$e=IW(),tGt=RW(),rGt=MW(),nGt=(t,e,r,n)=>{t=new ZJt(t,n),e=new QJt(e,n);let o,i,a,s,u;switch(r){case">":o=h$e,i=tGt,a=g$e,s=">",u=">=";break;case"<":o=g$e,i=rGt,a=h$e,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(eGt(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===XJt&&(p=new y$e(">=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};b$e.exports=nGt});var v$e=v((jSn,_$e)=>{var oGt=NW(),iGt=(t,e,r)=>oGt(t,e,">",r);_$e.exports=iGt});var S$e=v((DSn,w$e)=>{var aGt=NW(),sGt=(t,e,r)=>aGt(t,e,"<",r);w$e.exports=sGt});var O$e=v((NSn,C$e)=>{var x$e=Jm(),uGt=(t,e,r)=>(t=new x$e(t,r),e=new x$e(e,r),t.intersects(e,r));C$e.exports=uGt});var E$e=v((LSn,P$e)=>{var lGt=WU(),cGt=Km();P$e.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>cGt(c,d,r));for(let c of a)lGt(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 j$e=v((FSn,R$e)=>{var T$e=Jm(),Cce=HU(),{ANY:xce}=Cce,KU=WU(),Oce=Km(),dGt=(t,e,r={})=>{if(t===e)return!0;t=new T$e(t,r),e=new T$e(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=pGt(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},fGt=[new Cce(">=0.0.0-0")],A$e=[new Cce(">=0.0.0")],pGt=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===xce){if(e.length===1&&e[0].semver===xce)return!0;r.includePrerelease?t=fGt:t=A$e}if(e.length===1&&e[0].semver===xce){if(r.includePrerelease)return!0;e=A$e}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=I$e(o,p,r):p.operator==="<"||p.operator==="<="?i=M$e(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=Oce(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&&!KU(p,String(o),r)||i&&!KU(p,String(i),r))return null;for(let m of e)if(!KU(p,String(m),r))return!1;return!0}let s,u,l,c,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of e){if(c=c||p.operator===">"||p.operator===">=",l=l||p.operator==="<"||p.operator==="<=",o){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator===">"||p.operator===">="){if(s=I$e(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!KU(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=M$e(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!KU(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)},I$e=(t,e,r)=>{if(!t)return e;let n=Oce(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},M$e=(t,e,r)=>{if(!t)return e;let n=Oce(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};R$e.exports=dGt});var F$e=v((kSn,L$e)=>{var Pce=CN(),D$e=qU(),mGt=cd(),N$e=dce(),hGt=pM(),gGt=ske(),yGt=lke(),bGt=fke(),_Gt=hke(),vGt=yke(),wGt=_ke(),SGt=wke(),xGt=xke(),CGt=Km(),OGt=Eke(),PGt=Ake(),EGt=AW(),TGt=jke(),AGt=Nke(),IGt=zU(),MGt=IW(),RGt=pce(),jGt=mce(),DGt=MW(),NGt=RW(),LGt=hce(),FGt=Hke(),kGt=HU(),$Gt=Jm(),BGt=WU(),qGt=i$e(),UGt=s$e(),zGt=l$e(),HGt=f$e(),VGt=m$e(),WGt=NW(),KGt=v$e(),JGt=S$e(),GGt=O$e(),YGt=E$e(),ZGt=j$e();L$e.exports={parse:hGt,valid:gGt,clean:yGt,inc:bGt,diff:_Gt,major:vGt,minor:wGt,patch:SGt,prerelease:xGt,compare:CGt,rcompare:OGt,compareLoose:PGt,compareBuild:EGt,sort:TGt,rsort:AGt,gt:IGt,lt:MGt,eq:RGt,neq:jGt,gte:DGt,lte:NGt,cmp:LGt,coerce:FGt,Comparator:kGt,Range:$Gt,satisfies:BGt,toComparators:qGt,maxSatisfying:UGt,minSatisfying:zGt,minVersion:HGt,validRange:VGt,outside:WGt,gtr:KGt,ltr:JGt,intersects:GGt,simplifyRange:YGt,subset:ZGt,SemVer:mGt,re:Pce.re,src:Pce.src,tokens:Pce.t,SEMVER_SPEC_VERSION:D$e.SEMVER_SPEC_VERSION,RELEASE_TYPES:D$e.RELEASE_TYPES,compareIdentifiers:N$e.compareIdentifiers,rcompareIdentifiers:N$e.rcompareIdentifiers}});function Px(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 XGt,k$e=O(()=>{XGt=$(F$e(),1)});async function nn(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 Ece(o):new Error(o)}var Ece,$$e=O(()=>{Ece=class extends Error{constructor(e){super(e),this.name="LangSmithConflictError"}}});function t7t(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function LW(t){return e7t.encode(t)}function Hf(t,e,r,n){try{let o=JSON.stringify(t,e,r);return LW(o)}catch(o){if(!o.message?.includes("Converting circular structure to JSON"))return console.warn("[WARNING]: LangSmith received unserializable value."),LW("[Unserializable]");console.warn("[WARNING]: LangSmith received circular JSON. This will decrease tracer performance."),typeof n>"u"&&(n=t7t()),Ace(t,"",0,[],void 0,0,n);let i;try{PN.length===0?i=JSON.stringify(t,e,r):i=JSON.stringify(t,r7t(e),r)}catch{return LW("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;FW.length!==0;){let a=FW.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return LW(i)}}function Tce(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),FW.push([n,r,e,o])):PN.push([e,r,t]):(n[r]=t,FW.push([n,r,e]))}function Ace(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){Tce(QGt,t,e,o);return}if(typeof a.depthLimit<"u"&&i>a.depthLimit){Tce(B$e,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Tce(B$e,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s<t.length;s++)Ace(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];Ace(t[l],l,s,n,t,i,a)}}n.pop()}}function r7t(t){return t=typeof t<"u"?t:function(e,r){return r},function(e,r){if(PN.length>0)for(var n=0;n<PN.length;n++){var o=PN[n];if(o[1]===e&&o[0]===r){r=o[2],PN.splice(n,1);break}}return t.call(this,e,r)}}var B$e,QGt,FW,PN,e7t,q$e=O(()=>{B$e="[...]",QGt={result:"[Circular]"},FW=[],PN=[],e7t=new TextEncoder});function U$e(t){let e=BW(),r=V$e(),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 i7t(t){let e=[];for await(let r of t)e.push(r);return e}function Ice(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function z$e(t){return typeof t=="number"?Number(t.toFixed(4)):t}function H$e(t){return"dataset_id"in t||"dataset_name"in t}var n7t,o7t,a7t,Mce,s7t,u7t,mM,Rce=O(()=>{MP();zFe();HFe();$U();$W();VFe();uce();k$e();$$e();xW();q$e();n7t=t=>{let e=t?.toString()??Uf("TRACING_SAMPLING_RATE");if(e===void 0)return;let r=parseFloat(e);if(r<0||r>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${r}`);return r},o7t=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};a7t=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};Mce=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=Hf(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())]}},s7t=20971520,u7t=2500,mM=class t{constructor(e={}){Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"webUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchIngestCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout_ms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tenantId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filteredPostUuids",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:new Mce}),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:tb("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:tb("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=n7t(e.tracingSamplingRate),this.apiUrl=Ice(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=Ice(e.apiKey??r.apiKey),this.webUrl=Ice(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.timeout_ms=e.timeout_ms??9e4,this.caller=new BU({...e.callerOptions??{},debug:e.debug??this.debug}),this.traceBatchConcurrency=e.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.debug=e.debug??this.debug,this.batchIngestCaller=new BU({maxRetries:2,maxConcurrency:this.traceBatchConcurrency,...e.callerOptions??{},onFailedResponseHook:a7t,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode}static getDefaultClientConfig(){let e=Uf("API_KEY"),r=Uf("ENDPOINT")??"https://api.smith.langchain.com",n=Uf("HIDE_INPUTS")==="true",o=Uf("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:o7t(this.apiUrl)?(this.webUrl="http://localhost:3000",this.webUrl):this.apiUrl.endsWith("/api/v1")?(this.webUrl=this.apiUrl.replace("/api/v1",""),this.webUrl):this.apiUrl.includes("/api")&&!this.apiUrl.split(".",1)[0].endsWith("api")?(this.webUrl=this.apiUrl.replace("/api",""),this.webUrl):this.apiUrl.split(".",1)[0].includes("dev")?(this.webUrl="https://dev.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("eu")?(this.webUrl="https://eu.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("beta")?(this.webUrl="https://beta.smith.langchain.com",this.webUrl):(this.webUrl="https://smith.langchain.com",this.webUrl)}get headers(){let e={"User-Agent":`langsmith-js/${kW}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),e}async processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}async processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}async prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`,i=await this.caller.call(Nt(this.debug),o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(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(Nt(this.debug),a,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(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(Nt(this.debug),`${this.apiUrl}${e}`,{method:n,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)})).json();if(!s||!s[o])break;yield s[o];let u=s.cursors;if(!u||!u.next)break;i.cursor=u.next}}_shouldSample(){return this.tracingSampleRate===void 0?!0:Math.random()<this.tracingSampleRate}_filterForSampling(e,r=!1){if(this.tracingSampleRate===void 0)return e;if(r){let n=[];for(let o of e)this.filteredPostUuids.has(o.id)?this.filteredPostUuids.delete(o.id):n.push(o);return n}else{let n=[];for(let o of e){let i=o.trace_id??o.id;this.filteredPostUuids.has(i)||(o.id===i?this._shouldSample()?n.push(o):this.filteredPostUuids.add(i):n.push(o))}return n}}async _getBatchSizeLimitBytes(){let e=await this._ensureServerInfo();return this.batchSizeBytesLimit??e.batch_ingest_config?.size_limit_bytes??s7t}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=U$e(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 Nt(this.debug)(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(u7t),...this.fetchOptions});await nn(e,"get server info");let r=await e.json();return this.debug&&console.log(`
=== LangSmith Server Configuration ===
`+JSON.stringify(r,null,2)+`
`),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch{console.warn("[WARNING]: LangSmith failed to fetch info on supported operations. Falling back to batch operations and default limits.")}return this._serverInfo??{}})()),this._getServerInfoPromise.then(e=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),e))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let e=await this._getBatchSizeLimitBytes();await this.drainAutoBatchQueue(e)}async createRun(e){if(!this._filterForSampling([e]).length)return;let r={...this.headers,"Content-Type":"application/json"},n=e.project_name;delete e.project_name;let o=await this.prepareRunCreateOrUpdateInputs({session_name:n,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){this.processRunOperation({action:"create",item:o}).catch(console.error);return}let i=U$e(o),a=await this.caller.call(Nt(this.debug),`${this.apiUrl}/runs`,{method:"POST",headers:r,body:Hf(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(a,"create run",!0)}async batchIngestRuns({runCreates:e,runUpdates:r}){if(e===void 0&&r===void 0)return;let n=await Promise.all(e?.map(s=>this.prepareRunCreateOrUpdateInputs(s))??[]),o=await Promise.all(r?.map(s=>this.prepareRunCreateOrUpdateInputs(s))??[]);if(n.length>0&&o.length>0){let s=n.reduce((l,c)=>(c.id&&(l[c.id]=c),l),{}),u=[];for(let l of o)l.id!==void 0&&s[l.id]?s[l.id]={...s[l.id],...l}:u.push(l);n=Object.values(s),o=u}let i={post:n,patch:o};if(!i.post.length&&!i.patch.length)return;let a={post:[],patch:[]};for(let s of["post","patch"]){let u=s,l=i[u].reverse(),c=l.pop();for(;c!==void 0;)a[u].push(c),c=l.pop()}(a.post.length>0||a.patch.length>0)&&await this._postBatchIngestRuns(Hf(a))}async _postBatchIngestRuns(e){let r={...this.headers,"Content-Type":"application/json",Accept:"application/json"},n=await this.batchIngestCaller.call(Nt(this.debug),`${this.apiUrl}/runs/batch`,{method:"POST",headers:r,body:e,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(n,"batch create run",!0)}async multipartIngestRuns({runCreates:e,runUpdates:r}){if(e===void 0&&r===void 0)return;let n={},o=[];for(let c of e??[]){let d=await this.prepareRunCreateOrUpdateInputs(c);d.id!==void 0&&d.attachments!==void 0&&(n[d.id]=d.attachments),delete d.attachments,o.push(d)}let i=[];for(let c of r??[])i.push(await this.prepareRunCreateOrUpdateInputs(c));if(o.find(c=>c.trace_id===void 0||c.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(i.find(c=>c.trace_id===void 0||c.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(o.length>0&&i.length>0){let c=o.reduce((f,p)=>(p.id&&(f[p.id]=p),f),{}),d=[];for(let f of i)f.id!==void 0&&c[f.id]?c[f.id]={...c[f.id],...f}:d.push(f);o=Object.values(c),i=d}if(o.length===0&&i.length===0)return;let u=[],l=[];for(let[c,d]of[["post",o],["patch",i]])for(let f of d){let{inputs:p,outputs:m,events:h,attachments:b,...g}=f,_={inputs:p,outputs:m,events:h},w=Hf(g);l.push({name:`${c}.${g.id}`,payload:new Blob([w],{type:`application/json; length=${w.length}`})});for(let[x,C]of Object.entries(_)){if(C===void 0)continue;let E=Hf(C);l.push({name:`${c}.${g.id}.${x}`,payload:new Blob([E],{type:`application/json; length=${E.length}`})})}if(g.id!==void 0){let x=n[g.id];if(x){delete n[g.id];for(let[C,E]of Object.entries(x)){let P,A;if(Array.isArray(E)?[P,A]=E:(P=E.mimeType,A=E.data),C.includes(".")){console.warn(`Skipping attachment '${C}' for run ${g.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}l.push({name:`attachment.${g.id}.${C}`,payload:new Blob([A],{type:`${P}; length=${A.byteLength}`})})}}}u.push(`trace=${g.trace_id},id=${g.id}`)}await this._sendMultipartRequest(l,u.join("; "))}async _sendMultipartRequest(e,r){try{let n="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),o=[];for(let u of e)o.push(new Blob([`--${n}\r
`])),o.push(new Blob([`Content-Disposition: form-data; name="${u.name}"\r
`,`Content-Type: ${u.payload.type}\r
\r
`])),o.push(u.payload),o.push(new Blob([`\r
`]));o.push(new Blob([`--${n}--\r
`]));let a=await new Blob(o).arrayBuffer(),s=await this.batchIngestCaller.call(Nt(this.debug),`${this.apiUrl}/runs/multipart`,{method:"POST",headers:{...this.headers,"Content-Type":`multipart/form-data; boundary=${n}`},body:a,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(s,"ingest multipart runs",!0)}catch(n){console.warn(`${n.message.trim()}
Context: ${r}`)}}async updateRun(e,r){zr(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let n={...r,id:e};if(!this._filterForSampling([n],!0).length)return;if(this.autoBatchTracing&&n.trace_id!==void 0&&n.dotted_order!==void 0){if(r.end_time!==void 0&&n.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:n}).catch(console.error);return}else this.processRunOperation({action:"update",item:n}).catch(console.error);return}let o={...this.headers,"Content-Type":"application/json"},i=await this.caller.call(Nt(this.debug),`${this.apiUrl}/runs/${e}`,{method:"PATCH",headers:o,body:Hf(r),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(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:Uf("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 i7t(this.listRuns({id:e.child_run_ids})),n={},o={};r.sort((i,a)=>(i?.dotted_order??"").localeCompare(a?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:a,startTime:s,executionOrder:u,isRoot:l,runType:c,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:b,limit:g,select:_}=e,w=[];if(r&&(w=Array.isArray(r)?r:[r]),n){let P=Array.isArray(n)?n:[n],A=await Promise.all(P.map(I=>this.readProject({projectName:I}).then(R=>R.id)));w.push(...A)}let x=["app_path","child_run_ids","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],C={session:w.length?w:null,run_type:c,reference_example:a,query:p,filter:m,trace_filter:h,tree_filter:b,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},E=0;for await(let P of this._getCursorPaginatedList("/runs/query",C))if(g){if(E>=g)break;if(P.length+E>g){yield*P.slice(0,g-E);break}E+=P.length,yield*P}else yield*P}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:a,referenceExampleIds:s,startTime:u,endTime:l,error:c,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:b}){let g=a||[];i&&(g=[...a||[],...await Promise.all(i.map(E=>this.readProject({projectName:E}).then(P=>P.id)))]);let w=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:g,reference_example:s,start_time:u,end_time:l,error:c,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:b}).filter(([E,P])=>P!==void 0));return await(await this.caller.call(Nt(this.debug),`${this.apiUrl}/runs/stats`,{method:"POST",headers:this.headers,body:JSON.stringify(w),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||Za()};zr(e);let i=await(await this.caller.call(Nt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this.headers,body:JSON.stringify(n),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();if(i===null||!("share_token"in i))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${i.share_token}/r`}async unshareRun(e){zr(e);let r=await this.caller.call(Nt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(r,"unshare run",!0)}async readRunSharedLink(e){zr(e);let n=await(await this.caller.call(Nt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();if(!(n===null||!("share_token"in n)))return`${this.getHostUrl()}/public/${n.share_token}/r`}async listSharedRuns(e,{runIds:r}={}){let n=new URLSearchParams({share_token:e});if(r!==void 0)for(let a of r)n.append("id",a);return zr(e),await(await this.caller.call(Nt(this.debug),`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async readDatasetSharedSchema(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id),zr(e);let o=await(await this.caller.call(Nt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();return o.url=`${this.getHostUrl()}/public/${o.share_token}/d`,o}async shareDataset(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id);let n={dataset_id:e};zr(e);let i=await(await this.caller.call(Nt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this.headers,body:JSON.stringify(n),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();return i.url=`${this.getHostUrl()}/public/${i.share_token}/d`,i}async unshareDataset(e){zr(e);let r=await this.caller.call(Nt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(r,"unshare dataset",!0)}async readSharedDataset(e){return zr(e),await(await this.caller.call(Nt(this.debug),`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async listSharedExamples(e,r){let n={};r?.exampleIds&&(n.id=r.exampleIds);let o=new URLSearchParams;Object.entries(n).forEach(([s,u])=>{Array.isArray(u)?u.forEach(l=>o.append(s,l)):o.append(s,u)});let i=await this.caller.call(Nt(this.debug),`${this.apiUrl}/public/${e}/examples?${o.toString()}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions}),a=await i.json();if(!i.ok)throw"detail"in a?new Error(`Failed to list shared examples.
Status: ${i.status}
Message: ${a.detail.join(`
`)}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return a.map(s=>({...s,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:r=null,metadata:n=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:a=null}){let s=o?"?upsert=true":"",u=`${this.apiUrl}/sessions${s}`,l=i||{};n&&(l.metadata=n);let c={name:e,extra:l,description:r};a!==null&&(c.reference_dataset_id=a);let d=await this.caller.call(Nt(this.debug),u,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(c),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(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(Nt(this.debug),s,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(l),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(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(Nt(this.debug),`${this.apiUrl}${n}?${o}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});try{let a=await i.json();return i.ok?Array.isArray(a)?a.length>0:!0:!1}catch{return!1}}async readProject({projectId:e,projectName:r,includeStats:n}){let o="/sessions",i=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)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(Nt(this.debug),`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(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(Nt(this.debug),u,{method:"POST",headers:this.headers,body:l,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(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(Nt(this.debug),`${this.apiUrl}/datasets`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(s),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(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 either datasetName or datasetId");return(await(await this._getResponse(`${n}/${e}/openai_ft`)).text()).trim().split(`
`).map(s=>JSON.parse(s))}async*listDatasets({limit:e=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:a}={}){let s="/datasets",u=new URLSearchParams({limit:e.toString(),offset:r.toString()});if(n!==void 0)for(let l of n)u.append("id",l);o!==void 0&&u.append("name",o),i!==void 0&&u.append("name_contains",i),a!==void 0&&u.append("metadata",JSON.stringify(a));for await(let l of this._getPaginated(s,u))yield*l}async updateDataset(e){let{datasetId:r,datasetName:n,...o}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;zr(i);let a=await this.caller.call(Nt(this.debug),`${this.apiUrl}/datasets/${i}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(o),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(a,"update dataset"),await a.json()}async updateDatasetTag(e){let{datasetId:r,datasetName:n,asOf:o,tag:i}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let a=r??(await this.readDataset({datasetName:n})).id;zr(a);let s=await this.caller.call(Nt(this.debug),`${this.apiUrl}/datasets/${a}/tags`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify({as_of:typeof o=="string"?o:o.toISOString(),tag:i}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(s,"update dataset tags")}async deleteDataset({datasetId:e,datasetName:r}){let n="/datasets",o=e;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(r!==void 0&&(o=(await this.readDataset({datasetName:r})).id),o!==void 0)zr(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");let i=await this.caller.call(Nt(this.debug),this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(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(Nt(this.debug),`${this.apiUrl}/datasets/${o}/index`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(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(Nt(this.debug),`${this.apiUrl}/datasets/${r}/search`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(a,"fetch similar examples"),(await a.json()).examples}async createExample(e,r,n){if(H$e(e)&&(r!==void 0||n!==void 0))throw new Error("Cannot provide outputs or options when using ExampleCreate object");let o=r?n?.datasetId:e.dataset_id,i=r?n?.datasetName:e.dataset_name;if(o===void 0&&i===void 0)throw new Error("Must provide either datasetName or datasetId");if(o!==void 0&&i!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");o===void 0&&(o=(await this.readDataset({datasetName:i})).id);let a=(r?n?.createdAt:e.created_at)||new Date,s;H$e(e)?s=e:s={inputs:e,outputs:r,created_at:a?.toISOString(),id:n?.exampleId,metadata:n?.metadata,split:n?.split,source_run_id:n?.sourceRunId,use_source_run_io:n?.useSourceRunIO,use_source_run_attachments:n?.useSourceRunAttachments,attachments:n?.attachments};let u=await this._uploadExamplesMultipart(o,[s]);return await this.readExample(u.example_ids?.[0]??Za())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let _=e,w=_[0].dataset_id,x=_[0].dataset_name;if(w===void 0&&x===void 0)throw new Error("Must provide either datasetName or datasetId");if(w!==void 0&&x!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");w===void 0&&(w=(await this.readDataset({datasetName:x})).id);let C=await this._uploadExamplesMultipart(w,_);return await Promise.all(C.example_ids.map(P=>this.readExample(P)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:a,useSourceRunIOs:s,useSourceRunAttachments:u,attachments:l,exampleIds:c,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((_,w)=>({dataset_id:p,inputs:_,outputs:n?.[w],metadata:o?.[w],split:i?.[w],id:c?.[w],attachments:l?.[w],source_run_id:a?.[w],use_source_run_io:s?.[w],use_source_run_attachments:u?.[w]})),b=await this._uploadExamplesMultipart(p,h);return await Promise.all(b.example_ids.map(_=>this.readExample(_)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(a=>ace(a)?sce(a):a),i=ace(r)?sce(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,mime_type:l.mime_type},s),{})),a}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:a,metadata:s,limit:u,offset:l,filter:c,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=o?typeof o=="string"?o:o?.toISOString():void 0;m&&p.append("as_of",m);let h=a??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let g of n)p.append("id",g);if(i!==void 0)for(let g of i)p.append("splits",g);if(s!==void 0){let g=JSON.stringify(s);p.append("metadata",g)}u!==void 0&&p.append("limit",u.toString()),l!==void 0&&p.append("offset",l.toString()),c!==void 0&&p.append("filter",c),d===!0&&["attachment_urls","outputs","metadata"].forEach(g=>p.append("select",g));let b=0;for await(let g of this._getPaginated("/examples",p)){for(let _ of g){let{attachment_urls:w,...x}=_,C=x;w&&(C.attachments=Object.entries(w).reduce((E,[P,A])=>(E[P.slice(11)]={presigned_url:A.presigned_url,mime_type:A.mime_type||void 0},E),{})),yield C,b++}if(u!==void 0&&b>=u)break}}async deleteExample(e){zr(e);let r=`/examples/${e}`,n=await this.caller.call(Nt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(n,`delete ${r}`),await n.json()}async updateExample(e,r){let n;r?n=e:n=e.id,zr(n);let o;r?o={id:n,...r}:o=e;let i;return o.dataset_id!==void 0?i=o.dataset_id:i=(await this.readExample(n)).dataset_id,this._updateExamplesMultipart(i,[o])}async updateExamples(e){let r;return e[0].dataset_id===void 0?r=(await this.readExample(e[0].id)).dataset_id:r=e[0].dataset_id,this._updateExamplesMultipart(r,e)}async readDatasetVersion({datasetId:e,datasetName:r,asOf:n,tag:o}){let i;if(e?i=e:i=(await this.readDataset({datasetName:r})).id,zr(i),n&&o||!n&&!o)throw new Error("Exactly one of asOf and tag must be specified.");let a=new URLSearchParams;n!==void 0&&a.append("as_of",typeof n=="string"?n:n.toISOString()),o!==void 0&&a.append("tag",o);let s=await this.caller.call(Nt(this.debug),`${this.apiUrl}/datasets/${i}/version?${a.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(s,"read dataset version"),await s.json()}async listDatasetSplits({datasetId:e,datasetName:r,asOf:n}){let o;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?o=(await this.readDataset({datasetName:r})).id:o=e,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(Nt(this.debug),`${this.apiUrl}/datasets/${a}/splits`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(s),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(u,"update dataset splits",!0)}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){OW("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let a;if(typeof e=="string")a=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)a=e;else throw new Error(`Invalid run type: ${typeof e}`);a.reference_example_id!==null&&a.reference_example_id!==void 0&&(i=await this.readExample(a.reference_example_id));let s=await r.evaluateRun(a,i),[u,l]=await this._logEvaluationFeedback(s,a,n);return l[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:a,sourceInfo:s,feedbackSourceType:u="api",sourceRunId:l,feedbackId:c,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:u??"api",metadata:s??{}};l!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:l}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&zr(m.metadata.__run.run_id);let h={id:c??Za(),run_id:e,key:r,score:z$e(n),value:o,correction:i,comment:a,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},b=`${this.apiUrl}/feedback`,g=await this.caller.call(Nt(this.debug),b,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(h),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(g,"create feedback",!0),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let a={};r!=null&&(a.score=z$e(r)),n!=null&&(a.value=n),o!=null&&(a.correction=o),i!=null&&(a.comment=i),zr(e);let s=await this.caller.call(Nt(this.debug),`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(a),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(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(Nt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(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(Nt(this.debug),`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async createComparativeExperiment({name:e,experimentIds:r,referenceDatasetId:n,createdAt:o,description:i,metadata:a,id:s}){if(r.length===0)throw new Error("At least one experiment is required");if(n||(n=(await this.readProject({projectId:r[0]})).reference_dataset_id),!n==null)throw new Error("A reference dataset is required");let u={id:s,name:e,experiment_ids:r,reference_dataset_id:n,description:i,created_at:(o??new Date)?.toISOString(),extra:{}};return a&&(u.extra.metadata=a),await(await this.caller.call(Nt(this.debug),`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(u),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async*listPresignedFeedbackTokens(e){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:Array.isArray(e)?r=e:r=[e],r}async _logEvaluationFeedback(e,r,n){let o=this._selectEvalResults(e),i=[];for(let a of o){let s=n||{};a.evaluatorInfo&&(s={...a.evaluatorInfo,...s});let u=null;a.targetRunId?u=a.targetRunId:r&&(u=r.id),i.push(await this.createFeedback(u,a.key,{score:a.score,value:a.value,comment:a.comment,correction:a.correction,sourceInfo:s,sourceRunId:a.sourceRunId,feedbackConfig:a.feedbackConfig,feedbackSourceType:"model"}))}return[o,i]}async logEvaluationFeedback(e,r,n){let[o]=await this._logEvaluationFeedback(e,r,n);return o}async*listAnnotationQueues(e={}){let{queueIds:r,name:n,nameContains:o,limit:i}=e,a=new URLSearchParams;r&&r.forEach((u,l)=>{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||Za()},a=await this.caller.call(Nt(this.debug),`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(Object.fromEntries(Object.entries(i).filter(([u,l])=>l!==void 0))),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(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(Nt(this.debug),`${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 nn(i,"update annotation queue")}async deleteAnnotationQueue(e){let r=await this.caller.call(Nt(this.debug),`${this.apiUrl}/annotation-queues/${zr(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(r,"delete annotation queue")}async addRunsToAnnotationQueue(e,r){let n=await this.caller.call(Nt(this.debug),`${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 nn(n,"add runs to annotation queue")}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${zr(e,"queueId")}/run`,o=await this.caller.call(Nt(this.debug),`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(o,"get run from annotation queue"),await o.json()}async deleteRunFromAnnotationQueue(e,r){let n=await this.caller.call(Nt(this.debug),`${this.apiUrl}/annotation-queues/${zr(e,"queueId")}/runs/${zr(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(n,"delete run from annotation queue")}async getSizeFromAnnotationQueue(e){let r=await this.caller.call(Nt(this.debug),`${this.apiUrl}/annotation-queues/${zr(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(r,"get size from annotation queue"),await r.json()}async _currentTenantIsOwner(e){let r=await this._getSettings();return e=="-"||r.tenant_handle===e}async _ownerConflictError(e,r){let n=await this._getSettings();return new Error(`Cannot ${e} for another tenant.
Current tenant: ${n.tenant_handle}
Requested tenant: ${r}`)}async _getLatestCommitHash(e){let r=await this.caller.call(Nt(this.debug),`${this.apiUrl}/commits/${e}/?limit=1&offset=0`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions}),n=await r.json();if(!r.ok){let o=typeof n.detail=="string"?n.detail:JSON.stringify(n.detail),i=new Error(`Error ${r.status}: ${r.statusText}
${o}`);throw i.statusCode=r.status,i}if(n.commits.length!==0)return n.commits[0].commit_hash}async _likeOrUnlikePrompt(e,r){let[n,o,i]=Px(e),a=await this.caller.call(Nt(this.debug),`${this.apiUrl}/likes/${n}/${o}`,{method:"POST",body:JSON.stringify({like:r}),headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(a,`${r?"like":"unlike"} prompt`),await a.json()}async _getPromptUrl(e){let[r,n,o]=Px(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]=Px(e),i=await this.caller.call(Nt(this.debug),`${this.apiUrl}/repos/${r}/${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});if(i.status===404)return null;await nn(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]=Px(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(Nt(this.debug),`${this.apiUrl}/repos/`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(s),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(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]=Px(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(Nt(this.debug),`${this.apiUrl}/commits/${o}/${i}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(u),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(l,"create commit");let c=await l.json();return this._getPromptUrl(`${o}/${i}${c.commit_hash?`:${c.commit_hash}`:""}`)}async updateExamplesMultipart(e,r=[]){return this._updateExamplesMultipart(e,r)}async _updateExamplesMultipart(e,r=[]){if(!await this._getMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let s of r){let u=s.id,l={...s.metadata&&{metadata:s.metadata},...s.split&&{split:s.split}},c=Hf(l),d=new Blob([c],{type:"application/json"});if(n.append(u,d),s.inputs){let f=Hf(s.inputs),p=new Blob([f],{type:"application/json"});n.append(`${u}.inputs`,p)}if(s.outputs){let f=Hf(s.outputs),p=new Blob([f],{type:"application/json"});n.append(`${u}.outputs`,p)}if(s.attachments)for(let[f,p]of Object.entries(s.attachments)){let m,h;Array.isArray(p)?[m,h]=p:(m=p.mimeType,h=p.data);let b=new Blob([h],{type:`${m}; length=${h.byteLength}`});n.append(`${u}.attachment.${f}`,b)}if(s.attachments_operations){let f=Hf(s.attachments_operations),p=new Blob([f],{type:"application/json"});n.append(`${u}.attachments_operations`,p)}}let o=e??r[0]?.dataset_id;return await(await this.caller.call(Nt(this.debug),`${this.apiUrl}/v1/platform/datasets/${o}/examples`,{method:"PATCH",headers:this.headers,body:n})).json()}async uploadExamplesMultipart(e,r=[]){return this._uploadExamplesMultipart(e,r)}async _uploadExamplesMultipart(e,r=[]){if(!await this._getMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let a of r){let s=(a.id??Za()).toString(),u={created_at:a.created_at,...a.metadata&&{metadata:a.metadata},...a.split&&{split:a.split},...a.source_run_id&&{source_run_id:a.source_run_id},...a.use_source_run_io&&{use_source_run_io:a.use_source_run_io},...a.use_source_run_attachments&&{use_source_run_attachments:a.use_source_run_attachments}},l=Hf(u),c=new Blob([l],{type:"application/json"});if(n.append(s,c),a.inputs){let d=Hf(a.inputs),f=new Blob([d],{type:"application/json"});n.append(`${s}.inputs`,f)}if(a.outputs){let d=Hf(a.outputs),f=new Blob([d],{type:"application/json"});n.append(`${s}.outputs`,f)}if(a.attachments)for(let[d,f]of Object.entries(a.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${s}.attachment.${d}`,h)}}let o=await this.caller.call(Nt(this.debug),`${this.apiUrl}/v1/platform/datasets/${e}/examples`,{method:"POST",headers:this.headers,body:n});return await nn(o,"upload examples"),await o.json()}async updatePrompt(e,r){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[n,o]=Px(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(Nt(this.debug),`${this.apiUrl}/repos/${n}/${o}`,{method:"PATCH",body:JSON.stringify(i),headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await nn(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]=Px(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return await(await this.caller.call(Nt(this.debug),`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async pullPromptCommit(e,r){let[n,o,i]=Px(e),a=await this.caller.call(Nt(this.debug),`${this.apiUrl}/commits/${n}/${o}/${i}${r?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await nn(a,"pull prompt commit");let s=await a.json();return{owner:n,repo:o,commit_hash:s.commit_hash,manifest:s.manifest,examples:s.examples}}async _pullPrompt(e,r){let n=await this.pullPromptCommit(e,{includeModel:r?.includeModel});return JSON.stringify(n.manifest)}async pushPrompt(e,r){return await this.promptExists(e)?r&&Object.keys(r).some(o=>o!=="object")&&await this.updatePrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}):await this.createPrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}),r?.object?await this.createCommit(e,r?.object,{parentCommitHash:r?.parentCommitHash}):await this._getPromptUrl(e)}async clonePublicDataset(e,r={}){let{sourceApiUrl:n=this.apiUrl,datasetName:o}=r,[i,a]=this.parseTokenOrUrl(e,n),s=new t({apiUrl:i,apiKey:"placeholder"}),u=await s.readSharedDataset(a),l=o||u.name;try{if(await this.hasDataset({datasetId:l})){console.log(`Dataset ${l} already exists in your tenant. Skipping.`);return}}catch{}let c=await s.listSharedExamples(a),d=await this.createDataset(l,{description:u.description,dataType:u.data_type||"kv",inputsSchema:u.inputs_schema_definition??void 0,outputsSchema:u.outputs_schema_definition??void 0});try{await this.createExamples({inputs:c.map(f=>f.inputs),outputs:c.flatMap(f=>f.outputs?[f.outputs]:[]),datasetId:d.id})}catch(f){throw console.error(`An error occurred while creating dataset ${l}. You should delete it manually.`),f}}parseTokenOrUrl(e,r,n=2,o="dataset"){try{return 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 kW,$W=O(()=>{Rce();qW();xW();kW="0.3.20"});function BW(){if(jce===void 0){let t=p7t(),e=h7t();jce={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:kW,...e}}return jce}function V$e(){let t=m7t()||{},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 m7t(){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 tb(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function Uf(t){return tb(`LANGSMITH_${t}`)||tb(`LANGCHAIN_${t}`)}function h7t(){if(Dce!==void 0)return Dce;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=tb(r);n!==void 0&&(e[r]=n)}return Dce=e,e}var Tx,l7t,c7t,d7t,W$e,f7t,p7t,jce,Dce,$U=O(()=>{$W();l7t=()=>typeof window<"u"&&typeof window.document<"u",c7t=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",d7t=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),W$e=()=>typeof Deno<"u",f7t=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!W$e(),p7t=()=>Tx||(l7t()?Tx="browser":f7t()?Tx="node":c7t()?Tx="webworker":d7t()?Tx="jsdom":W$e()?Tx="deno":Tx="other",Tx)});var K$e,J$e=O(()=>{$U();K$e=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>Uf(r)==="true")});var UW,G$e=O(()=>{UW=Symbol.for("lc:context_variables")});function g7t(t){return t.replace(/[-:.]/g,"")}function y7t(t,e,r=1){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return g7t(`${new Date(t).toISOString().slice(0,-1)}${n}Z`)+e}function HW(t){return t!==void 0&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function Z$e(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function Y$e(t){return Array.isArray(t)&&t.some(e=>Z$e(e))}function b7t(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function _7t(t){return t!==void 0&&typeof t.callbacks=="object"&&(Y$e(t.callbacks?.handlers)||Y$e(t.callbacks))}var zW,Ex,qW=O(()=>{MP();$U();Rce();J$e();uce();G$e();zW=class t{constructor(e,r,n){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n}static fromHeader(e){let r=e.split(","),n={},o=[],i;for(let a of r){let[s,u]=a.split("="),l=decodeURIComponent(u);s==="langsmith-metadata"?n=JSON.parse(l):s==="langsmith-tags"?o=l.split(","):s==="langsmith-project"&&(i=l)}return new t(n,o,i)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}},Ex=class t{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),HW(e)){Object.assign(this,{...e});return}let r=t.getDefaultConfig(),{metadata:n,...o}=e,i=o.client??t.getSharedClient(),a={...n,...o?.extra?.metadata};if(o.extra={...o.extra,metadata:a},Object.assign(this,{...r,...o,client:i}),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.execution_order??(this.execution_order=1),this.child_execution_order??(this.child_execution_order=1),!this.dotted_order){let s=y7t(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:Za(),run_type:"chain",project_name:Uf("PROJECT")??tb("LANGCHAIN_SESSION")??"default",child_runs:[],api_url:tb("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:tb("LANGCHAIN_API_KEY"),caller_options:{},start_time:Date.now(),serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new mM),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=new t({...e,parent_run:this,project_name:this.project_name,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});UW in this&&(n[UW]=this[UW]);let o=Symbol.for("lc:child_config"),i=e.extra?.[o]??this.extra[o];if(_7t(i)){let u={...i},l=b7t(u.callbacks)?u.callbacks.copy?.():void 0;l&&(Object.assign(l,{_parentRunId:n.id}),l.handlers?.find(Z$e)?.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=BW(),n=await this._convertToCreate(this,r,!0);if(await this.client.createRun(n),!e){OW("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let o of this.child_runs)await o.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(){try{let e={end_time:this.end_time,error:this.error,inputs:this.inputs,outputs:this.outputs,parent_run_id:this.parent_run?.id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};await this.client.updateRun(this.id,e)}catch(e){console.error(`Error in patchRun for run ${this.id}`,e)}}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(e){this.events||(this.events=[]),typeof e=="string"?this.events.push({name:"event",time:new Date().toISOString(),message:e}):this.events.push({...e,time:e.time??new Date().toISOString()})}static fromRunnableConfig(e,r){let n=e?.callbacks,o,i,a,s=K$e();if(n){let l=n?.getParentRunId?.()??"",c=n?.handlers?.find(d=>d?.name=="langchain_tracer");o=c?.getRun?.(l),i=c?.projectName,a=c?.client,s=s||!!c}return o?new t({name:o.name,id:o.id,trace_id:o.trace_id,dotted_order:o.dotted_order,client:a,tracingEnabled:s,project_name:i,tags:[...new Set((o?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...o?.extra?.metadata,...e?.metadata}}}).createChild(r):new t({...r,client:a,tracingEnabled:s,project_name:i})}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,r){let n="get"in e&&typeof e.get=="function"?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,o=n["langsmith-trace"];if(!o||typeof o!="string")return;let i=o.trim(),a=i.split(".").map(l=>{let[c,d]=l.split("Z");return{strTime:c,time:Date.parse(c+"Z"),uuid:d}}),s=a[0].uuid,u={...r,name:r?.name??"parent",run_type:r?.run_type??"chain",start_time:r?.start_time??Date.now(),id:a.at(-1)?.uuid,trace_id:s,dotted_order:i};if(n.baggage&&typeof n.baggage=="string"){let l=zW.fromHeader(n.baggage);u.metadata=l.metadata,u.tags=l.tags,u.project_name=l.project_name}return new t(u)}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new zW(this.extra?.metadata,this.tags,this.project_name).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(Ex,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});function VW(t){return typeof t=="function"&&"langsmith:traceable"in t}var Lce,Nce,v7t,Fce,w7t,X$e,gxn,Q$e=O(()=>{qW();Lce=class{getStore(){}run(e,r){return r()}},Nce=Symbol.for("ls:tracing_async_local_storage"),v7t=new Lce,Fce=class{getInstance(){return globalThis[Nce]??v7t}initializeGlobalInstance(e){globalThis[Nce]===void 0&&(globalThis[Nce]=e)}},w7t=new Fce,X$e=()=>{let t=w7t.getInstance().getStore();if(!HW(t))throw new Error(["Could not get the current run tree.","","Please make sure you are calling this method within a traceable function and that tracing is enabled."].join(`
`));return t},gxn=Symbol.for("langsmith:traceable:root")});var kce=O(()=>{Q$e()});function KW(t,e){return S7t.call(t,e)}function JW(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)KW(t,r)&&e.push(r);return e}function dd(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function GW(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 rb(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function JU(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function WW(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(WW(t[r]))return!0}else if(typeof t=="object"){let r=JW(t),n=r.length;for(var e=0;e<n;e++)if(WW(t[r[e]]))return!0}}return!1}function eBe(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 S7t,hM,GU=O(()=>{S7t=Object.prototype.hasOwnProperty;hM=class extends Error{constructor(e,r,n,o,i){super(eBe(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=eBe(e,{name:r,index:n,operation:o,tree:i})}}});var $ce={};$f($ce,{JsonPatchError:()=>Xa,_areEquals:()=>YU,applyOperation:()=>gM,applyPatch:()=>RP,applyReducer:()=>O7t,deepClone:()=>x7t,getValueByPointer:()=>YW,validate:()=>tBe,validator:()=>ZW});function YW(t,e){if(e=="")return t;var r={op:"_get",path:e};return gM(t,r),r.value}function gM(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):ZW(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=YW(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=YU(t,e.value),a.test===!1)throw new Xa("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 Xa("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=dd(t));let s=(e.path||"").split("/"),u=t,l=1,c=s.length,d,f,p;for(typeof r=="function"?p=r:p=ZW;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=JU(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&&!GW(f))throw new Xa("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);GW(f)&&(f=~~f)}if(l>=c){if(r&&e.op==="add"&&f>u.length)throw new Xa("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let m=C7t[e.op].call(e,u,f,t);if(m.test===!1)throw new Xa("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(l>=c){let m=EN[e.op].call(e,u,f,t);if(m.test===!1)throw new Xa("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(u=u[f],r&&l<c&&(!u||typeof u!="object"))throw new Xa("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,t)}}}function RP(t,e,r,n=!0,o=!0){if(r&&!Array.isArray(e))throw new Xa("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=dd(t));let i=new Array(e.length);for(let a=0,s=e.length;a<s;a++)i[a]=gM(t,e[a],r,!0,o,a),t=i[a].newDocument;return i.newDocument=t,i}function O7t(t,e,r){let n=gM(t,e);if(n.test===!1)throw new Xa("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function ZW(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new Xa("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(EN[t.op]){if(typeof t.path!="string")throw new Xa("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new Xa('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 Xa("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 Xa("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")&&WW(t.value))throw new Xa("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 Xa("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 Xa("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=tBe([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Xa("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new Xa("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function tBe(t,e,r){try{if(!Array.isArray(t))throw new Xa("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)RP(dd(e),dd(t),r||!0);else{r=r||ZW;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(o){if(o instanceof Xa)return o;throw o}}function YU(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(!YU(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],!YU(t[a],e[a]))return!1;return!0}return t!==t&&e!==e}var Xa,x7t,EN,C7t,XW=O(()=>{GU();Xa=hM,x7t=dd,EN={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=YW(r,this.path);n&&(n=dd(n));let o=gM(r,{op:"remove",path:this.from}).removed;return gM(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=YW(r,this.from);return gM(r,{op:"add",path:this.path,value:dd(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:YU(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},C7t={add:function(t,e,r){return GW(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:EN.move,copy:EN.copy,test:EN.test,_get:EN._get}});function rBe(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=JW(e),a=JW(t),s=!1,u=!1,l=a.length-1;l>=0;l--){var c=a[l],d=t[c];if(KW(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)?rBe(d,f,r,n+"/"+rb(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+rb(c),value:dd(d)}),r.push({op:"replace",path:n+"/"+rb(c),value:dd(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+rb(c),value:dd(d)}),r.push({op:"remove",path:n+"/"+rb(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];!KW(t,c)&&e[c]!==void 0&&r.push({op:"add",path:n+"/"+rb(c),value:dd(e[c])})}}}function QW(t,e,r=!1){var n=[];return rBe(t,e,n,"",r),n}var nBe=O(()=>{GU();XW();});var Pxn,Bce=O(()=>{XW();nBe();GU();XW();GU();Pxn={...$ce,JsonPatchError:hM,deepClone:dd,escapePathComponent:rb,unescapePathComponent:JU}});var iBe=v((Mxn,oBe)=>{"use strict";oBe.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 fBe=v((Rxn,qce)=>{"use strict";var P7t=/[\p{Lu}]/u,E7t=/[\p{Ll}]/u,aBe=/^[\p{Lu}](?![\p{Lu}])/gu,lBe=/([\p{Alpha}\p{N}_]|$)/u,cBe=/[_.\- ]+/,T7t=new RegExp("^"+cBe.source),sBe=new RegExp(cBe.source+lBe.source,"gu"),uBe=new RegExp("\\d+"+lBe.source,"gu"),A7t=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a<t.length;a++){let s=t[a];n&&P7t.test(s)?(t=t.slice(0,a)+"-"+t.slice(a),n=!1,i=o,o=!0,a++):o&&i&&E7t.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},I7t=(t,e)=>(aBe.lastIndex=0,t.replace(aBe,r=>e(r))),M7t=(t,e)=>(sBe.lastIndex=0,uBe.lastIndex=0,t.replace(sBe,(r,n)=>e(n)).replace(uBe,r=>e(r))),dBe=(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=A7t(t,r,n)),t=t.replace(T7t,""),e.preserveConsecutiveUppercase?t=I7t(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),M7t(t,n))};qce.exports=dBe;qce.exports.default=dBe});function mBe(t,e){return e?.[t]||(0,pBe.default)(t)}function hBe(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var pBe,R7t,gBe=O(()=>{pBe=$(iBe(),1),R7t=$(fBe(),1)});function yBe(t){return Array.isArray(t)?[...t]:{...t}}function j7t(t,e){let r=yBe(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]=yBe(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function Uce(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 Vf,yM=O(()=>{gBe();Vf=class t{static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Uce(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof t||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((o,i)=>(o[i]=i in this?this[i]:this.lc_kwargs[i],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(e,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));return Object.keys(r).forEach(o=>{let i=this,a=n,[s,...u]=o.split(".").reverse();for(let l of u.reverse()){if(!(l in i)||i[l]===void 0)return;(!(l in a)||a[l]===void 0)&&(typeof i[l]=="object"&&i[l]!=null?a[l]={}:Array.isArray(i[l])&&(a[l]=[])),i=i[l],a=a[l]}s in i&&i[s]!==void 0&&(a[s]=a[s]||i[s])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:hBe(Object.keys(r).length?j7t(n,r):n,mBe,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});async function bBe(){return zce===void 0&&(zce={library:"langchain-js",runtime:e9()}),zce}function et(t){try{return typeof process<"u"?process.env?.[t]:Hce()?Deno?.env.get(t):void 0}catch{return}}var D7t,N7t,L7t,Hce,F7t,e9,zce,bM=O(()=>{D7t=()=>typeof window<"u"&&typeof window.document<"u",N7t=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",L7t=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),Hce=()=>typeof Deno<"u",F7t=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!Hce(),e9=()=>{let t;return D7t()?t="browser":F7t()?t="node":N7t()?t="webworker":L7t()?t="jsdom":Hce()?t="deno":t="other",t}});function Wce(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var Vce,_M,_Be,ZU=O(()=>{MP();yM();bM();Vce=class{};_M=class t extends Vce{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,Uce(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:et("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 Vf.prototype.toJSON.call(this)}toJSONNotImplemented(){return Vf.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class r extends t{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:Za()}),Object.assign(this,e)}}return new r}},_Be=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});function Kce(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function k7t(t){return t.replace(/[-:.]/g,"")}function $7t(t,e,r){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return k7t(`${new Date(t).toISOString().slice(0,-1)}${n}Z`)+e}function TN(t){return typeof t._addRunToRunMap=="function"}var Gm,vM=O(()=>{ZU();Gm=class extends _M{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=$7t(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=Kce(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=Kce(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=Kce(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 xBe=v((Uxn,SBe)=>{"use strict";var vBe=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,wBe=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function B7t(){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=vBe(),e.color.ansi16m=wBe(),e.bgColor.ansi256=vBe(10),e.bgColor.ansi16m=wBe(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(SBe,"exports",{enumerable:!0,get:B7t})});function rf(t,e){return`${t.open}${e}${t.close}`}function Ym(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function CBe(t){return typeof t=="string"?t.trim():t==null?t:Ym(t,t.toString())}function jP(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 Jce,Wf,XU,OBe=O(()=>{Jce=$(xBe(),1);vM();({color:Wf}=Jce.default),XU=class extends Gm{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?rf(Jce.default.bold,s):s}).join(" > ");return rf(Wf.grey,n)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${rf(Wf.green,"[chain/start]")} [${r}] Entering Chain run with input: ${Ym(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${rf(Wf.cyan,"[chain/end]")} [${r}] [${jP(e)}] Exiting Chain run with output: ${Ym(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${rf(Wf.red,"[chain/error]")} [${r}] [${jP(e)}] Chain run errored with error: ${Ym(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(`${rf(Wf.green,"[llm/start]")} [${r}] Entering LLM run with input: ${Ym(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${rf(Wf.cyan,"[llm/end]")} [${r}] [${jP(e)}] Exiting LLM run with output: ${Ym(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${rf(Wf.red,"[llm/error]")} [${r}] [${jP(e)}] LLM run errored with error: ${Ym(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${rf(Wf.green,"[tool/start]")} [${r}] Entering Tool run with input: "${CBe(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${rf(Wf.cyan,"[tool/end]")} [${r}] [${jP(e)}] Exiting Tool run with output: "${CBe(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${rf(Wf.red,"[tool/error]")} [${r}] [${jP(e)}] Tool run errored with error: ${Ym(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${rf(Wf.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${Ym(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${rf(Wf.cyan,"[retriever/end]")} [${r}] [${jP(e)}] Exiting Retriever run with output: ${Ym(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${rf(Wf.red,"[retriever/error]")} [${r}] [${jP(e)}] Retriever run errored with error: ${Ym(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${rf(Wf.blue,"[agent/action]")} [${n}] Agent selected action: ${Ym(r.actions[r.actions.length-1],"[action]")}`)}}});function DP(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var QU=O(()=>{});function NP(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function PBe(t){return!!(t&&typeof t=="object"&&"toolCall"in t&&t.toolCall!=null&&typeof t.toolCall=="object"&&"id"in t.toolCall&&typeof t.toolCall.id=="string")}var wM,t9=O(()=>{wM=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 Gce(t,e=AN){t=t.trim();let r=t.indexOf("```");if(r===-1)return e(t);let n=t.substring(r+3);n.startsWith(`json
`)?n=n.substring(5):n.startsWith("json")?n=n.substring(4):n.startsWith(`
`)&&(n=n.substring(1));let o=n.indexOf("```"),i=n;return o!==-1&&(i=n.substring(0,o)),e(i.trim())}function AN(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 Yce=O(()=>{});function LP(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function EBe(t){return LP(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function TBe(t){return LP(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function ABe(t){if(LP(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function Zce({dataUrl:t,asTypedArray:e=!1}){let r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let o=e?Uint8Array.from(atob(r[2]),i=>i.charCodeAt(0)):r[2];return{mime_type:n,data:o}}}function IBe(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}var Xce=O(()=>{});function Zm(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.some(r=>LP(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?ez(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>LP(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function MBe(t,e){return t==="error"||e==="error"?"error":"success"}function q7t(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 ds(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]=ds(r[n],o);else if(Array.isArray(r[n]))r[n]=ez(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 ez(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]=ds(r[o],n):r.push(n)}else{if(typeof n=="object"&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function RBe(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 ez(t,e);if(typeof t=="object"&&typeof e=="object")return ds(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types.
Left ${t}
Right ${e}`)}function jBe(t){return typeof t.role=="string"}function Xm(t){return typeof t?._getType=="function"}function Qce(t){return Xm(t)&&typeof t.concat=="function"}var ul,Kf,Qm=O(()=>{yM();Xce();ul=class extends Vf{get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(e=>typeof e=="string"?e:e.type==="text"?e.text:"").join(""):""}getType(){return this._getType()}constructor(e,r){typeof e=="string"&&(e={content:e,additional_kwargs:r,response_metadata:{}}),e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","messages"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"additional_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"response_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.content=e.content,this.additional_kwargs=e.additional_kwargs,this.response_metadata=e.response_metadata,this.id=e.id}toDict(){return{type:this._getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(e===null)return this;let r=q7t(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}};Kf=class extends ul{}});function DBe(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function NBe(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 Ax,eh,IN=O(()=>{Qm();Ax=class extends ul{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}}},eh=class t extends Kf{constructor(e){super(e),Object.defineProperty(this,"tool_call_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"artifact",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}static lc_name(){return"ToolMessageChunk"}_getType(){return"tool"}concat(e){return new t({content:Zm(this.content,e.content),additional_kwargs:ds(this.additional_kwargs,e.additional_kwargs),response_metadata:ds(this.response_metadata,e.response_metadata),artifact:RBe(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:MBe(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function hi(t){return t._getType()==="ai"}function ede(t){return t._getType()==="ai"}var fn,or,SM=O(()=>{Yce();Qm();IN();fn=class extends ul{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]=NBe(o);n.tool_calls=a??[],n.invalid_tool_calls=s??[]}else n.tool_calls=n.tool_calls??[],n.invalid_tool_calls=n.invalid_tool_calls??[]}catch{n.tool_calls=[],n.invalid_tool_calls=[]}}super(n),Object.defineProperty(this,"tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"invalid_tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"usage_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),typeof n!="string"&&(this.tool_calls=n.tool_calls??this.tool_calls,this.invalid_tool_calls=n.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=n.usage_metadata}static lc_name(){return"AIMessage"}_getType(){return"ai"}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}};or=class t extends Kf{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=AN(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:Zm(this.content,e.content),additional_kwargs:ds(this.additional_kwargs,e.additional_kwargs),response_metadata:ds(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=ez(this.tool_call_chunks,e.tool_call_chunks);n!==void 0&&n.length>0&&(r.tool_call_chunks=n)}if(this.usage_metadata!==void 0||e.usage_metadata!==void 0){let n={...(this.usage_metadata?.input_token_details?.audio!==void 0||e.usage_metadata?.input_token_details?.audio!==void 0)&&{audio:(this.usage_metadata?.input_token_details?.audio??0)+(e.usage_metadata?.input_token_details?.audio??0)},...(this.usage_metadata?.input_token_details?.cache_read!==void 0||e.usage_metadata?.input_token_details?.cache_read!==void 0)&&{cache_read:(this.usage_metadata?.input_token_details?.cache_read??0)+(e.usage_metadata?.input_token_details?.cache_read??0)},...(this.usage_metadata?.input_token_details?.cache_creation!==void 0||e.usage_metadata?.input_token_details?.cache_creation!==void 0)&&{cache_creation:(this.usage_metadata?.input_token_details?.cache_creation??0)+(e.usage_metadata?.input_token_details?.cache_creation??0)}},o={...(this.usage_metadata?.output_token_details?.audio!==void 0||e.usage_metadata?.output_token_details?.audio!==void 0)&&{audio:(this.usage_metadata?.output_token_details?.audio??0)+(e.usage_metadata?.output_token_details?.audio??0)},...(this.usage_metadata?.output_token_details?.reasoning!==void 0||e.usage_metadata?.output_token_details?.reasoning!==void 0)&&{reasoning:(this.usage_metadata?.output_token_details?.reasoning??0)+(e.usage_metadata?.output_token_details?.reasoning??0)}},i=this.usage_metadata??{input_tokens:0,output_tokens:0,total_tokens:0},a=e.usage_metadata??{input_tokens:0,output_tokens:0,total_tokens:0},s={input_tokens:i.input_tokens+a.input_tokens,output_tokens:i.output_tokens+a.output_tokens,total_tokens:i.total_tokens+a.total_tokens,...Object.keys(n).length>0&&{input_token_details:n},...Object.keys(o).length>0&&{output_token_details:o}};r.usage_metadata=s}return new t(r)}}});var fs,nf,r9=O(()=>{Qm();fs=class t extends ul{static lc_name(){return"ChatMessage"}static _chatMessageClass(){return t}constructor(e,r){typeof e=="string"&&(e={content:e,role:r}),super(e),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=e.role}_getType(){return"generic"}static isInstance(e){return e._getType()==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},nf=class t extends Kf{static lc_name(){return"ChatMessageChunk"}constructor(e,r){typeof e=="string"&&(e={content:e,role:r}),super(e),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=e.role}_getType(){return"generic"}concat(e){return new t({content:Zm(this.content,e.content),additional_kwargs:ds(this.additional_kwargs,e.additional_kwargs),response_metadata:ds(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}get _printableFields(){return{...super._printableFields,role:this.role}}}});var zp,n9=O(()=>{Qm();zp=class t extends Kf{static lc_name(){return"FunctionMessageChunk"}_getType(){return"function"}concat(e){return new t({content:Zm(this.content,e.content),additional_kwargs:ds(this.additional_kwargs,e.additional_kwargs),response_metadata:ds(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});var ps,of,tz=O(()=>{Qm();ps=class extends ul{static lc_name(){return"HumanMessage"}_getType(){return"human"}constructor(e,r){super(e,r)}},of=class t extends Kf{static lc_name(){return"HumanMessageChunk"}_getType(){return"human"}constructor(e,r){super(e,r)}concat(e){return new t({content:Zm(this.content,e.content),additional_kwargs:ds(this.additional_kwargs,e.additional_kwargs),response_metadata:ds(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});var Ix,fd,o9=O(()=>{Qm();Ix=class extends ul{static lc_name(){return"SystemMessage"}_getType(){return"system"}constructor(e,r){super(e,r)}},fd=class t extends Kf{static lc_name(){return"SystemMessageChunk"}_getType(){return"system"}constructor(e,r){super(e,r)}concat(e){return new t({content:Zm(this.content,e.content),additional_kwargs:ds(this.additional_kwargs,e.additional_kwargs),response_metadata:ds(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});function z7t(t){return NP(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 H7t(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function tde(t){let e,r;if(H7t(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 ps(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new fn(r);let i=n.map(z7t);return new fn({...o,tool_calls:i})}else{if(e==="system")return new Ix(r);if(e==="developer")return new Ix({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new Ax({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});throw DP(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported.
Received: ${JSON.stringify(t,null,2)}`),"MESSAGE_COERCION_FAILURE")}}function Eg(t){if(typeof t=="string")return new ps(t);if(Xm(t))return t;if(Array.isArray(t)){let[e,r]=t;return tde({type:e,content:r})}else if(jBe(t)){let{role:e,...r}=t;return tde({...r,type:e})}else return tde(t)}function af(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 rde(t){let e=t._getType();if(e==="human")return new of({...t});if(e==="ai"){let r={...t};return"tool_calls"in r&&(r={...r,tool_call_chunks:r.tool_calls?.map(n=>({...n,type:"tool_call_chunk",index:void 0,args:JSON.stringify(n.args)}))}),new or({...r})}else{if(e==="system")return new fd({...t});if(e==="function")return new zp({...t});if(fs.isInstance(t))return new nf({...t});throw new Error("Unknown message type.")}}var FP=O(()=>{QU();t9();SM();Qm();r9();n9();tz();o9();IN()});var nde=O(()=>{qW()});var ode=O(()=>{$W()});var ide,LBe,FBe=O(()=>{ode();bM();LBe=()=>{if(ide===void 0){let t=et("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};ide=new mM(t)}return ide}});var MN,kBe=O(()=>{nde();kce();bM();vM();FBe();MN=class t extends Gm{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??et("LANGCHAIN_PROJECT")??et("LANGCHAIN_SESSION"),this.exampleId=r,this.client=o??LBe();let i=t.getTraceableRunTree();i&&this.updateFromRunTree(i)}async _convertToCreate(e,r=void 0){return{...e,extra:{...e.extra,runtime:await bBe()},child_runs:void 0,session_name:this.projectName,reference_example_id:e.parent_run_id?void 0:r}}async persistRun(e){}async onRunCreate(e){let r=await this._convertToCreate(e,this.exampleId);await this.client.createRun(r)}async onRunUpdate(e){let r={end_time:e.end_time,error:e.error,outputs:e.outputs,events:e.events,inputs:e.inputs,trace_id:e.trace_id,dotted_order:e.dotted_order,parent_run_id:e.parent_run_id,extra:e.extra,session_name:this.projectName};await this.client.updateRun(e.id,r)}getRun(e){return this.runMap.get(e)}updateFromRunTree(e){let r=e,n=new Set;for(;r.parent_run&&!(n.has(r.id)||(n.add(r.id),!r.parent_run));)r=r.parent_run;n.clear();let o=[r];for(;o.length>0;){let i=o.shift();!i||n.has(i.id)||(n.add(i.id),this.runMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}convertToRunTree(e){let r={},n=[];for(let[o,i]of this.runMap){let a=new Ex({...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 X$e()}catch{return}}}});var $Be,xM,BBe,kP,rz=O(()=>{$Be=Symbol.for("ls:tracing_async_local_storage"),xM=Symbol.for("lc:context_variables"),BBe=t=>{globalThis[$Be]=t},kP=()=>globalThis[$Be]});function V7t(){let t="default"in i9.default?i9.default.default:i9.default;return new t({autoStart:!0,concurrency:1})}function W7t(){return typeof nz>"u"&&(nz=V7t()),nz}async function ms(t,e){if(e===!0){let r=kP();r!==void 0?await r.run(void 0,async()=>t()):await t()}else nz=W7t(),nz.add(async()=>{let r=kP();r!==void 0?await r.run(void 0,async()=>t()):await t()})}var i9,nz,qBe=O(()=>{i9=$(SW(),1);rz()});var UBe=O(()=>{qBe()});var zBe,HBe=O(()=>{bM();zBe=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>et(r)==="true")});function ade(t){let e=kP();return e===void 0?void 0:e.getStore()?.[xM]?.[t]}var K7t,VBe,WBe=O(()=>{nde();rz();K7t=Symbol("lc:configure_hooks"),VBe=()=>ade(K7t)||[]});function CM(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function oz(t){return"name"in t?t:_M.fromMethods(t)}var sde,RN,ude,a9,lde,cde,Es,$P=O(()=>{MP();ZU();OBe();FP();bM();kBe();UBe();HBe();vM();WBe();sde=class{setHandler(e){return this.setHandlers([e])}},RN=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=>ms(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=>ms(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)))}},ude=class extends RN{getChild(e){let r=new Es(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=>ms(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=>ms(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)))}},a9=class extends RN{async handleLLMNewToken(e,r,n,o,i,a){await Promise.all(this.handlers.map(s=>ms(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=>ms(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=>ms(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)))}},lde=class extends RN{getChild(e){let r=new Es(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=>ms(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=>ms(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=>ms(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=>ms(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)))}},cde=class extends RN{getChild(e){let r=new Es(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=>ms(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=>ms(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)))}},Es=class t extends sde{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:Za();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return TN(f)&&f._createRunForLLMStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),ms(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 a9(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:Za();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return TN(f)&&f._createRunForChatModelStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),ms(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=af(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 a9(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=Za(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreChain)return TN(u)&&u._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,s),ms(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 lde(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=Za(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreAgent)return TN(u)&&u._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),ms(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 cde(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=Za(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreRetriever)return TN(u)&&u._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),ms(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 ude(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=>ms(async()=>{if(!a.ignoreCustomEvent)try{await a.handleCustomEvent?.(e,r,n,this.tags,this.metadata)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleCustomEvent: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}addHandler(e,r=!0){this.handlers.push(e),r&&this.inheritableHandlers.push(e)}removeHandler(e){this.handlers=this.handlers.filter(r=>r!==e),this.inheritableHandlers=this.inheritableHandlers.filter(r=>r!==e)}setHandlers(e,r=!0){this.handlers=[],this.inheritableHandlers=[];for(let n of e)this.addHandler(n,r)}addTags(e,r=!0){this.removeTags(e),this.tags.push(...e),r&&this.inheritableTags.push(...e)}removeTags(e){this.tags=this.tags.filter(r=>!e.includes(r)),this.inheritableTags=this.inheritableTags.filter(r=>!e.includes(r))}addMetadata(e,r=!0){this.metadata={...this.metadata,...e},r&&(this.inheritableMetadata={...this.inheritableMetadata,...e})}removeMetadata(e){for(let r of Object.keys(e))delete this.metadata[r],delete this.inheritableMetadata[r]}copy(e=[],r=!0){let n=new t(this._parentRunId);for(let o of this.handlers){let i=this.inheritableHandlers.includes(o);n.addHandler(o,i)}for(let o of this.tags){let i=this.inheritableTags.includes(o);n.addTags([o],i)}for(let o of Object.keys(this.metadata)){let i=Object.keys(this.inheritableMetadata).includes(o);n.addMetadata({[o]:this.metadata[o]},i)}for(let o of e)n.handlers.filter(i=>i.name==="console_callback_handler").some(i=>i.name===o.name)||n.addHandler(o,r);return n}static fromHandlers(e){class r extends _M{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:Za()}),Object.assign(this,e)}}let n=new this;return n.addHandler(new r),n}static configure(e,r,n,o,i,a,s){return this._configureSync(e,r,n,o,i,a,s)}static _configureSync(e,r,n,o,i,a,s){let u;(e||r)&&(Array.isArray(e)||!e?(u=new t,u.setHandlers(e?.map(oz)??[],!0)):u=e,u=u.copy(Array.isArray(r)?r.map(oz):r?.handlers,!1));let l=et("LANGCHAIN_VERBOSE")==="true"||s?.verbose,c=MN.getTraceableRunTree()?.tracingEnabled||zBe(),d=c||(et("LANGCHAIN_TRACING")??!1);if(l||d){if(u||(u=new t),l&&!u.handlers.some(f=>f.name===XU.prototype.name)){let f=new XU;u.addHandler(f,!0)}if(d&&!u.handlers.some(f=>f.name==="langchain_tracer")&&c){let f=new MN;u.addHandler(f,!0),u._parentRunId=MN.getTraceableRunTree()?.id??u._parentRunId}}for(let{contextVar:f,inheritable:p=!0,handlerClass:m,envVar:h}of VBe()){let b=h&&et(h)==="true"&&m,g,_=f!==void 0?ade(f):void 0;_&&_Be(_)?g=_:b&&(g=new m({})),g!==void 0&&(u||(u=new t),u.handlers.some(w=>w.name===g.name)||u.addHandler(g,p))}return(n||o)&&u&&(u.addTags(n??[]),u.addTags(o??[],!1)),(i||a)&&u&&(u.addMetadata(i??{}),u.addMetadata(a??{},!1)),u}}});var s9,J7t,KBe,dde,pd,JBe=O(()=>{ode();rz();$P();s9=class{getStore(){}run(e,r){return r()}enterWith(e){}},J7t=new s9,KBe=Symbol.for("lc:child_config"),dde=class{getInstance(){return kP()??J7t}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[KBe]}runWithConfig(e,r,n){let o=Es._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 Ex({name:"<runnable_lambda>",tracingEnabled:!1})),l&&(l.extra={...l.extra,[KBe]:e}),a!==void 0&&a[xM]!==void 0&&(l===void 0&&(l={}),l[xM]=a[xM]),i.run(l,r)}initializeGlobalInstance(e){kP()===void 0&&BBe(e)}},pd=new dde});var jN=O(()=>{JBe();rz()});async function Jf(t){return Es._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function l9(...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(oz(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(oz(s),!0);e.callbacks=a}else e.callbacks=new Es(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 on(t){let e=pd.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))G7t.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 Qa(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=on(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 Hp(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 u9,G7t,nb=O(()=>{$P();jN();u9=25;G7t=new Set(["string","number","boolean"])});async function ob(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 fde=O(()=>{});function pde(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 Il(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]=Il(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function GBe(t,e,r,n,...o){let i=new Mx({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var md,Mx,ib=O(()=>{nb();jN();fde();md=class t extends ReadableStream{constructor(){super(...arguments),Object.defineProperty(this,"reader",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let e=await this.reader.read();return e.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}throw e}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(e){let r=e.getReader();return new t({start(n){return o();function o(){return r.read().then(({done:i,value:a})=>{if(i){n.close();return}return n.enqueue(a),o()})}},cancel(){r.releaseLock()}})}static fromAsyncGenerator(e){return new t({async pull(r){let{value:n,done:o}=await e.next();o&&r.close(),r.enqueue(n)},async cancel(r){await e.return(r)}})}};Mx=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)=>{pd.runWithConfig(Hp(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?pd.runWithConfig(Hp(this.config),this.signal?async()=>ob(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 YBe(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 ZBe(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 Y7t(t){return t!==void 0&&t.message!==void 0}var Tg,iz,XBe,az,QBe=O(()=>{Bce();vM();ib();SM();Tg=class{constructor(e){Object.defineProperty(this,"ops",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.ops=e.ops??[]}concat(e){let r=this.ops.concat(e.ops),n=RP({},r);return new iz({ops:r,state:n[n.length-1].newDocument})}},iz=class t extends Tg{constructor(e){super(e),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.state=e.state}concat(e){let r=this.ops.concat(e.ops),n=RP(this.state,e.ops);return new t({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=RP({},e.ops);return new t({ops:e.ops,state:r[r.length-1].newDocument})}},XBe=t=>t.name==="log_stream_tracer";az=class extends Gm{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=md.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){if(e.id===this.rootId)return!1;let r=e.tags??[],n=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(n=n||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(e.run_type)),this.includeTags!==void 0&&(n=n||r.find(o=>this.includeTags?.includes(o))!==void 0),this.excludeNames!==void 0&&(n=n&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(e.run_type)),this.excludeTags!==void 0&&(n=n&&r.every(o=>!this.excludeTags?.includes(o))),n}async*tapOutputIterable(e,r){for await(let n of r){if(e!==this.rootId){let o=this.keyMapByRunId[e];o&&await this.writer.write(new Tg({ops:[{op:"add",path:`/logs/${o}/streamed_output/-`,value:n}]}))}yield n}}async onRunCreate(e){if(this.rootId===void 0&&(this.rootId=e.id,await this.writer.write(new Tg({ops:[{op:"replace",path:"",value:{id:e.id,name:e.name,type:e.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(e))return;this.counterMapByRunName[e.name]===void 0&&(this.counterMapByRunName[e.name]=0),this.counterMapByRunName[e.name]+=1;let r=this.counterMapByRunName[e.name];this.keyMapByRunId[e.id]=r===1?e.name:`${e.name}:${r}`;let n={id:e.id,name:e.name,type:e.run_type,tags:e.tags??[],metadata:e.extra?.metadata??{},start_time:new Date(e.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};this._schemaFormat==="streaming_events"&&(n.inputs=await YBe(e,this._schemaFormat)),await this.writer.write(new Tg({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[e.id]}`,value:n}]}))}async onRunUpdate(e){try{let r=this.keyMapByRunId[e.id];if(r===void 0)return;let n=[];this._schemaFormat==="streaming_events"&&n.push({op:"replace",path:`/logs/${r}/inputs`,value:await YBe(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await ZBe(e,this._schemaFormat)}),e.end_time!==void 0&&n.push({op:"add",path:`/logs/${r}/end_time`,value:new Date(e.end_time).toISOString()});let o=new Tg({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new Tg({ops:[{op:"replace",path:"/final_output",value:await ZBe(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?Y7t(n?.chunk)?a=n?.chunk:a=new or({id:`run-${e.id}`,content:r}):a=r;let s=new Tg({ops:[{op:"add",path:`/logs/${o}/streamed_output_str/-`,value:r},{op:"add",path:`/logs/${o}/streamed_output/-`,value:a}]});await this.writer.write(s)}}});var sz,Gf,Ln,DN=O(()=>{sz="__run",Gf=class t{constructor(e){Object.defineProperty(this,"text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"generationInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new t({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},Ln=class t extends Gf{constructor(e){super(e),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.message=e.message}concat(e){return new t({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo},message:this.message.concat(e.message)})}}});function c9({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 eqe,d9,tqe=O(()=>{vM();ib();SM();DN();eqe=t=>t.name==="event_stream_tracer",d9=class extends Gm{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=md.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 Gf({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=c9(e),n=e.inputs.messages!==void 0?"chat_model":"llm",o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:n,inputs:e.inputs};this.runInfoMap.set(e.id,o);let i=`on_${n}_start`;await this.send({event:i,data:{input:e.inputs},name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onLLMNewToken(e,r,n){let o=this.runInfoMap.get(e.id),i,a;if(o===void 0)throw new Error(`onLLMNewToken: Run ID ${e.id} not found in run map.`);if(this.runInfoMap.size!==1){if(o.runType==="chat_model")a="on_chat_model_stream",n?.chunk===void 0?i=new or({content:r,id:`run-${e.id}`}):i=n.chunk.message;else if(o.runType==="llm")a="on_llm_stream",n?.chunk===void 0?i=new Gf({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=c9(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=c9(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=c9(e),o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:"retriever",inputs:{query:e.inputs.query}};this.runInfoMap.set(e.id,o),await this.send({event:"on_retriever_start",data:{input:{query:e.inputs.query}},name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onRetrieverEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onRetrieverEnd: Run ID ${e.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:e.outputs?.documents??e.outputs,input:r.inputs},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async handleCustomEvent(e,r,n){let o=this.runInfoMap.get(n);if(o===void 0)throw new Error(`handleCustomEvent: Run ID ${n} not found in run map.`);await this.send({event:"on_custom_event",run_id:n,name:e,tags:o.tags,metadata:o.metadata,data:r},o)}async finish(){let e=[...this.tappedPromises.values()];Promise.all(e).finally(()=>{this.writer.close()})}}});var rqe,f9,Z7t,X7t,Vp,NN=O(()=>{rqe=$(mW(),1),f9=$(SW(),1),Z7t=[400,401,402,403,404,405,406,407,409],X7t=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&&Z7t.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},Vp=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??X7t;let r="default"in f9.default?f9.default.default:f9.default;this.queue=new r({concurrency:this.maxConcurrency})}call(e,...r){return this.queue.add(()=>(0,rqe.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 uz,nqe=O(()=>{vM();uz=class extends Gm{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 lz(t){return t?t.lc_runnable:!1}var p9,mde=O(()=>{p9=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 iqe,oqe,aqe,m9=O(()=>{iqe=Symbol("Let zodToJsonSchema decide on which parser to use"),oqe={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"},aqe=t=>typeof t=="string"?{...oqe,name:t}:{...oqe,...t}});var sqe,hde=O(()=>{m9();sqe=t=>{let e=aqe(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 gde(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Fn(t,e,r,n,o){t[e]=r,gde(t,e,n,o)}var BP=O(()=>{});function uqe(){return{}}var yde=O(()=>{});function lqe(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==se.ZodAny&&(r.items=ir(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Fn(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Fn(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Fn(r,"minItems",t.exactLength.value,t.exactLength.message,e),Fn(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var bde=O(()=>{ud();BP();Ts()});function cqe(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?Fn(r,"minimum",n.value,n.message,e):Fn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Fn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Fn(r,"maximum",n.value,n.message,e):Fn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Fn(r,"maximum",n.value,n.message,e));break;case"multipleOf":Fn(r,"multipleOf",n.value,n.message,e);break}return r}var _de=O(()=>{BP()});function dqe(){return{type:"boolean"}}var vde=O(()=>{});function h9(t,e){return ir(t.type._def,e)}var g9=O(()=>{Ts()});var fqe,wde=O(()=>{Ts();fqe=(t,e)=>ir(t.innerType._def,e)});function Sde(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>Sde(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 Q7t(t,e)}}var Q7t,xde=O(()=>{BP();Q7t=(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":Fn(r,"minimum",n.value,n.message,e);break;case"max":Fn(r,"maximum",n.value,n.message,e);break}return r}});function pqe(t,e){return{...ir(t.innerType._def,e),default:t.defaultValue()}}var Cde=O(()=>{Ts()});function mqe(t,e){return e.effectStrategy==="input"?ir(t.schema._def,e):{}}var Ode=O(()=>{Ts()});function hqe(t){return{type:"string",enum:Array.from(t.values)}}var Pde=O(()=>{});function gqe(t,e){let r=[ir(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),ir(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(eYt(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 eYt,Ede=O(()=>{Ts();eYt=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function yqe(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 Tde=O(()=>{});function y9(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":Fn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":Fn(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":Ig(r,"email",n.message,e);break;case"format:idn-email":Ig(r,"idn-email",n.message,e);break;case"pattern:zod":sf(r,Ag.email,n.message,e);break}break;case"url":Ig(r,"uri",n.message,e);break;case"uuid":Ig(r,"uuid",n.message,e);break;case"regex":sf(r,n.regex,n.message,e);break;case"cuid":sf(r,Ag.cuid,n.message,e);break;case"cuid2":sf(r,Ag.cuid2,n.message,e);break;case"startsWith":sf(r,RegExp(`^${Ide(n.value,e)}`),n.message,e);break;case"endsWith":sf(r,RegExp(`${Ide(n.value,e)}$`),n.message,e);break;case"datetime":Ig(r,"date-time",n.message,e);break;case"date":Ig(r,"date",n.message,e);break;case"time":Ig(r,"time",n.message,e);break;case"duration":Ig(r,"duration",n.message,e);break;case"length":Fn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),Fn(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{sf(r,RegExp(Ide(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&Ig(r,"ipv4",n.message,e),n.version!=="v4"&&Ig(r,"ipv6",n.message,e);break}case"base64url":sf(r,Ag.base64url,n.message,e);break;case"jwt":sf(r,Ag.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&sf(r,Ag.ipv4Cidr,n.message,e),n.version!=="v4"&&sf(r,Ag.ipv6Cidr,n.message,e);break}case"emoji":sf(r,Ag.emoji(),n.message,e);break;case"ulid":{sf(r,Ag.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Ig(r,"binary",n.message,e);break}case"contentEncoding:base64":{Fn(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{sf(r,Ag.base64,n.message,e);break}}break}case"nanoid":sf(r,Ag.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Ide(t,e){return e.patternStrategy==="escape"?rYt(t):t}function rYt(t){let e="";for(let r=0;r<t.length;r++)tYt.has(t[r])||(e+="\\"),e+=t[r];return e}function Ig(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}}})):Fn(t,"format",e,r,n)}function sf(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:bqe(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Fn(t,"pattern",bqe(e,n),r,n)}function bqe(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 Ade,Ag,tYt,b9=O(()=>{BP();Ag={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:()=>(Ade===void 0&&(Ade=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ade),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-_]*$/};tYt=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function _9(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===se.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:ir(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:ir(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===se.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=y9(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===se.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===se.ZodBranded&&t.keyType._def.type._def.typeName===se.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=h9(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var v9=O(()=>{ud();Ts();b9();g9()});function _qe(t,e){if(e.mapStrategy==="record")return _9(t,e);let r=ir(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=ir(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 Mde=O(()=>{Ts();v9()});function vqe(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 Rde=O(()=>{});function wqe(){return{not:{}}}var jde=O(()=>{});function Sqe(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Dde=O(()=>{});function Cqe(t,e){if(e.target==="openApi3")return xqe(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in cz&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=cz[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 xqe(t,e)}var cz,xqe,w9=O(()=>{Ts();cz={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};xqe=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>ir(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 Oqe(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:cz[t.innerType._def.typeName],nullable:!0}:{type:[cz[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=ir(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=ir(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var Nde=O(()=>{Ts();w9()});function Pqe(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",gde(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Fn(r,"minimum",n.value,n.message,e):Fn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Fn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Fn(r,"maximum",n.value,n.message,e):Fn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Fn(r,"maximum",n.value,n.message,e));break;case"multipleOf":Fn(r,"multipleOf",n.value,n.message,e);break}return r}var Lde=O(()=>{BP()});function nYt(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":ir(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":ir(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function Eqe(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 Bf&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=ir(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:nYt(t,e)};return n.required.length||delete n.required,n}var Fde=O(()=>{ud();Ts()});var Tqe,kde=O(()=>{Ts();Tqe=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return ir(t.innerType._def,e);let r=ir(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var Aqe,$de=O(()=>{Ts();Aqe=(t,e)=>{if(e.pipeStrategy==="input")return ir(t.in._def,e);if(e.pipeStrategy==="output")return ir(t.out._def,e);let r=ir(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=ir(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function Iqe(t,e){return ir(t.type._def,e)}var Bde=O(()=>{Ts()});function Mqe(t,e){let n={type:"array",uniqueItems:!0,items:ir(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Fn(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Fn(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var qde=O(()=>{BP();Ts()});function Rqe(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>ir(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:ir(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>ir(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var Ude=O(()=>{Ts()});function jqe(){return{not:{}}}var zde=O(()=>{});function Dqe(){return{}}var Hde=O(()=>{});var Nqe,Vde=O(()=>{Ts();Nqe=(t,e)=>ir(t.innerType._def,e)});function ir(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==iqe)return a}if(n&&!r){let a=oYt(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=aYt(t,t.typeName,e);return i&&sYt(t,e,i),o.jsonSchema=i,i}var oYt,iYt,aYt,sYt,Ts=O(()=>{ud();yde();bde();_de();vde();g9();wde();xde();Cde();Ode();Pde();Ede();Tde();Mde();Rde();jde();Dde();Nde();Lde();Fde();kde();$de();Bde();v9();qde();b9();Ude();zde();w9();Hde();Vde();m9();oYt=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:iYt(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}},iYt=(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("/")},aYt=(t,e,r)=>{switch(e){case se.ZodString:return y9(t,r);case se.ZodNumber:return Pqe(t,r);case se.ZodObject:return Eqe(t,r);case se.ZodBigInt:return cqe(t,r);case se.ZodBoolean:return dqe();case se.ZodDate:return Sde(t,r);case se.ZodUndefined:return jqe();case se.ZodNull:return Sqe(r);case se.ZodArray:return lqe(t,r);case se.ZodUnion:case se.ZodDiscriminatedUnion:return Cqe(t,r);case se.ZodIntersection:return gqe(t,r);case se.ZodTuple:return Rqe(t,r);case se.ZodRecord:return _9(t,r);case se.ZodLiteral:return yqe(t,r);case se.ZodEnum:return hqe(t);case se.ZodNativeEnum:return vqe(t);case se.ZodNullable:return Oqe(t,r);case se.ZodOptional:return Tqe(t,r);case se.ZodMap:return _qe(t,r);case se.ZodSet:return Mqe(t,r);case se.ZodLazy:return ir(t.getter()._def,r);case se.ZodPromise:return Iqe(t,r);case se.ZodNaN:case se.ZodNever:return wqe();case se.ZodEffects:return mqe(t,r);case se.ZodAny:return uqe();case se.ZodUnknown:return Dqe();case se.ZodDefault:return pqe(t,r);case se.ZodBranded:return h9(t,r);case se.ZodReadonly:return Nqe(t,r);case se.ZodCatch:return fqe(t,r);case se.ZodPipeline:return Aqe(t,r);case se.ZodFunction:case se.ZodVoid:case se.ZodSymbol:return;default:return(n=>{})(e)}},sYt=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var po,Wde=O(()=>{Ts();hde();po=(t,e)=>{let r=sqe(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:ir(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=ir(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 fc=O(()=>{m9();hde();BP();Ts();yde();bde();_de();vde();g9();wde();xde();Cde();Ode();Pde();Ede();Tde();Mde();Rde();jde();Dde();Nde();Lde();Fde();kde();$de();Bde();Vde();v9();qde();b9();Ude();zde();w9();Hde();Wde();Wde()});function Kde(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function lYt(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n};
`;return e}function Lqe(t,e,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:a=!0,curveStyle:s="linear",wrapLabelNWords:u=9}=r??{},l=a?`%%{init: {'flowchart': {'curve': '${s}'}}}%%
graph TD;
`:`graph TD;
`;if(a){let p="default",m={[p]:"{0}({1})"};n!==void 0&&(m[n]="{0}([{1}]):::first"),o!==void 0&&(m[o]="{0}([{1}]):::last");for(let[h,b]of Object.entries(t)){let g=b.name.split(":").pop()??"",w=uYt.some(C=>g.startsWith(C)&&g.endsWith(C))?`<p>${g}</p>`:g;Object.keys(b.metadata??{}).length&&(w+=`<hr/><small><em>${Object.entries(b.metadata??{}).map(([C,E])=>`${C} = ${E}`).join(`
`)}</em></small>`);let x=(m[h]??m[p]).replace("{0}",Kde(h)).replace("{1}",w);l+=` ${x}
`}}let c={};for(let p of e){let m=p.source.split(":"),h=p.target.split(":"),b=m.filter((g,_)=>g===h[_]).join(":");c[b]||(c[b]=[]),c[b].push(p)}let d=new Set;function f(p,m){let h=p.length===1&&p[0].source===p[0].target;if(m&&!h){let b=m.split(":").pop();if(d.has(b))throw new Error(`Found duplicate subgraph '${b}' -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);d.add(b),l+=` subgraph ${b}
`}for(let b of p){let{source:g,target:_,data:w,conditional:x}=b,C="";if(w!==void 0){let E=w,P=E.split(" ");P.length>u&&(E=Array.from({length:Math.ceil(P.length/u)},(A,I)=>P.slice(I*u,(I+1)*u).join(" ")).join("&nbsp;<br>&nbsp;")),C=x?` -. &nbsp;${E}&nbsp; .-> `:` -- &nbsp;${E}&nbsp; --> `}else C=x?" -.-> ":" --> ";l+=` ${Kde(g)}${C}${Kde(_)};
`}for(let b in c)b.startsWith(`${m}:`)&&b!==m&&f(c[b],b);m&&!h&&(l+=` end
`)}f(c[""]??[],"");for(let p in c)!p.includes(":")&&p!==""&&f(c[p],p);return a&&(l+=lYt(i??{})),l}async function Fqe(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 uYt,kqe=O(()=>{uYt=["*","_","`"]});function cYt(t,e){if(t!==void 0&&!IP(t))return t;if(lz(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 dYt(t){return lz(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...po(t.data.schema),title:t.data.name}}}function $qe(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 Bqe(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 dz,qqe=O(()=>{fc();MP();mde();kqe();dz=class t{constructor(e){Object.defineProperty(this,"nodes",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"edges",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.nodes=e?.nodes??this.nodes,this.edges=e?.edges??this.edges}toJSON(){let e={};return Object.values(this.nodes).forEach((r,n)=>{e[r.id]=IP(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...dYt(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??Za(),i={id:o,data:e,name:cYt(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 $qe(this)}lastNode(){return Bqe(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(l=>l.id).every(IP)&&(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&&$qe(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&Bqe(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 IP(o)&&r.get(i)===1?i:o};return new t({nodes:Object.fromEntries(Object.entries(this.nodes).map(([o,i])=>[n(o),{...i,id:n(o)}])),edges:this.edges.map(o=>({...o,source:n(o.source),target:n(o.target)}))})}drawMermaid(e){let{withStyles:r,curveStyle:n,nodeColors:o={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=e??{},a=this.reid(),s=a.firstNode(),u=a.lastNode();return Lqe(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 Fqe(r,{backgroundColor:e?.backgroundColor})}}});function Uqe(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 md.fromReadableStream(r)}var zqe=O(()=>{ib()});function Jde(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function S9(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*Gde(t,e){for(;;){let{value:r,done:n}=pd.runWithConfig(Hp(t),e.next.bind(e),!0);if(n)break;yield r}}async function*x9(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await pd.runWithConfig(Hp(t),r.next.bind(e),!0);if(o)break;yield n}}var Hqe,Vqe=O(()=>{jN();nb();Hqe=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function ll(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function fYt(t){if(VW(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function Rx(t){if(typeof t=="function")return new uf({func:t});if(gn.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=Rx(n);return new qP({steps:e})}else throw new Error(`Expected a Runnable, function or object.
Instead got an unsupported type.`)}function pYt(t,e){let r=e.name??t.getName(),n=e.description??e.schema?.description;return e.schema.constructor===Ur.ZodString?new fz({name:r,description:n,schema:Ur.object({input:Ur.string()}).transform(o=>o.input),bound:t}):new fz({name:r,description:n,schema:e.schema,bound:t})}var Yde,gn,jx,C9,O9,si,qP,Zde,uf,P9,LN,E9,fz,lf=O(()=>{ud();Yde=$(mW(),1);MP();kce();QBe();tqe();yM();ib();fde();nb();NN();nqe();mde();jN();qqe();zqe();Vqe();t9();gn=class extends Vf{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 jx({bound:this,kwargs:e,config:{}})}map(){return new C9({bound:this})}withRetry(e){return new O9({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new jx({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new P9({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(on);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)=>on(i===0?e:n))}return Array.from({length:r},()=>on(e))}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=o[0]?.maxConcurrency??n?.maxConcurrency,a=new Vp({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=on(r),o=new Mx({generator:this._streamIterator(e,n),config:n});return await o.setup,md.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=on(e):r=on({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=on(n),a=await(await Jf(o))?.handleChainStart(this.toJSON(),ll(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 ob(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(ll(s,"output")),s}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(Jf)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),ll(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 ob(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(ll(u,"output")))),u}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=on(n),l=await Jf(u);async function*c(){for await(let f of e){if(i)if(o===void 0)o=f;else try{o=Il(o,f)}catch{o=void 0,i=!1}yield f}}let d;try{let f=await GBe(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(eqe),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(XBe);h!==void 0&&d!==void 0&&(m=h.tapOutputIterable(d.runId,m));for await(let b of m)if(yield b,s)if(a===void 0)a=b;else try{a=Il(a,b)}catch{a=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:ll(o,"input")}),f}await d?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:ll(o,"input")})}getGraph(e){let r=new dz,n=r.addNode({name:`${this.getName()}Input`,schema:Ur.any()}),o=r.addNode(this),i=r.addNode({name:`${this.getName()}Output`,schema:Ur.any()});return r.addEdge(n,o),r.addEdge(o,i),r}pipe(e){return new si({first:this,last:Rx(e)})}pick(e){return this.pipe(new E9(e))}assign(e){return this.pipe(new LN(new qP({steps:e})))}async*transform(e,r){let n;for await(let o of e)n===void 0?n=o:n=Il(n,o);yield*this._streamIterator(n,on(r))}async*streamLog(e,r,n){let o=new az({...n,autoClose:!1,_schemaFormat:"original"}),i=on(r);yield*this._streamLog(e,o,i)}async*_streamLog(e,r,n){let{callbacks:o}=n;if(o===void 0)n.callbacks=[r];else if(Array.isArray(o))n.callbacks=o.concat([r]);else{let u=o.copy();u.addHandler(r,!0),n.callbacks=u}let i=this.stream(e,n);async function a(){try{let u=await i;for await(let l of u){let c=new Tg({ops:[{op:"add",path:"/streamed_output/-",value:l}]});await r.writer.write(c)}}finally{await r.writer.close()}}let s=a();try{for await(let u of r)yield u}finally{await s}}streamEvents(e,r,n){let o;if(r.version==="v1")o=this._streamEventsV1(e,r,n);else if(r.version==="v2")o=this._streamEventsV2(e,r,n);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return r.encoding==="text/event-stream"?Uqe(o):md.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new d9({...n,autoClose:!1}),i=on(r),a=i.runId??Za();i.runId=a;let s=i.callbacks;if(s===void 0)i.callbacks=[o];else if(Array.isArray(s))i.callbacks=s.concat(o);else{let m=s.copy();m.addHandler(o,!0),i.callbacks=m}let u=new AbortController,l=this;async function c(){try{let m;r?.signal?"any"in AbortSignal?m=AbortSignal.any([u.signal,r.signal]):(m=r.signal,r.signal.addEventListener("abort",()=>{u.abort()},{once:!0})):m=u.signal;let h=await l.stream(e,{...i,signal:m}),b=o.tapOutputIterable(a,h);for await(let g of b)if(u.signal.aborted)break}finally{await o.finish()}}let d=c(),f=!1,p;try{for await(let m of o){if(!f){m.data.input=e,f=!0,p=m.run_id,yield m;continue}m.run_id===p&&m.event.endsWith("_end")&&m.data?.input&&delete m.data.input,yield m}}finally{u.abort(),await d}}async*_streamEventsV1(e,r,n){let o,i=!1,a=on(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new az({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new p9({...n}),f=this._streamLog(e,c,a);for await(let m of f){if(o?o=o.concat(m):o=iz.fromRunLogPatch(m),o.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!i){i=!0;let _={...o.state},w={run_id:_.id,event:`on_${_.type}_start`,name:l,tags:s,metadata:u,data:{input:e}};d.includeEvent(w,_.type)&&(yield w)}let h=m.ops.filter(_=>_.path.startsWith("/logs/")).map(_=>_.path.split("/")[2]),b=[...new Set(h)];for(let _ of b){let w,x={},C=o.state.logs[_];if(C.end_time===void 0?C.streamed_output.length>0?w="stream":w="start":w="end",w==="start")C.inputs!==void 0&&(x.input=C.inputs);else if(w==="end")C.inputs!==void 0&&(x.input=C.inputs),x.output=C.final_output;else if(w==="stream"){let E=C.streamed_output.length;if(E!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${E} instead. Encountered in: "${C.name}"`);x={chunk:C.streamed_output[0]},C.streamed_output=[]}yield{event:`on_${C.type}_${w}`,name:C.name,run_id:C.id,tags:C.tags,metadata:C.metadata,data:x}}let{state:g}=o;if(g.streamed_output.length>0){let _=g.streamed_output.length;if(_!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${_} instead. Encountered in: "${g.name}"`);let w={chunk:g.streamed_output[0]};g.streamed_output=[];let x={event:`on_${g.type}_stream`,run_id:g.id,tags:s,metadata:u,name:l,data:w};d.includeEvent(x,g.type)&&(yield x)}}let p=o?.state;if(p!==void 0){let m={event:`on_${p.type}_end`,name:l,run_id:p.id,tags:s,metadata:u,data:{output:p.final_output}};d.includeEvent(m,p.type)&&(yield m)}}static isRunnable(e){return lz(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new jx({bound:this,config:{},configFactories:[o=>({callbacks:[new uz({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return pYt(this,e)}},jx=class t extends gn{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=l9(this.config,...e);return l9(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(on(r),this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(on(i),this.kwargs))):await this._mergeConfig(on(r),this.kwargs);return this.bound.batch(e,o,n)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(on(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(on(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(on(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(on(r),o.kwargs),version:r.version},n)};return md.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&gn.isRunnable(e.bound)}withListeners({onStart:e,onEnd:r,onError:n}){return new t({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[o=>({callbacks:[new uz({config:o,onStart:e,onEnd:r,onError:n})]})]})}},C9=class t extends gn{static lc_name(){return"RunnableEach"}constructor(e){super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"bound",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.bound=e.bound}bind(e){return new t({bound:this.bound.bind(e)})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _invoke(e,r,n){return this.bound.batch(e,Qa(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new t({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},O9=class extends jx{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 Qa(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return(0,Yde.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,Yde.default)(async a=>{let s=e.map((f,p)=>p).filter(f=>i[f.toString()]===void 0||i[f.toString()]instanceof Error),u=s.map(f=>e[f]),l=s.map(f=>this._patchConfigForRetry(a,r?.[f],n?.[f])),c=await super.batch(u,l,{...o,returnExceptions:!0}),d;for(let f=0;f<c.length;f+=1){let p=c[f],m=s[f];p instanceof Error&&d===void 0&&(d=p,d.input=u[f]),i[m.toString()]=p}if(d)throw d;return c},{onFailedAttempt:a=>this.onFailedAttempt(a,a.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(a){if(o?.returnExceptions!==!0)throw a}return Object.keys(i).sort((a,s)=>parseInt(a,10)-parseInt(s,10)).map(a=>i[parseInt(a,10)])}async batch(e,r,n){return this._batchWithConfig(this._batch.bind(this),e,r,n)}},si=class t extends gn{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=on(r),i=await(await Jf(n))?.handleChainStart(this.toJSON(),ll(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,Qa(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${l+1}`)}));a=await ob(d,r?.signal)}if(r?.signal?.aborted)throw new Error("Aborted");s=await this.last.invoke(a,Qa(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(ll(s,"output")),s}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(Jf)),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),ll(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 Qa(o[f],{callbacks:p})}),n);s=await ob(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(ll(s,"output")))),s}async*_streamIterator(e,r){let n=await Jf(r),{runId:o,...i}=r??{},a=await n?.handleChainStart(this.toJSON(),ll(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(),Qa(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,Qa(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=Il(l,f)}catch{l=void 0,u=!1}}catch(d){throw await a?.handleChainError(d),d}await a?.handleChainEnd(ll(l,"output"))}getGraph(e){let r=new dz,n=null;return this.steps.forEach((o,i)=>{let a=o.getGraph(e);i!==0&&a.trimFirstNode(),i!==this.steps.length-1&&a.trimLastNode(),r.extend(a);let s=a.firstNode();if(!s)throw new Error(`Runnable ${o} has no first node`);n&&r.addEdge(n,s),n=a.lastNode()}),r}pipe(e){return t.isRunnableSequence(e)?new t({first:this.first,middle:this.middle.concat([this.last,e.first,...e.middle]),last:e.last,name:this.name??e.name}):new t({first:this.first,middle:[...this.middle,this.last],last:Rx(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&gn.isRunnable(e)}static from([e,...r],n){let o={};return typeof n=="string"?o.name=n:n!==void 0&&(o=n),new t({...o,first:Rx(e),middle:r.slice(0,-1).map(Rx),last:Rx(r[r.length-1])})}},qP=class t extends gn{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]=Rx(n)}static from(e){return new t({steps:e})}async invoke(e,r){let n=on(r),i=await(await Jf(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,Qa(n,{callbacks:i?.getChild(`map:key:${u}`)}))});await ob(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=pde(e,Object.keys(o).length),a=new Map(Object.entries(o).map(([s,u],l)=>{let c=u.transform(i[l],Qa(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 ob(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=on(r),i=new Mx({generator:this.transform(n(),o),config:o});return await i.setup,md.fromAsyncGenerator(i)}},Zde=class t extends gn{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}),!VW(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 Jf(n),i=this.func(Qa(n,{callbacks:o}),e);return ob(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(S9(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(Hqe(o)){for(;;){n?.signal?.throwIfAborted();let i=o.next();if(i.done)break;yield i.value}return}yield o}static from(e){return new t({func:e})}};uf=class t extends gn{static lc_name(){return"RunnableLambda"}constructor(e){if(VW(e.func))return Zde.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}),fYt(e.func),this.func=e.func}static from(e){return new t({func:e})}async _invoke(e,r,n){return new Promise((o,i)=>{let a=Qa(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??u9)-1});pd.runWithConfig(Hp(a),async()=>{try{let s=await this.func(e,{...a});if(s&&gn.isRunnable(s)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");s=await s.invoke(e,{...a,recursionLimit:(a.recursionLimit??u9)-1})}else if(S9(s)){let u;for await(let l of x9(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=Il(u,l)}catch{u=l}s=u}else if(Jde(s)){let u;for(let l of Gde(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=Il(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=Il(o,s)}catch{o=s}let i=Qa(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??u9)-1}),a=await new Promise((s,u)=>{pd.runWithConfig(Hp(i),async()=>{try{let l=await this.func(o,{...i,config:i});s(l)}catch(l){u(l)}})});if(a&&gn.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(S9(a))for await(let s of x9(i,a))n?.signal?.throwIfAborted(),yield s;else if(Jde(a))for(let s of Gde(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=on(r),i=new Mx({generator:this.transform(n(),o),config:o});return await i.setup,md.fromAsyncGenerator(i)}},P9=class extends gn{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=on(r),o=await Jf(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),ll(e,"input"),i,void 0,void 0,void 0,a?.runName),u=Qa(a,{callbacks:s?.getChild()});return await pd.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(ll(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=on(r),o=await Jf(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),ll(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=Qa(a,{callbacks:s?.getChild()});try{let p=await d.stream(e,f);l=x9(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:Il(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(ll(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=>Jf(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),ll(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)=>Qa(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(ll(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.")}};LN=class extends gn{static lc_name(){return"RunnableAssign"}constructor(e){e instanceof qP&&(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]=pde(e),s=this.mapper.transform(a,Qa(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=on(r),i=new Mx({generator:this.transform(n(),o),config:o});return await i.setup,md.fromAsyncGenerator(i)}},E9=class extends gn{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=on(r),i=new Mx({generator:this.transform(n(),o),config:o});return await i.setup,md.fromAsyncGenerator(i)}},fz=class extends jx{constructor(e){let r=si.from([uf.from(async n=>{let o;if(NP(n))try{o=await this.schema.parseAsync(n.args)}catch{throw new wM("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 so,T9=O(()=>{ib();lf();nb();so=class extends gn{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=on(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=on(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=Il(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(e){return new LN(new qP({steps:e}))}}});var Wqe=O(()=>{lf();nb()});var Kqe=O(()=>{lf();nb();ib()});var Xde=O(()=>{Qm()});var Jqe=O(()=>{lf();SM();Qm();r9();n9();tz();Xde();o9();IN();FP()});var OM=O(()=>{SM();Qm();r9();n9();tz();o9();FP();Jqe();Xde();Xce();IN()});var Gqe=O(()=>{OM();lf();T9()});var Qde=O(()=>{lf();nb();T9();Wqe();Kqe();Gqe()});var PM,EM,Wp,FN=O(()=>{Qde();QU();PM=class extends gn{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"})}},EM=class extends PM{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")}},Wp=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");DP(this,"OUTPUT_PARSING_FAILURE")}}});function Dx(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(!Dx(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(!Dx(t[a],e[a]))return!1;return!0}return t===e}var efe=O(()=>{});function Kp(t){return encodeURI(mYt(t))}function mYt(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var A9=O(()=>{});function Nx(t,e=Object.create(null),r=bYt,n=""){if(t&&typeof t=="object"&&!Array.isArray(t)){let i=t.$id||t.id;if(i){let a=new URL(i,r.href);a.hash.length>1?e[a.href]=t:(a.hash="",n===""?r=a:Nx(t,e,r))}}else if(t!==!0&&t!==!1)return e;let o=r.href+(n?"#"+n:"");if(e[o]!==void 0)throw new Error(`Duplicate schema URI "${o}".`);if(e[o]=t,t===!0||t===!1)return e;if(t.__absolute_uri__===void 0&&Object.defineProperty(t,"__absolute_uri__",{enumerable:!1,value:o}),t.$ref&&t.__absolute_ref__===void 0){let i=new URL(t.$ref,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_ref__",{enumerable:!1,value:i.href})}if(t.$recursiveRef&&t.__absolute_recursive_ref__===void 0){let i=new URL(t.$recursiveRef,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(t.$anchor){let i=new URL("#"+t.$anchor,r.href);e[i.href]=t}for(let i in t){if(yYt[i])continue;let a=`${n}/${Kp(i)}`,s=t[i];if(Array.isArray(s)){if(hYt[i]){let u=s.length;for(let l=0;l<u;l++)Nx(s[l],e,r,`${a}/${l}`)}}else if(gYt[i])for(let u in s)Nx(s[u],e,r,`${a}/${Kp(u)}`);else Nx(s,e,r,a)}return e}var hYt,gYt,yYt,bYt,I9=O(()=>{A9();hYt={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},gYt={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},yYt={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},bYt=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 Yf(t){return t.test.bind(t)}function $Yt(t){return t%4===0&&(t%100!==0||t%400===0)}function Yqe(t){let e=t.match(_Yt);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&$Yt(r)?29:vYt[n])}function Zqe(t,e){let r=e.match(wYt);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 qYt(t){let e=t.split(BYt);return e.length==2&&Yqe(e[0])&&Zqe(!0,e[1])}function HYt(t){return UYt.test(t)&&zYt.test(t)}function WYt(t){if(VYt.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var _Yt,vYt,wYt,SYt,xYt,CYt,OYt,PYt,EYt,TYt,AYt,IYt,MYt,RYt,jYt,DYt,NYt,LYt,FYt,kYt,tfe,BYt,UYt,zYt,VYt,rfe=O(()=>{_Yt=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,vYt=[0,31,28,31,30,31,30,31,31,30,31,30,31],wYt=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,SYt=/^(?=.{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,xYt=/^(?:[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,CYt=/^(?:(?:[^\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,OYt=/^(?:(?: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,PYt=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,EYt=/^(?:\/(?:[^~/]|~0|~1)*)*$/,TYt=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,AYt=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,IYt=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,MYt=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,RYt=/^\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,jYt=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,DYt=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))},NYt=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,LYt=/^((([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,FYt=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));kYt={date:Yqe,time:Zqe.bind(void 0,!1),"date-time":qYt,duration:FYt,uri:HYt,"uri-reference":Yf(xYt),"uri-template":Yf(CYt),url:Yf(OYt),email:DYt,hostname:Yf(SYt),ipv4:Yf(NYt),ipv6:Yf(LYt),regex:WYt,uuid:Yf(PYt),"json-pointer":Yf(EYt),"json-pointer-uri-fragment":Yf(TYt),"relative-json-pointer":Yf(AYt)},tfe={...kYt,date:Yf(IYt),time:Yf(MYt),"date-time":Yf(RYt),"uri-reference":Yf(jYt)};BYt=/t|\s/i;UYt=/\/|:/,zYt=/^(?:[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;VYt=/[^\\]\\Z/});var Xqe,Qqe=O(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(Xqe||(Xqe={}))});function eUe(t){let e=0,r=t.length,n=0,o;for(;n<r;)e++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<r&&(o=t.charCodeAt(n),(o&64512)==56320&&n++);return e}var nfe=O(()=>{});function Hi(t,e,r="2019-09",n=Nx(e),o=!0,i=null,a="#",s="#",u=Object.create(null)){if(e===!0)return{valid:!0,errors:[]};if(e===!1)return{valid:!1,errors:[{instanceLocation:a,keyword:"false",keywordLocation:a,error:"False boolean schema."}]};let l=typeof t,c;switch(l){case"boolean":case"number":case"string":c=l;break;case"object":t===null?c="null":Array.isArray(t)?c="array":c="object";break;default:throw new Error(`Instances of "${l}" type are not supported.`)}let{$ref:d,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:b,required:g,not:_,anyOf:w,allOf:x,oneOf:C,if:E,then:P,else:A,format:I,properties:R,patternProperties:j,additionalProperties:D,unevaluatedProperties:k,minProperties:F,maxProperties:B,propertyNames:q,dependentRequired:W,dependentSchemas:H,dependencies:L,prefixItems:z,items:K,additionalItems:J,unevaluatedItems:ee,contains:Pe,minContains:G,maxContains:Z,minItems:ie,maxItems:Ie,uniqueItems:st,minimum:Te,maximum:Qe,exclusiveMinimum:nt,exclusiveMaximum:Ht,multipleOf:Me,minLength:ht,maxLength:Xt,pattern:nr,__absolute_ref__:Fr,__absolute_recursive_ref__:xe}=e,te=[];if(p===!0&&i===null&&(i=e),f==="#"){let je=i===null?n[xe]:i,Ee=`${s}/$recursiveRef`,re=Hi(t,i===null?e:i,r,n,o,je,a,Ee,u);re.valid||te.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:Ee,error:"A subschema had errors."},...re.errors)}if(d!==void 0){let Ee=n[Fr||d];if(Ee===void 0){let Se=`Unresolved $ref "${d}".`;throw Fr&&Fr!==d&&(Se+=` Absolute URI "${Fr}".`),Se+=`
Known schemas:
- ${Object.keys(n).join(`
- `)}`,new Error(Se)}let re=`${s}/$ref`,oe=Hi(t,Ee,r,n,o,i,a,re,u);if(oe.valid||te.push({instanceLocation:a,keyword:"$ref",keywordLocation:re,error:"A subschema had errors."},...oe.errors),r==="4"||r==="7")return{valid:te.length===0,errors:te}}if(Array.isArray(m)){let je=m.length,Ee=!1;for(let re=0;re<je;re++)if(c===m[re]||m[re]==="integer"&&c==="number"&&t%1===0&&t===t){Ee=!0;break}Ee||te.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m.join('", "')}".`})}else m==="integer"?(c!=="number"||t%1||t!==t)&&te.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`}):m!==void 0&&c!==m&&te.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`});if(h!==void 0&&(c==="object"||c==="array"?Dx(t,h)||te.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):t!==h&&te.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`})),b!==void 0&&(c==="object"||c==="array"?b.some(je=>Dx(t,je))||te.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(b)}.`}):b.some(je=>t===je)||te.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(b)}.`})),_!==void 0){let je=`${s}/not`;Hi(t,_,r,n,o,i,a,je).valid&&te.push({instanceLocation:a,keyword:"not",keywordLocation:je,error:'Instance matched "not" schema.'})}let ur=[];if(w!==void 0){let je=`${s}/anyOf`,Ee=te.length,re=!1;for(let oe=0;oe<w.length;oe++){let Se=w[oe],ve=Object.create(u),qe=Hi(t,Se,r,n,o,p===!0?i:null,a,`${je}/${oe}`,ve);te.push(...qe.errors),re=re||qe.valid,qe.valid&&ur.push(ve)}re?te.length=Ee:te.splice(Ee,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:je,error:"Instance does not match any subschemas."})}if(x!==void 0){let je=`${s}/allOf`,Ee=te.length,re=!0;for(let oe=0;oe<x.length;oe++){let Se=x[oe],ve=Object.create(u),qe=Hi(t,Se,r,n,o,p===!0?i:null,a,`${je}/${oe}`,ve);te.push(...qe.errors),re=re&&qe.valid,qe.valid&&ur.push(ve)}re?te.length=Ee:te.splice(Ee,0,{instanceLocation:a,keyword:"allOf",keywordLocation:je,error:"Instance does not match every subschema."})}if(C!==void 0){let je=`${s}/oneOf`,Ee=te.length,re=C.filter((oe,Se)=>{let ve=Object.create(u),qe=Hi(t,oe,r,n,o,p===!0?i:null,a,`${je}/${Se}`,ve);return te.push(...qe.errors),qe.valid&&ur.push(ve),qe.valid}).length;re===1?te.length=Ee:te.splice(Ee,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:je,error:`Instance does not match exactly one subschema (${re} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...ur),E!==void 0){let je=`${s}/if`;if(Hi(t,E,r,n,o,i,a,je,u).valid){if(P!==void 0){let re=Hi(t,P,r,n,o,i,a,`${s}/then`,u);re.valid||te.push({instanceLocation:a,keyword:"if",keywordLocation:je,error:'Instance does not match "then" schema.'},...re.errors)}}else if(A!==void 0){let re=Hi(t,A,r,n,o,i,a,`${s}/else`,u);re.valid||te.push({instanceLocation:a,keyword:"if",keywordLocation:je,error:'Instance does not match "else" schema.'},...re.errors)}}if(c==="object"){if(g!==void 0)for(let oe of g)oe in t||te.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${oe}".`});let je=Object.keys(t);if(F!==void 0&&je.length<F&&te.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${F} properties.`}),B!==void 0&&je.length>B&&te.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${B} properties.`}),q!==void 0){let oe=`${s}/propertyNames`;for(let Se in t){let ve=`${a}/${Kp(Se)}`,qe=Hi(Se,q,r,n,o,i,ve,oe);qe.valid||te.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:oe,error:`Property name "${Se}" does not match schema.`},...qe.errors)}}if(W!==void 0){let oe=`${s}/dependantRequired`;for(let Se in W)if(Se in t){let ve=W[Se];for(let qe of ve)qe in t||te.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:oe,error:`Instance has "${Se}" but does not have "${qe}".`})}}if(H!==void 0)for(let oe in H){let Se=`${s}/dependentSchemas`;if(oe in t){let ve=Hi(t,H[oe],r,n,o,i,a,`${Se}/${Kp(oe)}`,u);ve.valid||te.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:Se,error:`Instance has "${oe}" but does not match dependant schema.`},...ve.errors)}}if(L!==void 0){let oe=`${s}/dependencies`;for(let Se in L)if(Se in t){let ve=L[Se];if(Array.isArray(ve))for(let qe of ve)qe in t||te.push({instanceLocation:a,keyword:"dependencies",keywordLocation:oe,error:`Instance has "${Se}" but does not have "${qe}".`});else{let qe=Hi(t,ve,r,n,o,i,a,`${oe}/${Kp(Se)}`);qe.valid||te.push({instanceLocation:a,keyword:"dependencies",keywordLocation:oe,error:`Instance has "${Se}" but does not match dependant schema.`},...qe.errors)}}}let Ee=Object.create(null),re=!1;if(R!==void 0){let oe=`${s}/properties`;for(let Se in R){if(!(Se in t))continue;let ve=`${a}/${Kp(Se)}`,qe=Hi(t[Se],R[Se],r,n,o,i,ve,`${oe}/${Kp(Se)}`);if(qe.valid)u[Se]=Ee[Se]=!0;else if(re=o,te.push({instanceLocation:a,keyword:"properties",keywordLocation:oe,error:`Property "${Se}" does not match schema.`},...qe.errors),re)break}}if(!re&&j!==void 0){let oe=`${s}/patternProperties`;for(let Se in j){let ve=new RegExp(Se,"u"),qe=j[Se];for(let kr in t){if(!ve.test(kr))continue;let pi=`${a}/${Kp(kr)}`,sa=Hi(t[kr],qe,r,n,o,i,pi,`${oe}/${Kp(Se)}`);sa.valid?u[kr]=Ee[kr]=!0:(re=o,te.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:oe,error:`Property "${kr}" matches pattern "${Se}" but does not match associated schema.`},...sa.errors))}}}if(!re&&D!==void 0){let oe=`${s}/additionalProperties`;for(let Se in t){if(Ee[Se])continue;let ve=`${a}/${Kp(Se)}`,qe=Hi(t[Se],D,r,n,o,i,ve,oe);qe.valid?u[Se]=!0:(re=o,te.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:oe,error:`Property "${Se}" does not match additional properties schema.`},...qe.errors))}}else if(!re&&k!==void 0){let oe=`${s}/unevaluatedProperties`;for(let Se in t)if(!u[Se]){let ve=`${a}/${Kp(Se)}`,qe=Hi(t[Se],k,r,n,o,i,ve,oe);qe.valid?u[Se]=!0:te.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:oe,error:`Property "${Se}" does not match unevaluated properties schema.`},...qe.errors)}}}else if(c==="array"){Ie!==void 0&&t.length>Ie&&te.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${t.length} > ${Ie}).`}),ie!==void 0&&t.length<ie&&te.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${t.length} < ${ie}).`});let je=t.length,Ee=0,re=!1;if(z!==void 0){let oe=`${s}/prefixItems`,Se=Math.min(z.length,je);for(;Ee<Se;Ee++){let ve=Hi(t[Ee],z[Ee],r,n,o,i,`${a}/${Ee}`,`${oe}/${Ee}`);if(u[Ee]=!0,!ve.valid&&(re=o,te.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:oe,error:"Items did not match schema."},...ve.errors),re))break}}if(K!==void 0){let oe=`${s}/items`;if(Array.isArray(K)){let Se=Math.min(K.length,je);for(;Ee<Se;Ee++){let ve=Hi(t[Ee],K[Ee],r,n,o,i,`${a}/${Ee}`,`${oe}/${Ee}`);if(u[Ee]=!0,!ve.valid&&(re=o,te.push({instanceLocation:a,keyword:"items",keywordLocation:oe,error:"Items did not match schema."},...ve.errors),re))break}}else for(;Ee<je;Ee++){let Se=Hi(t[Ee],K,r,n,o,i,`${a}/${Ee}`,oe);if(u[Ee]=!0,!Se.valid&&(re=o,te.push({instanceLocation:a,keyword:"items",keywordLocation:oe,error:"Items did not match schema."},...Se.errors),re))break}if(!re&&J!==void 0){let Se=`${s}/additionalItems`;for(;Ee<je;Ee++){let ve=Hi(t[Ee],J,r,n,o,i,`${a}/${Ee}`,Se);u[Ee]=!0,ve.valid||(re=o,te.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:Se,error:"Items did not match additional items schema."},...ve.errors))}}}if(Pe!==void 0)if(je===0&&G===void 0)te.push({instanceLocation:a,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(G!==void 0&&je<G)te.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${je}) than minContains (${G}).`});else{let oe=`${s}/contains`,Se=te.length,ve=0;for(let qe=0;qe<je;qe++){let kr=Hi(t[qe],Pe,r,n,o,i,`${a}/${qe}`,oe);kr.valid?(u[qe]=!0,ve++):te.push(...kr.errors)}ve>=(G||0)&&(te.length=Se),G===void 0&&Z===void 0&&ve===0?te.splice(Se,0,{instanceLocation:a,keyword:"contains",keywordLocation:oe,error:"Array does not contain item matching schema."}):G!==void 0&&ve<G?te.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${G} items matching schema. Only ${ve} items were found.`}):Z!==void 0&&ve>Z&&te.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${Z} items matching schema. ${ve} items were found.`})}if(!re&&ee!==void 0){let oe=`${s}/unevaluatedItems`;for(Ee;Ee<je;Ee++){if(u[Ee])continue;let Se=Hi(t[Ee],ee,r,n,o,i,`${a}/${Ee}`,oe);u[Ee]=!0,Se.valid||te.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:oe,error:"Items did not match unevaluated items schema."},...Se.errors)}}if(st)for(let oe=0;oe<je;oe++){let Se=t[oe],ve=typeof Se=="object"&&Se!==null;for(let qe=0;qe<je;qe++){if(oe===qe)continue;let kr=t[qe];(Se===kr||ve&&(typeof kr=="object"&&kr!==null)&&Dx(Se,kr))&&(te.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${oe} and ${qe}.`}),oe=Number.MAX_SAFE_INTEGER,qe=Number.MAX_SAFE_INTEGER)}}}else if(c==="number"){if(r==="4"?(Te!==void 0&&(nt===!0&&t<=Te||t<Te)&&te.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${nt?"or equal to ":""} ${Te}.`}),Qe!==void 0&&(Ht===!0&&t>=Qe||t>Qe)&&te.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Ht?"or equal to ":""} ${Qe}.`})):(Te!==void 0&&t<Te&&te.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${Te}.`}),Qe!==void 0&&t>Qe&&te.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Qe}.`}),nt!==void 0&&t<=nt&&te.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${t} is less than ${nt}.`}),Ht!==void 0&&t>=Ht&&te.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${t} is greater than or equal to ${Ht}.`})),Me!==void 0){let je=t%Me;Math.abs(0-je)>=11920929e-14&&Math.abs(Me-je)>=11920929e-14&&te.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${t} is not a multiple of ${Me}.`})}}else if(c==="string"){let je=ht===void 0&&Xt===void 0?0:eUe(t);ht!==void 0&&je<ht&&te.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${je} < ${ht}).`}),Xt!==void 0&&je>Xt&&te.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${je} > ${Xt}).`}),nr!==void 0&&!new RegExp(nr,"u").test(t)&&te.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),I!==void 0&&tfe[I]&&!tfe[I](t)&&te.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${I}".`})}return{valid:te.length===0,errors:te}}var ofe=O(()=>{efe();I9();rfe();A9();nfe()});var tUe=O(()=>{I9();ofe()});var pz=O(()=>{efe();I9();rfe();A9();Qqe();nfe();ofe();tUe()});var TM,AM,UP=O(()=>{pz();FN();Qm();FP();DN();TM=class extends EM{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"})}},AM=class extends TM{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(Qce(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new Ln({message:o,text:o.content})}else if(Xm(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new Ln({message:rde(o),text:o.content})}else i=new Gf({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!Dx(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var rUe=O(()=>{UP()});var nUe=O(()=>{FN();UP()});var M9,oUe=O(()=>{UP();M9=class extends TM{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 pc,iUe=O(()=>{ud();fc();FN();pc=class extends EM{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=Ur.object(Object.fromEntries(Object.entries(e).map(([n,o])=>[n,Ur.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(po(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 Wp(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}}});var ife=O(()=>{Bce()});var mc,afe=O(()=>{UP();ife();Yce();mc=class extends AM{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?QW(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return Gce(e[0].text)}async parse(e){return Gce(e,JSON.parse)}getFormatInstructions(){return""}}});var aUe=O(()=>{});var sUe=O(()=>{UP();ife();aUe()});var uUe=O(()=>{FN();rUe();nUe();oUe();iUe();UP();afe();sUe()});var Mg=O(()=>{uUe()});var mz,kN,$N,R9,hz=O(()=>{yM();tz();FP();mz=class extends Vf{},kN=class extends mz{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 ps(this.value)]}},$N=class extends mz{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 af(this.messages)}toChatMessages(){return this.messages}},R9=class extends mz{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 ps({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var Lx,gz=O(()=>{hz();BN();Lx=class extends ab{async formatPromptValue(e){let r=await this.format(e);return new kN(r)}}});function ufe(t){return typeof t=="function"}function JYt(t){return UN(t)?"array":typeof t}function sfe(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function lUe(t,e){return t!=null&&typeof t=="object"&&e in t}function GYt(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function ZYt(t,e){return YYt.call(t,e)}function QYt(t){return!ZYt(XYt,t)}function tZt(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return eZt[r]})}function aZt(t,e){if(!t)return[];var r=!1,n=[],o=[],i=[],a=!1,s=!1,u="",l=0;function c(){if(a&&!s)for(;i.length;)delete o[i.pop()];else i=[];a=!1,s=!1}var d,f,p;function m(A){if(typeof A=="string"&&(A=A.split(nZt,2)),!UN(A)||A.length!==2)throw new Error("Invalid tags: "+A);d=new RegExp(sfe(A[0])+"\\s*"),f=new RegExp("\\s*"+sfe(A[1])),p=new RegExp("\\s*"+sfe("}"+A[1]))}m(e||th.tags);for(var h=new bz(t),b,g,_,w,x,C;!h.eos();){if(b=h.pos,_=h.scanUntil(d),_)for(var E=0,P=_.length;E<P;++E)w=_.charAt(E),QYt(w)?(i.push(o.length),u+=w):(s=!0,r=!0,u+=" "),o.push(["text",w,b,b+1]),b+=1,w===`
`&&(c(),u="",l=0,r=!1);if(!h.scan(d))break;if(a=!0,g=h.scan(iZt)||"name",h.scan(rZt),g==="="?(_=h.scanUntil(cUe),h.scan(cUe),h.scanUntil(f)):g==="{"?(_=h.scanUntil(p),h.scan(oZt),h.scanUntil(f),g="&"):_=h.scanUntil(f),!h.scan(f))throw new Error("Unclosed tag at "+h.pos);if(g==">"?x=[g,_,b,h.pos,u,l,r]:x=[g,_,b,h.pos],l++,o.push(x),g==="#"||g==="^")n.push(x);else if(g==="/"){if(C=n.pop(),!C)throw new Error('Unopened section "'+_+'" at '+b);if(C[1]!==_)throw new Error('Unclosed section "'+C[1]+'" at '+b)}else g==="name"||g==="{"||g==="&"?s=!0:g==="="&&m(_)}if(c(),C=n.pop(),C)throw new Error('Unclosed section "'+C[1]+'" at '+h.pos);return uZt(sZt(o))}function sZt(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 uZt(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 bz(t){this.string=t,this.tail=t,this.pos=0}function qN(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function cf(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}var KYt,UN,YYt,XYt,eZt,rZt,nZt,cUe,oZt,iZt,th,yz,j9,dUe=O(()=>{KYt=Object.prototype.toString,UN=Array.isArray||function(e){return KYt.call(e)==="[object Array]"};YYt=RegExp.prototype.test;XYt=/\S/;eZt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};rZt=/\s*/,nZt=/\s+/,cUe=/\s*=/,oZt=/\s*\}/,iZt=/#|\^|\/|>|\{|&|=|!/;bz.prototype.eos=function(){return this.tail===""};bz.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};bz.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};qN.prototype.push=function(e){return new qN(e,this)};qN.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=lUe(i,a[s])||GYt(i,a[s])),i=i[a[s++]];else i=o.view[e],u=lUe(o.view,e);if(u){n=i;break}o=o.parent}r[e]=n}return ufe(n)&&(n=n.call(this.view)),n};cf.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};cf.prototype.parse=function(e,r){var n=this.templateCache,o=e+":"+(r||th.tags).join(":"),i=typeof n<"u",a=i?n.get(o):void 0;return a==null&&(a=aZt(e,r),i&&n.set(o,a)),a};cf.prototype.render=function(e,r,n,o){var i=this.getConfigTags(o),a=this.parse(e,i),s=r instanceof qN?r:new qN(r,void 0);return this.renderTokens(a,s,n,e,o)};cf.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};cf.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(UN(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(ufe(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}};cf.prototype.renderInverted=function(e,r,n,o,i){var a=r.lookup(e[1]);if(!a||UN(a)&&a.length===0)return this.renderTokens(e[4],r,n,o,i)};cf.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(`
`)};cf.prototype.renderPartial=function(e,r,n,o){if(n){var i=this.getConfigTags(o),a=ufe(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)}}};cf.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};cf.prototype.escapedValue=function(e,r,n){var o=this.getConfigEscape(n)||th.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===th.escape?String(i):o(i)};cf.prototype.rawValue=function(e){return e[1]};cf.prototype.getConfigTags=function(e){return UN(e)?e:e&&typeof e=="object"?e.tags:void 0};cf.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!UN(e))return e.escape};th={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){yz.templateCache=t},get templateCache(){return yz.templateCache}},yz=new cf;th.clearCache=function(){return yz.clearCache()};th.parse=function(e,r){return yz.parse(e,r)};th.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+JYt(e)+'" was given as the first argument for mustache#render(template, view, partials)');return yz.render(e,r,n,o)};th.escape=tZt;th.Scanner=bz;th.Context=qN;th.Writer=cf;j9=th});function fUe(){j9.escape=t=>t}var _z,lZt,D9,cZt,dZt,lfe,fZt,Zf,vz,IM,MM=O(()=>{dUe();QU();_z=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},lZt=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]}),D9=t=>{fUe();let e=j9.parse(t);return lZt(e)},cZt=(t,e)=>_z(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},""),dZt=(t,e)=>(fUe(),j9.render(t,e)),lfe={"f-string":cZt,mustache:dZt},fZt={"f-string":_z,mustache:D9},Zf=(t,e,r)=>{try{return lfe[e](t,r)}catch(n){throw DP(n,"INVALID_PROMPT_INPUT")}},vz=(t,e)=>fZt[e](t),IM=(t,e,r)=>{if(!(e in lfe)){let n=Object.keys(lfe);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")Zf(o.text,e,n);else if(o.type==="image_url")if(typeof o.image_url=="string")Zf(o.image_url,e,n);else{let i=o.image_url.url;Zf(i,e,n)}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):Zf(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var cfe={};$f(cfe,{PromptTemplate:()=>hd});var hd,zN=O(()=>{gz();MM();hd=class t extends Lx{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))),IM(this.template,this.templateFormat,r)}}_getPromptType(){return"prompt"}async format(e){let r=await this.mergePartialAndUserVariables(e);return Zf(this.template,this.templateFormat,r)}static fromExamples(e,r,n,o=`
`,i=""){let a=[i,...e,r].join(o);return new t({inputVariables:n,template:a})}static fromTemplate(e,r){let{templateFormat:n="f-string",...o}=r??{},i=new Set;return vz(e,n).forEach(a=>{a.type==="variable"&&i.add(a.name)}),new t({inputVariables:[...i],templateFormat:n,template:e,...o})}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}serialize(){if(this.outputParser!==void 0)throw new Error("Cannot serialize a prompt template with an output parser");return{_type:this._getPromptType(),input_variables:this.inputVariables,template:this.template,template_format:this.templateFormat}}static async deserialize(e){if(!e.template)throw new Error("Prompt template must have a template");return new t({inputVariables:e.input_variables,template:e.template,templateFormat:e.template_format})}}});var HN,dfe=O(()=>{hz();BN();MM();HN=class t extends ab{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))),IM([{type:"image_url",image_url:this.template}],this.templateFormat,r)}}_getPromptType(){return"prompt"}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}async format(e){let r={};for(let[a,s]of Object.entries(this.template))typeof s=="string"?r[a]=Zf(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 R9(r)}}});function ffe(t,e){let r=[];for(let n of Object.values(t))if(typeof n=="string")vz(n,e).forEach(o=>{o.type==="variable"&&r.push(o.name)});else if(Array.isArray(n))for(let o of n)typeof o=="string"?vz(o,e).forEach(i=>{i.type==="variable"&&r.push(i.name)}):typeof o=="object"&&r.push(...ffe(o,e));else typeof n=="object"&&n!==null&&r.push(...ffe(n,e));return Array.from(new Set(r))}function pfe(t,e,r){let n={};for(let[o,i]of Object.entries(t))if(typeof i=="string")n[o]=Zf(i,r,e);else if(Array.isArray(i)){let a=[];for(let s of i)typeof s=="string"?a.push(Zf(s,r,e)):typeof s=="object"&&a.push(pfe(s,e,r));n[o]=a}else typeof i=="object"&&i!==null?n[o]=pfe(i,e,r):n[o]=i;return n}var wz,mfe=O(()=>{lf();MM();wz=class extends gn{static lc_name(){return"DictPromptTemplate"}constructor(e){let r=e.templateFormat??"f-string",n=ffe(e.template,r);super({inputVariables:n,...e}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","dict"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.template=e.template,this.templateFormat=r,this.inputVariables=n}async format(e){return pfe(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}}});function pZt(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).length===1&&"text"in t&&typeof t.text=="string"}function mZt(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:"image_url"in t&&(typeof t.image_url=="string"||typeof t.image_url=="object"&&t.image_url!==null&&"url"in t.image_url&&typeof t.image_url.url=="string")}function hZt(t){return typeof t.formatMessages=="function"}function gZt(t,e){if(hZt(t)||Xm(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 sb({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new sb({variableName:i,optional:!0})}throw new Error(`Invalid placeholder template for format ${e?.templateFormat??'"f-string"'}: "${t[1]}". Expected a variable name surrounded by ${e?.templateFormat==="mustache"?"double":"single"} curly braces.`)}let r=Eg(t),n;if(typeof r.content=="string"?n=r.content:n=r.content.map(o=>"text"in o?{...o,text:o.text}:"image_url"in o?{...o,image_url:o.image_url}:o),r._getType()==="human")return ub.fromTemplate(n,e);if(r._getType()==="ai")return yfe.fromTemplate(n,e);if(r._getType()==="system")return zP.fromTemplate(n,e);if(fs.isInstance(r))return gfe.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function yZt(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var Sz,sb,hfe,xz,gfe,Cz,ub,yfe,zP,Xf,Oz=O(()=>{OM();hz();lf();gz();BN();zN();dfe();MM();QU();mfe();Sz=class extends gn{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"})}},sb=class extends Sz{static lc_name(){return"MessagesPlaceholder"}constructor(e){typeof e=="string"&&(e={variableName:e}),super(e),Object.defineProperty(this,"variableName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"optional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.variableName=e.variableName,this.optional=e.optional??!1}get inputVariables(){return[this.variableName]}async formatMessages(e){let r=e[this.variableName];if(this.optional&&!r)return[];if(!r){let o=new Error(`Field "${this.variableName}" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages as an input value. Received: undefined`);throw o.name="InputFormatError",o}let n;try{Array.isArray(r)?n=r.map(Eg):n=[Eg(r)]}catch(o){let i=typeof r=="string"?r:JSON.stringify(r,null,2),a=new Error([`Field "${this.variableName}" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages or coerceable values as input.`,`Received value: ${i}`,`Additional message: ${o.message}`].join(`
`));throw a.name="InputFormatError",a.lc_error_code=o.lc_error_code,a}return n}},hfe=class extends Sz{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)]}},xz=class extends ab{constructor(e){super(e)}async format(e){return(await this.formatPromptValue(e)).toString()}async formatPromptValue(e){let r=await this.formatMessages(e);return new $N(r)}},gfe=class extends hfe{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 fs(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this(hd.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}};Cz=class extends Sz{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(hd.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string")n.push(hd.fromTemplate(o,r));else if(o!==null)if(pZt(o)){let i="";typeof o.text=="string"&&(i=o.text??"");let a={...r,additionalContentFields:o};n.push(hd.fromTemplate(i,a))}else if(mZt(o)){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=D9(i):u=_z(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 HN({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=D9(i.url):u=_z(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new HN({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else throw new Error("Invalid image template");n.push(a)}else typeof o=="object"&&n.push(new wz({template:o,templateFormat:r?.templateFormat}));return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof Lx){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 Lx){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"text",text:i})}else if(n instanceof HN){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"image_url",image_url:i})}else if(n instanceof wz){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,...i})}}return this.createMessage(r)}}async formatMessages(e){return[await this.format(e)]}},ub=class extends Cz{static _messageClass(){return ps}static lc_name(){return"HumanMessagePromptTemplate"}},yfe=class extends Cz{static _messageClass(){return fn}static lc_name(){return"AIMessagePromptTemplate"}},zP=class extends Cz{static _messageClass(){return Ix}static lc_name(){return"SystemMessagePromptTemplate"}};Xf=class t extends xz{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 ul))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 hd.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 ul)n.push(await this._parseImagePrompts(o,r));else{let i=o.inputVariables.reduce((s,u)=>{if(!(u in r)&&!(yZt(o)&&o.optional))throw DP(new Error(`Missing value for input variable \`${u.toString()}\``),"INVALID_PROMPT_INPUT");return s[u]=r[u],s},{}),a=await o.formatMessages(i);n=n.concat(a)}return n}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}static fromTemplate(e,r){let n=hd.fromTemplate(e,r),o=new ub({prompt:n});return this.fromMessages([o])}static fromMessages(e,r){let n=e.reduce((a,s)=>a.concat(s instanceof t?s.promptMessages:[gZt(s,r)]),[]),o=e.reduce((a,s)=>s instanceof t?Object.assign(a,s.partialVariables):a,Object.create(null)),i=new Set;for(let a of n)if(!(a instanceof ul))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 pUe={};$f(pUe,{FewShotChatMessagePromptTemplate:()=>_fe,FewShotPromptTemplate:()=>bfe});var bfe,_fe,vfe=O(()=>{gz();MM();zN();Oz();bfe=class t extends Lx{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))),IM(this.prefix+this.suffix,this.templateFormat,r)}}_getPromptType(){return"few_shot"}static lc_name(){return"FewShotPromptTemplate"}async getExamples(e){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(e);throw new Error("One of 'examples' and 'example_selector' should be provided")}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}async format(e){let r=await this.mergePartialAndUserVariables(e),n=await this.getExamples(r),o=await Promise.all(n.map(a=>this.examplePrompt.format(a))),i=[this.prefix,...o,this.suffix].join(this.exampleSeparator);return Zf(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 hd.deserialize(r),o;if(Array.isArray(e.examples))o=e.examples;else throw new Error("Invalid examples format. Only list or string are supported.");return new t({inputVariables:e.input_variables,examplePrompt:n,examples:o,exampleSeparator:e.example_separator,prefix:e.prefix,suffix:e.suffix,templateFormat:e.template_format})}},_fe=class t extends xz{_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))),IM(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 Zf(a,this.templateFormat,r)}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}}});var ab,BN=O(()=>{lf();ab=class extends gn{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(()=>(zN(),cfe));return r.deserialize(e)}case void 0:{let{PromptTemplate:r}=await Promise.resolve().then(()=>(zN(),cfe));return r.deserialize({...e,_type:"prompt"})}case"few_shot":{let{FewShotPromptTemplate:r}=await Promise.resolve().then(()=>(vfe(),pUe));return r.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}});var mUe=O(()=>{BN();Oz()});var hUe=O(()=>{});var gUe=O(()=>{Oz()});var yUe=O(()=>{BN();Oz();vfe();mUe();zN();hUe();gz();MM();dfe();gUe();mfe()});var HP=O(()=>{yUe()});var Jp=O(()=>{Qde()});var wfe,Sfe=O(()=>{wfe=t=>t.map(e=>e.pageContent).join(`
`)});var bUe=O(()=>{Sfe()});function Fx(t,e){let r=`atom${++bZt}`,n={toString(){return(ca.env?ca.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=_Zt,n.write=vZt),e&&(n.write=e),n}function _Zt(t){return t(this)}function vZt(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var ca,bZt,_Ue,xfe,Cfe,L9,Pfe,wZt,SZt,Efe,vUe,N9,xUe,wUe,VN,Ofe,xZt,CZt,SUe,VP,CUe,F9,Pz,OUe,Tfe=O(()=>{ca={},bZt=0;_Ue=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,xfe=t=>"init"in t,Cfe=t=>!!t.write,L9=new WeakMap,Pfe=t=>{var e;return Efe(t)&&!((e=L9.get(t))!=null&&e[1])},wZt=(t,e)=>{let r=L9.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((ca.env?ca.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},SZt=t=>{if(L9.has(t))return;let e=[new Set,!1];L9.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},Efe=t=>typeof t?.then=="function",vUe=t=>"v"in t||"e"in t,N9=t=>{if("e"in t)throw t.e;if((ca.env?ca.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},xUe=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},wUe=(t,e,r,n,o)=>{var i;if((ca.env?ca.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),Pfe(r.v)&&xUe(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&xZt(t,n,e)},VN=()=>[new Map,new Map,new Set],Ofe=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},xZt=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},CZt=(t,e)=>t[0].get(e),SUe=(t,e)=>{t[2].add(e)},VP=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},CUe=(...[t,e,r,n])=>{let o;(ca.env?ca.env.MODE:void 0)!=="production"&&(o=new Set);let i=(w,x,C)=>{let E="v"in x,P=x.v,A=Pfe(x.v)?x.v:null;if(Efe(C)){SZt(C);for(let I of x.d.keys())xUe(w,C,t(I));x.v=C,delete x.e}else x.v=C,delete x.e;(!E||!Object.is(P,x.v))&&(++x.n,A&&wZt(A,C))},a=(w,x,C)=>{var E;let P=t(x);if(vUe(P)&&(P.m&&!C?.has(x)||Array.from(P.d).every(([k,F])=>a(w,k,C).n===F)))return P;P.d.clear();let A=!0,I=k=>{if(_Ue(x,k)){let B=t(k);if(!vUe(B))if(xfe(k))i(k,B,k.init);else throw new Error("no atom init");return N9(B)}let F=a(w,k,C);try{return N9(F)}finally{if(A)wUe(w,x,P,k,F);else{let B=VN();wUe(B,x,P,k,F),p(B,x,P),VP(B)}}},R,j,D={get signal(){return R||(R=new AbortController),R.signal},get setSelf(){return(ca.env?ca.env.MODE:void 0)!=="production"&&!Cfe(x)&&console.warn("setSelf function cannot be used with read-only atom"),!j&&Cfe(x)&&(j=(...k)=>{if((ca.env?ca.env.MODE:void 0)!=="production"&&A&&console.warn("setSelf function cannot be called in sync"),!A)return f(x,...k)}),j}};try{let k=e(x,I,D);if(i(x,P,k),Efe(k)){(E=k.onCancel)==null||E.call(k,()=>R?.abort());let F=()=>{if(P.m){let B=VN();p(B,x,P),VP(B)}};k.then(F,F)}return P}catch(k){return delete P.v,P.e=k,++P.n,P}finally{A=!1}},s=w=>N9(a(void 0,w)),u=(w,x,C)=>{var E,P;let A=new Map;for(let I of((E=C.m)==null?void 0:E.t)||[])A.set(I,t(I));for(let I of C.p)A.set(I,t(I));return(P=CZt(w,x))==null||P.forEach(I=>{A.set(I,t(I))}),A};function l(w,x,C){let E=[],P=new Set,A=new Set,I=[[x,C]];for(;I.length>0;){let[R,j]=I[I.length-1];if(A.has(R)){I.pop();continue}if(P.has(R)){E.push([R,j,j.n]),A.add(R),I.pop();continue}P.add(R);for(let[D,k]of u(w,R,j))R!==D&&!P.has(D)&&I.push([D,k])}return[E,A]}let c=(w,x,C)=>{let[E,P]=l(w,x,C),A=new Set([x]);for(let I=E.length-1;I>=0;--I){let[R,j,D]=E[I],k=!1;for(let F of j.d.keys())if(F!==R&&A.has(F)){k=!0;break}k&&(a(w,R,P),p(w,R,j),D!==j.n&&(Ofe(w,R,j),A.add(R))),P.delete(R)}},d=(w,x,...C)=>{let E=!0,P=I=>N9(a(w,I)),A=(I,...R)=>{let j=t(I);try{if(_Ue(x,I)){if(!xfe(I))throw new Error("atom not writable");let D=j.n,k=R[0];i(I,j,k),p(w,I,j),D!==j.n&&(Ofe(w,I,j),c(w,I,j));return}else return d(w,I,...R)}finally{E||VP(w)}};try{return r(x,P,A,...C)}finally{E=!1}},f=(w,...x)=>{let C=VN();try{return d(C,w,...x)}finally{VP(C)}},p=(w,x,C)=>{if(C.m&&!Pfe(C.v)){for(let E of C.d.keys())C.m.d.has(E)||(m(w,E,t(E)).t.add(x),C.m.d.add(E));for(let E of C.m.d||[])if(!C.d.has(E)){C.m.d.delete(E);let P=h(w,E,t(E));P?.t.delete(x)}}},m=(w,x,C)=>{if(!C.m){a(w,x);for(let E of C.d.keys())m(w,E,t(E)).t.add(x);if(C.m={l:new Set,d:new Set(C.d.keys()),t:new Set},(ca.env?ca.env.MODE:void 0)!=="production"&&o.add(x),Cfe(x)){let E=C.m,P,A=(I,R)=>{let j=!0;P=(...D)=>{try{return d(I,x,...D)}finally{j||VP(I)}};try{return R()}finally{j=!1}};SUe(w,()=>{let I=A(w,()=>n(x,(...R)=>P(...R)));I&&(E.u=R=>A(R,I))})}}return C.m},h=(w,x,C)=>{if(C.m&&!C.m.l.size&&!Array.from(C.m.t).some(E=>{var P;return(P=t(E).m)==null?void 0:P.d.has(x)})){let E=C.m.u;E&&SUe(w,()=>E(w)),delete C.m,(ca.env?ca.env.MODE:void 0)!=="production"&&o.delete(x);for(let P of C.d.keys()){let A=h(w,P,t(P));A?.t.delete(x)}return}return C.m},_={get:s,set:f,sub:(w,x)=>{let C=VN(),E=t(w),A=m(C,w,E).l;return A.add(x),VP(C),()=>{A.delete(x);let I=VN();h(I,w,E),VP(I)}},unstable_derive:w=>CUe(...w(t,e,r,n))};return(ca.env?ca.env.MODE:void 0)!=="production"&&Object.assign(_,{dev4_get_internal_weak_map:()=>({get:x=>{let C=t(x);if(C.n!==0)return C}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:x=>{let C=VN();for(let[E,P]of x)if(xfe(E)){let A=t(E),I=A.n;i(E,A,P),p(C,E,A),I!==A.n&&(Ofe(C,E,A),c(C,E,A))}VP(C)}}),_},F9=()=>{let t=new WeakMap;return CUe(r=>{if((ca.env?ca.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)})},OUe=()=>(Pz||(Pz=F9(),(ca.env?ca.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Pz),globalThis.__JOTAI_DEFAULT_STORE__!==Pz&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Pz)});var LUe=v(On=>{"use strict";var Ez=Symbol.for("react.element"),OZt=Symbol.for("react.portal"),PZt=Symbol.for("react.fragment"),EZt=Symbol.for("react.strict_mode"),TZt=Symbol.for("react.profiler"),AZt=Symbol.for("react.provider"),IZt=Symbol.for("react.context"),MZt=Symbol.for("react.forward_ref"),RZt=Symbol.for("react.suspense"),jZt=Symbol.for("react.memo"),DZt=Symbol.for("react.lazy"),PUe=Symbol.iterator;function NZt(t){return t===null||typeof t!="object"?null:(t=PUe&&t[PUe]||t["@@iterator"],typeof t=="function"?t:null)}var AUe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},IUe=Object.assign,MUe={};function WN(t,e,r){this.props=t,this.context=e,this.refs=MUe,this.updater=r||AUe}WN.prototype.isReactComponent={};WN.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")};WN.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function RUe(){}RUe.prototype=WN.prototype;function Ife(t,e,r){this.props=t,this.context=e,this.refs=MUe,this.updater=r||AUe}var Mfe=Ife.prototype=new RUe;Mfe.constructor=Ife;IUe(Mfe,WN.prototype);Mfe.isPureReactComponent=!0;var EUe=Array.isArray,jUe=Object.prototype.hasOwnProperty,Rfe={current:null},DUe={key:!0,ref:!0,__self:!0,__source:!0};function NUe(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)jUe.call(e,n)&&!DUe.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:Ez,type:t,key:i,ref:a,props:o,_owner:Rfe.current}}function LZt(t,e){return{$$typeof:Ez,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function jfe(t){return typeof t=="object"&&t!==null&&t.$$typeof===Ez}function FZt(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var TUe=/\/+/g;function Afe(t,e){return typeof t=="object"&&t!==null&&t.key!=null?FZt(""+t.key):e.toString(36)}function $9(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 Ez:case OZt:a=!0}}if(a)return a=t,o=o(a),t=n===""?"."+Afe(a,0):n,EUe(o)?(r="",t!=null&&(r=t.replace(TUe,"$&/")+"/"),$9(o,e,r,"",function(l){return l})):o!=null&&(jfe(o)&&(o=LZt(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(TUe,"$&/")+"/")+t)),e.push(o)),1;if(a=0,n=n===""?".":n+":",EUe(t))for(var s=0;s<t.length;s++){i=t[s];var u=n+Afe(i,s);a+=$9(i,e,r,u,o)}else if(u=NZt(t),typeof u=="function")for(t=u.call(t),s=0;!(i=t.next()).done;)i=i.value,u=n+Afe(i,s++),a+=$9(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 k9(t,e,r){if(t==null)return t;var n=[],o=0;return $9(t,n,"","",function(i){return e.call(r,i,o++)}),n}function kZt(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 df={current:null},B9={transition:null},$Zt={ReactCurrentDispatcher:df,ReactCurrentBatchConfig:B9,ReactCurrentOwner:Rfe};On.Children={map:k9,forEach:function(t,e,r){k9(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return k9(t,function(){e++}),e},toArray:function(t){return k9(t,function(e){return e})||[]},only:function(t){if(!jfe(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};On.Component=WN;On.Fragment=PZt;On.Profiler=TZt;On.PureComponent=Ife;On.StrictMode=EZt;On.Suspense=RZt;On.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$Zt;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=IUe({},t.props),o=t.key,i=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,a=Rfe.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(u in e)jUe.call(e,u)&&!DUe.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:Ez,type:t.type,key:o,ref:i,props:n,_owner:a}};On.createContext=function(t){return t={$$typeof:IZt,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:AZt,_context:t},t.Consumer=t};On.createElement=NUe;On.createFactory=function(t){var e=NUe.bind(null,t);return e.type=t,e};On.createRef=function(){return{current:null}};On.forwardRef=function(t){return{$$typeof:MZt,render:t}};On.isValidElement=jfe;On.lazy=function(t){return{$$typeof:DZt,_payload:{_status:-1,_result:t},_init:kZt}};On.memo=function(t,e){return{$$typeof:jZt,type:t,compare:e===void 0?null:e}};On.startTransition=function(t){var e=B9.transition;B9.transition={};try{t()}finally{B9.transition=e}};On.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};On.useCallback=function(t,e){return df.current.useCallback(t,e)};On.useContext=function(t){return df.current.useContext(t)};On.useDebugValue=function(){};On.useDeferredValue=function(t){return df.current.useDeferredValue(t)};On.useEffect=function(t,e){return df.current.useEffect(t,e)};On.useId=function(){return df.current.useId()};On.useImperativeHandle=function(t,e,r){return df.current.useImperativeHandle(t,e,r)};On.useInsertionEffect=function(t,e){return df.current.useInsertionEffect(t,e)};On.useLayoutEffect=function(t,e){return df.current.useLayoutEffect(t,e)};On.useMemo=function(t,e){return df.current.useMemo(t,e)};On.useReducer=function(t,e,r){return df.current.useReducer(t,e,r)};On.useRef=function(t){return df.current.useRef(t)};On.useState=function(t){return df.current.useState(t)};On.useSyncExternalStore=function(t,e,r){return df.current.useSyncExternalStore(t,e,r)};On.useTransition=function(){return df.current.useTransition()};On.version="18.2.0"});var Y=v((sRn,FUe)=>{"use strict";FUe.exports=LUe()});function Lfe(t,e){let r=$Ue(e),[[n,o,i],a]=(0,gd.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,gd.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);Nfe(c)&&BUe(kUe(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,gd.useDebugValue)(s),Nfe(s)){let l=kUe(s);return qZt(l)}return s}function UZt(t,e){let r=$Ue(e);return(0,gd.useCallback)((...o)=>{if((q9.env?q9.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function U9(t,e){return[Lfe(t,e),UZt(t,e)]}var gd,q9,BZt,$Ue,Nfe,BUe,qZt,Dfe,kUe,qUe=O(()=>{"use client";gd=$(Y(),1);Tfe();q9={},BZt=(0,gd.createContext)(void 0),$Ue=t=>{let e=(0,gd.useContext)(BZt);return t?.store||e||OUe()},Nfe=t=>typeof t?.then=="function",BUe=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},qZt=gd.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(BUe(t),t)}),Dfe=new WeakMap,kUe=t=>{let e=Dfe.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((q9.env?q9.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");Nfe(l)?(Dfe.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),Dfe.set(t,e)),e}});var Ffe=O(()=>{Tfe();qUe()});function WP(t){let e=zZt({...ne(),...t});cl.set(RM,e)}function Je(t,e){let r=ne();WP({...r,[t]:e})}function ne(){return cl.get(RM)}function zUe(){let t={...Qf,activeModels:lb.map(e=>({...e,enabled:!0})),activeEmbeddingModels:jM.map(e=>({...e,enabled:!0}))};WP(t)}function Mi(t){let e=ne();return cl.sub(RM,()=>{let r=ne();t(e,r),e=r})}function Pn(){return Lfe(RM,{store:cl})}function HUe(t){let e=t||Qf;e.userId||(e.userId=GI()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(u=>({...u,provider:u.provider==="azure_openai"?"azure openai":u.provider})):e.activeEmbeddingModels=jM.map(u=>({...u,enabled:!0}));let r={...e},n=Number(e.temperature);r.temperature=isNaN(n)?Qf.temperature:n;let o=Number(e.maxTokens);r.maxTokens=isNaN(o)?Qf.maxTokens:o;let i=Number(e.contextTurns);r.contextTurns=isNaN(i)?Qf.contextTurns:i;let a=Number(e.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(a)?Qf.embeddingRequestsPerMin:a;let s=Number(e.embeddingBatchSize);return r.embeddingBatchSize=isNaN(s)?Qf.embeddingBatchSize:s,typeof r.includeActiveNoteAsContext!="boolean"&&(r.includeActiveNoteAsContext=Qf.includeActiveNoteAsContext),typeof r.passMarkdownImages!="boolean"&&(r.passMarkdownImages=Qf.passMarkdownImages),typeof r.enableCustomPromptTemplating!="boolean"&&(r.enableCustomPromptTemplating=Qf.enableCustomPromptTemplating),typeof r.allowAdditionalContext!="boolean"&&(r.allowAdditionalContext=Qf.allowAdditionalContext),typeof r.enableWordCompletion!="boolean"&&(r.enableWordCompletion=Qf.enableWordCompletion),r}function VUe(){return ne().isPlusUser?KUe:""}function KP(){let t=ne().userSystemPrompt,e=WUe;return t?`${e}
<user_custom_instructions>
${t}
</user_custom_instructions>`:e}function zZt(t){return t.activeModels=UUe(t.activeModels,lb),t.activeEmbeddingModels=UUe(t.activeEmbeddingModels,jM),t}function Dr(t){return`${t.name}|${t.provider}`}function UUe(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(Dr(n),{...n})}),t.forEach(n=>{let o=Dr(n),i=r.get(o);if(i){let a=e.find(s=>s.name===n.name&&s.provider===n.provider);a?r.set(o,{...a,...n,isBuiltIn:!0,believerExclusive:a.believerExclusive}):r.set(o,{...n,isBuiltIn:i.isBuiltIn})}else r.set(o,n)}),Array.from(r.values())}var cl,RM,Jt=O(()=>{Ffe();iW();Zr();cl=F9(),RM=Fx(Qf)});function ae(...t){ne().debug&&console.log(...t)}function fe(...t){ne().debug&&console.error(...t)}function kx(...t){ne().debug&&console.warn(...t)}var mo=O(()=>{Jt()});var JUe=v((kfe,KN)=>{(function(t,e){typeof kfe=="object"&&typeof KN<"u"?KN.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(kfe,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(y){t=y}function n(y){return y instanceof Array||Object.prototype.toString.call(y)==="[object Array]"}function o(y){return y!=null&&Object.prototype.toString.call(y)==="[object Object]"}function i(y,S){return Object.prototype.hasOwnProperty.call(y,S)}function a(y){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(y).length===0;var S;for(S in y)if(i(y,S))return!1;return!0}function s(y){return y===void 0}function u(y){return typeof y=="number"||Object.prototype.toString.call(y)==="[object Number]"}function l(y){return y instanceof Date||Object.prototype.toString.call(y)==="[object Date]"}function c(y,S){var T=[],M,N=y.length;for(M=0;M<N;++M)T.push(S(y[M],M));return T}function d(y,S){for(var T in S)i(S,T)&&(y[T]=S[T]);return i(S,"toString")&&(y.toString=S.toString),i(S,"valueOf")&&(y.valueOf=S.valueOf),y}function f(y,S,T,M){return ALe(y,S,T,M,!0).utc()}function p(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function m(y){return y._pf==null&&(y._pf=p()),y._pf}var h;Array.prototype.some?h=Array.prototype.some:h=function(y){var S=Object(this),T=S.length>>>0,M;for(M=0;M<T;M++)if(M in S&&y.call(this,S[M],M,S))return!0;return!1};function b(y){if(y._isValid==null){var S=m(y),T=h.call(S.parsedDateParts,function(N){return N!=null}),M=!isNaN(y._d.getTime())&&S.overflow<0&&!S.empty&&!S.invalidEra&&!S.invalidMonth&&!S.invalidWeekday&&!S.weekdayMismatch&&!S.nullInput&&!S.invalidFormat&&!S.userInvalidated&&(!S.meridiem||S.meridiem&&T);if(y._strict&&(M=M&&S.charsLeftOver===0&&S.unusedTokens.length===0&&S.bigHour===void 0),Object.isFrozen==null||!Object.isFrozen(y))y._isValid=M;else return M}return y._isValid}function g(y){var S=f(NaN);return y!=null?d(m(S),y):m(S).userInvalidated=!0,S}var _=e.momentProperties=[],w=!1;function x(y,S){var T,M,N,V=_.length;if(s(S._isAMomentObject)||(y._isAMomentObject=S._isAMomentObject),s(S._i)||(y._i=S._i),s(S._f)||(y._f=S._f),s(S._l)||(y._l=S._l),s(S._strict)||(y._strict=S._strict),s(S._tzm)||(y._tzm=S._tzm),s(S._isUTC)||(y._isUTC=S._isUTC),s(S._offset)||(y._offset=S._offset),s(S._pf)||(y._pf=m(S)),s(S._locale)||(y._locale=S._locale),V>0)for(T=0;T<V;T++)M=_[T],N=S[M],s(N)||(y[M]=N);return y}function C(y){x(this,y),this._d=new Date(y._d!=null?y._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),w===!1&&(w=!0,e.updateOffset(this),w=!1)}function E(y){return y instanceof C||y!=null&&y._isAMomentObject!=null}function P(y){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+y)}function A(y,S){var T=!0;return d(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,y),T){var M=[],N,V,ce,Vt=arguments.length;for(V=0;V<Vt;V++){if(N="",typeof arguments[V]=="object"){N+=`
[`+V+"] ";for(ce in arguments[0])i(arguments[0],ce)&&(N+=ce+": "+arguments[0][ce]+", ");N=N.slice(0,-2)}else N=arguments[V];M.push(N)}P(y+`
Arguments: `+Array.prototype.slice.call(M).join("")+`
`+new Error().stack),T=!1}return S.apply(this,arguments)},S)}var I={};function R(y,S){e.deprecationHandler!=null&&e.deprecationHandler(y,S),I[y]||(P(S),I[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 D(y){var S,T;for(T in y)i(y,T)&&(S=y[T],j(S)?this[T]=S:this["_"+T]=S);this._config=y,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function k(y,S){var T=d({},y),M;for(M in S)i(S,M)&&(o(y[M])&&o(S[M])?(T[M]={},d(T[M],y[M]),d(T[M],S[M])):S[M]!=null?T[M]=S[M]:delete T[M]);for(M in y)i(y,M)&&!i(S,M)&&o(y[M])&&(T[M]=d({},T[M]));return T}function F(y){y!=null&&this.set(y)}var B;Object.keys?B=Object.keys:B=function(y){var S,T=[];for(S in y)i(y,S)&&T.push(S);return T};var q={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function W(y,S,T){var M=this._calendar[y]||this._calendar.sameElse;return j(M)?M.call(S,T):M}function H(y,S,T){var M=""+Math.abs(y),N=S-M.length,V=y>=0;return(V?T?"+":"":"-")+Math.pow(10,Math.max(0,N)).toString().substr(1)+M}var L=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,z=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,K={},J={};function ee(y,S,T,M){var N=M;typeof M=="string"&&(N=function(){return this[M]()}),y&&(J[y]=N),S&&(J[S[0]]=function(){return H(N.apply(this,arguments),S[1],S[2])}),T&&(J[T]=function(){return this.localeData().ordinal(N.apply(this,arguments),y)})}function Pe(y){return y.match(/\[[\s\S]/)?y.replace(/^\[|\]$/g,""):y.replace(/\\/g,"")}function G(y){var S=y.match(L),T,M;for(T=0,M=S.length;T<M;T++)J[S[T]]?S[T]=J[S[T]]:S[T]=Pe(S[T]);return function(N){var V="",ce;for(ce=0;ce<M;ce++)V+=j(S[ce])?S[ce].call(N,y):S[ce];return V}}function Z(y,S){return y.isValid()?(S=ie(S,y.localeData()),K[S]=K[S]||G(S),K[S](y)):y.localeData().invalidDate()}function ie(y,S){var T=5;function M(N){return S.longDateFormat(N)||N}for(z.lastIndex=0;T>=0&&z.test(y);)y=y.replace(z,M),z.lastIndex=0,T-=1;return y}var Ie={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 st(y){var S=this._longDateFormat[y],T=this._longDateFormat[y.toUpperCase()];return S||!T?S:(this._longDateFormat[y]=T.match(L).map(function(M){return M==="MMMM"||M==="MM"||M==="DD"||M==="dddd"?M.slice(1):M}).join(""),this._longDateFormat[y])}var Te="Invalid date";function Qe(){return this._invalidDate}var nt="%d",Ht=/\d{1,2}/;function Me(y){return this._ordinal.replace("%d",y)}var ht={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 Xt(y,S,T,M){var N=this._relativeTime[T];return j(N)?N(y,S,T,M):N.replace(/%d/i,y)}function nr(y,S){var T=this._relativeTime[y>0?"future":"past"];return j(T)?T(S):T.replace(/%s/i,S)}var Fr={};function xe(y,S){var T=y.toLowerCase();Fr[T]=Fr[T+"s"]=Fr[S]=y}function te(y){return typeof y=="string"?Fr[y]||Fr[y.toLowerCase()]:void 0}function ur(y){var S={},T,M;for(M in y)i(y,M)&&(T=te(M),T&&(S[T]=y[M]));return S}var je={};function Ee(y,S){je[y]=S}function re(y){var S=[],T;for(T in y)i(y,T)&&S.push({unit:T,priority:je[T]});return S.sort(function(M,N){return M.priority-N.priority}),S}function oe(y){return y%4===0&&y%100!==0||y%400===0}function Se(y){return y<0?Math.ceil(y)||0:Math.floor(y)}function ve(y){var S=+y,T=0;return S!==0&&isFinite(S)&&(T=Se(S)),T}function qe(y,S){return function(T){return T!=null?(pi(this,y,T),e.updateOffset(this,S),this):kr(this,y)}}function kr(y,S){return y.isValid()?y._d["get"+(y._isUTC?"UTC":"")+S]():NaN}function pi(y,S,T){y.isValid()&&!isNaN(T)&&(S==="FullYear"&&oe(y.year())&&y.month()===1&&y.date()===29?(T=ve(T),y._d["set"+(y._isUTC?"UTC":"")+S](T,y.month(),W5(T,y.month()))):y._d["set"+(y._isUTC?"UTC":"")+S](T))}function sa(y){return y=te(y),j(this[y])?this[y]():this}function uc(y,S){if(typeof y=="object"){y=ur(y);var T=re(y),M,N=T.length;for(M=0;M<N;M++)this[T[M].unit](y[T[M].unit])}else if(y=te(y),j(this[y]))return this[y](S);return this}var Wd=/\d/,ua=/\d\d/,Ff=/\d{3}/,od=/\d{4}/,Kd=/[+-]?\d{6}/,$r=/\d\d?/,Zy=/\d\d\d\d?/,dx=/\d\d\d\d\d\d?/,xP=/\d{1,3}/,Ya=/\d{1,4}/,Ps=/[+-]?\d{1,6}/,Pa=/\d+/,Jd=/[+-]?\d+/,id=/Z|[+-]\d\d:?\d\d/gi,ls=/Z|[+-]\d\d(?::?\d\d)?/gi,kf=/[+-]?\d+(\.\d{1,3})?/,Gd=/[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,Cn;Cn={};function We(y,S,T){Cn[y]=j(S)?S:function(M,N){return M&&T?T:S}}function Yd(y,S){return i(Cn,y)?Cn[y](S._strict,S._locale):new RegExp(Bp(y))}function Bp(y){return al(y.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(S,T,M,N,V){return T||M||N||V}))}function al(y){return y.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var fx={};function Sn(y,S){var T,M=S,N;for(typeof y=="string"&&(y=[y]),u(S)&&(M=function(V,ce){ce[S]=ve(V)}),N=y.length,T=0;T<N;T++)fx[y[T]]=M}function xg(y,S){Sn(y,function(T,M,N,V){N._w=N._w||{},S(T,N._w,N,V)})}function OU(y,S,T){S!=null&&i(fx,y)&&fx[y](S,T._a,T,y)}var ad=0,px=1,Xy=2,sl=3,Cg=4,mx=5,WI=6,HVt=7,VVt=8;function WVt(y,S){return(y%S+S)%S}var cs;Array.prototype.indexOf?cs=Array.prototype.indexOf:cs=function(y){var S;for(S=0;S<this.length;++S)if(this[S]===y)return S;return-1};function W5(y,S){if(isNaN(y)||isNaN(S))return NaN;var T=WVt(S,12);return y+=(S-T)/12,T===1?oe(y)?29:28:31-T%7%2}ee("M",["MM",2],"Mo",function(){return this.month()+1}),ee("MMM",0,0,function(y){return this.localeData().monthsShort(this,y)}),ee("MMMM",0,0,function(y){return this.localeData().months(this,y)}),xe("month","M"),Ee("month",8),We("M",$r),We("MM",$r,ua),We("MMM",function(y,S){return S.monthsShortRegex(y)}),We("MMMM",function(y,S){return S.monthsRegex(y)}),Sn(["M","MM"],function(y,S){S[px]=ve(y)-1}),Sn(["MMM","MMMM"],function(y,S,T,M){var N=T._locale.monthsParse(y,M,T._strict);N!=null?S[px]=N:m(T).invalidMonth=y});var KVt="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),mLe="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),hLe=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,JVt=Gd,GVt=Gd;function YVt(y,S){return y?n(this._months)?this._months[y.month()]:this._months[(this._months.isFormat||hLe).test(S)?"format":"standalone"][y.month()]:n(this._months)?this._months:this._months.standalone}function ZVt(y,S){return y?n(this._monthsShort)?this._monthsShort[y.month()]:this._monthsShort[hLe.test(S)?"format":"standalone"][y.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function XVt(y,S,T){var M,N,V,ce=y.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],M=0;M<12;++M)V=f([2e3,M]),this._shortMonthsParse[M]=this.monthsShort(V,"").toLocaleLowerCase(),this._longMonthsParse[M]=this.months(V,"").toLocaleLowerCase();return T?S==="MMM"?(N=cs.call(this._shortMonthsParse,ce),N!==-1?N:null):(N=cs.call(this._longMonthsParse,ce),N!==-1?N:null):S==="MMM"?(N=cs.call(this._shortMonthsParse,ce),N!==-1?N:(N=cs.call(this._longMonthsParse,ce),N!==-1?N:null)):(N=cs.call(this._longMonthsParse,ce),N!==-1?N:(N=cs.call(this._shortMonthsParse,ce),N!==-1?N:null))}function QVt(y,S,T){var M,N,V;if(this._monthsParseExact)return XVt.call(this,y,S,T);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),M=0;M<12;M++){if(N=f([2e3,M]),T&&!this._longMonthsParse[M]&&(this._longMonthsParse[M]=new RegExp("^"+this.months(N,"").replace(".","")+"$","i"),this._shortMonthsParse[M]=new RegExp("^"+this.monthsShort(N,"").replace(".","")+"$","i")),!T&&!this._monthsParse[M]&&(V="^"+this.months(N,"")+"|^"+this.monthsShort(N,""),this._monthsParse[M]=new RegExp(V.replace(".",""),"i")),T&&S==="MMMM"&&this._longMonthsParse[M].test(y))return M;if(T&&S==="MMM"&&this._shortMonthsParse[M].test(y))return M;if(!T&&this._monthsParse[M].test(y))return M}}function gLe(y,S){var T;if(!y.isValid())return y;if(typeof S=="string"){if(/^\d+$/.test(S))S=ve(S);else if(S=y.localeData().monthsParse(S),!u(S))return y}return T=Math.min(y.date(),W5(y.year(),S)),y._d["set"+(y._isUTC?"UTC":"")+"Month"](S,T),y}function yLe(y){return y!=null?(gLe(this,y),e.updateOffset(this,!0),this):kr(this,"Month")}function e8t(){return W5(this.year(),this.month())}function t8t(y){return this._monthsParseExact?(i(this,"_monthsRegex")||bLe.call(this),y?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=JVt),this._monthsShortStrictRegex&&y?this._monthsShortStrictRegex:this._monthsShortRegex)}function r8t(y){return this._monthsParseExact?(i(this,"_monthsRegex")||bLe.call(this),y?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=GVt),this._monthsStrictRegex&&y?this._monthsStrictRegex:this._monthsRegex)}function bLe(){function y(ce,Vt){return Vt.length-ce.length}var S=[],T=[],M=[],N,V;for(N=0;N<12;N++)V=f([2e3,N]),S.push(this.monthsShort(V,"")),T.push(this.months(V,"")),M.push(this.months(V,"")),M.push(this.monthsShort(V,""));for(S.sort(y),T.sort(y),M.sort(y),N=0;N<12;N++)S[N]=al(S[N]),T[N]=al(T[N]);for(N=0;N<24;N++)M[N]=al(M[N]);this._monthsRegex=new RegExp("^("+M.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+T.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+S.join("|")+")","i")}ee("Y",0,0,function(){var y=this.year();return y<=9999?H(y,4):"+"+y}),ee(0,["YY",2],0,function(){return this.year()%100}),ee(0,["YYYY",4],0,"year"),ee(0,["YYYYY",5],0,"year"),ee(0,["YYYYYY",6,!0],0,"year"),xe("year","y"),Ee("year",1),We("Y",Jd),We("YY",$r,ua),We("YYYY",Ya,od),We("YYYYY",Ps,Kd),We("YYYYYY",Ps,Kd),Sn(["YYYYY","YYYYYY"],ad),Sn("YYYY",function(y,S){S[ad]=y.length===2?e.parseTwoDigitYear(y):ve(y)}),Sn("YY",function(y,S){S[ad]=e.parseTwoDigitYear(y)}),Sn("Y",function(y,S){S[ad]=parseInt(y,10)});function PU(y){return oe(y)?366:365}e.parseTwoDigitYear=function(y){return ve(y)+(ve(y)>68?1900:2e3)};var _Le=qe("FullYear",!0);function n8t(){return oe(this.year())}function o8t(y,S,T,M,N,V,ce){var Vt;return y<100&&y>=0?(Vt=new Date(y+400,S,T,M,N,V,ce),isFinite(Vt.getFullYear())&&Vt.setFullYear(y)):Vt=new Date(y,S,T,M,N,V,ce),Vt}function EU(y){var S,T;return y<100&&y>=0?(T=Array.prototype.slice.call(arguments),T[0]=y+400,S=new Date(Date.UTC.apply(null,T)),isFinite(S.getUTCFullYear())&&S.setUTCFullYear(y)):S=new Date(Date.UTC.apply(null,arguments)),S}function K5(y,S,T){var M=7+S-T,N=(7+EU(y,0,M).getUTCDay()-S)%7;return-N+M-1}function vLe(y,S,T,M,N){var V=(7+T-M)%7,ce=K5(y,M,N),Vt=1+7*(S-1)+V+ce,rn,mi;return Vt<=0?(rn=y-1,mi=PU(rn)+Vt):Vt>PU(y)?(rn=y+1,mi=Vt-PU(y)):(rn=y,mi=Vt),{year:rn,dayOfYear:mi}}function TU(y,S,T){var M=K5(y.year(),S,T),N=Math.floor((y.dayOfYear()-M-1)/7)+1,V,ce;return N<1?(ce=y.year()-1,V=N+hx(ce,S,T)):N>hx(y.year(),S,T)?(V=N-hx(y.year(),S,T),ce=y.year()+1):(ce=y.year(),V=N),{week:V,year:ce}}function hx(y,S,T){var M=K5(y,S,T),N=K5(y+1,S,T);return(PU(y)-M+N)/7}ee("w",["ww",2],"wo","week"),ee("W",["WW",2],"Wo","isoWeek"),xe("week","w"),xe("isoWeek","W"),Ee("week",5),Ee("isoWeek",5),We("w",$r),We("ww",$r,ua),We("W",$r),We("WW",$r,ua),xg(["w","ww","W","WW"],function(y,S,T,M){S[M.substr(0,1)]=ve(y)});function i8t(y){return TU(y,this._week.dow,this._week.doy).week}var a8t={dow:0,doy:6};function s8t(){return this._week.dow}function u8t(){return this._week.doy}function l8t(y){var S=this.localeData().week(this);return y==null?S:this.add((y-S)*7,"d")}function c8t(y){var S=TU(this,1,4).week;return y==null?S:this.add((y-S)*7,"d")}ee("d",0,"do","day"),ee("dd",0,0,function(y){return this.localeData().weekdaysMin(this,y)}),ee("ddd",0,0,function(y){return this.localeData().weekdaysShort(this,y)}),ee("dddd",0,0,function(y){return this.localeData().weekdays(this,y)}),ee("e",0,0,"weekday"),ee("E",0,0,"isoWeekday"),xe("day","d"),xe("weekday","e"),xe("isoWeekday","E"),Ee("day",11),Ee("weekday",11),Ee("isoWeekday",11),We("d",$r),We("e",$r),We("E",$r),We("dd",function(y,S){return S.weekdaysMinRegex(y)}),We("ddd",function(y,S){return S.weekdaysShortRegex(y)}),We("dddd",function(y,S){return S.weekdaysRegex(y)}),xg(["dd","ddd","dddd"],function(y,S,T,M){var N=T._locale.weekdaysParse(y,M,T._strict);N!=null?S.d=N:m(T).invalidWeekday=y}),xg(["d","e","E"],function(y,S,T,M){S[M]=ve(y)});function d8t(y,S){return typeof y!="string"?y:isNaN(y)?(y=S.weekdaysParse(y),typeof y=="number"?y:null):parseInt(y,10)}function f8t(y,S){return typeof y=="string"?S.weekdaysParse(y)%7||7:isNaN(y)?null:y}function Ole(y,S){return y.slice(S,7).concat(y.slice(0,S))}var p8t="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),wLe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),m8t="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),h8t=Gd,g8t=Gd,y8t=Gd;function b8t(y,S){var T=n(this._weekdays)?this._weekdays:this._weekdays[y&&y!==!0&&this._weekdays.isFormat.test(S)?"format":"standalone"];return y===!0?Ole(T,this._week.dow):y?T[y.day()]:T}function _8t(y){return y===!0?Ole(this._weekdaysShort,this._week.dow):y?this._weekdaysShort[y.day()]:this._weekdaysShort}function v8t(y){return y===!0?Ole(this._weekdaysMin,this._week.dow):y?this._weekdaysMin[y.day()]:this._weekdaysMin}function w8t(y,S,T){var M,N,V,ce=y.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],M=0;M<7;++M)V=f([2e3,1]).day(M),this._minWeekdaysParse[M]=this.weekdaysMin(V,"").toLocaleLowerCase(),this._shortWeekdaysParse[M]=this.weekdaysShort(V,"").toLocaleLowerCase(),this._weekdaysParse[M]=this.weekdays(V,"").toLocaleLowerCase();return T?S==="dddd"?(N=cs.call(this._weekdaysParse,ce),N!==-1?N:null):S==="ddd"?(N=cs.call(this._shortWeekdaysParse,ce),N!==-1?N:null):(N=cs.call(this._minWeekdaysParse,ce),N!==-1?N:null):S==="dddd"?(N=cs.call(this._weekdaysParse,ce),N!==-1||(N=cs.call(this._shortWeekdaysParse,ce),N!==-1)?N:(N=cs.call(this._minWeekdaysParse,ce),N!==-1?N:null)):S==="ddd"?(N=cs.call(this._shortWeekdaysParse,ce),N!==-1||(N=cs.call(this._weekdaysParse,ce),N!==-1)?N:(N=cs.call(this._minWeekdaysParse,ce),N!==-1?N:null)):(N=cs.call(this._minWeekdaysParse,ce),N!==-1||(N=cs.call(this._weekdaysParse,ce),N!==-1)?N:(N=cs.call(this._shortWeekdaysParse,ce),N!==-1?N:null))}function S8t(y,S,T){var M,N,V;if(this._weekdaysParseExact)return w8t.call(this,y,S,T);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),M=0;M<7;M++){if(N=f([2e3,1]).day(M),T&&!this._fullWeekdaysParse[M]&&(this._fullWeekdaysParse[M]=new RegExp("^"+this.weekdays(N,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[M]=new RegExp("^"+this.weekdaysShort(N,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[M]=new RegExp("^"+this.weekdaysMin(N,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[M]||(V="^"+this.weekdays(N,"")+"|^"+this.weekdaysShort(N,"")+"|^"+this.weekdaysMin(N,""),this._weekdaysParse[M]=new RegExp(V.replace(".",""),"i")),T&&S==="dddd"&&this._fullWeekdaysParse[M].test(y))return M;if(T&&S==="ddd"&&this._shortWeekdaysParse[M].test(y))return M;if(T&&S==="dd"&&this._minWeekdaysParse[M].test(y))return M;if(!T&&this._weekdaysParse[M].test(y))return M}}function x8t(y){if(!this.isValid())return y!=null?this:NaN;var S=this._isUTC?this._d.getUTCDay():this._d.getDay();return y!=null?(y=d8t(y,this.localeData()),this.add(y-S,"d")):S}function C8t(y){if(!this.isValid())return y!=null?this:NaN;var S=(this.day()+7-this.localeData()._week.dow)%7;return y==null?S:this.add(y-S,"d")}function O8t(y){if(!this.isValid())return y!=null?this:NaN;if(y!=null){var S=f8t(y,this.localeData());return this.day(this.day()%7?S:S-7)}else return this.day()||7}function P8t(y){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Ple.call(this),y?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=h8t),this._weekdaysStrictRegex&&y?this._weekdaysStrictRegex:this._weekdaysRegex)}function E8t(y){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Ple.call(this),y?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=g8t),this._weekdaysShortStrictRegex&&y?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function T8t(y){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Ple.call(this),y?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=y8t),this._weekdaysMinStrictRegex&&y?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ple(){function y(Zd,vx){return vx.length-Zd.length}var S=[],T=[],M=[],N=[],V,ce,Vt,rn,mi;for(V=0;V<7;V++)ce=f([2e3,1]).day(V),Vt=al(this.weekdaysMin(ce,"")),rn=al(this.weekdaysShort(ce,"")),mi=al(this.weekdays(ce,"")),S.push(Vt),T.push(rn),M.push(mi),N.push(Vt),N.push(rn),N.push(mi);S.sort(y),T.sort(y),M.sort(y),N.sort(y),this._weekdaysRegex=new RegExp("^("+N.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+M.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+T.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+S.join("|")+")","i")}function Ele(){return this.hours()%12||12}function A8t(){return this.hours()||24}ee("H",["HH",2],0,"hour"),ee("h",["hh",2],0,Ele),ee("k",["kk",2],0,A8t),ee("hmm",0,0,function(){return""+Ele.apply(this)+H(this.minutes(),2)}),ee("hmmss",0,0,function(){return""+Ele.apply(this)+H(this.minutes(),2)+H(this.seconds(),2)}),ee("Hmm",0,0,function(){return""+this.hours()+H(this.minutes(),2)}),ee("Hmmss",0,0,function(){return""+this.hours()+H(this.minutes(),2)+H(this.seconds(),2)});function SLe(y,S){ee(y,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),S)})}SLe("a",!0),SLe("A",!1),xe("hour","h"),Ee("hour",13);function xLe(y,S){return S._meridiemParse}We("a",xLe),We("A",xLe),We("H",$r),We("h",$r),We("k",$r),We("HH",$r,ua),We("hh",$r,ua),We("kk",$r,ua),We("hmm",Zy),We("hmmss",dx),We("Hmm",Zy),We("Hmmss",dx),Sn(["H","HH"],sl),Sn(["k","kk"],function(y,S,T){var M=ve(y);S[sl]=M===24?0:M}),Sn(["a","A"],function(y,S,T){T._isPm=T._locale.isPM(y),T._meridiem=y}),Sn(["h","hh"],function(y,S,T){S[sl]=ve(y),m(T).bigHour=!0}),Sn("hmm",function(y,S,T){var M=y.length-2;S[sl]=ve(y.substr(0,M)),S[Cg]=ve(y.substr(M)),m(T).bigHour=!0}),Sn("hmmss",function(y,S,T){var M=y.length-4,N=y.length-2;S[sl]=ve(y.substr(0,M)),S[Cg]=ve(y.substr(M,2)),S[mx]=ve(y.substr(N)),m(T).bigHour=!0}),Sn("Hmm",function(y,S,T){var M=y.length-2;S[sl]=ve(y.substr(0,M)),S[Cg]=ve(y.substr(M))}),Sn("Hmmss",function(y,S,T){var M=y.length-4,N=y.length-2;S[sl]=ve(y.substr(0,M)),S[Cg]=ve(y.substr(M,2)),S[mx]=ve(y.substr(N))});function I8t(y){return(y+"").toLowerCase().charAt(0)==="p"}var M8t=/[ap]\.?m?\.?/i,R8t=qe("Hours",!0);function j8t(y,S,T){return y>11?T?"pm":"PM":T?"am":"AM"}var CLe={calendar:q,longDateFormat:Ie,invalidDate:Te,ordinal:nt,dayOfMonthOrdinalParse:Ht,relativeTime:ht,months:KVt,monthsShort:mLe,week:a8t,weekdays:p8t,weekdaysMin:m8t,weekdaysShort:wLe,meridiemParse:M8t},la={},AU={},IU;function D8t(y,S){var T,M=Math.min(y.length,S.length);for(T=0;T<M;T+=1)if(y[T]!==S[T])return T;return M}function OLe(y){return y&&y.toLowerCase().replace("_","-")}function N8t(y){for(var S=0,T,M,N,V;S<y.length;){for(V=OLe(y[S]).split("-"),T=V.length,M=OLe(y[S+1]),M=M?M.split("-"):null;T>0;){if(N=J5(V.slice(0,T).join("-")),N)return N;if(M&&M.length>=T&&D8t(V,M)>=T-1)break;T--}S++}return IU}function L8t(y){return y.match("^[^/\\\\]*$")!=null}function J5(y){var S=null,T;if(la[y]===void 0&&typeof KN<"u"&&KN&&KN.exports&&L8t(y))try{S=IU._abbr,T=require,T("./locale/"+y),CP(S)}catch{la[y]=null}return la[y]}function CP(y,S){var T;return y&&(s(S)?T=gx(y):T=Tle(y,S),T?IU=T:typeof console<"u"&&console.warn&&console.warn("Locale "+y+" not found. Did you forget to load it?")),IU._abbr}function Tle(y,S){if(S!==null){var T,M=CLe;if(S.abbr=y,la[y]!=null)R("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),M=la[y]._config;else if(S.parentLocale!=null)if(la[S.parentLocale]!=null)M=la[S.parentLocale]._config;else if(T=J5(S.parentLocale),T!=null)M=T._config;else return AU[S.parentLocale]||(AU[S.parentLocale]=[]),AU[S.parentLocale].push({name:y,config:S}),null;return la[y]=new F(k(M,S)),AU[y]&&AU[y].forEach(function(N){Tle(N.name,N.config)}),CP(y),la[y]}else return delete la[y],null}function F8t(y,S){if(S!=null){var T,M,N=CLe;la[y]!=null&&la[y].parentLocale!=null?la[y].set(k(la[y]._config,S)):(M=J5(y),M!=null&&(N=M._config),S=k(N,S),M==null&&(S.abbr=y),T=new F(S),T.parentLocale=la[y],la[y]=T),CP(y)}else la[y]!=null&&(la[y].parentLocale!=null?(la[y]=la[y].parentLocale,y===CP()&&CP(y)):la[y]!=null&&delete la[y]);return la[y]}function gx(y){var S;if(y&&y._locale&&y._locale._abbr&&(y=y._locale._abbr),!y)return IU;if(!n(y)){if(S=J5(y),S)return S;y=[y]}return N8t(y)}function k8t(){return B(la)}function Ale(y){var S,T=y._a;return T&&m(y).overflow===-2&&(S=T[px]<0||T[px]>11?px:T[Xy]<1||T[Xy]>W5(T[ad],T[px])?Xy:T[sl]<0||T[sl]>24||T[sl]===24&&(T[Cg]!==0||T[mx]!==0||T[WI]!==0)?sl:T[Cg]<0||T[Cg]>59?Cg:T[mx]<0||T[mx]>59?mx:T[WI]<0||T[WI]>999?WI:-1,m(y)._overflowDayOfYear&&(S<ad||S>Xy)&&(S=Xy),m(y)._overflowWeeks&&S===-1&&(S=HVt),m(y)._overflowWeekday&&S===-1&&(S=VVt),m(y).overflow=S),y}var $8t=/^\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)?)?$/,B8t=/^\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)?)?$/,q8t=/Z|[+-]\d\d(?::?\d\d)?/,G5=[["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]],Ile=[["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/]],U8t=/^\/?Date\((-?\d+)/i,z8t=/^(?:(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}))$/,H8t={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 PLe(y){var S,T,M=y._i,N=$8t.exec(M)||B8t.exec(M),V,ce,Vt,rn,mi=G5.length,Zd=Ile.length;if(N){for(m(y).iso=!0,S=0,T=mi;S<T;S++)if(G5[S][1].exec(N[1])){ce=G5[S][0],V=G5[S][2]!==!1;break}if(ce==null){y._isValid=!1;return}if(N[3]){for(S=0,T=Zd;S<T;S++)if(Ile[S][1].exec(N[3])){Vt=(N[2]||" ")+Ile[S][0];break}if(Vt==null){y._isValid=!1;return}}if(!V&&Vt!=null){y._isValid=!1;return}if(N[4])if(q8t.exec(N[4]))rn="Z";else{y._isValid=!1;return}y._f=ce+(Vt||"")+(rn||""),Rle(y)}else y._isValid=!1}function V8t(y,S,T,M,N,V){var ce=[W8t(y),mLe.indexOf(S),parseInt(T,10),parseInt(M,10),parseInt(N,10)];return V&&ce.push(parseInt(V,10)),ce}function W8t(y){var S=parseInt(y,10);return S<=49?2e3+S:S<=999?1900+S:S}function K8t(y){return y.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function J8t(y,S,T){if(y){var M=wLe.indexOf(y),N=new Date(S[0],S[1],S[2]).getDay();if(M!==N)return m(T).weekdayMismatch=!0,T._isValid=!1,!1}return!0}function G8t(y,S,T){if(y)return H8t[y];if(S)return 0;var M=parseInt(T,10),N=M%100,V=(M-N)/100;return V*60+N}function ELe(y){var S=z8t.exec(K8t(y._i)),T;if(S){if(T=V8t(S[4],S[3],S[2],S[5],S[6],S[7]),!J8t(S[1],T,y))return;y._a=T,y._tzm=G8t(S[8],S[9],S[10]),y._d=EU.apply(null,y._a),y._d.setUTCMinutes(y._d.getUTCMinutes()-y._tzm),m(y).rfc2822=!0}else y._isValid=!1}function Y8t(y){var S=U8t.exec(y._i);if(S!==null){y._d=new Date(+S[1]);return}if(PLe(y),y._isValid===!1)delete y._isValid;else return;if(ELe(y),y._isValid===!1)delete y._isValid;else return;y._strict?y._isValid=!1:e.createFromInputFallback(y)}e.createFromInputFallback=A("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(y){y._d=new Date(y._i+(y._useUTC?" UTC":""))});function cN(y,S,T){return y??S??T}function Z8t(y){var S=new Date(e.now());return y._useUTC?[S.getUTCFullYear(),S.getUTCMonth(),S.getUTCDate()]:[S.getFullYear(),S.getMonth(),S.getDate()]}function Mle(y){var S,T,M=[],N,V,ce;if(!y._d){for(N=Z8t(y),y._w&&y._a[Xy]==null&&y._a[px]==null&&X8t(y),y._dayOfYear!=null&&(ce=cN(y._a[ad],N[ad]),(y._dayOfYear>PU(ce)||y._dayOfYear===0)&&(m(y)._overflowDayOfYear=!0),T=EU(ce,0,y._dayOfYear),y._a[px]=T.getUTCMonth(),y._a[Xy]=T.getUTCDate()),S=0;S<3&&y._a[S]==null;++S)y._a[S]=M[S]=N[S];for(;S<7;S++)y._a[S]=M[S]=y._a[S]==null?S===2?1:0:y._a[S];y._a[sl]===24&&y._a[Cg]===0&&y._a[mx]===0&&y._a[WI]===0&&(y._nextDay=!0,y._a[sl]=0),y._d=(y._useUTC?EU:o8t).apply(null,M),V=y._useUTC?y._d.getUTCDay():y._d.getDay(),y._tzm!=null&&y._d.setUTCMinutes(y._d.getUTCMinutes()-y._tzm),y._nextDay&&(y._a[sl]=24),y._w&&typeof y._w.d<"u"&&y._w.d!==V&&(m(y).weekdayMismatch=!0)}}function X8t(y){var S,T,M,N,V,ce,Vt,rn,mi;S=y._w,S.GG!=null||S.W!=null||S.E!=null?(V=1,ce=4,T=cN(S.GG,y._a[ad],TU(Ui(),1,4).year),M=cN(S.W,1),N=cN(S.E,1),(N<1||N>7)&&(rn=!0)):(V=y._locale._week.dow,ce=y._locale._week.doy,mi=TU(Ui(),V,ce),T=cN(S.gg,y._a[ad],mi.year),M=cN(S.w,mi.week),S.d!=null?(N=S.d,(N<0||N>6)&&(rn=!0)):S.e!=null?(N=S.e+V,(S.e<0||S.e>6)&&(rn=!0)):N=V),M<1||M>hx(T,V,ce)?m(y)._overflowWeeks=!0:rn!=null?m(y)._overflowWeekday=!0:(Vt=vLe(T,M,N,V,ce),y._a[ad]=Vt.year,y._dayOfYear=Vt.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function Rle(y){if(y._f===e.ISO_8601){PLe(y);return}if(y._f===e.RFC_2822){ELe(y);return}y._a=[],m(y).empty=!0;var S=""+y._i,T,M,N,V,ce,Vt=S.length,rn=0,mi,Zd;for(N=ie(y._f,y._locale).match(L)||[],Zd=N.length,T=0;T<Zd;T++)V=N[T],M=(S.match(Yd(V,y))||[])[0],M&&(ce=S.substr(0,S.indexOf(M)),ce.length>0&&m(y).unusedInput.push(ce),S=S.slice(S.indexOf(M)+M.length),rn+=M.length),J[V]?(M?m(y).empty=!1:m(y).unusedTokens.push(V),OU(V,M,y)):y._strict&&!M&&m(y).unusedTokens.push(V);m(y).charsLeftOver=Vt-rn,S.length>0&&m(y).unusedInput.push(S),y._a[sl]<=12&&m(y).bigHour===!0&&y._a[sl]>0&&(m(y).bigHour=void 0),m(y).parsedDateParts=y._a.slice(0),m(y).meridiem=y._meridiem,y._a[sl]=Q8t(y._locale,y._a[sl],y._meridiem),mi=m(y).era,mi!==null&&(y._a[ad]=y._locale.erasConvertYear(mi,y._a[ad])),Mle(y),Ale(y)}function Q8t(y,S,T){var M;return T==null?S:y.meridiemHour!=null?y.meridiemHour(S,T):(y.isPM!=null&&(M=y.isPM(T),M&&S<12&&(S+=12),!M&&S===12&&(S=0)),S)}function e6t(y){var S,T,M,N,V,ce,Vt=!1,rn=y._f.length;if(rn===0){m(y).invalidFormat=!0,y._d=new Date(NaN);return}for(N=0;N<rn;N++)V=0,ce=!1,S=x({},y),y._useUTC!=null&&(S._useUTC=y._useUTC),S._f=y._f[N],Rle(S),b(S)&&(ce=!0),V+=m(S).charsLeftOver,V+=m(S).unusedTokens.length*10,m(S).score=V,Vt?V<M&&(M=V,T=S):(M==null||V<M||ce)&&(M=V,T=S,ce&&(Vt=!0));d(y,T||S)}function t6t(y){if(!y._d){var S=ur(y._i),T=S.day===void 0?S.date:S.day;y._a=c([S.year,S.month,T,S.hour,S.minute,S.second,S.millisecond],function(M){return M&&parseInt(M,10)}),Mle(y)}}function r6t(y){var S=new C(Ale(TLe(y)));return S._nextDay&&(S.add(1,"d"),S._nextDay=void 0),S}function TLe(y){var S=y._i,T=y._f;return y._locale=y._locale||gx(y._l),S===null||T===void 0&&S===""?g({nullInput:!0}):(typeof S=="string"&&(y._i=S=y._locale.preparse(S)),E(S)?new C(Ale(S)):(l(S)?y._d=S:n(T)?e6t(y):T?Rle(y):n6t(y),b(y)||(y._d=null),y))}function n6t(y){var S=y._i;s(S)?y._d=new Date(e.now()):l(S)?y._d=new Date(S.valueOf()):typeof S=="string"?Y8t(y):n(S)?(y._a=c(S.slice(0),function(T){return parseInt(T,10)}),Mle(y)):o(S)?t6t(y):u(S)?y._d=new Date(S):e.createFromInputFallback(y)}function ALe(y,S,T,M,N){var V={};return(S===!0||S===!1)&&(M=S,S=void 0),(T===!0||T===!1)&&(M=T,T=void 0),(o(y)&&a(y)||n(y)&&y.length===0)&&(y=void 0),V._isAMomentObject=!0,V._useUTC=V._isUTC=N,V._l=T,V._i=y,V._f=S,V._strict=M,r6t(V)}function Ui(y,S,T,M){return ALe(y,S,T,M,!1)}var o6t=A("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var y=Ui.apply(null,arguments);return this.isValid()&&y.isValid()?y<this?this:y:g()}),i6t=A("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var y=Ui.apply(null,arguments);return this.isValid()&&y.isValid()?y>this?this:y:g()});function ILe(y,S){var T,M;if(S.length===1&&n(S[0])&&(S=S[0]),!S.length)return Ui();for(T=S[0],M=1;M<S.length;++M)(!S[M].isValid()||S[M][y](T))&&(T=S[M]);return T}function a6t(){var y=[].slice.call(arguments,0);return ILe("isBefore",y)}function s6t(){var y=[].slice.call(arguments,0);return ILe("isAfter",y)}var u6t=function(){return Date.now?Date.now():+new Date},MU=["year","quarter","month","week","day","hour","minute","second","millisecond"];function l6t(y){var S,T=!1,M,N=MU.length;for(S in y)if(i(y,S)&&!(cs.call(MU,S)!==-1&&(y[S]==null||!isNaN(y[S]))))return!1;for(M=0;M<N;++M)if(y[MU[M]]){if(T)return!1;parseFloat(y[MU[M]])!==ve(y[MU[M]])&&(T=!0)}return!0}function c6t(){return this._isValid}function d6t(){return Og(NaN)}function Y5(y){var S=ur(y),T=S.year||0,M=S.quarter||0,N=S.month||0,V=S.week||S.isoWeek||0,ce=S.day||0,Vt=S.hour||0,rn=S.minute||0,mi=S.second||0,Zd=S.millisecond||0;this._isValid=l6t(S),this._milliseconds=+Zd+mi*1e3+rn*6e4+Vt*1e3*60*60,this._days=+ce+V*7,this._months=+N+M*3+T*12,this._data={},this._locale=gx(),this._bubble()}function Z5(y){return y instanceof Y5}function jle(y){return y<0?Math.round(-1*y)*-1:Math.round(y)}function f6t(y,S,T){var M=Math.min(y.length,S.length),N=Math.abs(y.length-S.length),V=0,ce;for(ce=0;ce<M;ce++)(T&&y[ce]!==S[ce]||!T&&ve(y[ce])!==ve(S[ce]))&&V++;return V+N}function MLe(y,S){ee(y,0,0,function(){var T=this.utcOffset(),M="+";return T<0&&(T=-T,M="-"),M+H(~~(T/60),2)+S+H(~~T%60,2)})}MLe("Z",":"),MLe("ZZ",""),We("Z",ls),We("ZZ",ls),Sn(["Z","ZZ"],function(y,S,T){T._useUTC=!0,T._tzm=Dle(ls,y)});var p6t=/([\+\-]|\d\d)/gi;function Dle(y,S){var T=(S||"").match(y),M,N,V;return T===null?null:(M=T[T.length-1]||[],N=(M+"").match(p6t)||["-",0,0],V=+(N[1]*60)+ve(N[2]),V===0?0:N[0]==="+"?V:-V)}function Nle(y,S){var T,M;return S._isUTC?(T=S.clone(),M=(E(y)||l(y)?y.valueOf():Ui(y).valueOf())-T.valueOf(),T._d.setTime(T._d.valueOf()+M),e.updateOffset(T,!1),T):Ui(y).local()}function Lle(y){return-Math.round(y._d.getTimezoneOffset())}e.updateOffset=function(){};function m6t(y,S,T){var M=this._offset||0,N;if(!this.isValid())return y!=null?this:NaN;if(y!=null){if(typeof y=="string"){if(y=Dle(ls,y),y===null)return this}else Math.abs(y)<16&&!T&&(y=y*60);return!this._isUTC&&S&&(N=Lle(this)),this._offset=y,this._isUTC=!0,N!=null&&this.add(N,"m"),M!==y&&(!S||this._changeInProgress?NLe(this,Og(y-M,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?M:Lle(this)}function h6t(y,S){return y!=null?(typeof y!="string"&&(y=-y),this.utcOffset(y,S),this):-this.utcOffset()}function g6t(y){return this.utcOffset(0,y)}function y6t(y){return this._isUTC&&(this.utcOffset(0,y),this._isUTC=!1,y&&this.subtract(Lle(this),"m")),this}function b6t(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var y=Dle(id,this._i);y!=null?this.utcOffset(y):this.utcOffset(0,!0)}return this}function _6t(y){return this.isValid()?(y=y?Ui(y).utcOffset():0,(this.utcOffset()-y)%60===0):!1}function v6t(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function w6t(){if(!s(this._isDSTShifted))return this._isDSTShifted;var y={},S;return x(y,this),y=TLe(y),y._a?(S=y._isUTC?f(y._a):Ui(y._a),this._isDSTShifted=this.isValid()&&f6t(y._a,S.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function S6t(){return this.isValid()?!this._isUTC:!1}function x6t(){return this.isValid()?this._isUTC:!1}function RLe(){return this.isValid()?this._isUTC&&this._offset===0:!1}var C6t=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,O6t=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Og(y,S){var T=y,M=null,N,V,ce;return Z5(y)?T={ms:y._milliseconds,d:y._days,M:y._months}:u(y)||!isNaN(+y)?(T={},S?T[S]=+y:T.milliseconds=+y):(M=C6t.exec(y))?(N=M[1]==="-"?-1:1,T={y:0,d:ve(M[Xy])*N,h:ve(M[sl])*N,m:ve(M[Cg])*N,s:ve(M[mx])*N,ms:ve(jle(M[WI]*1e3))*N}):(M=O6t.exec(y))?(N=M[1]==="-"?-1:1,T={y:KI(M[2],N),M:KI(M[3],N),w:KI(M[4],N),d:KI(M[5],N),h:KI(M[6],N),m:KI(M[7],N),s:KI(M[8],N)}):T==null?T={}:typeof T=="object"&&("from"in T||"to"in T)&&(ce=P6t(Ui(T.from),Ui(T.to)),T={},T.ms=ce.milliseconds,T.M=ce.months),V=new Y5(T),Z5(y)&&i(y,"_locale")&&(V._locale=y._locale),Z5(y)&&i(y,"_isValid")&&(V._isValid=y._isValid),V}Og.fn=Y5.prototype,Og.invalid=d6t;function KI(y,S){var T=y&&parseFloat(y.replace(",","."));return(isNaN(T)?0:T)*S}function jLe(y,S){var T={};return T.months=S.month()-y.month()+(S.year()-y.year())*12,y.clone().add(T.months,"M").isAfter(S)&&--T.months,T.milliseconds=+S-+y.clone().add(T.months,"M"),T}function P6t(y,S){var T;return y.isValid()&&S.isValid()?(S=Nle(S,y),y.isBefore(S)?T=jLe(y,S):(T=jLe(S,y),T.milliseconds=-T.milliseconds,T.months=-T.months),T):{milliseconds:0,months:0}}function DLe(y,S){return function(T,M){var N,V;return M!==null&&!isNaN(+M)&&(R(S,"moment()."+S+"(period, number) is deprecated. Please use moment()."+S+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),V=T,T=M,M=V),N=Og(T,M),NLe(this,N,y),this}}function NLe(y,S,T,M){var N=S._milliseconds,V=jle(S._days),ce=jle(S._months);y.isValid()&&(M=M??!0,ce&&gLe(y,kr(y,"Month")+ce*T),V&&pi(y,"Date",kr(y,"Date")+V*T),N&&y._d.setTime(y._d.valueOf()+N*T),M&&e.updateOffset(y,V||ce))}var E6t=DLe(1,"add"),T6t=DLe(-1,"subtract");function LLe(y){return typeof y=="string"||y instanceof String}function A6t(y){return E(y)||l(y)||LLe(y)||u(y)||M6t(y)||I6t(y)||y===null||y===void 0}function I6t(y){var S=o(y)&&!a(y),T=!1,M=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],N,V,ce=M.length;for(N=0;N<ce;N+=1)V=M[N],T=T||i(y,V);return S&&T}function M6t(y){var S=n(y),T=!1;return S&&(T=y.filter(function(M){return!u(M)&&LLe(y)}).length===0),S&&T}function R6t(y){var S=o(y)&&!a(y),T=!1,M=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],N,V;for(N=0;N<M.length;N+=1)V=M[N],T=T||i(y,V);return S&&T}function j6t(y,S){var T=y.diff(S,"days",!0);return T<-6?"sameElse":T<-1?"lastWeek":T<0?"lastDay":T<1?"sameDay":T<2?"nextDay":T<7?"nextWeek":"sameElse"}function D6t(y,S){arguments.length===1&&(arguments[0]?A6t(arguments[0])?(y=arguments[0],S=void 0):R6t(arguments[0])&&(S=arguments[0],y=void 0):(y=void 0,S=void 0));var T=y||Ui(),M=Nle(T,this).startOf("day"),N=e.calendarFormat(this,M)||"sameElse",V=S&&(j(S[N])?S[N].call(this,T):S[N]);return this.format(V||this.localeData().calendar(N,this,Ui(T)))}function N6t(){return new C(this)}function L6t(y,S){var T=E(y)?y:Ui(y);return this.isValid()&&T.isValid()?(S=te(S)||"millisecond",S==="millisecond"?this.valueOf()>T.valueOf():T.valueOf()<this.clone().startOf(S).valueOf()):!1}function F6t(y,S){var T=E(y)?y:Ui(y);return this.isValid()&&T.isValid()?(S=te(S)||"millisecond",S==="millisecond"?this.valueOf()<T.valueOf():this.clone().endOf(S).valueOf()<T.valueOf()):!1}function k6t(y,S,T,M){var N=E(y)?y:Ui(y),V=E(S)?S:Ui(S);return this.isValid()&&N.isValid()&&V.isValid()?(M=M||"()",(M[0]==="("?this.isAfter(N,T):!this.isBefore(N,T))&&(M[1]===")"?this.isBefore(V,T):!this.isAfter(V,T))):!1}function $6t(y,S){var T=E(y)?y:Ui(y),M;return this.isValid()&&T.isValid()?(S=te(S)||"millisecond",S==="millisecond"?this.valueOf()===T.valueOf():(M=T.valueOf(),this.clone().startOf(S).valueOf()<=M&&M<=this.clone().endOf(S).valueOf())):!1}function B6t(y,S){return this.isSame(y,S)||this.isAfter(y,S)}function q6t(y,S){return this.isSame(y,S)||this.isBefore(y,S)}function U6t(y,S,T){var M,N,V;if(!this.isValid())return NaN;if(M=Nle(y,this),!M.isValid())return NaN;switch(N=(M.utcOffset()-this.utcOffset())*6e4,S=te(S),S){case"year":V=X5(this,M)/12;break;case"month":V=X5(this,M);break;case"quarter":V=X5(this,M)/3;break;case"second":V=(this-M)/1e3;break;case"minute":V=(this-M)/6e4;break;case"hour":V=(this-M)/36e5;break;case"day":V=(this-M-N)/864e5;break;case"week":V=(this-M-N)/6048e5;break;default:V=this-M}return T?V:Se(V)}function X5(y,S){if(y.date()<S.date())return-X5(S,y);var T=(S.year()-y.year())*12+(S.month()-y.month()),M=y.clone().add(T,"months"),N,V;return S-M<0?(N=y.clone().add(T-1,"months"),V=(S-M)/(M-N)):(N=y.clone().add(T+1,"months"),V=(S-M)/(N-M)),-(T+V)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function z6t(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function H6t(y){if(!this.isValid())return null;var S=y!==!0,T=S?this.clone().utc():this;return T.year()<0||T.year()>9999?Z(T,S?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):j(Date.prototype.toISOString)?S?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Z(T,"Z")):Z(T,S?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function V6t(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var y="moment",S="",T,M,N,V;return this.isLocal()||(y=this.utcOffset()===0?"moment.utc":"moment.parseZone",S="Z"),T="["+y+'("]',M=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",N="-MM-DD[T]HH:mm:ss.SSS",V=S+'[")]',this.format(T+M+N+V)}function W6t(y){y||(y=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var S=Z(this,y);return this.localeData().postformat(S)}function K6t(y,S){return this.isValid()&&(E(y)&&y.isValid()||Ui(y).isValid())?Og({to:this,from:y}).locale(this.locale()).humanize(!S):this.localeData().invalidDate()}function J6t(y){return this.from(Ui(),y)}function G6t(y,S){return this.isValid()&&(E(y)&&y.isValid()||Ui(y).isValid())?Og({from:this,to:y}).locale(this.locale()).humanize(!S):this.localeData().invalidDate()}function Y6t(y){return this.to(Ui(),y)}function FLe(y){var S;return y===void 0?this._locale._abbr:(S=gx(y),S!=null&&(this._locale=S),this)}var kLe=A("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(y){return y===void 0?this.localeData():this.locale(y)});function $Le(){return this._locale}var Q5=1e3,dN=60*Q5,eW=60*dN,BLe=(365*400+97)*24*eW;function fN(y,S){return(y%S+S)%S}function qLe(y,S,T){return y<100&&y>=0?new Date(y+400,S,T)-BLe:new Date(y,S,T).valueOf()}function ULe(y,S,T){return y<100&&y>=0?Date.UTC(y+400,S,T)-BLe:Date.UTC(y,S,T)}function Z6t(y){var S,T;if(y=te(y),y===void 0||y==="millisecond"||!this.isValid())return this;switch(T=this._isUTC?ULe:qLe,y){case"year":S=T(this.year(),0,1);break;case"quarter":S=T(this.year(),this.month()-this.month()%3,1);break;case"month":S=T(this.year(),this.month(),1);break;case"week":S=T(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":S=T(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":S=T(this.year(),this.month(),this.date());break;case"hour":S=this._d.valueOf(),S-=fN(S+(this._isUTC?0:this.utcOffset()*dN),eW);break;case"minute":S=this._d.valueOf(),S-=fN(S,dN);break;case"second":S=this._d.valueOf(),S-=fN(S,Q5);break}return this._d.setTime(S),e.updateOffset(this,!0),this}function X6t(y){var S,T;if(y=te(y),y===void 0||y==="millisecond"||!this.isValid())return this;switch(T=this._isUTC?ULe:qLe,y){case"year":S=T(this.year()+1,0,1)-1;break;case"quarter":S=T(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":S=T(this.year(),this.month()+1,1)-1;break;case"week":S=T(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":S=T(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":S=T(this.year(),this.month(),this.date()+1)-1;break;case"hour":S=this._d.valueOf(),S+=eW-fN(S+(this._isUTC?0:this.utcOffset()*dN),eW)-1;break;case"minute":S=this._d.valueOf(),S+=dN-fN(S,dN)-1;break;case"second":S=this._d.valueOf(),S+=Q5-fN(S,Q5)-1;break}return this._d.setTime(S),e.updateOffset(this,!0),this}function Q6t(){return this._d.valueOf()-(this._offset||0)*6e4}function e5t(){return Math.floor(this.valueOf()/1e3)}function t5t(){return new Date(this.valueOf())}function r5t(){var y=this;return[y.year(),y.month(),y.date(),y.hour(),y.minute(),y.second(),y.millisecond()]}function n5t(){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 o5t(){return this.isValid()?this.toISOString():null}function i5t(){return b(this)}function a5t(){return d({},m(this))}function s5t(){return m(this).overflow}function u5t(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}ee("N",0,0,"eraAbbr"),ee("NN",0,0,"eraAbbr"),ee("NNN",0,0,"eraAbbr"),ee("NNNN",0,0,"eraName"),ee("NNNNN",0,0,"eraNarrow"),ee("y",["y",1],"yo","eraYear"),ee("y",["yy",2],0,"eraYear"),ee("y",["yyy",3],0,"eraYear"),ee("y",["yyyy",4],0,"eraYear"),We("N",Fle),We("NN",Fle),We("NNN",Fle),We("NNNN",_5t),We("NNNNN",v5t),Sn(["N","NN","NNN","NNNN","NNNNN"],function(y,S,T,M){var N=T._locale.erasParse(y,M,T._strict);N?m(T).era=N:m(T).invalidEra=y}),We("y",Pa),We("yy",Pa),We("yyy",Pa),We("yyyy",Pa),We("yo",w5t),Sn(["y","yy","yyy","yyyy"],ad),Sn(["yo"],function(y,S,T,M){var N;T._locale._eraYearOrdinalRegex&&(N=y.match(T._locale._eraYearOrdinalRegex)),T._locale.eraYearOrdinalParse?S[ad]=T._locale.eraYearOrdinalParse(y,N):S[ad]=parseInt(y,10)});function l5t(y,S){var T,M,N,V=this._eras||gx("en")._eras;for(T=0,M=V.length;T<M;++T){switch(typeof V[T].since){case"string":N=e(V[T].since).startOf("day"),V[T].since=N.valueOf();break}switch(typeof V[T].until){case"undefined":V[T].until=1/0;break;case"string":N=e(V[T].until).startOf("day").valueOf(),V[T].until=N.valueOf();break}}return V}function c5t(y,S,T){var M,N,V=this.eras(),ce,Vt,rn;for(y=y.toUpperCase(),M=0,N=V.length;M<N;++M)if(ce=V[M].name.toUpperCase(),Vt=V[M].abbr.toUpperCase(),rn=V[M].narrow.toUpperCase(),T)switch(S){case"N":case"NN":case"NNN":if(Vt===y)return V[M];break;case"NNNN":if(ce===y)return V[M];break;case"NNNNN":if(rn===y)return V[M];break}else if([ce,Vt,rn].indexOf(y)>=0)return V[M]}function d5t(y,S){var T=y.since<=y.until?1:-1;return S===void 0?e(y.since).year():e(y.since).year()+(S-y.offset)*T}function f5t(){var y,S,T,M=this.localeData().eras();for(y=0,S=M.length;y<S;++y)if(T=this.clone().startOf("day").valueOf(),M[y].since<=T&&T<=M[y].until||M[y].until<=T&&T<=M[y].since)return M[y].name;return""}function p5t(){var y,S,T,M=this.localeData().eras();for(y=0,S=M.length;y<S;++y)if(T=this.clone().startOf("day").valueOf(),M[y].since<=T&&T<=M[y].until||M[y].until<=T&&T<=M[y].since)return M[y].narrow;return""}function m5t(){var y,S,T,M=this.localeData().eras();for(y=0,S=M.length;y<S;++y)if(T=this.clone().startOf("day").valueOf(),M[y].since<=T&&T<=M[y].until||M[y].until<=T&&T<=M[y].since)return M[y].abbr;return""}function h5t(){var y,S,T,M,N=this.localeData().eras();for(y=0,S=N.length;y<S;++y)if(T=N[y].since<=N[y].until?1:-1,M=this.clone().startOf("day").valueOf(),N[y].since<=M&&M<=N[y].until||N[y].until<=M&&M<=N[y].since)return(this.year()-e(N[y].since).year())*T+N[y].offset;return this.year()}function g5t(y){return i(this,"_erasNameRegex")||kle.call(this),y?this._erasNameRegex:this._erasRegex}function y5t(y){return i(this,"_erasAbbrRegex")||kle.call(this),y?this._erasAbbrRegex:this._erasRegex}function b5t(y){return i(this,"_erasNarrowRegex")||kle.call(this),y?this._erasNarrowRegex:this._erasRegex}function Fle(y,S){return S.erasAbbrRegex(y)}function _5t(y,S){return S.erasNameRegex(y)}function v5t(y,S){return S.erasNarrowRegex(y)}function w5t(y,S){return S._eraYearOrdinalRegex||Pa}function kle(){var y=[],S=[],T=[],M=[],N,V,ce=this.eras();for(N=0,V=ce.length;N<V;++N)S.push(al(ce[N].name)),y.push(al(ce[N].abbr)),T.push(al(ce[N].narrow)),M.push(al(ce[N].name)),M.push(al(ce[N].abbr)),M.push(al(ce[N].narrow));this._erasRegex=new RegExp("^("+M.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+S.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+y.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+T.join("|")+")","i")}ee(0,["gg",2],0,function(){return this.weekYear()%100}),ee(0,["GG",2],0,function(){return this.isoWeekYear()%100});function tW(y,S){ee(0,[y,y.length],0,S)}tW("gggg","weekYear"),tW("ggggg","weekYear"),tW("GGGG","isoWeekYear"),tW("GGGGG","isoWeekYear"),xe("weekYear","gg"),xe("isoWeekYear","GG"),Ee("weekYear",1),Ee("isoWeekYear",1),We("G",Jd),We("g",Jd),We("GG",$r,ua),We("gg",$r,ua),We("GGGG",Ya,od),We("gggg",Ya,od),We("GGGGG",Ps,Kd),We("ggggg",Ps,Kd),xg(["gggg","ggggg","GGGG","GGGGG"],function(y,S,T,M){S[M.substr(0,2)]=ve(y)}),xg(["gg","GG"],function(y,S,T,M){S[M]=e.parseTwoDigitYear(y)});function S5t(y){return zLe.call(this,y,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function x5t(y){return zLe.call(this,y,this.isoWeek(),this.isoWeekday(),1,4)}function C5t(){return hx(this.year(),1,4)}function O5t(){return hx(this.isoWeekYear(),1,4)}function P5t(){var y=this.localeData()._week;return hx(this.year(),y.dow,y.doy)}function E5t(){var y=this.localeData()._week;return hx(this.weekYear(),y.dow,y.doy)}function zLe(y,S,T,M,N){var V;return y==null?TU(this,M,N).year:(V=hx(y,M,N),S>V&&(S=V),T5t.call(this,y,S,T,M,N))}function T5t(y,S,T,M,N){var V=vLe(y,S,T,M,N),ce=EU(V.year,0,V.dayOfYear);return this.year(ce.getUTCFullYear()),this.month(ce.getUTCMonth()),this.date(ce.getUTCDate()),this}ee("Q",0,"Qo","quarter"),xe("quarter","Q"),Ee("quarter",7),We("Q",Wd),Sn("Q",function(y,S){S[px]=(ve(y)-1)*3});function A5t(y){return y==null?Math.ceil((this.month()+1)/3):this.month((y-1)*3+this.month()%3)}ee("D",["DD",2],"Do","date"),xe("date","D"),Ee("date",9),We("D",$r),We("DD",$r,ua),We("Do",function(y,S){return y?S._dayOfMonthOrdinalParse||S._ordinalParse:S._dayOfMonthOrdinalParseLenient}),Sn(["D","DD"],Xy),Sn("Do",function(y,S){S[Xy]=ve(y.match($r)[0])});var HLe=qe("Date",!0);ee("DDD",["DDDD",3],"DDDo","dayOfYear"),xe("dayOfYear","DDD"),Ee("dayOfYear",4),We("DDD",xP),We("DDDD",Ff),Sn(["DDD","DDDD"],function(y,S,T){T._dayOfYear=ve(y)});function I5t(y){var S=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return y==null?S:this.add(y-S,"d")}ee("m",["mm",2],0,"minute"),xe("minute","m"),Ee("minute",14),We("m",$r),We("mm",$r,ua),Sn(["m","mm"],Cg);var M5t=qe("Minutes",!1);ee("s",["ss",2],0,"second"),xe("second","s"),Ee("second",15),We("s",$r),We("ss",$r,ua),Sn(["s","ss"],mx);var R5t=qe("Seconds",!1);ee("S",0,0,function(){return~~(this.millisecond()/100)}),ee(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),ee(0,["SSS",3],0,"millisecond"),ee(0,["SSSS",4],0,function(){return this.millisecond()*10}),ee(0,["SSSSS",5],0,function(){return this.millisecond()*100}),ee(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),ee(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),ee(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),ee(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),xe("millisecond","ms"),Ee("millisecond",16),We("S",xP,Wd),We("SS",xP,ua),We("SSS",xP,Ff);var OP,VLe;for(OP="SSSS";OP.length<=9;OP+="S")We(OP,Pa);function j5t(y,S){S[WI]=ve(("0."+y)*1e3)}for(OP="S";OP.length<=9;OP+="S")Sn(OP,j5t);VLe=qe("Milliseconds",!1),ee("z",0,0,"zoneAbbr"),ee("zz",0,0,"zoneName");function D5t(){return this._isUTC?"UTC":""}function N5t(){return this._isUTC?"Coordinated Universal Time":""}var $e=C.prototype;$e.add=E6t,$e.calendar=D6t,$e.clone=N6t,$e.diff=U6t,$e.endOf=X6t,$e.format=W6t,$e.from=K6t,$e.fromNow=J6t,$e.to=G6t,$e.toNow=Y6t,$e.get=sa,$e.invalidAt=s5t,$e.isAfter=L6t,$e.isBefore=F6t,$e.isBetween=k6t,$e.isSame=$6t,$e.isSameOrAfter=B6t,$e.isSameOrBefore=q6t,$e.isValid=i5t,$e.lang=kLe,$e.locale=FLe,$e.localeData=$Le,$e.max=i6t,$e.min=o6t,$e.parsingFlags=a5t,$e.set=uc,$e.startOf=Z6t,$e.subtract=T6t,$e.toArray=r5t,$e.toObject=n5t,$e.toDate=t5t,$e.toISOString=H6t,$e.inspect=V6t,typeof Symbol<"u"&&Symbol.for!=null&&($e[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),$e.toJSON=o5t,$e.toString=z6t,$e.unix=e5t,$e.valueOf=Q6t,$e.creationData=u5t,$e.eraName=f5t,$e.eraNarrow=p5t,$e.eraAbbr=m5t,$e.eraYear=h5t,$e.year=_Le,$e.isLeapYear=n8t,$e.weekYear=S5t,$e.isoWeekYear=x5t,$e.quarter=$e.quarters=A5t,$e.month=yLe,$e.daysInMonth=e8t,$e.week=$e.weeks=l8t,$e.isoWeek=$e.isoWeeks=c8t,$e.weeksInYear=P5t,$e.weeksInWeekYear=E5t,$e.isoWeeksInYear=C5t,$e.isoWeeksInISOWeekYear=O5t,$e.date=HLe,$e.day=$e.days=x8t,$e.weekday=C8t,$e.isoWeekday=O8t,$e.dayOfYear=I5t,$e.hour=$e.hours=R8t,$e.minute=$e.minutes=M5t,$e.second=$e.seconds=R5t,$e.millisecond=$e.milliseconds=VLe,$e.utcOffset=m6t,$e.utc=g6t,$e.local=y6t,$e.parseZone=b6t,$e.hasAlignedHourOffset=_6t,$e.isDST=v6t,$e.isLocal=S6t,$e.isUtcOffset=x6t,$e.isUtc=RLe,$e.isUTC=RLe,$e.zoneAbbr=D5t,$e.zoneName=N5t,$e.dates=A("dates accessor is deprecated. Use date instead.",HLe),$e.months=A("months accessor is deprecated. Use month instead",yLe),$e.years=A("years accessor is deprecated. Use year instead",_Le),$e.zone=A("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",h6t),$e.isDSTShifted=A("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",w6t);function L5t(y){return Ui(y*1e3)}function F5t(){return Ui.apply(null,arguments).parseZone()}function WLe(y){return y}var fo=F.prototype;fo.calendar=W,fo.longDateFormat=st,fo.invalidDate=Qe,fo.ordinal=Me,fo.preparse=WLe,fo.postformat=WLe,fo.relativeTime=Xt,fo.pastFuture=nr,fo.set=D,fo.eras=l5t,fo.erasParse=c5t,fo.erasConvertYear=d5t,fo.erasAbbrRegex=y5t,fo.erasNameRegex=g5t,fo.erasNarrowRegex=b5t,fo.months=YVt,fo.monthsShort=ZVt,fo.monthsParse=QVt,fo.monthsRegex=r8t,fo.monthsShortRegex=t8t,fo.week=i8t,fo.firstDayOfYear=u8t,fo.firstDayOfWeek=s8t,fo.weekdays=b8t,fo.weekdaysMin=v8t,fo.weekdaysShort=_8t,fo.weekdaysParse=S8t,fo.weekdaysRegex=P8t,fo.weekdaysShortRegex=E8t,fo.weekdaysMinRegex=T8t,fo.isPM=I8t,fo.meridiem=j8t;function rW(y,S,T,M){var N=gx(),V=f().set(M,S);return N[T](V,y)}function KLe(y,S,T){if(u(y)&&(S=y,y=void 0),y=y||"",S!=null)return rW(y,S,T,"month");var M,N=[];for(M=0;M<12;M++)N[M]=rW(y,M,T,"month");return N}function $le(y,S,T,M){typeof y=="boolean"?(u(S)&&(T=S,S=void 0),S=S||""):(S=y,T=S,y=!1,u(S)&&(T=S,S=void 0),S=S||"");var N=gx(),V=y?N._week.dow:0,ce,Vt=[];if(T!=null)return rW(S,(T+V)%7,M,"day");for(ce=0;ce<7;ce++)Vt[ce]=rW(S,(ce+V)%7,M,"day");return Vt}function k5t(y,S){return KLe(y,S,"months")}function $5t(y,S){return KLe(y,S,"monthsShort")}function B5t(y,S,T){return $le(y,S,T,"weekdays")}function q5t(y,S,T){return $le(y,S,T,"weekdaysShort")}function U5t(y,S,T){return $le(y,S,T,"weekdaysMin")}CP("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(y){var S=y%10,T=ve(y%100/10)===1?"th":S===1?"st":S===2?"nd":S===3?"rd":"th";return y+T}}),e.lang=A("moment.lang is deprecated. Use moment.locale instead.",CP),e.langData=A("moment.langData is deprecated. Use moment.localeData instead.",gx);var yx=Math.abs;function z5t(){var y=this._data;return this._milliseconds=yx(this._milliseconds),this._days=yx(this._days),this._months=yx(this._months),y.milliseconds=yx(y.milliseconds),y.seconds=yx(y.seconds),y.minutes=yx(y.minutes),y.hours=yx(y.hours),y.months=yx(y.months),y.years=yx(y.years),this}function JLe(y,S,T,M){var N=Og(S,T);return y._milliseconds+=M*N._milliseconds,y._days+=M*N._days,y._months+=M*N._months,y._bubble()}function H5t(y,S){return JLe(this,y,S,1)}function V5t(y,S){return JLe(this,y,S,-1)}function GLe(y){return y<0?Math.floor(y):Math.ceil(y)}function W5t(){var y=this._milliseconds,S=this._days,T=this._months,M=this._data,N,V,ce,Vt,rn;return y>=0&&S>=0&&T>=0||y<=0&&S<=0&&T<=0||(y+=GLe(Ble(T)+S)*864e5,S=0,T=0),M.milliseconds=y%1e3,N=Se(y/1e3),M.seconds=N%60,V=Se(N/60),M.minutes=V%60,ce=Se(V/60),M.hours=ce%24,S+=Se(ce/24),rn=Se(YLe(S)),T+=rn,S-=GLe(Ble(rn)),Vt=Se(T/12),T%=12,M.days=S,M.months=T,M.years=Vt,this}function YLe(y){return y*4800/146097}function Ble(y){return y*146097/4800}function K5t(y){if(!this.isValid())return NaN;var S,T,M=this._milliseconds;if(y=te(y),y==="month"||y==="quarter"||y==="year")switch(S=this._days+M/864e5,T=this._months+YLe(S),y){case"month":return T;case"quarter":return T/3;case"year":return T/12}else switch(S=this._days+Math.round(Ble(this._months)),y){case"week":return S/7+M/6048e5;case"day":return S+M/864e5;case"hour":return S*24+M/36e5;case"minute":return S*1440+M/6e4;case"second":return S*86400+M/1e3;case"millisecond":return Math.floor(S*864e5)+M;default:throw new Error("Unknown unit "+y)}}function J5t(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+ve(this._months/12)*31536e6:NaN}function bx(y){return function(){return this.as(y)}}var G5t=bx("ms"),Y5t=bx("s"),Z5t=bx("m"),X5t=bx("h"),Q5t=bx("d"),eWt=bx("w"),tWt=bx("M"),rWt=bx("Q"),nWt=bx("y");function oWt(){return Og(this)}function iWt(y){return y=te(y),this.isValid()?this[y+"s"]():NaN}function JI(y){return function(){return this.isValid()?this._data[y]:NaN}}var aWt=JI("milliseconds"),sWt=JI("seconds"),uWt=JI("minutes"),lWt=JI("hours"),cWt=JI("days"),dWt=JI("months"),fWt=JI("years");function pWt(){return Se(this.days()/7)}var _x=Math.round,pN={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function mWt(y,S,T,M,N){return N.relativeTime(S||1,!!T,y,M)}function hWt(y,S,T,M){var N=Og(y).abs(),V=_x(N.as("s")),ce=_x(N.as("m")),Vt=_x(N.as("h")),rn=_x(N.as("d")),mi=_x(N.as("M")),Zd=_x(N.as("w")),vx=_x(N.as("y")),PP=V<=T.ss&&["s",V]||V<T.s&&["ss",V]||ce<=1&&["m"]||ce<T.m&&["mm",ce]||Vt<=1&&["h"]||Vt<T.h&&["hh",Vt]||rn<=1&&["d"]||rn<T.d&&["dd",rn];return T.w!=null&&(PP=PP||Zd<=1&&["w"]||Zd<T.w&&["ww",Zd]),PP=PP||mi<=1&&["M"]||mi<T.M&&["MM",mi]||vx<=1&&["y"]||["yy",vx],PP[2]=S,PP[3]=+y>0,PP[4]=M,mWt.apply(null,PP)}function gWt(y){return y===void 0?_x:typeof y=="function"?(_x=y,!0):!1}function yWt(y,S){return pN[y]===void 0?!1:S===void 0?pN[y]:(pN[y]=S,y==="s"&&(pN.ss=S-1),!0)}function bWt(y,S){if(!this.isValid())return this.localeData().invalidDate();var T=!1,M=pN,N,V;return typeof y=="object"&&(S=y,y=!1),typeof y=="boolean"&&(T=y),typeof S=="object"&&(M=Object.assign({},pN,S),S.s!=null&&S.ss==null&&(M.ss=S.s-1)),N=this.localeData(),V=hWt(this,!T,M,N),T&&(V=N.pastFuture(+this,V)),N.postformat(V)}var qle=Math.abs;function mN(y){return(y>0)-(y<0)||+y}function nW(){if(!this.isValid())return this.localeData().invalidDate();var y=qle(this._milliseconds)/1e3,S=qle(this._days),T=qle(this._months),M,N,V,ce,Vt=this.asSeconds(),rn,mi,Zd,vx;return Vt?(M=Se(y/60),N=Se(M/60),y%=60,M%=60,V=Se(T/12),T%=12,ce=y?y.toFixed(3).replace(/\.?0+$/,""):"",rn=Vt<0?"-":"",mi=mN(this._months)!==mN(Vt)?"-":"",Zd=mN(this._days)!==mN(Vt)?"-":"",vx=mN(this._milliseconds)!==mN(Vt)?"-":"",rn+"P"+(V?mi+V+"Y":"")+(T?mi+T+"M":"")+(S?Zd+S+"D":"")+(N||M||y?"T":"")+(N?vx+N+"H":"")+(M?vx+M+"M":"")+(y?vx+ce+"S":"")):"P0D"}var Hn=Y5.prototype;Hn.isValid=c6t,Hn.abs=z5t,Hn.add=H5t,Hn.subtract=V5t,Hn.as=K5t,Hn.asMilliseconds=G5t,Hn.asSeconds=Y5t,Hn.asMinutes=Z5t,Hn.asHours=X5t,Hn.asDays=Q5t,Hn.asWeeks=eWt,Hn.asMonths=tWt,Hn.asQuarters=rWt,Hn.asYears=nWt,Hn.valueOf=J5t,Hn._bubble=W5t,Hn.clone=oWt,Hn.get=iWt,Hn.milliseconds=aWt,Hn.seconds=sWt,Hn.minutes=uWt,Hn.hours=lWt,Hn.days=cWt,Hn.weeks=pWt,Hn.months=dWt,Hn.years=fWt,Hn.humanize=bWt,Hn.toISOString=nW,Hn.toString=nW,Hn.toJSON=nW,Hn.locale=FLe,Hn.localeData=$Le,Hn.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",nW),Hn.lang=kLe,ee("X",0,0,"unix"),ee("x",0,0,"valueOf"),We("x",Jd),We("X",kf),Sn("X",function(y,S,T){T._d=new Date(parseFloat(y)*1e3)}),Sn("x",function(y,S,T){T._d=new Date(ve(y))});return e.version="2.29.4",r(Ui),e.fn=$e,e.min=a6t,e.max=s6t,e.now=u6t,e.utc=f,e.unix=L5t,e.months=k5t,e.isDate=l,e.locale=CP,e.invalid=g,e.duration=Og,e.isMoment=E,e.weekdays=B5t,e.parseZone=F5t,e.localeData=gx,e.isDuration=Z5,e.monthsShort=$5t,e.weekdaysMin=U5t,e.defineLocale=Tle,e.updateLocale=F8t,e.locales=k8t,e.weekdaysShort=q5t,e.normalizeUnits=te,e.relativeTimeRounding=gWt,e.relativeTimeThreshold=yWt,e.calendarFormat=j6t,e.prototype=$e,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},e})});function GUe(t){let e=t?.detail||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function HZt(t){let e=GUe(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function YUe(t){let e=GUe(t);return HZt(t)?$fe.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:$fe.UNKNOWN_ERROR)}function JN(t){return t.replace(/^#/,"").trim().toLowerCase()}function Tz(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(JN(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(JN(i))}):typeof n=="string"&&o.add(JN(n))),Array.from(o)}function ZUe(t,e,r){if(e.length===0)return[];e=e.map(i=>JN(i));let n=r&&r.length>0?r:Ufe(t,"/"),o=[];for(let i of n){let a=Tz(i);e.some(s=>a.includes(s))&&o.push(i)}return o}function zfe(t){let e=(0,qfe.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()}:Ml(new Date)}async function GN(t,e){return t.extension!="md"&&t.extension!="canvas"?null:await e.cachedRead(t)}function z9(t){return t.basename}function QUe(t,e){return!t||!e?!1:t.includes(Bfe)&&e.includes(Bfe)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function YN(t){let e=[],{history:r}=t;for(let n=0;n<r.length;n+=2){let o=r[n]?.content||"",i=r[n+1]?.content||"";e.push({role:"user",content:o},{role:"assistant",content:i})}return e}function $x(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 rh.TFile)o.set(s.path,s);else{let l=e.getMarkdownFiles().filter(c=>c.basename===a);l.length>0&&(Hfe(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 Hfe(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function eze(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function tze(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}function nze(t){return rze.test(t)}function Az(t){let e=t.match(rze);return e?e[0]:null}async function As(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)}ae("==== safeFetch method request ====");let n=e.method?.toUpperCase()||"POST",i=await(0,rh.requestUrl)({url:t,contentType:"application/json",headers:r,method:n,...["POST","PUT","PATCH"].includes(n)&&{body:e.body?.toString()},throw:!1});if(i.status>=400){let a;try{a=typeof i.json=="string"?JSON.parse(i.json):i.json}catch{try{a=typeof i.text=="string"?JSON.parse(i.text):i.text}catch{a=null}}let s=new Error($fe.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:KZt(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 KZt(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function En(t,e=!1){return t instanceof Error?t.message+`
${t?.cause?"more message: "+t.cause.message:""}
${e?t.stack:""}`:JSON.stringify(t)}function Vfe(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function H9(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 cb(t){let e=QN[t];return{...e,label:e.label||t}}function ff(t,e){let r=QN[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}async function Iz(t,e=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new rh.Notice("No active leaf found.");return}if(r.view instanceof rh.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof rh.MarkdownView)){new rh.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to");e?n.replaceRange(t,o,i):n.replaceRange(t,i),new rh.Notice("Message inserted into the active note.")}function V9(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function W9(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 oze(){try{return{version:(await(0,rh.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 DM(t){if(typeof t=="string")return t.startsWith("o1")||t.startsWith("o3")||t.startsWith("o4");let e=t.modelName||t.model||"";return e.startsWith("o1")||e.startsWith("o3")||e.startsWith("o4")}function ize(t,e="system"){return DM(t)?"human":e}function Wfe(){let t=["3rd party (openai-format)","ollama","lm-studio","azure openai","copilot-plus","copilot-plus-jina"];return Object.entries(QN).filter(([e])=>!t.includes(e)).map(([e])=>e)}function ZN(t,e){let r=!!Wfe().find(i=>i===t.provider),n=db[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 JZt(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e.type==="text").map(e=>e.text).join(""):String(t||"")}function XN(t){return JZt(t).replace(/<think>[\s\S]*?<\/think>/g,"").trim()}function aze(){return crypto.randomUUID()}async function Bx(t){let e=console.warn;try{return console.warn=function(...r){if(!(r[0]?.includes&&(r[0].includes("Failed to calculate number of tokens")||r[0].includes("Unknown model"))))return e.apply(console,r)},await t()}finally{console.warn=e}}var qfe,rh,$fe,Ufe,VZt,WZt,XUe,Ml,rze,yn=O(()=>{pf();Zr();mo();qfe=$(JUe()),rh=require("obsidian"),$fe={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}`};Ufe=(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})};VZt=t=>t.last.bound.modelName||t.last.bound.model,WZt=t=>t.last.bound.retriever!==void 0,XUe=t=>VZt(t)||WZt(t),Ml=(t,e="local")=>{let r=(0,qfe.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};rze=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/});var eL,Kfe,Mz,pf=O(()=>{Mg();HP();Jp();bUe();yn();eL=class eL{static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.bind({signal:i?.signal}),s=si.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return eL.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=eL.instances.get("llm_chain");return r||(r=eL.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,u=hd.fromTemplate(`Given the following conversation and a follow up question,
summarize the conversation as context and keep the follow up question unchanged, in its original language.
If the follow up question is unrelated to its preceding messages, return this follow up question directly.
If it is related, then combine the summary and the follow up question to construct a standalone question.
Make sure to keep any [[]] wrapped note titles in the question unchanged.
Chat History:
{chat_history}
Follow Up Input: {question}
Standalone question:`),c=hd.fromTemplate(`{system_message}
Answer the question with as detailed as possible based only on the following context:
{context}
Question: {question}
`),d=b=>b.map(_=>`Human: ${_[0]}
Assistant: ${_[1]}`).join(`
`),f=si.from([{question:b=>(n&&console.log("Input Question: ",b.question),b.question),chat_history:b=>{let g=d(b.chat_history);return n&&console.log("Formatted Chat History: ",g),g}},u,o,new M9,b=>{let g=XN(b);return n&&console.log("Standalone Question: ",g),g}]),p=async b=>(r(b),wfe(b)),m=si.from([{context:i.pipe(p),question:new so,system_message:()=>a},c,o]);return f.pipe(m)}};eL.instances=new Map;Kfe=eL,Mz=Kfe});var Rz=O(()=>{});var GP,hs,gi,fb,WUe,KUe,jz,K9,uze,Jfe,lze,Gfe,Yfe,Ux,zx,qx,YP,lb,JP,jM,Bfe,QN,db,cze,ar,J9,nh,Qf,Hx,Zr=O(()=>{Hle();iW();pf();Rz();GP="https://api.brevilabs.com/v1",hs="copilot-chat-view",gi="user",fb="ai",WUe=`You are Obsidian Copilot, a helpful assistant that integrates AI to Obsidian note-taking.
1. Never mention that you do not have access to something. Always rely on the user provided context.
2. Always answer to the best of your knowledge. If you are unsure about something, say so and ask the user to provide more context.
3. If the user mentions "note", it most likely means an Obsidian note in the vault, not the generic meaning of a note.
4. If the user mentions "@vault", it means the user wants you to search the Obsidian vault for information relevant to the query. The search results will be provided to you in the context along with the user query, read it carefully and answer the question based on the information provided. If there's no relevant information in the vault, just say so.
5. If the user mentions any other tool with the @ symbol, check the context for their results. If nothing is found, just ignore the @ symbol in the query.
6. Always use $'s instead of \\[ etc. for LaTeX equations.
7. When showing note titles, use [[title]] format and do not wrap them in \` \`.
8. When showing **Obsidian internal** image links, use ![[link]] format and do not wrap them in \` \`.
9. When showing **web** image links, use ![link](url) format and do not wrap them in \` \`.
10. When generating a table, use compact formatting without excessive whitespace.
11. Always respond in the language of the user's query.
12. Do NOT mention the additional context provided such as getCurrentTime and getTimeRangeMs if it's irrelevant to the user message.
13. If the user mentions "tags", it most likely means tags in Obsidian note properties.`,KUe=`Return the new note content or canvas JSON in a special JSON format.
# Steps to find the the target notes
1. Extract the target note information from user message and find out the note path from the context below.
2. If target note is not specified, use the <active_note> as the target note.
3. If still failed to find the target note or the note path, ask the user to specify the target note.
# JSON Format
Provide the content in JSON format and wrap it in a code block with the following structure:
For a single markdown file:
\`\`\`json
{
"type": "composer",
"path": "path/to/file.md",
"content": "The FULL CONTENT of the md note goes here"
}
\`\`\`
For a canvas file:
\`\`\`json
{
"type": "composer",
"path": "path/to/file.canvas",
"canvas_json": {
"nodes": [
{
"id": "1",
"type": "text",
"text": "Hello, world!",
"x": 0,
"y": 0,
"width": 200,
"height": 50
}
],
"edges": [
{
"id": "e1-2",
"fromNode": "1",
"toNode": "2",
"label": "connects to"
}
]
}
}
\`\`\`
# Important
* ALL JSON objects must be complete and valid - ensure all arrays and objects have matching closing brackets
* For canvas files, both 'nodes' and 'edges' arrays must be properly closed with ]
* Properly escape all special characters in the content field, especially backticks and quotes
* Prefer to create new files in existing folders or root folder unless the user's request specifies otherwise
* File paths must end with a .md or .canvas extension
* When generating changes on multiple files, output multiple JSON objects
* Each JSON object must be parseable independently
* For canvas files:
- Every node must have: id, type, x, y, width, height
- Every edge must have: id, fromNode, toNode
- All IDs must be unique
- Edge fromNode and toNode must reference existing node IDs`,jz="note_context",K9=`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.`,uze=6e3,Jfe=.4,lze=.4,Gfe=15,Yfe=448e3,Ux={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree"},zx={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"},qx=(m=>(m.OPENAI="openai",m.OPENAI_FORMAT="3rd party (openai-format)",m.AZURE_OPENAI="azure openai",m.ANTHROPIC="anthropic",m.COHEREAI="cohereai",m.GOOGLE="google",m.XAI="xai",m.OPENROUTERAI="openrouterai",m.GROQ="groq",m.OLLAMA="ollama",m.LM_STUDIO="lm-studio",m.COPILOT_PLUS="copilot-plus",m.MISTRAL="mistralai",m.DEEPSEEK="deepseek",m))(qx||{}),YP={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},lb=[{name:"copilot-plus-flash",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,core:!0,plusExclusive:!0,projectEnabled:!1,capabilities:["vision"]},{name:"gpt-4.1",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-4.1-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-4.1-nano",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"o4-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["reasoning"]},{name:"claude-sonnet-4-20250514",provider:"anthropic",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"claude-3-7-sonnet-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"claude-3-5-sonnet-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"claude-3-5-haiku-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0},{name:"grok-3-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"grok-3-mini-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"gemini-2.5-flash-preview-04-17",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gemini-2.5-pro-preview-06-05",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"command-r",provider:"cohereai",enabled:!0,isBuiltIn:!0},{name:"command-r-plus",provider:"cohereai",enabled:!0,isBuiltIn:!0},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0},{name:"deepseek-chat",provider:"deepseek",enabled:!0,isBuiltIn:!0},{name:"deepseek-reasoner",provider:"deepseek",enabled:!0,isBuiltIn:!0,capabilities:["reasoning"]}],JP=(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))(JP||{}),jM=[{name:"copilot-plus-small",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0},{name:"copilot-plus-large",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0,believerExclusive:!0,dimensions:1024},{name:"copilot-plus-multilingual",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0,dimensions:512},{name:"text-embedding-3-small",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"text-embedding-3-large",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"embed-multilingual-light-v3.0",provider:"cohereai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"text-embedding-004",provider:"google",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0}],Bfe="nomic-embed-text",QN={openai:{label:"OpenAI",host:"https://api.openai.com",keyManagementURL:"https://platform.openai.com/api-keys",listModelURL:"https://api.openai.com/v1/models",testModel:"gpt-4.1"},"azure openai":{label:"Azure OpenAI",host:"",keyManagementURL:"",listModelURL:"",testModel:"azure-openai"},anthropic:{label:"Anthropic",host:"https://api.anthropic.com/",keyManagementURL:"https://console.anthropic.com/settings/keys",listModelURL:"https://api.anthropic.com/v1/models",testModel:"claude-3-5-sonnet-latest"},cohereai:{label:"Cohere",host:"https://api.cohere.com",keyManagementURL:"https://dashboard.cohere.ai/api-keys",listModelURL:"https://api.cohere.com/v1/models",testModel:"command-r"},google:{label:"Gemini",host:"https://generativelanguage.googleapis.com",keyManagementURL:"https://makersuite.google.com/app/apikey",listModelURL:"https://generativelanguage.googleapis.com/v1beta/models",testModel:"gemini-2.5-flash-preview-04-17"},xai:{label:"XAI",host:"https://api.x.ai/v1",keyManagementURL:"https://console.x.ai",listModelURL:"https://api.x.ai/v1/models",testModel:"grok-3-beta"},openrouterai:{label:"OpenRouter",host:"https://openrouter.ai/api/v1/",keyManagementURL:"https://openrouter.ai/keys",listModelURL:"https://openrouter.ai/api/v1/models",testModel:"openai/chatgpt-4o-latest"},groq:{label:"Groq",host:"https://api.groq.com/openai",keyManagementURL:"https://console.groq.com/keys",listModelURL:"https://api.groq.com/openai/v1/models",testModel:"llama3-8b-8192"},ollama:{label:"Ollama",host:"http://localhost:11434/v1/",keyManagementURL:"",listModelURL:""},"lm-studio":{label:"LM Studio",host:"http://localhost:1234/v1",keyManagementURL:"",listModelURL:""},"3rd party (openai-format)":{label:"OpenAI Format",host:"https://api.example.com/v1",keyManagementURL:"",listModelURL:""},mistralai:{label:"Mistral",host:"https://api.mistral.ai/v1",keyManagementURL:"https://console.mistral.ai/api-keys",listModelURL:"https://api.mistral.ai/v1/models",testModel:"mistral-tiny-latest"},deepseek:{label:"DeepSeek",host:"https://api.deepseek.com/",keyManagementURL:"https://platform.deepseek.com/api-keys",listModelURL:"https://api.deepseek.com/models",testModel:"deepseek-chat"},"copilot-plus":{label:"Copilot Plus",host:"https://api.brevilabs.com/v1",keyManagementURL:"",listModelURL:""},"copilot-plus-jina":{label:"Copilot Plus",host:"https://api.brevilabs.com/v1",keyManagementURL:"",listModelURL:""}},db={anthropic:"anthropicApiKey",openai:"openAIApiKey","azure openai":"azureOpenAIApiKey",google:"googleApiKey",groq:"groqApiKey",openrouterai:"openRouterAiApiKey",cohereai:"cohereApiKey",xai:"xaiApiKey","copilot-plus":"plusLicenseKey",mistralai:"mistralApiKey",deepseek:"deepseekApiKey"},cze=["NEVER","ON STARTUP","ON MODE SWITCH"],ar={ADD_CUSTOM_PROMPT:"add-custom-prompt",APPLY_ADHOC_PROMPT:"apply-adhoc-prompt",APPLY_CUSTOM_PROMPT:"apply-custom-prompt",CLEAR_LOCAL_COPILOT_INDEX:"clear-local-copilot-index",CLEAR_COPILOT_CACHE:"clear-copilot-cache",COUNT_WORD_AND_TOKENS_SELECTION:"count-word-and-tokens-selection",COUNT_TOTAL_VAULT_TOKENS:"count-total-vault-tokens",DEBUG_WORD_COMPLETION:"debug-word-completion",DELETE_CUSTOM_PROMPT:"delete-custom-prompt",EDIT_CUSTOM_PROMPT:"edit-custom-prompt",FIND_RELEVANT_NOTES:"find-relevant-notes",FORCE_REINDEX_VAULT_TO_COPILOT_INDEX:"force-reindex-vault-to-copilot-index",GARBAGE_COLLECT_COPILOT_INDEX:"garbage-collect-copilot-index",INDEX_VAULT_TO_COPILOT_INDEX:"index-vault-to-copilot-index",INSPECT_COPILOT_INDEX_BY_NOTE_PATHS:"copilot-inspect-index-by-note-paths",LIST_INDEXED_FILES:"copilot-list-indexed-files",LOAD_COPILOT_CHAT_CONVERSATION:"load-copilot-chat-conversation",NEW_CHAT:"new-chat",OPEN_COPILOT_CHAT_WINDOW:"chat-open-window",REMOVE_FILES_FROM_COPILOT_INDEX:"remove-files-from-copilot-index",SEARCH_ORAMA_DB:"copilot-search-orama-db",TOGGLE_COPILOT_CHAT_WINDOW:"chat-toggle-window",TOGGLE_AUTOCOMPLETE:"toggle-autocomplete"},J9={[ar.ADD_CUSTOM_PROMPT]:"Add custom prompt",[ar.APPLY_ADHOC_PROMPT]:"Apply ad-hoc custom prompt",[ar.APPLY_CUSTOM_PROMPT]:"Apply custom prompt",[ar.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[ar.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[ar.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[ar.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[ar.DEBUG_WORD_COMPLETION]:"Word completion: Debug",[ar.DELETE_CUSTOM_PROMPT]:"Delete custom prompt",[ar.EDIT_CUSTOM_PROMPT]:"Edit custom prompt",[ar.FIND_RELEVANT_NOTES]:"Find relevant notes",[ar.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[ar.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[ar.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[ar.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[ar.LIST_INDEXED_FILES]:"List all indexed files (debug)",[ar.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[ar.NEW_CHAT]:"New Copilot Chat",[ar.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[ar.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[ar.SEARCH_ORAMA_DB]:"Search OramaDB (debug)",[ar.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window",[ar.TOGGLE_AUTOCOMPLETE]:"Toggle autocomplete"},nh={DELAY_MS:600,MIN_TRIGGER_LENGTH:3,MAX_CONTEXT_LENGTH:1e4,KEYBIND:"Tab"},Qf={userId:GI(),isPlusUser:!1,plusLicenseKey:"",openAIApiKey:"",openAIOrgId:"",huggingfaceApiKey:"",cohereApiKey:"",anthropicApiKey:"",azureOpenAIApiKey:"",azureOpenAIApiInstanceName:"",azureOpenAIApiDeploymentName:"",azureOpenAIApiVersion:"",azureOpenAIApiEmbeddingDeploymentName:"",googleApiKey:"",openRouterAiApiKey:"",xaiApiKey:"",mistralApiKey:"",deepseekApiKey:"",defaultChainType:"llm_chain",defaultModelKey:"gpt-4.1|openai",embeddingModelKey:"text-embedding-3-small|openai",temperature:.1,maxTokens:6e3,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:"copilot-conversations",defaultConversationTag:"copilot-conversation",autosaveChat:!1,includeActiveNoteAsContext:!0,defaultOpenArea:"view",customPromptsFolder:"copilot-custom-prompts",indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:"",qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:3,groqApiKey:"",activeModels:lb,activeEmbeddingModels:jM,embeddingRequestsPerMin:90,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,promptUsageTimestamps:{},promptSortStrategy:"timestamp",defaultConversationNoteName:"{$topic}@{$date}_{$time}",inlineEditCommands:hN,projectList:[],enableAutocomplete:!0,autocompleteAcceptKey:nh.KEYBIND,allowAdditionalContext:!0,enableWordCompletion:!1,lastDismissedVersion:null,passMarkdownImages:!0,enableCustomPromptTemplating:!0},Hx={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change"}});var Xfe=v(G9=>{"use strict";G9.byteLength=YZt;G9.toByteArray=XZt;G9.fromByteArray=tXt;var pb=[],oh=[],GZt=typeof Uint8Array<"u"?Uint8Array:Array,Zfe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(NM=0,dze=Zfe.length;NM<dze;++NM)pb[NM]=Zfe[NM],oh[Zfe.charCodeAt(NM)]=NM;var NM,dze;oh[45]=62;oh[95]=63;function fze(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 YZt(t){var e=fze(t),r=e[0],n=e[1];return(r+n)*3/4-n}function ZZt(t,e,r){return(e+r)*3/4-r}function XZt(t){var e,r=fze(t),n=r[0],o=r[1],i=new GZt(ZZt(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u<s;u+=4)e=oh[t.charCodeAt(u)]<<18|oh[t.charCodeAt(u+1)]<<12|oh[t.charCodeAt(u+2)]<<6|oh[t.charCodeAt(u+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=oh[t.charCodeAt(u)]<<2|oh[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=oh[t.charCodeAt(u)]<<10|oh[t.charCodeAt(u+1)]<<4|oh[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function QZt(t){return pb[t>>18&63]+pb[t>>12&63]+pb[t>>6&63]+pb[t&63]}function eXt(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(QZt(n));return o.join("")}function tXt(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,s=r-n;a<s;a+=i)o.push(eXt(t,a,a+i>s?s:a+i));return n===1?(e=t[r-1],o.push(pb[e>>2]+pb[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(pb[e>>10]+pb[e>>4&63]+pb[e<<2&63]+"=")),o.join("")}});var pze=v(Qfe=>{Qfe.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)};Qfe.write=function(t,e,r,n,o,i){var a,s,u,l=i*8-o-1,c=(1<<l)-1,d=c>>1,f=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,m=n?1:-1,h=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+d>=1?e+=f/u:e+=f*Math.pow(2,1-d),e*u>=2&&(a++,u/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(e*u-1)*Math.pow(2,o),a=a+d):(s=e*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;t[r+p]=s&255,p+=m,s/=256,o-=8);for(a=a<<o|s,l+=o;l>0;t[r+p]=a&255,p+=m,a/=256,l-=8);t[r+p-m]|=h*128}});var tp=v(oL=>{"use strict";var epe=Xfe(),rL=pze(),mze=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;oL.Buffer=pe;oL.SlowBuffer=sXt;oL.INSPECT_MAX_BYTES=50;var Y9=2147483647;oL.kMaxLength=Y9;pe.TYPED_ARRAY_SUPPORT=rXt();!pe.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 rXt(){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(pe.prototype,"parent",{enumerable:!0,get:function(){if(pe.isBuffer(this))return this.buffer}});Object.defineProperty(pe.prototype,"offset",{enumerable:!0,get:function(){if(pe.isBuffer(this))return this.byteOffset}});function Vx(t){if(t>Y9)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,pe.prototype),e}function pe(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 ope(t)}return bze(t,e,r)}pe.poolSize=8192;function bze(t,e,r){if(typeof t=="string")return oXt(t,e);if(ArrayBuffer.isView(t))return iXt(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(mb(t,ArrayBuffer)||t&&mb(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(mb(t,SharedArrayBuffer)||t&&mb(t.buffer,SharedArrayBuffer)))return rpe(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 pe.from(n,e,r);let o=aXt(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return pe.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)}pe.from=function(t,e,r){return bze(t,e,r)};Object.setPrototypeOf(pe.prototype,Uint8Array.prototype);Object.setPrototypeOf(pe,Uint8Array);function _ze(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 nXt(t,e,r){return _ze(t),t<=0?Vx(t):e!==void 0?typeof r=="string"?Vx(t).fill(e,r):Vx(t).fill(e):Vx(t)}pe.alloc=function(t,e,r){return nXt(t,e,r)};function ope(t){return _ze(t),Vx(t<0?0:ipe(t)|0)}pe.allocUnsafe=function(t){return ope(t)};pe.allocUnsafeSlow=function(t){return ope(t)};function oXt(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!pe.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=vze(t,e)|0,n=Vx(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function tpe(t){let e=t.length<0?0:ipe(t.length)|0,r=Vx(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function iXt(t){if(mb(t,Uint8Array)){let e=new Uint8Array(t);return rpe(e.buffer,e.byteOffset,e.byteLength)}return tpe(t)}function rpe(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,pe.prototype),n}function aXt(t){if(pe.isBuffer(t)){let e=ipe(t.length)|0,r=Vx(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||spe(t.length)?Vx(0):tpe(t);if(t.type==="Buffer"&&Array.isArray(t.data))return tpe(t.data)}function ipe(t){if(t>=Y9)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Y9.toString(16)+" bytes");return t|0}function sXt(t){return+t!=t&&(t=0),pe.alloc(+t)}pe.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==pe.prototype};pe.compare=function(e,r){if(mb(e,Uint8Array)&&(e=pe.from(e,e.offset,e.byteLength)),mb(r,Uint8Array)&&(r=pe.from(r,r.offset,r.byteLength)),!pe.isBuffer(e)||!pe.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};pe.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}};pe.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return pe.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let o=pe.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){let a=e[n];if(mb(a,Uint8Array))i+a.length>o.length?(pe.isBuffer(a)||(a=pe.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(pe.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function vze(t,e){if(pe.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||mb(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 npe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Aze(t).length;default:if(o)return n?-1:npe(t).length;e=(""+e).toLowerCase(),o=!0}}pe.byteLength=vze;function uXt(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 bXt(this,e,r);case"utf8":case"utf-8":return Sze(this,e,r);case"ascii":return gXt(this,e,r);case"latin1":case"binary":return yXt(this,e,r);case"base64":return mXt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _Xt(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}pe.prototype._isBuffer=!0;function LM(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}pe.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)LM(this,r,r+1);return this};pe.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)LM(this,r,r+3),LM(this,r+1,r+2);return this};pe.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)LM(this,r,r+7),LM(this,r+1,r+6),LM(this,r+2,r+5),LM(this,r+3,r+4);return this};pe.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Sze(this,0,e):uXt.apply(this,arguments)};pe.prototype.toLocaleString=pe.prototype.toString;pe.prototype.equals=function(e){if(!pe.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:pe.compare(this,e)===0};pe.prototype.inspect=function(){let e="",r=oL.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};mze&&(pe.prototype[mze]=pe.prototype.inspect);pe.prototype.compare=function(e,r,n,o,i){if(mb(e,Uint8Array)&&(e=pe.from(e,e.offset,e.byteLength)),!pe.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 wze(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,spe(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=pe.from(e,n)),pe.isBuffer(e))return e.length===0?-1:hze(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):hze(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function hze(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}pe.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};pe.prototype.indexOf=function(e,r,n){return wze(this,e,r,n,!0)};pe.prototype.lastIndexOf=function(e,r,n){return wze(this,e,r,n,!1)};function lXt(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(spe(s))return a;t[r+a]=s}return a}function cXt(t,e,r,n){return Z9(npe(e,t.length-r),t,r,n)}function dXt(t,e,r,n){return Z9(xXt(e),t,r,n)}function fXt(t,e,r,n){return Z9(Aze(e),t,r,n)}function pXt(t,e,r,n){return Z9(CXt(e,t.length-r),t,r,n)}pe.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 lXt(this,e,r,n);case"utf8":case"utf-8":return cXt(this,e,r,n);case"ascii":case"latin1":case"binary":return dXt(this,e,r,n);case"base64":return fXt(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pXt(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};pe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function mXt(t,e,r){return e===0&&r===t.length?epe.fromByteArray(t):epe.fromByteArray(t.slice(e,r))}function Sze(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 hXt(n)}var gze=4096;function hXt(t){let e=t.length;if(e<=gze)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=gze));return r}function gXt(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 yXt(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 bXt(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+=OXt[t[i]];return o}function _Xt(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}pe.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,pe.prototype),o};function Rl(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")}pe.prototype.readUintLE=pe.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Rl(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return o};pe.prototype.readUintBE=pe.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Rl(e,r,this.length);let o=this[e+--r],i=1;for(;r>0&&(i*=256);)o+=this[e+--r]*i;return o};pe.prototype.readUint8=pe.prototype.readUInt8=function(e,r){return e=e>>>0,r||Rl(e,1,this.length),this[e]};pe.prototype.readUint16LE=pe.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Rl(e,2,this.length),this[e]|this[e+1]<<8};pe.prototype.readUint16BE=pe.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Rl(e,2,this.length),this[e]<<8|this[e+1]};pe.prototype.readUint32LE=pe.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Rl(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};pe.prototype.readUint32BE=pe.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Rl(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};pe.prototype.readBigUInt64LE=ZP(function(e){e=e>>>0,nL(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Dz(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))});pe.prototype.readBigUInt64BE=ZP(function(e){e=e>>>0,nL(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Dz(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)});pe.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Rl(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};pe.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Rl(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};pe.prototype.readInt8=function(e,r){return e=e>>>0,r||Rl(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};pe.prototype.readInt16LE=function(e,r){e=e>>>0,r||Rl(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};pe.prototype.readInt16BE=function(e,r){e=e>>>0,r||Rl(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};pe.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Rl(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};pe.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Rl(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};pe.prototype.readBigInt64LE=ZP(function(e){e=e>>>0,nL(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Dz(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)});pe.prototype.readBigInt64BE=ZP(function(e){e=e>>>0,nL(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Dz(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)});pe.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Rl(e,4,this.length),rL.read(this,e,!0,23,4)};pe.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Rl(e,4,this.length),rL.read(this,e,!1,23,4)};pe.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Rl(e,8,this.length),rL.read(this,e,!0,52,8)};pe.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Rl(e,8,this.length),rL.read(this,e,!1,52,8)};function ep(t,e,r,n,o,i){if(!pe.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")}pe.prototype.writeUintLE=pe.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;ep(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};pe.prototype.writeUintBE=pe.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;ep(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};pe.prototype.writeUint8=pe.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||ep(this,e,r,1,255,0),this[r]=e&255,r+1};pe.prototype.writeUint16LE=pe.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||ep(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};pe.prototype.writeUint16BE=pe.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||ep(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};pe.prototype.writeUint32LE=pe.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||ep(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};pe.prototype.writeUint32BE=pe.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||ep(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 xze(t,e,r,n,o){Tze(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 Cze(t,e,r,n,o){Tze(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}pe.prototype.writeBigUInt64LE=ZP(function(e,r=0){return xze(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});pe.prototype.writeBigUInt64BE=ZP(function(e,r=0){return Cze(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});pe.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);ep(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};pe.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);ep(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};pe.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||ep(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};pe.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||ep(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};pe.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||ep(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};pe.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||ep(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};pe.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||ep(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};pe.prototype.writeBigInt64LE=ZP(function(e,r=0){return xze(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});pe.prototype.writeBigInt64BE=ZP(function(e,r=0){return Cze(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Oze(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 Pze(t,e,r,n,o){return e=+e,r=r>>>0,o||Oze(t,e,r,4,34028234663852886e22,-34028234663852886e22),rL.write(t,e,r,n,23,4),r+4}pe.prototype.writeFloatLE=function(e,r,n){return Pze(this,e,r,!0,n)};pe.prototype.writeFloatBE=function(e,r,n){return Pze(this,e,r,!1,n)};function Eze(t,e,r,n,o){return e=+e,r=r>>>0,o||Oze(t,e,r,8,17976931348623157e292,-17976931348623157e292),rL.write(t,e,r,n,52,8),r+8}pe.prototype.writeDoubleLE=function(e,r,n){return Eze(this,e,r,!0,n)};pe.prototype.writeDoubleBE=function(e,r,n){return Eze(this,e,r,!1,n)};pe.prototype.copy=function(e,r,n,o){if(!pe.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};pe.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"&&!pe.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=pe.isBuffer(e)?e:pe.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 tL={};function ape(t,e,r){tL[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}`}}}ape("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ape("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);ape("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=yze(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=yze(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function yze(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 vXt(t,e,r){nL(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Dz(e,t.length-(r+1))}function Tze(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 tL.ERR_OUT_OF_RANGE("value",s,t)}vXt(n,o,i)}function nL(t,e){if(typeof t!="number")throw new tL.ERR_INVALID_ARG_TYPE(e,"number",t)}function Dz(t,e,r){throw Math.floor(t)!==t?(nL(t,r),new tL.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new tL.ERR_BUFFER_OUT_OF_BOUNDS:new tL.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var wXt=/[^+/0-9A-Za-z-_]/g;function SXt(t){if(t=t.split("=")[0],t=t.trim().replace(wXt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function npe(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 xXt(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function CXt(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 Aze(t){return epe.toByteArray(SXt(t))}function Z9(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 mb(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function spe(t){return t!==t}var OXt=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 ZP(t){return typeof BigInt>"u"?PXt:t}function PXt(){throw new Error("BigInt not supported")}});var Yze=v(Ri=>{"use strict";function ype(t,e){var r=t.length;t.push(e);e:for(;0<r;){var n=r-1>>>1,o=t[n];if(0<iK(o,e))t[n]=e,t[r]=o,r=n;else break e}}function jg(t){return t.length===0?null:t[0]}function sK(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>iK(s,r))u<o&&0>iK(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(u<o&&0>iK(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function iK(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(qze=performance,Ri.unstable_now=function(){return qze.now()}):(mpe=Date,Uze=mpe.now(),Ri.unstable_now=function(){return mpe.now()-Uze});var qze,mpe,Uze,gb=[],QP=[],IXt=1,ih=null,yd=3,uK=!1,BM=!1,Fz=!1,Vze=typeof setTimeout=="function"?setTimeout:null,Wze=typeof clearTimeout=="function"?clearTimeout:null,zze=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function bpe(t){for(var e=jg(QP);e!==null;){if(e.callback===null)sK(QP);else if(e.startTime<=t)sK(QP),e.sortIndex=e.expirationTime,ype(gb,e);else break;e=jg(QP)}}function _pe(t){if(Fz=!1,bpe(t),!BM)if(jg(gb)!==null)BM=!0,wpe(vpe);else{var e=jg(QP);e!==null&&Spe(_pe,e.startTime-t)}}function vpe(t,e){BM=!1,Fz&&(Fz=!1,Wze(kz),kz=-1),uK=!0;var r=yd;try{for(bpe(e),ih=jg(gb);ih!==null&&(!(ih.expirationTime>e)||t&&!Gze());){var n=ih.callback;if(typeof n=="function"){ih.callback=null,yd=ih.priorityLevel;var o=n(ih.expirationTime<=e);e=Ri.unstable_now(),typeof o=="function"?ih.callback=o:ih===jg(gb)&&sK(gb),bpe(e)}else sK(gb);ih=jg(gb)}if(ih!==null)var i=!0;else{var a=jg(QP);a!==null&&Spe(_pe,a.startTime-e),i=!1}return i}finally{ih=null,yd=r,uK=!1}}var lK=!1,aK=null,kz=-1,Kze=5,Jze=-1;function Gze(){return!(Ri.unstable_now()-Jze<Kze)}function hpe(){if(aK!==null){var t=Ri.unstable_now();Jze=t;var e=!0;try{e=aK(!0,t)}finally{e?Lz():(lK=!1,aK=null)}}else lK=!1}var Lz;typeof zze=="function"?Lz=function(){zze(hpe)}:typeof MessageChannel<"u"?(gpe=new MessageChannel,Hze=gpe.port2,gpe.port1.onmessage=hpe,Lz=function(){Hze.postMessage(null)}):Lz=function(){Vze(hpe,0)};var gpe,Hze;function wpe(t){aK=t,lK||(lK=!0,Lz())}function Spe(t,e){kz=Vze(function(){t(Ri.unstable_now())},e)}Ri.unstable_IdlePriority=5;Ri.unstable_ImmediatePriority=1;Ri.unstable_LowPriority=4;Ri.unstable_NormalPriority=3;Ri.unstable_Profiling=null;Ri.unstable_UserBlockingPriority=2;Ri.unstable_cancelCallback=function(t){t.callback=null};Ri.unstable_continueExecution=function(){BM||uK||(BM=!0,wpe(vpe))};Ri.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"):Kze=0<t?Math.floor(1e3/t):5};Ri.unstable_getCurrentPriorityLevel=function(){return yd};Ri.unstable_getFirstCallbackNode=function(){return jg(gb)};Ri.unstable_next=function(t){switch(yd){case 1:case 2:case 3:var e=3;break;default:e=yd}var r=yd;yd=e;try{return t()}finally{yd=r}};Ri.unstable_pauseExecution=function(){};Ri.unstable_requestPaint=function(){};Ri.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=yd;yd=t;try{return e()}finally{yd=r}};Ri.unstable_scheduleCallback=function(t,e,r){var n=Ri.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:IXt++,callback:e,priorityLevel:t,startTime:r,expirationTime:o,sortIndex:-1},r>n?(t.sortIndex=r,ype(QP,t),jg(gb)===null&&t===jg(QP)&&(Fz?(Wze(kz),kz=-1):Fz=!0,Spe(_pe,r-n))):(t.sortIndex=o,ype(gb,t),BM||uK||(BM=!0,wpe(vpe))),t};Ri.unstable_shouldYield=Gze;Ri.unstable_wrapCallback=function(t){var e=yd;return function(){var r=yd;yd=e;try{return t.apply(this,arguments)}finally{yd=r}}}});var Xze=v((XRn,Zze)=>{"use strict";Zze.exports=Yze()});var oHe=v(tm=>{"use strict";var i4e=Y(),Qp=Xze();function Fe(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 a4e=new Set,a2={};function QM(t,e){EL(t,e),EL(t+"Capture",e)}function EL(t,e){for(a2[t]=e,t=0;t<e.length;t++)a4e.add(e[t])}var Zx=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vpe=Object.prototype.hasOwnProperty,MXt=/^[: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]*$/,Qze={},e2e={};function RXt(t){return Vpe.call(e2e,t)?!0:Vpe.call(Qze,t)?!1:MXt.test(t)?e2e[t]=!0:(Qze[t]=!0,!1)}function jXt(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 DXt(t,e,r,n){if(e===null||typeof e>"u"||jXt(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 gf(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 bc={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){bc[t]=new gf(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];bc[e]=new gf(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){bc[t]=new gf(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){bc[t]=new gf(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){bc[t]=new gf(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){bc[t]=new gf(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){bc[t]=new gf(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){bc[t]=new gf(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){bc[t]=new gf(t,5,!1,t.toLowerCase(),null,!1,!1)});var Fme=/[\-:]([a-z])/g;function kme(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(Fme,kme);bc[e]=new gf(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(Fme,kme);bc[e]=new gf(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(Fme,kme);bc[e]=new gf(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){bc[t]=new gf(t,1,!1,t.toLowerCase(),null,!1,!1)});bc.xlinkHref=new gf("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){bc[t]=new gf(t,1,!1,t.toLowerCase(),null,!0,!0)});function $me(t,e,r,n){var o=bc.hasOwnProperty(e)?bc[e]:null;(o!==null?o.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(DXt(e,r,o,n)&&(r=null),n||o===null?RXt(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 tC=i4e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,cK=Symbol.for("react.element"),lL=Symbol.for("react.portal"),cL=Symbol.for("react.fragment"),Bme=Symbol.for("react.strict_mode"),Wpe=Symbol.for("react.profiler"),s4e=Symbol.for("react.provider"),u4e=Symbol.for("react.context"),qme=Symbol.for("react.forward_ref"),Kpe=Symbol.for("react.suspense"),Jpe=Symbol.for("react.suspense_list"),Ume=Symbol.for("react.memo"),tE=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var l4e=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var t2e=Symbol.iterator;function $z(t){return t===null||typeof t!="object"?null:(t=t2e&&t[t2e]||t["@@iterator"],typeof t=="function"?t:null)}var Aa=Object.assign,xpe;function Kz(t){if(xpe===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);xpe=e&&e[1]||""}return`
`+xpe+t}var Cpe=!1;function Ope(t,e){if(!t||Cpe)return"";Cpe=!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{Cpe=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?Kz(t):""}function NXt(t){switch(t.tag){case 5:return Kz(t.type);case 16:return Kz("Lazy");case 13:return Kz("Suspense");case 19:return Kz("SuspenseList");case 0:case 2:case 15:return t=Ope(t.type,!1),t;case 11:return t=Ope(t.type.render,!1),t;case 1:return t=Ope(t.type,!0),t;default:return""}}function Gpe(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 cL:return"Fragment";case lL:return"Portal";case Wpe:return"Profiler";case Bme:return"StrictMode";case Kpe:return"Suspense";case Jpe:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case u4e:return(t.displayName||"Context")+".Consumer";case s4e:return(t._context.displayName||"Context")+".Provider";case qme:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Ume:return e=t.displayName||null,e!==null?e:Gpe(t.type)||"Memo";case tE:e=t._payload,t=t._init;try{return Gpe(t(e))}catch{}}return null}function LXt(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 Gpe(e);case 8:return e===Bme?"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 hE(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function c4e(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function FXt(t){var e=c4e(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 dK(t){t._valueTracker||(t._valueTracker=FXt(t))}function d4e(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=c4e(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function $K(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 Ype(t,e){var r=e.checked;return Aa({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function r2e(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=hE(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 f4e(t,e){e=e.checked,e!=null&&$me(t,"checked",e,!1)}function Zpe(t,e){f4e(t,e);var r=hE(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")?Xpe(t,e.type,r):e.hasOwnProperty("defaultValue")&&Xpe(t,e.type,hE(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function n2e(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 Xpe(t,e,r){(e!=="number"||$K(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var Jz=Array.isArray;function wL(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=""+hE(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 Qpe(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Fe(91));return Aa({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function o2e(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(Fe(92));if(Jz(r)){if(1<r.length)throw Error(Fe(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:hE(r)}}function p4e(t,e){var r=hE(e.value),n=hE(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 i2e(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function m4e(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 eme(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?m4e(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var fK,h4e=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(fK=fK||document.createElement("div"),fK.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=fK.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function s2(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var Zz={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},kXt=["Webkit","ms","Moz","O"];Object.keys(Zz).forEach(function(t){kXt.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Zz[e]=Zz[t]})});function g4e(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||Zz.hasOwnProperty(t)&&Zz[t]?(""+e).trim():e+"px"}function y4e(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=g4e(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var $Xt=Aa({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 tme(t,e){if(e){if($Xt[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Fe(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Fe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Fe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Fe(62))}}function rme(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 nme=null;function zme(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ome=null,SL=null,xL=null;function a2e(t){if(t=O2(t)){if(typeof ome!="function")throw Error(Fe(280));var e=t.stateNode;e&&(e=pJ(e),ome(t.stateNode,t.type,e))}}function b4e(t){SL?xL?xL.push(t):xL=[t]:SL=t}function _4e(){if(SL){var t=SL,e=xL;if(xL=SL=null,a2e(t),e)for(t=0;t<e.length;t++)a2e(e[t])}}function v4e(t,e){return t(e)}function w4e(){}var Ppe=!1;function S4e(t,e,r){if(Ppe)return t(e,r);Ppe=!0;try{return v4e(t,e,r)}finally{Ppe=!1,(SL!==null||xL!==null)&&(w4e(),_4e())}}function u2(t,e){var r=t.stateNode;if(r===null)return null;var n=pJ(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(Fe(231,e,typeof r));return r}var ime=!1;if(Zx)try{sL={},Object.defineProperty(sL,"passive",{get:function(){ime=!0}}),window.addEventListener("test",sL,sL),window.removeEventListener("test",sL,sL)}catch{ime=!1}var sL;function BXt(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 Xz=!1,BK=null,qK=!1,ame=null,qXt={onError:function(t){Xz=!0,BK=t}};function UXt(t,e,r,n,o,i,a,s,u){Xz=!1,BK=null,BXt.apply(qXt,arguments)}function zXt(t,e,r,n,o,i,a,s,u){if(UXt.apply(this,arguments),Xz){if(Xz){var l=BK;Xz=!1,BK=null}else throw Error(Fe(198));qK||(qK=!0,ame=l)}}function eR(t){var e=t,r=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,(e.flags&4098)!==0&&(r=e.return),t=e.return;while(t)}return e.tag===3?r:null}function x4e(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 s2e(t){if(eR(t)!==t)throw Error(Fe(188))}function HXt(t){var e=t.alternate;if(!e){if(e=eR(t),e===null)throw Error(Fe(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 s2e(o),t;if(i===n)return s2e(o),e;i=i.sibling}throw Error(Fe(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(Fe(189))}}if(r.alternate!==n)throw Error(Fe(190))}if(r.tag!==3)throw Error(Fe(188));return r.stateNode.current===r?t:e}function C4e(t){return t=HXt(t),t!==null?O4e(t):null}function O4e(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=O4e(t);if(e!==null)return e;t=t.sibling}return null}var P4e=Qp.unstable_scheduleCallback,u2e=Qp.unstable_cancelCallback,VXt=Qp.unstable_shouldYield,WXt=Qp.unstable_requestPaint,gs=Qp.unstable_now,KXt=Qp.unstable_getCurrentPriorityLevel,Hme=Qp.unstable_ImmediatePriority,E4e=Qp.unstable_UserBlockingPriority,UK=Qp.unstable_NormalPriority,JXt=Qp.unstable_LowPriority,T4e=Qp.unstable_IdlePriority,lJ=null,vb=null;function GXt(t){if(vb&&typeof vb.onCommitFiberRoot=="function")try{vb.onCommitFiberRoot(lJ,t,void 0,(t.current.flags&128)===128)}catch{}}var kg=Math.clz32?Math.clz32:XXt,YXt=Math.log,ZXt=Math.LN2;function XXt(t){return t>>>=0,t===0?32:31-(YXt(t)/ZXt|0)|0}var pK=64,mK=4194304;function Gz(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 zK(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=Gz(s):(i&=a,i!==0&&(n=Gz(i)))}else a=r&~o,a!==0?n=Gz(a):i!==0&&(n=Gz(i));if(n===0)return 0;if(e!==0&&e!==n&&(e&o)===0&&(o=n&-n,i=e&-e,o>=i||o===16&&(i&4194240)!==0))return e;if((n&4)!==0&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0<e;)r=31-kg(e),o=1<<r,n|=t[r],e&=~o;return n}function QXt(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 eQt(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var a=31-kg(i),s=1<<a,u=o[a];u===-1?((s&r)===0||(s&n)!==0)&&(o[a]=QXt(s,e)):u<=e&&(t.expiredLanes|=s),i&=~s}}function sme(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function A4e(){var t=pK;return pK<<=1,(pK&4194240)===0&&(pK=64),t}function Epe(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function x2(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-kg(e),t[e]=r}function tQt(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-kg(r),i=1<<o;e[o]=0,n[o]=-1,t[o]=-1,r&=~i}}function Vme(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-kg(r),o=1<<n;o&e|t[n]&e&&(t[n]|=e),r&=~o}}var ui=0;function I4e(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var M4e,Wme,R4e,j4e,D4e,ume=!1,hK=[],sE=null,uE=null,lE=null,l2=new Map,c2=new Map,nE=[],rQt="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 l2e(t,e){switch(t){case"focusin":case"focusout":sE=null;break;case"dragenter":case"dragleave":uE=null;break;case"mouseover":case"mouseout":lE=null;break;case"pointerover":case"pointerout":l2.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":c2.delete(e.pointerId)}}function Bz(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=O2(e),e!==null&&Wme(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function nQt(t,e,r,n,o){switch(e){case"focusin":return sE=Bz(sE,t,e,r,n,o),!0;case"dragenter":return uE=Bz(uE,t,e,r,n,o),!0;case"mouseover":return lE=Bz(lE,t,e,r,n,o),!0;case"pointerover":var i=o.pointerId;return l2.set(i,Bz(l2.get(i)||null,t,e,r,n,o)),!0;case"gotpointercapture":return i=o.pointerId,c2.set(i,Bz(c2.get(i)||null,t,e,r,n,o)),!0}return!1}function N4e(t){var e=zM(t.target);if(e!==null){var r=eR(e);if(r!==null){if(e=r.tag,e===13){if(e=x4e(r),e!==null){t.blockedOn=e,D4e(t.priority,function(){R4e(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 AK(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=lme(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);nme=n,r.target.dispatchEvent(n),nme=null}else return e=O2(r),e!==null&&Wme(e),t.blockedOn=r,!1;e.shift()}return!0}function c2e(t,e,r){AK(t)&&r.delete(e)}function oQt(){ume=!1,sE!==null&&AK(sE)&&(sE=null),uE!==null&&AK(uE)&&(uE=null),lE!==null&&AK(lE)&&(lE=null),l2.forEach(c2e),c2.forEach(c2e)}function qz(t,e){t.blockedOn===e&&(t.blockedOn=null,ume||(ume=!0,Qp.unstable_scheduleCallback(Qp.unstable_NormalPriority,oQt)))}function d2(t){function e(o){return qz(o,t)}if(0<hK.length){qz(hK[0],t);for(var r=1;r<hK.length;r++){var n=hK[r];n.blockedOn===t&&(n.blockedOn=null)}}for(sE!==null&&qz(sE,t),uE!==null&&qz(uE,t),lE!==null&&qz(lE,t),l2.forEach(e),c2.forEach(e),r=0;r<nE.length;r++)n=nE[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<nE.length&&(r=nE[0],r.blockedOn===null);)N4e(r),r.blockedOn===null&&nE.shift()}var CL=tC.ReactCurrentBatchConfig,HK=!0;function iQt(t,e,r,n){var o=ui,i=CL.transition;CL.transition=null;try{ui=1,Kme(t,e,r,n)}finally{ui=o,CL.transition=i}}function aQt(t,e,r,n){var o=ui,i=CL.transition;CL.transition=null;try{ui=4,Kme(t,e,r,n)}finally{ui=o,CL.transition=i}}function Kme(t,e,r,n){if(HK){var o=lme(t,e,r,n);if(o===null)Dpe(t,e,n,VK,r),l2e(t,n);else if(nQt(o,t,e,r,n))n.stopPropagation();else if(l2e(t,n),e&4&&-1<rQt.indexOf(t)){for(;o!==null;){var i=O2(o);if(i!==null&&M4e(i),i=lme(t,e,r,n),i===null&&Dpe(t,e,n,VK,r),i===o)break;o=i}o!==null&&n.stopPropagation()}else Dpe(t,e,n,null,r)}}var VK=null;function lme(t,e,r,n){if(VK=null,t=zme(n),t=zM(t),t!==null)if(e=eR(t),e===null)t=null;else if(r=e.tag,r===13){if(t=x4e(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 VK=t,null}function L4e(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(KXt()){case Hme:return 1;case E4e:return 4;case UK:case JXt:return 16;case T4e:return 536870912;default:return 16}default:return 16}}var iE=null,Jme=null,IK=null;function F4e(){if(IK)return IK;var t,e=Jme,r=e.length,n,o="value"in iE?iE.value:iE.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 IK=o.slice(t,1<n?1-n:void 0)}function MK(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 gK(){return!0}function d2e(){return!1}function em(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)?gK:d2e,this.isPropagationStopped=d2e,this}return Aa(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=gK)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=gK)},persist:function(){},isPersistent:gK}),e}var DL={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gme=em(DL),C2=Aa({},DL,{view:0,detail:0}),sQt=em(C2),Tpe,Ape,Uz,cJ=Aa({},C2,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yme,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!==Uz&&(Uz&&t.type==="mousemove"?(Tpe=t.screenX-Uz.screenX,Ape=t.screenY-Uz.screenY):Ape=Tpe=0,Uz=t),Tpe)},movementY:function(t){return"movementY"in t?t.movementY:Ape}}),f2e=em(cJ),uQt=Aa({},cJ,{dataTransfer:0}),lQt=em(uQt),cQt=Aa({},C2,{relatedTarget:0}),Ipe=em(cQt),dQt=Aa({},DL,{animationName:0,elapsedTime:0,pseudoElement:0}),fQt=em(dQt),pQt=Aa({},DL,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),mQt=em(pQt),hQt=Aa({},DL,{data:0}),p2e=em(hQt),gQt={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yQt={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"},bQt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _Qt(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=bQt[t])?!!e[t]:!1}function Yme(){return _Qt}var vQt=Aa({},C2,{key:function(t){if(t.key){var e=gQt[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=MK(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?yQt[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yme,charCode:function(t){return t.type==="keypress"?MK(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?MK(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),wQt=em(vQt),SQt=Aa({},cJ,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),m2e=em(SQt),xQt=Aa({},C2,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yme}),CQt=em(xQt),OQt=Aa({},DL,{propertyName:0,elapsedTime:0,pseudoElement:0}),PQt=em(OQt),EQt=Aa({},cJ,{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}),TQt=em(EQt),AQt=[9,13,27,32],Zme=Zx&&"CompositionEvent"in window,Qz=null;Zx&&"documentMode"in document&&(Qz=document.documentMode);var IQt=Zx&&"TextEvent"in window&&!Qz,k4e=Zx&&(!Zme||Qz&&8<Qz&&11>=Qz),h2e=" ",g2e=!1;function $4e(t,e){switch(t){case"keyup":return AQt.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function B4e(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var dL=!1;function MQt(t,e){switch(t){case"compositionend":return B4e(e);case"keypress":return e.which!==32?null:(g2e=!0,h2e);case"textInput":return t=e.data,t===h2e&&g2e?null:t;default:return null}}function RQt(t,e){if(dL)return t==="compositionend"||!Zme&&$4e(t,e)?(t=F4e(),IK=Jme=iE=null,dL=!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 k4e&&e.locale!=="ko"?null:e.data;default:return null}}var jQt={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 y2e(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!jQt[t.type]:e==="textarea"}function q4e(t,e,r,n){b4e(n),e=WK(e,"onChange"),0<e.length&&(r=new Gme("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var e2=null,f2=null;function DQt(t){X4e(t,0)}function dJ(t){var e=mL(t);if(d4e(e))return t}function NQt(t,e){if(t==="change")return e}var U4e=!1;Zx&&(Zx?(bK="oninput"in document,bK||(Mpe=document.createElement("div"),Mpe.setAttribute("oninput","return;"),bK=typeof Mpe.oninput=="function"),yK=bK):yK=!1,U4e=yK&&(!document.documentMode||9<document.documentMode));var yK,bK,Mpe;function b2e(){e2&&(e2.detachEvent("onpropertychange",z4e),f2=e2=null)}function z4e(t){if(t.propertyName==="value"&&dJ(f2)){var e=[];q4e(e,f2,t,zme(t)),S4e(DQt,e)}}function LQt(t,e,r){t==="focusin"?(b2e(),e2=e,f2=r,e2.attachEvent("onpropertychange",z4e)):t==="focusout"&&b2e()}function FQt(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return dJ(f2)}function kQt(t,e){if(t==="click")return dJ(e)}function $Qt(t,e){if(t==="input"||t==="change")return dJ(e)}function BQt(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Bg=typeof Object.is=="function"?Object.is:BQt;function p2(t,e){if(Bg(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(!Vpe.call(e,o)||!Bg(t[o],e[o]))return!1}return!0}function _2e(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function v2e(t,e){var r=_2e(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=_2e(r)}}function H4e(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?H4e(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function V4e(){for(var t=window,e=$K();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=$K(t.document)}return e}function Xme(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 qQt(t){var e=V4e(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&H4e(r.ownerDocument.documentElement,r)){if(n!==null&&Xme(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=v2e(r,i);var a=v2e(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 UQt=Zx&&"documentMode"in document&&11>=document.documentMode,fL=null,cme=null,t2=null,dme=!1;function w2e(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;dme||fL==null||fL!==$K(n)||(n=fL,"selectionStart"in n&&Xme(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}),t2&&p2(t2,n)||(t2=n,n=WK(cme,"onSelect"),0<n.length&&(e=new Gme("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=fL)))}function _K(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var pL={animationend:_K("Animation","AnimationEnd"),animationiteration:_K("Animation","AnimationIteration"),animationstart:_K("Animation","AnimationStart"),transitionend:_K("Transition","TransitionEnd")},Rpe={},W4e={};Zx&&(W4e=document.createElement("div").style,"AnimationEvent"in window||(delete pL.animationend.animation,delete pL.animationiteration.animation,delete pL.animationstart.animation),"TransitionEvent"in window||delete pL.transitionend.transition);function fJ(t){if(Rpe[t])return Rpe[t];if(!pL[t])return t;var e=pL[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in W4e)return Rpe[t]=e[r];return t}var K4e=fJ("animationend"),J4e=fJ("animationiteration"),G4e=fJ("animationstart"),Y4e=fJ("transitionend"),Z4e=new Map,S2e="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 yE(t,e){Z4e.set(t,e),QM(e,[t])}for(vK=0;vK<S2e.length;vK++)wK=S2e[vK],x2e=wK.toLowerCase(),C2e=wK[0].toUpperCase()+wK.slice(1),yE(x2e,"on"+C2e);var wK,x2e,C2e,vK;yE(K4e,"onAnimationEnd");yE(J4e,"onAnimationIteration");yE(G4e,"onAnimationStart");yE("dblclick","onDoubleClick");yE("focusin","onFocus");yE("focusout","onBlur");yE(Y4e,"onTransitionEnd");EL("onMouseEnter",["mouseout","mouseover"]);EL("onMouseLeave",["mouseout","mouseover"]);EL("onPointerEnter",["pointerout","pointerover"]);EL("onPointerLeave",["pointerout","pointerover"]);QM("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));QM("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));QM("onBeforeInput",["compositionend","keypress","textInput","paste"]);QM("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));QM("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));QM("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yz="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(" "),zQt=new Set("cancel close invalid load scroll toggle".split(" ").concat(Yz));function O2e(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,zXt(n,e,void 0,t),t.currentTarget=null}function X4e(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;O2e(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;O2e(o,s,l),i=u}}}if(qK)throw t=ame,qK=!1,ame=null,t}function Vi(t,e){var r=e[gme];r===void 0&&(r=e[gme]=new Set);var n=t+"__bubble";r.has(n)||(Q4e(e,t,2,!1),r.add(n))}function jpe(t,e,r){var n=0;e&&(n|=4),Q4e(r,t,n,e)}var SK="_reactListening"+Math.random().toString(36).slice(2);function m2(t){if(!t[SK]){t[SK]=!0,a4e.forEach(function(r){r!=="selectionchange"&&(zQt.has(r)||jpe(r,!1,t),jpe(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[SK]||(e[SK]=!0,jpe("selectionchange",!1,e))}}function Q4e(t,e,r,n){switch(L4e(e)){case 1:var o=iQt;break;case 4:o=aQt;break;default:o=Kme}r=o.bind(null,e,r,t),o=void 0,!ime||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 Dpe(t,e,r,n,o){var i=n;if((e&1)===0&&(e&2)===0&&n!==null)e:for(;;){if(n===null)return;var a=n.tag;if(a===3||a===4){var s=n.stateNode.containerInfo;if(s===o||s.nodeType===8&&s.parentNode===o)break;if(a===4)for(a=n.return;a!==null;){var u=a.tag;if((u===3||u===4)&&(u=a.stateNode.containerInfo,u===o||u.nodeType===8&&u.parentNode===o))return;a=a.return}for(;s!==null;){if(a=zM(s),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}s=s.parentNode}}n=n.return}S4e(function(){var l=i,c=zme(r),d=[];e:{var f=Z4e.get(t);if(f!==void 0){var p=Gme,m=t;switch(t){case"keypress":if(MK(r)===0)break e;case"keydown":case"keyup":p=wQt;break;case"focusin":m="focus",p=Ipe;break;case"focusout":m="blur",p=Ipe;break;case"beforeblur":case"afterblur":p=Ipe;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=f2e;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=lQt;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=CQt;break;case K4e:case J4e:case G4e:p=fQt;break;case Y4e:p=PQt;break;case"scroll":p=sQt;break;case"wheel":p=TQt;break;case"copy":case"cut":case"paste":p=mQt;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=m2e}var h=(e&4)!==0,b=!h&&t==="scroll",g=h?f!==null?f+"Capture":null:f;h=[];for(var _=l,w;_!==null;){w=_;var x=w.stateNode;if(w.tag===5&&x!==null&&(w=x,g!==null&&(x=u2(_,g),x!=null&&h.push(h2(_,x,w)))),b)break;_=_.return}0<h.length&&(f=new p(f,m,null,r,c),d.push({event:f,listeners:h}))}}if((e&7)===0){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&r!==nme&&(m=r.relatedTarget||r.fromElement)&&(zM(m)||m[Xx]))break e;if((p||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=r.relatedTarget||r.toElement,p=l,m=m?zM(m):null,m!==null&&(b=eR(m),m!==b||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=l),p!==m)){if(h=f2e,x="onMouseLeave",g="onMouseEnter",_="mouse",(t==="pointerout"||t==="pointerover")&&(h=m2e,x="onPointerLeave",g="onPointerEnter",_="pointer"),b=p==null?f:mL(p),w=m==null?f:mL(m),f=new h(x,_+"leave",p,r,c),f.target=b,f.relatedTarget=w,x=null,zM(c)===l&&(h=new h(g,_+"enter",m,r,c),h.target=w,h.relatedTarget=b,x=h),b=x,p&&m)t:{for(h=p,g=m,_=0,w=h;w;w=uL(w))_++;for(w=0,x=g;x;x=uL(x))w++;for(;0<_-w;)h=uL(h),_--;for(;0<w-_;)g=uL(g),w--;for(;_--;){if(h===g||g!==null&&h===g.alternate)break t;h=uL(h),g=uL(g)}h=null}else h=null;p!==null&&P2e(d,f,p,h,!1),m!==null&&b!==null&&P2e(d,b,m,h,!0)}}e:{if(f=l?mL(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var C=NQt;else if(y2e(f))if(U4e)C=$Qt;else{C=FQt;var E=LQt}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(C=kQt);if(C&&(C=C(t,l))){q4e(d,C,r,c);break e}E&&E(t,f,l),t==="focusout"&&(E=f._wrapperState)&&E.controlled&&f.type==="number"&&Xpe(f,"number",f.value)}switch(E=l?mL(l):window,t){case"focusin":(y2e(E)||E.contentEditable==="true")&&(fL=E,cme=l,t2=null);break;case"focusout":t2=cme=fL=null;break;case"mousedown":dme=!0;break;case"contextmenu":case"mouseup":case"dragend":dme=!1,w2e(d,r,c);break;case"selectionchange":if(UQt)break;case"keydown":case"keyup":w2e(d,r,c)}var P;if(Zme)e:{switch(t){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else dL?$4e(t,r)&&(A="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(A="onCompositionStart");A&&(k4e&&r.locale!=="ko"&&(dL||A!=="onCompositionStart"?A==="onCompositionEnd"&&dL&&(P=F4e()):(iE=c,Jme="value"in iE?iE.value:iE.textContent,dL=!0)),E=WK(l,A),0<E.length&&(A=new p2e(A,t,null,r,c),d.push({event:A,listeners:E}),P?A.data=P:(P=B4e(r),P!==null&&(A.data=P)))),(P=IQt?MQt(t,r):RQt(t,r))&&(l=WK(l,"onBeforeInput"),0<l.length&&(c=new p2e("onBeforeInput","beforeinput",null,r,c),d.push({event:c,listeners:l}),c.data=P))}X4e(d,e)})}function h2(t,e,r){return{instance:t,listener:e,currentTarget:r}}function WK(t,e){for(var r=e+"Capture",n=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=u2(t,r),i!=null&&n.unshift(h2(t,i,o)),i=u2(t,e),i!=null&&n.push(h2(t,i,o))),t=t.return}return n}function uL(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function P2e(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=u2(r,i),u!=null&&a.unshift(h2(r,u,s))):o||(u=u2(r,i),u!=null&&a.push(h2(r,u,s)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var HQt=/\r\n?/g,VQt=/\u0000|\uFFFD/g;function E2e(t){return(typeof t=="string"?t:""+t).replace(HQt,`
`).replace(VQt,"")}function xK(t,e,r){if(e=E2e(e),E2e(t)!==e&&r)throw Error(Fe(425))}function KK(){}var fme=null,pme=null;function mme(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 hme=typeof setTimeout=="function"?setTimeout:void 0,WQt=typeof clearTimeout=="function"?clearTimeout:void 0,T2e=typeof Promise=="function"?Promise:void 0,KQt=typeof queueMicrotask=="function"?queueMicrotask:typeof T2e<"u"?function(t){return T2e.resolve(null).then(t).catch(JQt)}:hme;function JQt(t){setTimeout(function(){throw t})}function Npe(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),d2(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=o}while(r);d2(e)}function cE(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 A2e(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 NL=Math.random().toString(36).slice(2),_b="__reactFiber$"+NL,g2="__reactProps$"+NL,Xx="__reactContainer$"+NL,gme="__reactEvents$"+NL,GQt="__reactListeners$"+NL,YQt="__reactHandles$"+NL;function zM(t){var e=t[_b];if(e)return e;for(var r=t.parentNode;r;){if(e=r[Xx]||r[_b]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=A2e(t);t!==null;){if(r=t[_b])return r;t=A2e(t)}return e}t=r,r=t.parentNode}return null}function O2(t){return t=t[_b]||t[Xx],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function mL(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(Fe(33))}function pJ(t){return t[g2]||null}var yme=[],hL=-1;function bE(t){return{current:t}}function Wi(t){0>hL||(t.current=yme[hL],yme[hL]=null,hL--)}function ji(t,e){hL++,yme[hL]=t.current,t.current=e}var gE={},wd=bE(gE),op=bE(!1),JM=gE;function TL(t,e){var r=t.type.contextTypes;if(!r)return gE;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in r)o[i]=e[i];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function ip(t){return t=t.childContextTypes,t!=null}function JK(){Wi(op),Wi(wd)}function I2e(t,e,r){if(wd.current!==gE)throw Error(Fe(168));ji(wd,e),ji(op,r)}function e3e(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(Fe(108,LXt(t)||"Unknown",o));return Aa({},r,n)}function GK(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||gE,JM=wd.current,ji(wd,t),ji(op,op.current),!0}function M2e(t,e,r){var n=t.stateNode;if(!n)throw Error(Fe(169));r?(t=e3e(t,e,JM),n.__reactInternalMemoizedMergedChildContext=t,Wi(op),Wi(wd),ji(wd,t)):Wi(op),ji(op,r)}var Kx=null,mJ=!1,Lpe=!1;function t3e(t){Kx===null?Kx=[t]:Kx.push(t)}function ZQt(t){mJ=!0,t3e(t)}function _E(){if(!Lpe&&Kx!==null){Lpe=!0;var t=0,e=ui;try{var r=Kx;for(ui=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}Kx=null,mJ=!1}catch(o){throw Kx!==null&&(Kx=Kx.slice(t+1)),P4e(Hme,_E),o}finally{ui=e,Lpe=!1}}return null}var gL=[],yL=0,YK=null,ZK=0,ah=[],sh=0,GM=null,Jx=1,Gx="";function qM(t,e){gL[yL++]=ZK,gL[yL++]=YK,YK=t,ZK=e}function r3e(t,e,r){ah[sh++]=Jx,ah[sh++]=Gx,ah[sh++]=GM,GM=t;var n=Jx;t=Gx;var o=32-kg(n)-1;n&=~(1<<o),r+=1;var i=32-kg(e)+o;if(30<i){var a=o-o%5;i=(n&(1<<a)-1).toString(32),n>>=a,o-=a,Jx=1<<32-kg(e)+o|r<<o|n,Gx=i+t}else Jx=1<<i|r<<o|n,Gx=t}function Qme(t){t.return!==null&&(qM(t,1),r3e(t,1,0))}function ehe(t){for(;t===YK;)YK=gL[--yL],gL[yL]=null,ZK=gL[--yL],gL[yL]=null;for(;t===GM;)GM=ah[--sh],ah[sh]=null,Gx=ah[--sh],ah[sh]=null,Jx=ah[--sh],ah[sh]=null}var Xp=null,Zp=null,da=!1,Fg=null;function n3e(t,e){var r=uh(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 R2e(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,Xp=t,Zp=cE(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Xp=t,Zp=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=GM!==null?{id:Jx,overflow:Gx}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=uh(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,Xp=t,Zp=null,!0):!1;default:return!1}}function bme(t){return(t.mode&1)!==0&&(t.flags&128)===0}function _me(t){if(da){var e=Zp;if(e){var r=e;if(!R2e(t,e)){if(bme(t))throw Error(Fe(418));e=cE(r.nextSibling);var n=Xp;e&&R2e(t,e)?n3e(n,r):(t.flags=t.flags&-4097|2,da=!1,Xp=t)}}else{if(bme(t))throw Error(Fe(418));t.flags=t.flags&-4097|2,da=!1,Xp=t}}}function j2e(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Xp=t}function CK(t){if(t!==Xp)return!1;if(!da)return j2e(t),da=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!mme(t.type,t.memoizedProps)),e&&(e=Zp)){if(bme(t))throw o3e(),Error(Fe(418));for(;e;)n3e(t,e),e=cE(e.nextSibling)}if(j2e(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Fe(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){Zp=cE(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}Zp=null}}else Zp=Xp?cE(t.stateNode.nextSibling):null;return!0}function o3e(){for(var t=Zp;t;)t=cE(t.nextSibling)}function AL(){Zp=Xp=null,da=!1}function the(t){Fg===null?Fg=[t]:Fg.push(t)}var XQt=tC.ReactCurrentBatchConfig;function Ng(t,e){if(t&&t.defaultProps){e=Aa({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}var XK=bE(null),QK=null,bL=null,rhe=null;function nhe(){rhe=bL=QK=null}function ohe(t){var e=XK.current;Wi(XK),t._currentValue=e}function vme(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 OL(t,e){QK=t,rhe=bL=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&e)!==0&&(np=!0),t.firstContext=null)}function ch(t){var e=t._currentValue;if(rhe!==t)if(t={context:t,memoizedValue:e,next:null},bL===null){if(QK===null)throw Error(Fe(308));bL=t,QK.dependencies={lanes:0,firstContext:t}}else bL=bL.next=t;return e}var HM=null;function ihe(t){HM===null?HM=[t]:HM.push(t)}function i3e(t,e,r,n){var o=e.interleaved;return o===null?(r.next=r,ihe(e)):(r.next=o.next,o.next=r),e.interleaved=r,Qx(t,n)}function Qx(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 rE=!1;function ahe(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function a3e(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 Yx(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function dE(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,(uo&2)!==0){var o=n.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),n.pending=e,Qx(t,r)}return o=n.interleaved,o===null?(e.next=e,ihe(n)):(e.next=o.next,o.next=e),n.interleaved=e,Qx(t,r)}function RK(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,Vme(t,r)}}function D2e(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 eJ(t,e,r,n){var o=t.updateQueue;rE=!1;var i=o.firstBaseUpdate,a=o.lastBaseUpdate,s=o.shared.pending;if(s!==null){o.shared.pending=null;var u=s,l=u.next;u.next=null,a===null?i=l:a.next=l,a=u;var c=t.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==a&&(s===null?c.firstBaseUpdate=l:s.next=l,c.lastBaseUpdate=u))}if(i!==null){var d=o.baseState;a=0,c=l=u=null,s=i;do{var f=s.lane,p=s.eventTime;if((n&f)===f){c!==null&&(c=c.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var m=t,h=s;switch(f=e,p=r,h.tag){case 1:if(m=h.payload,typeof m=="function"){d=m.call(p,d,f);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m=="function"?m.call(p,d,f):m,f==null)break e;d=Aa({},d,f);break e;case 2:rE=!0}}s.callback!==null&&s.lane!==0&&(t.flags|=64,f=o.effects,f===null?o.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(l=c=p,u=d):c=c.next=p,a|=f;if(s=s.next,s===null){if(s=o.shared.pending,s===null)break;f=s,s=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(c===null&&(u=d),o.baseState=u,o.firstBaseUpdate=l,o.lastBaseUpdate=c,e=o.shared.interleaved,e!==null){o=e;do a|=o.lane,o=o.next;while(o!==e)}else i===null&&(o.shared.lanes=0);ZM|=a,t.lanes=a,t.memoizedState=d}}function N2e(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(Fe(191,o));o.call(n)}}}var s3e=new i4e.Component().refs;function wme(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:Aa({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var hJ={isMounted:function(t){return(t=t._reactInternals)?eR(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=hf(),o=pE(t),i=Yx(n,o);i.payload=e,r!=null&&(i.callback=r),e=dE(t,i,o),e!==null&&($g(e,t,o,n),RK(e,t,o))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=hf(),o=pE(t),i=Yx(n,o);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=dE(t,i,o),e!==null&&($g(e,t,o,n),RK(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=hf(),n=pE(t),o=Yx(r,n);o.tag=2,e!=null&&(o.callback=e),e=dE(t,o,n),e!==null&&($g(e,t,n,r),RK(e,t,n))}};function L2e(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?!p2(r,n)||!p2(o,i):!0}function u3e(t,e,r){var n=!1,o=gE,i=e.contextType;return typeof i=="object"&&i!==null?i=ch(i):(o=ip(e)?JM:wd.current,n=e.contextTypes,i=(n=n!=null)?TL(t,o):gE),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=hJ,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function F2e(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&&hJ.enqueueReplaceState(e,e.state,null)}function Sme(t,e,r,n){var o=t.stateNode;o.props=r,o.state=t.memoizedState,o.refs=s3e,ahe(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=ch(i):(i=ip(e)?JM:wd.current,o.context=TL(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(wme(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&&hJ.enqueueReplaceState(o,o.state,null),eJ(t,r,o,n),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function zz(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(Fe(309));var n=r.stateNode}if(!n)throw Error(Fe(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===s3e&&(s=o.refs={}),a===null?delete s[i]:s[i]=a},e._stringRef=i,e)}if(typeof t!="string")throw Error(Fe(284));if(!r._owner)throw Error(Fe(290,t))}return t}function OK(t,e){throw t=Object.prototype.toString.call(e),Error(Fe(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function k2e(t){var e=t._init;return e(t._payload)}function l3e(t){function e(g,_){if(t){var w=g.deletions;w===null?(g.deletions=[_],g.flags|=16):w.push(_)}}function r(g,_){if(!t)return null;for(;_!==null;)e(g,_),_=_.sibling;return null}function n(g,_){for(g=new Map;_!==null;)_.key!==null?g.set(_.key,_):g.set(_.index,_),_=_.sibling;return g}function o(g,_){return g=mE(g,_),g.index=0,g.sibling=null,g}function i(g,_,w){return g.index=w,t?(w=g.alternate,w!==null?(w=w.index,w<_?(g.flags|=2,_):w):(g.flags|=2,_)):(g.flags|=1048576,_)}function a(g){return t&&g.alternate===null&&(g.flags|=2),g}function s(g,_,w,x){return _===null||_.tag!==6?(_=zpe(w,g.mode,x),_.return=g,_):(_=o(_,w),_.return=g,_)}function u(g,_,w,x){var C=w.type;return C===cL?c(g,_,w.props.children,x,w.key):_!==null&&(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===tE&&k2e(C)===_.type)?(x=o(_,w.props),x.ref=zz(g,_,w),x.return=g,x):(x=kK(w.type,w.key,w.props,null,g.mode,x),x.ref=zz(g,_,w),x.return=g,x)}function l(g,_,w,x){return _===null||_.tag!==4||_.stateNode.containerInfo!==w.containerInfo||_.stateNode.implementation!==w.implementation?(_=Hpe(w,g.mode,x),_.return=g,_):(_=o(_,w.children||[]),_.return=g,_)}function c(g,_,w,x,C){return _===null||_.tag!==7?(_=KM(w,g.mode,x,C),_.return=g,_):(_=o(_,w),_.return=g,_)}function d(g,_,w){if(typeof _=="string"&&_!==""||typeof _=="number")return _=zpe(""+_,g.mode,w),_.return=g,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case cK:return w=kK(_.type,_.key,_.props,null,g.mode,w),w.ref=zz(g,null,_),w.return=g,w;case lL:return _=Hpe(_,g.mode,w),_.return=g,_;case tE:var x=_._init;return d(g,x(_._payload),w)}if(Jz(_)||$z(_))return _=KM(_,g.mode,w,null),_.return=g,_;OK(g,_)}return null}function f(g,_,w,x){var C=_!==null?_.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:s(g,_,""+w,x);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case cK:return w.key===C?u(g,_,w,x):null;case lL:return w.key===C?l(g,_,w,x):null;case tE:return C=w._init,f(g,_,C(w._payload),x)}if(Jz(w)||$z(w))return C!==null?null:c(g,_,w,x,null);OK(g,w)}return null}function p(g,_,w,x,C){if(typeof x=="string"&&x!==""||typeof x=="number")return g=g.get(w)||null,s(_,g,""+x,C);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case cK:return g=g.get(x.key===null?w:x.key)||null,u(_,g,x,C);case lL:return g=g.get(x.key===null?w:x.key)||null,l(_,g,x,C);case tE:var E=x._init;return p(g,_,w,E(x._payload),C)}if(Jz(x)||$z(x))return g=g.get(w)||null,c(_,g,x,C,null);OK(_,x)}return null}function m(g,_,w,x){for(var C=null,E=null,P=_,A=_=0,I=null;P!==null&&A<w.length;A++){P.index>A?(I=P,P=null):I=P.sibling;var R=f(g,P,w[A],x);if(R===null){P===null&&(P=I);break}t&&P&&R.alternate===null&&e(g,P),_=i(R,_,A),E===null?C=R:E.sibling=R,E=R,P=I}if(A===w.length)return r(g,P),da&&qM(g,A),C;if(P===null){for(;A<w.length;A++)P=d(g,w[A],x),P!==null&&(_=i(P,_,A),E===null?C=P:E.sibling=P,E=P);return da&&qM(g,A),C}for(P=n(g,P);A<w.length;A++)I=p(P,g,A,w[A],x),I!==null&&(t&&I.alternate!==null&&P.delete(I.key===null?A:I.key),_=i(I,_,A),E===null?C=I:E.sibling=I,E=I);return t&&P.forEach(function(j){return e(g,j)}),da&&qM(g,A),C}function h(g,_,w,x){var C=$z(w);if(typeof C!="function")throw Error(Fe(150));if(w=C.call(w),w==null)throw Error(Fe(151));for(var E=C=null,P=_,A=_=0,I=null,R=w.next();P!==null&&!R.done;A++,R=w.next()){P.index>A?(I=P,P=null):I=P.sibling;var j=f(g,P,R.value,x);if(j===null){P===null&&(P=I);break}t&&P&&j.alternate===null&&e(g,P),_=i(j,_,A),E===null?C=j:E.sibling=j,E=j,P=I}if(R.done)return r(g,P),da&&qM(g,A),C;if(P===null){for(;!R.done;A++,R=w.next())R=d(g,R.value,x),R!==null&&(_=i(R,_,A),E===null?C=R:E.sibling=R,E=R);return da&&qM(g,A),C}for(P=n(g,P);!R.done;A++,R=w.next())R=p(P,g,A,R.value,x),R!==null&&(t&&R.alternate!==null&&P.delete(R.key===null?A:R.key),_=i(R,_,A),E===null?C=R:E.sibling=R,E=R);return t&&P.forEach(function(D){return e(g,D)}),da&&qM(g,A),C}function b(g,_,w,x){if(typeof w=="object"&&w!==null&&w.type===cL&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case cK:e:{for(var C=w.key,E=_;E!==null;){if(E.key===C){if(C=w.type,C===cL){if(E.tag===7){r(g,E.sibling),_=o(E,w.props.children),_.return=g,g=_;break e}}else if(E.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===tE&&k2e(C)===E.type){r(g,E.sibling),_=o(E,w.props),_.ref=zz(g,E,w),_.return=g,g=_;break e}r(g,E);break}else e(g,E);E=E.sibling}w.type===cL?(_=KM(w.props.children,g.mode,x,w.key),_.return=g,g=_):(x=kK(w.type,w.key,w.props,null,g.mode,x),x.ref=zz(g,_,w),x.return=g,g=x)}return a(g);case lL:e:{for(E=w.key;_!==null;){if(_.key===E)if(_.tag===4&&_.stateNode.containerInfo===w.containerInfo&&_.stateNode.implementation===w.implementation){r(g,_.sibling),_=o(_,w.children||[]),_.return=g,g=_;break e}else{r(g,_);break}else e(g,_);_=_.sibling}_=Hpe(w,g.mode,x),_.return=g,g=_}return a(g);case tE:return E=w._init,b(g,_,E(w._payload),x)}if(Jz(w))return m(g,_,w,x);if($z(w))return h(g,_,w,x);OK(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,_!==null&&_.tag===6?(r(g,_.sibling),_=o(_,w),_.return=g,g=_):(r(g,_),_=zpe(w,g.mode,x),_.return=g,g=_),a(g)):r(g,_)}return b}var IL=l3e(!0),c3e=l3e(!1),P2={},wb=bE(P2),y2=bE(P2),b2=bE(P2);function VM(t){if(t===P2)throw Error(Fe(174));return t}function she(t,e){switch(ji(b2,e),ji(y2,t),ji(wb,P2),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:eme(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=eme(e,t)}Wi(wb),ji(wb,e)}function ML(){Wi(wb),Wi(y2),Wi(b2)}function d3e(t){VM(b2.current);var e=VM(wb.current),r=eme(e,t.type);e!==r&&(ji(y2,t),ji(wb,r))}function uhe(t){y2.current===t&&(Wi(wb),Wi(y2))}var Ea=bE(0);function tJ(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if((e.flags&128)!==0)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Fpe=[];function lhe(){for(var t=0;t<Fpe.length;t++)Fpe[t]._workInProgressVersionPrimary=null;Fpe.length=0}var jK=tC.ReactCurrentDispatcher,kpe=tC.ReactCurrentBatchConfig,YM=0,Ta=null,dl=null,jl=null,rJ=!1,r2=!1,_2=0,QQt=0;function bd(){throw Error(Fe(321))}function che(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!Bg(t[r],e[r]))return!1;return!0}function dhe(t,e,r,n,o,i){if(YM=i,Ta=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,jK.current=t===null||t.memoizedState===null?ner:oer,t=r(n,o),r2){i=0;do{if(r2=!1,_2=0,25<=i)throw Error(Fe(301));i+=1,jl=dl=null,e.updateQueue=null,jK.current=ier,t=r(n,o)}while(r2)}if(jK.current=nJ,e=dl!==null&&dl.next!==null,YM=0,jl=dl=Ta=null,rJ=!1,e)throw Error(Fe(300));return t}function fhe(){var t=_2!==0;return _2=0,t}function bb(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jl===null?Ta.memoizedState=jl=t:jl=jl.next=t,jl}function dh(){if(dl===null){var t=Ta.alternate;t=t!==null?t.memoizedState:null}else t=dl.next;var e=jl===null?Ta.memoizedState:jl.next;if(e!==null)jl=e,dl=t;else{if(t===null)throw Error(Fe(310));dl=t,t={memoizedState:dl.memoizedState,baseState:dl.baseState,baseQueue:dl.baseQueue,queue:dl.queue,next:null},jl===null?Ta.memoizedState=jl=t:jl=jl.next=t}return jl}function v2(t,e){return typeof e=="function"?e(t):e}function $pe(t){var e=dh(),r=e.queue;if(r===null)throw Error(Fe(311));r.lastRenderedReducer=t;var n=dl,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((YM&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,Ta.lanes|=c,ZM|=c}l=l.next}while(l!==null&&l!==i);u===null?a=n:u.next=s,Bg(n,e.memoizedState)||(np=!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,Ta.lanes|=i,ZM|=i,o=o.next;while(o!==t)}else o===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function Bpe(t){var e=dh(),r=e.queue;if(r===null)throw Error(Fe(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);Bg(i,e.memoizedState)||(np=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function f3e(){}function p3e(t,e){var r=Ta,n=dh(),o=e(),i=!Bg(n.memoizedState,o);if(i&&(n.memoizedState=o,np=!0),n=n.queue,phe(g3e.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||jl!==null&&jl.memoizedState.tag&1){if(r.flags|=2048,w2(9,h3e.bind(null,r,n,o,e),void 0,null),Dl===null)throw Error(Fe(349));(YM&30)!==0||m3e(r,e,o)}return o}function m3e(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=Ta.updateQueue,e===null?(e={lastEffect:null,stores:null},Ta.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function h3e(t,e,r,n){e.value=r,e.getSnapshot=n,y3e(e)&&b3e(t)}function g3e(t,e,r){return r(function(){y3e(e)&&b3e(t)})}function y3e(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!Bg(t,r)}catch{return!0}}function b3e(t){var e=Qx(t,1);e!==null&&$g(e,t,1,-1)}function $2e(t){var e=bb();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:v2,lastRenderedState:t},e.queue=t,t=t.dispatch=rer.bind(null,Ta,t),[e.memoizedState,t]}function w2(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=Ta.updateQueue,e===null?(e={lastEffect:null,stores:null},Ta.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 _3e(){return dh().memoizedState}function DK(t,e,r,n){var o=bb();Ta.flags|=t,o.memoizedState=w2(1|e,r,void 0,n===void 0?null:n)}function gJ(t,e,r,n){var o=dh();n=n===void 0?null:n;var i=void 0;if(dl!==null){var a=dl.memoizedState;if(i=a.destroy,n!==null&&che(n,a.deps)){o.memoizedState=w2(e,r,i,n);return}}Ta.flags|=t,o.memoizedState=w2(1|e,r,i,n)}function B2e(t,e){return DK(8390656,8,t,e)}function phe(t,e){return gJ(2048,8,t,e)}function v3e(t,e){return gJ(4,2,t,e)}function w3e(t,e){return gJ(4,4,t,e)}function S3e(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 x3e(t,e,r){return r=r!=null?r.concat([t]):null,gJ(4,4,S3e.bind(null,e,t),r)}function mhe(){}function C3e(t,e){var r=dh();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&che(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function O3e(t,e){var r=dh();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&che(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function P3e(t,e,r){return(YM&21)===0?(t.baseState&&(t.baseState=!1,np=!0),t.memoizedState=r):(Bg(r,e)||(r=A4e(),Ta.lanes|=r,ZM|=r,t.baseState=!0),e)}function eer(t,e){var r=ui;ui=r!==0&&4>r?r:4,t(!0);var n=kpe.transition;kpe.transition={};try{t(!1),e()}finally{ui=r,kpe.transition=n}}function E3e(){return dh().memoizedState}function ter(t,e,r){var n=pE(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},T3e(t))A3e(e,r);else if(r=i3e(t,e,r,n),r!==null){var o=hf();$g(r,t,n,o),I3e(r,e,n)}}function rer(t,e,r){var n=pE(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(T3e(t))A3e(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,Bg(s,a)){var u=e.interleaved;u===null?(o.next=o,ihe(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=i3e(t,e,o,n),r!==null&&(o=hf(),$g(r,t,n,o),I3e(r,e,n))}}function T3e(t){var e=t.alternate;return t===Ta||e!==null&&e===Ta}function A3e(t,e){r2=rJ=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function I3e(t,e,r){if((r&4194240)!==0){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Vme(t,r)}}var nJ={readContext:ch,useCallback:bd,useContext:bd,useEffect:bd,useImperativeHandle:bd,useInsertionEffect:bd,useLayoutEffect:bd,useMemo:bd,useReducer:bd,useRef:bd,useState:bd,useDebugValue:bd,useDeferredValue:bd,useTransition:bd,useMutableSource:bd,useSyncExternalStore:bd,useId:bd,unstable_isNewReconciler:!1},ner={readContext:ch,useCallback:function(t,e){return bb().memoizedState=[t,e===void 0?null:e],t},useContext:ch,useEffect:B2e,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,DK(4194308,4,S3e.bind(null,e,t),r)},useLayoutEffect:function(t,e){return DK(4194308,4,t,e)},useInsertionEffect:function(t,e){return DK(4,2,t,e)},useMemo:function(t,e){var r=bb();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=bb();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=ter.bind(null,Ta,t),[n.memoizedState,t]},useRef:function(t){var e=bb();return t={current:t},e.memoizedState=t},useState:$2e,useDebugValue:mhe,useDeferredValue:function(t){return bb().memoizedState=t},useTransition:function(){var t=$2e(!1),e=t[0];return t=eer.bind(null,t[1]),bb().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=Ta,o=bb();if(da){if(r===void 0)throw Error(Fe(407));r=r()}else{if(r=e(),Dl===null)throw Error(Fe(349));(YM&30)!==0||m3e(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,B2e(g3e.bind(null,n,i,t),[t]),n.flags|=2048,w2(9,h3e.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=bb(),e=Dl.identifierPrefix;if(da){var r=Gx,n=Jx;r=(n&~(1<<32-kg(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=_2++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=QQt++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},oer={readContext:ch,useCallback:C3e,useContext:ch,useEffect:phe,useImperativeHandle:x3e,useInsertionEffect:v3e,useLayoutEffect:w3e,useMemo:O3e,useReducer:$pe,useRef:_3e,useState:function(){return $pe(v2)},useDebugValue:mhe,useDeferredValue:function(t){var e=dh();return P3e(e,dl.memoizedState,t)},useTransition:function(){var t=$pe(v2)[0],e=dh().memoizedState;return[t,e]},useMutableSource:f3e,useSyncExternalStore:p3e,useId:E3e,unstable_isNewReconciler:!1},ier={readContext:ch,useCallback:C3e,useContext:ch,useEffect:phe,useImperativeHandle:x3e,useInsertionEffect:v3e,useLayoutEffect:w3e,useMemo:O3e,useReducer:Bpe,useRef:_3e,useState:function(){return Bpe(v2)},useDebugValue:mhe,useDeferredValue:function(t){var e=dh();return dl===null?e.memoizedState=t:P3e(e,dl.memoizedState,t)},useTransition:function(){var t=Bpe(v2)[0],e=dh().memoizedState;return[t,e]},useMutableSource:f3e,useSyncExternalStore:p3e,useId:E3e,unstable_isNewReconciler:!1};function RL(t,e){try{var r="",n=e;do r+=NXt(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 qpe(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function xme(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var aer=typeof WeakMap=="function"?WeakMap:Map;function M3e(t,e,r){r=Yx(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){iJ||(iJ=!0,jme=n),xme(t,e)},r}function R3e(t,e,r){r=Yx(-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(){xme(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){xme(t,e),typeof n!="function"&&(fE===null?fE=new Set([this]):fE.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function q2e(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new aer;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=ver.bind(null,t,e,r),e.then(t,t))}function U2e(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 z2e(t,e,r,n,o){return(t.mode&1)===0?(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=Yx(-1,1),e.tag=2,dE(r,e,1))),r.lanes|=1),t):(t.flags|=65536,t.lanes=o,t)}var ser=tC.ReactCurrentOwner,np=!1;function mf(t,e,r,n){e.child=t===null?c3e(e,null,r,n):IL(e,t.child,r,n)}function H2e(t,e,r,n,o){r=r.render;var i=e.ref;return OL(e,o),n=dhe(t,e,r,n,i,o),r=fhe(),t!==null&&!np?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,eC(t,e,o)):(da&&r&&Qme(e),e.flags|=1,mf(t,e,n,o),e.child)}function V2e(t,e,r,n,o){if(t===null){var i=r.type;return typeof i=="function"&&!She(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,j3e(t,e,i,n,o)):(t=kK(r.type,null,n,e,e.mode,o),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,(t.lanes&o)===0){var a=i.memoizedProps;if(r=r.compare,r=r!==null?r:p2,r(a,n)&&t.ref===e.ref)return eC(t,e,o)}return e.flags|=1,t=mE(i,n),t.ref=e.ref,t.return=e,e.child=t}function j3e(t,e,r,n,o){if(t!==null){var i=t.memoizedProps;if(p2(i,n)&&t.ref===e.ref)if(np=!1,e.pendingProps=n=i,(t.lanes&o)!==0)(t.flags&131072)!==0&&(np=!0);else return e.lanes=t.lanes,eC(t,e,o)}return Cme(t,e,r,n,o)}function D3e(t,e,r){var n=e.pendingProps,o=n.children,i=t!==null?t.memoizedState:null;if(n.mode==="hidden")if((e.mode&1)===0)e.memoizedState={baseLanes:0,cachePool:null,transitions:null},ji(vL,Yp),Yp|=r;else{if((r&1073741824)===0)return t=i!==null?i.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,ji(vL,Yp),Yp|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,ji(vL,Yp),Yp|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,ji(vL,Yp),Yp|=n;return mf(t,e,o,r),e.child}function N3e(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function Cme(t,e,r,n,o){var i=ip(r)?JM:wd.current;return i=TL(e,i),OL(e,o),r=dhe(t,e,r,n,i,o),n=fhe(),t!==null&&!np?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,eC(t,e,o)):(da&&n&&Qme(e),e.flags|=1,mf(t,e,r,o),e.child)}function W2e(t,e,r,n,o){if(ip(r)){var i=!0;GK(e)}else i=!1;if(OL(e,o),e.stateNode===null)NK(t,e),u3e(e,r,n),Sme(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=ch(l):(l=ip(r)?JM:wd.current,l=TL(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)&&F2e(e,a,n,l),rE=!1;var f=e.memoizedState;a.state=f,eJ(e,n,a,o),u=e.memoizedState,s!==n||f!==u||op.current||rE?(typeof c=="function"&&(wme(e,r,c,n),u=e.memoizedState),(s=rE||L2e(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,a3e(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=ch(u):(u=ip(r)?JM:wd.current,u=TL(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)&&F2e(e,a,n,u),rE=!1,f=e.memoizedState,a.state=f,eJ(e,n,a,o);var m=e.memoizedState;s!==d||f!==m||op.current||rE?(typeof p=="function"&&(wme(e,r,p,n),m=e.memoizedState),(l=rE||L2e(e,r,l,n,f,m,u)||!1)?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,m,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,m,u)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=m),a.props=n,a.state=m,a.context=u,n=l):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),n=!1)}return Ome(t,e,r,n,i,o)}function Ome(t,e,r,n,o,i){N3e(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return o&&M2e(e,r,!1),eC(t,e,i);n=e.stateNode,ser.current=e;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=IL(e,t.child,null,i),e.child=IL(e,null,s,i)):mf(t,e,s,i),e.memoizedState=n.state,o&&M2e(e,r,!0),e.child}function L3e(t){var e=t.stateNode;e.pendingContext?I2e(t,e.pendingContext,e.pendingContext!==e.context):e.context&&I2e(t,e.context,!1),she(t,e.containerInfo)}function K2e(t,e,r,n,o){return AL(),the(o),e.flags|=256,mf(t,e,r,n),e.child}var Pme={dehydrated:null,treeContext:null,retryLane:0};function Eme(t){return{baseLanes:t,cachePool:null,transitions:null}}function F3e(t,e,r){var n=e.pendingProps,o=Ea.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),ji(Ea,o&1),t===null)return _me(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((e.mode&1)===0?e.lanes=1:t.data==="$!"?e.lanes=8:e.lanes=1073741824,null):(a=n.children,t=n.fallback,i?(n=e.mode,i=e.child,a={mode:"hidden",children:a},(n&1)===0&&i!==null?(i.childLanes=0,i.pendingProps=a):i=_J(a,n,0,null),t=KM(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=Eme(r),e.memoizedState=Pme,t):hhe(e,a));if(o=t.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return uer(t,e,a,n,s,o,r);if(i){i=n.fallback,a=e.mode,o=t.child,s=o.sibling;var u={mode:"hidden",children:n.children};return(a&1)===0&&e.child!==o?(n=e.child,n.childLanes=0,n.pendingProps=u,e.deletions=null):(n=mE(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=mE(s,i):(i=KM(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?Eme(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~r,e.memoizedState=Pme,n}return i=t.child,t=i.sibling,n=mE(i,{mode:"visible",children:n.children}),(e.mode&1)===0&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function hhe(t,e){return e=_J({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function PK(t,e,r,n){return n!==null&&the(n),IL(e,t.child,null,r),t=hhe(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function uer(t,e,r,n,o,i,a){if(r)return e.flags&256?(e.flags&=-257,n=qpe(Error(Fe(422))),PK(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,o=e.mode,n=_J({mode:"visible",children:n.children},o,0,null),i=KM(i,o,a,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,(e.mode&1)!==0&&IL(e,t.child,null,a),e.child.memoizedState=Eme(a),e.memoizedState=Pme,i);if((e.mode&1)===0)return PK(t,e,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(Fe(419)),n=qpe(i,n,void 0),PK(t,e,a,n)}if(s=(a&t.childLanes)!==0,np||s){if(n=Dl,n!==null){switch(a&-a){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=(o&(n.suspendedLanes|a))!==0?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Qx(t,o),$g(n,t,o,-1))}return whe(),n=qpe(Error(Fe(421))),PK(t,e,a,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=wer.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,Zp=cE(o.nextSibling),Xp=e,da=!0,Fg=null,t!==null&&(ah[sh++]=Jx,ah[sh++]=Gx,ah[sh++]=GM,Jx=t.id,Gx=t.overflow,GM=e),e=hhe(e,n.children),e.flags|=4096,e)}function J2e(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),vme(t.return,e,r)}function Upe(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 k3e(t,e,r){var n=e.pendingProps,o=n.revealOrder,i=n.tail;if(mf(t,e,n.children,r),n=Ea.current,(n&2)!==0)n=n&1|2,e.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&J2e(t,r,e);else if(t.tag===19)J2e(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(ji(Ea,n),(e.mode&1)===0)e.memoizedState=null;else switch(o){case"forwards":for(r=e.child,o=null;r!==null;)t=r.alternate,t!==null&&tJ(t)===null&&(o=r),r=r.sibling;r=o,r===null?(o=e.child,e.child=null):(o=r.sibling,r.sibling=null),Upe(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&&tJ(t)===null){e.child=o;break}t=o.sibling,o.sibling=r,r=o,o=t}Upe(e,!0,r,null,i);break;case"together":Upe(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function NK(t,e){(e.mode&1)===0&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function eC(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),ZM|=e.lanes,(r&e.childLanes)===0)return null;if(t!==null&&e.child!==t.child)throw Error(Fe(153));if(e.child!==null){for(t=e.child,r=mE(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=mE(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function ler(t,e,r){switch(e.tag){case 3:L3e(e),AL();break;case 5:d3e(e);break;case 1:ip(e.type)&&GK(e);break;case 4:she(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;ji(XK,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(ji(Ea,Ea.current&1),e.flags|=128,null):(r&e.child.childLanes)!==0?F3e(t,e,r):(ji(Ea,Ea.current&1),t=eC(t,e,r),t!==null?t.sibling:null);ji(Ea,Ea.current&1);break;case 19:if(n=(r&e.childLanes)!==0,(t.flags&128)!==0){if(n)return k3e(t,e,r);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),ji(Ea,Ea.current),n)break;return null;case 22:case 23:return e.lanes=0,D3e(t,e,r)}return eC(t,e,r)}var $3e,Tme,B3e,q3e;$3e=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}};Tme=function(){};B3e=function(t,e,r,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,VM(wb.current);var i=null;switch(r){case"input":o=Ype(t,o),n=Ype(t,n),i=[];break;case"select":o=Aa({},o,{value:void 0}),n=Aa({},n,{value:void 0}),i=[];break;case"textarea":o=Qpe(t,o),n=Qpe(t,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=KK)}tme(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"&&(a2.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"&&(a2.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)}};q3e=function(t,e,r,n){r!==n&&(e.flags|=4)};function Hz(t,e){if(!da)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 _d(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 cer(t,e,r){var n=e.pendingProps;switch(ehe(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _d(e),null;case 1:return ip(e.type)&&JK(),_d(e),null;case 3:return n=e.stateNode,ML(),Wi(op),Wi(wd),lhe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(CK(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,Fg!==null&&(Lme(Fg),Fg=null))),Tme(t,e),_d(e),null;case 5:uhe(e);var o=VM(b2.current);if(r=e.type,t!==null&&e.stateNode!=null)B3e(t,e,r,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(Fe(166));return _d(e),null}if(t=VM(wb.current),CK(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[_b]=e,n[g2]=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<Yz.length;o++)Vi(Yz[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":r2e(n,i),Vi("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},Vi("invalid",n);break;case"textarea":o2e(n,i),Vi("invalid",n)}tme(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&&xK(n.textContent,s,t),o=["children",s]):typeof s=="number"&&n.textContent!==""+s&&(i.suppressHydrationWarning!==!0&&xK(n.textContent,s,t),o=["children",""+s]):a2.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&Vi("scroll",n)}switch(r){case"input":dK(n),n2e(n,i,!0);break;case"textarea":dK(n),i2e(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=KK)}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=m4e(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[_b]=e,t[g2]=n,$3e(t,e,!1,!1),e.stateNode=t;e:{switch(a=rme(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<Yz.length;o++)Vi(Yz[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":r2e(t,n),o=Ype(t,n),Vi("invalid",t);break;case"option":o=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=Aa({},n,{value:void 0}),Vi("invalid",t);break;case"textarea":o2e(t,n),o=Qpe(t,n),Vi("invalid",t);break;default:o=n}tme(r,o),s=o;for(i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="style"?y4e(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&h4e(t,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&s2(t,u):typeof u=="number"&&s2(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(a2.hasOwnProperty(i)?u!=null&&i==="onScroll"&&Vi("scroll",t):u!=null&&$me(t,i,u,a))}switch(r){case"input":dK(t),n2e(t,n,!1);break;case"textarea":dK(t),i2e(t);break;case"option":n.value!=null&&t.setAttribute("value",""+hE(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?wL(t,!!n.multiple,i,!1):n.defaultValue!=null&&wL(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=KK)}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 _d(e),null;case 6:if(t&&e.stateNode!=null)q3e(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(Fe(166));if(r=VM(b2.current),VM(wb.current),CK(e)){if(n=e.stateNode,r=e.memoizedProps,n[_b]=e,(i=n.nodeValue!==r)&&(t=Xp,t!==null))switch(t.tag){case 3:xK(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&xK(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[_b]=e,e.stateNode=n}return _d(e),null;case 13:if(Wi(Ea),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(da&&Zp!==null&&(e.mode&1)!==0&&(e.flags&128)===0)o3e(),AL(),e.flags|=98560,i=!1;else if(i=CK(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(Fe(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Fe(317));i[_b]=e}else AL(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;_d(e),i=!1}else Fg!==null&&(Lme(Fg),Fg=null),i=!0;if(!i)return e.flags&65536?e:null}return(e.flags&128)!==0?(e.lanes=r,e):(n=n!==null,n!==(t!==null&&t.memoizedState!==null)&&n&&(e.child.flags|=8192,(e.mode&1)!==0&&(t===null||(Ea.current&1)!==0?fl===0&&(fl=3):whe())),e.updateQueue!==null&&(e.flags|=4),_d(e),null);case 4:return ML(),Tme(t,e),t===null&&m2(e.stateNode.containerInfo),_d(e),null;case 10:return ohe(e.type._context),_d(e),null;case 17:return ip(e.type)&&JK(),_d(e),null;case 19:if(Wi(Ea),i=e.memoizedState,i===null)return _d(e),null;if(n=(e.flags&128)!==0,a=i.rendering,a===null)if(n)Hz(i,!1);else{if(fl!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(a=tJ(t),a!==null){for(e.flags|=128,Hz(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 ji(Ea,Ea.current&1|2),e.child}t=t.sibling}i.tail!==null&&gs()>jL&&(e.flags|=128,n=!0,Hz(i,!1),e.lanes=4194304)}else{if(!n)if(t=tJ(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),Hz(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!da)return _d(e),null}else 2*gs()-i.renderingStartTime>jL&&r!==1073741824&&(e.flags|=128,n=!0,Hz(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=gs(),e.sibling=null,r=Ea.current,ji(Ea,n?r&1|2:r&1),e):(_d(e),null);case 22:case 23:return vhe(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&(e.mode&1)!==0?(Yp&1073741824)!==0&&(_d(e),e.subtreeFlags&6&&(e.flags|=8192)):_d(e),null;case 24:return null;case 25:return null}throw Error(Fe(156,e.tag))}function der(t,e){switch(ehe(e),e.tag){case 1:return ip(e.type)&&JK(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ML(),Wi(op),Wi(wd),lhe(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return uhe(e),null;case 13:if(Wi(Ea),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Fe(340));AL()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Wi(Ea),null;case 4:return ML(),null;case 10:return ohe(e.type._context),null;case 22:case 23:return vhe(),null;case 24:return null;default:return null}}var EK=!1,vd=!1,fer=typeof WeakSet=="function"?WeakSet:Set,gt=null;function _L(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){es(t,e,n)}else r.current=null}function Ame(t,e,r){try{r()}catch(n){es(t,e,n)}}var G2e=!1;function per(t,e){if(fme=HK,t=V4e(),Xme(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(pme={focusedElem:t,selectionRange:r},HK=!1,gt=e;gt!==null;)if(e=gt,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,gt=t;else for(;gt!==null;){e=gt;try{var m=e.alternate;if((e.flags&1024)!==0)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var h=m.memoizedProps,b=m.memoizedState,g=e.stateNode,_=g.getSnapshotBeforeUpdate(e.elementType===e.type?h:Ng(e.type,h),b);g.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Fe(163))}}catch(x){es(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,gt=t;break}gt=e.return}return m=G2e,G2e=!1,m}function n2(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&&Ame(e,r,i)}o=o.next}while(o!==n)}}function yJ(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 Ime(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 U3e(t){var e=t.alternate;e!==null&&(t.alternate=null,U3e(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[_b],delete e[g2],delete e[gme],delete e[GQt],delete e[YQt])),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 z3e(t){return t.tag===5||t.tag===3||t.tag===4}function Y2e(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||z3e(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 Mme(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=KK));else if(n!==4&&(t=t.child,t!==null))for(Mme(t,e,r),t=t.sibling;t!==null;)Mme(t,e,r),t=t.sibling}function Rme(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(Rme(t,e,r),t=t.sibling;t!==null;)Rme(t,e,r),t=t.sibling}var gc=null,Lg=!1;function eE(t,e,r){for(r=r.child;r!==null;)H3e(t,e,r),r=r.sibling}function H3e(t,e,r){if(vb&&typeof vb.onCommitFiberUnmount=="function")try{vb.onCommitFiberUnmount(lJ,r)}catch{}switch(r.tag){case 5:vd||_L(r,e);case 6:var n=gc,o=Lg;gc=null,eE(t,e,r),gc=n,Lg=o,gc!==null&&(Lg?(t=gc,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):gc.removeChild(r.stateNode));break;case 18:gc!==null&&(Lg?(t=gc,r=r.stateNode,t.nodeType===8?Npe(t.parentNode,r):t.nodeType===1&&Npe(t,r),d2(t)):Npe(gc,r.stateNode));break;case 4:n=gc,o=Lg,gc=r.stateNode.containerInfo,Lg=!0,eE(t,e,r),gc=n,Lg=o;break;case 0:case 11:case 14:case 15:if(!vd&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){o=n=n.next;do{var i=o,a=i.destroy;i=i.tag,a!==void 0&&((i&2)!==0||(i&4)!==0)&&Ame(r,e,a),o=o.next}while(o!==n)}eE(t,e,r);break;case 1:if(!vd&&(_L(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){es(r,e,s)}eE(t,e,r);break;case 21:eE(t,e,r);break;case 22:r.mode&1?(vd=(n=vd)||r.memoizedState!==null,eE(t,e,r),vd=n):eE(t,e,r);break;default:eE(t,e,r)}}function Z2e(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new fer),e.forEach(function(n){var o=Ser.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function Dg(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:gc=s.stateNode,Lg=!1;break e;case 3:gc=s.stateNode.containerInfo,Lg=!0;break e;case 4:gc=s.stateNode.containerInfo,Lg=!0;break e}s=s.return}if(gc===null)throw Error(Fe(160));H3e(i,a,o),gc=null,Lg=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){es(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)V3e(e,t),e=e.sibling}function V3e(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Dg(e,t),yb(t),n&4){try{n2(3,t,t.return),yJ(3,t)}catch(h){es(t,t.return,h)}try{n2(5,t,t.return)}catch(h){es(t,t.return,h)}}break;case 1:Dg(e,t),yb(t),n&512&&r!==null&&_L(r,r.return);break;case 5:if(Dg(e,t),yb(t),n&512&&r!==null&&_L(r,r.return),t.flags&32){var o=t.stateNode;try{s2(o,"")}catch(h){es(t,t.return,h)}}if(n&4&&(o=t.stateNode,o!=null)){var i=t.memoizedProps,a=r!==null?r.memoizedProps:i,s=t.type,u=t.updateQueue;if(t.updateQueue=null,u!==null)try{s==="input"&&i.type==="radio"&&i.name!=null&&f4e(o,i),rme(s,a);var l=rme(s,i);for(a=0;a<u.length;a+=2){var c=u[a],d=u[a+1];c==="style"?y4e(o,d):c==="dangerouslySetInnerHTML"?h4e(o,d):c==="children"?s2(o,d):$me(o,c,d,l)}switch(s){case"input":Zpe(o,i);break;case"textarea":p4e(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?wL(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?wL(o,!!i.multiple,i.defaultValue,!0):wL(o,!!i.multiple,i.multiple?[]:"",!1))}o[g2]=i}catch(h){es(t,t.return,h)}}break;case 6:if(Dg(e,t),yb(t),n&4){if(t.stateNode===null)throw Error(Fe(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(h){es(t,t.return,h)}}break;case 3:if(Dg(e,t),yb(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{d2(e.containerInfo)}catch(h){es(t,t.return,h)}break;case 4:Dg(e,t),yb(t);break;case 13:Dg(e,t),yb(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(bhe=gs())),n&4&&Z2e(t);break;case 22:if(c=r!==null&&r.memoizedState!==null,t.mode&1?(vd=(l=vd)||c,Dg(e,t),vd=l):Dg(e,t),yb(t),n&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&(t.mode&1)!==0)for(gt=t,c=t.child;c!==null;){for(d=gt=c;gt!==null;){switch(f=gt,p=f.child,f.tag){case 0:case 11:case 14:case 15:n2(4,f,f.return);break;case 1:_L(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){n=f,r=f.return;try{e=n,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(h){es(n,r,h)}}break;case 5:_L(f,f.return);break;case 22:if(f.memoizedState!==null){Q2e(d);continue}}p!==null?(p.return=f,gt=p):Q2e(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=g4e("display",a))}catch(h){es(t,t.return,h)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(h){es(t,t.return,h)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Dg(e,t),yb(t),n&4&&Z2e(t);break;case 21:break;default:Dg(e,t),yb(t)}}function yb(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(z3e(r)){var n=r;break e}r=r.return}throw Error(Fe(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(s2(o,""),n.flags&=-33);var i=Y2e(t);Rme(t,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,s=Y2e(t);Mme(t,s,a);break;default:throw Error(Fe(161))}}catch(u){es(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function mer(t,e,r){gt=t,W3e(t,e,r)}function W3e(t,e,r){for(var n=(t.mode&1)!==0;gt!==null;){var o=gt,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||EK;if(!a){var s=o.alternate,u=s!==null&&s.memoizedState!==null||vd;s=EK;var l=vd;if(EK=a,(vd=u)&&!l)for(gt=o;gt!==null;)a=gt,u=a.child,a.tag===22&&a.memoizedState!==null?e4e(o):u!==null?(u.return=a,gt=u):e4e(o);for(;i!==null;)gt=i,W3e(i,e,r),i=i.sibling;gt=o,EK=s,vd=l}X2e(t,e,r)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,gt=i):X2e(t,e,r)}}function X2e(t){for(;gt!==null;){var e=gt;if((e.flags&8772)!==0){var r=e.alternate;try{if((e.flags&8772)!==0)switch(e.tag){case 0:case 11:case 15:vd||yJ(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!vd)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&&N2e(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}N2e(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&&d2(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Fe(163))}vd||e.flags&512&&Ime(e)}catch(f){es(e,e.return,f)}}if(e===t){gt=null;break}if(r=e.sibling,r!==null){r.return=e.return,gt=r;break}gt=e.return}}function Q2e(t){for(;gt!==null;){var e=gt;if(e===t){gt=null;break}var r=e.sibling;if(r!==null){r.return=e.return,gt=r;break}gt=e.return}}function e4e(t){for(;gt!==null;){var e=gt;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{yJ(4,e)}catch(u){es(e,r,u)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var o=e.return;try{n.componentDidMount()}catch(u){es(e,o,u)}}var i=e.return;try{Ime(e)}catch(u){es(e,i,u)}break;case 5:var a=e.return;try{Ime(e)}catch(u){es(e,a,u)}}}catch(u){es(e,e.return,u)}if(e===t){gt=null;break}var s=e.sibling;if(s!==null){s.return=e.return,gt=s;break}gt=e.return}}var her=Math.ceil,oJ=tC.ReactCurrentDispatcher,ghe=tC.ReactCurrentOwner,lh=tC.ReactCurrentBatchConfig,uo=0,Dl=null,Is=null,yc=0,Yp=0,vL=bE(0),fl=0,S2=null,ZM=0,bJ=0,yhe=0,o2=null,rp=null,bhe=0,jL=1/0,Wx=null,iJ=!1,jme=null,fE=null,TK=!1,aE=null,aJ=0,i2=0,Dme=null,LK=-1,FK=0;function hf(){return(uo&6)!==0?gs():LK!==-1?LK:LK=gs()}function pE(t){return(t.mode&1)===0?1:(uo&2)!==0&&yc!==0?yc&-yc:XQt.transition!==null?(FK===0&&(FK=A4e()),FK):(t=ui,t!==0||(t=window.event,t=t===void 0?16:L4e(t.type)),t)}function $g(t,e,r,n){if(50<i2)throw i2=0,Dme=null,Error(Fe(185));x2(t,r,n),((uo&2)===0||t!==Dl)&&(t===Dl&&((uo&2)===0&&(bJ|=r),fl===4&&oE(t,yc)),ap(t,n),r===1&&uo===0&&(e.mode&1)===0&&(jL=gs()+500,mJ&&_E()))}function ap(t,e){var r=t.callbackNode;eQt(t,e);var n=zK(t,t===Dl?yc:0);if(n===0)r!==null&&u2e(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&u2e(r),e===1)t.tag===0?ZQt(t4e.bind(null,t)):t3e(t4e.bind(null,t)),KQt(function(){(uo&6)===0&&_E()}),r=null;else{switch(I4e(n)){case 1:r=Hme;break;case 4:r=E4e;break;case 16:r=UK;break;case 536870912:r=T4e;break;default:r=UK}r=eHe(r,K3e.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function K3e(t,e){if(LK=-1,FK=0,(uo&6)!==0)throw Error(Fe(327));var r=t.callbackNode;if(PL()&&t.callbackNode!==r)return null;var n=zK(t,t===Dl?yc:0);if(n===0)return null;if((n&30)!==0||(n&t.expiredLanes)!==0||e)e=sJ(t,n);else{e=n;var o=uo;uo|=2;var i=G3e();(Dl!==t||yc!==e)&&(Wx=null,jL=gs()+500,WM(t,e));do try{ber();break}catch(s){J3e(t,s)}while(!0);nhe(),oJ.current=i,uo=o,Is!==null?e=0:(Dl=null,yc=0,e=fl)}if(e!==0){if(e===2&&(o=sme(t),o!==0&&(n=o,e=Nme(t,o))),e===1)throw r=S2,WM(t,0),oE(t,n),ap(t,gs()),r;if(e===6)oE(t,n);else{if(o=t.current.alternate,(n&30)===0&&!ger(o)&&(e=sJ(t,n),e===2&&(i=sme(t),i!==0&&(n=i,e=Nme(t,i))),e===1))throw r=S2,WM(t,0),oE(t,n),ap(t,gs()),r;switch(t.finishedWork=o,t.finishedLanes=n,e){case 0:case 1:throw Error(Fe(345));case 2:UM(t,rp,Wx);break;case 3:if(oE(t,n),(n&130023424)===n&&(e=bhe+500-gs(),10<e)){if(zK(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){hf(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=hme(UM.bind(null,t,rp,Wx),e);break}UM(t,rp,Wx);break;case 4:if(oE(t,n),(n&4194240)===n)break;for(e=t.eventTimes,o=-1;0<n;){var a=31-kg(n);i=1<<a,a=e[a],a>o&&(o=a),n&=~i}if(n=o,n=gs()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*her(n/1960))-n,10<n){t.timeoutHandle=hme(UM.bind(null,t,rp,Wx),n);break}UM(t,rp,Wx);break;case 5:UM(t,rp,Wx);break;default:throw Error(Fe(329))}}}return ap(t,gs()),t.callbackNode===r?K3e.bind(null,t):null}function Nme(t,e){var r=o2;return t.current.memoizedState.isDehydrated&&(WM(t,e).flags|=256),t=sJ(t,e),t!==2&&(e=rp,rp=r,e!==null&&Lme(e)),t}function Lme(t){rp===null?rp=t:rp.push.apply(rp,t)}function ger(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(!Bg(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 oE(t,e){for(e&=~yhe,e&=~bJ,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-kg(e),n=1<<r;t[r]=-1,e&=~n}}function t4e(t){if((uo&6)!==0)throw Error(Fe(327));PL();var e=zK(t,0);if((e&1)===0)return ap(t,gs()),null;var r=sJ(t,e);if(t.tag!==0&&r===2){var n=sme(t);n!==0&&(e=n,r=Nme(t,n))}if(r===1)throw r=S2,WM(t,0),oE(t,e),ap(t,gs()),r;if(r===6)throw Error(Fe(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,UM(t,rp,Wx),ap(t,gs()),null}function _he(t,e){var r=uo;uo|=1;try{return t(e)}finally{uo=r,uo===0&&(jL=gs()+500,mJ&&_E())}}function XM(t){aE!==null&&aE.tag===0&&(uo&6)===0&&PL();var e=uo;uo|=1;var r=lh.transition,n=ui;try{if(lh.transition=null,ui=1,t)return t()}finally{ui=n,lh.transition=r,uo=e,(uo&6)===0&&_E()}}function vhe(){Yp=vL.current,Wi(vL)}function WM(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,WQt(r)),Is!==null)for(r=Is.return;r!==null;){var n=r;switch(ehe(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&JK();break;case 3:ML(),Wi(op),Wi(wd),lhe();break;case 5:uhe(n);break;case 4:ML();break;case 13:Wi(Ea);break;case 19:Wi(Ea);break;case 10:ohe(n.type._context);break;case 22:case 23:vhe()}r=r.return}if(Dl=t,Is=t=mE(t.current,null),yc=Yp=e,fl=0,S2=null,yhe=bJ=ZM=0,rp=o2=null,HM!==null){for(e=0;e<HM.length;e++)if(r=HM[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}HM=null}return t}function J3e(t,e){do{var r=Is;try{if(nhe(),jK.current=nJ,rJ){for(var n=Ta.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}rJ=!1}if(YM=0,jl=dl=Ta=null,r2=!1,_2=0,ghe.current=null,r===null||r.return===null){fl=1,S2=e,Is=null;break}e:{var i=t,a=r.return,s=r,u=e;if(e=yc,s.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var l=u,c=s,d=c.tag;if((c.mode&1)===0&&(d===0||d===11||d===15)){var f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var p=U2e(a);if(p!==null){p.flags&=-257,z2e(p,a,s,i,e),p.mode&1&&q2e(i,l,e),e=p,u=l;var m=e.updateQueue;if(m===null){var h=new Set;h.add(u),e.updateQueue=h}else m.add(u);break e}else{if((e&1)===0){q2e(i,l,e),whe();break e}u=Error(Fe(426))}}else if(da&&s.mode&1){var b=U2e(a);if(b!==null){(b.flags&65536)===0&&(b.flags|=256),z2e(b,a,s,i,e),the(RL(u,s));break e}}i=u=RL(u,s),fl!==4&&(fl=2),o2===null?o2=[i]:o2.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var g=M3e(i,u,e);D2e(i,g);break e;case 1:s=u;var _=i.type,w=i.stateNode;if((i.flags&128)===0&&(typeof _.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(fE===null||!fE.has(w)))){i.flags|=65536,e&=-e,i.lanes|=e;var x=R3e(i,s,e);D2e(i,x);break e}}i=i.return}while(i!==null)}Z3e(r)}catch(C){e=C,Is===r&&r!==null&&(Is=r=r.return);continue}break}while(!0)}function G3e(){var t=oJ.current;return oJ.current=nJ,t===null?nJ:t}function whe(){(fl===0||fl===3||fl===2)&&(fl=4),Dl===null||(ZM&268435455)===0&&(bJ&268435455)===0||oE(Dl,yc)}function sJ(t,e){var r=uo;uo|=2;var n=G3e();(Dl!==t||yc!==e)&&(Wx=null,WM(t,e));do try{yer();break}catch(o){J3e(t,o)}while(!0);if(nhe(),uo=r,oJ.current=n,Is!==null)throw Error(Fe(261));return Dl=null,yc=0,fl}function yer(){for(;Is!==null;)Y3e(Is)}function ber(){for(;Is!==null&&!VXt();)Y3e(Is)}function Y3e(t){var e=Q3e(t.alternate,t,Yp);t.memoizedProps=t.pendingProps,e===null?Z3e(t):Is=e,ghe.current=null}function Z3e(t){var e=t;do{var r=e.alternate;if(t=e.return,(e.flags&32768)===0){if(r=cer(r,e,Yp),r!==null){Is=r;return}}else{if(r=der(r,e),r!==null){r.flags&=32767,Is=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{fl=6,Is=null;return}}if(e=e.sibling,e!==null){Is=e;return}Is=e=t}while(e!==null);fl===0&&(fl=5)}function UM(t,e,r){var n=ui,o=lh.transition;try{lh.transition=null,ui=1,_er(t,e,r,n)}finally{lh.transition=o,ui=n}return null}function _er(t,e,r,n){do PL();while(aE!==null);if((uo&6)!==0)throw Error(Fe(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(Fe(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(tQt(t,i),t===Dl&&(Is=Dl=null,yc=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||TK||(TK=!0,eHe(UK,function(){return PL(),null})),i=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||i){i=lh.transition,lh.transition=null;var a=ui;ui=1;var s=uo;uo|=4,ghe.current=null,per(t,r),V3e(r,t),qQt(pme),HK=!!fme,pme=fme=null,t.current=r,mer(r,t,o),WXt(),uo=s,ui=a,lh.transition=i}else t.current=r;if(TK&&(TK=!1,aE=t,aJ=o),i=t.pendingLanes,i===0&&(fE=null),GXt(r.stateNode,n),ap(t,gs()),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(iJ)throw iJ=!1,t=jme,jme=null,t;return(aJ&1)!==0&&t.tag!==0&&PL(),i=t.pendingLanes,(i&1)!==0?t===Dme?i2++:(i2=0,Dme=t):i2=0,_E(),null}function PL(){if(aE!==null){var t=I4e(aJ),e=lh.transition,r=ui;try{if(lh.transition=null,ui=16>t?16:t,aE===null)var n=!1;else{if(t=aE,aE=null,aJ=0,(uo&6)!==0)throw Error(Fe(331));var o=uo;for(uo|=4,gt=t.current;gt!==null;){var i=gt,a=i.child;if((gt.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;u<s.length;u++){var l=s[u];for(gt=l;gt!==null;){var c=gt;switch(c.tag){case 0:case 11:case 15:n2(8,c,i)}var d=c.child;if(d!==null)d.return=c,gt=d;else for(;gt!==null;){c=gt;var f=c.sibling,p=c.return;if(U3e(c),c===l){gt=null;break}if(f!==null){f.return=p,gt=f;break}gt=p}}}var m=i.alternate;if(m!==null){var h=m.child;if(h!==null){m.child=null;do{var b=h.sibling;h.sibling=null,h=b}while(h!==null)}}gt=i}}if((i.subtreeFlags&2064)!==0&&a!==null)a.return=i,gt=a;else e:for(;gt!==null;){if(i=gt,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:n2(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,gt=g;break e}gt=i.return}}var _=t.current;for(gt=_;gt!==null;){a=gt;var w=a.child;if((a.subtreeFlags&2064)!==0&&w!==null)w.return=a,gt=w;else e:for(a=_;gt!==null;){if(s=gt,(s.flags&2048)!==0)try{switch(s.tag){case 0:case 11:case 15:yJ(9,s)}}catch(C){es(s,s.return,C)}if(s===a){gt=null;break e}var x=s.sibling;if(x!==null){x.return=s.return,gt=x;break e}gt=s.return}}if(uo=o,_E(),vb&&typeof vb.onPostCommitFiberRoot=="function")try{vb.onPostCommitFiberRoot(lJ,t)}catch{}n=!0}return n}finally{ui=r,lh.transition=e}}return!1}function r4e(t,e,r){e=RL(r,e),e=M3e(t,e,1),t=dE(t,e,1),e=hf(),t!==null&&(x2(t,1,e),ap(t,e))}function es(t,e,r){if(t.tag===3)r4e(t,t,r);else for(;e!==null;){if(e.tag===3){r4e(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(fE===null||!fE.has(n))){t=RL(r,t),t=R3e(e,t,1),e=dE(e,t,1),t=hf(),e!==null&&(x2(e,1,t),ap(e,t));break}}e=e.return}}function ver(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=hf(),t.pingedLanes|=t.suspendedLanes&r,Dl===t&&(yc&r)===r&&(fl===4||fl===3&&(yc&130023424)===yc&&500>gs()-bhe?WM(t,0):yhe|=r),ap(t,e)}function X3e(t,e){e===0&&((t.mode&1)===0?e=1:(e=mK,mK<<=1,(mK&130023424)===0&&(mK=4194304)));var r=hf();t=Qx(t,e),t!==null&&(x2(t,e,r),ap(t,r))}function wer(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),X3e(t,r)}function Ser(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(Fe(314))}n!==null&&n.delete(e),X3e(t,r)}var Q3e;Q3e=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||op.current)np=!0;else{if((t.lanes&r)===0&&(e.flags&128)===0)return np=!1,ler(t,e,r);np=(t.flags&131072)!==0}else np=!1,da&&(e.flags&1048576)!==0&&r3e(e,ZK,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;NK(t,e),t=e.pendingProps;var o=TL(e,wd.current);OL(e,r),o=dhe(null,e,n,t,o,r);var i=fhe();return e.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,ip(n)?(i=!0,GK(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,ahe(e),o.updater=hJ,e.stateNode=o,o._reactInternals=e,Sme(e,n,t,r),e=Ome(null,e,n,!0,i,r)):(e.tag=0,da&&i&&Qme(e),mf(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(NK(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=Cer(n),t=Ng(n,t),o){case 0:e=Cme(null,e,n,t,r);break e;case 1:e=W2e(null,e,n,t,r);break e;case 11:e=H2e(null,e,n,t,r);break e;case 14:e=V2e(null,e,n,Ng(n.type,t),r);break e}throw Error(Fe(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:Ng(n,o),Cme(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:Ng(n,o),W2e(t,e,n,o,r);case 3:e:{if(L3e(e),t===null)throw Error(Fe(387));n=e.pendingProps,i=e.memoizedState,o=i.element,a3e(t,e),eJ(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=RL(Error(Fe(423)),e),e=K2e(t,e,n,r,o);break e}else if(n!==o){o=RL(Error(Fe(424)),e),e=K2e(t,e,n,r,o);break e}else for(Zp=cE(e.stateNode.containerInfo.firstChild),Xp=e,da=!0,Fg=null,r=c3e(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(AL(),n===o){e=eC(t,e,r);break e}mf(t,e,n,r)}e=e.child}return e;case 5:return d3e(e),t===null&&_me(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,mme(n,o)?a=null:i!==null&&mme(n,i)&&(e.flags|=32),N3e(t,e),mf(t,e,a,r),e.child;case 6:return t===null&&_me(e),null;case 13:return F3e(t,e,r);case 4:return she(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=IL(e,null,n,r):mf(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:Ng(n,o),H2e(t,e,n,o,r);case 7:return mf(t,e,e.pendingProps,r),e.child;case 8:return mf(t,e,e.pendingProps.children,r),e.child;case 12:return mf(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,ji(XK,n._currentValue),n._currentValue=a,i!==null)if(Bg(i.value,a)){if(i.children===o.children&&!op.current){e=eC(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=Yx(-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),vme(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(Fe(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),vme(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}mf(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,OL(e,r),o=ch(o),n=n(o),e.flags|=1,mf(t,e,n,r),e.child;case 14:return n=e.type,o=Ng(n,e.pendingProps),o=Ng(n.type,o),V2e(t,e,n,o,r);case 15:return j3e(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:Ng(n,o),NK(t,e),e.tag=1,ip(n)?(t=!0,GK(e)):t=!1,OL(e,r),u3e(e,n,o),Sme(e,n,o,r),Ome(null,e,n,!0,t,r);case 19:return k3e(t,e,r);case 22:return D3e(t,e,r)}throw Error(Fe(156,e.tag))};function eHe(t,e){return P4e(t,e)}function xer(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 uh(t,e,r,n){return new xer(t,e,r,n)}function She(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Cer(t){if(typeof t=="function")return She(t)?1:0;if(t!=null){if(t=t.$$typeof,t===qme)return 11;if(t===Ume)return 14}return 2}function mE(t,e){var r=t.alternate;return r===null?(r=uh(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 kK(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")She(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case cL:return KM(r.children,o,i,e);case Bme:a=8,o|=8;break;case Wpe:return t=uh(12,r,e,o|2),t.elementType=Wpe,t.lanes=i,t;case Kpe:return t=uh(13,r,e,o),t.elementType=Kpe,t.lanes=i,t;case Jpe:return t=uh(19,r,e,o),t.elementType=Jpe,t.lanes=i,t;case l4e:return _J(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case s4e:a=10;break e;case u4e:a=9;break e;case qme:a=11;break e;case Ume:a=14;break e;case tE:a=16,n=null;break e}throw Error(Fe(130,t==null?t:typeof t,""))}return e=uh(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function KM(t,e,r,n){return t=uh(7,t,n,e),t.lanes=r,t}function _J(t,e,r,n){return t=uh(22,t,n,e),t.elementType=l4e,t.lanes=r,t.stateNode={isHidden:!1},t}function zpe(t,e,r){return t=uh(6,t,null,e),t.lanes=r,t}function Hpe(t,e,r){return e=uh(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Oer(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=Epe(0),this.expirationTimes=Epe(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Epe(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function xhe(t,e,r,n,o,i,a,s,u){return t=new Oer(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=uh(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},ahe(i),t}function Per(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:lL,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function tHe(t){if(!t)return gE;t=t._reactInternals;e:{if(eR(t)!==t||t.tag!==1)throw Error(Fe(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(ip(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Fe(171))}if(t.tag===1){var r=t.type;if(ip(r))return e3e(t,r,e)}return e}function rHe(t,e,r,n,o,i,a,s,u){return t=xhe(r,n,!0,t,o,i,a,s,u),t.context=tHe(null),r=t.current,n=hf(),o=pE(r),i=Yx(n,o),i.callback=e??null,dE(r,i,o),t.current.lanes=o,x2(t,o,n),ap(t,n),t}function vJ(t,e,r,n){var o=e.current,i=hf(),a=pE(o);return r=tHe(r),e.context===null?e.context=r:e.pendingContext=r,e=Yx(i,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=dE(o,e,a),t!==null&&($g(t,o,a,i),RK(t,o,a)),a}function uJ(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 n4e(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function Che(t,e){n4e(t,e),(t=t.alternate)&&n4e(t,e)}function Eer(){return null}var nHe=typeof reportError=="function"?reportError:function(t){console.error(t)};function Ohe(t){this._internalRoot=t}wJ.prototype.render=Ohe.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Fe(409));vJ(t,e,null,null)};wJ.prototype.unmount=Ohe.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;XM(function(){vJ(null,t,null,null)}),e[Xx]=null}};function wJ(t){this._internalRoot=t}wJ.prototype.unstable_scheduleHydration=function(t){if(t){var e=j4e();t={blockedOn:null,target:t,priority:e};for(var r=0;r<nE.length&&e!==0&&e<nE[r].priority;r++);nE.splice(r,0,t),r===0&&N4e(t)}};function Phe(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function SJ(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function o4e(){}function Ter(t,e,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var l=uJ(a);i.call(l)}}var a=rHe(e,n,t,0,null,!1,!1,"",o4e);return t._reactRootContainer=a,t[Xx]=a.current,m2(t.nodeType===8?t.parentNode:t),XM(),a}for(;o=t.lastChild;)t.removeChild(o);if(typeof n=="function"){var s=n;n=function(){var l=uJ(u);s.call(l)}}var u=xhe(t,0,!1,null,null,!1,!1,"",o4e);return t._reactRootContainer=u,t[Xx]=u.current,m2(t.nodeType===8?t.parentNode:t),XM(function(){vJ(e,u,r,n)}),u}function xJ(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=uJ(a);s.call(u)}}vJ(e,a,t,o)}else a=Ter(r,e,t,o,n);return uJ(a)}M4e=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=Gz(e.pendingLanes);r!==0&&(Vme(e,r|1),ap(e,gs()),(uo&6)===0&&(jL=gs()+500,_E()))}break;case 13:XM(function(){var n=Qx(t,1);if(n!==null){var o=hf();$g(n,t,1,o)}}),Che(t,1)}};Wme=function(t){if(t.tag===13){var e=Qx(t,134217728);if(e!==null){var r=hf();$g(e,t,134217728,r)}Che(t,134217728)}};R4e=function(t){if(t.tag===13){var e=pE(t),r=Qx(t,e);if(r!==null){var n=hf();$g(r,t,e,n)}Che(t,e)}};j4e=function(){return ui};D4e=function(t,e){var r=ui;try{return ui=t,e()}finally{ui=r}};ome=function(t,e,r){switch(e){case"input":if(Zpe(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=pJ(n);if(!o)throw Error(Fe(90));d4e(n),Zpe(n,o)}}}break;case"textarea":p4e(t,r);break;case"select":e=r.value,e!=null&&wL(t,!!r.multiple,e,!1)}};v4e=_he;w4e=XM;var Aer={usingClientEntryPoint:!1,Events:[O2,mL,pJ,b4e,_4e,_he]},Vz={findFiberByHostInstance:zM,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},Ier={bundleType:Vz.bundleType,version:Vz.version,rendererPackageName:Vz.rendererPackageName,rendererConfig:Vz.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:tC.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=C4e(t),t===null?null:t.stateNode},findFiberByHostInstance:Vz.findFiberByHostInstance||Eer,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Wz=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Wz.isDisabled&&Wz.supportsFiber))try{lJ=Wz.inject(Ier),vb=Wz}catch{}var Wz;tm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Aer;tm.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Phe(e))throw Error(Fe(200));return Per(t,e,null,r)};tm.createRoot=function(t,e){if(!Phe(t))throw Error(Fe(299));var r=!1,n="",o=nHe;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=xhe(t,1,!1,null,null,r,!1,n,o),t[Xx]=e.current,m2(t.nodeType===8?t.parentNode:t),new Ohe(e)};tm.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(Fe(188)):(t=Object.keys(t).join(","),Error(Fe(268,t)));return t=C4e(e),t=t===null?null:t.stateNode,t};tm.flushSync=function(t){return XM(t)};tm.hydrate=function(t,e,r){if(!SJ(e))throw Error(Fe(200));return xJ(null,t,e,!0,r)};tm.hydrateRoot=function(t,e,r){if(!Phe(t))throw Error(Fe(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=nHe;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=rHe(e,null,t,1,r??null,o,!1,i,a),t[Xx]=e.current,m2(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 wJ(e)};tm.render=function(t,e,r){if(!SJ(e))throw Error(Fe(200));return xJ(null,t,e,!1,r)};tm.unmountComponentAtNode=function(t){if(!SJ(t))throw Error(Fe(40));return t._reactRootContainer?(XM(function(){xJ(null,null,t,!1,function(){t._reactRootContainer=null,t[Xx]=null})}),!0):!1};tm.unstable_batchedUpdates=_he;tm.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!SJ(r))throw Error(Fe(200));if(t==null||t._reactInternals===void 0)throw Error(Fe(38));return xJ(t,e,r,!1,n)};tm.version="18.2.0-next-9e3b772b8-20220608"});var Ms=v((e1n,aHe)=>{"use strict";function iHe(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(iHe)}catch(t){console.error(t)}}iHe(),aHe.exports=oHe()});var _c=v(Ehe=>{"use strict";var sHe=Ms();Ehe.createRoot=sHe.createRoot,Ehe.hydrateRoot=sHe.hydrateRoot;var t1n});var cHe=v(CJ=>{"use strict";var Rer=Y(),jer=Symbol.for("react.element"),Der=Symbol.for("react.fragment"),Ner=Object.prototype.hasOwnProperty,Ler=Rer.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Fer={key:!0,ref:!0,__self:!0,__source:!0};function lHe(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)Ner.call(e,n)&&!Fer.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:jer,type:t,key:i,ref:a,props:o,_owner:Ler.current}}CJ.Fragment=Der;CJ.jsx=lHe;CJ.jsxs=lHe});var St=v((i1n,dHe)=>{"use strict";dHe.exports=cHe()});var IHe=v(IJ=>{"use strict";Object.defineProperty(IJ,"__esModule",{value:!0});IJ.V2ChatStreamRequestCitationMode=void 0;IJ.V2ChatStreamRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var MHe=v(MJ=>{"use strict";Object.defineProperty(MJ,"__esModule",{value:!0});MJ.V2ChatRequestCitationMode=void 0;MJ.V2ChatRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var jHe=v(RHe=>{"use strict";Object.defineProperty(RHe,"__esModule",{value:!0})});var NHe=v(DHe=>{"use strict";Object.defineProperty(DHe,"__esModule",{value:!0})});var FHe=v(LHe=>{"use strict";Object.defineProperty(LHe,"__esModule",{value:!0})});var $He=v(kHe=>{"use strict";Object.defineProperty(kHe,"__esModule",{value:!0})});var qHe=v(BHe=>{"use strict";Object.defineProperty(BHe,"__esModule",{value:!0})});var zHe=v(UHe=>{"use strict";Object.defineProperty(UHe,"__esModule",{value:!0})});var VHe=v(HHe=>{"use strict";Object.defineProperty(HHe,"__esModule",{value:!0})});var KHe=v(WHe=>{"use strict";Object.defineProperty(WHe,"__esModule",{value:!0})});var GHe=v(JHe=>{"use strict";Object.defineProperty(JHe,"__esModule",{value:!0})});var ZHe=v(YHe=>{"use strict";Object.defineProperty(YHe,"__esModule",{value:!0})});var QHe=v(XHe=>{"use strict";Object.defineProperty(XHe,"__esModule",{value:!0})});var tVe=v(eVe=>{"use strict";Object.defineProperty(eVe,"__esModule",{value:!0})});var nVe=v(rVe=>{"use strict";Object.defineProperty(rVe,"__esModule",{value:!0})});var iVe=v(oVe=>{"use strict";Object.defineProperty(oVe,"__esModule",{value:!0})});var sVe=v(aVe=>{"use strict";Object.defineProperty(aVe,"__esModule",{value:!0})});var lVe=v(uVe=>{"use strict";Object.defineProperty(uVe,"__esModule",{value:!0})});var dVe=v(cVe=>{"use strict";Object.defineProperty(cVe,"__esModule",{value:!0})});var pVe=v(fVe=>{"use strict";Object.defineProperty(fVe,"__esModule",{value:!0})});var hVe=v(mVe=>{"use strict";Object.defineProperty(mVe,"__esModule",{value:!0})});var yVe=v(gVe=>{"use strict";Object.defineProperty(gVe,"__esModule",{value:!0})});var _Ve=v(bVe=>{"use strict";Object.defineProperty(bVe,"__esModule",{value:!0})});var wVe=v(vVe=>{"use strict";Object.defineProperty(vVe,"__esModule",{value:!0})});var xVe=v(SVe=>{"use strict";Object.defineProperty(SVe,"__esModule",{value:!0})});var CVe=v(RJ=>{"use strict";Object.defineProperty(RJ,"__esModule",{value:!0});RJ.ChatFinishReason=void 0;RJ.ChatFinishReason={Complete:"complete",StopSequence:"stop_sequence",MaxTokens:"max_tokens",ToolCall:"tool_call",Error:"error",ContentBlocked:"content_blocked",ErrorLimit:"error_limit"}});var PVe=v(OVe=>{"use strict";Object.defineProperty(OVe,"__esModule",{value:!0})});var TVe=v(EVe=>{"use strict";Object.defineProperty(EVe,"__esModule",{value:!0})});var IVe=v(AVe=>{"use strict";Object.defineProperty(AVe,"__esModule",{value:!0})});var RVe=v(MVe=>{"use strict";Object.defineProperty(MVe,"__esModule",{value:!0})});var DVe=v(jVe=>{"use strict";Object.defineProperty(jVe,"__esModule",{value:!0})});var LVe=v(NVe=>{"use strict";Object.defineProperty(NVe,"__esModule",{value:!0})});var kVe=v(FVe=>{"use strict";Object.defineProperty(FVe,"__esModule",{value:!0})});var BVe=v($Ve=>{"use strict";Object.defineProperty($Ve,"__esModule",{value:!0})});var UVe=v(qVe=>{"use strict";Object.defineProperty(qVe,"__esModule",{value:!0})});var HVe=v(zVe=>{"use strict";Object.defineProperty(zVe,"__esModule",{value:!0})});var WVe=v(VVe=>{"use strict";Object.defineProperty(VVe,"__esModule",{value:!0})});var JVe=v(KVe=>{"use strict";Object.defineProperty(KVe,"__esModule",{value:!0})});var YVe=v(GVe=>{"use strict";Object.defineProperty(GVe,"__esModule",{value:!0})});var XVe=v(ZVe=>{"use strict";Object.defineProperty(ZVe,"__esModule",{value:!0})});var e8e=v(QVe=>{"use strict";Object.defineProperty(QVe,"__esModule",{value:!0})});var r8e=v(t8e=>{"use strict";Object.defineProperty(t8e,"__esModule",{value:!0})});var o8e=v(n8e=>{"use strict";Object.defineProperty(n8e,"__esModule",{value:!0})});var a8e=v(i8e=>{"use strict";Object.defineProperty(i8e,"__esModule",{value:!0})});var u8e=v(s8e=>{"use strict";Object.defineProperty(s8e,"__esModule",{value:!0})});var c8e=v(l8e=>{"use strict";Object.defineProperty(l8e,"__esModule",{value:!0})});var f8e=v(d8e=>{"use strict";Object.defineProperty(d8e,"__esModule",{value:!0})});var m8e=v(p8e=>{"use strict";Object.defineProperty(p8e,"__esModule",{value:!0})});var g8e=v(h8e=>{"use strict";Object.defineProperty(h8e,"__esModule",{value:!0})});var b8e=v(y8e=>{"use strict";Object.defineProperty(y8e,"__esModule",{value:!0})});var v8e=v(_8e=>{"use strict";Object.defineProperty(_8e,"__esModule",{value:!0})});var S8e=v(w8e=>{"use strict";Object.defineProperty(w8e,"__esModule",{value:!0})});var C8e=v(x8e=>{"use strict";Object.defineProperty(x8e,"__esModule",{value:!0})});var P8e=v(O8e=>{"use strict";Object.defineProperty(O8e,"__esModule",{value:!0})});var T8e=v(E8e=>{"use strict";Object.defineProperty(E8e,"__esModule",{value:!0})});var I8e=v(A8e=>{"use strict";Object.defineProperty(A8e,"__esModule",{value:!0})});var R8e=v(M8e=>{"use strict";Object.defineProperty(M8e,"__esModule",{value:!0})});var D8e=v(j8e=>{"use strict";Object.defineProperty(j8e,"__esModule",{value:!0})});var L8e=v(N8e=>{"use strict";Object.defineProperty(N8e,"__esModule",{value:!0})});var Dhe=v(vt=>{"use strict";var xtr=vt&&vt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),At=vt&&vt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xtr(e,t,r)};Object.defineProperty(vt,"__esModule",{value:!0});At(IHe(),vt);At(MHe(),vt);At(jHe(),vt);At(NHe(),vt);At(FHe(),vt);At($He(),vt);At(qHe(),vt);At(zHe(),vt);At(VHe(),vt);At(KHe(),vt);At(GHe(),vt);At(ZHe(),vt);At(QHe(),vt);At(tVe(),vt);At(nVe(),vt);At(iVe(),vt);At(sVe(),vt);At(lVe(),vt);At(dVe(),vt);At(pVe(),vt);At(hVe(),vt);At(yVe(),vt);At(_Ve(),vt);At(wVe(),vt);At(xVe(),vt);At(CVe(),vt);At(PVe(),vt);At(TVe(),vt);At(IVe(),vt);At(RVe(),vt);At(DVe(),vt);At(LVe(),vt);At(kVe(),vt);At(BVe(),vt);At(UVe(),vt);At(HVe(),vt);At(WVe(),vt);At(JVe(),vt);At(YVe(),vt);At(XVe(),vt);At(e8e(),vt);At(r8e(),vt);At(o8e(),vt);At(a8e(),vt);At(u8e(),vt);At(c8e(),vt);At(f8e(),vt);At(m8e(),vt);At(g8e(),vt);At(b8e(),vt);At(v8e(),vt);At(S8e(),vt);At(C8e(),vt);At(P8e(),vt);At(T8e(),vt);At(I8e(),vt);At(R8e(),vt);At(D8e(),vt);At(L8e(),vt)});var Nhe=v(F8e=>{"use strict";Object.defineProperty(F8e,"__esModule",{value:!0})});var k8e=v(lR=>{"use strict";var Ctr=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]}),Otr=lR&&lR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ctr(e,t,r)};Object.defineProperty(lR,"__esModule",{value:!0});Otr(Nhe(),lR)});var B8e=v(TE=>{"use strict";var Ptr=TE&&TE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$8e=TE&&TE.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ptr(e,t,r)};Object.defineProperty(TE,"__esModule",{value:!0});$8e(Dhe(),TE);$8e(k8e(),TE)});var q8e=v(jJ=>{"use strict";Object.defineProperty(jJ,"__esModule",{value:!0});jJ.CreateEmbedJobRequestTruncate=void 0;jJ.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var Lhe=v(cR=>{"use strict";var Etr=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]}),Ttr=cR&&cR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Etr(e,t,r)};Object.defineProperty(cR,"__esModule",{value:!0});Ttr(q8e(),cR)});var Fhe=v(U8e=>{"use strict";Object.defineProperty(U8e,"__esModule",{value:!0})});var z8e=v(dR=>{"use strict";var Atr=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]}),Itr=dR&&dR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Atr(e,t,r)};Object.defineProperty(dR,"__esModule",{value:!0});Itr(Fhe(),dR)});var V8e=v(AE=>{"use strict";var Mtr=AE&&AE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),H8e=AE&&AE.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Mtr(e,t,r)};Object.defineProperty(AE,"__esModule",{value:!0});H8e(Lhe(),AE);H8e(z8e(),AE)});var K8e=v(W8e=>{"use strict";Object.defineProperty(W8e,"__esModule",{value:!0})});var G8e=v(J8e=>{"use strict";Object.defineProperty(J8e,"__esModule",{value:!0})});var Z8e=v(Y8e=>{"use strict";Object.defineProperty(Y8e,"__esModule",{value:!0})});var Q8e=v(X8e=>{"use strict";Object.defineProperty(X8e,"__esModule",{value:!0})});var t6e=v(e6e=>{"use strict";Object.defineProperty(e6e,"__esModule",{value:!0})});var khe=v(Vg=>{"use strict";var Rtr=Vg&&Vg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),G2=Vg&&Vg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Rtr(e,t,r)};Object.defineProperty(Vg,"__esModule",{value:!0});G2(K8e(),Vg);G2(G8e(),Vg);G2(Z8e(),Vg);G2(Q8e(),Vg);G2(t6e(),Vg)});var $he=v(r6e=>{"use strict";Object.defineProperty(r6e,"__esModule",{value:!0})});var n6e=v(fR=>{"use strict";var jtr=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]}),Dtr=fR&&fR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jtr(e,t,r)};Object.defineProperty(fR,"__esModule",{value:!0});Dtr($he(),fR)});var i6e=v(IE=>{"use strict";var Ntr=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]}),o6e=IE&&IE.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ntr(e,t,r)};Object.defineProperty(IE,"__esModule",{value:!0});o6e(khe(),IE);o6e(n6e(),IE)});var a6e=v(DJ=>{"use strict";Object.defineProperty(DJ,"__esModule",{value:!0});DJ.BaseType=void 0;DJ.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var s6e=v(NJ=>{"use strict";Object.defineProperty(NJ,"__esModule",{value:!0});NJ.Strategy=void 0;NJ.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var l6e=v(u6e=>{"use strict";Object.defineProperty(u6e,"__esModule",{value:!0})});var d6e=v(c6e=>{"use strict";Object.defineProperty(c6e,"__esModule",{value:!0})});var p6e=v(f6e=>{"use strict";Object.defineProperty(f6e,"__esModule",{value:!0})});var h6e=v(m6e=>{"use strict";Object.defineProperty(m6e,"__esModule",{value:!0})});var g6e=v(LJ=>{"use strict";Object.defineProperty(LJ,"__esModule",{value:!0});LJ.Status=void 0;LJ.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 b6e=v(y6e=>{"use strict";Object.defineProperty(y6e,"__esModule",{value:!0})});var v6e=v(_6e=>{"use strict";Object.defineProperty(_6e,"__esModule",{value:!0})});var S6e=v(w6e=>{"use strict";Object.defineProperty(w6e,"__esModule",{value:!0})});var C6e=v(x6e=>{"use strict";Object.defineProperty(x6e,"__esModule",{value:!0})});var P6e=v(O6e=>{"use strict";Object.defineProperty(O6e,"__esModule",{value:!0})});var T6e=v(E6e=>{"use strict";Object.defineProperty(E6e,"__esModule",{value:!0})});var I6e=v(A6e=>{"use strict";Object.defineProperty(A6e,"__esModule",{value:!0})});var R6e=v(M6e=>{"use strict";Object.defineProperty(M6e,"__esModule",{value:!0})});var D6e=v(j6e=>{"use strict";Object.defineProperty(j6e,"__esModule",{value:!0})});var L6e=v(N6e=>{"use strict";Object.defineProperty(N6e,"__esModule",{value:!0})});var Bhe=v(Ma=>{"use strict";var Ltr=Ma&&Ma.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wc=Ma&&Ma.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ltr(e,t,r)};Object.defineProperty(Ma,"__esModule",{value:!0});wc(a6e(),Ma);wc(s6e(),Ma);wc(l6e(),Ma);wc(d6e(),Ma);wc(p6e(),Ma);wc(h6e(),Ma);wc(g6e(),Ma);wc(b6e(),Ma);wc(v6e(),Ma);wc(S6e(),Ma);wc(C6e(),Ma);wc(P6e(),Ma);wc(T6e(),Ma);wc(I6e(),Ma);wc(R6e(),Ma);wc(D6e(),Ma);wc(L6e(),Ma)});var F6e=v(pR=>{"use strict";var Ftr=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]}),ktr=pR&&pR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ftr(e,t,r)};Object.defineProperty(pR,"__esModule",{value:!0});ktr(Bhe(),pR)});var $6e=v(om=>{"use strict";var k6e=om&&om.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$tr=om&&om.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Btr=om&&om.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&k6e(e,t,r);return $tr(e,t),e},qtr=om&&om.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&k6e(e,t,r)};Object.defineProperty(om,"__esModule",{value:!0});om.finetuning=void 0;om.finetuning=Btr(F6e());qtr(Bhe(),om)});var qhe=v(B6e=>{"use strict";Object.defineProperty(B6e,"__esModule",{value:!0})});var q6e=v(mR=>{"use strict";var Utr=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]}),ztr=mR&&mR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Utr(e,t,r)};Object.defineProperty(mR,"__esModule",{value:!0});ztr(qhe(),mR)});var z6e=v(ME=>{"use strict";var Htr=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]}),U6e=ME&&ME.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Htr(e,t,r)};Object.defineProperty(ME,"__esModule",{value:!0});U6e($6e(),ME);U6e(q6e(),ME)});var Uhe=v(H6e=>{"use strict";Object.defineProperty(H6e,"__esModule",{value:!0})});var V6e=v(hR=>{"use strict";var Vtr=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]}),Wtr=hR&&hR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Vtr(e,t,r)};Object.defineProperty(hR,"__esModule",{value:!0});Wtr(Uhe(),hR)});var W6e=v(gR=>{"use strict";var Ktr=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]}),Jtr=gR&&gR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ktr(e,t,r)};Object.defineProperty(gR,"__esModule",{value:!0});Jtr(V6e(),gR)});var zhe=v(K6e=>{"use strict";Object.defineProperty(K6e,"__esModule",{value:!0})});var J6e=v(yR=>{"use strict";var Gtr=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]}),Ytr=yR&&yR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Gtr(e,t,r)};Object.defineProperty(yR,"__esModule",{value:!0});Ytr(zhe(),yR)});var G6e=v(bR=>{"use strict";var Ztr=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]}),Xtr=bR&&bR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ztr(e,t,r)};Object.defineProperty(bR,"__esModule",{value:!0});Xtr(J6e(),bR)});var Z6e=v(Wo=>{"use strict";var Y6e=Wo&&Wo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qtr=Wo&&Wo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HL=Wo&&Wo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Y6e(e,t,r);return Qtr(e,t),e},dC=Wo&&Wo.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Y6e(e,t,r)};Object.defineProperty(Wo,"__esModule",{value:!0});Wo.models=Wo.connectors=Wo.finetuning=Wo.datasets=Wo.embedJobs=Wo.v2=void 0;Wo.v2=HL(B8e());dC(Dhe(),Wo);Wo.embedJobs=HL(V8e());dC(Lhe(),Wo);Wo.datasets=HL(i6e());dC(khe(),Wo);Wo.finetuning=HL(z6e());Wo.connectors=HL(W6e());Wo.models=HL(G6e());dC(Nhe(),Wo);dC(Fhe(),Wo);dC($he(),Wo);dC(Uhe(),Wo);dC(zhe(),Wo);dC(qhe(),Wo)});var X6e=v(FJ=>{"use strict";Object.defineProperty(FJ,"__esModule",{value:!0});FJ.ChatStreamRequestPromptTruncation=void 0;FJ.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var Q6e=v(kJ=>{"use strict";Object.defineProperty(kJ,"__esModule",{value:!0});kJ.ChatStreamRequestCitationQuality=void 0;kJ.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var t5e=v(e5e=>{"use strict";Object.defineProperty(e5e,"__esModule",{value:!0})});var r5e=v($J=>{"use strict";Object.defineProperty($J,"__esModule",{value:!0});$J.ChatStreamRequestSafetyMode=void 0;$J.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var o5e=v(n5e=>{"use strict";Object.defineProperty(n5e,"__esModule",{value:!0})});var a5e=v(i5e=>{"use strict";Object.defineProperty(i5e,"__esModule",{value:!0})});var u5e=v(s5e=>{"use strict";Object.defineProperty(s5e,"__esModule",{value:!0})});var c5e=v(l5e=>{"use strict";Object.defineProperty(l5e,"__esModule",{value:!0})});var f5e=v(d5e=>{"use strict";Object.defineProperty(d5e,"__esModule",{value:!0})});var p5e=v(BJ=>{"use strict";Object.defineProperty(BJ,"__esModule",{value:!0});BJ.ChatRequestPromptTruncation=void 0;BJ.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var m5e=v(qJ=>{"use strict";Object.defineProperty(qJ,"__esModule",{value:!0});qJ.ChatRequestCitationQuality=void 0;qJ.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var g5e=v(h5e=>{"use strict";Object.defineProperty(h5e,"__esModule",{value:!0})});var y5e=v(UJ=>{"use strict";Object.defineProperty(UJ,"__esModule",{value:!0});UJ.ChatRequestSafetyMode=void 0;UJ.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var b5e=v(zJ=>{"use strict";Object.defineProperty(zJ,"__esModule",{value:!0});zJ.GenerateStreamRequestTruncate=void 0;zJ.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var _5e=v(HJ=>{"use strict";Object.defineProperty(HJ,"__esModule",{value:!0});HJ.GenerateStreamRequestReturnLikelihoods=void 0;HJ.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var v5e=v(VJ=>{"use strict";Object.defineProperty(VJ,"__esModule",{value:!0});VJ.GenerateRequestTruncate=void 0;VJ.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var w5e=v(WJ=>{"use strict";Object.defineProperty(WJ,"__esModule",{value:!0});WJ.GenerateRequestReturnLikelihoods=void 0;WJ.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var S5e=v(KJ=>{"use strict";Object.defineProperty(KJ,"__esModule",{value:!0});KJ.EmbedRequestTruncate=void 0;KJ.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var C5e=v(x5e=>{"use strict";Object.defineProperty(x5e,"__esModule",{value:!0})});var P5e=v(O5e=>{"use strict";Object.defineProperty(O5e,"__esModule",{value:!0})});var T5e=v(E5e=>{"use strict";Object.defineProperty(E5e,"__esModule",{value:!0})});var I5e=v(A5e=>{"use strict";Object.defineProperty(A5e,"__esModule",{value:!0})});var R5e=v(M5e=>{"use strict";Object.defineProperty(M5e,"__esModule",{value:!0})});var j5e=v(JJ=>{"use strict";Object.defineProperty(JJ,"__esModule",{value:!0});JJ.ClassifyRequestTruncate=void 0;JJ.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var N5e=v(D5e=>{"use strict";Object.defineProperty(D5e,"__esModule",{value:!0})});var L5e=v(GJ=>{"use strict";Object.defineProperty(GJ,"__esModule",{value:!0});GJ.ClassifyResponseClassificationsItemClassificationType=void 0;GJ.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var k5e=v(F5e=>{"use strict";Object.defineProperty(F5e,"__esModule",{value:!0})});var B5e=v($5e=>{"use strict";Object.defineProperty($5e,"__esModule",{value:!0})});var q5e=v(YJ=>{"use strict";Object.defineProperty(YJ,"__esModule",{value:!0});YJ.SummarizeRequestLength=void 0;YJ.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var U5e=v(ZJ=>{"use strict";Object.defineProperty(ZJ,"__esModule",{value:!0});ZJ.SummarizeRequestFormat=void 0;ZJ.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var z5e=v(XJ=>{"use strict";Object.defineProperty(XJ,"__esModule",{value:!0});XJ.SummarizeRequestExtractiveness=void 0;XJ.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var V5e=v(H5e=>{"use strict";Object.defineProperty(H5e,"__esModule",{value:!0})});var K5e=v(W5e=>{"use strict";Object.defineProperty(W5e,"__esModule",{value:!0})});var G5e=v(J5e=>{"use strict";Object.defineProperty(J5e,"__esModule",{value:!0})});var Z5e=v(Y5e=>{"use strict";Object.defineProperty(Y5e,"__esModule",{value:!0})});var Q5e=v(X5e=>{"use strict";Object.defineProperty(X5e,"__esModule",{value:!0})});var tWe=v(eWe=>{"use strict";Object.defineProperty(eWe,"__esModule",{value:!0})});var nWe=v(rWe=>{"use strict";Object.defineProperty(rWe,"__esModule",{value:!0})});var iWe=v(oWe=>{"use strict";Object.defineProperty(oWe,"__esModule",{value:!0})});var sWe=v(aWe=>{"use strict";Object.defineProperty(aWe,"__esModule",{value:!0})});var lWe=v(uWe=>{"use strict";Object.defineProperty(uWe,"__esModule",{value:!0})});var dWe=v(cWe=>{"use strict";Object.defineProperty(cWe,"__esModule",{value:!0})});var pWe=v(fWe=>{"use strict";Object.defineProperty(fWe,"__esModule",{value:!0})});var hWe=v(mWe=>{"use strict";Object.defineProperty(mWe,"__esModule",{value:!0})});var yWe=v(gWe=>{"use strict";Object.defineProperty(gWe,"__esModule",{value:!0})});var _We=v(bWe=>{"use strict";Object.defineProperty(bWe,"__esModule",{value:!0})});var wWe=v(vWe=>{"use strict";Object.defineProperty(vWe,"__esModule",{value:!0})});var xWe=v(SWe=>{"use strict";Object.defineProperty(SWe,"__esModule",{value:!0})});var OWe=v(CWe=>{"use strict";Object.defineProperty(CWe,"__esModule",{value:!0})});var EWe=v(PWe=>{"use strict";Object.defineProperty(PWe,"__esModule",{value:!0})});var AWe=v(TWe=>{"use strict";Object.defineProperty(TWe,"__esModule",{value:!0})});var IWe=v(QJ=>{"use strict";Object.defineProperty(QJ,"__esModule",{value:!0});QJ.FinishReason=void 0;QJ.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var RWe=v(MWe=>{"use strict";Object.defineProperty(MWe,"__esModule",{value:!0})});var DWe=v(jWe=>{"use strict";Object.defineProperty(jWe,"__esModule",{value:!0})});var LWe=v(NWe=>{"use strict";Object.defineProperty(NWe,"__esModule",{value:!0})});var kWe=v(FWe=>{"use strict";Object.defineProperty(FWe,"__esModule",{value:!0})});var BWe=v($We=>{"use strict";Object.defineProperty($We,"__esModule",{value:!0})});var UWe=v(qWe=>{"use strict";Object.defineProperty(qWe,"__esModule",{value:!0})});var HWe=v(zWe=>{"use strict";Object.defineProperty(zWe,"__esModule",{value:!0})});var WWe=v(VWe=>{"use strict";Object.defineProperty(VWe,"__esModule",{value:!0})});var JWe=v(KWe=>{"use strict";Object.defineProperty(KWe,"__esModule",{value:!0})});var YWe=v(GWe=>{"use strict";Object.defineProperty(GWe,"__esModule",{value:!0})});var XWe=v(ZWe=>{"use strict";Object.defineProperty(ZWe,"__esModule",{value:!0})});var e9e=v(QWe=>{"use strict";Object.defineProperty(QWe,"__esModule",{value:!0})});var t9e=v(eG=>{"use strict";Object.defineProperty(eG,"__esModule",{value:!0});eG.ChatStreamEndEventFinishReason=void 0;eG.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});var n9e=v(r9e=>{"use strict";Object.defineProperty(r9e,"__esModule",{value:!0})});var i9e=v(o9e=>{"use strict";Object.defineProperty(o9e,"__esModule",{value:!0})});var s9e=v(a9e=>{"use strict";Object.defineProperty(a9e,"__esModule",{value:!0})});var l9e=v(u9e=>{"use strict";Object.defineProperty(u9e,"__esModule",{value:!0})});var d9e=v(c9e=>{"use strict";Object.defineProperty(c9e,"__esModule",{value:!0})});var p9e=v(f9e=>{"use strict";Object.defineProperty(f9e,"__esModule",{value:!0})});var h9e=v(m9e=>{"use strict";Object.defineProperty(m9e,"__esModule",{value:!0})});var y9e=v(g9e=>{"use strict";Object.defineProperty(g9e,"__esModule",{value:!0})});var _9e=v(b9e=>{"use strict";Object.defineProperty(b9e,"__esModule",{value:!0})});var w9e=v(v9e=>{"use strict";Object.defineProperty(v9e,"__esModule",{value:!0})});var x9e=v(S9e=>{"use strict";Object.defineProperty(S9e,"__esModule",{value:!0})});var O9e=v(C9e=>{"use strict";Object.defineProperty(C9e,"__esModule",{value:!0})});var E9e=v(P9e=>{"use strict";Object.defineProperty(P9e,"__esModule",{value:!0})});var A9e=v(T9e=>{"use strict";Object.defineProperty(T9e,"__esModule",{value:!0})});var M9e=v(I9e=>{"use strict";Object.defineProperty(I9e,"__esModule",{value:!0})});var j9e=v(R9e=>{"use strict";Object.defineProperty(R9e,"__esModule",{value:!0})});var N9e=v(D9e=>{"use strict";Object.defineProperty(D9e,"__esModule",{value:!0})});var F9e=v(L9e=>{"use strict";Object.defineProperty(L9e,"__esModule",{value:!0})});var $9e=v(k9e=>{"use strict";Object.defineProperty(k9e,"__esModule",{value:!0})});var q9e=v(B9e=>{"use strict";Object.defineProperty(B9e,"__esModule",{value:!0})});var U9e=v(tG=>{"use strict";Object.defineProperty(tG,"__esModule",{value:!0});tG.EmbedInputType=void 0;tG.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering"}});var z9e=v(rG=>{"use strict";Object.defineProperty(rG,"__esModule",{value:!0});rG.EmbeddingType=void 0;rG.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"}});var V9e=v(H9e=>{"use strict";Object.defineProperty(H9e,"__esModule",{value:!0})});var K9e=v(W9e=>{"use strict";Object.defineProperty(W9e,"__esModule",{value:!0})});var G9e=v(J9e=>{"use strict";Object.defineProperty(J9e,"__esModule",{value:!0})});var Y9e=v(nG=>{"use strict";Object.defineProperty(nG,"__esModule",{value:!0});nG.EmbedJobStatus=void 0;nG.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var Z9e=v(oG=>{"use strict";Object.defineProperty(oG,"__esModule",{value:!0});oG.EmbedJobTruncate=void 0;oG.EmbedJobTruncate={Start:"START",End:"END"}});var Q9e=v(X9e=>{"use strict";Object.defineProperty(X9e,"__esModule",{value:!0})});var tKe=v(eKe=>{"use strict";Object.defineProperty(eKe,"__esModule",{value:!0})});var nKe=v(rKe=>{"use strict";Object.defineProperty(rKe,"__esModule",{value:!0})});var iKe=v(oKe=>{"use strict";Object.defineProperty(oKe,"__esModule",{value:!0})});var sKe=v(aKe=>{"use strict";Object.defineProperty(aKe,"__esModule",{value:!0})});var uKe=v(iG=>{"use strict";Object.defineProperty(iG,"__esModule",{value:!0});iG.DatasetValidationStatus=void 0;iG.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var lKe=v(aG=>{"use strict";Object.defineProperty(aG,"__esModule",{value:!0});aG.DatasetType=void 0;aG.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 dKe=v(cKe=>{"use strict";Object.defineProperty(cKe,"__esModule",{value:!0})});var pKe=v(fKe=>{"use strict";Object.defineProperty(fKe,"__esModule",{value:!0})});var hKe=v(mKe=>{"use strict";Object.defineProperty(mKe,"__esModule",{value:!0})});var yKe=v(gKe=>{"use strict";Object.defineProperty(gKe,"__esModule",{value:!0})});var _Ke=v(bKe=>{"use strict";Object.defineProperty(bKe,"__esModule",{value:!0})});var wKe=v(vKe=>{"use strict";Object.defineProperty(vKe,"__esModule",{value:!0})});var xKe=v(SKe=>{"use strict";Object.defineProperty(SKe,"__esModule",{value:!0})});var OKe=v(CKe=>{"use strict";Object.defineProperty(CKe,"__esModule",{value:!0})});var EKe=v(PKe=>{"use strict";Object.defineProperty(PKe,"__esModule",{value:!0})});var AKe=v(TKe=>{"use strict";Object.defineProperty(TKe,"__esModule",{value:!0})});var MKe=v(IKe=>{"use strict";Object.defineProperty(IKe,"__esModule",{value:!0})});var jKe=v(RKe=>{"use strict";Object.defineProperty(RKe,"__esModule",{value:!0})});var DKe=v(sG=>{"use strict";Object.defineProperty(sG,"__esModule",{value:!0});sG.ConnectorAuthStatus=void 0;sG.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var LKe=v(NKe=>{"use strict";Object.defineProperty(NKe,"__esModule",{value:!0})});var kKe=v(FKe=>{"use strict";Object.defineProperty(FKe,"__esModule",{value:!0})});var BKe=v($Ke=>{"use strict";Object.defineProperty($Ke,"__esModule",{value:!0})});var qKe=v(uG=>{"use strict";Object.defineProperty(uG,"__esModule",{value:!0});uG.AuthTokenType=void 0;uG.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var zKe=v(UKe=>{"use strict";Object.defineProperty(UKe,"__esModule",{value:!0})});var VKe=v(HKe=>{"use strict";Object.defineProperty(HKe,"__esModule",{value:!0})});var KKe=v(WKe=>{"use strict";Object.defineProperty(WKe,"__esModule",{value:!0})});var GKe=v(JKe=>{"use strict";Object.defineProperty(JKe,"__esModule",{value:!0})});var ZKe=v(YKe=>{"use strict";Object.defineProperty(YKe,"__esModule",{value:!0})});var QKe=v(XKe=>{"use strict";Object.defineProperty(XKe,"__esModule",{value:!0})});var eJe=v(lG=>{"use strict";Object.defineProperty(lG,"__esModule",{value:!0});lG.CompatibleEndpoint=void 0;lG.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var rJe=v(tJe=>{"use strict";Object.defineProperty(tJe,"__esModule",{value:!0})});var oJe=v(nJe=>{"use strict";Object.defineProperty(nJe,"__esModule",{value:!0})});var iJe=v(ue=>{"use strict";var err=ue&&ue.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ge=ue&&ue.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&err(e,t,r)};Object.defineProperty(ue,"__esModule",{value:!0});ge(X6e(),ue);ge(Q6e(),ue);ge(t5e(),ue);ge(r5e(),ue);ge(o5e(),ue);ge(a5e(),ue);ge(u5e(),ue);ge(c5e(),ue);ge(f5e(),ue);ge(p5e(),ue);ge(m5e(),ue);ge(g5e(),ue);ge(y5e(),ue);ge(b5e(),ue);ge(_5e(),ue);ge(v5e(),ue);ge(w5e(),ue);ge(S5e(),ue);ge(C5e(),ue);ge(P5e(),ue);ge(T5e(),ue);ge(I5e(),ue);ge(R5e(),ue);ge(j5e(),ue);ge(N5e(),ue);ge(L5e(),ue);ge(k5e(),ue);ge(B5e(),ue);ge(q5e(),ue);ge(U5e(),ue);ge(z5e(),ue);ge(V5e(),ue);ge(K5e(),ue);ge(G5e(),ue);ge(Z5e(),ue);ge(Q5e(),ue);ge(tWe(),ue);ge(nWe(),ue);ge(iWe(),ue);ge(sWe(),ue);ge(lWe(),ue);ge(dWe(),ue);ge(pWe(),ue);ge(hWe(),ue);ge(yWe(),ue);ge(_We(),ue);ge(wWe(),ue);ge(xWe(),ue);ge(OWe(),ue);ge(EWe(),ue);ge(AWe(),ue);ge(IWe(),ue);ge(RWe(),ue);ge(DWe(),ue);ge(LWe(),ue);ge(kWe(),ue);ge(BWe(),ue);ge(UWe(),ue);ge(HWe(),ue);ge(WWe(),ue);ge(JWe(),ue);ge(YWe(),ue);ge(XWe(),ue);ge(e9e(),ue);ge(t9e(),ue);ge(n9e(),ue);ge(i9e(),ue);ge(s9e(),ue);ge(l9e(),ue);ge(d9e(),ue);ge(p9e(),ue);ge(h9e(),ue);ge(y9e(),ue);ge(_9e(),ue);ge(w9e(),ue);ge(x9e(),ue);ge(O9e(),ue);ge(E9e(),ue);ge(A9e(),ue);ge(M9e(),ue);ge(j9e(),ue);ge(N9e(),ue);ge(F9e(),ue);ge($9e(),ue);ge(q9e(),ue);ge(U9e(),ue);ge(z9e(),ue);ge(V9e(),ue);ge(K9e(),ue);ge(G9e(),ue);ge(Y9e(),ue);ge(Z9e(),ue);ge(Q9e(),ue);ge(tKe(),ue);ge(nKe(),ue);ge(iKe(),ue);ge(sKe(),ue);ge(uKe(),ue);ge(lKe(),ue);ge(dKe(),ue);ge(pKe(),ue);ge(hKe(),ue);ge(yKe(),ue);ge(_Ke(),ue);ge(wKe(),ue);ge(xKe(),ue);ge(OKe(),ue);ge(EKe(),ue);ge(AKe(),ue);ge(MKe(),ue);ge(jKe(),ue);ge(DKe(),ue);ge(LKe(),ue);ge(kKe(),ue);ge(BKe(),ue);ge(qKe(),ue);ge(zKe(),ue);ge(VKe(),ue);ge(KKe(),ue);ge(GKe(),ue);ge(ZKe(),ue);ge(QKe(),ue);ge(eJe(),ue);ge(rJe(),ue);ge(oJe(),ue)});var aJe=v(cG=>{"use strict";Object.defineProperty(cG,"__esModule",{value:!0});cG.CohereError=void 0;var Hhe=class t extends Error{constructor({message:e,statusCode:r,body:n}){super(trr({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,t.prototype),r!=null&&(this.statusCode=r),n!==void 0&&(this.body=n)}};cG.CohereError=Hhe;function trr({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 sJe=v(dG=>{"use strict";Object.defineProperty(dG,"__esModule",{value:!0});dG.CohereTimeoutError=void 0;var Vhe=class t extends Error{constructor(){super("Timeout"),Object.setPrototypeOf(this,t.prototype)}};dG.CohereTimeoutError=Vhe});var ys=v(VL=>{"use strict";Object.defineProperty(VL,"__esModule",{value:!0});VL.CohereTimeoutError=VL.CohereError=void 0;var rrr=aJe();Object.defineProperty(VL,"CohereError",{enumerable:!0,get:function(){return rrr.CohereError}});var nrr=sJe();Object.defineProperty(VL,"CohereTimeoutError",{enumerable:!0,get:function(){return nrr.CohereTimeoutError}})});var uJe=v(Eb=>{"use strict";var orr=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]}),irr=Eb&&Eb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),arr=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)&&orr(e,t,r);return irr(e,t),e};Object.defineProperty(Eb,"__esModule",{value:!0});Eb.BadRequestError=void 0;var srr=arr(ys()),Whe=class t extends srr.CohereError{constructor(e){super({message:"BadRequestError",statusCode:400,body:e}),Object.setPrototypeOf(this,t.prototype)}};Eb.BadRequestError=Whe});var lJe=v(Tb=>{"use strict";var urr=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]}),lrr=Tb&&Tb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),crr=Tb&&Tb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&urr(e,t,r);return lrr(e,t),e};Object.defineProperty(Tb,"__esModule",{value:!0});Tb.UnauthorizedError=void 0;var drr=crr(ys()),Khe=class t extends drr.CohereError{constructor(e){super({message:"UnauthorizedError",statusCode:401,body:e}),Object.setPrototypeOf(this,t.prototype)}};Tb.UnauthorizedError=Khe});var cJe=v(Ab=>{"use strict";var frr=Ab&&Ab.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),prr=Ab&&Ab.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mrr=Ab&&Ab.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&frr(e,t,r);return prr(e,t),e};Object.defineProperty(Ab,"__esModule",{value:!0});Ab.ForbiddenError=void 0;var hrr=mrr(ys()),Jhe=class t extends hrr.CohereError{constructor(e){super({message:"ForbiddenError",statusCode:403,body:e}),Object.setPrototypeOf(this,t.prototype)}};Ab.ForbiddenError=Jhe});var dJe=v(Ib=>{"use strict";var grr=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]}),yrr=Ib&&Ib.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),brr=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)&&grr(e,t,r);return yrr(e,t),e};Object.defineProperty(Ib,"__esModule",{value:!0});Ib.NotFoundError=void 0;var _rr=brr(ys()),Ghe=class t extends _rr.CohereError{constructor(e){super({message:"NotFoundError",statusCode:404,body:e}),Object.setPrototypeOf(this,t.prototype)}};Ib.NotFoundError=Ghe});var fJe=v(Mb=>{"use strict";var vrr=Mb&&Mb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wrr=Mb&&Mb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Srr=Mb&&Mb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vrr(e,t,r);return wrr(e,t),e};Object.defineProperty(Mb,"__esModule",{value:!0});Mb.UnprocessableEntityError=void 0;var xrr=Srr(ys()),Yhe=class t extends xrr.CohereError{constructor(e){super({message:"UnprocessableEntityError",statusCode:422,body:e}),Object.setPrototypeOf(this,t.prototype)}};Mb.UnprocessableEntityError=Yhe});var pJe=v(Rb=>{"use strict";var Crr=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]}),Orr=Rb&&Rb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Prr=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)&&Crr(e,t,r);return Orr(e,t),e};Object.defineProperty(Rb,"__esModule",{value:!0});Rb.TooManyRequestsError=void 0;var Err=Prr(ys()),Zhe=class t extends Err.CohereError{constructor(e){super({message:"TooManyRequestsError",statusCode:429,body:e}),Object.setPrototypeOf(this,t.prototype)}};Rb.TooManyRequestsError=Zhe});var mJe=v(jb=>{"use strict";var Trr=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]}),Arr=jb&&jb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Irr=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)&&Trr(e,t,r);return Arr(e,t),e};Object.defineProperty(jb,"__esModule",{value:!0});jb.ClientClosedRequestError=void 0;var Mrr=Irr(ys()),Xhe=class t extends Mrr.CohereError{constructor(e){super({message:"ClientClosedRequestError",statusCode:499,body:e}),Object.setPrototypeOf(this,t.prototype)}};jb.ClientClosedRequestError=Xhe});var hJe=v(Db=>{"use strict";var Rrr=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]}),jrr=Db&&Db.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Drr=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)&&Rrr(e,t,r);return jrr(e,t),e};Object.defineProperty(Db,"__esModule",{value:!0});Db.InternalServerError=void 0;var Nrr=Drr(ys()),Qhe=class t extends Nrr.CohereError{constructor(e){super({message:"InternalServerError",statusCode:500,body:e}),Object.setPrototypeOf(this,t.prototype)}};Db.InternalServerError=Qhe});var gJe=v(Nb=>{"use strict";var Lrr=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]}),Frr=Nb&&Nb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),krr=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)&&Lrr(e,t,r);return Frr(e,t),e};Object.defineProperty(Nb,"__esModule",{value:!0});Nb.NotImplementedError=void 0;var $rr=krr(ys()),ege=class t extends $rr.CohereError{constructor(e){super({message:"NotImplementedError",statusCode:501,body:e}),Object.setPrototypeOf(this,t.prototype)}};Nb.NotImplementedError=ege});var yJe=v(Lb=>{"use strict";var Brr=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]}),qrr=Lb&&Lb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Urr=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)&&Brr(e,t,r);return qrr(e,t),e};Object.defineProperty(Lb,"__esModule",{value:!0});Lb.ServiceUnavailableError=void 0;var zrr=Urr(ys()),tge=class t extends zrr.CohereError{constructor(e){super({message:"ServiceUnavailableError",statusCode:503,body:e}),Object.setPrototypeOf(this,t.prototype)}};Lb.ServiceUnavailableError=tge});var bJe=v(Fb=>{"use strict";var Hrr=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]}),Vrr=Fb&&Fb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wrr=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)&&Hrr(e,t,r);return Vrr(e,t),e};Object.defineProperty(Fb,"__esModule",{value:!0});Fb.GatewayTimeoutError=void 0;var Krr=Wrr(ys()),rge=class t extends Krr.CohereError{constructor(e){super({message:"GatewayTimeoutError",statusCode:504,body:e}),Object.setPrototypeOf(this,t.prototype)}};Fb.GatewayTimeoutError=rge});var _Je=v(Sc=>{"use strict";var Jrr=Sc&&Sc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wg=Sc&&Sc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Jrr(e,t,r)};Object.defineProperty(Sc,"__esModule",{value:!0});Wg(uJe(),Sc);Wg(lJe(),Sc);Wg(cJe(),Sc);Wg(dJe(),Sc);Wg(fJe(),Sc);Wg(pJe(),Sc);Wg(mJe(),Sc);Wg(hJe(),Sc);Wg(gJe(),Sc);Wg(yJe(),Sc);Wg(bJe(),Sc)});var wJe=v(vJe=>{"use strict";Object.defineProperty(vJe,"__esModule",{value:!0})});var SJe=v(_R=>{"use strict";var Grr=_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]}),Yrr=_R&&_R.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Grr(e,t,r)};Object.defineProperty(_R,"__esModule",{value:!0});Yrr(wJe(),_R)});var fC=v(kb=>{"use strict";var Zrr=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]}),fG=kb&&kb.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Zrr(e,t,r)};Object.defineProperty(kb,"__esModule",{value:!0});fG(Z6e(),kb);fG(iJe(),kb);fG(_Je(),kb);fG(SJe(),kb)});var ige={};$f(ige,{__addDisposableResource:()=>zJe,__assign:()=>pG,__asyncDelegator:()=>NJe,__asyncGenerator:()=>DJe,__asyncValues:()=>LJe,__await:()=>WL,__awaiter:()=>TJe,__classPrivateFieldGet:()=>BJe,__classPrivateFieldIn:()=>UJe,__classPrivateFieldSet:()=>qJe,__createBinding:()=>hG,__decorate:()=>OJe,__disposeResources:()=>HJe,__esDecorate:()=>Xrr,__exportStar:()=>IJe,__extends:()=>xJe,__generator:()=>AJe,__importDefault:()=>$Je,__importStar:()=>kJe,__makeTemplateObject:()=>FJe,__metadata:()=>EJe,__param:()=>PJe,__propKey:()=>enr,__read:()=>oge,__rest:()=>CJe,__runInitializers:()=>Qrr,__setFunctionName:()=>tnr,__spread:()=>MJe,__spreadArray:()=>jJe,__spreadArrays:()=>RJe,__values:()=>mG,default:()=>onr});function xJe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");nge(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function CJe(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 OJe(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 PJe(t,e){return function(r,n){e(r,n,t)}}function Xrr(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var b=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(d=a(b.get))&&(c.get=d),(d=a(b.set))&&(c.set=d),(d=a(b.init))&&o.unshift(d)}else(d=a(b))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function Qrr(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 enr(t){return typeof t=="symbol"?t:"".concat(t)}function tnr(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 EJe(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function TJe(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 AJe(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 IJe(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hG(e,t,r)}function mG(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 oge(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 MJe(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(oge(arguments[e]));return t}function RJe(){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 jJe(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 WL(t){return this instanceof WL?(this.v=t,this):new WL(t)}function DJe(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(b,g){i.push([p,h,b,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof WL?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function NJe(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:WL(t[o](a)),done:!1}:i?i(a):a}:i}}function LJe(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 mG=="function"?mG(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 FJe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function kJe(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hG(e,t,r);return rnr(e,t),e}function $Je(t){return t&&t.__esModule?t:{default:t}}function BJe(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 qJe(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 UJe(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 zJe(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 HJe(t){function e(i){t.error=t.hasError?new nnr(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 nge,pG,hG,rnr,nnr,onr,age=O(()=>{nge=function(t,e){return nge=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])},nge(t,e)};pG=function(){return pG=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},pG.apply(this,arguments)};hG=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};rnr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};nnr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};onr={__extends:xJe,__assign:pG,__rest:CJe,__decorate:OJe,__param:PJe,__metadata:EJe,__awaiter:TJe,__generator:AJe,__createBinding:hG,__exportStar:IJe,__values:mG,__read:oge,__spread:MJe,__spreadArrays:RJe,__spreadArray:jJe,__await:WL,__asyncGenerator:DJe,__asyncDelegator:NJe,__asyncValues:LJe,__makeTemplateObject:FJe,__importStar:kJe,__importDefault:$Je,__classPrivateFieldGet:BJe,__classPrivateFieldSet:qJe,__classPrivateFieldIn:UJe,__addDisposableResource:zJe,__disposeResources:HJe}});var sge=v(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});ph.MAX_HASHABLE_LENGTH=ph.INIT=ph.KEY=ph.DIGEST_LENGTH=ph.BLOCK_SIZE=void 0;ph.BLOCK_SIZE=64;ph.DIGEST_LENGTH=32;ph.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]);ph.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];ph.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var VJe=v(gG=>{"use strict";Object.defineProperty(gG,"__esModule",{value:!0});gG.RawSha256=void 0;var mh=sge(),inr=function(){function t(){this.state=Int32Array.from(mh.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>mh.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===mh.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%mh.BLOCK_SIZE>=mh.BLOCK_SIZE-8){for(var o=this.bufferLength;o<mh.BLOCK_SIZE;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<mh.BLOCK_SIZE-8;o++)r.setUint8(o,0);r.setUint32(mh.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),r.setUint32(mh.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(mh.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<mh.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(r[f*4]&255)<<24|(r[f*4+1]&255)<<16|(r[f*4+2]&255)<<8|r[f*4+3]&255;else{var p=this.temp[f-2],m=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var h=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(m+this.temp[f-7]|0)+(h+this.temp[f-16]|0)}var b=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&c)|0)+(d+(mh.KEY[f]+this.temp[f]|0)|0)|0,g=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&i^o&a^i&a)|0;d=c,c=l,l=u,u=s+b|0,s=a,a=i,i=o,o=b+g|0}n[0]+=o,n[1]+=i,n[2]+=a,n[3]+=s,n[4]+=u,n[5]+=l,n[6]+=c,n[7]+=d},t}();gG.RawSha256=inr});var JJe=v((FBn,KJe)=>{var yG=Object.defineProperty,anr=Object.getOwnPropertyDescriptor,snr=Object.getOwnPropertyNames,unr=Object.prototype.hasOwnProperty,lnr=(t,e)=>yG(t,"name",{value:e,configurable:!0}),cnr=(t,e)=>{for(var r in e)yG(t,r,{get:e[r],enumerable:!0})},dnr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of snr(e))!unr.call(t,o)&&o!==r&&yG(t,o,{get:()=>e[o],enumerable:!(n=anr(e,o))||n.enumerable});return t},fnr=t=>dnr(yG({},"__esModule",{value:!0}),t),WJe={};cnr(WJe,{isArrayBuffer:()=>pnr});KJe.exports=fnr(WJe);var pnr=lnr(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var XJe=v((kBn,ZJe)=>{var bG=Object.defineProperty,mnr=Object.getOwnPropertyDescriptor,hnr=Object.getOwnPropertyNames,gnr=Object.prototype.hasOwnProperty,GJe=(t,e)=>bG(t,"name",{value:e,configurable:!0}),ynr=(t,e)=>{for(var r in e)bG(t,r,{get:e[r],enumerable:!0})},bnr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of hnr(e))!gnr.call(t,o)&&o!==r&&bG(t,o,{get:()=>e[o],enumerable:!(n=mnr(e,o))||n.enumerable});return t},_nr=t=>bnr(bG({},"__esModule",{value:!0}),t),YJe={};ynr(YJe,{fromArrayBuffer:()=>wnr,fromString:()=>Snr});ZJe.exports=_nr(YJe);var vnr=JJe(),uge=tp(),wnr=GJe((t,e=0,r=t.byteLength-e)=>{if(!(0,vnr.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return uge.Buffer.from(t,e,r)},"fromArrayBuffer"),Snr=GJe((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?uge.Buffer.from(t,e):uge.Buffer.from(t)},"fromString")});var nGe=v(($Bn,rGe)=>{var _G=Object.defineProperty,xnr=Object.getOwnPropertyDescriptor,Cnr=Object.getOwnPropertyNames,Onr=Object.prototype.hasOwnProperty,lge=(t,e)=>_G(t,"name",{value:e,configurable:!0}),Pnr=(t,e)=>{for(var r in e)_G(t,r,{get:e[r],enumerable:!0})},Enr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Cnr(e))!Onr.call(t,o)&&o!==r&&_G(t,o,{get:()=>e[o],enumerable:!(n=xnr(e,o))||n.enumerable});return t},Tnr=t=>Enr(_G({},"__esModule",{value:!0}),t),QJe={};Pnr(QJe,{fromUtf8:()=>tGe,toUint8Array:()=>Anr,toUtf8:()=>Inr});rGe.exports=Tnr(QJe);var eGe=XJe(),tGe=lge(t=>{let e=(0,eGe.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),Anr=lge(t=>typeof t=="string"?tGe(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),Inr=lge(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,eGe.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var oGe=v(vG=>{"use strict";Object.defineProperty(vG,"__esModule",{value:!0});vG.convertToBuffer=void 0;var Mnr=nGe(),Rnr=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:Mnr.fromUtf8;function jnr(t){return t instanceof Uint8Array?t:typeof t=="string"?Rnr(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}vG.convertToBuffer=jnr});var iGe=v(wG=>{"use strict";Object.defineProperty(wG,"__esModule",{value:!0});wG.isEmptyData=void 0;function Dnr(t){return typeof t=="string"?t.length===0:t.byteLength===0}wG.isEmptyData=Dnr});var aGe=v(SG=>{"use strict";Object.defineProperty(SG,"__esModule",{value:!0});SG.numToUint8=void 0;function Nnr(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}SG.numToUint8=Nnr});var sGe=v(xG=>{"use strict";Object.defineProperty(xG,"__esModule",{value:!0});xG.uint32ArrayFrom=void 0;function Lnr(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)}xG.uint32ArrayFrom=Lnr});var CG=v($b=>{"use strict";Object.defineProperty($b,"__esModule",{value:!0});$b.uint32ArrayFrom=$b.numToUint8=$b.isEmptyData=$b.convertToBuffer=void 0;var Fnr=oGe();Object.defineProperty($b,"convertToBuffer",{enumerable:!0,get:function(){return Fnr.convertToBuffer}});var knr=iGe();Object.defineProperty($b,"isEmptyData",{enumerable:!0,get:function(){return knr.isEmptyData}});var $nr=aGe();Object.defineProperty($b,"numToUint8",{enumerable:!0,get:function(){return $nr.numToUint8}});var Bnr=sGe();Object.defineProperty($b,"uint32ArrayFrom",{enumerable:!0,get:function(){return Bnr.uint32ArrayFrom}})});var lGe=v(EG=>{"use strict";Object.defineProperty(EG,"__esModule",{value:!0});EG.Sha256=void 0;var uGe=(age(),Al(ige)),PG=sge(),OG=VJe(),cge=CG(),qnr=function(){function t(e){this.secret=e,this.hash=new OG.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,cge.isEmptyData)(e)||this.error))try{this.hash.update((0,cge.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 uGe.__awaiter(this,void 0,void 0,function(){return uGe.__generator(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new OG.RawSha256,this.secret){this.outer=new OG.RawSha256;var e=Unr(this.secret),r=new Uint8Array(PG.BLOCK_SIZE);r.set(e);for(var n=0;n<PG.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}();EG.Sha256=qnr;function Unr(t){var e=(0,cge.convertToBuffer)(t);if(e.byteLength>PG.BLOCK_SIZE){var r=new OG.RawSha256;r.update(e),e=r.digest()}var n=new Uint8Array(PG.BLOCK_SIZE);return n.set(e),n}});var fge=v(dge=>{"use strict";Object.defineProperty(dge,"__esModule",{value:!0});var znr=(age(),Al(ige));znr.__exportStar(lGe(),dge)});var cGe=O(()=>{});var dGe=O(()=>{});var fGe=O(()=>{});var vR,Y2=O(()=>{vR=class t extends Error{constructor(e,r=!0){let n,o=!0;typeof r=="boolean"?(n=void 0,o=r):r!=null&&typeof r=="object"&&(n=r.logger,o=r.tryNextLink??!0),super(e),this.name="ProviderError",this.tryNextLink=o,Object.setPrototypeOf(this,t.prototype),n?.debug?.(`@smithy/property-provider ${o?"->":"(!)"} ${e}`)}static from(e,r=!0){return Object.assign(new this(e.message,r),e)}}});var pl,pGe=O(()=>{Y2();pl=class t extends vR{constructor(e,r=!0){super(e,r),this.name="CredentialsProviderError",Object.setPrototypeOf(this,t.prototype)}}});var mGe=O(()=>{Y2()});var hGe=O(()=>{Y2()});var gGe=O(()=>{});var yGe,bGe=O(()=>{yGe=(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 pC=O(()=>{pGe();Y2();mGe();hGe();gGe();bGe()});function TG(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 pge=O(()=>{});var _Ge=O(()=>{});var vGe=O(()=>{_Ge()});var wGe=O(()=>{});var SGe,xGe=O(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(SGe||(SGe={}))});var mge,CGe=O(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(mge||(mge={}))});var OGe=O(()=>{});var PGe=O(()=>{});var EGe=O(()=>{});var TGe=O(()=>{});var AGe=O(()=>{xGe();CGe();OGe();PGe();EGe();TGe()});var IGe=O(()=>{});var MGe=O(()=>{});var RGe=O(()=>{});var jGe=O(()=>{});var DGe=O(()=>{});var NGe=O(()=>{});var LGe=O(()=>{});var FGe=O(()=>{DGe();NGe();LGe()});var kGe=O(()=>{});var $Ge=O(()=>{});var KL,BGe=O(()=>{(function(t){t.HTTP="http",t.HTTPS="https"})(KL||(KL={}))});var qGe=O(()=>{});var UGe=O(()=>{});var zGe=O(()=>{});var HGe=O(()=>{});var VGe=O(()=>{});var WGe=O(()=>{qGe();UGe();zGe();HGe();VGe()});var KGe=O(()=>{});var JL,hge=O(()=>{(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(JL||(JL={}))});var JGe=O(()=>{hge()});var GGe=O(()=>{});var YGe=O(()=>{JGe();GGe();hge()});var im,ZGe=O(()=>{(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(im||(im={}))});var XGe=O(()=>{});var QGe=O(()=>{});var e7e=O(()=>{});var t7e=O(()=>{});var r7e=O(()=>{});var n7e=O(()=>{QGe();e7e();t7e();r7e()});var o7e=O(()=>{});var GL,i7e=O(()=>{GL="__smithy_context"});var a7e=O(()=>{});var s7e,u7e=O(()=>{(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(s7e||(s7e={}))});var l7e=O(()=>{});var c7e=O(()=>{});var d7e=O(()=>{});var f7e=O(()=>{});var p7e=O(()=>{});var m7e=O(()=>{});var h7e=O(()=>{});var g7e=O(()=>{});var y7e=O(()=>{});var b7e,_7e=O(()=>{(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(b7e||(b7e={}))});var v7e=O(()=>{});var w7e=O(()=>{});var S7e=O(()=>{});var x7e=O(()=>{});var C7e=O(()=>{});var O7e=O(()=>{});var Rs=O(()=>{wGe();AGe();IGe();MGe();RGe();jGe();FGe();kGe();$Ge();BGe();WGe();KGe();YGe();ZGe();XGe();n7e();o7e();i7e();a7e();u7e();l7e();c7e();d7e();f7e();p7e();m7e();h7e();g7e();y7e();_7e();v7e();w7e();S7e();x7e();C7e();O7e()});var P7e=O(()=>{Rs()});var E7e=O(()=>{});var T7e=O(()=>{});function Hnr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var AG,A7e=O(()=>{AG=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Hnr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var I7e=O(()=>{});var M7e=O(()=>{});var R7e=O(()=>{});var j7e=O(()=>{vGe();P7e();E7e();T7e();A7e();I7e();M7e();R7e()});var Vnr,Wnr,IG,gge=O(()=>{j7e();Vnr=t=>e=>async r=>{if(!AG.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)},Wnr={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},IG=t=>({applyToStack:e=>{e.add(Vnr(t),Wnr)}})});var Knr,Jnr,MG,D7e=O(()=>{Knr=()=>(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}},Jnr={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},MG=t=>({applyToStack:e=>{e.add(Knr(),Jnr)}})});var yge=O(()=>{D7e()});var N7e=O(()=>{});var L7e=O(()=>{N7e()});var F7e=O(()=>{Rs()});var k7e=O(()=>{});var $7e=O(()=>{});function Gnr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var RG,B7e=O(()=>{RG=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Gnr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var q7e=O(()=>{});var U7e=O(()=>{});var z7e=O(()=>{});var H7e=O(()=>{L7e();F7e();k7e();$7e();B7e();q7e();U7e();z7e()});var V7e,Ynr,Znr,Xnr,Qnr,jG,bge=O(()=>{H7e();V7e="X-Amzn-Trace-Id",Ynr="AWS_LAMBDA_FUNCTION_NAME",Znr="_X_AMZN_TRACE_ID",Xnr=t=>e=>async r=>{let{request:n}=r;if(!RG.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(V7e))return e(r);let o=process.env[Ynr],i=process.env[Znr],a=s=>typeof s=="string"&&s.length>0;return a(o)&&a(i)&&(n.headers[V7e]=i),e({...r,request:n})},Qnr={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},jG=t=>({applyToStack:e=>{e.add(Xnr(t),Qnr)}})});function DG(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}var W7e=O(()=>{});var eor,Z2,_ge=O(()=>{eor=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}$"),Z2=t=>eor.test(t)||t.startsWith("[")&&t.endsWith("]")});var tor,X2,vge=O(()=>{tor=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),X2=(t,e=!1)=>{if(!e)return tor.test(t);let r=t.split(".");for(let n of r)if(!X2(n))return!1;return!0}});var mC,NG=O(()=>{mC={}});var hC,K7e=O(()=>{hC="endpoints"});function hh(t){return typeof t!="object"||t==null?t:"ref"in t?`$${hh(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(hh).join(", ")})`:JSON.stringify(t,null,2)}var J7e=O(()=>{});var Q2=O(()=>{K7e();J7e()});var Ni,G7e=O(()=>{Ni=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var Y7e=O(()=>{});var Z7e=O(()=>{});var X7e=O(()=>{});var Q7e=O(()=>{});var eYe=O(()=>{});var tYe=O(()=>{});var gh=O(()=>{G7e();Y7e();Z7e();X7e();Q7e();eYe();tYe()});var rYe,nYe=O(()=>{rYe=(t,e)=>t===e});var oYe,iYe=O(()=>{gh();oYe=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 Ni(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new Ni(`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 LG,aYe=O(()=>{gh();iYe();LG=(t,e)=>oYe(e).reduce((r,n)=>{if(typeof r!="object")throw new Ni(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var sYe,uYe=O(()=>{sYe=t=>t!=null});var lYe,cYe=O(()=>{lYe=t=>!t});var wge,dYe,fYe=O(()=>{Rs();_ge();wge={[KL.HTTP]:80,[KL.HTTPS]:443},dYe=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:f,port:p,protocol:m="",path:h="",query:b={}}=t,g=new URL(`${m}//${f}${p?`:${p}`:""}${h}`);return g.search=Object.entries(b).map(([_,w])=>`${_}=${w}`).join("&"),g}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;let r=e.href,{host:n,hostname:o,pathname:i,protocol:a,search:s}=e;if(s)return null;let u=a.slice(0,-1);if(!Object.values(KL).includes(u))return null;let l=Z2(o),c=r.includes(`${n}:${wge[u]}`)||typeof t=="string"&&t.includes(`${n}:${wge[u]}`),d=`${n}${c?`:${wge[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var pYe,mYe=O(()=>{pYe=(t,e)=>t===e});var hYe,gYe=O(()=>{hYe=(t,e,r,n)=>e>=r||t.length<r?null:n?t.substring(t.length-r,t.length-e):t.substring(e,r)});var yYe,bYe=O(()=>{yYe=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var Sge=O(()=>{nYe();aYe();uYe();vge();cYe();fYe();mYe();gYe();bYe()});var _Ye,vYe=O(()=>{Sge();_Ye={booleanEquals:rYe,getAttr:LG,isSet:sYe,isValidHostLabel:X2,not:lYe,parseURL:dYe,stringEquals:pYe,substring:hYe,uriEncode:yYe}});var FG,xge=O(()=>{Sge();FG=(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(LG(n[u],l))}else r.push(n[s]);o=a+1}return r.join("")}});var wYe,SYe=O(()=>{wYe=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var RE,e4=O(()=>{gh();Cge();xge();SYe();RE=(t,e,r)=>{if(typeof t=="string")return FG(t,r);if(t.fn)return kG(t,r);if(t.ref)return wYe(t,r);throw new Ni(`'${e}': ${String(t)} is not a string, function or reference.`)}});var kG,Cge=O(()=>{NG();vYe();e4();kG=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:RE(i,"arg",r)),o=t.split(".");return o[0]in mC&&o[1]!=null?mC[o[0]][o[1]](...n):_Ye[t](...n)}});var xYe,CYe=O(()=>{Q2();gh();Cge();xYe=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new Ni(`'${t}' is already defined in Reference Record.`);let n=kG(e,r);return r.logger?.debug?.(`${hC} evaluateCondition: ${hh(e)} = ${hh(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var YL,$G=O(()=>{Q2();CYe();YL=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=xYe(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${hC} assign: ${i.name} := ${hh(i.value)}`))}return{result:!0,referenceRecord:r}}});var OYe,PYe=O(()=>{gh();e4();OYe=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=RE(i,"Header value entry",e);if(typeof a!="string")throw new Ni(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var Oge,EYe=O(()=>{gh();xge();Pge();Oge=(t,e)=>{if(Array.isArray(t))return t.map(r=>Oge(r,e));switch(typeof t){case"string":return FG(t,e);case"object":if(t===null)throw new Ni(`Unexpected endpoint property: ${t}`);return BG(t,e);case"boolean":return t;default:throw new Ni(`Unexpected endpoint property type: ${typeof t}`)}}});var BG,Pge=O(()=>{EYe();BG=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:Oge(o,e)}),{})});var TYe,AYe=O(()=>{gh();e4();TYe=(t,e)=>{let r=RE(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 Ni(`Endpoint URL must be a string, got ${typeof r}`)}});var IYe,MYe=O(()=>{Q2();$G();PYe();Pge();AYe();IYe=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=YL(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${hC} Resolving endpoint from template: ${hh(n)}`),{...l!=null&&{headers:OYe(l,a)},...u!=null&&{properties:BG(u,a)},url:TYe(s,a)}}});var RYe,jYe=O(()=>{gh();$G();e4();RYe=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=YL(r,e);if(o)throw new Ni(RE(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var DYe,NYe=O(()=>{$G();Ege();DYe=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=YL(r,e);if(o)return qG(n,{...e,referenceRecord:{...e.referenceRecord,...i}})}});var qG,Ege=O(()=>{gh();MYe();jYe();NYe();qG=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=IYe(r,e);if(n)return n}else if(r.type==="error")RYe(r,e);else if(r.type==="tree"){let n=DYe(r,e);if(n)return n}else throw new Ni(`Unknown endpoint rule: ${r}`);throw new Ni("Rules evaluation failed")}});var LYe=O(()=>{NG();Ege()});var t4,FYe=O(()=>{Q2();gh();LYe();t4=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${hC} Initial EndpointParams: ${hh(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 Ni(`Missing required parameter: '${l}'`);let u=qG(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?.(`${hC} Resolved endpoint: ${hh(u)}`),u}});var jE=O(()=>{_ge();vge();NG();FYe();gh()});var Tge=O(()=>{jE()});var Age,kYe=O(()=>{jE();Tge();Age=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!Age(r))return!1;return!0}return!(!X2(t)||t.length<3||t.length>63||t!==t.toLowerCase()||Z2(t))}});var $Ye,ror,BYe,qYe=O(()=>{$Ye=":",ror="/",BYe=t=>{let e=t.split($Ye);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join($Ye)==="")return null;let u=s.map(l=>l.split(ror)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var zYe,UYe=O(()=>{zYe={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 oor,ior,HYe,VYe,Ige=O(()=>{UYe();oor=zYe,ior="",HYe=t=>{let{partitions:e}=oor;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}},VYe=()=>ior});var r4,WYe=O(()=>{jE();kYe();qYe();Ige();r4={isVirtualHostableS3Bucket:Age,parseArn:BYe,partition:HYe};mC.aws=r4});var KYe=O(()=>{jE()});var JYe=O(()=>{jE()});var GYe=O(()=>{});var YYe=O(()=>{});var ZYe=O(()=>{});var XYe=O(()=>{});var QYe=O(()=>{});var eZe=O(()=>{JYe();GYe();YYe();ZYe();XYe();QYe()});var UG=O(()=>{WYe();Ige();Tge();KYe();eZe()});var tZe=O(()=>{});var rZe=O(()=>{tZe()});var nZe=O(()=>{Rs()});var oZe=O(()=>{});var iZe=O(()=>{});function aor(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var zG,aZe=O(()=>{zG=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=aor(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var sZe=O(()=>{});var uZe=O(()=>{});var lZe=O(()=>{});var cZe=O(()=>{rZe();nZe();oZe();iZe();aZe();sZe();uZe();lZe()});var Mge,HG,Rge,VG,dZe,fZe,jge,pZe=O(()=>{Mge="user-agent",HG="x-amz-user-agent",Rge=" ",VG="/",dZe=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,fZe=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,jge="-"});var sor,Dge,uor,WG,mZe=O(()=>{UG();cZe();pZe();sor=t=>(e,r)=>async n=>{let{request:o}=n;if(!zG.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map(Dge)||[],s=(await t.defaultUserAgentProvider()).map(Dge),u=t?.customUserAgent?.map(Dge)||[],l=VYe(),c=(l?[l]:[]).concat([...s,...a,...u]).join(Rge),d=[...s.filter(f=>f.startsWith("aws-sdk-")),...u].join(Rge);return t.runtime!=="browser"?(d&&(i[HG]=i[HG]?`${i[Mge]} ${d}`:d),i[Mge]=c):i[HG]=c,e({...n,request:o})},Dge=t=>{let e=t[0].split(VG).map(a=>a.replace(dZe,jge)).join(VG),r=t[1]?.replace(fZe,jge),n=e.indexOf(VG),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}`}},"")},uor={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},WG=t=>({applyToStack:e=>{e.add(sor(t),uor)}})});var Nge=O(()=>{W7e();mZe()});var hZe=O(()=>{});var gZe=O(()=>{});var KG,yZe=O(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(KG||(KG={}))});var Lge=O(()=>{hZe();gZe();yZe()});var JG,bZe=O(()=>{Lge();JG=!1});var GG,_Ze=O(()=>{Lge();GG=!1});var Bb,vZe=O(()=>{Rs();Bb=t=>t[GL]||(t[GL]={})});var Sd,wZe=O(()=>{Sd=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var Kg=O(()=>{vZe();wZe()});var SZe=O(()=>{Kg()});var xZe=O(()=>{});var CZe=O(()=>{Kg();xZe()});var OZe=O(()=>{bZe();_Ze();SZe();CZe()});var PZe=O(()=>{});var YG,Fge=O(()=>{YG=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var kge,EZe=O(()=>{Fge();kge=t=>YG(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var ZG,TZe=O(()=>{EZe();Fge();ZG=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return kge(e);let n=await e();return kge(n)},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return YG(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}}});var AZe=O(()=>{PZe();TZe()});var IZe=O(()=>{});var MZe=O(()=>{});var RZe=O(()=>{});var jZe=O(()=>{});var DZe=O(()=>{});var NZe=O(()=>{});var LZe=O(()=>{RZe();jZe();DZe();NZe()});var FZe=O(()=>{IZe();MZe();LZe()});var n4=O(()=>{OZe();AZe();FZe()});function cor(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var $ge,XG=O(()=>{Rs();Kg();$ge=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=cor(t.httpAuthSchemes),s=Bb(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 kZe,dor,por,mor,hor,gor,$Ze=O(()=>{kZe=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),gor(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!hor(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},dor=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,por=/(\d+\.){3}\d+/,mor=/\.\./,hor=t=>dor.test(t)&&!por.test(t)&&!mor.test(t),gor=t=>{let[e,r,n,,,o]=t.split(":"),i=e==="arn"&&t.split(":").length>=6,a=!!(i&&r&&n&&o);if(i&&!a)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return a}});var BZe=O(()=>{$Ze()});var qZe,UZe=O(()=>{qZe=(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 zZe,HZe=O(()=>{zZe=async t=>{}});function VZe(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 WZe=O(()=>{});var DE,QG=O(()=>{WZe();DE=t=>{if(typeof t=="string")return DE(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=VZe(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var e7,t7=O(()=>{QG();e7=t=>typeof t=="object"?"url"in t?DE(t.url):t:DE(t)});var KZe,yor,Bge=O(()=>{BZe();UZe();HZe();t7();KZe=async(t,e,r,n)=>{if(!r.endpoint){let a=await zZe(r.serviceId||"");a&&(r.endpoint=()=>Promise.resolve(e7(a)))}let o=await yor(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},yor=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 qZe(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 kZe(n),n}});var JZe=O(()=>{Bge();t7()});var GZe,qge=O(()=>{Kg();Bge();GZe=({config:t,instructions:e})=>(r,n)=>async o=>{let i=await KZe(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=Bb(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 YZe,Uge=O(()=>{YZe=(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 ZZe,zge=O(()=>{ZZe=(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 xt(t,e,r){return{applyToStack:n=>{n.add(YZe(t,r),bor),n.add(ZZe(t,e),o4)}}}var bor,o4,XZe=O(()=>{Uge();zge();bor={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},o4={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var Kn=O(()=>{Uge();XZe();zge()});var Hge,Ct,QZe=O(()=>{Kn();qge();Hge={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:o4.name},Ct=(t,e)=>({applyToStack:r=>{r.addRelativeTo(GZe({config:t,instructions:e}),Hge)}})});var r7,eXe=O(()=>{Kg();t7();r7=t=>{let e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>e7(await Sd(r)()):void 0;return{...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:Sd(t.useDualstackEndpoint??!1),useFipsEndpoint:Sd(t.useFipsEndpoint??!1)}}});var tXe=O(()=>{});var kn=O(()=>{JZe();qge();QZe();eXe();tXe()});var _or,n7,rXe=O(()=>{kn();XG();_or={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:Hge.name},n7=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo($ge(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),_or)}})});var wVn,nXe=O(()=>{Kn();XG();wVn={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:o4.name}});var oXe=O(()=>{XG();rXe();nXe()});var iXe=O(()=>{});var aXe=O(()=>{iXe()});var sXe=O(()=>{Rs()});var uXe=O(()=>{});var lXe=O(()=>{});function vor(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var wR,cXe=O(()=>{wR=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=vor(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var dXe=O(()=>{});var fXe=O(()=>{});var pXe=O(()=>{});var i4=O(()=>{aXe();sXe();uXe();lXe();cXe();dXe();fXe();pXe()});var wor,Sor,mXe,Vge=O(()=>{i4();Rs();Kg();wor=t=>e=>{throw e},Sor=(t,e)=>{},mXe=t=>(e,r)=>async n=>{if(!wR.isInstance(n.request))return e(n);let i=Bb(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||wor)(a));return(u.successHandler||Sor)(l.response,a),l}});var Jg,qb,a4,o7=O(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(Jg||(Jg={}));qb=3,a4=Jg.STANDARD});var hXe,gXe,yXe,bXe,_Xe=O(()=>{hXe=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],gXe=["TimeoutError","RequestTimeout","RequestTimeoutException"],yXe=[500,502,503,504],bXe=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"]});var xor,ZL,i7,vXe,s4=O(()=>{_Xe();xor=t=>t.$metadata?.clockSkewCorrected,ZL=t=>t.$metadata?.httpStatusCode===429||hXe.includes(t.name)||t.$retryable?.throttling==!0,i7=t=>xor(t)||gXe.includes(t.name)||bXe.includes(t?.code||"")||yXe.includes(t.$metadata?.httpStatusCode||0),vXe=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!i7(t)}return!1}});var u4,Wge=O(()=>{s4();u4=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(),ZL(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 a7,s7,XL=O(()=>{a7="amz-sdk-invocation-id",s7="amz-sdk-request"});var wXe,SXe=O(()=>{XL();wXe=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var Kge,xXe=O(()=>{XL();Kge=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var SR,l7=O(()=>{o7();XL();SXe();xXe();SR=class{constructor(e){this.maxAttempts=e,this.mode=Jg.STANDARD,this.capacity=500,this.retryBackoffStrategy=wXe(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return Kge({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,Kge({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 ${qb}`),qb}}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 c7,TXe=O(()=>{o7();Wge();l7();c7=class{constructor(e,r){this.maxAttemptsProvider=e,this.mode=Jg.ADAPTIVE;let{rateLimiter:n}=r??{};this.rateLimiter=n??new u4,this.standardRetryStrategy=new SR(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 AXe=O(()=>{XL();l7()});var IXe=O(()=>{});var Ub=O(()=>{TXe();AXe();Wge();l7();o7();XL();IXe()});var MXe=O(()=>{});var RXe=O(()=>{MXe()});var jXe=O(()=>{Rs()});var DXe=O(()=>{});var NXe=O(()=>{});function Cor(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var eF,LXe=O(()=>{eF=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Cor(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var l4,FXe=O(()=>{l4=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 kXe=O(()=>{});var $Xe=O(()=>{});var d7=O(()=>{RXe();jXe();DXe();NXe();LXe();FXe();kXe();$Xe()});var BXe=O(()=>{Ub()});var Gge=O(()=>{Ub()});var Yge=O(()=>{s4()});var Zge,Xge=O(()=>{Zge=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 Qge=O(()=>{d7();s4();Ub();BXe();Gge();Yge();Xge()});var qXe=O(()=>{Ub();Qge()});var f7,UXe=O(()=>{Kg();Ub();f7=t=>{let{retryStrategy:e}=t,r=Sd(t.maxAttempts??qb);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await Sd(t.retryMode)()===Jg.ADAPTIVE?new c7(r):new SR(r))}}});var zXe=O(()=>{d7();Ub()});var NE,HXe=O(()=>{NE=class{trace(){}debug(){}info(){}warn(){}error(){}}});var xR,LE,tF,VXe,WXe,KXe=O(()=>{xR=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},LE=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,tF=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>VXe[p.step]-VXe[f.step]||WXe[p.priority||"normal"]-WXe[f.priority||"normal"]),i=d=>{let f=!1,p=m=>{let h=xR(m.name,m.aliases);if(h.includes(d)){f=!0;for(let b of h)n.delete(b);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},a=d=>{let f=!1,p=m=>{if(m.middleware===d){f=!0;for(let h of xR(m.name,m.aliases))n.delete(h);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},s=d=>(t.forEach(f=>{d.add(f.middleware,{...f})}),e.forEach(f=>{d.addRelativeTo(f.middleware,{...f})}),d.identifyOnResolve?.(c.identifyOnResolve()),d),u=d=>{let f=[];return d.before.forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f.push(d),d.after.reverse().forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f},l=(d=!1)=>{let f=[],p=[],m={};return t.forEach(b=>{let g={...b,before:[],after:[]};for(let _ of xR(g.name,g.aliases))m[_]=g;f.push(g)}),e.forEach(b=>{let g={...b,before:[],after:[]};for(let _ of xR(g.name,g.aliases))m[_]=g;p.push(g)}),p.forEach(b=>{if(b.toMiddleware){let g=m[b.toMiddleware];if(g===void 0){if(d)return;throw new Error(`${b.toMiddleware} is not found when adding ${LE(b.name,b.aliases)} middleware ${b.relation} ${b.toMiddleware}`)}b.relation==="after"&&g.after.push(b),b.relation==="before"&&g.before.push(b)}}),o(f).map(u).reduce((b,g)=>(b.push(...g),b),[])},c={add:(d,f={})=>{let{name:p,override:m,aliases:h}=f,b={step:"initialize",priority:"normal",middleware:d,...f},g=xR(p,h);if(g.length>0){if(g.some(_=>n.has(_))){if(!m)throw new Error(`Duplicate middleware name '${LE(p,h)}'`);for(let _ of g){let w=t.findIndex(C=>C.name===_||C.aliases?.some(E=>E===_));if(w===-1)continue;let x=t[w];if(x.step!==b.step||b.priority!==x.priority)throw new Error(`"${LE(x.name,x.aliases)}" middleware with ${x.priority} priority in ${x.step} step cannot be overridden by "${LE(p,h)}" middleware with ${b.priority} priority in ${b.step} step.`);t.splice(w,1)}}for(let _ of g)n.add(_)}t.push(b)},addRelativeTo:(d,f)=>{let{name:p,override:m,aliases:h}=f,b={middleware:d,...f},g=xR(p,h);if(g.length>0){if(g.some(_=>n.has(_))){if(!m)throw new Error(`Duplicate middleware name '${LE(p,h)}'`);for(let _ of g){let w=e.findIndex(C=>C.name===_||C.aliases?.some(E=>E===_));if(w===-1)continue;let x=e[w];if(x.toMiddleware!==b.toMiddleware||x.relation!==b.relation)throw new Error(`"${LE(x.name,x.aliases)}" middleware ${x.relation} "${x.toMiddleware}" middleware cannot be overridden by "${LE(p,h)}" middleware ${b.relation} "${b.toMiddleware}" middleware.`);e.splice(w,1)}}for(let _ of g)n.add(_)}e.push(b)},clone:()=>s(tF()),use:d=>{d.applyToStack(c)},remove:d=>typeof d=="string"?i(d):a(d),removeByTag:d=>{let f=!1,p=m=>{let{tags:h,name:b,aliases:g}=m;if(h&&h.includes(d)){let _=xR(b,g);for(let w of _)n.delete(w);return f=!0,!1}return!0};return t=t.filter(p),e=e.filter(p),f},concat:d=>{let f=s(tF());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 LE(d.name,d.aliases)+" - "+f}),identifyOnResolve(d){return typeof d=="boolean"&&(r=d),r},resolve:(d,f)=>{for(let p of l().map(m=>m.middleware).reverse())d=p(d,f);return r&&console.log(c.identify()),d}};return c},VXe={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},WXe={high:3,normal:2,low:1}});var eye=O(()=>{KXe()});var CR,JXe=O(()=>{eye();CR=class{constructor(e){this.middlewareStack=tF(),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 gC,OR,FE,PR,GXe,tye=O(()=>{gC={},OR=new Array(64);for(let t=0,e=65,r=90;t+e<=r;t++){let n=String.fromCharCode(t+e);gC[n]=t,OR[t]=n}for(let t=0,e=97,r=122;t+e<=r;t++){let n=String.fromCharCode(t+e),o=t+26;gC[n]=o,OR[o]=n}for(let t=0;t<10;t++){gC[t.toString(10)]=t+52;let e=t.toString(10),r=t+52;gC[e]=r,OR[r]=e}gC["+"]=62;OR[62]="+";gC["/"]=63;OR[63]="/";FE=6,PR=8,GXe=63});var kE,YXe=O(()=>{tye();kE=t=>{let e=t.length/4*3;t.slice(-2)==="=="?e-=2:t.slice(-1)==="="&&e--;let r=new ArrayBuffer(e),n=new DataView(r);for(let o=0;o<t.length;o+=4){let i=0,a=0;for(let l=o,c=o+3;l<=c;l++)if(t[l]!=="="){if(!(t[l]in gC))throw new TypeError(`Invalid character ${t[l]} in base64 string.`);i|=gC[t[l]]<<(c-l)*FE,a+=FE}else i>>=FE;let s=o/4*3;i>>=a%PR;let u=Math.floor(a/PR);for(let l=0;l<u;l++){let c=(u-l-1)*PR;n.setUint8(s+l,(i&255<<c)>>c)}}return new Uint8Array(r)}});var rye,nye=O(()=>{rye=t=>new TextEncoder().encode(t)});var ZXe=O(()=>{nye()});var XXe=O(()=>{});var QXe=O(()=>{nye();ZXe();XXe()});function $E(t){let e;typeof t=="string"?e=rye(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)*PR,s+=PR;let u=Math.ceil(s/FE);a<<=u*FE-s;for(let l=1;l<=u;l++){let c=(u-l)*FE;o+=OR[(a&GXe<<c)>>c]}o+="==".slice(0,4-u)}return o}var eQe=O(()=>{QXe();tye()});var rF=O(()=>{YXe();eQe()});var oye,iye=O(()=>{oye=t=>new TextEncoder().encode(t)});var tQe=O(()=>{iye()});var p7,rQe=O(()=>{p7=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 aye=O(()=>{iye();tQe();rQe()});function nQe(t,e="utf-8"){return e==="base64"?$E(t):p7(t)}function oQe(t,e){return e==="base64"?yC.mutate(kE(t)):yC.mutate(oye(t))}var iQe=O(()=>{rF();aye();sye()});var yC,sye=O(()=>{iQe();yC=class t extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return oQe(e,r);default:throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(e){return Object.setPrototypeOf(e,t.prototype),e}transformToString(e="utf-8"){return nQe(this,e)}}});var aQe=O(()=>{});var sQe=O(()=>{});var uQe=O(()=>{sQe()});var lQe=O(()=>{Rs()});var cQe=O(()=>{});var dQe=O(()=>{});var fQe=O(()=>{});var c4,pQe=O(()=>{c4=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 mQe=O(()=>{});var hQe=O(()=>{});var gQe=O(()=>{uQe();lQe();cQe();dQe();fQe();pQe();mQe();hQe()});var yh,Oor,uye=O(()=>{yh=t=>encodeURIComponent(t).replace(/[!'()*]/g,Oor),Oor=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var yQe=O(()=>{uye()});var m7=O(()=>{uye();yQe()});function bQe(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=yh(r),Array.isArray(n))for(let o=0,i=n.length;o<i;o++)e.push(`${r}=${yh(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${yh(n)}`),e.push(o)}}return e.join("&")}var _Qe=O(()=>{m7()});function vQe(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 wQe=O(()=>{});var lye,BE,SQe=O(()=>{gQe();_Qe();wQe();lye={supported:void 0},BE=class t{static create(e){return typeof e?.handle=="function"?e:new t(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(r=>r||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),lye.supported===void 0&&(lye.supported=typeof Request<"u"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(e,{abortSignal:r}={}){this.config||(this.config=await this.configProvider);let n=this.config.requestTimeout,o=this.config.keepAlive===!0,i=this.config.credentials;if(r?.aborted){let g=new Error("Request aborted");return g.name="AbortError",Promise.reject(g)}let a=e.path,s=bQe(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),lye.supported&&(p.keepalive=o);let m=()=>{},h=new Request(d,p),b=[fetch(h).then(g=>{let _=g.headers,w={};for(let C of _.entries())w[C[0]]=C[1];return g.body!=null?{response:new c4({headers:w,reason:g.statusText,statusCode:g.status,body:g.body})}:g.blob().then(C=>({response:new c4({headers:w,reason:g.statusText,statusCode:g.status,body:C})}))}),vQe(n)];return r&&b.push(new Promise((g,_)=>{let w=()=>{let x=new Error("Request aborted");x.name="AbortError",_(x)};if(typeof r.addEventListener=="function"){let x=r;x.addEventListener("abort",w,{once:!0}),m=()=>x.removeEventListener("abort",w)}else r.onabort=w})),Promise.race(b).finally(m)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}});async function Por(t){let e=await Tor(t),r=kE(e);return new Uint8Array(r)}async function Eor(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 Tor(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 nF,xQe=O(()=>{rF();nF=t=>typeof Blob=="function"&&t instanceof Blob?Por(t):Eor(t)});var d4=O(()=>{SQe();xQe()});function OQe(t){let e="";for(let r=0;r<t.byteLength;r++)e+=CQe[t[r]];return e}var CQe,Aor,PQe=O(()=>{CQe={},Aor={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),CQe[t]=e,Aor[e]=t}});var cye,dye=O(()=>{cye=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var EQe,AQe,TQe,IQe=O(()=>{d4();rF();PQe();aye();dye();EQe="The stream has already been transformed.",AQe=t=>{if(!TQe(t)&&!cye(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(EQe);return e=!0,await nF(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 $E(i);if(o==="hex")return OQe(i);if(o===void 0||o==="utf8"||o==="utf-8")return p7(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(EQe);if(e=!0,TQe(t))return n(t);if(cye(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},TQe=t=>typeof Blob=="function"&&t instanceof Blob});var MQe=O(()=>{});var RQe=O(()=>{});var fye=O(()=>{sye();aQe();IQe();MQe();RQe();dye()});var qE,jQe=O(()=>{fye();qE=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return yC.mutate(t);if(!t)return yC.mutate(new Uint8Array);let r=e.streamCollector(t);return yC.mutate(await r)}});var yt,pye,DQe=O(()=>{eye();Rs();yt=class{constructor(){this.middlewareStack=tF()}static classBuilder(){return new pye}resolveMiddlewareWithContext(e,r,n,{middlewareFn:o,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,smithyContext:l,additionalContext:c,CommandCtor:d}){for(let b of o.bind(this)(d,e,r,n))this.middlewareStack.use(b);let f=e.concat(this.middlewareStack),{logger:p}=r,m={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,[GL]:{commandInstance:this,...l},...c},{requestHandler:h}=r;return f.resolve(b=>h.handle(b.request,n||{}),m)}},pye=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 yt{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 h7,NQe=O(()=>{h7="***SensitiveInformation***"});var g7,LQe=O(()=>{g7=(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 ER,Ior,FQe,Mor,kQe,$Qe,BQe,mye,Ror,oF,an,qQe,UQe,jor,f4,p4,hye,zQe,HQe,VQe,gye=O(()=>{ER=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&VQe.warn(HQe(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},Ior=Math.ceil(34028234663852886e22),FQe=t=>{let e=ER(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>Ior)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},Mor=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},kQe=t=>mye(t,32),$Qe=t=>mye(t,16),BQe=t=>mye(t,8),mye=(t,e)=>{let r=Mor(t);if(r!==void 0&&Ror(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},Ror=(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]}},oF=(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},an=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return VQe.warn(HQe(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},qQe=t=>ER(typeof t=="string"?f4(t):t),UQe=t=>FQe(typeof t=="string"?f4(t):t),jor=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,f4=t=>{let e=t.match(jor);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},p4=t=>kQe(typeof t=="string"?f4(t):t),hye=t=>$Qe(typeof t=="string"?f4(t):t),zQe=t=>BQe(typeof t=="string"?f4(t):t),HQe=t=>String(new TypeError(t).stack||t).split(`
`).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
`),VQe={warn:console.warn}});var Dor,Nor,WQe,Lor,KQe,hWn,gWn,yWn,y7,JQe,bWn,For,kor,$or,TR,Bor,qor,yye,GQe=O(()=>{gye();Dor=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Nor=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),WQe=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Nor.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=hye(yye(n)),d=TR(o,"month",1,12),f=TR(i,"day",1,31);return JQe(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},Lor=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),KQe=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Lor.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=hye(yye(n)),f=TR(o,"month",1,12),p=TR(i,"day",1,31),m=JQe(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&m.setTime(m.getTime()-qor(c)),m},hWn=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$/),gWn=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$/),yWn=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})$/),y7=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=qQe(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))},JQe=(t,e,r,n)=>{let o=e-1;return kor(t,o,r),new Date(Date.UTC(t,o,r,TR(n.hours,"hour",0,23),TR(n.minutes,"minute",0,59),TR(n.seconds,"seconds",0,60),Bor(n.fractionalMilliseconds)))},bWn=50*365*24*60*60*1e3,For=[31,28,31,30,31,30,31,31,30,31,30,31],kor=(t,e,r)=>{let n=For[e];if(e===1&&$or(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${Dor[e]} in ${t}: ${r}`)},$or=t=>t%4===0&&(t%100!==0||t%400===0),TR=(t,e,r,n)=>{let o=zQe(yye(t));if(o<r||o>n)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},Bor=t=>t==null?0:UQe("0."+t)*1e3,qor=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},yye=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var iF,Ra,bye=O(()=>{iF=class t extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,t.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}},Ra=(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 Uor,b7,zor,YQe=O(()=>{bye();Uor=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{let o=zor(t),i=o.httpStatusCode?o.httpStatusCode+"":void 0,a=new r({name:e?.code||e?.Code||n||i||"UnknownError",$fault:"client",$metadata:o});throw Ra(a,e)},b7=t=>({output:e,parsedBody:r,errorCode:n})=>{Uor({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},zor=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 _7,ZQe=O(()=>{_7=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 XQe=O(()=>{});var QQe,eet,tet=O(()=>{Rs();QQe=t=>{let e=[];for(let r in JL){let n=JL[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}}},eet=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var ret,net,oet=O(()=>{ret=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},net=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var v7,w7,iet=O(()=>{tet();oet();v7=t=>({...QQe(t),...ret(t)}),w7=t=>({...eet(t),...net(t)})});var aet=O(()=>{iet()});function S7(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var _ye=O(()=>{});var set=O(()=>{});var vye,uet=O(()=>{vye=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]=vye(t[r]));return t}});var wye,cet=O(()=>{wye=function(){let t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};wye.prototype=Object.create(String.prototype,{constructor:{value:wye,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(wye,String)});var m4,Hor,Vor,Wor,det=O(()=>{m4=(t,e)=>{let r={};for(let n in e)Hor(r,t,e,n);return r},Hor=(t,e,r,n)=>{if(e!==null){let a=r[n];typeof a=="function"&&(a=[,a]);let[s=Vor,u=Wor,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)}},Vor=t=>t!=null,Wor=t=>t});var fet=O(()=>{_ye()});var pet=O(()=>{});var Gt,met=O(()=>{Gt=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(Gt);if(typeof t=="object"){let e={};for(let r of Object.keys(t))t[r]!=null&&(e[r]=Gt(t[r]));return e}return t}});var het=O(()=>{});var Qt=O(()=>{HXe();JXe();jQe();DQe();NQe();LQe();GQe();YQe();ZQe();XQe();aet();bye();_ye();set();uet();cet();det();gye();fet();pet();met();het()});var get,yet=O(()=>{get=t=>t?.body instanceof ReadableStream});var Kor,Jor,Gor,Yor,Sye,x7,Zor,bet=O(()=>{d7();s4();Qt();Ub();iW();yet();Xge();Kor=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(Jor(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=eF.isInstance(c);for(d&&(c.headers[a7]=GI());;)try{d&&(c.headers[s7]=`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=Gor(f);if(s=Zge(f),d&&get(c))throw(r.logger instanceof NE?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),s;try{a=await o.refreshRetryTokenForRetry(a,p)}catch{throw s.$metadata||(s.$metadata={}),s.$metadata.attempts=u+1,s.$metadata.totalRetryDelay=l,s}u=a.getRetryCount();let m=a.getRetryDelay();l+=m,await new Promise(h=>setTimeout(h,m))}}else return o=o,o?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",o.mode]]),o.retry(e,n)},Jor=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",Gor=t=>{let e={error:t,errorType:Yor(t)},r=Zor(t.$response);return r&&(e.retryAfterHint=r),e},Yor=t=>ZL(t)?"THROTTLING":i7(t)?"TRANSIENT":vXe(t)?"SERVER_ERROR":"CLIENT_ERROR",Sye={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},x7=t=>({applyToStack:e=>{e.add(Kor(t),Sye)}}),Zor=t=>{if(!l4.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 C7=O(()=>{qXe();Qge();UXe();Gge();zXe();Yge();bet()});var Xor,O7,_et=O(()=>{C7();Vge();Xor={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:Sye.name},O7=t=>({applyToStack:e=>{e.addRelativeTo(mXe(t),Xor)}})});var vet=O(()=>{Vge();_et()});var aF,wet=O(()=>{aF=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 xet=O(()=>{i4();Rs()});var Cet=O(()=>{i4()});var sF,Oet=O(()=>{sF=class{async sign(e,r,n){return e}}});var Pet=O(()=>{xet();Cet();Oet()});var Qor,Eet,xye,Tet,Aet=O(()=>{Qor=t=>e=>xye(e)&&e.expiration.getTime()-Date.now()<t,Eet=Qor(3e5),xye=t=>t.expiration!==void 0,Tet=(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 Iet=O(()=>{wet();Pet();Aet()});var Met=O(()=>{Rs()});var uF,Ret=O(()=>{uF=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var jet=O(()=>{i4();Qt()});function Cye(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 eir(e,a.client,s,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield d;let f=l;l=tir(d,n),c=!!(l&&(!a.stopOnSameToken||l!==f))}return void 0}}var eir,tir,Det=O(()=>{eir=async(t,e,r,...n)=>await e.send(new t(r),...n);tir=(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 UE=O(()=>{oXe();vet();Iet();Met();Ret();jet();Det()});var Net=O(()=>{});var Let=O(()=>{Net()});var Fet=O(()=>{Rs()});var ket=O(()=>{});var $et=O(()=>{});function rir(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var P7,Bet=O(()=>{P7=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=rir(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var qet=O(()=>{});var Uet=O(()=>{});var zet=O(()=>{});var Het=O(()=>{Let();Fet();ket();$et();Bet();qet();Uet();zet()});function nir(t){return e=>async r=>{let n=r.request;if(P7.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(Vet)===-1)try{let a=t(o);n.headers={...n.headers,[Vet]:String(a)}}catch{}}return e({...r,request:n})}}var Vet,oir,E7,Oye=O(()=>{Het();Vet="content-length";oir={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},E7=t=>({applyToStack:e=>{e.add(nir(t.bodyLengthChecker),oir)}})});var Wet=O(()=>{});var Ket=O(()=>{Wet()});var Jet=O(()=>{});var Get=O(()=>{Jet()});var Yet=O(()=>{Rs()});var Zet=O(()=>{});var Xet=O(()=>{});function iir(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var zE,Qet=O(()=>{zE=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=iir(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var T7,ett=O(()=>{T7=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 ttt=O(()=>{});var rtt=O(()=>{});var h4=O(()=>{Get();Yet();Zet();Xet();Qet();ett();ttt();rtt()});var Pye,ntt=O(()=>{h4();Pye=t=>T7.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var A7,Eye=O(()=>{A7=t=>new Date(Date.now()+t)});var ott,itt=O(()=>{Eye();ott=(t,e)=>Math.abs(A7(e).getTime()-t)>=3e5});var Tye,att=O(()=>{itt();Tye=(t,e)=>{let r=Date.parse(t);return ott(r,e)?r-Date.now():e}});var stt=O(()=>{ntt();Eye();att()});var g4,utt,AR,ltt=O(()=>{h4();stt();g4=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},utt=async t=>{let e=g4("context",t.context),r=g4("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await g4("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},AR=class{async sign(e,r,n){if(!zE.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await utt(n),{config:i,signer:a}=o,{signingRegion:s,signingName:u}=o,l=n.context;if(l?.authSchemes?.length??!1){let[d,f]=l.authSchemes;d?.name==="sigv4a"&&f?.name==="sigv4"&&(s=f?.signingRegion??s,u=f?.signingName??u)}return await a.sign(e,{signingDate:A7(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??Pye(r.$response);if(n){let o=g4("config",e.config),i=o.systemClockOffset;o.systemClockOffset=Tye(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=Pye(e);if(n){let o=g4("config",r.config);o.systemClockOffset=Tye(n,o.systemClockOffset)}}}});var ctt=O(()=>{UE();pC()});function ftt(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 Aye)e[r/2]=Aye[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function Gg(t){let e="";for(let r=0;r<t.byteLength;r++)e+=dtt[t[r]];return e}var dtt,Aye,y4=O(()=>{dtt={},Aye={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),dtt[t]=e,Aye[e]=t}});var b4,Iye=O(()=>{b4=t=>new TextEncoder().encode(t)});var HE,ptt=O(()=>{Iye();HE=t=>typeof t=="string"?b4(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var mtt=O(()=>{});var _4=O(()=>{Iye();ptt();mtt()});var htt,gtt,Mye,ytt,btt,Rye,jye,Dye,Nye,air,_tt,vtt,v4,wtt,Stt,xtt,Ctt,I7,Ott,Ptt,Ett,Lye,Ttt,IR=O(()=>{htt="X-Amz-Algorithm",gtt="X-Amz-Credential",Mye="X-Amz-Date",ytt="X-Amz-SignedHeaders",btt="X-Amz-Expires",Rye="X-Amz-Signature",jye="X-Amz-Security-Token",Dye="authorization",Nye=Mye.toLowerCase(),air="date",_tt=[Dye,Nye,air],vtt=Rye.toLowerCase(),v4="x-amz-content-sha256",wtt=jye.toLowerCase(),Stt={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},xtt=/^proxy-/,Ctt=/^sec-/,I7="AWS4-HMAC-SHA256",Ott="AWS4-HMAC-SHA256-PAYLOAD",Ptt="UNSIGNED-PAYLOAD",Ett=50,Lye="aws4_request",Ttt=60*60*24*7});var M7,Fye,R7,Itt,Att,kye=O(()=>{y4();_4();IR();M7={},Fye=[],R7=(t,e,r)=>`${t}/${e}/${r}/${Lye}`,Itt=async(t,e,r,n,o)=>{let i=await Att(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${Gg(i)}:${e.sessionToken}`;if(a in M7)return M7[a];for(Fye.push(a);Fye.length>Ett;)delete M7[Fye.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,Lye])s=await Att(t,s,u);return M7[a]=s},Att=(t,e,r)=>{let n=new t(e);return n.update(HE(r)),n.digest()}});var j7,$ye=O(()=>{IR();j7=({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 Stt||e?.has(i)||xtt.test(i)||Ctt.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var Bye,qye=O(()=>{m7();IR();Bye=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===vtt)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${yh(n)}=${yh(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).reduce((i,a)=>i.concat([`${yh(n)}=${yh(a)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")}});var Mtt,Rtt=O(()=>{Mtt=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var w4,Uye=O(()=>{Rtt();y4();_4();IR();w4=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===v4)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||Mtt(e)){let n=new r;return n.update(HE(e)),Gg(await n.digest())}return Ptt}});function Dtt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var D7,jtt,sir,zye,Ntt=O(()=>{y4();_4();D7=class{format(e){let r=[];for(let i of Object.keys(e)){let a=b4(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=b4(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(zye.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!sir.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(ftt(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"})(jtt||(jtt={}));sir=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,zye=class t{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let n=7,o=Math.abs(Math.round(e));n>-1&&o>0;n--,o/=256)r[n]=o;return e<0&&Dtt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&Dtt(e),parseInt(Gg(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var Ltt,Ftt=O(()=>{Ltt=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var Hye,Vye=O(()=>{h4();Hye=(t,e={})=>{let{headers:r,query:n={}}=zE.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 N7,Wye=O(()=>{h4();IR();N7=t=>{t=zE.clone(t);for(let e of Object.keys(t.headers))_tt.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var ktt,uir,$tt=O(()=>{ktt=t=>uir(t).toISOString().replace(/\.\d{3}Z$/,"Z"),uir=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var S4,L7,Btt,qtt=O(()=>{y4();Kg();m7();_4();IR();kye();$ye();qye();Uye();Ntt();Ftt();Vye();Wye();$tt();S4=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new D7,this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=Sd(n),this.credentialProvider=Sd(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}=L7(n);if(o>Ttt)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=R7(p,d,l??this.service),h=Hye(N7(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[jye]=c.sessionToken),h.query[htt]=I7,h.query[gtt]=`${c.accessKeyId}/${m}`,h.query[Mye]=f,h.query[btt]=o.toString(10);let b=j7(h,i,s);return h.query[ytt]=Btt(b),h.query[Rye]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,b,await w4(e,this.sha256))),h}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=L7(n),c=R7(u,s,a??this.service),d=await w4({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=Gg(await f.digest()),m=[Ott,l,c,o,p,d].join(`
`);return this.signString(m,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=L7(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update(HE(e)),Gg(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=N7(e),{longDate:c,shortDate:d}=L7(r),f=R7(d,u,a??this.service);l.headers[Nye]=c,s.sessionToken&&(l.headers[wtt]=s.sessionToken);let p=await w4(l,this.sha256);!Ltt(v4,l.headers)&&this.applyChecksum&&(l.headers[v4]=p);let m=j7(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[Dye]=`${I7} Credential=${s.accessKeyId}/${f}, SignedHeaders=${Btt(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${Bye(e)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}
${o.join(";")}
${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update(HE(n));let i=await o.digest();return`${I7}
${e}
${r}
${Gg(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let r=[];for(let i of e.split("/"))i?.length!==0&&i!=="."&&(i===".."?r.pop():r.push(i));let n=`${e?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&e?.endsWith("/")?"/":""}`;return yh(n).replace(/%2F/g,"/")}return e}async getSignature(e,r,n,o){let i=await this.createStringToSign(e,r,o),a=new this.sha256(await n);return a.update(HE(i)),Gg(await a.digest())}getSigningKey(e,r,n,o){return Itt(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")}},L7=t=>{let e=ktt(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},Btt=t=>Object.keys(t).sort().join(";")});var Utt=O(()=>{qtt();$ye();qye();Uye();Vye();Wye();kye()});var F7,ztt=O(()=>{UE();Utt();F7=t=>{let e;t.credentials&&(e=Tet(t.credentials,Eet,xye)),e||(t.credentialDefaultProvider?e=uF(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=uF(t.signer):t.regionInfoProvider?i=()=>uF(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||S4;return new d(c)}):i=async a=>{a=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await uF(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||S4;return new c(l)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:i}}});var Htt=O(()=>{ltt();ctt();ztt()});var Vtt=O(()=>{Htt()});var Wtt=O(()=>{});var Ktt=O(()=>{Qt()});var k7,Kye=O(()=>{Qt();k7=(t,e)=>qE(t,e).then(r=>e.utf8Encoder(r))});var bs,Jtt,Gtt,Ytt=O(()=>{Kye();bs=(t,e)=>k7(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{}}),Jtt=async(t,e)=>{let r=await bs(t,e);return r.message=r.message??r.Message,r},Gtt=(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 $7=v(bC=>{"use strict";var Ztt=":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",lir=Ztt+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Xtt="["+Ztt+"]["+lir+"]*",cir=new RegExp("^"+Xtt+"$"),dir=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},fir=function(t){let e=cir.exec(t);return!(e===null||typeof e>"u")};bC.isExist=function(t){return typeof t<"u"};bC.isEmptyObject=function(t){return Object.keys(t).length===0};bC.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]]}};bC.getValue=function(t){return bC.isExist(t)?t:""};bC.isName=fir;bC.getAllMatches=dir;bC.nameRegexp=Xtt});var Gye=v(nrt=>{"use strict";var Jye=$7(),pir={allowBooleanAttributes:!1,unpairedTags:[]};nrt.validate=function(t,e){e=Object.assign({},pir,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=ert(t,i),i.err)return i}else if(t[i]==="<"){let a=i;if(i++,t[i]==="!"){i=trt(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--),!wir(u)){let d;return u.trim().length===0?d="Invalid space after '<'.":d="Tag '"+u+"' is an invalid name.",_s("InvalidTag",d,bf(t,i))}let l=gir(t,i);if(l===!1)return _s("InvalidAttr","Attributes for '"+u+"' have open quote.",bf(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=rrt(c,e);if(f===!0)n=!0;else return _s(f.err.code,f.err.msg,bf(t,d+f.err.line))}else if(s)if(l.tagClosed){if(c.trim().length>0)return _s("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",bf(t,a));if(r.length===0)return _s("InvalidTag","Closing tag '"+u+"' has not been opened.",bf(t,a));{let d=r.pop();if(u!==d.tagName){let f=bf(t,d.tagStartPos);return _s("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+u+"'.",bf(t,a))}r.length==0&&(o=!0)}}else return _s("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",bf(t,i));else{let d=rrt(c,e);if(d!==!0)return _s(d.err.code,d.err.msg,bf(t,i-c.length+d.err.line));if(o===!0)return _s("InvalidXml","Multiple possible root nodes found.",bf(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=trt(t,i);continue}else if(t[i+1]==="?"){if(i=ert(t,++i),i.err)return i}else break;else if(t[i]==="&"){let d=_ir(t,i);if(d==-1)return _s("InvalidChar","char '&' is not expected.",bf(t,i));i=d}else if(o===!0&&!Qtt(t[i]))return _s("InvalidXml","Extra text at the end",bf(t,i));t[i]==="<"&&i--}}else{if(Qtt(t[i]))continue;return _s("InvalidChar","char '"+t[i]+"' is not expected.",bf(t,i))}if(n){if(r.length==1)return _s("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",bf(t,r[0].tagStartPos));if(r.length>0)return _s("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return _s("InvalidXml","Start tag expected.",1);return!0};function Qtt(t){return t===" "||t===" "||t===`
`||t==="\r"}function ert(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 _s("InvalidXml","XML declaration allowed only at the start of the document.",bf(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function trt(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 mir='"',hir="'";function gir(t,e){let r="",n="",o=!1;for(;e<t.length;e++){if(t[e]===mir||t[e]===hir)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 yir=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function rrt(t,e){let r=Jye.getAllMatches(t,yir),n={};for(let o=0;o<r.length;o++){if(r[o][1].length===0)return _s("InvalidAttr","Attribute '"+r[o][2]+"' has no space in starting.",x4(r[o]));if(r[o][3]!==void 0&&r[o][4]===void 0)return _s("InvalidAttr","Attribute '"+r[o][2]+"' is without value.",x4(r[o]));if(r[o][3]===void 0&&!e.allowBooleanAttributes)return _s("InvalidAttr","boolean attribute '"+r[o][2]+"' is not allowed.",x4(r[o]));let i=r[o][2];if(!vir(i))return _s("InvalidAttr","Attribute '"+i+"' is an invalid name.",x4(r[o]));if(!n.hasOwnProperty(i))n[i]=1;else return _s("InvalidAttr","Attribute '"+i+"' is repeated.",x4(r[o]))}return!0}function bir(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 _ir(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,bir(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 _s(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function vir(t){return Jye.isName(t)}function wir(t){return Jye.isName(t)}function bf(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function x4(t){return t.startIndex+t[1].length}});var irt=v(Yye=>{var ort={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}},Sir=function(t){return Object.assign({},ort,t)};Yye.buildOptions=Sir;Yye.defaultOptions=ort});var srt=v((UGn,art)=>{"use strict";var Zye=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})}};art.exports=Zye});var lrt=v((zGn,urt)=>{var xir=$7();function Cir(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&&Eir(t,e))e+=7,[entityName,val,e]=Oir(t,e+1),val.indexOf("&")===-1&&(r[Mir(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(o&&Tir(t,e))e+=8;else if(o&&Air(t,e))e+=8;else if(o&&Iir(t,e))e+=9;else if(Pir)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 Oir(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 Pir(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function Eir(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 Tir(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 Air(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 Iir(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 Mir(t){if(xir.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}urt.exports=Cir});var drt=v((HGn,crt)=>{var Rir=/^[-+]?0x[a-fA-F0-9]+$/,jir=/^([\-\+])?(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 Dir={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Nir(t,e={}){if(e=Object.assign({},Dir,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&&Rir.test(r))return Number.parseInt(r,16);{let n=jir.exec(r);if(n){let o=n[1],i=n[2],a=Lir(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 Lir(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}crt.exports=Nir});var mrt=v((VGn,prt)=>{"use strict";var frt=$7(),C4=srt(),Fir=lrt(),kir=drt(),Xye=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=$ir,this.parseXml=Hir,this.parseTextData=Bir,this.resolveNameSpace=qir,this.buildAttributesMap=zir,this.isItStopNode=Jir,this.replaceEntitiesValue=Wir,this.readStopNodeData=Yir,this.saveTextToParentTag=Kir,this.addChild=Vir}};function $ir(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 Bir(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?ebe(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?ebe(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function qir(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 Uir=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function zir(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let n=frt.getAllMatches(t,Uir),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]=ebe(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 Hir=function(t){t=t.replace(/\r\n?/g,`
`);let e=new C4("!xml"),r=e,n="",o="";for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){let s=MR(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=Qye(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 C4(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=MR(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=Fir(t,i);this.docTypeEntities=s.entities,i=s.i}else if(t.substr(i+1,2)==="!["){let s=MR(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=Qye(t,i,this.options.removeNSPrefix),u=s.tagName,l=s.rawTagName,c=s.tagExp,d=s.attrExpPresent,f=s.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,o,!1));let p=r;if(p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(r=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==e.tagname&&(o+=o?"."+u:u),this.isItStopNode(this.options.stopNodes,o,u)){let m="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),i=s.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=s.closeIndex;else{let b=this.readStopNodeData(t,l,f+1);if(!b)throw new Error(`Unexpected end of ${l}`);i=b.i,m=b.tagContent}let h=new C4(u);u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),m&&(m=this.parseTextData(m,u,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),h.add(this.options.textNodeName,m),this.addChild(r,h,o)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));let m=new C4(u);u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),o=o.substr(0,o.lastIndexOf("."))}else{let m=new C4(u);this.tagsNodeStack.push(r),u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),r=m}n="",i=f}}else n+=t[i];return e.child};function Vir(t,e,r){let n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}var Wir=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 Kir(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 Jir(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 Gir(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 MR(t,e,r,n){let o=t.indexOf(e,r);if(o===-1)throw new Error(n);return o+e.length-1}function Qye(t,e,r,n=">"){let o=Gir(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 Yir(t,e,r){let n=r,o=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let i=MR(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=MR(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=MR(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=MR(t,"]]>",r,"StopNode is not closed.")-2;else{let i=Qye(t,r,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,r=i.closeIndex)}}function ebe(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:kir(t,r)}else return frt.isExist(t)?t:""}prt.exports=Xye});var yrt=v(grt=>{"use strict";function Zir(t,e){return hrt(t,e)}function hrt(t,e,r){let n,o={};for(let i=0;i<t.length;i++){let a=t[i],s=Xir(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=hrt(a[s],e,u),c=ear(l,e);a[":@"]?Qir(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 Xir(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function Qir(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 ear(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))}grt.prettify=Zir});var _rt=v((KGn,brt)=>{var{buildOptions:tar}=irt(),rar=mrt(),{prettify:nar}=yrt(),oar=Gye(),tbe=class{constructor(e){this.externalEntities={},this.options=tar(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=oar.validate(e,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new rar(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:nar(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}};brt.exports=tbe});var Crt=v((JGn,xrt)=>{var iar=`
`;function aar(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=iar),wrt(t,e,"",r)}function wrt(t,e,r,n){let o="",i=!1;for(let a=0;a<t.length;a++){let s=t[a],u=sar(s);if(u===void 0)continue;let l="";if(r.length===0?l=u:l=`${r}.${u}`,u===e.textNodeName){let m=s[u];uar(l,e)||(m=e.tagValueProcessor(u,m),m=Srt(m,e)),i&&(o+=n),o+=m,i=!1;continue}else if(u===e.cdataPropName){i&&(o+=n),o+=`<![CDATA[${s[u][0][e.textNodeName]}]]>`,i=!1;continue}else if(u===e.commentPropName){o+=n+`<!--${s[u][0][e.textNodeName]}-->`,i=!0;continue}else if(u[0]==="?"){let m=vrt(s[":@"],e),h=u==="?xml"?"":n,b=s[u][0][e.textNodeName];b=b.length!==0?" "+b:"",o+=h+`<${u}${b}${m}?>`,i=!0;continue}let c=n;c!==""&&(c+=e.indentBy);let d=vrt(s[":@"],e),f=n+`<${u}${d}`,p=wrt(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 sar(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 vrt(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=Srt(o,e),o===!0&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${o}"`}return r}function uar(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 Srt(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}xrt.exports=aar});var Prt=v((GGn,Ort)=>{"use strict";var lar=Crt(),car={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 VE(t){this.options=Object.assign({},car,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=par),this.processTextOrObjNode=dar,this.options.format?(this.indentate=far,this.tagEndChar=`>
`,this.newLine=`
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}VE.prototype.build=function(t){return this.options.preserveOrder?lar(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};VE.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}};VE.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 dar(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)}VE.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}};VE.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};VE.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}};VE.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 far(t){return this.options.indentBy.repeat(t)}function par(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}Ort.exports=VE});var Trt=v((YGn,Ert)=>{"use strict";var mar=Gye(),har=_rt(),gar=Prt();Ert.exports={XMLParser:har,XMLValidator:mar,XMLBuilder:gar}});var Art,zb,Irt,Mrt=O(()=>{Qt();Art=$(Trt());Kye();zb=(t,e)=>k7(t,e).then(r=>{if(r.length){let n=new Art.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]),vye(s)}return{}}),Irt=async(t,e)=>{let r=await zb(t,e);return r.Error&&(r.Error.message=r.Error.message??r.Error.Message),r}});var Rrt=O(()=>{Wtt();Ktt();Ytt();Mrt()});var RR=O(()=>{Ket();Vtt();Rrt()});function yar(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function B7(t){return{schemeId:"smithy.api#noAuth"}}var jrt,Drt,Nrt,rbe=O(()=>{RR();Kg();jrt=async(t,e,r)=>({operation:Bb(e).operation,region:await Sd(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});Drt=t=>{let e=[];switch(t.operation){case"GetCredentialsForIdentity":{e.push(B7(t));break}case"GetId":{e.push(B7(t));break}case"GetOpenIdToken":{e.push(B7(t));break}case"UnlinkIdentity":{e.push(B7(t));break}default:e.push(yar(t))}return e},Nrt=t=>({...F7(t)})});var Lrt,br,Ji=O(()=>{Lrt=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),br={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var krt,Frt=O(()=>{krt={name:"@aws-sdk/client-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 nbe,obe,$rt,Brt=O(()=>{nbe={name:"SHA-256"},obe={name:"HMAC",hash:nbe},$rt=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 lF(){return typeof window<"u"?window:typeof self<"u"?self:_ar}var _ar,ibe=O(()=>{_ar={}});var cF,abe,sbe=O(()=>{cF=$(CG());Brt();ibe();abe=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,cF.isEmptyData)(e)){var r=(0,cF.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 lF().crypto.subtle.sign(obe,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,cF.isEmptyData)(this.toHash)?Promise.resolve($rt):Promise.resolve().then(function(){return lF().crypto.subtle.digest(nbe,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){lF().crypto.subtle.importKey("raw",(0,cF.convertToBuffer)(e.secret),obe,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function qrt(t){if(Sar(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return xar(e)}return!1}function Sar(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function xar(t){return t&&war.every(function(e){return typeof t[e]=="function"})}var war,Urt=O(()=>{war=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var zrt=O(()=>{Urt()});var Hrt,Vrt,q7,Wrt=O(()=>{sbe();Hrt=$(fge());zrt();ibe();Vrt=$(CG()),q7=function(){function t(e){qrt(lF())?this.hash=new abe(e):this.hash=new Hrt.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,Vrt.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var ube=O(()=>{Wrt();sbe()});var cbe=v((O4,lbe)=>{(function(t,e){typeof O4=="object"&&typeof lbe=="object"?lbe.exports=e():typeof define=="function"&&define.amd?define([],e):typeof O4=="object"?O4.bowser=e():t.bowser=e()})(O4,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(n,o,i){r.o(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:i})},r.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,o){if(1&o&&(n=r(n)),8&o||4&o&&typeof n=="object"&&n&&n.__esModule)return n;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&o&&typeof n!="string")for(var a in n)r.d(i,a,function(s){return n[s]}.bind(null,a));return i},r.n=function(n){var o=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(o,"a",o),o},r.o=function(n,o){return Object.prototype.hasOwnProperty.call(n,o)},r.p="",r(r.s=90)}({17:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=r(18),o=function(){function i(){}return i.getFirstMatch=function(a,s){var u=s.match(a);return u&&u.length>0&&u[1]||""},i.getSecondMatch=function(a,s){var u=s.match(a);return u&&u.length>1&&u[2]||""},i.matchAndReturnConst=function(a,s,u){if(a.test(s))return u},i.getWindowsVersionName=function(a){switch(a){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},i.getMacOSVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),s[0]===10)switch(s[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},i.getAndroidVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),!(s[0]===1&&s[1]<5))return s[0]===1&&s[1]<6?"Cupcake":s[0]===1&&s[1]>=6?"Donut":s[0]===2&&s[1]<2?"Eclair":s[0]===2&&s[1]===2?"Froyo":s[0]===2&&s[1]>2?"Gingerbread":s[0]===3?"Honeycomb":s[0]===4&&s[1]<1?"Ice Cream Sandwich":s[0]===4&&s[1]<4?"Jelly Bean":s[0]===4&&s[1]>=4?"KitKat":s[0]===5?"Lollipop":s[0]===6?"Marshmallow":s[0]===7?"Nougat":s[0]===8?"Oreo":s[0]===9?"Pie":void 0},i.getVersionPrecision=function(a){return a.split(".").length},i.compareVersions=function(a,s,u){u===void 0&&(u=!1);var l=i.getVersionPrecision(a),c=i.getVersionPrecision(s),d=Math.max(l,c),f=0,p=i.map([a,s],function(m){var h=d-i.getVersionPrecision(m),b=m+new Array(h+1).join(".0");return i.map(b.split("."),function(g){return new Array(20-g.length).join("0")+g}).reverse()});for(u&&(f=d-Math.min(l,c)),d-=1;d>=f;){if(p[0][d]>p[1][d])return 1;if(p[0][d]===p[1][d]){if(d===f)return 0;d-=1}else if(p[0][d]<p[1][d])return-1}},i.map=function(a,s){var u,l=[];if(Array.prototype.map)return Array.prototype.map.call(a,s);for(u=0;u<a.length;u+=1)l.push(s(a[u]));return l},i.find=function(a,s){var u,l;if(Array.prototype.find)return Array.prototype.find.call(a,s);for(u=0,l=a.length;u<l;u+=1){var c=a[u];if(s(c,u))return c}},i.assign=function(a){for(var s,u,l=a,c=arguments.length,d=new Array(c>1?c-1:0),f=1;f<c;f++)d[f-1]=arguments[f];if(Object.assign)return Object.assign.apply(Object,[a].concat(d));var p=function(){var m=d[s];typeof m=="object"&&m!==null&&Object.keys(m).forEach(function(h){l[h]=m[h]})};for(s=0,u=d.length;s<u;s+=1)p();return a},i.getBrowserAlias=function(a){return n.BROWSER_ALIASES_MAP[a]},i.getBrowserTypeByAlias=function(a){return n.BROWSER_MAP[a]||""},i}();e.default=o,t.exports=e.default},18:function(t,e,r){"use strict";e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(91))&&n.__esModule?n:{default:n},i=r(18);function a(u,l){for(var c=0;c<l.length;c++){var d=l[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(u,d.key,d)}}var s=function(){function u(){}var l,c,d;return u.getParser=function(f,p){if(p===void 0&&(p=!1),typeof f!="string")throw new Error("UserAgent should be a string");return new o.default(f,p)},u.parse=function(f){return new o.default(f).getResult()},l=u,d=[{key:"BROWSER_MAP",get:function(){return i.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return i.ENGINE_MAP}},{key:"OS_MAP",get:function(){return i.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return i.PLATFORMS_MAP}}],(c=null)&&a(l.prototype,c),d&&a(l,d),u}();e.default=s,t.exports=e.default},91:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=u(r(92)),o=u(r(93)),i=u(r(94)),a=u(r(95)),s=u(r(17));function u(c){return c&&c.__esModule?c:{default:c}}var l=function(){function c(f,p){if(p===void 0&&(p=!1),f==null||f==="")throw new Error("UserAgent parameter can't be empty");this._ua=f,this.parsedResult={},p!==!0&&this.parse()}var d=c.prototype;return d.getUA=function(){return this._ua},d.test=function(f){return f.test(this._ua)},d.parseBrowser=function(){var f=this;this.parsedResult.browser={};var p=s.default.find(n.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.browser=p.describe(this.getUA())),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(f){return f?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var f=this;this.parsedResult.os={};var p=s.default.find(o.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.os=p.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(f){var p=this.getOS().name;return f?String(p).toLowerCase()||"":p||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(f){f===void 0&&(f=!1);var p=this.getPlatform().type;return f?String(p).toLowerCase()||"":p||""},d.parsePlatform=function(){var f=this;this.parsedResult.platform={};var p=s.default.find(i.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.platform=p.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(f){return f?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var f=this;this.parsedResult.engine={};var p=s.default.find(a.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.engine=p.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return s.default.assign({},this.parsedResult)},d.satisfies=function(f){var p=this,m={},h=0,b={},g=0;if(Object.keys(f).forEach(function(I){var R=f[I];typeof R=="string"?(b[I]=R,g+=1):typeof R=="object"&&(m[I]=R,h+=1)}),h>0){var _=Object.keys(m),w=s.default.find(_,function(I){return p.isOS(I)});if(w){var x=this.satisfies(m[w]);if(x!==void 0)return x}var C=s.default.find(_,function(I){return p.isPlatform(I)});if(C){var E=this.satisfies(m[C]);if(E!==void 0)return E}}if(g>0){var P=Object.keys(b),A=s.default.find(P,function(I){return p.isBrowser(I,!0)});if(A!==void 0)return this.compareVersion(b[A])}},d.isBrowser=function(f,p){p===void 0&&(p=!1);var m=this.getBrowserName().toLowerCase(),h=f.toLowerCase(),b=s.default.getBrowserTypeByAlias(h);return p&&b&&(h=b.toLowerCase()),h===m},d.compareVersion=function(f){var p=[0],m=f,h=!1,b=this.getBrowserVersion();if(typeof b=="string")return f[0]===">"||f[0]==="<"?(m=f.substr(1),f[1]==="="?(h=!0,m=f.substr(2)):p=[],f[0]===">"?p.push(1):p.push(-1)):f[0]==="="?m=f.substr(1):f[0]==="~"&&(h=!0,m=f.substr(1)),p.indexOf(s.default.compareVersions(b,m,h))>-1},d.isOS=function(f){return this.getOSName(!0)===String(f).toLowerCase()},d.isPlatform=function(f){return this.getPlatformType(!0)===String(f).toLowerCase()},d.isEngine=function(f){return this.getEngineName(!0)===String(f).toLowerCase()},d.is=function(f,p){return p===void 0&&(p=!1),this.isBrowser(f,p)||this.isOS(f)||this.isPlatform(f)},d.some=function(f){var p=this;return f===void 0&&(f=[]),f.some(function(m){return p.is(m)})},c}();e.default=l,t.exports=e.default},92:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(s){var u={name:"Googlebot"},l=o.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/opera/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opr\/|opios/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/SamsungBrowser/i],describe:function(s){var u={name:"Samsung Internet for Android"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Whale/i],describe:function(s){var u={name:"NAVER Whale Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MZBrowser/i],describe:function(s){var u={name:"MZ Browser"},l=o.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/focus/i],describe:function(s){var u={name:"Focus"},l=o.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/swing/i],describe:function(s){var u={name:"Swing"},l=o.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/coast/i],describe:function(s){var u={name:"Opera Coast"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(s){var u={name:"Opera Touch"},l=o.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/yabrowser/i],describe:function(s){var u={name:"Yandex Browser"},l=o.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/ucbrowser/i],describe:function(s){var u={name:"UC Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Maxthon|mxios/i],describe:function(s){var u={name:"Maxthon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/epiphany/i],describe:function(s){var u={name:"Epiphany"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/puffin/i],describe:function(s){var u={name:"Puffin"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sleipnir/i],describe:function(s){var u={name:"Sleipnir"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/k-meleon/i],describe:function(s){var u={name:"K-Meleon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/micromessenger/i],describe:function(s){var u={name:"WeChat"},l=o.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qqbrowser/i],describe:function(s){var u={name:/qqbrowserlite/i.test(s)?"QQ Browser Lite":"QQ Browser"},l=o.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/msie|trident/i],describe:function(s){var u={name:"Internet Explorer"},l=o.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/\sedg\//i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/edg([ea]|ios)/i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/vivaldi/i],describe:function(s){var u={name:"Vivaldi"},l=o.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/seamonkey/i],describe:function(s){var u={name:"SeaMonkey"},l=o.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sailfish/i],describe:function(s){var u={name:"Sailfish"},l=o.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,s);return l&&(u.version=l),u}},{test:[/silk/i],describe:function(s){var u={name:"Amazon Silk"},l=o.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/phantom/i],describe:function(s){var u={name:"PhantomJS"},l=o.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/slimerjs/i],describe:function(s){var u={name:"SlimerJS"},l=o.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u={name:"BlackBerry"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u={name:"WebOS Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/bada/i],describe:function(s){var u={name:"Bada"},l=o.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/tizen/i],describe:function(s){var u={name:"Tizen"},l=o.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qupzilla/i],describe:function(s){var u={name:"QupZilla"},l=o.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/firefox|iceweasel|fxios/i],describe:function(s){var u={name:"Firefox"},l=o.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/electron/i],describe:function(s){var u={name:"Electron"},l=o.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MiuiBrowser/i],describe:function(s){var u={name:"Miui"},l=o.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/chromium/i],describe:function(s){var u={name:"Chromium"},l=o.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/chrome|crios|crmo/i],describe:function(s){var u={name:"Chrome"},l=o.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/GSA/i],describe:function(s){var u={name:"Google Search"},l=o.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u={name:"Android Browser"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/playstation 4/i],describe:function(s){var u={name:"PlayStation 4"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/safari|applewebkit/i],describe:function(s){var u={name:"Safari"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/.*/i],describe:function(s){var u=s.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:o.default.getFirstMatch(u,s),version:o.default.getSecondMatch(u,s)}}}];e.default=a,t.exports=e.default},93:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/Roku\/DVP/],describe:function(s){var u=o.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,s);return{name:i.OS_MAP.Roku,version:u}}},{test:[/windows phone/i],describe:function(s){var u=o.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.WindowsPhone,version:u}}},{test:[/windows /i],describe:function(s){var u=o.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,s),l=o.default.getWindowsVersionName(u);return{name:i.OS_MAP.Windows,version:u,versionName:l}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(s){var u={name:i.OS_MAP.iOS},l=o.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,s);return l&&(u.version=l),u}},{test:[/macintosh/i],describe:function(s){var u=o.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,s).replace(/[_\s]/g,"."),l=o.default.getMacOSVersionName(u),c={name:i.OS_MAP.MacOS,version:u};return l&&(c.versionName=l),c}},{test:[/(ipod|iphone|ipad)/i],describe:function(s){var u=o.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,s).replace(/[_\s]/g,".");return{name:i.OS_MAP.iOS,version:u}}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u=o.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,s),l=o.default.getAndroidVersionName(u),c={name:i.OS_MAP.Android,version:u};return l&&(c.versionName=l),c}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u=o.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,s),l={name:i.OS_MAP.WebOS};return u&&u.length&&(l.version=u),l}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u=o.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,s)||o.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,s)||o.default.getFirstMatch(/\bbb(\d+)/i,s);return{name:i.OS_MAP.BlackBerry,version:u}}},{test:[/bada/i],describe:function(s){var u=o.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Bada,version:u}}},{test:[/tizen/i],describe:function(s){var u=o.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Tizen,version:u}}},{test:[/linux/i],describe:function(){return{name:i.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:i.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(s){var u=o.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.PlayStation4,version:u}}}];e.default=a,t.exports=e.default},94:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(s){var u=o.default.getFirstMatch(/(can-l01)/i,s)&&"Nova",l={type:i.PLATFORMS_MAP.mobile,vendor:"Huawei"};return u&&(l.model=u),l}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){var u=s.test(/ipod|iphone/i),l=s.test(/like (ipod|iphone)/i);return u&&!l},describe:function(s){var u=o.default.getFirstMatch(/(ipod|iphone)/i,s);return{type:i.PLATFORMS_MAP.mobile,vendor:"Apple",model:u}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName(!0)==="blackberry"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(s){return s.getBrowserName(!0)==="bada"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName()==="windows phone"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(s){var u=Number(String(s.getOSVersion()).split(".")[0]);return s.getOSName(!0)==="android"&&u>=3},describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){return s.getOSName(!0)==="android"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getOSName(!0)==="macos"},describe:function(){return{type:i.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(s){return s.getOSName(!0)==="windows"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="linux"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="playstation 4"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(s){return s.getOSName(!0)==="roku"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}}];e.default=a,t.exports=e.default},95:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:function(s){return s.getBrowserName(!0)==="microsoft edge"},describe:function(s){if(/\sedg\//i.test(s))return{name:i.ENGINE_MAP.Blink};var u=o.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:i.ENGINE_MAP.EdgeHTML,version:u}}},{test:[/trident/i],describe:function(s){var u={name:i.ENGINE_MAP.Trident},l=o.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){return s.test(/presto/i)},describe:function(s){var u={name:i.ENGINE_MAP.Presto},l=o.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=s.test(/gecko/i),l=s.test(/like gecko/i);return u&&!l},describe:function(s){var u={name:i.ENGINE_MAP.Gecko},l=o.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:i.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(s){var u={name:i.ENGINE_MAP.WebKit},l=o.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}}];e.default=a,t.exports=e.default}})})});var Krt,U7,dbe=O(()=>{Krt=$(cbe()),U7=({serviceId:t,clientVersion:e})=>async()=>{let r=typeof window<"u"&&window?.navigator?.userAgent?Krt.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 Jrt=O(()=>{});var z7,Grt=O(()=>{z7=t=>()=>Promise.reject(t)});var fbe=O(()=>{Jrt();Grt()});var Yrt,H7,Zrt=O(()=>{Yrt=typeof TextEncoder=="function"?new TextEncoder:null,H7=t=>{if(typeof t=="string"){if(Yrt)return Yrt.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 pbe=O(()=>{Zrt()});var mbe,hbe=O(()=>{mbe=t=>new TextEncoder().encode(t)});var Xrt=O(()=>{hbe()});var Qrt,ent=O(()=>{Qrt=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 tnt=O(()=>{hbe();Xrt();ent()});var dnt,Vb,Wb,fF,rnt,E4,dF,P4,_C,gbe,nnt,ont,int,fnt,pnt,Hb,ant,snt,unt,lnt,cnt,Car,mnt,hnt=O(()=>{dnt="required",Vb="fn",Wb="argv",fF="ref",rnt="isSet",E4="booleanEquals",dF="error",P4="endpoint",_C="tree",gbe="PartitionResult",nnt={[dnt]:!1,type:"String"},ont={[dnt]:!0,default:!1,type:"Boolean"},int={[fF]:"Endpoint"},fnt={[Vb]:E4,[Wb]:[{[fF]:"UseFIPS"},!0]},pnt={[Vb]:E4,[Wb]:[{[fF]:"UseDualStack"},!0]},Hb={},ant={[Vb]:"getAttr",[Wb]:[{[fF]:gbe},"supportsFIPS"]},snt={[Vb]:E4,[Wb]:[!0,{[Vb]:"getAttr",[Wb]:[{[fF]:gbe},"supportsDualStack"]}]},unt=[fnt],lnt=[pnt],cnt=[{[fF]:"Region"}],Car={version:"1.0",parameters:{Region:nnt,UseDualStack:ont,UseFIPS:ont,Endpoint:nnt},rules:[{conditions:[{[Vb]:rnt,[Wb]:[int]}],rules:[{conditions:unt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:dF},{conditions:lnt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:dF},{endpoint:{url:int,properties:Hb,headers:Hb},type:P4}],type:_C},{conditions:[{[Vb]:rnt,[Wb]:cnt}],rules:[{conditions:[{[Vb]:"aws.partition",[Wb]:cnt,assign:gbe}],rules:[{conditions:[fnt,pnt],rules:[{conditions:[{[Vb]:E4,[Wb]:[!0,ant]},snt],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Hb,headers:Hb},type:P4}],type:_C},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:dF}],type:_C},{conditions:unt,rules:[{conditions:[{[Vb]:E4,[Wb]:[ant,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Hb,headers:Hb},type:P4}],type:_C},{error:"FIPS is enabled but this partition does not support FIPS",type:dF}],type:_C},{conditions:lnt,rules:[{conditions:[snt],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Hb,headers:Hb},type:P4}],type:_C},{error:"DualStack is enabled but this partition does not support DualStack",type:dF}],type:_C},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:Hb,headers:Hb},type:P4}],type:_C}],type:_C},{error:"Invalid Configuration: Missing Region",type:dF}]},mnt=Car});var gnt,ynt=O(()=>{UG();jE();hnt();gnt=(t,e={})=>t4(mnt,{endpointParams:t,logger:e.logger});mC.aws=r4});var bnt,_nt=O(()=>{RR();UE();Qt();QG();rF();tnt();rbe();ynt();bnt=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??kE,base64Encoder:t?.base64Encoder??$E,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??gnt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??Drt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new AR},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new sF}],logger:t?.logger??new NE,serviceId:t?.serviceId??"Cognito Identity",urlParser:t?.urlParser??DE,utf8Decoder:t?.utf8Decoder??mbe,utf8Encoder:t?.utf8Encoder??Qrt})});var vnt,wnt=O(()=>{vnt=["in-region","cross-region","mobile","standard","legacy"]});var Snt,V7,Oar,xnt=O(()=>{pC();Snt=$(cbe());wnt();V7=({defaultsMode:t}={})=>yGe(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(Oar()?"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 ${vnt.join(", ")}, got ${e}`)}}),Oar=()=>{let e=(typeof window<"u"&&window?.navigator?.userAgent?Snt.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return e==="tablet"||e==="mobile"}});var ybe=O(()=>{xnt()});var Cnt,Ont=O(()=>{Frt();ube();dbe();n4();d4();fbe();pbe();Ub();_nt();Qt();ybe();Cnt=t=>{let e=V7(t),r=()=>e().then(_7),n=bnt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??H7,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??U7({serviceId:n.serviceId,clientVersion:krt.version}),maxAttempts:t?.maxAttempts??qb,region:t?.region??z7("Region is missing"),requestHandler:BE.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||a4),sha256:t?.sha256??q7,streamCollector:t?.streamCollector??nF,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(JG)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(GG))}}});var W7,K7,Pnt=O(()=>{W7=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}}},K7=t=>({region:t.region()})});var Ent=O(()=>{});var bbe=O(()=>{});var Tnt=O(()=>{bbe()});var Ant=O(()=>{Tnt();bbe()});var Int=O(()=>{Ent();Ant()});var _be=O(()=>{Pnt();Int()});var Mnt,Rnt,jnt=O(()=>{Mnt=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},Rnt=t=>({httpHandler:t.httpHandler()})});var Dnt=O(()=>{jnt()});var Nnt=O(()=>{Rs()});var Lnt=O(()=>{});var Fnt=O(()=>{});function Ear(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var J7,knt=O(()=>{J7=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Ear(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var $nt=O(()=>{});var Bnt=O(()=>{});var qnt=O(()=>{});var vbe=O(()=>{Dnt();Nnt();Lnt();Fnt();knt();$nt();Bnt();qnt()});var Unt,znt,Hnt=O(()=>{Unt=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}}},znt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var G7,Vnt,Wnt=O(()=>{_be();vbe();Qt();Hnt();G7=t=>t,Vnt=(t,e)=>{let r={...G7(W7(t)),...G7(v7(t)),...G7(Mnt(t)),...G7(Unt(t))};return e.forEach(n=>n.configure(r)),{...t,...K7(r),...w7(r),...Rnt(r),...znt(r)}}});var WE,Y7=O(()=>{gge();yge();bge();Nge();n4();UE();Oye();kn();C7();Qt();rbe();Ji();Ont();Wnt();WE=class extends CR{constructor(...[e]){let r=Cnt(e||{}),n=Lrt(r),o=DG(n),i=f7(o),a=ZG(i),s=a,u=r7(s),l=Nrt(u),c=Vnt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(WG(this.config)),this.middlewareStack.use(x7(this.config)),this.middlewareStack.use(E7(this.config)),this.middlewareStack.use(IG(this.config)),this.middlewareStack.use(MG(this.config)),this.middlewareStack.use(jG(this.config)),this.middlewareStack.use(n7(this.config,{httpAuthSchemeParametersProvider:jrt,identityProviderConfigProvider:async d=>new aF({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(O7(this.config))}destroy(){super.destroy()}}});var xd,wbe=O(()=>{Qt();xd=class t extends iF{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var Z7,X7,Q7,eY,tY,rY,nY,oY,iY,aY,sY,Sbe=O(()=>{wbe();Z7=class t extends xd{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,t.prototype)}},X7=class t extends xd{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Q7=class t extends xd{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},eY=class t extends xd{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},tY=class t extends xd{constructor(e){super({name:"ResourceConflictException",$fault:"client",...e}),this.name="ResourceConflictException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},rY=class t extends xd{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},nY=class t extends xd{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},oY=class t extends xd{constructor(e){super({name:"ExternalServiceException",$fault:"client",...e}),this.name="ExternalServiceException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},iY=class t extends xd{constructor(e){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...e}),this.name="InvalidIdentityPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},aY=class t extends xd{constructor(e){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...e}),this.name="DeveloperUserAlreadyRegisteredException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},sY=class t extends xd{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}}});function Na(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${t}`}}var Knt,Jnt,Gnt,Ynt,Znt,Xnt,Qnt,eot,tot,rot,not,oot,iot,aot,sot,uot,lot,cot,dot,fot,pot,mot,hot,got,yot,bot,_ot,vot,wot,Sot,xot,Cot,Oot,Pot,Eot,Tot,Aot,Iot,Mot,Rot,jot,Dot,Not,Lot,Fot,kot,ja,Aar,Iar,Mar,Rar,jar,Dar,Nar,Lar,Far,kar,$ar,Bar,qar,Uar,$ot,zar,Jn,Har,Da,pa=O(()=>{RR();vbe();Qt();wbe();Sbe();Knt=async(t,e)=>{let r=Na("CreateIdentityPool"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},Jnt=async(t,e)=>{let r=Na("DeleteIdentities"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},Gnt=async(t,e)=>{let r=Na("DeleteIdentityPool"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},Ynt=async(t,e)=>{let r=Na("DescribeIdentity"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},Znt=async(t,e)=>{let r=Na("DescribeIdentityPool"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},Xnt=async(t,e)=>{let r=Na("GetCredentialsForIdentity"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},Qnt=async(t,e)=>{let r=Na("GetId"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},eot=async(t,e)=>{let r=Na("GetIdentityPoolRoles"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},tot=async(t,e)=>{let r=Na("GetOpenIdToken"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},rot=async(t,e)=>{let r=Na("GetOpenIdTokenForDeveloperIdentity"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},not=async(t,e)=>{let r=Na("GetPrincipalTagAttributeMap"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},oot=async(t,e)=>{let r=Na("ListIdentities"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},iot=async(t,e)=>{let r=Na("ListIdentityPools"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},aot=async(t,e)=>{let r=Na("ListTagsForResource"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},sot=async(t,e)=>{let r=Na("LookupDeveloperIdentity"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},uot=async(t,e)=>{let r=Na("MergeDeveloperIdentities"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},lot=async(t,e)=>{let r=Na("SetIdentityPoolRoles"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},cot=async(t,e)=>{let r=Na("SetPrincipalTagAttributeMap"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},dot=async(t,e)=>{let r=Na("TagResource"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},fot=async(t,e)=>{let r=Na("UnlinkDeveloperIdentity"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},pot=async(t,e)=>{let r=Na("UnlinkIdentity"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},mot=async(t,e)=>{let r=Na("UntagResource"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},hot=async(t,e)=>{let r=Na("UpdateIdentityPool"),n;return n=JSON.stringify(Gt(t)),Da(e,r,"/",void 0,n)},got=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},yot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},bot=async(t,e)=>t.statusCode>=300?ja(t,e):(await qE(t.body,e),{$metadata:Jn(t)}),_ot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=$ot(r,e),{$metadata:Jn(t),...n}},vot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},wot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=qar(r,e),{$metadata:Jn(t),...n}},Sot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},xot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},Cot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},Oot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},Pot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},Eot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=zar(r,e),{$metadata:Jn(t),...n}},Tot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},Aot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},Iot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},Mot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},Rot=async(t,e)=>t.statusCode>=300?ja(t,e):(await qE(t.body,e),{$metadata:Jn(t)}),jot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},Dot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},Not=async(t,e)=>t.statusCode>=300?ja(t,e):(await qE(t.body,e),{$metadata:Jn(t)}),Lot=async(t,e)=>t.statusCode>=300?ja(t,e):(await qE(t.body,e),{$metadata:Jn(t)}),Fot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},kot=async(t,e)=>{if(t.statusCode>=300)return ja(t,e);let r=await bs(t.body,e),n={};return n=Gt(r),{$metadata:Jn(t),...n}},ja=async(t,e)=>{let r={...t,body:await Jtt(t.body,e)},n=Gtt(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":throw await Rar(r,e);case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":throw await Dar(r,e);case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":throw await Nar(r,e);case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":throw await Lar(r,e);case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":throw await Far(r,e);case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":throw await $ar(r,e);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":throw await kar(r,e);case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":throw await Mar(r,e);case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":throw await jar(r,e);case"DeveloperUserAlreadyRegisteredException":case"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException":throw await Iar(r,e);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentity#ConcurrentModificationException":throw await Aar(r,e);default:let o=r.body;return Har({output:t,parsedBody:o,errorCode:n})}},Aar=async(t,e)=>{let r=t.body,n=Gt(r),o=new sY({$metadata:Jn(t),...n});return Ra(o,r)},Iar=async(t,e)=>{let r=t.body,n=Gt(r),o=new aY({$metadata:Jn(t),...n});return Ra(o,r)},Mar=async(t,e)=>{let r=t.body,n=Gt(r),o=new oY({$metadata:Jn(t),...n});return Ra(o,r)},Rar=async(t,e)=>{let r=t.body,n=Gt(r),o=new Z7({$metadata:Jn(t),...n});return Ra(o,r)},jar=async(t,e)=>{let r=t.body,n=Gt(r),o=new iY({$metadata:Jn(t),...n});return Ra(o,r)},Dar=async(t,e)=>{let r=t.body,n=Gt(r),o=new X7({$metadata:Jn(t),...n});return Ra(o,r)},Nar=async(t,e)=>{let r=t.body,n=Gt(r),o=new Q7({$metadata:Jn(t),...n});return Ra(o,r)},Lar=async(t,e)=>{let r=t.body,n=Gt(r),o=new eY({$metadata:Jn(t),...n});return Ra(o,r)},Far=async(t,e)=>{let r=t.body,n=Gt(r),o=new tY({$metadata:Jn(t),...n});return Ra(o,r)},kar=async(t,e)=>{let r=t.body,n=Gt(r),o=new nY({$metadata:Jn(t),...n});return Ra(o,r)},$ar=async(t,e)=>{let r=t.body,n=Gt(r),o=new rY({$metadata:Jn(t),...n});return Ra(o,r)},Bar=(t,e)=>m4(t,{AccessKeyId:an,Expiration:r=>oF(y7(ER(r))),SecretKey:an,SessionToken:an}),qar=(t,e)=>m4(t,{Credentials:r=>Bar(r,e),IdentityId:an}),Uar=(t,e)=>(t||[]).filter(n=>n!=null).map(n=>$ot(n,e)),$ot=(t,e)=>m4(t,{CreationDate:r=>oF(y7(ER(r))),IdentityId:an,LastModifiedDate:r=>oF(y7(ER(r))),Logins:Gt}),zar=(t,e)=>m4(t,{Identities:r=>Uar(r,e),IdentityPoolId:an,NextToken:an}),Jn=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),Har=b7(xd),Da=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 J7(l)}});var uY,xbe=O(()=>{kn();Kn();Qt();Ji();pa();uY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").f(void 0,void 0).ser(Knt).de(got).build(){}});var lY,Cbe=O(()=>{kn();Kn();Qt();Ji();pa();lY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").f(void 0,void 0).ser(Jnt).de(yot).build(){}});var cY,Obe=O(()=>{kn();Kn();Qt();Ji();pa();cY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").f(void 0,void 0).ser(Gnt).de(bot).build(){}});var dY,Pbe=O(()=>{kn();Kn();Qt();Ji();pa();dY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").f(void 0,void 0).ser(Ynt).de(_ot).build(){}});var fY,Ebe=O(()=>{kn();Kn();Qt();Ji();pa();fY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").f(void 0,void 0).ser(Znt).de(vot).build(){}});var pF,Tbe=O(()=>{kn();Kn();Qt();Ji();pa();pF=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").f(void 0,void 0).ser(Xnt).de(wot).build(){}});var mF,Abe=O(()=>{kn();Kn();Qt();Ji();pa();mF=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").f(void 0,void 0).ser(Qnt).de(Sot).build(){}});var pY,Ibe=O(()=>{kn();Kn();Qt();Ji();pa();pY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").f(void 0,void 0).ser(eot).de(xot).build(){}});var mY,Mbe=O(()=>{kn();Kn();Qt();Ji();pa();mY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").f(void 0,void 0).ser(tot).de(Cot).build(){}});var hY,Rbe=O(()=>{kn();Kn();Qt();Ji();pa();hY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").f(void 0,void 0).ser(rot).de(Oot).build(){}});var gY,jbe=O(()=>{kn();Kn();Qt();Ji();pa();gY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(not).de(Pot).build(){}});var yY,Dbe=O(()=>{kn();Kn();Qt();Ji();pa();yY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").f(void 0,void 0).ser(oot).de(Eot).build(){}});var hF,bY=O(()=>{kn();Kn();Qt();Ji();pa();hF=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").f(void 0,void 0).ser(iot).de(Tot).build(){}});var _Y,Nbe=O(()=>{kn();Kn();Qt();Ji();pa();_Y=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").f(void 0,void 0).ser(aot).de(Aot).build(){}});var vY,Lbe=O(()=>{kn();Kn();Qt();Ji();pa();vY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").f(void 0,void 0).ser(sot).de(Iot).build(){}});var wY,Fbe=O(()=>{kn();Kn();Qt();Ji();pa();wY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").f(void 0,void 0).ser(uot).de(Mot).build(){}});var SY,kbe=O(()=>{kn();Kn();Qt();Ji();pa();SY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").f(void 0,void 0).ser(lot).de(Rot).build(){}});var xY,$be=O(()=>{kn();Kn();Qt();Ji();pa();xY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(cot).de(jot).build(){}});var CY,Bbe=O(()=>{kn();Kn();Qt();Ji();pa();CY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").f(void 0,void 0).ser(dot).de(Dot).build(){}});var OY,qbe=O(()=>{kn();Kn();Qt();Ji();pa();OY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").f(void 0,void 0).ser(fot).de(Not).build(){}});var PY,Ube=O(()=>{kn();Kn();Qt();Ji();pa();PY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").f(void 0,void 0).ser(pot).de(Lot).build(){}});var EY,zbe=O(()=>{kn();Kn();Qt();Ji();pa();EY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").f(void 0,void 0).ser(mot).de(Fot).build(){}});var TY,Hbe=O(()=>{kn();Kn();Qt();Ji();pa();TY=class extends yt.classBuilder().ep({...br}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").f(void 0,void 0).ser(hot).de(kot).build(){}});var Var,Vbe,Bot=O(()=>{Qt();Y7();xbe();Cbe();Obe();Pbe();Ebe();Tbe();Abe();Ibe();Mbe();Rbe();jbe();Dbe();bY();Nbe();Lbe();Fbe();kbe();$be();Bbe();qbe();Ube();zbe();Hbe();Var={CreateIdentityPoolCommand:uY,DeleteIdentitiesCommand:lY,DeleteIdentityPoolCommand:cY,DescribeIdentityCommand:dY,DescribeIdentityPoolCommand:fY,GetCredentialsForIdentityCommand:pF,GetIdCommand:mF,GetIdentityPoolRolesCommand:pY,GetOpenIdTokenCommand:mY,GetOpenIdTokenForDeveloperIdentityCommand:hY,GetPrincipalTagAttributeMapCommand:gY,ListIdentitiesCommand:yY,ListIdentityPoolsCommand:hF,ListTagsForResourceCommand:_Y,LookupDeveloperIdentityCommand:vY,MergeDeveloperIdentitiesCommand:wY,SetIdentityPoolRolesCommand:SY,SetPrincipalTagAttributeMapCommand:xY,TagResourceCommand:CY,UnlinkDeveloperIdentityCommand:OY,UnlinkIdentityCommand:PY,UntagResourceCommand:EY,UpdateIdentityPoolCommand:TY},Vbe=class extends WE{};g7(Var,Vbe)});var qot=O(()=>{xbe();Cbe();Obe();Pbe();Ebe();Tbe();Abe();Ibe();Mbe();Rbe();jbe();Dbe();bY();Nbe();Lbe();Fbe();kbe();$be();Bbe();qbe();Ube();zbe();Hbe()});var Uot=O(()=>{});var lto,zot=O(()=>{UE();Y7();bY();lto=Cye(WE,hF,"NextToken","NextToken","MaxResults")});var Hot=O(()=>{Uot();zot()});var Vot=O(()=>{Sbe()});var Wot=O(()=>{Y7();Bot();qot();Hot();Vot()});var Wbe={};$f(Wbe,{CognitoIdentityClient:()=>WE,GetCredentialsForIdentityCommand:()=>pF,GetIdCommand:()=>mF});var Kbe=O(()=>{Wot()});function AY(t){return async()=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:e,CognitoIdentityClient:r}=await Promise.resolve().then(()=>(Kbe(),Wbe)),{Credentials:{AccessKeyId:n=War(t.logger),Expiration:o,SecretKey:i=Jar(t.logger),SessionToken:a}=Kar(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 TG(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:n,secretAccessKey:i,sessionToken:a,expiration:o}}}function War(t){throw new pl("Response from Amazon Cognito contained no access key ID",{logger:t})}function Kar(t){throw new pl("Response from Amazon Cognito contained no credentials",{logger:t})}function Jar(t){throw new pl("Response from Amazon Cognito contained no secret key",{logger:t})}var Jbe=O(()=>{pC();pge()});var Gbe,IY,Kot=O(()=>{Gbe="IdentityIds",IY=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(Gbe,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(Gbe,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(Gbe)))}).catch(i=>{throw n.close(),i})})}}});var MY,Jot=O(()=>{MY=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 Got(){return typeof self=="object"&&self.indexedDB?new IY:typeof window=="object"&&window.localStorage?window.localStorage:Gar}var Gar,Yot=O(()=>{Kot();Jot();Gar=new MY});function Zot({accountId:t,cache:e=Got(),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(()=>(Kbe(),Wbe)),m=r??new p(Object.assign({},n??{},{region:n?.region??l?.region})),h=c&&await e.getItem(c);if(!h){let{IdentityId:b=Yar(u)}=await m.send(new f({AccountId:t,IdentityPoolId:i,Logins:a?await TG(a):void 0}));h=b,c&&Promise.resolve(e.setItem(c,h)).catch(()=>{})}return d=AY({client:m,customRoleArn:o,logins:a,identityId:h}),d()};return()=>d().catch(async f=>{throw c&&Promise.resolve(e.removeItem(c)).catch(()=>{}),f})}function Yar(t){throw new pl("Response from Amazon Cognito contained no identity ID",{logger:t})}var Xot=O(()=>{pC();Jbe();Yot();pge()});var Ybe=O(()=>{cGe();dGe();fGe();Jbe();Xot()});var Zar,Qot=O(()=>{Ybe();Zar=t=>AY({...t})});var Xar,eit=O(()=>{Ybe();Xar=t=>Zot({...t})});var Qar,esr,tsr,tit,rit=O(()=>{pC();Qar="169.254.170.2",esr="169.254.170.23",tsr="[fd00:ec2::23]",tit=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===Qar||t.hostname===esr||t.hostname===tsr)){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 pl(`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 nit=O(()=>{});var oit=O(()=>{nit()});var iit=O(()=>{Rs()});var ait=O(()=>{});var sit=O(()=>{});function rsr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var RY,uit=O(()=>{RY=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=rsr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var lit=O(()=>{});var cit=O(()=>{});var dit=O(()=>{});var fit=O(()=>{oit();iit();ait();sit();uit();lit();cit();dit()});function pit(t){return new RY({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 mit(t,e){let n=await AQe(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 pl("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:WQe(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new pl(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new pl(`Server responded with status: ${t.statusCode}`,{logger:e})}var hit=O(()=>{pC();fit();Qt();fye()});var git,yit=O(()=>{git=(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 Zbe,bit=O(()=>{d4();pC();rit();hit();yit();Zbe=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new pl("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);tit(n,t.logger);let o=new BE;return git(async()=>{let i=pit(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return mit(a.response)},t.maxRetries??3,t.timeout??1e3)}});var _it=O(()=>{bit()});function nsr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function vit(t){return{schemeId:"smithy.api#noAuth"}}var wit,Sit,osr,xit,Xbe=O(()=>{RR();Kg();T4();wit=async(t,e,r)=>({operation:Bb(e).operation,region:await Sd(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});Sit=t=>{let e=[];switch(t.operation){case"AssumeRoleWithSAML":{e.push(vit(t));break}case"AssumeRoleWithWebIdentity":{e.push(vit(t));break}default:e.push(nsr(t))}return e},osr=t=>({...t,stsClientCtor:bh}),xit=t=>{let e=osr(t);return{...F7(e)}}});var Cit,Cd,Kb=O(()=>{Cit=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),Cd={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 Pit,Oit=O(()=>{Pit={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 Qbe,e_e=O(()=>{Qbe=t=>new TextEncoder().encode(t)});var Eit=O(()=>{e_e()});var Tit,Ait=O(()=>{Tit=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 Iit=O(()=>{e_e();Eit();Ait()});var qit,Qr,ho,go,JE,KE,xc,Uit,zit,Hit,ma,Mit,Jb,gF,r_e,Rit,t_e,Vit,jit,Cc,Dit,Wit,Kit,Od,am,Nit,Jit,Git,Lit,Yit,Fit,kit,$it,Bit,asr,Zit,Xit=O(()=>{qit="required",Qr="type",ho="fn",go="argv",JE="ref",KE="booleanEquals",xc="stringEquals",Uit="sigv4",zit="sts",Hit="us-east-1",ma="endpoint",Mit="https://sts.{Region}.{PartitionResult#dnsSuffix}",Jb="tree",gF="error",r_e="getAttr",Rit={[qit]:!1,[Qr]:"String"},t_e={[qit]:!0,default:!1,[Qr]:"Boolean"},Vit={[JE]:"Endpoint"},jit={[ho]:"isSet",[go]:[{[JE]:"Region"}]},Cc={[JE]:"Region"},Dit={[ho]:"aws.partition",[go]:[Cc],assign:"PartitionResult"},Wit={[JE]:"UseFIPS"},Kit={[JE]:"UseDualStack"},Od={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:Uit,signingName:zit,signingRegion:Hit}]},headers:{}},am={},Nit={conditions:[{[ho]:xc,[go]:[Cc,"aws-global"]}],[ma]:Od,[Qr]:ma},Jit={[ho]:KE,[go]:[Wit,!0]},Git={[ho]:KE,[go]:[Kit,!0]},Lit={[ho]:r_e,[go]:[{[JE]:"PartitionResult"},"supportsFIPS"]},Yit={[JE]:"PartitionResult"},Fit={[ho]:KE,[go]:[!0,{[ho]:r_e,[go]:[Yit,"supportsDualStack"]}]},kit=[{[ho]:"isSet",[go]:[Vit]}],$it=[Jit],Bit=[Git],asr={version:"1.0",parameters:{Region:Rit,UseDualStack:t_e,UseFIPS:t_e,Endpoint:Rit,UseGlobalEndpoint:t_e},rules:[{conditions:[{[ho]:KE,[go]:[{[JE]:"UseGlobalEndpoint"},!0]},{[ho]:"not",[go]:kit},jit,Dit,{[ho]:KE,[go]:[Wit,!1]},{[ho]:KE,[go]:[Kit,!1]}],rules:[{conditions:[{[ho]:xc,[go]:[Cc,"ap-northeast-1"]}],endpoint:Od,[Qr]:ma},{conditions:[{[ho]:xc,[go]:[Cc,"ap-south-1"]}],endpoint:Od,[Qr]:ma},{conditions:[{[ho]:xc,[go]:[Cc,"ap-southeast-1"]}],endpoint:Od,[Qr]:ma},{conditions:[{[ho]:xc,[go]:[Cc,"ap-southeast-2"]}],endpoint:Od,[Qr]:ma},Nit,{conditions:[{[ho]:xc,[go]:[Cc,"ca-central-1"]}],endpoint:Od,[Qr]:ma},{conditions:[{[ho]:xc,[go]:[Cc,"eu-central-1"]}],endpoint:Od,[Qr]:ma},{conditions:[{[ho]:xc,[go]:[Cc,"eu-north-1"]}],endpoint:Od,[Qr]:ma},{conditions:[{[ho]:xc,[go]:[Cc,"eu-west-1"]}],endpoint:Od,[Qr]:ma},{conditions:[{[ho]:xc,[go]:[Cc,"eu-west-2"]}],endpoint:Od,[Qr]:ma},{conditions:[{[ho]:xc,[go]:[Cc,"eu-west-3"]}],endpoint:Od,[Qr]:ma},{conditions:[{[ho]:xc,[go]:[Cc,"sa-east-1"]}],endpoint:Od,[Qr]:ma},{conditions:[{[ho]:xc,[go]:[Cc,Hit]}],endpoint:Od,[Qr]:ma},{conditions:[{[ho]:xc,[go]:[Cc,"us-east-2"]}],endpoint:Od,[Qr]:ma},{conditions:[{[ho]:xc,[go]:[Cc,"us-west-1"]}],endpoint:Od,[Qr]:ma},{conditions:[{[ho]:xc,[go]:[Cc,"us-west-2"]}],endpoint:Od,[Qr]:ma},{endpoint:{url:Mit,properties:{authSchemes:[{name:Uit,signingName:zit,signingRegion:"{Region}"}]},headers:am},[Qr]:ma}],[Qr]:Jb},{conditions:kit,rules:[{conditions:$it,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Qr]:gF},{conditions:Bit,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Qr]:gF},{endpoint:{url:Vit,properties:am,headers:am},[Qr]:ma}],[Qr]:Jb},{conditions:[jit],rules:[{conditions:[Dit],rules:[{conditions:[Jit,Git],rules:[{conditions:[{[ho]:KE,[go]:[!0,Lit]},Fit],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:am,headers:am},[Qr]:ma}],[Qr]:Jb},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Qr]:gF}],[Qr]:Jb},{conditions:$it,rules:[{conditions:[{[ho]:KE,[go]:[Lit,!0]}],rules:[{conditions:[{[ho]:xc,[go]:[{[ho]:r_e,[go]:[Yit,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:am,headers:am},[Qr]:ma},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:am,headers:am},[Qr]:ma}],[Qr]:Jb},{error:"FIPS is enabled but this partition does not support FIPS",[Qr]:gF}],[Qr]:Jb},{conditions:Bit,rules:[{conditions:[Fit],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:am,headers:am},[Qr]:ma}],[Qr]:Jb},{error:"DualStack is enabled but this partition does not support DualStack",[Qr]:gF}],[Qr]:Jb},Nit,{endpoint:{url:Mit,properties:am,headers:am},[Qr]:ma}],[Qr]:Jb}],[Qr]:Jb},{error:"Invalid Configuration: Missing Region",[Qr]:gF}]},Zit=asr});var Qit,eat=O(()=>{UG();jE();Xit();Qit=(t,e={})=>t4(Zit,{endpointParams:t,logger:e.logger});mC.aws=r4});var tat,rat=O(()=>{RR();UE();Qt();QG();rF();Iit();Xbe();eat();tat=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??kE,base64Encoder:t?.base64Encoder??$E,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??Qit,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??Sit,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new AR},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new sF}],logger:t?.logger??new NE,serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??DE,utf8Decoder:t?.utf8Decoder??Qbe,utf8Encoder:t?.utf8Encoder??Tit})});var nat,oat=O(()=>{Oit();ube();dbe();n4();d4();fbe();pbe();Ub();rat();Qt();ybe();nat=t=>{let e=V7(t),r=()=>e().then(_7),n=tat(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??H7,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??U7({serviceId:n.serviceId,clientVersion:Pit.version}),maxAttempts:t?.maxAttempts??qb,region:t?.region??z7("Region is missing"),requestHandler:BE.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||a4),sha256:t?.sha256??q7,streamCollector:t?.streamCollector??nF,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(JG)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(GG))}}});var iat,aat,sat=O(()=>{iat=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},aat=t=>({httpHandler:t.httpHandler()})});var uat=O(()=>{sat()});var lat=O(()=>{Rs()});var cat=O(()=>{});var dat=O(()=>{});function ssr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var jY,fat=O(()=>{jY=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=ssr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var pat=O(()=>{});var mat=O(()=>{});var hat=O(()=>{});var n_e=O(()=>{uat();lat();cat();dat();fat();pat();mat();hat()});var gat,yat,bat=O(()=>{gat=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}}},yat=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var DY,_at,vat=O(()=>{_be();n_e();Qt();bat();DY=t=>t,_at=(t,e)=>{let r={...DY(W7(t)),...DY(v7(t)),...DY(iat(t)),...DY(gat(t))};return e.forEach(n=>n.configure(r)),{...t,...K7(r),...w7(r),...aat(r),...yat(r)}}});var bh,T4=O(()=>{gge();yge();bge();Nge();n4();UE();Oye();kn();C7();Qt();Xbe();Kb();oat();vat();bh=class extends CR{constructor(...[e]){let r=nat(e||{}),n=Cit(r),o=DG(n),i=f7(o),a=ZG(i),s=a,u=r7(s),l=xit(u),c=_at(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(WG(this.config)),this.middlewareStack.use(x7(this.config)),this.middlewareStack.use(E7(this.config)),this.middlewareStack.use(IG(this.config)),this.middlewareStack.use(MG(this.config)),this.middlewareStack.use(jG(this.config)),this.middlewareStack.use(n7(this.config,{httpAuthSchemeParametersProvider:wit,identityProviderConfigProvider:async d=>new aF({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(O7(this.config))}destroy(){super.destroy()}}});var _f,NY=O(()=>{Qt();_f=class t extends iF{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var A4,I4,M4,R4,j4,D4,N4,L4,yF,o_e,i_e,a_e,s_e,u_e,l_e,c_e,GE=O(()=>{Qt();NY();A4=class t extends _f{constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},I4=class t extends _f{constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},M4=class t extends _f{constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},R4=class t extends _f{constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},j4=class t extends _f{constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},D4=class t extends _f{constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},N4=class t extends _f{constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},L4=class t extends _f{constructor(e){super({name:"InvalidAuthorizationMessageException",$fault:"client",...e}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},yF=t=>({...t,...t.SecretAccessKey&&{SecretAccessKey:h7}}),o_e=t=>({...t,...t.Credentials&&{Credentials:yF(t.Credentials)}}),i_e=t=>({...t,...t.SAMLAssertion&&{SAMLAssertion:h7}}),a_e=t=>({...t,...t.Credentials&&{Credentials:yF(t.Credentials)}}),s_e=t=>({...t,...t.WebIdentityToken&&{WebIdentityToken:h7}}),u_e=t=>({...t,...t.Credentials&&{Credentials:yF(t.Credentials)}}),l_e=t=>({...t,...t.Credentials&&{Credentials:yF(t.Credentials)}}),c_e=t=>({...t,...t.Credentials&&{Credentials:yF(t.Credentials)}})});var wat,Sat,xat,Cat,Oat,Pat,Eat,Tat,Aat,Iat,Mat,Rat,jat,Dat,Nat,Lat,YE,usr,lsr,csr,dsr,fsr,psr,msr,hsr,gsr,ysr,bsr,_sr,vsr,wsr,Ssr,xsr,LY,Csr,Osr,Psr,Esr,Tsr,Fat,$_e,Asr,Isr,Msr,F4,Rsr,jsr,Dsr,Nsr,Lsr,Fsr,ksr,$sr,Bsr,qsr,Usr,zsr,Hsr,Vsr,Pd,Wsr,ZE,XE,QE,eT,bF,Ksr,d_e,vC,Jsr,Gsr,_F,wC,vF,vf,f_e,Ysr,p_e,wf,m_e,h_e,g_e,y_e,b_e,Zsr,Xsr,Qsr,eur,__e,v_e,w_e,S_e,_h,vh,x_e,C_e,O_e,P_e,wh,E_e,SC,wF,T_e,A_e,I_e,M_e,Sh,SF,R_e,j_e,xF,CF,D_e,N_e,tT,L_e,F_e,k_e,ha,rT,tur,xC=O(()=>{RR();n_e();Qt();GE();NY();wat=async(t,e)=>{let r=XE,n;return n=rT({...gsr(t,e),[eT]:Ksr,[tT]:QE}),ZE(e,r,"/",void 0,n)},Sat=async(t,e)=>{let r=XE,n;return n=rT({...ysr(t,e),[eT]:Jsr,[tT]:QE}),ZE(e,r,"/",void 0,n)},xat=async(t,e)=>{let r=XE,n;return n=rT({...bsr(t,e),[eT]:Gsr,[tT]:QE}),ZE(e,r,"/",void 0,n)},Cat=async(t,e)=>{let r=XE,n;return n=rT({..._sr(t,e),[eT]:Ysr,[tT]:QE}),ZE(e,r,"/",void 0,n)},Oat=async(t,e)=>{let r=XE,n;return n=rT({...vsr(t,e),[eT]:Zsr,[tT]:QE}),ZE(e,r,"/",void 0,n)},Pat=async(t,e)=>{let r=XE,n;return n=rT({...wsr(t,e),[eT]:Xsr,[tT]:QE}),ZE(e,r,"/",void 0,n)},Eat=async(t,e)=>{let r=XE,n;return n=rT({...Ssr(t,e),[eT]:Qsr,[tT]:QE}),ZE(e,r,"/",void 0,n)},Tat=async(t,e)=>{let r=XE,n;return n=rT({...xsr(t,e),[eT]:eur,[tT]:QE}),ZE(e,r,"/",void 0,n)},Aat=async(t,e)=>{if(t.statusCode>=300)return YE(t,e);let r=await zb(t.body,e),n={};return n=Asr(r.AssumeRoleResult,e),{$metadata:Pd(t),...n}},Iat=async(t,e)=>{if(t.statusCode>=300)return YE(t,e);let r=await zb(t.body,e),n={};return n=Isr(r.AssumeRoleWithSAMLResult,e),{$metadata:Pd(t),...n}},Mat=async(t,e)=>{if(t.statusCode>=300)return YE(t,e);let r=await zb(t.body,e),n={};return n=Msr(r.AssumeRoleWithWebIdentityResult,e),{$metadata:Pd(t),...n}},Rat=async(t,e)=>{if(t.statusCode>=300)return YE(t,e);let r=await zb(t.body,e),n={};return n=Rsr(r.DecodeAuthorizationMessageResult,e),{$metadata:Pd(t),...n}},jat=async(t,e)=>{if(t.statusCode>=300)return YE(t,e);let r=await zb(t.body,e),n={};return n=Nsr(r.GetAccessKeyInfoResult,e),{$metadata:Pd(t),...n}},Dat=async(t,e)=>{if(t.statusCode>=300)return YE(t,e);let r=await zb(t.body,e),n={};return n=Lsr(r.GetCallerIdentityResult,e),{$metadata:Pd(t),...n}},Nat=async(t,e)=>{if(t.statusCode>=300)return YE(t,e);let r=await zb(t.body,e),n={};return n=Fsr(r.GetFederationTokenResult,e),{$metadata:Pd(t),...n}},Lat=async(t,e)=>{if(t.statusCode>=300)return YE(t,e);let r=await zb(t.body,e),n={};return n=ksr(r.GetSessionTokenResult,e),{$metadata:Pd(t),...n}},YE=async(t,e)=>{let r={...t,body:await Irt(t.body,e)},n=tur(t,r.body);switch(n){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await usr(r,e);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await psr(r,e);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await msr(r,e);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await hsr(r,e);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await csr(r,e);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await fsr(r,e);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await lsr(r,e);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await dsr(r,e);default:let o=r.body;return Wsr({output:t,parsedBody:o.Error,errorCode:n})}},usr=async(t,e)=>{let r=t.body,n=jsr(r.Error,e),o=new A4({$metadata:Pd(t),...n});return Ra(o,r)},lsr=async(t,e)=>{let r=t.body,n=$sr(r.Error,e),o=new N4({$metadata:Pd(t),...n});return Ra(o,r)},csr=async(t,e)=>{let r=t.body,n=Bsr(r.Error,e),o=new j4({$metadata:Pd(t),...n});return Ra(o,r)},dsr=async(t,e)=>{let r=t.body,n=qsr(r.Error,e),o=new L4({$metadata:Pd(t),...n});return Ra(o,r)},fsr=async(t,e)=>{let r=t.body,n=Usr(r.Error,e),o=new D4({$metadata:Pd(t),...n});return Ra(o,r)},psr=async(t,e)=>{let r=t.body,n=zsr(r.Error,e),o=new I4({$metadata:Pd(t),...n});return Ra(o,r)},msr=async(t,e)=>{let r=t.body,n=Hsr(r.Error,e),o=new M4({$metadata:Pd(t),...n});return Ra(o,r)},hsr=async(t,e)=>{let r=t.body,n=Vsr(r.Error,e),o=new R4({$metadata:Pd(t),...n});return Ra(o,r)},gsr=(t,e)=>{let r={};if(t[SC]!=null&&(r[SC]=t[SC]),t[wF]!=null&&(r[wF]=t[wF]),t[vh]!=null){let n=LY(t[vh],e);t[vh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[_h]!=null&&(r[_h]=t[_h]),t[wf]!=null&&(r[wf]=t[wf]),t[xF]!=null){let n=Fat(t[xF],e);t[xF]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}if(t[D_e]!=null){let n=Tsr(t[D_e],e);t[D_e]?.length===0&&(r.TransitiveTagKeys=[]),Object.entries(n).forEach(([o,i])=>{let a=`TransitiveTagKeys.${o}`;r[a]=i})}if(t[h_e]!=null&&(r[h_e]=t[h_e]),t[SF]!=null&&(r[SF]=t[SF]),t[CF]!=null&&(r[CF]=t[CF]),t[Sh]!=null&&(r[Sh]=t[Sh]),t[O_e]!=null){let n=Psr(t[O_e],e);t[O_e]?.length===0&&(r.ProvidedContexts=[]),Object.entries(n).forEach(([o,i])=>{let a=`ProvidedContexts.${o}`;r[a]=i})}return r},ysr=(t,e)=>{let r={};if(t[SC]!=null&&(r[SC]=t[SC]),t[x_e]!=null&&(r[x_e]=t[x_e]),t[I_e]!=null&&(r[I_e]=t[I_e]),t[vh]!=null){let n=LY(t[vh],e);t[vh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[_h]!=null&&(r[_h]=t[_h]),t[wf]!=null&&(r[wf]=t[wf]),r},bsr=(t,e)=>{let r={};if(t[SC]!=null&&(r[SC]=t[SC]),t[wF]!=null&&(r[wF]=t[wF]),t[F_e]!=null&&(r[F_e]=t[F_e]),t[P_e]!=null&&(r[P_e]=t[P_e]),t[vh]!=null){let n=LY(t[vh],e);t[vh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[_h]!=null&&(r[_h]=t[_h]),t[wf]!=null&&(r[wf]=t[wf]),r},_sr=(t,e)=>{let r={};return t[g_e]!=null&&(r[g_e]=t[g_e]),r},vsr=(t,e)=>{let r={};return t[bF]!=null&&(r[bF]=t[bF]),r},wsr=(t,e)=>({}),Ssr=(t,e)=>{let r={};if(t[w_e]!=null&&(r[w_e]=t[w_e]),t[_h]!=null&&(r[_h]=t[_h]),t[vh]!=null){let n=LY(t[vh],e);t[vh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[wf]!=null&&(r[wf]=t[wf]),t[xF]!=null){let n=Fat(t[xF],e);t[xF]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}return r},xsr=(t,e)=>{let r={};return t[wf]!=null&&(r[wf]=t[wf]),t[SF]!=null&&(r[SF]=t[SF]),t[CF]!=null&&(r[CF]=t[CF]),r},LY=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=Csr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},Csr=(t,e)=>{let r={};return t[k_e]!=null&&(r[k_e]=t[k_e]),r},Osr=(t,e)=>{let r={};return t[C_e]!=null&&(r[C_e]=t[C_e]),t[f_e]!=null&&(r[f_e]=t[f_e]),r},Psr=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=Osr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},Esr=(t,e)=>{let r={};return t[v_e]!=null&&(r[v_e]=t[v_e]),t[L_e]!=null&&(r[L_e]=t[L_e]),r},Tsr=(t,e)=>{let r={},n=1;for(let o of t)o!==null&&(r[`member.${n}`]=o,n++);return r},Fat=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=Esr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},$_e=(t,e)=>{let r={};return t[d_e]!=null&&(r[d_e]=an(t[d_e])),t[wC]!=null&&(r[wC]=an(t[wC])),r},Asr=(t,e)=>{let r={};return t[vf]!=null&&(r[vf]=F4(t[vf],e)),t[vC]!=null&&(r[vC]=$_e(t[vC],e)),t[wh]!=null&&(r[wh]=p4(t[wh])),t[Sh]!=null&&(r[Sh]=an(t[Sh])),r},Isr=(t,e)=>{let r={};return t[vf]!=null&&(r[vf]=F4(t[vf],e)),t[vC]!=null&&(r[vC]=$_e(t[vC],e)),t[wh]!=null&&(r[wh]=p4(t[wh])),t[T_e]!=null&&(r[T_e]=an(t[T_e])),t[R_e]!=null&&(r[R_e]=an(t[R_e])),t[__e]!=null&&(r[__e]=an(t[__e])),t[vF]!=null&&(r[vF]=an(t[vF])),t[S_e]!=null&&(r[S_e]=an(t[S_e])),t[Sh]!=null&&(r[Sh]=an(t[Sh])),r},Msr=(t,e)=>{let r={};return t[vf]!=null&&(r[vf]=F4(t[vf],e)),t[M_e]!=null&&(r[M_e]=an(t[M_e])),t[vC]!=null&&(r[vC]=$_e(t[vC],e)),t[wh]!=null&&(r[wh]=p4(t[wh])),t[E_e]!=null&&(r[E_e]=an(t[E_e])),t[vF]!=null&&(r[vF]=an(t[vF])),t[Sh]!=null&&(r[Sh]=an(t[Sh])),r},F4=(t,e)=>{let r={};return t[bF]!=null&&(r[bF]=an(t[bF])),t[A_e]!=null&&(r[A_e]=an(t[A_e])),t[j_e]!=null&&(r[j_e]=an(t[j_e])),t[m_e]!=null&&(r[m_e]=oF(KQe(t[m_e]))),r},Rsr=(t,e)=>{let r={};return t[p_e]!=null&&(r[p_e]=an(t[p_e])),r},jsr=(t,e)=>{let r={};return t[ha]!=null&&(r[ha]=an(t[ha])),r},Dsr=(t,e)=>{let r={};return t[b_e]!=null&&(r[b_e]=an(t[b_e])),t[wC]!=null&&(r[wC]=an(t[wC])),r},Nsr=(t,e)=>{let r={};return t[_F]!=null&&(r[_F]=an(t[_F])),r},Lsr=(t,e)=>{let r={};return t[N_e]!=null&&(r[N_e]=an(t[N_e])),t[_F]!=null&&(r[_F]=an(t[_F])),t[wC]!=null&&(r[wC]=an(t[wC])),r},Fsr=(t,e)=>{let r={};return t[vf]!=null&&(r[vf]=F4(t[vf],e)),t[y_e]!=null&&(r[y_e]=Dsr(t[y_e],e)),t[wh]!=null&&(r[wh]=p4(t[wh])),r},ksr=(t,e)=>{let r={};return t[vf]!=null&&(r[vf]=F4(t[vf],e)),r},$sr=(t,e)=>{let r={};return t[ha]!=null&&(r[ha]=an(t[ha])),r},Bsr=(t,e)=>{let r={};return t[ha]!=null&&(r[ha]=an(t[ha])),r},qsr=(t,e)=>{let r={};return t[ha]!=null&&(r[ha]=an(t[ha])),r},Usr=(t,e)=>{let r={};return t[ha]!=null&&(r[ha]=an(t[ha])),r},zsr=(t,e)=>{let r={};return t[ha]!=null&&(r[ha]=an(t[ha])),r},Hsr=(t,e)=>{let r={};return t[ha]!=null&&(r[ha]=an(t[ha])),r},Vsr=(t,e)=>{let r={};return t[ha]!=null&&(r[ha]=an(t[ha])),r},Pd=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"]}),Wsr=b7(_f),ZE=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 jY(l)},XE={"content-type":"application/x-www-form-urlencoded"},QE="2011-06-15",eT="Action",bF="AccessKeyId",Ksr="AssumeRole",d_e="AssumedRoleId",vC="AssumedRoleUser",Jsr="AssumeRoleWithSAML",Gsr="AssumeRoleWithWebIdentity",_F="Account",wC="Arn",vF="Audience",vf="Credentials",f_e="ContextAssertion",Ysr="DecodeAuthorizationMessage",p_e="DecodedMessage",wf="DurationSeconds",m_e="Expiration",h_e="ExternalId",g_e="EncodedMessage",y_e="FederatedUser",b_e="FederatedUserId",Zsr="GetAccessKeyInfo",Xsr="GetCallerIdentity",Qsr="GetFederationToken",eur="GetSessionToken",__e="Issuer",v_e="Key",w_e="Name",S_e="NameQualifier",_h="Policy",vh="PolicyArns",x_e="PrincipalArn",C_e="ProviderArn",O_e="ProvidedContexts",P_e="ProviderId",wh="PackedPolicySize",E_e="Provider",SC="RoleArn",wF="RoleSessionName",T_e="Subject",A_e="SecretAccessKey",I_e="SAMLAssertion",M_e="SubjectFromWebIdentityToken",Sh="SourceIdentity",SF="SerialNumber",R_e="SubjectType",j_e="SessionToken",xF="Tags",CF="TokenCode",D_e="TransitiveTagKeys",N_e="UserId",tT="Version",L_e="Value",F_e="WebIdentityToken",k_e="arn",ha="message",rT=t=>Object.entries(t).map(([e,r])=>S7(e)+"="+S7(r)).join("&"),tur=(t,e)=>{if(e.Error?.Code!==void 0)return e.Error.Code;if(t.statusCode==404)return"NotFound"}});var CC,FY=O(()=>{kn();Kn();Qt();Kb();GE();xC();CC=class extends yt.classBuilder().ep({...Cd}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,o_e).ser(wat).de(Aat).build(){}});var k4,B_e=O(()=>{kn();Kn();Qt();Kb();GE();xC();k4=class extends yt.classBuilder().ep({...Cd}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").f(i_e,a_e).ser(Sat).de(Iat).build(){}});var jR,kY=O(()=>{kn();Kn();Qt();Kb();GE();xC();jR=class extends yt.classBuilder().ep({...Cd}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(s_e,u_e).ser(xat).de(Mat).build(){}});var $4,q_e=O(()=>{kn();Kn();Qt();Kb();xC();$4=class extends yt.classBuilder().ep({...Cd}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").f(void 0,void 0).ser(Cat).de(Rat).build(){}});var B4,U_e=O(()=>{kn();Kn();Qt();Kb();xC();B4=class extends yt.classBuilder().ep({...Cd}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").f(void 0,void 0).ser(Oat).de(jat).build(){}});var q4,z_e=O(()=>{kn();Kn();Qt();Kb();xC();q4=class extends yt.classBuilder().ep({...Cd}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").f(void 0,void 0).ser(Pat).de(Dat).build(){}});var U4,H_e=O(()=>{kn();Kn();Qt();Kb();GE();xC();U4=class extends yt.classBuilder().ep({...Cd}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").f(void 0,l_e).ser(Eat).de(Nat).build(){}});var z4,V_e=O(()=>{kn();Kn();Qt();Kb();GE();xC();z4=class extends yt.classBuilder().ep({...Cd}).m(function(e,r,n,o){return[xt(n,this.serialize,this.deserialize),Ct(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").f(void 0,c_e).ser(Tat).de(Lat).build(){}});var rur,$Y,kat=O(()=>{Qt();FY();B_e();kY();q_e();U_e();z_e();H_e();V_e();T4();rur={AssumeRoleCommand:CC,AssumeRoleWithSAMLCommand:k4,AssumeRoleWithWebIdentityCommand:jR,DecodeAuthorizationMessageCommand:$4,GetAccessKeyInfoCommand:B4,GetCallerIdentityCommand:q4,GetFederationTokenCommand:U4,GetSessionTokenCommand:z4},$Y=class extends bh{};g7(rur,$Y)});var $at=O(()=>{FY();B_e();kY();q_e();U_e();z_e();H_e();V_e()});var Bat=O(()=>{GE()});var qat,Uat,zat,Hat,Vat,Wat,Kat=O(()=>{FY();kY();qat="us-east-1",Uat=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},zat=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)`,`${qat} (STS default)`),n??o??qat},Hat=(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 zat(c,t?.parentClientConfig?.region,f),m=!Wat(d);r=new e({credentialDefaultProvider:()=>async()=>n,region:p,requestHandler:m?d:void 0,logger:l})}let{Credentials:a,AssumedRoleUser:s}=await r.send(new CC(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=Uat(s);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}}}},Vat=(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 zat(u,t?.parentClientConfig?.region,c),f=!Wat(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=Uat(i);return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}}}},Wat=t=>t?.metadata?.handlerProtocol==="h2"});var Jat,Gat,Yat,nur,Zat=O(()=>{Kat();T4();Jat=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,Gat=(t={},e)=>Hat(t,Jat(bh,e)),Yat=(t={},e)=>Vat(t,Jat(bh,e)),nur=t=>e=>t({roleAssumer:Gat(e),roleAssumerWithWebIdentity:Yat(e),...e})});var Xat={};$f(Xat,{$Command:()=>yt,AssumeRoleCommand:()=>CC,AssumeRoleResponseFilterSensitiveLog:()=>o_e,AssumeRoleWithSAMLCommand:()=>k4,AssumeRoleWithSAMLRequestFilterSensitiveLog:()=>i_e,AssumeRoleWithSAMLResponseFilterSensitiveLog:()=>a_e,AssumeRoleWithWebIdentityCommand:()=>jR,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:()=>s_e,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:()=>u_e,CredentialsFilterSensitiveLog:()=>yF,DecodeAuthorizationMessageCommand:()=>$4,ExpiredTokenException:()=>A4,GetAccessKeyInfoCommand:()=>B4,GetCallerIdentityCommand:()=>q4,GetFederationTokenCommand:()=>U4,GetFederationTokenResponseFilterSensitiveLog:()=>l_e,GetSessionTokenCommand:()=>z4,GetSessionTokenResponseFilterSensitiveLog:()=>c_e,IDPCommunicationErrorException:()=>N4,IDPRejectedClaimException:()=>j4,InvalidAuthorizationMessageException:()=>L4,InvalidIdentityTokenException:()=>D4,MalformedPolicyDocumentException:()=>I4,PackedPolicyTooLargeException:()=>M4,RegionDisabledException:()=>R4,STS:()=>$Y,STSClient:()=>bh,STSServiceException:()=>_f,__Client:()=>CR,decorateDefaultCredentialProvider:()=>nur,getDefaultRoleAssumer:()=>Gat,getDefaultRoleAssumerWithWebIdentity:()=>Yat});var W_e=O(()=>{T4();kat();$at();Bat();Zat();NY()});var Qat={};$f(Qat,{AssumeRoleCommand:()=>CC,STSClient:()=>bh});var est=O(()=>{W_e()});var our,tst=O(()=>{pC();our=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 pl("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(()=>(est(),Qat));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 pl(`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 rst=O(()=>{});var nst,ost=O(()=>{nst=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(()=>(W_e(),Xat));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 ist=O(()=>{rst();ost()});var iur,ast=O(()=>{ist();iur=t=>nst({...t})});var sst={};$f(sst,{fromCognitoIdentity:()=>Zar,fromCognitoIdentityPool:()=>Xar,fromHttp:()=>Zbe,fromTemporaryCredentials:()=>our,fromWebToken:()=>iur});var ust=O(()=>{Qot();eit();_it();tst();ast()});var DR={};$f(DR,{__addDisposableResource:()=>Ast,__assign:()=>BY,__asyncDelegator:()=>wst,__asyncGenerator:()=>vst,__asyncValues:()=>Sst,__await:()=>OF,__awaiter:()=>mst,__classPrivateFieldGet:()=>Pst,__classPrivateFieldIn:()=>Tst,__classPrivateFieldSet:()=>Est,__createBinding:()=>UY,__decorate:()=>dst,__disposeResources:()=>Ist,__esDecorate:()=>aur,__exportStar:()=>gst,__extends:()=>lst,__generator:()=>hst,__importDefault:()=>Ost,__importStar:()=>Cst,__makeTemplateObject:()=>xst,__metadata:()=>pst,__param:()=>fst,__propKey:()=>uur,__read:()=>J_e,__rest:()=>cst,__runInitializers:()=>sur,__setFunctionName:()=>lur,__spread:()=>yst,__spreadArray:()=>_st,__spreadArrays:()=>bst,__values:()=>qY,default:()=>fur});function lst(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");K_e(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function cst(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 dst(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 fst(t,e){return function(r,n){e(r,n,t)}}function aur(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var b=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(d=a(b.get))&&(c.get=d),(d=a(b.set))&&(c.set=d),(d=a(b.init))&&o.unshift(d)}else(d=a(b))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function sur(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 uur(t){return typeof t=="symbol"?t:"".concat(t)}function lur(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 pst(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function mst(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 hst(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 gst(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UY(e,t,r)}function qY(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 J_e(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function yst(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(J_e(arguments[e]));return t}function bst(){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 _st(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 OF(t){return this instanceof OF?(this.v=t,this):new OF(t)}function vst(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(b,g){i.push([p,h,b,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof OF?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function wst(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:OF(t[o](a)),done:!1}:i?i(a):a}:i}}function Sst(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 qY=="function"?qY(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 xst(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Cst(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UY(e,t,r);return cur(e,t),e}function Ost(t){return t&&t.__esModule?t:{default:t}}function Pst(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 Est(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 Tst(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 Ast(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 Ist(t){function e(i){t.error=t.hasError?new dur(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 K_e,BY,UY,cur,dur,fur,NR=O(()=>{K_e=function(t,e){return K_e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},K_e(t,e)};BY=function(){return BY=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},BY.apply(this,arguments)};UY=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};cur=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};dur=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};fur={__extends:lst,__assign:BY,__rest:cst,__decorate:dst,__param:fst,__metadata:pst,__awaiter:mst,__generator:hst,__createBinding:UY,__exportStar:gst,__values:qY,__read:J_e,__spread:yst,__spreadArrays:bst,__spreadArray:_st,__await:OF,__asyncGenerator:vst,__asyncDelegator:wst,__asyncValues:Sst,__makeTemplateObject:xst,__importStar:Cst,__importDefault:Ost,__classPrivateFieldGet:Pst,__classPrivateFieldSet:Est,__classPrivateFieldIn:Tst,__addDisposableResource:Ast,__disposeResources:Ist}});var Rst=v(Mst=>{"use strict";Object.defineProperty(Mst,"__esModule",{value:!0})});var jst=v(H4=>{"use strict";Object.defineProperty(H4,"__esModule",{value:!0});H4.HttpAuthLocation=void 0;var pur;(function(t){t.HEADER="header",t.QUERY="query"})(pur=H4.HttpAuthLocation||(H4.HttpAuthLocation={}))});var Nst=v(Dst=>{"use strict";Object.defineProperty(Dst,"__esModule",{value:!0})});var Fst=v(Lst=>{"use strict";Object.defineProperty(Lst,"__esModule",{value:!0})});var $st=v(kst=>{"use strict";Object.defineProperty(kst,"__esModule",{value:!0})});var qst=v(Bst=>{"use strict";Object.defineProperty(Bst,"__esModule",{value:!0})});var zst=v(Ust=>{"use strict";Object.defineProperty(Ust,"__esModule",{value:!0})});var Vst=v(Hst=>{"use strict";Object.defineProperty(Hst,"__esModule",{value:!0})});var Kst=v(Wst=>{"use strict";Object.defineProperty(Wst,"__esModule",{value:!0})});var Jst=v(V4=>{"use strict";Object.defineProperty(V4,"__esModule",{value:!0});var G_e=(NR(),Al(DR));G_e.__exportStar(zst(),V4);G_e.__exportStar(Vst(),V4);G_e.__exportStar(Kst(),V4)});var Yst=v(Gst=>{"use strict";Object.defineProperty(Gst,"__esModule",{value:!0})});var Xst=v(Zst=>{"use strict";Object.defineProperty(Zst,"__esModule",{value:!0})});var Qst=v(W4=>{"use strict";Object.defineProperty(W4,"__esModule",{value:!0});W4.EndpointURLScheme=void 0;var mur;(function(t){t.HTTP="http",t.HTTPS="https"})(mur=W4.EndpointURLScheme||(W4.EndpointURLScheme={}))});var tut=v(eut=>{"use strict";Object.defineProperty(eut,"__esModule",{value:!0})});var nut=v(rut=>{"use strict";Object.defineProperty(rut,"__esModule",{value:!0})});var iut=v(out=>{"use strict";Object.defineProperty(out,"__esModule",{value:!0})});var sut=v(aut=>{"use strict";Object.defineProperty(aut,"__esModule",{value:!0})});var lut=v(uut=>{"use strict";Object.defineProperty(uut,"__esModule",{value:!0})});var cut=v(LR=>{"use strict";Object.defineProperty(LR,"__esModule",{value:!0});var K4=(NR(),Al(DR));K4.__exportStar(tut(),LR);K4.__exportStar(nut(),LR);K4.__exportStar(iut(),LR);K4.__exportStar(sut(),LR);K4.__exportStar(lut(),LR)});var fut=v(dut=>{"use strict";Object.defineProperty(dut,"__esModule",{value:!0})});var put=v(J4=>{"use strict";Object.defineProperty(J4,"__esModule",{value:!0});J4.FieldPosition=void 0;var hur;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(hur=J4.FieldPosition||(J4.FieldPosition={}))});var hut=v(mut=>{"use strict";Object.defineProperty(mut,"__esModule",{value:!0})});var yut=v(gut=>{"use strict";Object.defineProperty(gut,"__esModule",{value:!0})});var _ut=v(zY=>{"use strict";Object.defineProperty(zY,"__esModule",{value:!0});var but=(NR(),Al(DR));but.__exportStar(hut(),zY);but.__exportStar(yut(),zY)});var wut=v(vut=>{"use strict";Object.defineProperty(vut,"__esModule",{value:!0})});var xut=v(Sut=>{"use strict";Object.defineProperty(Sut,"__esModule",{value:!0})});var Out=v(Cut=>{"use strict";Object.defineProperty(Cut,"__esModule",{value:!0})});var Eut=v(Put=>{"use strict";Object.defineProperty(Put,"__esModule",{value:!0})});var Aut=v(Tut=>{"use strict";Object.defineProperty(Tut,"__esModule",{value:!0})});var Mut=v(Iut=>{"use strict";Object.defineProperty(Iut,"__esModule",{value:!0})});var jut=v(Rut=>{"use strict";Object.defineProperty(Rut,"__esModule",{value:!0})});var Nut=v(Dut=>{"use strict";Object.defineProperty(Dut,"__esModule",{value:!0})});var Fut=v(Lut=>{"use strict";Object.defineProperty(Lut,"__esModule",{value:!0})});var $ut=v(kut=>{"use strict";Object.defineProperty(kut,"__esModule",{value:!0})});var qut=v(But=>{"use strict";Object.defineProperty(But,"__esModule",{value:!0})});var zut=v(Uut=>{"use strict";Object.defineProperty(Uut,"__esModule",{value:!0})});var Vut=v(Hut=>{"use strict";Object.defineProperty(Hut,"__esModule",{value:!0})});var Wut=v(G4=>{"use strict";Object.defineProperty(G4,"__esModule",{value:!0});G4.RequestHandlerProtocol=void 0;var gur;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(gur=G4.RequestHandlerProtocol||(G4.RequestHandlerProtocol={}))});var Jut=v(Kut=>{"use strict";Object.defineProperty(Kut,"__esModule",{value:!0})});var Yut=v(Gut=>{"use strict";Object.defineProperty(Gut,"__esModule",{value:!0})});var Xut=v(Zut=>{"use strict";Object.defineProperty(Zut,"__esModule",{value:!0})});var elt=v(Qut=>{"use strict";Object.defineProperty(Qut,"__esModule",{value:!0})});var rlt=v(tlt=>{"use strict";Object.defineProperty(tlt,"__esModule",{value:!0})});var nlt=v($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});var lo=(NR(),Al(DR));lo.__exportStar(Rst(),$n);lo.__exportStar(jst(),$n);lo.__exportStar(Nst(),$n);lo.__exportStar(Fst(),$n);lo.__exportStar($st(),$n);lo.__exportStar(qst(),$n);lo.__exportStar(Jst(),$n);lo.__exportStar(Yst(),$n);lo.__exportStar(Xst(),$n);lo.__exportStar(Qst(),$n);lo.__exportStar(cut(),$n);lo.__exportStar(fut(),$n);lo.__exportStar(put(),$n);lo.__exportStar(_ut(),$n);lo.__exportStar(wut(),$n);lo.__exportStar(xut(),$n);lo.__exportStar(Out(),$n);lo.__exportStar(Eut(),$n);lo.__exportStar(Aut(),$n);lo.__exportStar(Mut(),$n);lo.__exportStar(jut(),$n);lo.__exportStar(Nut(),$n);lo.__exportStar(Fut(),$n);lo.__exportStar($ut(),$n);lo.__exportStar(qut(),$n);lo.__exportStar(zut(),$n);lo.__exportStar(Vut(),$n);lo.__exportStar(Wut(),$n);lo.__exportStar(Jut(),$n);lo.__exportStar(Yut(),$n);lo.__exportStar(Xut(),$n);lo.__exportStar(elt(),$n);lo.__exportStar(rlt(),$n)});var olt=v(HY=>{"use strict";Object.defineProperty(HY,"__esModule",{value:!0});HY.Field=void 0;var yur=nlt(),Y_e=class{constructor({name:e,kind:r=yur.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}};HY.Field=Y_e});var ilt=v(VY=>{"use strict";Object.defineProperty(VY,"__esModule",{value:!0});VY.Fields=void 0;var Z_e=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)}};VY.Fields=Z_e});var slt=v(alt=>{"use strict";Object.defineProperty(alt,"__esModule",{value:!0})});var ult=v(WY=>{"use strict";Object.defineProperty(WY,"__esModule",{value:!0});WY.HttpRequest=void 0;var X_e=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){let e=new t({...this,headers:{...this.headers}});return e.query&&(e.query=bur(e.query)),e}};WY.HttpRequest=X_e;function bur(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}});var llt=v(KY=>{"use strict";Object.defineProperty(KY,"__esModule",{value:!0});KY.HttpResponse=void 0;var Q_e=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"}};KY.HttpResponse=Q_e});var clt=v(JY=>{"use strict";Object.defineProperty(JY,"__esModule",{value:!0});JY.isValidHostname=void 0;function _ur(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}JY.isValidHostname=_ur});var flt=v(dlt=>{"use strict";Object.defineProperty(dlt,"__esModule",{value:!0})});var plt=v(OC=>{"use strict";Object.defineProperty(OC,"__esModule",{value:!0});var FR=(NR(),Al(DR));FR.__exportStar(olt(),OC);FR.__exportStar(ilt(),OC);FR.__exportStar(slt(),OC);FR.__exportStar(ult(),OC);FR.__exportStar(llt(),OC);FR.__exportStar(clt(),OC);FR.__exportStar(flt(),OC)});var mlt=v(eve=>{"use strict";Object.defineProperty(eve,"__esModule",{value:!0});var vur=(NR(),Al(DR));vur.__exportStar(plt(),eve)});var kR={};$f(kR,{__addDisposableResource:()=>Nlt,__assign:()=>GY,__asyncDelegator:()=>Elt,__asyncGenerator:()=>Plt,__asyncValues:()=>Tlt,__await:()=>PF,__awaiter:()=>vlt,__classPrivateFieldGet:()=>Rlt,__classPrivateFieldIn:()=>Dlt,__classPrivateFieldSet:()=>jlt,__createBinding:()=>ZY,__decorate:()=>ylt,__disposeResources:()=>Llt,__esDecorate:()=>wur,__exportStar:()=>Slt,__extends:()=>hlt,__generator:()=>wlt,__importDefault:()=>Mlt,__importStar:()=>Ilt,__makeTemplateObject:()=>Alt,__metadata:()=>_lt,__param:()=>blt,__propKey:()=>xur,__read:()=>rve,__rest:()=>glt,__runInitializers:()=>Sur,__setFunctionName:()=>Cur,__spread:()=>xlt,__spreadArray:()=>Olt,__spreadArrays:()=>Clt,__values:()=>YY,default:()=>Eur});function hlt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");tve(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function glt(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 ylt(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 blt(t,e){return function(r,n){e(r,n,t)}}function wur(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var b=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(d=a(b.get))&&(c.get=d),(d=a(b.set))&&(c.set=d),(d=a(b.init))&&o.unshift(d)}else(d=a(b))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function Sur(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 xur(t){return typeof t=="symbol"?t:"".concat(t)}function Cur(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 _lt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function vlt(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 wlt(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 Slt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ZY(e,t,r)}function YY(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 rve(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 xlt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(rve(arguments[e]));return t}function Clt(){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 Olt(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 PF(t){return this instanceof PF?(this.v=t,this):new PF(t)}function Plt(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(b,g){i.push([p,h,b,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof PF?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function Elt(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:PF(t[o](a)),done:!1}:i?i(a):a}:i}}function Tlt(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 YY=="function"?YY(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 Alt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Ilt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZY(e,t,r);return Our(e,t),e}function Mlt(t){return t&&t.__esModule?t:{default:t}}function Rlt(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 jlt(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 Dlt(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 Nlt(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 Llt(t){function e(i){t.error=t.hasError?new Pur(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 tve,GY,ZY,Our,Pur,Eur,$R=O(()=>{tve=function(t,e){return tve=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])},tve(t,e)};GY=function(){return GY=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},GY.apply(this,arguments)};ZY=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};Our=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};Pur=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};Eur={__extends:hlt,__assign:GY,__rest:glt,__decorate:ylt,__param:blt,__metadata:_lt,__awaiter:vlt,__generator:wlt,__createBinding:ZY,__exportStar:Slt,__values:YY,__read:rve,__spread:xlt,__spreadArrays:Clt,__spreadArray:Olt,__await:PF,__asyncGenerator:Plt,__asyncDelegator:Elt,__asyncValues:Tlt,__makeTemplateObject:Alt,__importStar:Ilt,__importDefault:Mlt,__classPrivateFieldGet:Rlt,__classPrivateFieldSet:jlt,__classPrivateFieldIn:Dlt,__addDisposableResource:Nlt,__disposeResources:Llt}});var ave={};$f(ave,{__assign:()=>ove,__asyncDelegator:()=>Bur,__asyncGenerator:()=>$ur,__asyncValues:()=>qur,__await:()=>Y4,__awaiter:()=>jur,__classPrivateFieldGet:()=>Vur,__classPrivateFieldSet:()=>Wur,__createBinding:()=>Nur,__decorate:()=>Iur,__exportStar:()=>Lur,__extends:()=>Tur,__generator:()=>Dur,__importDefault:()=>Hur,__importStar:()=>zur,__makeTemplateObject:()=>Uur,__metadata:()=>Rur,__param:()=>Mur,__read:()=>Flt,__rest:()=>Aur,__spread:()=>Fur,__spreadArrays:()=>kur,__values:()=>ive});function Tur(t,e){nve(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Aur(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 Iur(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 Mur(t,e){return function(r,n){e(r,n,t)}}function Rur(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function jur(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 Dur(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 Nur(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Lur(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function ive(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 Flt(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 Fur(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Flt(arguments[e]));return t}function kur(){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 Y4(t){return this instanceof Y4?(this.v=t,this):new Y4(t)}function $ur(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof Y4?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){s("next",f)}function c(f){s("throw",f)}function d(f,p){f(p),i.shift(),i.length&&s(i[0][0],i[0][1])}}function Bur(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:Y4(t[o](a)),done:o==="return"}:i?i(a):a}:i}}function qur(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 ive=="function"?ive(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 Uur(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function zur(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 Hur(t){return t&&t.__esModule?t:{default:t}}function Vur(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Wur(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 nve,ove,sve=O(()=>{nve=function(t,e){return nve=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])},nve(t,e)};ove=function(){return ove=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},ove.apply(this,arguments)}});var klt=v(EF=>{"use strict";Object.defineProperty(EF,"__esModule",{value:!0});EF.toUtf8=EF.fromUtf8=void 0;var Kur=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)};EF.fromUtf8=Kur;var Jur=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};EF.toUtf8=Jur});var $lt=v(TF=>{"use strict";Object.defineProperty(TF,"__esModule",{value:!0});TF.toUtf8=TF.fromUtf8=void 0;function Gur(t){return new TextEncoder().encode(t)}TF.fromUtf8=Gur;function Yur(t){return new TextDecoder("utf-8").decode(t)}TF.toUtf8=Yur});var Ult=v(AF=>{"use strict";Object.defineProperty(AF,"__esModule",{value:!0});AF.toUtf8=AF.fromUtf8=void 0;var Blt=klt(),qlt=$lt(),Zur=t=>typeof TextEncoder=="function"?(0,qlt.fromUtf8)(t):(0,Blt.fromUtf8)(t);AF.fromUtf8=Zur;var Xur=t=>typeof TextDecoder=="function"?(0,qlt.toUtf8)(t):(0,Blt.toUtf8)(t);AF.toUtf8=Xur});var zlt=v(XY=>{"use strict";Object.defineProperty(XY,"__esModule",{value:!0});XY.convertToBuffer=void 0;var Qur=Ult(),elr=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:Qur.fromUtf8;function tlr(t){return t instanceof Uint8Array?t:typeof t=="string"?elr(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}XY.convertToBuffer=tlr});var Hlt=v(QY=>{"use strict";Object.defineProperty(QY,"__esModule",{value:!0});QY.isEmptyData=void 0;function rlr(t){return typeof t=="string"?t.length===0:t.byteLength===0}QY.isEmptyData=rlr});var Vlt=v(eZ=>{"use strict";Object.defineProperty(eZ,"__esModule",{value:!0});eZ.numToUint8=void 0;function nlr(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}eZ.numToUint8=nlr});var Wlt=v(tZ=>{"use strict";Object.defineProperty(tZ,"__esModule",{value:!0});tZ.uint32ArrayFrom=void 0;function olr(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)}tZ.uint32ArrayFrom=olr});var uve=v(Gb=>{"use strict";Object.defineProperty(Gb,"__esModule",{value:!0});Gb.uint32ArrayFrom=Gb.numToUint8=Gb.isEmptyData=Gb.convertToBuffer=void 0;var ilr=zlt();Object.defineProperty(Gb,"convertToBuffer",{enumerable:!0,get:function(){return ilr.convertToBuffer}});var alr=Hlt();Object.defineProperty(Gb,"isEmptyData",{enumerable:!0,get:function(){return alr.isEmptyData}});var slr=Vlt();Object.defineProperty(Gb,"numToUint8",{enumerable:!0,get:function(){return slr.numToUint8}});var ulr=Wlt();Object.defineProperty(Gb,"uint32ArrayFrom",{enumerable:!0,get:function(){return ulr.uint32ArrayFrom}})});var Glt=v(rZ=>{"use strict";Object.defineProperty(rZ,"__esModule",{value:!0});rZ.AwsCrc32=void 0;var Klt=(sve(),Al(ave)),lve=uve(),Jlt=nZ(),llr=function(){function t(){this.crc32=new Jlt.Crc32}return t.prototype.update=function(e){(0,lve.isEmptyData)(e)||this.crc32.update((0,lve.convertToBuffer)(e))},t.prototype.digest=function(){return Klt.__awaiter(this,void 0,void 0,function(){return Klt.__generator(this,function(e){return[2,(0,lve.numToUint8)(this.crc32.digest())]})})},t.prototype.reset=function(){this.crc32=new Jlt.Crc32},t}();rZ.AwsCrc32=llr});var nZ=v(nT=>{"use strict";Object.defineProperty(nT,"__esModule",{value:!0});nT.AwsCrc32=nT.Crc32=nT.crc32=void 0;var clr=(sve(),Al(ave)),dlr=uve();function flr(t){return new Ylt().update(t).digest()}nT.crc32=flr;var Ylt=function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var r,n;try{for(var o=clr.__values(e),i=o.next();!i.done;i=o.next()){var a=i.value;this.checksum=this.checksum>>>8^mlr[(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}();nT.Crc32=Ylt;var plr=[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],mlr=(0,dlr.uint32ArrayFrom)(plr),hlr=Glt();Object.defineProperty(nT,"AwsCrc32",{enumerable:!0,get:function(){return hlr.AwsCrc32}})});var MF=v(IF=>{"use strict";Object.defineProperty(IF,"__esModule",{value:!0});IF.toHex=IF.fromHex=void 0;var Zlt={},cve={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Zlt[t]=e,cve[e]=t}function glr(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 cve)e[r/2]=cve[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}IF.fromHex=glr;function ylr(t){let e="";for(let r=0;r<t.byteLength;r++)e+=Zlt[t[r]];return e}IF.toHex=ylr});var fve=v(oZ=>{"use strict";Object.defineProperty(oZ,"__esModule",{value:!0});oZ.Int64=void 0;var blr=MF(),dve=class t{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let n=7,o=Math.abs(Math.round(e));n>-1&&o>0;n--,o/=256)r[n]=o;return e<0&&Xlt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&Xlt(e),parseInt((0,blr.toHex)(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};oZ.Int64=dve;function Xlt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}});var hve=v(iZ=>{"use strict";Object.defineProperty(iZ,"__esModule",{value:!0});iZ.HeaderMarshaller=void 0;var RF=MF(),pve=fve(),mve=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(pve.Int64.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!Elr.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set((0,RF.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:ect,value:!0};break;case 1:r[i]={type:ect,value:!1};break;case 2:r[i]={type:_lr,value:e.getInt8(n++)};break;case 3:r[i]={type:vlr,value:e.getInt16(n,!1)},n+=2;break;case 4:r[i]={type:wlr,value:e.getInt32(n,!1)},n+=4;break;case 5:r[i]={type:Slr,value:new pve.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:xlr,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:Clr,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,s))},n+=s;break;case 8:r[i]={type:Olr,value:new Date(new pve.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:Plr,value:`${(0,RF.toHex)(u.subarray(0,4))}-${(0,RF.toHex)(u.subarray(4,6))}-${(0,RF.toHex)(u.subarray(6,8))}-${(0,RF.toHex)(u.subarray(8,10))}-${(0,RF.toHex)(u.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};iZ.HeaderMarshaller=mve;var Qlt;(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"})(Qlt||(Qlt={}));var ect="boolean",_lr="byte",vlr="short",wlr="integer",Slr="long",xlr="binary",Clr="string",Olr="timestamp",Plr="uuid",Elr=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});var rct=v(aZ=>{"use strict";Object.defineProperty(aZ,"__esModule",{value:!0});aZ.splitMessage=void 0;var Tlr=nZ(),tct=4,oT=tct*2,BR=4,Alr=oT+BR*2;function Ilr({byteLength:t,byteOffset:e,buffer:r}){if(t<Alr)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(tct,!1),a=n.getUint32(oT,!1),s=n.getUint32(t-BR,!1),u=new Tlr.Crc32().update(new Uint8Array(r,e,oT));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+oT,t-(oT+BR))),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+oT+BR,i),body:new Uint8Array(r,e+oT+BR+i,o-i-(oT+BR+BR))}}aZ.splitMessage=Ilr});var nct=v(sZ=>{"use strict";Object.defineProperty(sZ,"__esModule",{value:!0});sZ.EventStreamCodec=void 0;var Mlr=nZ(),Rlr=hve(),jlr=rct(),gve=class{constructor(e,r){this.headerMarshaller=new Rlr.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 Mlr.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,jlr.splitMessage)(e);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}};sZ.EventStreamCodec=gve});var ict=v(oct=>{"use strict";Object.defineProperty(oct,"__esModule",{value:!0})});var act=v(uZ=>{"use strict";Object.defineProperty(uZ,"__esModule",{value:!0});uZ.MessageDecoderStream=void 0;var yve=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)}};uZ.MessageDecoderStream=yve});var sct=v(lZ=>{"use strict";Object.defineProperty(lZ,"__esModule",{value:!0});lZ.MessageEncoderStream=void 0;var bve=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))}};lZ.MessageEncoderStream=bve});var uct=v(cZ=>{"use strict";Object.defineProperty(cZ,"__esModule",{value:!0});cZ.SmithyMessageDecoderStream=void 0;var _ve=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)}}};cZ.SmithyMessageDecoderStream=_ve});var lct=v(dZ=>{"use strict";Object.defineProperty(dZ,"__esModule",{value:!0});dZ.SmithyMessageEncoderStream=void 0;var vve=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)}};dZ.SmithyMessageEncoderStream=vve});var cct=v(Yb=>{"use strict";Object.defineProperty(Yb,"__esModule",{value:!0});var iT=($R(),Al(kR));iT.__exportStar(nct(),Yb);iT.__exportStar(hve(),Yb);iT.__exportStar(fve(),Yb);iT.__exportStar(ict(),Yb);iT.__exportStar(act(),Yb);iT.__exportStar(sct(),Yb);iT.__exportStar(uct(),Yb);iT.__exportStar(lct(),Yb)});var dct=v(fZ=>{"use strict";Object.defineProperty(fZ,"__esModule",{value:!0});fZ.normalizeProvider=void 0;var Dlr=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};fZ.normalizeProvider=Dlr});var fct=v(wve=>{"use strict";Object.defineProperty(wve,"__esModule",{value:!0});var Nlr=($R(),Al(kR));Nlr.__exportStar(dct(),wve)});var Sve=v(pZ=>{"use strict";Object.defineProperty(pZ,"__esModule",{value:!0});pZ.isArrayBuffer=void 0;var Llr=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";pZ.isArrayBuffer=Llr});var Cve=v(jF=>{"use strict";Object.defineProperty(jF,"__esModule",{value:!0});jF.fromString=jF.fromArrayBuffer=void 0;var Flr=Sve(),xve=tp(),klr=(t,e=0,r=t.byteLength-e)=>{if(!(0,Flr.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return xve.Buffer.from(t,e,r)};jF.fromArrayBuffer=klr;var $lr=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?xve.Buffer.from(t,e):xve.Buffer.from(t)};jF.fromString=$lr});var Ove=v(mZ=>{"use strict";Object.defineProperty(mZ,"__esModule",{value:!0});mZ.fromUtf8=void 0;var Blr=Cve(),qlr=t=>{let e=(0,Blr.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)};mZ.fromUtf8=qlr});var pct=v(hZ=>{"use strict";Object.defineProperty(hZ,"__esModule",{value:!0});hZ.toUint8Array=void 0;var Ulr=Ove(),zlr=t=>typeof t=="string"?(0,Ulr.fromUtf8)(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t);hZ.toUint8Array=zlr});var mct=v(gZ=>{"use strict";Object.defineProperty(gZ,"__esModule",{value:!0});gZ.toUtf8=void 0;var Hlr=Cve(),Vlr=t=>(0,Hlr.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8");gZ.toUtf8=Vlr});var yZ=v(Z4=>{"use strict";Object.defineProperty(Z4,"__esModule",{value:!0});var Pve=($R(),Al(kR));Pve.__exportStar(Ove(),Z4);Pve.__exportStar(pct(),Z4);Pve.__exportStar(mct(),Z4)});var qR=v(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.MAX_PRESIGNED_TTL=Ot.KEY_TYPE_IDENTIFIER=Ot.MAX_CACHE_SIZE=Ot.UNSIGNED_PAYLOAD=Ot.EVENT_ALGORITHM_IDENTIFIER=Ot.ALGORITHM_IDENTIFIER_V4A=Ot.ALGORITHM_IDENTIFIER=Ot.UNSIGNABLE_PATTERNS=Ot.SEC_HEADER_PATTERN=Ot.PROXY_HEADER_PATTERN=Ot.ALWAYS_UNSIGNABLE_HEADERS=Ot.HOST_HEADER=Ot.TOKEN_HEADER=Ot.SHA256_HEADER=Ot.SIGNATURE_HEADER=Ot.GENERATED_HEADERS=Ot.DATE_HEADER=Ot.AMZ_DATE_HEADER=Ot.AUTH_HEADER=Ot.REGION_SET_PARAM=Ot.TOKEN_QUERY_PARAM=Ot.SIGNATURE_QUERY_PARAM=Ot.EXPIRES_QUERY_PARAM=Ot.SIGNED_HEADERS_QUERY_PARAM=Ot.AMZ_DATE_QUERY_PARAM=Ot.CREDENTIAL_QUERY_PARAM=Ot.ALGORITHM_QUERY_PARAM=void 0;Ot.ALGORITHM_QUERY_PARAM="X-Amz-Algorithm";Ot.CREDENTIAL_QUERY_PARAM="X-Amz-Credential";Ot.AMZ_DATE_QUERY_PARAM="X-Amz-Date";Ot.SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders";Ot.EXPIRES_QUERY_PARAM="X-Amz-Expires";Ot.SIGNATURE_QUERY_PARAM="X-Amz-Signature";Ot.TOKEN_QUERY_PARAM="X-Amz-Security-Token";Ot.REGION_SET_PARAM="X-Amz-Region-Set";Ot.AUTH_HEADER="authorization";Ot.AMZ_DATE_HEADER=Ot.AMZ_DATE_QUERY_PARAM.toLowerCase();Ot.DATE_HEADER="date";Ot.GENERATED_HEADERS=[Ot.AUTH_HEADER,Ot.AMZ_DATE_HEADER,Ot.DATE_HEADER];Ot.SIGNATURE_HEADER=Ot.SIGNATURE_QUERY_PARAM.toLowerCase();Ot.SHA256_HEADER="x-amz-content-sha256";Ot.TOKEN_HEADER=Ot.TOKEN_QUERY_PARAM.toLowerCase();Ot.HOST_HEADER="host";Ot.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};Ot.PROXY_HEADER_PATTERN=/^proxy-/;Ot.SEC_HEADER_PATTERN=/^sec-/;Ot.UNSIGNABLE_PATTERNS=[/^proxy-/i,/^sec-/i];Ot.ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256";Ot.ALGORITHM_IDENTIFIER_V4A="AWS4-ECDSA-P256-SHA256";Ot.EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD";Ot.UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD";Ot.MAX_CACHE_SIZE=50;Ot.KEY_TYPE_IDENTIFIER="aws4_request";Ot.MAX_PRESIGNED_TTL=60*60*24*7});var Tve=v(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});aT.clearCredentialCache=aT.getSigningKey=aT.createScope=void 0;var Wlr=MF(),Klr=yZ(),Eve=qR(),DF={},bZ=[],Jlr=(t,e,r)=>`${t}/${e}/${r}/${Eve.KEY_TYPE_IDENTIFIER}`;aT.createScope=Jlr;var Glr=async(t,e,r,n,o)=>{let i=await hct(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${(0,Wlr.toHex)(i)}:${e.sessionToken}`;if(a in DF)return DF[a];for(bZ.push(a);bZ.length>Eve.MAX_CACHE_SIZE;)delete DF[bZ.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,Eve.KEY_TYPE_IDENTIFIER])s=await hct(t,s,u);return DF[a]=s};aT.getSigningKey=Glr;var Ylr=()=>{bZ.length=0,Object.keys(DF).forEach(t=>{delete DF[t]})};aT.clearCredentialCache=Ylr;var hct=(t,e,r)=>{let n=new t(e);return n.update((0,Klr.toUint8Array)(r)),n.digest()}});var Ive=v(_Z=>{"use strict";Object.defineProperty(_Z,"__esModule",{value:!0});_Z.getCanonicalHeaders=void 0;var Ave=qR(),Zlr=({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 Ave.ALWAYS_UNSIGNABLE_HEADERS||e?.has(i)||Ave.PROXY_HEADER_PATTERN.test(i)||Ave.SEC_HEADER_PATTERN.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n};_Z.getCanonicalHeaders=Zlr});var Mve=v(vZ=>{"use strict";Object.defineProperty(vZ,"__esModule",{value:!0});vZ.escapeUri=void 0;var Xlr=t=>encodeURIComponent(t).replace(/[!'()*]/g,Qlr);vZ.escapeUri=Xlr;var Qlr=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var gct=v(wZ=>{"use strict";Object.defineProperty(wZ,"__esModule",{value:!0});wZ.escapeUriPath=void 0;var ecr=Mve(),tcr=t=>t.split("/").map(ecr.escapeUri).join("/");wZ.escapeUriPath=tcr});var bct=v(SZ=>{"use strict";Object.defineProperty(SZ,"__esModule",{value:!0});var yct=($R(),Al(kR));yct.__exportStar(Mve(),SZ);yct.__exportStar(gct(),SZ)});var Rve=v(CZ=>{"use strict";Object.defineProperty(CZ,"__esModule",{value:!0});CZ.getCanonicalQuery=void 0;var xZ=bct(),rcr=qR(),ncr=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===rcr.SIGNATURE_HEADER)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${(0,xZ.escapeUri)(n)}=${(0,xZ.escapeUri)(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).sort().reduce((i,a)=>i.concat([`${(0,xZ.escapeUri)(n)}=${(0,xZ.escapeUri)(a)}`]),[]).join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")};CZ.getCanonicalQuery=ncr});var jve=v(OZ=>{"use strict";Object.defineProperty(OZ,"__esModule",{value:!0});OZ.getPayloadHash=void 0;var ocr=Sve(),icr=MF(),acr=yZ(),_ct=qR(),scr=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===_ct.SHA256_HEADER)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||(0,ocr.isArrayBuffer)(e)){let n=new r;return n.update((0,acr.toUint8Array)(e)),(0,icr.toHex)(await n.digest())}return _ct.UNSIGNED_PAYLOAD};OZ.getPayloadHash=scr});var vct=v(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0});sT.deleteHeader=sT.getHeaderValue=sT.hasHeader=void 0;var ucr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1};sT.hasHeader=ucr;var lcr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return e[r]};sT.getHeaderValue=lcr;var ccr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))t===r.toLowerCase()&&delete e[r]};sT.deleteHeader=ccr});var Dve=v(UR=>{"use strict";Object.defineProperty(UR,"__esModule",{value:!0});UR.cloneQuery=UR.cloneRequest=void 0;var dcr=({headers:t,query:e,...r})=>({...r,headers:{...t},query:e?(0,UR.cloneQuery)(e):void 0});UR.cloneRequest=dcr;var fcr=t=>Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{});UR.cloneQuery=fcr});var Nve=v(PZ=>{"use strict";Object.defineProperty(PZ,"__esModule",{value:!0});PZ.moveHeadersToQuery=void 0;var pcr=Dve(),mcr=(t,e={})=>{var r;let{headers:n,query:o={}}=typeof t.clone=="function"?t.clone():(0,pcr.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}};PZ.moveHeadersToQuery=mcr});var Lve=v(EZ=>{"use strict";Object.defineProperty(EZ,"__esModule",{value:!0});EZ.prepareRequest=void 0;var hcr=Dve(),gcr=qR(),ycr=t=>{t=typeof t.clone=="function"?t.clone():(0,hcr.cloneRequest)(t);for(let e of Object.keys(t.headers))gcr.GENERATED_HEADERS.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t};EZ.prepareRequest=ycr});var wct=v(zR=>{"use strict";Object.defineProperty(zR,"__esModule",{value:!0});zR.toDate=zR.iso8601=void 0;var bcr=t=>(0,zR.toDate)(t).toISOString().replace(/\.\d{3}Z$/,"Z");zR.iso8601=bcr;var _cr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;zR.toDate=_cr});var Pct=v(MZ=>{"use strict";Object.defineProperty(MZ,"__esModule",{value:!0});MZ.SignatureV4=void 0;var vcr=cct(),TZ=MF(),Sct=fct(),X4=yZ(),Oc=qR(),AZ=Tve(),xct=Ive(),wcr=Rve(),Fve=jve(),Scr=vct(),xcr=Nve(),Cct=Lve(),Ccr=wct(),kve=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerMarshaller=new vcr.HeaderMarshaller(X4.toUtf8,X4.fromUtf8),this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=(0,Sct.normalizeProvider)(n),this.credentialProvider=(0,Sct.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}=IZ(n);if(o>Oc.MAX_PRESIGNED_TTL)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=(0,AZ.createScope)(p,d,l??this.service),h=(0,xcr.moveHeadersToQuery)((0,Cct.prepareRequest)(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[Oc.TOKEN_QUERY_PARAM]=c.sessionToken),h.query[Oc.ALGORITHM_QUERY_PARAM]=Oc.ALGORITHM_IDENTIFIER,h.query[Oc.CREDENTIAL_QUERY_PARAM]=`${c.accessKeyId}/${m}`,h.query[Oc.AMZ_DATE_QUERY_PARAM]=f,h.query[Oc.EXPIRES_QUERY_PARAM]=o.toString(10);let b=(0,xct.getCanonicalHeaders)(h,i,s);return h.query[Oc.SIGNED_HEADERS_QUERY_PARAM]=Oct(b),h.query[Oc.SIGNATURE_QUERY_PARAM]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,b,await(0,Fve.getPayloadHash)(e,this.sha256))),h}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=IZ(n),c=(0,AZ.createScope)(u,s,a??this.service),d=await(0,Fve.getPayloadHash)({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=(0,TZ.toHex)(await f.digest()),m=[Oc.EVENT_ALGORITHM_IDENTIFIER,l,c,o,p,d].join(`
`);return this.signString(m,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerMarshaller.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=IZ(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update((0,X4.toUint8Array)(e)),(0,TZ.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,Cct.prepareRequest)(e),{longDate:c,shortDate:d}=IZ(r),f=(0,AZ.createScope)(d,u,a??this.service);l.headers[Oc.AMZ_DATE_HEADER]=c,s.sessionToken&&(l.headers[Oc.TOKEN_HEADER]=s.sessionToken);let p=await(0,Fve.getPayloadHash)(l,this.sha256);!(0,Scr.hasHeader)(Oc.SHA256_HEADER,l.headers)&&this.applyChecksum&&(l.headers[Oc.SHA256_HEADER]=p);let m=(0,xct.getCanonicalHeaders)(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[Oc.AUTH_HEADER]=`${Oc.ALGORITHM_IDENTIFIER} Credential=${s.accessKeyId}/${f}, SignedHeaders=${Oct(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${(0,wcr.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,X4.toUint8Array)(n));let i=await o.digest();return`${Oc.ALGORITHM_IDENTIFIER}
${e}
${r}
${(0,TZ.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,X4.toUint8Array)(i)),(0,TZ.toHex)(await a.digest())}getSigningKey(e,r,n,o){return(0,AZ.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")}};MZ.SignatureV4=kve;var IZ=t=>{let e=(0,Ccr.iso8601)(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},Oct=t=>Object.keys(t).sort().join(";")});var Tct=v(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});up.prepareRequest=up.moveHeadersToQuery=up.getPayloadHash=up.getCanonicalQuery=up.getCanonicalHeaders=void 0;var Ect=($R(),Al(kR));Ect.__exportStar(Pct(),up);var Ocr=Ive();Object.defineProperty(up,"getCanonicalHeaders",{enumerable:!0,get:function(){return Ocr.getCanonicalHeaders}});var Pcr=Rve();Object.defineProperty(up,"getCanonicalQuery",{enumerable:!0,get:function(){return Pcr.getCanonicalQuery}});var Ecr=jve();Object.defineProperty(up,"getPayloadHash",{enumerable:!0,get:function(){return Ecr.getPayloadHash}});var Tcr=Nve();Object.defineProperty(up,"moveHeadersToQuery",{enumerable:!0,get:function(){return Tcr.moveHeadersToQuery}});var Acr=Lve();Object.defineProperty(up,"prepareRequest",{enumerable:!0,get:function(){return Acr.prepareRequest}});Ect.__exportStar(Tve(),up)});var Act=v($ve=>{"use strict";Object.defineProperty($ve,"__esModule",{value:!0});var Icr=($R(),Al(kR));Icr.__exportStar(Tct(),$ve)});var La=v((Wso,Ict)=>{"use strict";Ict.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 NF=v((Kso,RZ)=>{"use strict";var{AbortController:Mct,AbortSignal:Mcr}=typeof self<"u"?self:typeof window<"u"?window:void 0;RZ.exports=Mct;RZ.exports.AbortSignal=Mcr;RZ.exports.default=Mct});var Q4=v((Jso,Bve)=>{"use strict";var LF=typeof Reflect=="object"?Reflect:null,Rct=LF&&typeof LF.apply=="function"?LF.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},jZ;LF&&typeof LF.ownKeys=="function"?jZ=LF.ownKeys:Object.getOwnPropertySymbols?jZ=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:jZ=function(e){return Object.getOwnPropertyNames(e)};function Rcr(t){console&&console.warn&&console.warn(t)}var Dct=Number.isNaN||function(e){return e!==e};function bi(){bi.init.call(this)}Bve.exports=bi;Bve.exports.once=Lcr;bi.EventEmitter=bi;bi.prototype._events=void 0;bi.prototype._eventsCount=0;bi.prototype._maxListeners=void 0;var jct=10;function DZ(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(bi,"defaultMaxListeners",{enumerable:!0,get:function(){return jct},set:function(t){if(typeof t!="number"||t<0||Dct(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");jct=t}});bi.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};bi.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Dct(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 Nct(t){return t._maxListeners===void 0?bi.defaultMaxListeners:t._maxListeners}bi.prototype.getMaxListeners=function(){return Nct(this)};bi.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")Rct(u,this,r);else for(var l=u.length,c=Bct(u,l),n=0;n<l;++n)Rct(c[n],this,r);return!0};function Lct(t,e,r,n){var o,i,a;if(DZ(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=Nct(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,Rcr(s)}return t}bi.prototype.addListener=function(e,r){return Lct(this,e,r,!1)};bi.prototype.on=bi.prototype.addListener;bi.prototype.prependListener=function(e,r){return Lct(this,e,r,!0)};function jcr(){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 Fct(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=jcr.bind(n);return o.listener=r,n.wrapFn=o,o}bi.prototype.once=function(e,r){return DZ(r),this.on(e,Fct(this,e,r)),this};bi.prototype.prependOnceListener=function(e,r){return DZ(r),this.prependListener(e,Fct(this,e,r)),this};bi.prototype.removeListener=function(e,r){var n,o,i,a,s;if(DZ(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():Dcr(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};bi.prototype.off=bi.prototype.removeListener;bi.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 kct(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?Ncr(o):Bct(o,o.length)}bi.prototype.listeners=function(e){return kct(this,e,!0)};bi.prototype.rawListeners=function(e){return kct(this,e,!1)};bi.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):$ct.call(t,e)};bi.prototype.listenerCount=$ct;function $ct(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}bi.prototype.eventNames=function(){return this._eventsCount>0?jZ(this._events):[]};function Bct(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Dcr(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Ncr(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Lcr(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))}qct(t,e,i,{once:!0}),e!=="error"&&Fcr(t,o,{once:!0})})}function Fcr(t,e,r){typeof t.on=="function"&&qct(t,"error",e,r)}function qct(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 Ed=v((Gso,Uve)=>{"use strict";var kcr=tp(),{kResistStopPropagation:$cr,SymbolDispose:Bcr}=La(),qcr=globalThis.AbortSignal||NF().AbortSignal,Ucr=globalThis.AbortController||NF().AbortController,zcr=Object.getPrototypeOf(async function(){}).constructor,Uct=globalThis.Blob||kcr.Blob,Hcr=typeof Uct<"u"?function(e){return e instanceof Uct}:function(e){return!1},zct=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},Vcr=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},qve=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}};Uve.exports={AggregateError:qve,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 zcr},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Hcr,deprecate(t,e){return t},addAbortListener:Q4().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);zct(e,"signal"),Vcr(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[$cr]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Bcr](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:qcr.any||function(e){if(e.length===1)return e[0];let r=new Ucr,n=()=>r.abort();return e.forEach(o=>{zct(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};Uve.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Sf=v((Yso,Wct)=>{"use strict";var{format:Wcr,inspect:NZ,AggregateError:Kcr}=Ed(),Jcr=globalThis.AggregateError||Kcr,Gcr=Symbol("kIsNodeError"),Ycr=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Zcr=/^([A-Z][a-z0-9]*)+$/,Xcr="__node_internal_",LZ={};function HR(t,e){if(!t)throw new LZ.ERR_INTERNAL_ASSERTION(e)}function Hct(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 Qcr(t,e,r){if(typeof e=="function")return HR(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 HR(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Wcr(e,...r)}function Pc(t,e,r){r||(r=Error);class n extends r{constructor(...i){super(Qcr(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[Gcr]=!0,LZ[t]=n}function Vct(t){let e=Xcr+t.name;return Object.defineProperty(t,"name",{value:e}),t}function edr(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new Jcr([e,t],e.message);return r.code=e.code,r}return t||e}var zve=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new LZ.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};Pc("ERR_ASSERTION","%s",Error);Pc("ERR_INVALID_ARG_TYPE",(t,e,r)=>{HR(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)HR(typeof u=="string","All expected entries have to be of type string"),Ycr.includes(u)?o.push(u.toLowerCase()):Zcr.test(u)?i.push(u):(HR(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=NZ(r,{depth:-1});n+=`. Received ${u}`}}else{let u=NZ(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);Pc("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=NZ(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);Pc("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);Pc("ERR_MISSING_ARGS",(...t)=>{HR(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);Pc("ERR_OUT_OF_RANGE",(t,e,r)=>{HR(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=Hct(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=Hct(n)),n+="n"):n=NZ(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);Pc("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Pc("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Pc("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Pc("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Pc("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Pc("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Pc("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Pc("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Pc("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Pc("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Pc("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Wct.exports={AbortError:zve,aggregateTwoErrors:Vct(edr),hideStackFrames:Vct,codes:LZ}});var kF=v((Zso,rdt)=>{"use strict";var{ArrayIsArray:Vve,ArrayPrototypeIncludes:Yct,ArrayPrototypeJoin:Zct,ArrayPrototypeMap:tdr,NumberIsInteger:Wve,NumberIsNaN:rdr,NumberMAX_SAFE_INTEGER:ndr,NumberMIN_SAFE_INTEGER:odr,NumberParseInt:idr,ObjectPrototypeHasOwnProperty:adr,RegExpPrototypeExec:Xct,String:sdr,StringPrototypeToUpperCase:udr,StringPrototypeTrim:ldr}=La(),{hideStackFrames:xh,codes:{ERR_SOCKET_BAD_PORT:cdr,ERR_INVALID_ARG_TYPE:Td,ERR_INVALID_ARG_VALUE:FF,ERR_OUT_OF_RANGE:VR,ERR_UNKNOWN_SIGNAL:Kct}}=Sf(),{normalizeEncoding:ddr}=Ed(),{isAsyncFunction:fdr,isArrayBufferView:pdr}=Ed().types,Jct={};function mdr(t){return t===(t|0)}function hdr(t){return t===t>>>0}var gdr=/^[0-7]+$/,ydr="must be a 32-bit unsigned integer or an octal string";function bdr(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(Xct(gdr,t)===null)throw new FF(e,t,ydr);t=idr(t,8)}return Qct(t,e),t}var _dr=xh((t,e,r=odr,n=ndr)=>{if(typeof t!="number")throw new Td(e,"number",t);if(!Wve(t))throw new VR(e,"an integer",t);if(t<r||t>n)throw new VR(e,`>= ${r} && <= ${n}`,t)}),vdr=xh((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Td(e,"number",t);if(!Wve(t))throw new VR(e,"an integer",t);if(t<r||t>n)throw new VR(e,`>= ${r} && <= ${n}`,t)}),Qct=xh((t,e,r=!1)=>{if(typeof t!="number")throw new Td(e,"number",t);if(!Wve(t))throw new VR(e,"an integer",t);let n=r?1:0,o=4294967295;if(t<n||t>o)throw new VR(e,`>= ${n} && <= ${o}`,t)});function Kve(t,e){if(typeof t!="string")throw new Td(e,"string",t)}function wdr(t,e,r=void 0,n){if(typeof t!="number")throw new Td(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&rdr(t))throw new VR(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var Sdr=xh((t,e,r)=>{if(!Yct(r,t)){let o="must be one of: "+Zct(tdr(r,i=>typeof i=="string"?`'${i}'`:sdr(i)),", ");throw new FF(e,t,o)}});function edt(t,e){if(typeof t!="boolean")throw new Td(e,"boolean",t)}function Hve(t,e,r){return t==null||!adr(t,e)?r:t[e]}var xdr=xh((t,e,r=null)=>{let n=Hve(r,"allowArray",!1),o=Hve(r,"allowFunction",!1);if(!Hve(r,"nullable",!1)&&t===null||!n&&Vve(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new Td(e,"Object",t)}),Cdr=xh((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Td(e,"a dictionary",t)}),FZ=xh((t,e,r=0)=>{if(!Vve(t))throw new Td(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new FF(e,t,n)}});function Odr(t,e){FZ(t,e);for(let r=0;r<t.length;r++)Kve(t[r],`${e}[${r}]`)}function Pdr(t,e){FZ(t,e);for(let r=0;r<t.length;r++)edt(t[r],`${e}[${r}]`)}function Edr(t,e){FZ(t,e);for(let r=0;r<t.length;r++){let n=t[r],o=`${e}[${r}]`;if(n==null)throw new Td(o,"AbortSignal",n);tdt(n,o)}}function Tdr(t,e="signal"){if(Kve(t,e),Jct[t]===void 0)throw Jct[udr(t)]!==void 0?new Kct(t+" (signals must use all capital letters)"):new Kct(t)}var Adr=xh((t,e="buffer")=>{if(!pdr(t))throw new Td(e,["Buffer","TypedArray","DataView"],t)});function Idr(t,e){let r=ddr(e),n=t.length;if(r==="hex"&&n%2!==0)throw new FF("encoding",e,`is invalid for data of length ${n}`)}function Mdr(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&ldr(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new cdr(e,t,r);return t|0}var tdt=xh((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Td(e,"AbortSignal",t)}),Rdr=xh((t,e)=>{if(typeof t!="function")throw new Td(e,"Function",t)}),jdr=xh((t,e)=>{if(typeof t!="function"||fdr(t))throw new Td(e,"Function",t)}),Ddr=xh((t,e)=>{if(t!==void 0)throw new Td(e,"undefined",t)});function Ndr(t,e,r){if(!Yct(r,t))throw new Td(e,`('${Zct(r,"|")}')`,t)}var Ldr=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Gct(t,e){if(typeof t>"u"||!Xct(Ldr,t))throw new FF(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function Fdr(t){if(typeof t=="string")return Gct(t,"hints"),t;if(Vve(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let o=t[n];Gct(o,"hints"),r+=o,n!==e-1&&(r+=", ")}return r}throw new FF("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}rdt.exports={isInt32:mdr,isUint32:hdr,parseFileMode:bdr,validateArray:FZ,validateStringArray:Odr,validateBooleanArray:Pdr,validateAbortSignalArray:Edr,validateBoolean:edt,validateBuffer:Adr,validateDictionary:Cdr,validateEncoding:Idr,validateFunction:Rdr,validateInt32:vdr,validateInteger:_dr,validateNumber:wdr,validateObject:xdr,validateOneOf:Sdr,validatePlainFunction:jdr,validatePort:Mdr,validateSignalName:Tdr,validateString:Kve,validateUint32:Qct,validateUndefined:Ddr,validateUnion:Ndr,validateAbortSignal:tdt,validateLinkHeaderValue:Fdr}});var uT=v((Xso,adt)=>{var vs=adt.exports={},Zb,Xb;function Jve(){throw new Error("setTimeout has not been defined")}function Gve(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Zb=setTimeout:Zb=Jve}catch{Zb=Jve}try{typeof clearTimeout=="function"?Xb=clearTimeout:Xb=Gve}catch{Xb=Gve}})();function ndt(t){if(Zb===setTimeout)return setTimeout(t,0);if((Zb===Jve||!Zb)&&setTimeout)return Zb=setTimeout,setTimeout(t,0);try{return Zb(t,0)}catch{try{return Zb.call(null,t,0)}catch{return Zb.call(this,t,0)}}}function kdr(t){if(Xb===clearTimeout)return clearTimeout(t);if((Xb===Gve||!Xb)&&clearTimeout)return Xb=clearTimeout,clearTimeout(t);try{return Xb(t)}catch{try{return Xb.call(null,t)}catch{return Xb.call(this,t)}}}var PC=[],$F=!1,WR,kZ=-1;function $dr(){!$F||!WR||($F=!1,WR.length?PC=WR.concat(PC):kZ=-1,PC.length&&odt())}function odt(){if(!$F){var t=ndt($dr);$F=!0;for(var e=PC.length;e;){for(WR=PC,PC=[];++kZ<e;)WR&&WR[kZ].run();kZ=-1,e=PC.length}WR=null,$F=!1,kdr(t)}}vs.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];PC.push(new idt(t,e)),PC.length===1&&!$F&&ndt(odt)};function idt(t,e){this.fun=t,this.array=e}idt.prototype.run=function(){this.fun.apply(null,this.array)};vs.title="browser";vs.browser=!0;vs.env={};vs.argv=[];vs.version="";vs.versions={};function EC(){}vs.on=EC;vs.addListener=EC;vs.once=EC;vs.off=EC;vs.removeListener=EC;vs.removeAllListeners=EC;vs.emit=EC;vs.prependListener=EC;vs.prependOnceListener=EC;vs.listeners=function(t){return[]};vs.binding=function(t){throw new Error("process.binding is not supported")};vs.cwd=function(){return"/"};vs.chdir=function(t){throw new Error("process.chdir is not supported")};vs.umask=function(){return 0}});var e_=v((Qso,wdt)=>{"use strict";var{SymbolAsyncIterator:sdt,SymbolIterator:udt,SymbolFor:KR}=La(),ldt=KR("nodejs.stream.destroyed"),cdt=KR("nodejs.stream.errored"),Yve=KR("nodejs.stream.readable"),Zve=KR("nodejs.stream.writable"),ddt=KR("nodejs.stream.disturbed"),Bdr=KR("nodejs.webstream.isClosedPromise"),qdr=KR("nodejs.webstream.controllerErrorFunction");function $Z(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 BZ(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 Udr(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function Qb(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function fdt(t){return!!(t&&!Qb(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function pdt(t){return!!(t&&!Qb(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function mdt(t){return!!(t&&!Qb(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function zdr(t){return fdt(t)||pdt(t)||mdt(t)}function Hdr(t,e){return t==null?!1:e===!0?typeof t[sdt]=="function":e===!1?typeof t[udt]=="function":typeof t[sdt]=="function"||typeof t[udt]=="function"}function qZ(t){if(!Qb(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[ldt]||n!=null&&n.destroyed)}function hdt(t){if(!BZ(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 Vdr(t,e){if(!BZ(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 Wdr(t){if(!$Z(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 gdt(t,e){if(!$Z(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 ydt(t){return t&&t[Yve]!=null?t[Yve]:typeof t?.readable!="boolean"?null:qZ(t)?!1:$Z(t)&&t.readable&&!gdt(t)}function bdt(t){return t&&t[Zve]!=null?t[Zve]:typeof t?.writable!="boolean"?null:qZ(t)?!1:BZ(t)&&t.writable&&!hdt(t)}function Kdr(t,e){return Qb(t)?qZ(t)?!0:!(e?.readable!==!1&&ydt(t)||e?.writable!==!1&&bdt(t)):null}function Jdr(t){var e,r;return Qb(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 Gdr(t){var e,r;return Qb(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 Ydr(t){if(!Qb(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"&&_dt(t)?t._closed:null}function _dt(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function vdt(t){return typeof t._sent100=="boolean"&&_dt(t)}function Zdr(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 Xdr(t){if(!Qb(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&vdt(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function Qdr(t){var e;return!!(t&&((e=t[ddt])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function efr(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[cdt])!==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))}wdt.exports={isDestroyed:qZ,kIsDestroyed:ldt,isDisturbed:Qdr,kIsDisturbed:ddt,isErrored:efr,kIsErrored:cdt,isReadable:ydt,kIsReadable:Yve,kIsClosedPromise:Bdr,kControllerErrorFunction:qdr,kIsWritable:Zve,isClosed:Ydr,isDuplexNodeStream:Udr,isFinished:Kdr,isIterable:Hdr,isReadableNodeStream:$Z,isReadableStream:fdt,isReadableEnded:Wdr,isReadableFinished:gdt,isReadableErrored:Gdr,isNodeStream:Qb,isWebStream:zdr,isWritable:bdt,isWritableNodeStream:BZ,isWritableStream:pdt,isWritableEnded:hdt,isWritableFinished:Vdr,isWritableErrored:Jdr,isServerRequest:Zdr,isServerResponse:vdt,willEmitClose:Xdr,isTransformStream:mdt}});var TC=v((euo,rwe)=>{var lT=uT(),{AbortError:Idt,codes:tfr}=Sf(),{ERR_INVALID_ARG_TYPE:rfr,ERR_STREAM_PREMATURE_CLOSE:Sdt}=tfr,{kEmptyObject:Qve,once:ewe}=Ed(),{validateAbortSignal:nfr,validateFunction:ofr,validateObject:ifr,validateBoolean:afr}=kF(),{Promise:sfr,PromisePrototypeThen:ufr,SymbolDispose:Mdt}=La(),{isClosed:lfr,isReadable:xdt,isReadableNodeStream:Xve,isReadableStream:cfr,isReadableFinished:Cdt,isReadableErrored:Odt,isWritable:Pdt,isWritableNodeStream:Edt,isWritableStream:dfr,isWritableFinished:Tdt,isWritableErrored:Adt,isNodeStream:ffr,willEmitClose:pfr,kIsClosedPromise:mfr}=e_(),BF;function hfr(t){return t.setHeader&&typeof t.abort=="function"}var twe=()=>{};function Rdt(t,e,r){var n,o;if(arguments.length===2?(r=e,e=Qve):e==null?e=Qve:ifr(e,"options"),ofr(r,"callback"),nfr(e.signal,"options.signal"),r=ewe(r),cfr(t)||dfr(t))return gfr(t,e,r);if(!ffr(t))throw new rfr("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:Xve(t),a=(o=e.writable)!==null&&o!==void 0?o:Edt(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=pfr(t)&&Xve(t)===i&&Edt(t)===a,d=Tdt(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=Cdt(t,!1),m=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||a))&&(!a||d)&&r.call(t)},h=C=>{r.call(t,C)},b=lfr(t),g=()=>{b=!0;let C=Adt(t)||Odt(t);if(C&&typeof C!="boolean")return r.call(t,C);if(i&&!p&&Xve(t,!0)&&!Cdt(t,!1))return r.call(t,new Sdt);if(a&&!d&&!Tdt(t,!1))return r.call(t,new Sdt);r.call(t)},_=()=>{b=!0;let C=Adt(t)||Odt(t);if(C&&typeof C!="boolean")return r.call(t,C);r.call(t)},w=()=>{t.req.on("finish",f)};hfr(t)?(t.on("complete",f),c||t.on("abort",g),t.req?w():t.on("request",w)):a&&!s&&(t.on("end",l),t.on("close",l)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",m),t.on("finish",f),e.error!==!1&&t.on("error",h),t.on("close",g),b?lT.nextTick(g):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||lT.nextTick(_):(!i&&(!c||xdt(t))&&(d||Pdt(t)===!1)||!a&&(!c||Pdt(t))&&(p||xdt(t)===!1)||u&&t.req&&t.aborted)&&lT.nextTick(_);let x=()=>{r=twe,t.removeListener("aborted",g),t.removeListener("complete",f),t.removeListener("abort",g),t.removeListener("request",w),t.req&&t.req.removeListener("finish",f),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",f),t.removeListener("end",m),t.removeListener("error",h),t.removeListener("close",g)};if(e.signal&&!b){let C=()=>{let E=r;x(),E.call(t,new Idt(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)lT.nextTick(C);else{BF=BF||Ed().addAbortListener;let E=BF(e.signal,C),P=r;r=ewe((...A)=>{E[Mdt](),P.apply(t,A)})}}return x}function gfr(t,e,r){let n=!1,o=twe;if(e.signal)if(o=()=>{n=!0,r.call(t,new Idt(void 0,{cause:e.signal.reason}))},e.signal.aborted)lT.nextTick(o);else{BF=BF||Ed().addAbortListener;let a=BF(e.signal,o),s=r;r=ewe((...u)=>{a[Mdt](),s.apply(t,u)})}let i=(...a)=>{n||lT.nextTick(()=>r.apply(t,a))};return ufr(t[mfr].promise,i,i),twe}function yfr(t,e){var r;let n=!1;return e===null&&(e=Qve),(r=e)!==null&&r!==void 0&&r.cleanup&&(afr(e.cleanup,"cleanup"),n=e.cleanup),new sfr((o,i)=>{let a=Rdt(t,e,s=>{n&&a(),s?i(s):o()})})}rwe.exports=Rdt;rwe.exports.finished=yfr});var JR=v((tuo,Bdt)=>{"use strict";var t_=uT(),{aggregateTwoErrors:bfr,codes:{ERR_MULTIPLE_CALLBACK:_fr},AbortError:vfr}=Sf(),{Symbol:Ndt}=La(),{kIsDestroyed:wfr,isDestroyed:Sfr,isFinished:xfr,isServerRequest:Cfr}=e_(),Ldt=Ndt("kDestroy"),nwe=Ndt("kConstruct");function Fdt(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Ofr(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):(Fdt(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?jdt(this,t,e):this.once(Ldt,function(i){jdt(this,bfr(i,t),e)}),this)}function jdt(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;Fdt(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?t_.nextTick(Pfr,t,i):t_.nextTick(kdt,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function Pfr(t,e){owe(t,e),kdt(t)}function kdt(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 owe(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 Efr(){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 iwe(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?t_.nextTick(owe,t,e):owe(t,e))}function Tfr(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(nwe,e),!(t.listenerCount(nwe)>1)&&t_.nextTick(Afr,t)}function Afr(t){let e=!1;function r(n){if(e){iwe(t,n??new _fr);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(Ldt,n):n?iwe(t,n,!0):t_.nextTick(Ifr,t)}try{t._construct(n=>{t_.nextTick(r,n)})}catch(n){t_.nextTick(r,n)}}function Ifr(t){t.emit(nwe)}function Ddt(t){return t?.setHeader&&typeof t.abort=="function"}function $dt(t){t.emit("close")}function Mfr(t,e){t.emit("error",e),t_.nextTick($dt,t)}function Rfr(t,e){!t||Sfr(t)||(!e&&!xfr(t)&&(e=new vfr),Cfr(t)?(t.socket=null,t.destroy(e)):Ddt(t)?t.abort():Ddt(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?t_.nextTick(Mfr,t,e):t_.nextTick($dt,t),t.destroyed||(t[wfr]=!0))}Bdt.exports={construct:Tfr,destroyer:Rfr,destroy:Ofr,undestroy:Efr,errorOrDestroy:iwe}});var HZ=v((ruo,Udt)=>{"use strict";var{ArrayIsArray:jfr,ObjectSetPrototypeOf:qdt}=La(),{EventEmitter:UZ}=Q4();function zZ(t){UZ.call(this,t)}qdt(zZ.prototype,UZ.prototype);qdt(zZ,UZ);zZ.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(),UZ.listenerCount(this,"error")===0&&this.emit("error",c)}awe(r,"error",u),awe(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 awe(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):jfr(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}Udt.exports={Stream:zZ,prependListener:awe}});var e3=v((nuo,VZ)=>{"use strict";var{SymbolDispose:Dfr}=La(),{AbortError:zdt,codes:Nfr}=Sf(),{isNodeStream:Hdt,isWebStream:Lfr,kControllerErrorFunction:Ffr}=e_(),kfr=TC(),{ERR_INVALID_ARG_TYPE:Vdt}=Nfr,swe,$fr=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Vdt(e,"AbortSignal",t)};VZ.exports.addAbortSignal=function(e,r){if($fr(e,"signal"),!Hdt(r)&&!Lfr(r))throw new Vdt("stream",["ReadableStream","WritableStream","Stream"],r);return VZ.exports.addAbortSignalNoValidate(e,r)};VZ.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Hdt(e)?()=>{e.destroy(new zdt(void 0,{cause:t.reason}))}:()=>{e[Ffr](new zdt(void 0,{cause:t.reason}))};if(t.aborted)r();else{swe=swe||Ed().addAbortListener;let n=swe(t,r);kfr(e,n[Dfr])}return e}});var Jdt=v((iuo,Kdt)=>{"use strict";var{StringPrototypeSlice:Wdt,SymbolIterator:Bfr,TypedArrayPrototypeSet:WZ,Uint8Array:qfr}=La(),{Buffer:uwe}=tp(),{inspect:Ufr}=Ed();Kdt.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 uwe.alloc(0);let r=uwe.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)WZ(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}*[Bfr](){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+=Wdt(i,0,e),this.head=n,n.data=Wdt(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=uwe.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)WZ(r,a,n-e),e-=a.length;else{e===a.length?(WZ(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):(WZ(r,new qfr(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 Ufr(this,{...r,depth:0,customInspect:!1})}}});var t3=v((auo,Xdt)=>{"use strict";var{MathFloor:zfr,NumberIsInteger:Hfr}=La(),{validateInteger:Vfr}=kF(),{ERR_INVALID_ARG_VALUE:Wfr}=Sf().codes,Gdt=16*1024,Ydt=16;function Kfr(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Zdt(t){return t?Ydt:Gdt}function Jfr(t,e){Vfr(e,"value",0),t?Ydt=e:Gdt=e}function Gfr(t,e,r,n){let o=Kfr(e,n,r);if(o!=null){if(!Hfr(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new Wfr(i,o)}return zfr(o)}return Zdt(t.objectMode)}Xdt.exports={getHighWaterMark:Gfr,getDefaultHighWaterMark:Zdt,setDefaultHighWaterMark:Jfr}});var tft=v((lwe,eft)=>{var KZ=tp(),r_=KZ.Buffer;function Qdt(t,e){for(var r in t)e[r]=t[r]}r_.from&&r_.alloc&&r_.allocUnsafe&&r_.allocUnsafeSlow?eft.exports=KZ:(Qdt(KZ,lwe),lwe.Buffer=GR);function GR(t,e,r){return r_(t,e,r)}GR.prototype=Object.create(r_.prototype);Qdt(r_,GR);GR.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return r_(t,e,r)};GR.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=r_(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};GR.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return r_(t)};GR.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return KZ.SlowBuffer(t)}});var oft=v(nft=>{"use strict";var dwe=tft().Buffer,rft=dwe.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 Yfr(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 Zfr(t){var e=Yfr(t);if(typeof e!="string"&&(dwe.isEncoding===rft||!rft(t)))throw new Error("Unknown encoding: "+t);return e||t}nft.StringDecoder=r3;function r3(t){this.encoding=Zfr(t);var e;switch(this.encoding){case"utf16le":this.text=npr,this.end=opr,e=4;break;case"utf8":this.fillLast=epr,e=4;break;case"base64":this.text=ipr,this.end=apr,e=3;break;default:this.write=spr,this.end=upr;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=dwe.allocUnsafe(e)}r3.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||""};r3.prototype.end=rpr;r3.prototype.text=tpr;r3.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 cwe(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Xfr(t,e,r){var n=e.length-1;if(n<r)return 0;var o=cwe(e[n]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--n<r||o===-2?0:(o=cwe(e[n]),o>=0?(o>0&&(t.lastNeed=o-2),o):--n<r||o===-2?0:(o=cwe(e[n]),o>=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function Qfr(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 epr(t){var e=this.lastTotal-this.lastNeed,r=Qfr(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 tpr(t,e){var r=Xfr(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 rpr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function npr(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 opr(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 ipr(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 apr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function spr(t){return t.toString(this.encoding)}function upr(t){return t&&t.length?this.write(t):""}});var fwe=v((uuo,uft)=>{"use strict";var ift=uT(),{PromisePrototypeThen:lpr,SymbolAsyncIterator:aft,SymbolIterator:sft}=La(),{Buffer:cpr}=tp(),{ERR_INVALID_ARG_TYPE:dpr,ERR_STREAM_NULL_VALUES:fpr}=Sf().codes;function ppr(t,e,r){let n;if(typeof e=="string"||e instanceof cpr)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[aft])o=!0,n=e[aft]();else if(e&&e[sft])o=!1,n=e[sft]();else throw new dpr("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){lpr(s(l),()=>ift.nextTick(c,l),d=>ift.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 fpr;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}uft.exports=ppr});var o3=v((luo,Pft)=>{var Yg=uT(),{ArrayPrototypeIndexOf:mpr,NumberIsInteger:hpr,NumberIsNaN:gpr,NumberParseInt:ypr,ObjectDefineProperties:vwe,ObjectKeys:bpr,ObjectSetPrototypeOf:dft,Promise:fft,SafeSet:_pr,SymbolAsyncDispose:vpr,SymbolAsyncIterator:wpr,Symbol:Spr}=La();Pft.exports=sn;sn.ReadableState=ZZ;var{EventEmitter:xpr}=Q4(),{Stream:cT,prependListener:Cpr}=HZ(),{Buffer:pwe}=tp(),{addAbortSignal:Opr}=e3(),pft=TC(),Tn=Ed().debuglog("stream",t=>{Tn=t}),Ppr=Jdt(),zF=JR(),{getHighWaterMark:Epr,getDefaultHighWaterMark:Tpr}=t3(),{aggregateTwoErrors:lft,codes:{ERR_INVALID_ARG_TYPE:Apr,ERR_METHOD_NOT_IMPLEMENTED:Ipr,ERR_OUT_OF_RANGE:Mpr,ERR_STREAM_PUSH_AFTER_EOF:Rpr,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:jpr},AbortError:Dpr}=Sf(),{validateObject:Npr}=kF(),YR=Spr("kPaused"),{StringDecoder:mft}=oft(),Lpr=fwe();dft(sn.prototype,cT.prototype);dft(sn,cT);var mwe=()=>{},{errorOrDestroy:qF}=zF,UF=1,Fpr=2,hft=4,n3=8,gft=16,JZ=32,GZ=64,yft=128,kpr=256,$pr=512,Bpr=1024,bwe=2048,_we=4096,qpr=8192,Upr=16384,zpr=32768,bft=65536,Hpr=1<<17,Vpr=1<<18;function ml(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}vwe(ZZ.prototype,{objectMode:ml(UF),ended:ml(Fpr),endEmitted:ml(hft),reading:ml(n3),constructed:ml(gft),sync:ml(JZ),needReadable:ml(GZ),emittedReadable:ml(yft),readableListening:ml(kpr),resumeScheduled:ml($pr),errorEmitted:ml(Bpr),emitClose:ml(bwe),autoDestroy:ml(_we),destroyed:ml(qpr),closed:ml(Upr),closeEmitted:ml(zpr),multiAwaitDrain:ml(bft),readingMore:ml(Hpr),dataEmitted:ml(Vpr)});function ZZ(t,e,r){typeof r!="boolean"&&(r=e instanceof n_()),this.state=bwe|_we|gft|JZ,t&&t.objectMode&&(this.state|=UF),r&&t&&t.readableObjectMode&&(this.state|=UF),this.highWaterMark=t?Epr(this,t,"readableHighWaterMark",r):Tpr(!1),this.buffer=new Ppr,this.length=0,this.pipes=[],this.flowing=null,this[YR]=null,t&&t.emitClose===!1&&(this.state&=~bwe),t&&t.autoDestroy===!1&&(this.state&=~_we),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new mft(t.encoding),this.encoding=t.encoding)}function sn(t){if(!(this instanceof sn))return new sn(t);let e=this instanceof n_();this._readableState=new ZZ(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&&Opr(t.signal,this)),cT.call(this,t),zF.construct(this,()=>{this._readableState.needReadable&&YZ(this,this._readableState)})}sn.prototype.destroy=zF.destroy;sn.prototype._undestroy=zF.undestroy;sn.prototype._destroy=function(t,e){e(t)};sn.prototype[xpr.captureRejectionSymbol]=function(t){this.destroy(t)};sn.prototype[vpr]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Dpr,this.destroy(t)),new fft((e,r)=>pft(this,n=>n&&n!==t?r(n):e(null)))};sn.prototype.push=function(t,e){return _ft(this,t,e,!1)};sn.prototype.unshift=function(t,e){return _ft(this,t,e,!0)};function _ft(t,e,r,n){Tn("readableAddChunk",e);let o=t._readableState,i;if((o.state&UF)===0&&(typeof e=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?e=pwe.from(e,r).toString(o.encoding):(e=pwe.from(e,r),r=""))):e instanceof pwe?r="":cT._isUint8Array(e)?(e=cT._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new Apr("chunk",["string","Buffer","Uint8Array"],e))),i)qF(t,i);else if(e===null)o.state&=~n3,Jpr(t,o);else if((o.state&UF)!==0||e&&e.length>0)if(n)if((o.state&hft)!==0)qF(t,new jpr);else{if(o.destroyed||o.errored)return!1;hwe(t,o,e,!0)}else if(o.ended)qF(t,new Rpr);else{if(o.destroyed||o.errored)return!1;o.state&=~n3,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?hwe(t,o,e,!1):YZ(t,o)):hwe(t,o,e,!1)}else n||(o.state&=~n3,YZ(t,o));return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function hwe(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&bft)!==0?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),(e.state&GZ)!==0&&XZ(t)),YZ(t,e)}sn.prototype.isPaused=function(){let t=this._readableState;return t[YR]===!0||t.flowing===!1};sn.prototype.setEncoding=function(t){let e=new mft(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 Wpr=1073741824;function Kpr(t){if(t>Wpr)throw new Mpr("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function cft(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&UF)!==0?1:gpr(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}sn.prototype.read=function(t){Tn("read",t),t===void 0?t=NaN:hpr(t)||(t=ypr(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=Kpr(t)),t!==0&&(e.state&=~yft),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Tn("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?gwe(this):XZ(this),null;if(t=cft(t,e),t===0&&e.ended)return e.length===0&&gwe(this),null;let n=(e.state&GZ)!==0;if(Tn("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,Tn("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,Tn("reading, ended or constructing",n);else if(n){Tn("do read"),e.state|=n3|JZ,e.length===0&&(e.state|=GZ);try{this._read(e.highWaterMark)}catch(i){qF(this,i)}e.state&=~JZ,e.reading||(t=cft(r,e))}let o;return t>0?o=Cft(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&&gwe(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function Jpr(t,e){if(Tn("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?XZ(t):(e.needReadable=!1,e.emittedReadable=!0,vft(t))}}function XZ(t){let e=t._readableState;Tn("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Tn("emitReadable",e.flowing),e.emittedReadable=!0,Yg.nextTick(vft,t))}function vft(t){let e=t._readableState;Tn("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,Sft(t)}function YZ(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Yg.nextTick(Gpr,t,e))}function Gpr(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(Tn("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}sn.prototype._read=function(t){throw new Ipr("_read()")};sn.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new _pr(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),Tn("pipe count=%d opts=%j",n.pipes.length,e);let i=(!e||e.end!==!1)&&t!==Yg.stdout&&t!==Yg.stderr?s:b;n.endEmitted?Yg.nextTick(i):r.once("end",i),t.on("unpipe",a);function a(g,_){Tn("onunpipe"),g===r&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,c())}function s(){Tn("onend"),t.end()}let u,l=!1;function c(){Tn("cleanup"),t.removeListener("close",m),t.removeListener("finish",h),u&&t.removeListener("drain",u),t.removeListener("error",p),t.removeListener("unpipe",a),r.removeListener("end",s),r.removeListener("end",b),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?(Tn("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(Tn("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=Ypr(r,t),t.on("drain",u))}r.on("data",f);function f(g){Tn("ondata");let _=t.write(g);Tn("dest.write",_),_===!1&&d()}function p(g){if(Tn("onerror",g),b(),t.removeListener("error",p),t.listenerCount("error")===0){let _=t._writableState||t._readableState;_&&!_.errorEmitted?qF(t,g):t.emit("error",g)}}Cpr(t,"error",p);function m(){t.removeListener("finish",h),b()}t.once("close",m);function h(){Tn("onfinish"),t.removeListener("close",m),b()}t.once("finish",h);function b(){Tn("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||(Tn("pipe resume"),r.resume()),t};function Ypr(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(Tn("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(Tn("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}sn.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=mpr(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};sn.prototype.on=function(t,e){let r=cT.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,Tn("on readable",n.length,n.reading),n.length?XZ(this):n.reading||Yg.nextTick(Zpr,this)),r};sn.prototype.addListener=sn.prototype.on;sn.prototype.removeListener=function(t,e){let r=cT.prototype.removeListener.call(this,t,e);return t==="readable"&&Yg.nextTick(wft,this),r};sn.prototype.off=sn.prototype.removeListener;sn.prototype.removeAllListeners=function(t){let e=cT.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Yg.nextTick(wft,this),e};function wft(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[YR]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function Zpr(t){Tn("readable nexttick read 0"),t.read(0)}sn.prototype.resume=function(){let t=this._readableState;return t.flowing||(Tn("resume"),t.flowing=!t.readableListening,Xpr(this,t)),t[YR]=!1,this};function Xpr(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Yg.nextTick(Qpr,t,e))}function Qpr(t,e){Tn("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Sft(t),e.flowing&&!e.reading&&t.read(0)}sn.prototype.pause=function(){return Tn("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Tn("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[YR]=!0,this};function Sft(t){let e=t._readableState;for(Tn("flow",e.flowing);e.flowing&&t.read()!==null;);}sn.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=>{qF(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=bpr(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};sn.prototype[wpr]=function(){return xft(this)};sn.prototype.iterator=function(t){return t!==void 0&&Npr(t,"options"),xft(this,t)};function xft(t,e){typeof t.read!="function"&&(t=sn.wrap(t,{objectMode:!0}));let r=emr(t,e);return r.stream=t,r}async function*emr(t,e){let r=mwe;function n(a){this===t?(r(),r=mwe):r=a}t.on("readable",n);let o,i=pft(t,{writable:!1},a=>{o=a?lft(o,a):null,r(),r=mwe});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 fft(n)}}}catch(a){throw o=lft(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?zF.destroyer(t,null):(t.off("readable",n),i())}}vwe(sn.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}}});vwe(ZZ.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[YR]!==!1},set(t){this[YR]=!!t}}});sn._fromList=Cft;function Cft(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 gwe(t){let e=t._readableState;Tn("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Yg.nextTick(tmr,e,t))}function tmr(t,e){if(Tn("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)Yg.nextTick(rmr,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function rmr(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}sn.from=function(t,e){return Lpr(sn,t,e)};var ywe;function Oft(){return ywe===void 0&&(ywe={}),ywe}sn.fromWeb=function(t,e){return Oft().newStreamReadableFromReadableStream(t,e)};sn.toWeb=function(t,e){return Oft().newReadableStreamFromStreamReadable(t,e)};sn.wrap=function(t,e){var r,n;return new sn({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){zF.destroyer(t,o),i(o)}}).wrap(t)}});var nX=v((cuo,kft)=>{var ZR=uT(),{ArrayPrototypeSlice:Aft,Error:nmr,FunctionPrototypeSymbolHasInstance:Ift,ObjectDefineProperty:Mft,ObjectDefineProperties:omr,ObjectSetPrototypeOf:Rft,StringPrototypeToLowerCase:imr,Symbol:amr,SymbolHasInstance:smr}=La();kft.exports=Fa;Fa.WritableState=s3;var{EventEmitter:umr}=Q4(),i3=HZ().Stream,{Buffer:QZ}=tp(),rX=JR(),{addAbortSignal:lmr}=e3(),{getHighWaterMark:cmr,getDefaultHighWaterMark:dmr}=t3(),{ERR_INVALID_ARG_TYPE:fmr,ERR_METHOD_NOT_IMPLEMENTED:pmr,ERR_MULTIPLE_CALLBACK:jft,ERR_STREAM_CANNOT_PIPE:mmr,ERR_STREAM_DESTROYED:a3,ERR_STREAM_ALREADY_FINISHED:hmr,ERR_STREAM_NULL_VALUES:gmr,ERR_STREAM_WRITE_AFTER_END:ymr,ERR_UNKNOWN_ENCODING:Dft}=Sf().codes,{errorOrDestroy:HF}=rX;Rft(Fa.prototype,i3.prototype);Rft(Fa,i3);function xwe(){}var VF=amr("kOnFinished");function s3(t,e,r){typeof r!="boolean"&&(r=e instanceof n_()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?cmr(this,t,"writableHighWaterMark",r):dmr(!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=_mr.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,tX(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[VF]=[]}function tX(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}s3.prototype.getBuffer=function(){return Aft(this.buffered,this.bufferedIndex)};Mft(s3.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Fa(t){let e=this instanceof n_();if(!e&&!Ift(Fa,this))return new Fa(t);this._writableState=new s3(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&&lmr(t.signal,this)),i3.call(this,t),rX.construct(this,()=>{let r=this._writableState;r.writing||Owe(this,r),Pwe(this,r)})}Mft(Fa,smr,{__proto__:null,value:function(t){return Ift(this,t)?!0:this!==Fa?!1:t&&t._writableState instanceof s3}});Fa.prototype.pipe=function(){HF(this,new mmr)};function Nft(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"&&!QZ.isEncoding(r))throw new Dft(r);typeof n!="function"&&(n=xwe)}if(e===null)throw new gmr;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=QZ.from(e,r),r="buffer");else if(e instanceof QZ)r="buffer";else if(i3._isUint8Array(e))e=i3._uint8ArrayToBuffer(e),r="buffer";else throw new fmr("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new ymr:o.destroyed&&(i=new a3("write")),i?(ZR.nextTick(n,i),HF(t,i,!0),i):(o.pendingcb++,bmr(t,o,e,r,n))}Fa.prototype.write=function(t,e,r){return Nft(this,t,e,r)===!0};Fa.prototype.cork=function(){this._writableState.corked++};Fa.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Owe(this,t))};Fa.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=imr(e)),!QZ.isEncoding(e))throw new Dft(e);return this._writableState.defaultEncoding=e,this};function bmr(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!==xwe&&(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 Eft(t,e,r,n,o,i,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new a3("write")):r?t._writev(o,e.onwrite):t._write(o,i,e.onwrite),e.sync=!1}function Tft(t,e,r,n){--e.pendingcb,n(r),Cwe(e),HF(t,r)}function _mr(t,e){let r=t._writableState,n=r.sync,o=r.writecb;if(typeof o!="function"){HF(t,new jft);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?ZR.nextTick(Tft,t,r,e,o):Tft(t,r,e,o)):(r.buffered.length>r.bufferedIndex&&Owe(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},ZR.nextTick(vmr,r.afterWriteTickInfo)):Lft(t,r,1,o))}function vmr({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,Lft(t,e,r,n)}function Lft(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&&Cwe(e),Pwe(t,e)}function Cwe(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 a3("write"))}let r=t[VF].splice(0);for(let o=0;o<r.length;o++){var n;r[o]((n=t.errored)!==null&&n!==void 0?n:new a3("end"))}tX(t)}function Owe(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?xwe:l=>{for(let c=a;c<r.length;++c)r[c].callback(l)},u=e.allNoop&&a===0?r:Aft(r,a);u.allBuffers=e.allBuffers,Eft(t,e,!0,e.length,u,"",s),tX(e)}else{do{let{chunk:s,encoding:u,callback:l}=r[a];r[a++]=null;let c=o?1:s.length;Eft(t,e,!1,c,s,u,l)}while(a<r.length&&!e.writing);a===r.length?tX(e):a>256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}Fa.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new pmr("_write()")};Fa.prototype._writev=null;Fa.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=Nft(this,t,e);i instanceof nmr&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,Pwe(this,n,!0),n.ended=!0):n.finished?o=new hmr("end"):n.destroyed&&(o=new a3("end"))),typeof r=="function"&&(o||n.finished?ZR.nextTick(r,o):n[VF].push(r)),this};function eX(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 wmr(t,e){let r=!1;function n(o){if(r){HF(t,o??jft());return}if(r=!0,e.pendingcb--,o){let i=e[VF].splice(0);for(let a=0;a<i.length;a++)i[a](o);HF(t,o,e.sync)}else eX(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,ZR.nextTick(Swe,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(o){n(o)}e.sync=!1}function Smr(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,wmr(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Pwe(t,e,r){eX(e)&&(Smr(t,e),e.pendingcb===0&&(r?(e.pendingcb++,ZR.nextTick((n,o)=>{eX(o)?Swe(n,o):o.pendingcb--},t,e)):eX(e)&&(e.pendingcb++,Swe(t,e))))}function Swe(t,e){e.pendingcb--,e.finished=!0;let r=e[VF].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()}}omr(Fa.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 xmr=rX.destroy;Fa.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[VF].length)&&ZR.nextTick(Cwe,r),xmr.call(this,t,e),this};Fa.prototype._undestroy=rX.undestroy;Fa.prototype._destroy=function(t,e){e(t)};Fa.prototype[umr.captureRejectionSymbol]=function(t){this.destroy(t)};var wwe;function Fft(){return wwe===void 0&&(wwe={}),wwe}Fa.fromWeb=function(t,e){return Fft().newStreamWritableFromWritableStream(t,e)};Fa.toWeb=function(t){return Fft().newWritableStreamFromStreamWritable(t)}});var Qft=v((duo,Xft)=>{var Ewe=uT(),Cmr=tp(),{isReadable:Omr,isWritable:Pmr,isIterable:$ft,isNodeStream:Emr,isReadableNodeStream:Bft,isWritableNodeStream:qft,isDuplexNodeStream:Tmr,isReadableStream:Uft,isWritableStream:zft}=e_(),Hft=TC(),{AbortError:Yft,codes:{ERR_INVALID_ARG_TYPE:Amr,ERR_INVALID_RETURN_VALUE:Vft}}=Sf(),{destroyer:KF}=JR(),Imr=n_(),Zft=o3(),Mmr=nX(),{createDeferredPromise:Wft}=Ed(),Kft=fwe(),Jft=globalThis.Blob||Cmr.Blob,Rmr=typeof Jft<"u"?function(e){return e instanceof Jft}:function(e){return!1},jmr=globalThis.AbortController||NF().AbortController,{FunctionPrototypeCall:Gft}=La(),dT=class extends Imr{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)}};Xft.exports=function t(e,r){if(Tmr(e))return e;if(Bft(e))return WF({readable:e});if(qft(e))return WF({writable:e});if(Emr(e))return WF({writable:!1,readable:!1});if(Uft(e))return WF({readable:Zft.fromWeb(e)});if(zft(e))return WF({writable:Mmr.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=Dmr(e);if($ft(o))return Kft(dT,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=Gft(u,o,d=>{if(d!=null)throw new Vft("nully","body",d)},d=>{KF(l,d)});return l=new dT({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,Ewe.nextTick(d,null)}catch(f){Ewe.nextTick(d,f)}})},destroy:s})}throw new Vft("Iterable, AsyncIterable or AsyncFunction",r,o)}if(Rmr(e))return t(e.arrayBuffer());if($ft(e))return Kft(dT,e,{objectMode:!0,writable:!1});if(Uft(e?.readable)&&zft(e?.writable))return dT.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?Bft(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?qft(e?.writable)?e?.writable:t(e.writable):void 0;return WF({readable:o,writable:i})}let n=e?.then;if(typeof n=="function"){let o;return Gft(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{KF(o,i)}),o=new dT({objectMode:!0,writable:!1,read(){}})}throw new Amr(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function Dmr(t){let{promise:e,resolve:r}=Wft(),n=new jmr,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if(Ewe.nextTick(l),u)return;if(o.aborted)throw new Yft(void 0,{cause:o.reason});({promise:e,resolve:r}=Wft()),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 WF(t){let e=t.readable&&typeof t.readable.read!="function"?Zft.wrap(t.readable):t.readable,r=t.writable,n=!!Omr(e),o=!!Pmr(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new dT({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(Hft(r,d=>{o=!1,d&&KF(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&&(Hft(e,d=>{n=!1,d&&KF(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 Yft),s=null,i=null,a=null,u===null?f(d):(u=f,KF(r,d),KF(e,d))},l}});var n_=v((fuo,rpt)=>{"use strict";var{ObjectDefineProperties:Nmr,ObjectGetOwnPropertyDescriptor:AC,ObjectKeys:Lmr,ObjectSetPrototypeOf:ept}=La();rpt.exports=Zg;var Iwe=o3(),Ch=nX();ept(Zg.prototype,Iwe.prototype);ept(Zg,Iwe);{let t=Lmr(Ch.prototype);for(let e=0;e<t.length;e++){let r=t[e];Zg.prototype[r]||(Zg.prototype[r]=Ch.prototype[r])}}function Zg(t){if(!(this instanceof Zg))return new Zg(t);Iwe.call(this,t),Ch.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}Nmr(Zg.prototype,{writable:{__proto__:null,...AC(Ch.prototype,"writable")},writableHighWaterMark:{__proto__:null,...AC(Ch.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...AC(Ch.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...AC(Ch.prototype,"writableBuffer")},writableLength:{__proto__:null,...AC(Ch.prototype,"writableLength")},writableFinished:{__proto__:null,...AC(Ch.prototype,"writableFinished")},writableCorked:{__proto__:null,...AC(Ch.prototype,"writableCorked")},writableEnded:{__proto__:null,...AC(Ch.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...AC(Ch.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 Twe;function tpt(){return Twe===void 0&&(Twe={}),Twe}Zg.fromWeb=function(t,e){return tpt().newStreamDuplexFromReadableWritablePair(t,e)};Zg.toWeb=function(t){return tpt().newReadableWritablePairFromDuplex(t)};var Awe;Zg.from=function(t){return Awe||(Awe=Qft()),Awe(t,"body")}});var jwe=v((puo,opt)=>{"use strict";var{ObjectSetPrototypeOf:npt,Symbol:Fmr}=La();opt.exports=IC;var{ERR_METHOD_NOT_IMPLEMENTED:kmr}=Sf().codes,Rwe=n_(),{getHighWaterMark:$mr}=t3();npt(IC.prototype,Rwe.prototype);npt(IC,Rwe);var u3=Fmr("kCallback");function IC(t){if(!(this instanceof IC))return new IC(t);let e=t?$mr(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Rwe.call(this,t),this._readableState.sync=!1,this[u3]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Bmr)}function Mwe(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 Bmr(){this._final!==Mwe&&Mwe.call(this)}IC.prototype._final=Mwe;IC.prototype._transform=function(t,e,r){throw new kmr("_transform()")};IC.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[u3]=r})};IC.prototype._read=function(){if(this[u3]){let t=this[u3];this[u3]=null,t()}}});var Nwe=v((muo,apt)=>{"use strict";var{ObjectSetPrototypeOf:ipt}=La();apt.exports=JF;var Dwe=jwe();ipt(JF.prototype,Dwe.prototype);ipt(JF,Dwe);function JF(t){if(!(this instanceof JF))return new JF(t);Dwe.call(this,t)}JF.prototype._transform=function(t,e,r){r(null,t)}});var sX=v((huo,dpt)=>{var l3=uT(),{ArrayIsArray:qmr,Promise:Umr,SymbolAsyncIterator:zmr,SymbolDispose:Hmr}=La(),aX=TC(),{once:Vmr}=Ed(),Wmr=JR(),spt=n_(),{aggregateTwoErrors:Kmr,codes:{ERR_INVALID_ARG_TYPE:Hwe,ERR_INVALID_RETURN_VALUE:Lwe,ERR_MISSING_ARGS:Jmr,ERR_STREAM_DESTROYED:Gmr,ERR_STREAM_PREMATURE_CLOSE:Ymr},AbortError:Zmr}=Sf(),{validateFunction:Xmr,validateAbortSignal:Qmr}=kF(),{isIterable:XR,isReadable:Fwe,isReadableNodeStream:iX,isNodeStream:upt,isTransformStream:GF,isWebStream:ehr,isReadableStream:kwe,isReadableFinished:thr}=e_(),rhr=globalThis.AbortController||NF().AbortController,$we,Bwe,qwe;function lpt(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=aX(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,Wmr.destroyer(t,i||new Gmr("pipe")))},cleanup:o}}function nhr(t){return Xmr(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function Uwe(t){if(XR(t))return t;if(iX(t))return ohr(t);throw new Hwe("val",["Readable","Iterable","AsyncIterable"],t)}async function*ohr(t){Bwe||(Bwe=o3()),yield*Bwe.prototype[zmr].call(t)}async function oX(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new Umr((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=aX(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?Kmr(o,l):l)}finally{u(),e.off("drain",a)}}async function zwe(t,e,r,{end:n}){GF(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 ihr(...t){return cpt(t,Vmr(nhr(t)))}function cpt(t,e,r){if(t.length===1&&qmr(t[0])&&(t=t[0]),t.length<2)throw new Jmr("streams");let n=new rhr,o=n.signal,i=r?.signal,a=[];Qmr(i,"options.signal");function s(){m(new Zmr)}qwe=qwe||Ed().addAbortListener;let u;i&&(u=qwe(i,s));let l,c,d=[],f=0;function p(w){m(w,--f===0)}function m(w,x){var C;if(w&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=w),!(!l&&!x)){for(;d.length;)d.shift()(l);(C=u)===null||C===void 0||C[Hmr](),n.abort(),x&&(l||a.forEach(E=>E()),l3.nextTick(e,l,c))}}let h;for(let w=0;w<t.length;w++){let x=t[w],C=w<t.length-1,E=w>0,P=C||r?.end!==!1,A=w===t.length-1;if(upt(x)){let I=function(R){R&&R.name!=="AbortError"&&R.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(R)};var _=I;if(P){let{destroy:R,cleanup:j}=lpt(x,C,E);d.push(R),Fwe(x)&&A&&a.push(j)}x.on("error",I),Fwe(x)&&A&&a.push(()=>{x.removeListener("error",I)})}if(w===0)if(typeof x=="function"){if(h=x({signal:o}),!XR(h))throw new Lwe("Iterable, AsyncIterable or Stream","source",h)}else XR(x)||iX(x)||GF(x)?h=x:h=spt.from(x);else if(typeof x=="function"){if(GF(h)){var b;h=Uwe((b=h)===null||b===void 0?void 0:b.readable)}else h=Uwe(h);if(h=x(h,{signal:o}),C){if(!XR(h,!0))throw new Lwe("AsyncIterable",`transform[${w-1}]`,h)}else{var g;$we||($we=Nwe());let I=new $we({objectMode:!0}),R=(g=h)===null||g===void 0?void 0:g.then;if(typeof R=="function")f++,R.call(h,k=>{c=k,k!=null&&I.write(k),P&&I.end(),l3.nextTick(p)},k=>{I.destroy(k),l3.nextTick(p,k)});else if(XR(h,!0))f++,oX(h,I,p,{end:P});else if(kwe(h)||GF(h)){let k=h.readable||h;f++,oX(k,I,p,{end:P})}else throw new Lwe("AsyncIterable or Promise","destination",h);h=I;let{destroy:j,cleanup:D}=lpt(h,!1,!0);d.push(j),A&&a.push(D)}}else if(upt(x)){if(iX(h)){f+=2;let I=ahr(h,x,p,{end:P});Fwe(x)&&A&&a.push(I)}else if(GF(h)||kwe(h)){let I=h.readable||h;f++,oX(I,x,p,{end:P})}else if(XR(h))f++,oX(h,x,p,{end:P});else throw new Hwe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=x}else if(ehr(x)){if(iX(h))f++,zwe(Uwe(h),x,p,{end:P});else if(kwe(h)||XR(h))f++,zwe(h,x,p,{end:P});else if(GF(h))f++,zwe(h.readable,x,p,{end:P});else throw new Hwe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=x}else h=spt.from(x)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&l3.nextTick(s),h}function ahr(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new Ymr)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;thr(t)?l3.nextTick(a):t.once("end",a)}else r();return aX(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)}),aX(e,{readable:!1,writable:!0},r)}dpt.exports={pipelineImpl:cpt,pipeline:ihr}});var Wwe=v((guo,ypt)=>{"use strict";var{pipeline:shr}=sX(),uX=n_(),{destroyer:uhr}=JR(),{isNodeStream:lX,isReadable:fpt,isWritable:ppt,isWebStream:Vwe,isTransformStream:QR,isWritableStream:mpt,isReadableStream:hpt}=e_(),{AbortError:lhr,codes:{ERR_INVALID_ARG_VALUE:gpt,ERR_MISSING_ARGS:chr}}=Sf(),dhr=TC();ypt.exports=function(...e){if(e.length===0)throw new chr("streams");if(e.length===1)return uX.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=uX.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=uX.from(e[p])}for(let p=0;p<e.length;++p)if(!(!lX(e[p])&&!Vwe(e[p]))){if(p<e.length-1&&!(fpt(e[p])||hpt(e[p])||QR(e[p])))throw new gpt(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(ppt(e[p])||mpt(e[p])||QR(e[p])))throw new gpt(`streams[${p}]`,r[p],"must be writable")}let n,o,i,a,s;function u(p){let m=a;a=null,m?m(p):p?s.destroy(p):!f&&!d&&s.destroy()}let l=e[0],c=shr(e,u),d=!!(ppt(l)||mpt(l)||QR(l)),f=!!(fpt(c)||hpt(c)||QR(c));if(s=new uX({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(lX(l))s._write=function(m,h,b){l.write(m,h)?b():n=b},s._final=function(m){l.end(),o=m},l.on("drain",function(){if(n){let m=n;n=null,m()}});else if(Vwe(l)){let h=(QR(l)?l.writable:l).getWriter();s._write=async function(b,g,_){try{await h.ready,h.write(b).catch(()=>{}),_()}catch(w){_(w)}},s._final=async function(b){try{await h.ready,h.close().catch(()=>{}),o=b}catch(g){b(g)}}}let p=QR(c)?c.readable:c;dhr(p,()=>{if(o){let m=o;o=null,m()}})}if(f){if(lX(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(Vwe(c)){let m=(QR(c)?c.readable:c).getReader();s._read=async function(){for(;;)try{let{value:h,done:b}=await m.read();if(!s.push(h))return;if(b){s.push(null);return}}catch{return}}}}return s._destroy=function(p,m){!p&&a!==null&&(p=new lhr),i=null,n=null,o=null,a===null?m(p):(a=m,lX(c)&&uhr(c,p))},s}});var Ept=v((yuo,Gwe)=>{"use strict";var fhr=globalThis.AbortController||NF().AbortController,{codes:{ERR_INVALID_ARG_VALUE:phr,ERR_INVALID_ARG_TYPE:c3,ERR_MISSING_ARGS:mhr,ERR_OUT_OF_RANGE:hhr},AbortError:o_}=Sf(),{validateAbortSignal:e1,validateInteger:bpt,validateObject:t1}=kF(),ghr=La().Symbol("kWeak"),yhr=La().Symbol("kResistStopPropagation"),{finished:bhr}=TC(),_hr=Wwe(),{addAbortSignalNoValidate:vhr}=e3(),{isWritable:whr,isNodeStream:Shr}=e_(),{deprecate:xhr}=Ed(),{ArrayPrototypePush:Chr,Boolean:Ohr,MathFloor:_pt,Number:Phr,NumberIsNaN:Ehr,Promise:vpt,PromiseReject:wpt,PromiseResolve:Thr,PromisePrototypeThen:Spt,Symbol:Cpt}=La(),cX=Cpt("kEmpty"),xpt=Cpt("kEof");function Ahr(t,e){if(e!=null&&t1(e,"options"),e?.signal!=null&&e1(e.signal,"options.signal"),Shr(t)&&!whr(t))throw new phr("stream",t,"must be writable");let r=_hr(this,t);return e!=null&&e.signal&&vhr(e.signal,r),r}function dX(t,e){if(typeof t!="function")throw new c3("fn",["Function","AsyncFunction"],t);e!=null&&t1(e,"options"),e?.signal!=null&&e1(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=_pt(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=_pt(e.highWaterMark)),bpt(r,"options.concurrency",1),bpt(n,"options.highWaterMark",0),n+=r,async function*(){let i=Ed().AbortSignalAny([e?.signal].filter(Ohr)),a=this,s=[],u={signal:i},l,c,d=!1,f=0;function p(){d=!0,m()}function m(){f-=1,h()}function h(){c&&!d&&f<r&&s.length<n&&(c(),c=null)}async function b(){try{for await(let g of a){if(d)return;if(i.aborted)throw new o_;try{if(g=t(g,u),g===cX)continue;g=Thr(g)}catch(_){g=wpt(_)}f+=1,Spt(g,m,p),s.push(g),l&&(l(),l=null),!d&&(s.length>=n||f>=r)&&await new vpt(_=>{c=_})}s.push(xpt)}catch(g){let _=wpt(g);Spt(_,m,p),s.push(_)}finally{d=!0,l&&(l(),l=null)}}b();try{for(;;){for(;s.length>0;){let g=await s[0];if(g===xpt)return;if(i.aborted)throw new o_;g!==cX&&(yield g),s.shift(),h()}await new vpt(g=>{l=g})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function Ihr(t=void 0){return t!=null&&t1(t,"options"),t?.signal!=null&&e1(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 o_({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function Opt(t,e=void 0){for await(let r of Jwe.call(this,t,e))return!0;return!1}async function Mhr(t,e=void 0){if(typeof t!="function")throw new c3("fn",["Function","AsyncFunction"],t);return!await Opt.call(this,async(...r)=>!await t(...r),e)}async function Rhr(t,e){for await(let r of Jwe.call(this,t,e))return r}async function jhr(t,e){if(typeof t!="function")throw new c3("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),cX}for await(let n of dX.call(this,r,e));}function Jwe(t,e){if(typeof t!="function")throw new c3("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:cX}return dX.call(this,r,e)}var Kwe=class extends mhr{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function Dhr(t,e,r){var n;if(typeof t!="function")throw new c3("reducer",["Function","AsyncFunction"],t);r!=null&&t1(r,"options"),r?.signal!=null&&e1(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new o_(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await bhr(this.destroy(l)),l}let i=new fhr,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[ghr]:this,[yhr]:!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 o_;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new Kwe}finally{i.abort()}return e}async function Nhr(t){t!=null&&t1(t,"options"),t?.signal!=null&&e1(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 o_(void 0,{cause:t.signal.reason});Chr(e,n)}return e}function Lhr(t,e){let r=dX.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function Ppt(t){if(t=Phr(t),Ehr(t))return 0;if(t<0)throw new hhr("number",">= 0",t);return t}function Fhr(t,e=void 0){return e!=null&&t1(e,"options"),e?.signal!=null&&e1(e.signal,"options.signal"),t=Ppt(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new o_;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new o_;t--<=0&&(yield i)}}.call(this)}function khr(t,e=void 0){return e!=null&&t1(e,"options"),e?.signal!=null&&e1(e.signal,"options.signal"),t=Ppt(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new o_;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new o_;if(t-- >0&&(yield i),t<=0)return}}.call(this)}Gwe.exports.streamReturningOperators={asIndexedPairs:xhr(Ihr,"readable.asIndexedPairs will be removed in a future version."),drop:Fhr,filter:Jwe,flatMap:Lhr,map:dX,take:khr,compose:Ahr};Gwe.exports.promiseReturningOperators={every:Mhr,forEach:jhr,reduce:Dhr,toArray:Nhr,some:Opt,find:Rhr}});var Ywe=v((buo,Tpt)=>{"use strict";var{ArrayPrototypePop:$hr,Promise:Bhr}=La(),{isIterable:qhr,isNodeStream:Uhr,isWebStream:zhr}=e_(),{pipelineImpl:Hhr}=sX(),{finished:Vhr}=TC();Zwe();function Whr(...t){return new Bhr((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!Uhr(i)&&!qhr(i)&&!zhr(i)){let a=$hr(t);n=a.signal,o=a.end}Hhr(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}Tpt.exports={finished:Vhr,pipeline:Whr}});var Zwe=v((_uo,Fpt)=>{var{Buffer:Khr}=tp(),{ObjectDefineProperty:MC,ObjectKeys:Mpt,ReflectApply:Rpt}=La(),{promisify:{custom:jpt}}=Ed(),{streamReturningOperators:Apt,promiseReturningOperators:Ipt}=Ept(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Dpt}}=Sf(),Jhr=Wwe(),{setDefaultHighWaterMark:Ghr,getDefaultHighWaterMark:Yhr}=t3(),{pipeline:Npt}=sX(),{destroyer:Zhr}=JR(),Lpt=TC(),Xwe=Ywe(),d3=e_(),Gi=Fpt.exports=HZ().Stream;Gi.isDestroyed=d3.isDestroyed;Gi.isDisturbed=d3.isDisturbed;Gi.isErrored=d3.isErrored;Gi.isReadable=d3.isReadable;Gi.isWritable=d3.isWritable;Gi.Readable=o3();for(let t of Mpt(Apt)){let r=function(...n){if(new.target)throw Dpt();return Gi.Readable.from(Rpt(e,this,n))};Qwe=r;let e=Apt[t];MC(r,"name",{__proto__:null,value:e.name}),MC(r,"length",{__proto__:null,value:e.length}),MC(Gi.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var Qwe;for(let t of Mpt(Ipt)){let r=function(...o){if(new.target)throw Dpt();return Rpt(e,this,o)};Qwe=r;let e=Ipt[t];MC(r,"name",{__proto__:null,value:e.name}),MC(r,"length",{__proto__:null,value:e.length}),MC(Gi.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var Qwe;Gi.Writable=nX();Gi.Duplex=n_();Gi.Transform=jwe();Gi.PassThrough=Nwe();Gi.pipeline=Npt;var{addAbortSignal:Xhr}=e3();Gi.addAbortSignal=Xhr;Gi.finished=Lpt;Gi.destroy=Zhr;Gi.compose=Jhr;Gi.setDefaultHighWaterMark=Ghr;Gi.getDefaultHighWaterMark=Yhr;MC(Gi,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Xwe}});MC(Npt,jpt,{__proto__:null,enumerable:!0,get(){return Xwe.pipeline}});MC(Lpt,jpt,{__proto__:null,enumerable:!0,get(){return Xwe.finished}});Gi.Stream=Gi;Gi._isUint8Array=function(e){return e instanceof Uint8Array};Gi._uint8ArrayToBuffer=function(e){return Khr.from(e.buffer,e.byteOffset,e.byteLength)}});var f3=v((vuo,ws)=>{"use strict";var hl=Zwe(),Qhr=Ywe(),egr=hl.Readable.destroy;ws.exports=hl.Readable;ws.exports._uint8ArrayToBuffer=hl._uint8ArrayToBuffer;ws.exports._isUint8Array=hl._isUint8Array;ws.exports.isDisturbed=hl.isDisturbed;ws.exports.isErrored=hl.isErrored;ws.exports.isReadable=hl.isReadable;ws.exports.Readable=hl.Readable;ws.exports.Writable=hl.Writable;ws.exports.Duplex=hl.Duplex;ws.exports.Transform=hl.Transform;ws.exports.PassThrough=hl.PassThrough;ws.exports.addAbortSignal=hl.addAbortSignal;ws.exports.finished=hl.finished;ws.exports.destroy=hl.destroy;ws.exports.destroy=egr;ws.exports.pipeline=hl.pipeline;ws.exports.compose=hl.compose;Object.defineProperty(hl,"promises",{configurable:!0,enumerable:!0,get(){return Qhr}});ws.exports.Stream=hl.Stream;ws.exports.default=ws.exports});var r1=v((wuo,kpt)=>{"use strict";kpt.exports=TypeError});var $pt=v(()=>{});var g3=v((Cuo,imt)=>{var l0e=typeof Map=="function"&&Map.prototype,e0e=Object.getOwnPropertyDescriptor&&l0e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,pX=l0e&&e0e&&typeof e0e.get=="function"?e0e.get:null,Bpt=l0e&&Map.prototype.forEach,c0e=typeof Set=="function"&&Set.prototype,t0e=Object.getOwnPropertyDescriptor&&c0e?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,mX=c0e&&t0e&&typeof t0e.get=="function"?t0e.get:null,qpt=c0e&&Set.prototype.forEach,tgr=typeof WeakMap=="function"&&WeakMap.prototype,m3=tgr?WeakMap.prototype.has:null,rgr=typeof WeakSet=="function"&&WeakSet.prototype,h3=rgr?WeakSet.prototype.has:null,ngr=typeof WeakRef=="function"&&WeakRef.prototype,Upt=ngr?WeakRef.prototype.deref:null,ogr=Boolean.prototype.valueOf,igr=Object.prototype.toString,agr=Function.prototype.toString,sgr=String.prototype.match,d0e=String.prototype.slice,fT=String.prototype.replace,ugr=String.prototype.toUpperCase,zpt=String.prototype.toLowerCase,Xpt=RegExp.prototype.test,Hpt=Array.prototype.concat,i_=Array.prototype.join,lgr=Array.prototype.slice,Vpt=Math.floor,o0e=typeof BigInt=="function"?BigInt.prototype.valueOf:null,r0e=Object.getOwnPropertySymbols,i0e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,YF=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ad=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===YF||!0)?Symbol.toStringTag:null,Qpt=Object.prototype.propertyIsEnumerable,Wpt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Kpt(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Xpt.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-Vpt(-t):Vpt(t);if(n!==t){var o=String(n),i=d0e.call(e,o.length+1);return fT.call(o,r,"$&_")+"."+fT.call(fT.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return fT.call(e,r,"$&_")}var a0e=$pt(),Jpt=a0e.custom,Gpt=rmt(Jpt)?Jpt:null,emt={__proto__:null,double:'"',single:"'"},cgr={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};imt.exports=function t(e,r,n,o){var i=r||{};if(RC(i,"quoteStyle")&&!RC(emt,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(RC(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=RC(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(RC(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(RC(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 omt(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?Kpt(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?Kpt(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 s0e(e)?"[Array]":"[Object]";var d=Tgr(i,n);if(typeof o>"u")o=[];else if(nmt(o,e)>=0)return"[Circular]";function f(k,F,B){if(F&&(o=lgr.call(o),o.push(F)),B){var q={depth:i.depth};return RC(i,"quoteStyle")&&(q.quoteStyle=i.quoteStyle),t(k,q,n+1,o)}return t(k,i,n+1,o)}if(typeof e=="function"&&!Ypt(e)){var p=_gr(e),m=fX(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+i_.call(m,", ")+" }":"")}if(rmt(e)){var h=YF?fT.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):i0e.call(e);return typeof e=="object"&&!YF?p3(h):h}if(Ogr(e)){for(var b="<"+zpt.call(String(e.nodeName)),g=e.attributes||[],_=0;_<g.length;_++)b+=" "+g[_].name+"="+tmt(dgr(g[_].value),"double",i);return b+=">",e.childNodes&&e.childNodes.length&&(b+="..."),b+="</"+zpt.call(String(e.nodeName))+">",b}if(s0e(e)){if(e.length===0)return"[]";var w=fX(e,f);return d&&!Egr(w)?"["+u0e(w,d)+"]":"[ "+i_.call(w,", ")+" ]"}if(pgr(e)){var x=fX(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!Qpt.call(e,"cause")?"{ ["+String(e)+"] "+i_.call(Hpt.call("[cause]: "+f(e.cause),x),", ")+" }":x.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+i_.call(x,", ")+" }"}if(typeof e=="object"&&a){if(Gpt&&typeof e[Gpt]=="function"&&a0e)return a0e(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(vgr(e)){var C=[];return Bpt&&Bpt.call(e,function(k,F){C.push(f(F,e,!0)+" => "+f(k,e))}),Zpt("Map",pX.call(e),C,d)}if(xgr(e)){var E=[];return qpt&&qpt.call(e,function(k){E.push(f(k,e))}),Zpt("Set",mX.call(e),E,d)}if(wgr(e))return n0e("WeakMap");if(Cgr(e))return n0e("WeakSet");if(Sgr(e))return n0e("WeakRef");if(hgr(e))return p3(f(Number(e)));if(ygr(e))return p3(f(o0e.call(e)));if(ggr(e))return p3(ogr.call(e));if(mgr(e))return p3(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(!fgr(e)&&!Ypt(e)){var P=fX(e,f),A=Wpt?Wpt(e)===Object.prototype:e instanceof Object||e.constructor===Object,I=e instanceof Object?"":"null prototype",R=!A&&Ad&&Object(e)===e&&Ad in e?d0e.call(pT(e),8,-1):I?"Object":"",j=A||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",D=j+(R||I?"["+i_.call(Hpt.call([],R||[],I||[]),": ")+"] ":"");return P.length===0?D+"{}":d?D+"{"+u0e(P,d)+"}":D+"{ "+i_.call(P,", ")+" }"}return String(e)};function tmt(t,e,r){var n=r.quoteStyle||e,o=emt[n];return o+t+o}function dgr(t){return fT.call(String(t),/"/g,"&quot;")}function s0e(t){return pT(t)==="[object Array]"&&(!Ad||!(typeof t=="object"&&Ad in t))}function fgr(t){return pT(t)==="[object Date]"&&(!Ad||!(typeof t=="object"&&Ad in t))}function Ypt(t){return pT(t)==="[object RegExp]"&&(!Ad||!(typeof t=="object"&&Ad in t))}function pgr(t){return pT(t)==="[object Error]"&&(!Ad||!(typeof t=="object"&&Ad in t))}function mgr(t){return pT(t)==="[object String]"&&(!Ad||!(typeof t=="object"&&Ad in t))}function hgr(t){return pT(t)==="[object Number]"&&(!Ad||!(typeof t=="object"&&Ad in t))}function ggr(t){return pT(t)==="[object Boolean]"&&(!Ad||!(typeof t=="object"&&Ad in t))}function rmt(t){if(YF)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!i0e)return!1;try{return i0e.call(t),!0}catch{}return!1}function ygr(t){if(!t||typeof t!="object"||!o0e)return!1;try{return o0e.call(t),!0}catch{}return!1}var bgr=Object.prototype.hasOwnProperty||function(t){return t in this};function RC(t,e){return bgr.call(t,e)}function pT(t){return igr.call(t)}function _gr(t){if(t.name)return t.name;var e=sgr.call(agr.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function nmt(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 vgr(t){if(!pX||!t||typeof t!="object")return!1;try{pX.call(t);try{mX.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function wgr(t){if(!m3||!t||typeof t!="object")return!1;try{m3.call(t,m3);try{h3.call(t,h3)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function Sgr(t){if(!Upt||!t||typeof t!="object")return!1;try{return Upt.call(t),!0}catch{}return!1}function xgr(t){if(!mX||!t||typeof t!="object")return!1;try{mX.call(t);try{pX.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function Cgr(t){if(!h3||!t||typeof t!="object")return!1;try{h3.call(t,h3);try{m3.call(t,m3)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function Ogr(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function omt(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return omt(d0e.call(t,0,e.maxStringLength),e)+n}var o=cgr[e.quoteStyle||"single"];o.lastIndex=0;var i=fT.call(fT.call(t,o,"\\$1"),/[\x00-\x1f]/g,Pgr);return tmt(i,"single",e)}function Pgr(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":"")+ugr.call(e.toString(16))}function p3(t){return"Object("+t+")"}function n0e(t){return t+" { ? }"}function Zpt(t,e,r,n){var o=n?u0e(r,n):i_.call(r,", ");return t+" ("+e+") {"+o+"}"}function Egr(t){for(var e=0;e<t.length;e++)if(nmt(t[e],`
`)>=0)return!1;return!0}function Tgr(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=i_.call(Array(t.indent+1)," ");else return null;return{base:r,prev:i_.call(Array(e+1),r)}}function u0e(t,e){if(t.length===0)return"";var r=`
`+e.prev+e.base;return r+i_.call(t,","+r)+`
`+e.prev}function fX(t,e){var r=s0e(t),n=[];if(r){n.length=t.length;for(var o=0;o<t.length;o++)n[o]=RC(t,o)?e(t[o],t):""}var i=typeof r0e=="function"?r0e(t):[],a;if(YF){a={};for(var s=0;s<i.length;s++)a["$"+i[s]]=i[s]}for(var u in t)RC(t,u)&&(r&&String(Number(u))===u&&u<t.length||YF&&a["$"+u]instanceof Symbol||(Xpt.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if(typeof r0e=="function")for(var l=0;l<i.length;l++)Qpt.call(t,i[l])&&n.push("["+e(i[l])+"]: "+e(t[i[l]],t));return n}});var smt=v((Ouo,amt)=>{"use strict";var Agr=g3(),Igr=r1(),hX=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},Mgr=function(t,e){if(t){var r=hX(t,e);return r&&r.value}},Rgr=function(t,e,r){var n=hX(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},jgr=function(t,e){return t?!!hX(t,e):!1},Dgr=function(t,e){if(t)return hX(t,e,!0)};amt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new Igr("Side channel does not contain "+Agr(n))},delete:function(n){var o=e&&e.next,i=Dgr(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return Mgr(e,n)},has:function(n){return jgr(e,n)},set:function(n,o){e||(e={next:void 0}),Rgr(e,n,o)}};return r}});var f0e=v((Puo,umt)=>{"use strict";umt.exports=Object});var cmt=v((Euo,lmt)=>{"use strict";lmt.exports=Error});var fmt=v((Tuo,dmt)=>{"use strict";dmt.exports=EvalError});var mmt=v((Auo,pmt)=>{"use strict";pmt.exports=RangeError});var gmt=v((Iuo,hmt)=>{"use strict";hmt.exports=ReferenceError});var bmt=v((Muo,ymt)=>{"use strict";ymt.exports=SyntaxError});var vmt=v((Ruo,_mt)=>{"use strict";_mt.exports=URIError});var Smt=v((juo,wmt)=>{"use strict";wmt.exports=Math.abs});var Cmt=v((Duo,xmt)=>{"use strict";xmt.exports=Math.floor});var Pmt=v((Nuo,Omt)=>{"use strict";Omt.exports=Math.max});var Tmt=v((Luo,Emt)=>{"use strict";Emt.exports=Math.min});var Imt=v((Fuo,Amt)=>{"use strict";Amt.exports=Math.pow});var Rmt=v((kuo,Mmt)=>{"use strict";Mmt.exports=Math.round});var Dmt=v(($uo,jmt)=>{"use strict";jmt.exports=Number.isNaN||function(e){return e!==e}});var Lmt=v((Buo,Nmt)=>{"use strict";var Ngr=Dmt();Nmt.exports=function(e){return Ngr(e)||e===0?e:e<0?-1:1}});var kmt=v((quo,Fmt)=>{"use strict";Fmt.exports=Object.getOwnPropertyDescriptor});var p0e=v((Uuo,$mt)=>{"use strict";var gX=kmt();if(gX)try{gX([],"length")}catch{gX=null}$mt.exports=gX});var qmt=v((zuo,Bmt)=>{"use strict";var yX=Object.defineProperty||!1;if(yX)try{yX({},"a",{value:1})}catch{yX=!1}Bmt.exports=yX});var zmt=v((Huo,Umt)=>{"use strict";Umt.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 Wmt=v((Vuo,Vmt)=>{"use strict";var Hmt=typeof Symbol<"u"&&Symbol,Lgr=zmt();Vmt.exports=function(){return typeof Hmt!="function"||typeof Symbol!="function"||typeof Hmt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Lgr()}});var m0e=v((Wuo,Kmt)=>{"use strict";Kmt.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var h0e=v((Kuo,Jmt)=>{"use strict";var Fgr=f0e();Jmt.exports=Fgr.getPrototypeOf||null});var Zmt=v((Juo,Ymt)=>{"use strict";var kgr="Function.prototype.bind called on incompatible ",$gr=Object.prototype.toString,Bgr=Math.max,qgr="[object Function]",Gmt=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},Ugr=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},zgr=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};Ymt.exports=function(e){var r=this;if(typeof r!="function"||$gr.apply(r)!==qgr)throw new TypeError(kgr+r);for(var n=Ugr(arguments,1),o,i=function(){if(this instanceof o){var c=r.apply(this,Gmt(n,arguments));return Object(c)===c?c:this}return r.apply(e,Gmt(n,arguments))},a=Bgr(0,r.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(o=Function("binder","return function ("+zgr(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 y3=v((Guo,Xmt)=>{"use strict";var Hgr=Zmt();Xmt.exports=Function.prototype.bind||Hgr});var bX=v((Yuo,Qmt)=>{"use strict";Qmt.exports=Function.prototype.call});var g0e=v((Zuo,eht)=>{"use strict";eht.exports=Function.prototype.apply});var rht=v((Xuo,tht)=>{"use strict";tht.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var oht=v((Quo,nht)=>{"use strict";var Vgr=y3(),Wgr=g0e(),Kgr=bX(),Jgr=rht();nht.exports=Jgr||Vgr.call(Kgr,Wgr)});var y0e=v((elo,iht)=>{"use strict";var Ggr=y3(),Ygr=r1(),Zgr=bX(),Xgr=oht();iht.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new Ygr("a function is required");return Xgr(Ggr,Zgr,e)}});var dht=v((tlo,cht)=>{"use strict";var Qgr=y0e(),aht=p0e(),uht;try{uht=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var b0e=!!uht&&aht&&aht(Object.prototype,"__proto__"),lht=Object,sht=lht.getPrototypeOf;cht.exports=b0e&&typeof b0e.get=="function"?Qgr([b0e.get]):typeof sht=="function"?function(e){return sht(e==null?e:lht(e))}:!1});var ght=v((rlo,hht)=>{"use strict";var fht=m0e(),pht=h0e(),mht=dht();hht.exports=fht?function(e){return fht(e)}:pht?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return pht(e)}:mht?function(e){return mht(e)}:null});var bht=v((nlo,yht)=>{"use strict";var eyr=Function.prototype.call,tyr=Object.prototype.hasOwnProperty,ryr=y3();yht.exports=ryr.call(eyr,tyr)});var wX=v((olo,Cht)=>{"use strict";var An,nyr=f0e(),oyr=cmt(),iyr=fmt(),ayr=mmt(),syr=gmt(),ek=bmt(),QF=r1(),uyr=vmt(),lyr=Smt(),cyr=Cmt(),dyr=Pmt(),fyr=Tmt(),pyr=Imt(),myr=Rmt(),hyr=Lmt(),Sht=Function,_0e=function(t){try{return Sht('"use strict"; return ('+t+").constructor;")()}catch{}},b3=p0e(),gyr=qmt(),v0e=function(){throw new QF},yyr=b3?function(){try{return arguments.callee,v0e}catch{try{return b3(arguments,"callee").get}catch{return v0e}}}():v0e,ZF=Wmt()(),Fl=ght(),byr=h0e(),_yr=m0e(),xht=g0e(),_3=bX(),XF={},vyr=typeof Uint8Array>"u"||!Fl?An:Fl(Uint8Array),n1={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?An:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?An:ArrayBuffer,"%ArrayIteratorPrototype%":ZF&&Fl?Fl([][Symbol.iterator]()):An,"%AsyncFromSyncIteratorPrototype%":An,"%AsyncFunction%":XF,"%AsyncGenerator%":XF,"%AsyncGeneratorFunction%":XF,"%AsyncIteratorPrototype%":XF,"%Atomics%":typeof Atomics>"u"?An:Atomics,"%BigInt%":typeof BigInt>"u"?An:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?An:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?An:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?An:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":oyr,"%eval%":eval,"%EvalError%":iyr,"%Float32Array%":typeof Float32Array>"u"?An:Float32Array,"%Float64Array%":typeof Float64Array>"u"?An:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?An:FinalizationRegistry,"%Function%":Sht,"%GeneratorFunction%":XF,"%Int8Array%":typeof Int8Array>"u"?An:Int8Array,"%Int16Array%":typeof Int16Array>"u"?An:Int16Array,"%Int32Array%":typeof Int32Array>"u"?An:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ZF&&Fl?Fl(Fl([][Symbol.iterator]())):An,"%JSON%":typeof JSON=="object"?JSON:An,"%Map%":typeof Map>"u"?An:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ZF||!Fl?An:Fl(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":nyr,"%Object.getOwnPropertyDescriptor%":b3,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?An:Promise,"%Proxy%":typeof Proxy>"u"?An:Proxy,"%RangeError%":ayr,"%ReferenceError%":syr,"%Reflect%":typeof Reflect>"u"?An:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?An:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ZF||!Fl?An:Fl(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?An:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ZF&&Fl?Fl(""[Symbol.iterator]()):An,"%Symbol%":ZF?Symbol:An,"%SyntaxError%":ek,"%ThrowTypeError%":yyr,"%TypedArray%":vyr,"%TypeError%":QF,"%Uint8Array%":typeof Uint8Array>"u"?An:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?An:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?An:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?An:Uint32Array,"%URIError%":uyr,"%WeakMap%":typeof WeakMap>"u"?An:WeakMap,"%WeakRef%":typeof WeakRef>"u"?An:WeakRef,"%WeakSet%":typeof WeakSet>"u"?An:WeakSet,"%Function.prototype.call%":_3,"%Function.prototype.apply%":xht,"%Object.defineProperty%":gyr,"%Object.getPrototypeOf%":byr,"%Math.abs%":lyr,"%Math.floor%":cyr,"%Math.max%":dyr,"%Math.min%":fyr,"%Math.pow%":pyr,"%Math.round%":myr,"%Math.sign%":hyr,"%Reflect.getPrototypeOf%":_yr};if(Fl)try{null.error}catch(t){_ht=Fl(Fl(t)),n1["%Error.prototype%"]=_ht}var _ht,wyr=function t(e){var r;if(e==="%AsyncFunction%")r=_0e("async function () {}");else if(e==="%GeneratorFunction%")r=_0e("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=_0e("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&Fl&&(r=Fl(o.prototype))}return n1[e]=r,r},vht={__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"]},v3=y3(),_X=bht(),Syr=v3.call(_3,Array.prototype.concat),xyr=v3.call(xht,Array.prototype.splice),wht=v3.call(_3,String.prototype.replace),vX=v3.call(_3,String.prototype.slice),Cyr=v3.call(_3,RegExp.prototype.exec),Oyr=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Pyr=/\\(\\)?/g,Eyr=function(e){var r=vX(e,0,1),n=vX(e,-1);if(r==="%"&&n!=="%")throw new ek("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new ek("invalid intrinsic syntax, expected opening `%`");var o=[];return wht(e,Oyr,function(i,a,s,u){o[o.length]=s?wht(u,Pyr,"$1"):a||i}),o},Tyr=function(e,r){var n=e,o;if(_X(vht,n)&&(o=vht[n],n="%"+o[0]+"%"),_X(n1,n)){var i=n1[n];if(i===XF&&(i=wyr(n)),typeof i>"u"&&!r)throw new QF("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new ek("intrinsic "+e+" does not exist!")};Cht.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new QF("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new QF('"allowMissing" argument must be a boolean');if(Cyr(/^%?[^%]*%?$/,e)===null)throw new ek("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Eyr(e),o=n.length>0?n[0]:"",i=Tyr("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],xyr(n,Syr([0,1],l)));for(var c=1,d=!0;c<n.length;c+=1){var f=n[c],p=vX(f,0,1),m=vX(f,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new ek("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(u=!0),o+="."+f,a="%"+o+"%",_X(n1,a))s=n1[a];else if(s!=null){if(!(f in s)){if(!r)throw new QF("base intrinsic for "+e+" exists, but the property is not available.");return}if(b3&&c+1>=n.length){var h=b3(s,f);d=!!h,d&&"get"in h&&!("originalValue"in h.get)?s=h.get:s=s[f]}else d=_X(s,f),s=s[f];d&&!u&&(n1[a]=s)}}return s}});var w0e=v((ilo,Eht)=>{"use strict";var Oht=wX(),Pht=y0e(),Ayr=Pht([Oht("%String.prototype.indexOf%")]);Eht.exports=function(e,r){var n=Oht(e,!!r);return typeof n=="function"&&Ayr(e,".prototype.")>-1?Pht([n]):n}});var S0e=v((alo,Aht)=>{"use strict";var Iyr=wX(),w3=w0e(),Myr=g3(),Ryr=r1(),Tht=Iyr("%Map%",!0),jyr=w3("Map.prototype.get",!0),Dyr=w3("Map.prototype.set",!0),Nyr=w3("Map.prototype.has",!0),Lyr=w3("Map.prototype.delete",!0),Fyr=w3("Map.prototype.size",!0);Aht.exports=!!Tht&&function(){var e,r={assert:function(n){if(!r.has(n))throw new Ryr("Side channel does not contain "+Myr(n))},delete:function(n){if(e){var o=Lyr(e,n);return Fyr(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return jyr(e,n)},has:function(n){return e?Nyr(e,n):!1},set:function(n,o){e||(e=new Tht),Dyr(e,n,o)}};return r}});var Mht=v((slo,Iht)=>{"use strict";var kyr=wX(),xX=w0e(),$yr=g3(),SX=S0e(),Byr=r1(),tk=kyr("%WeakMap%",!0),qyr=xX("WeakMap.prototype.get",!0),Uyr=xX("WeakMap.prototype.set",!0),zyr=xX("WeakMap.prototype.has",!0),Hyr=xX("WeakMap.prototype.delete",!0);Iht.exports=tk?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new Byr("Side channel does not contain "+$yr(o))},delete:function(o){if(tk&&o&&(typeof o=="object"||typeof o=="function")){if(e)return Hyr(e,o)}else if(SX&&r)return r.delete(o);return!1},get:function(o){return tk&&o&&(typeof o=="object"||typeof o=="function")&&e?qyr(e,o):r&&r.get(o)},has:function(o){return tk&&o&&(typeof o=="object"||typeof o=="function")&&e?zyr(e,o):!!r&&r.has(o)},set:function(o,i){tk&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new tk),Uyr(e,o,i)):SX&&(r||(r=SX()),r.set(o,i))}};return n}:SX});var jht=v((ulo,Rht)=>{"use strict";var Vyr=r1(),Wyr=g3(),Kyr=smt(),Jyr=S0e(),Gyr=Mht(),Yyr=Gyr||Jyr||Kyr;Rht.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new Vyr("Side channel does not contain "+Wyr(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=Yyr()),e.set(n,o)}};return r}});var CX=v((llo,Dht)=>{"use strict";var Zyr=String.prototype.replace,Xyr=/%20/g,x0e={RFC1738:"RFC1738",RFC3986:"RFC3986"};Dht.exports={default:x0e.RFC3986,formatters:{RFC1738:function(t){return Zyr.call(t,Xyr,"+")},RFC3986:function(t){return String(t)}},RFC1738:x0e.RFC1738,RFC3986:x0e.RFC3986}});var O0e=v((clo,Lht)=>{"use strict";var Qyr=CX(),C0e=Object.prototype.hasOwnProperty,o1=Array.isArray,a_=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),ebr=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(o1(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);r.obj[r.prop]=o}}},Nht=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},tbr=function t(e,r,n){if(!r)return e;if(typeof r!="object"){if(o1(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!C0e.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 o1(e)&&!o1(r)&&(o=Nht(e,n)),o1(e)&&o1(r)?(r.forEach(function(i,a){if(C0e.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 C0e.call(i,a)?i[a]=t(i[a],s,n):i[a]=s,i},o)},rbr=function(e,r){return Object.keys(r).reduce(function(n,o){return n[o]=r[o],n},e)},nbr=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}},obr=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===Qyr.RFC1738&&(l===40||l===41)){s+=a.charAt(u);continue}if(l<128){s=s+a_[l];continue}if(l<2048){s=s+(a_[192|l>>6]+a_[128|l&63]);continue}if(l<55296||l>=57344){s=s+(a_[224|l>>12]+a_[128|l>>6&63]+a_[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|a.charCodeAt(u)&1023),s+=a_[240|l>>18]+a_[128|l>>12&63]+a_[128|l>>6&63]+a_[128|l&63]}return s},ibr=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 ebr(r),e},abr=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},sbr=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},ubr=function(e,r){return[].concat(e,r)},lbr=function(e,r){if(o1(e)){for(var n=[],o=0;o<e.length;o+=1)n.push(r(e[o]));return n}return r(e)};Lht.exports={arrayToObject:Nht,assign:rbr,combine:ubr,compact:ibr,decode:nbr,encode:obr,isBuffer:sbr,isRegExp:abr,maybeMap:lbr,merge:tbr}});var Uht=v((dlo,qht)=>{"use strict";var $ht=jht(),OX=O0e(),S3=CX(),cbr=Object.prototype.hasOwnProperty,Fht={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},jC=Array.isArray,dbr=Array.prototype.push,Bht=function(t,e){dbr.apply(t,jC(e)?e:[e])},fbr=Date.prototype.toISOString,kht=S3.default,Id={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:OX.encode,encodeValuesOnly:!1,format:kht,formatter:S3.formatters[kht],indices:!1,serializeDate:function(e){return fbr.call(e)},skipNulls:!1,strictNullHandling:!1},pbr=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},P0e={},mbr=function t(e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,b){for(var g=e,_=b,w=0,x=!1;(_=_.get(P0e))!==void 0&&!x;){var C=_.get(e);if(w+=1,typeof C<"u"){if(C===w)throw new RangeError("Cyclic object value");x=!0}typeof _.get(P0e)>"u"&&(w=0)}if(typeof u=="function"?g=u(r,g):g instanceof Date?g=d(g):n==="comma"&&jC(g)&&(g=OX.maybeMap(g,function(q){return q instanceof Date?d(q):q})),g===null){if(i)return s&&!m?s(r,Id.encoder,h,"key",f):r;g=""}if(pbr(g)||OX.isBuffer(g)){if(s){var E=m?r:s(r,Id.encoder,h,"key",f);return[p(E)+"="+p(s(g,Id.encoder,h,"value",f))]}return[p(r)+"="+p(String(g))]}var P=[];if(typeof g>"u")return P;var A;if(n==="comma"&&jC(g))m&&s&&(g=OX.maybeMap(g,s)),A=[{value:g.length>0?g.join(",")||null:void 0}];else if(jC(u))A=u;else{var I=Object.keys(g);A=l?I.sort(l):I}for(var R=o&&jC(g)&&g.length===1?r+"[]":r,j=0;j<A.length;++j){var D=A[j],k=typeof D=="object"&&typeof D.value<"u"?D.value:g[D];if(!(a&&k===null)){var F=jC(g)?typeof n=="function"?n(R,D):R:R+(c?"."+D:"["+D+"]");b.set(e,w);var B=$ht();B.set(P0e,b),Bht(P,t(k,F,n,o,i,a,n==="comma"&&m&&jC(g)?null:s,u,l,c,d,f,p,m,h,B))}}return P},hbr=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=S3.default;if(typeof e.format<"u"){if(!cbr.call(S3.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var o=S3.formatters[n],i=Id.filter;return(typeof e.filter=="function"||jC(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}};qht.exports=function(t,e){var r=t,n=hbr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):jC(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s;e&&e.arrayFormat in Fht?s=e.arrayFormat:e&&"indices"in e?s=e.indices?"indices":"repeat":s="indices";var u=Fht[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=$ht(),d=0;d<o.length;++d){var f=o[d];n.skipNulls&&r[f]===null||Bht(a,mbr(r[f],f,u,l,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,c))}var p=a.join(n.delimiter),m=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),p.length>0?m+p:""}});var Vht=v((flo,Hht)=>{"use strict";var rk=O0e(),E0e=Object.prototype.hasOwnProperty,gbr=Array.isArray,kl={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:rk.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},ybr=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},zht=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},bbr="utf8=%26%2310003%3B",_br="utf8=%E2%9C%93",vbr=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]===_br?l="utf-8":a[u]===bbr&&(l="iso-8859-1"),s=u,u=a.length);for(u=0;u<a.length;++u)if(u!==s){var c=a[u],d=c.indexOf("]="),f=d===-1?c.indexOf("="):d+1,p,m;f===-1?(p=r.decoder(c,kl.decoder,l,"key"),m=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,f),kl.decoder,l,"key"),m=rk.maybeMap(zht(c.slice(f+1),r),function(h){return r.decoder(h,kl.decoder,l,"value")})),m&&r.interpretNumericEntities&&l==="iso-8859-1"&&(m=ybr(m)),c.indexOf("[]=")>-1&&(m=gbr(m)?[m]:m),E0e.call(n,p)?n[p]=rk.combine(n[p],m):n[p]=m}return n},wbr=function(t,e,r,n){for(var o=n?e:zht(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},Sbr=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&&E0e.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&&E0e.call(Object.prototype,u[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(u[1])}return u&&c.push("["+i.slice(u.index)+"]"),wbr(c,r,n,o)}},xbr=function(e){if(!e)return kl;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"?kl.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?kl.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:kl.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:kl.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:kl.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:kl.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:kl.comma,decoder:typeof e.decoder=="function"?e.decoder:kl.decoder,delimiter:typeof e.delimiter=="string"||rk.isRegExp(e.delimiter)?e.delimiter:kl.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:kl.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:kl.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:kl.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:kl.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:kl.strictNullHandling}};Hht.exports=function(t,e){var r=xbr(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?vbr(t,r):t,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],u=Sbr(s,n[s],r,typeof t=="string");o=rk.merge(o,u,r)}return r.allowSparse===!0?o:rk.compact(o)}});var Kht=v((plo,Wht)=>{"use strict";var Cbr=Uht(),Obr=Vht(),Pbr=CX();Wht.exports={formats:Pbr,parse:Obr,stringify:Cbr}});var Jht=v(nk=>{"use strict";var Ebr=nk&&nk.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(nk,"__esModule",{value:!0});nk.createRequestUrl=void 0;var Tbr=Ebr(Kht());function Abr(t,e){return Object.keys(e??{}).length>0?`${t}?${Tbr.default.stringify(e,{arrayFormat:"repeat"})}`:t}nk.createRequestUrl=Abr});var Zht=v(PX=>{"use strict";var T0e,A0e,I0e,M0e,R0e;Object.defineProperty(PX,"__esModule",{value:!0});PX.RUNTIME=void 0;var Ibr=typeof window<"u"&&typeof window.document<"u",Mbr=typeof self=="object"&&typeof self?.importScripts=="function"&&(((T0e=self.constructor)===null||T0e===void 0?void 0:T0e.name)==="DedicatedWorkerGlobalScope"||((A0e=self.constructor)===null||A0e===void 0?void 0:A0e.name)==="ServiceWorkerGlobalScope"||((I0e=self.constructor)===null||I0e===void 0?void 0:I0e.name)==="SharedWorkerGlobalScope"),Ght=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",Yht=typeof Bun<"u"&&typeof Bun.version<"u",Rbr=typeof process<"u"&&!!process.version&&!!(!((M0e=process.versions)===null||M0e===void 0)&&M0e.node)&&!Ght&&!Yht,jbr=typeof navigator<"u"&&navigator?.product==="ReactNative",Dbr=typeof globalThis<"u"&&((R0e=globalThis?.navigator)===null||R0e===void 0?void 0:R0e.userAgent)==="Cloudflare-Workers";PX.RUNTIME=Nbr();function Nbr(){return Ibr?{type:"browser",version:window.navigator.userAgent}:Dbr?{type:"workerd"}:Mbr?{type:"web-worker"}:Ght?{type:"deno",version:Deno.version.deno}:Yht?{type:"bun",version:Bun.version}:Rbr?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:jbr?{type:"react-native"}:{type:"unknown"}}});var ok=v(EX=>{"use strict";Object.defineProperty(EX,"__esModule",{value:!0});EX.RUNTIME=void 0;var Lbr=Zht();Object.defineProperty(EX,"RUNTIME",{enumerable:!0,get:function(){return Lbr.RUNTIME}})});var j0e=v((ik,Xht)=>{"use strict";var Fbr=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},i1=Fbr();Xht.exports=ik=i1.fetch;i1.fetch&&(ik.default=i1.fetch.bind(i1));ik.Headers=i1.Headers;ik.Request=i1.Request;ik.Response=i1.Response});var egt=v(Oh=>{"use strict";var kbr=Oh&&Oh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Oh&&Oh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qht=Oh&&Oh.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kbr(e,t,r);return $br(e,t),e},Bbr=Oh&&Oh.__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(Oh,"__esModule",{value:!0});Oh.getFetchFn=void 0;var TX=ok();function qbr(){return Bbr(this,void 0,void 0,function*(){return TX.RUNTIME.type==="node"&&TX.RUNTIME.parsedVersion!=null&&TX.RUNTIME.parsedVersion>=18?fetch:TX.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>Qht(j0e()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>Qht(j0e()))).default})}Oh.getFetchFn=qbr});var tgt=v(ak=>{"use strict";var Ubr=ak&&ak.__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(ak,"__esModule",{value:!0});ak.getRequestBody=void 0;function zbr({body:t,type:e}){return Ubr(this,void 0,void 0,function*(){return e.includes("json")?JSON.stringify(t):t})}ak.getRequestBody=zbr});var rgt=v(sk=>{"use strict";var Xg=sk&&sk.__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(sk,"__esModule",{value:!0});sk.Node18UniversalStreamWrapper=void 0;var D0e=class t{constructor(e){this.readableStream=e,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(e,r){var n;(n=this.events[e])===null||n===void 0||n.push(r)}off(e,r){var n;this.events[e]=(n=this.events[e])===null||n===void 0?void 0:n.filter(o=>o!==r)}pipe(e){return this.on("data",r=>Xg(this,void 0,void 0,function*(){if(e instanceof t)e._write(r);else if(e instanceof WritableStream){let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}else e.write(r)})),this.on("end",()=>Xg(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>Xg(this,void 0,void 0,function*(){e instanceof t?e._error(r):e instanceof WritableStream?e.getWriter().abort(r):e.destroy(r)})),this._startReading(),e}pipeTo(e){return this.pipe(e)}unpipe(e){this.off("data",r=>Xg(this,void 0,void 0,function*(){if(e instanceof t)e._write(r);else if(e instanceof WritableStream){let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}else e.write(r)})),this.off("end",()=>Xg(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>Xg(this,void 0,void 0,function*(){e instanceof t?e._error(r):e instanceof WritableStream?e.getWriter().abort(r):e.destroy(r)}))}destroy(e){this.reader.cancel(e).then(()=>{this._emit("close")}).catch(r=>{this._emit("error",r)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}read(){return Xg(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 Xg(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 Xg(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 Xg(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:()=>Xg(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}}}};sk.Node18UniversalStreamWrapper=D0e});var ngt=v(uk=>{"use strict";var x3=uk&&uk.__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(uk,"__esModule",{value:!0});uk.UndiciStreamWrapper=void 0;var N0e=class t{constructor(e){this.readableStream=e,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(e,r){var n;(n=this.events[e])===null||n===void 0||n.push(r)}off(e,r){var n;this.events[e]=(n=this.events[e])===null||n===void 0?void 0:n.filter(o=>o!==r)}pipe(e){return this.on("data",r=>{if(e instanceof t)e._write(r);else{let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}}),this.on("end",()=>{e instanceof t?e._end():e.getWriter().close()}),this.on("error",r=>{e instanceof t?e._error(r):e.getWriter().abort(r)}),this._startReading(),e}pipeTo(e){return this.pipe(e)}unpipe(e){this.off("data",r=>{if(e instanceof t)e._write(r);else{let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}}),this.off("end",()=>{e instanceof t?e._end():e.getWriter().close()}),this.off("error",r=>{e instanceof t?e._error(r):e.getWriter().abort(r)})}destroy(e){this.reader.cancel(e).then(()=>{this._emit("close")}).catch(r=>{this._emit("error",r)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}read(){return x3(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 x3(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 x3(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 x3(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:()=>x3(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}}}};uk.UndiciStreamWrapper=N0e});var ogt=v(mT=>{"use strict";var AX=mT&&mT.__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())})},Hbr=mT&&mT.__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(mT,"__esModule",{value:!0});mT.NodePre18StreamWrapper=void 0;var L0e=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 AX(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 AX(this,void 0,void 0,function*(){let n=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");try{for(var i=Hbr(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 AX(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 AX(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};mT.NodePre18StreamWrapper=L0e});var igt=v(Ph=>{"use strict";var Vbr=Ph&&Ph.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wbr=Ph&&Ph.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F0e=Ph&&Ph.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vbr(e,t,r);return Wbr(e,t),e},Kbr=Ph&&Ph.__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(Ph,"__esModule",{value:!0});Ph.chooseStreamWrapper=void 0;var IX=ok();function Jbr(t){return Kbr(this,void 0,void 0,function*(){return IX.RUNTIME.type==="node"&&IX.RUNTIME.parsedVersion!=null&&IX.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>F0e(rgt()))).Node18UniversalStreamWrapper(t):IX.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>F0e(ngt()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>F0e(ogt()))).NodePre18StreamWrapper(t)})}Ph.chooseStreamWrapper=Jbr});var agt=v(lk=>{"use strict";var Gbr=lk&&lk.__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(lk,"__esModule",{value:!0});lk.getResponseBody=void 0;var Ybr=igt();function Zbr(t,e){return Gbr(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,Ybr.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}})}lk.getResponseBody=Zbr});var sgt=v(ck=>{"use strict";Object.defineProperty(ck,"__esModule",{value:!0});ck.anySignal=ck.getTimeoutSignal=void 0;var Xbr="timeout";function Qbr(t){let e=new AbortController,r=setTimeout(()=>e.abort(Xbr),t);return{signal:e.signal,abortId:r}}ck.getTimeoutSignal=Qbr;function e_r(...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}ck.anySignal=e_r});var lgt=v(dk=>{"use strict";var t_r=dk&&dk.__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(dk,"__esModule",{value:!0});dk.makeRequest=void 0;var ugt=sgt(),r_r=(t,e,r,n,o,i,a,s,u)=>t_r(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:m}=(0,ugt.getTimeoutSignal)(i);c=m,l.push(p)}a!=null&&l.push(a);let d=(0,ugt.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});dk.makeRequest=r_r});var cgt=v(fk=>{"use strict";var n_r=fk&&fk.__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(fk,"__esModule",{value:!0});fk.requestWithRetries=void 0;var o_r=1,i_r=60,a_r=2;function s_r(t,e=a_r){return n_r(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(o_r*Math.pow(2,n),i_r);yield new Promise(i=>setTimeout(i,o)),r=yield t()}return r})}fk.requestWithRetries=s_r});var pgt=v(hT=>{"use strict";var dgt=hT&&hT.__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(hT,"__esModule",{value:!0});hT.fetcher=hT.fetcherImpl=void 0;var u_r=Jht(),l_r=egt(),c_r=tgt(),d_r=agt(),f_r=lgt(),p_r=cgt();function fgt(t){return dgt(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,u_r.createRequestUrl)(t.url,t.queryParameters),n=yield(0,c_r.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,l_r.getFetchFn)();try{let i=yield(0,p_r.requestWithRetries)(()=>dgt(this,void 0,void 0,function*(){return(0,f_r.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,d_r.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)}}}})}hT.fetcherImpl=fgt;hT.fetcher=fgt});var mgt=v(MX=>{"use strict";Object.defineProperty(MX,"__esModule",{value:!0});MX.getHeader=void 0;function m_r(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}MX.getHeader=m_r});var hgt=v(pk=>{"use strict";var h_r=pk&&pk.__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(pk,"__esModule",{value:!0});pk.Supplier=void 0;pk.Supplier={get:t=>h_r(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var ggt=v(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});gT.Supplier=gT.getHeader=gT.fetcher=void 0;var g_r=pgt();Object.defineProperty(gT,"fetcher",{enumerable:!0,get:function(){return g_r.fetcher}});var y_r=mgt();Object.defineProperty(gT,"getHeader",{enumerable:!0,get:function(){return y_r.getHeader}});var b_r=hgt();Object.defineProperty(gT,"Supplier",{enumerable:!0,get:function(){return b_r.Supplier}})});var ygt=v((k0e,$0e)=>{(function(t,e){typeof k0e=="object"&&typeof $0e<"u"?$0e.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:k0e,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(G){var Z={};return G.forEach(function(ie,Ie){return Z[ie]=Ie}),Z}(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(G,Z){return Z===void 0&&(Z=function(ie){return ie}),new Uint8Array(Array.prototype.slice.call(G,0).map(Z))},p=function(G){return G.replace(/=/g,"").replace(/[+\/]/g,function(Z){return Z=="+"?"-":"_"})},m=function(G){return G.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(G){for(var Z,ie,Ie,st,Te="",Qe=G.length%3,nt=0;nt<G.length;){if((ie=G.charCodeAt(nt++))>255||(Ie=G.charCodeAt(nt++))>255||(st=G.charCodeAt(nt++))>255)throw new TypeError("invalid character found");Z=ie<<16|Ie<<8|st,Te+=u[Z>>18&63]+u[Z>>12&63]+u[Z>>6&63]+u[Z&63]}return Qe?Te.slice(0,Qe-3)+"===".substring(Qe):Te},b=n?function(G){return btoa(G)}:o?function(G){return Buffer.from(G,"binary").toString("base64")}:h,g=o?function(G){return Buffer.from(G).toString("base64")}:function(G){for(var Z=4096,ie=[],Ie=0,st=G.length;Ie<st;Ie+=Z)ie.push(d.apply(null,G.subarray(Ie,Ie+Z)));return b(ie.join(""))},_=function(G,Z){return Z===void 0&&(Z=!1),Z?p(g(G)):g(G)},w=function(G){if(G.length<2){var Z=G.charCodeAt(0);return Z<128?G:Z<2048?d(192|Z>>>6)+d(128|Z&63):d(224|Z>>>12&15)+d(128|Z>>>6&63)+d(128|Z&63)}else{var Z=65536+(G.charCodeAt(0)-55296)*1024+(G.charCodeAt(1)-56320);return d(240|Z>>>18&7)+d(128|Z>>>12&63)+d(128|Z>>>6&63)+d(128|Z&63)}},x=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,C=function(G){return G.replace(x,w)},E=o?function(G){return Buffer.from(G,"utf8").toString("base64")}:a?function(G){return g(a.encode(G))}:function(G){return b(C(G))},P=function(G,Z){return Z===void 0&&(Z=!1),Z?p(E(G)):E(G)},A=function(G){return P(G,!0)},I=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,R=function(G){switch(G.length){case 4:var Z=(7&G.charCodeAt(0))<<18|(63&G.charCodeAt(1))<<12|(63&G.charCodeAt(2))<<6|63&G.charCodeAt(3),ie=Z-65536;return d((ie>>>10)+55296)+d((ie&1023)+56320);case 3:return d((15&G.charCodeAt(0))<<12|(63&G.charCodeAt(1))<<6|63&G.charCodeAt(2));default:return d((31&G.charCodeAt(0))<<6|63&G.charCodeAt(1))}},j=function(G){return G.replace(I,R)},D=function(G){if(G=G.replace(/\s+/g,""),!c.test(G))throw new TypeError("malformed base64.");G+="==".slice(2-(G.length&3));for(var Z,ie="",Ie,st,Te=0;Te<G.length;)Z=l[G.charAt(Te++)]<<18|l[G.charAt(Te++)]<<12|(Ie=l[G.charAt(Te++)])<<6|(st=l[G.charAt(Te++)]),ie+=Ie===64?d(Z>>16&255):st===64?d(Z>>16&255,Z>>8&255):d(Z>>16&255,Z>>8&255,Z&255);return ie},k=r?function(G){return atob(m(G))}:o?function(G){return Buffer.from(G,"base64").toString("binary")}:D,F=o?function(G){return f(Buffer.from(G,"base64"))}:function(G){return f(k(G),function(Z){return Z.charCodeAt(0)})},B=function(G){return F(W(G))},q=o?function(G){return Buffer.from(G,"base64").toString("utf8")}:i?function(G){return i.decode(F(G))}:function(G){return j(k(G))},W=function(G){return m(G.replace(/[-_]/g,function(Z){return Z=="-"?"+":"/"}))},H=function(G){return q(W(G))},L=function(G){if(typeof G!="string")return!1;var Z=G.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(Z)||!/[^\s0-9a-zA-Z\-_]/.test(Z)},z=function(G){return{value:G,enumerable:!1,writable:!0,configurable:!0}},K=function(){var G=function(Z,ie){return Object.defineProperty(String.prototype,Z,z(ie))};G("fromBase64",function(){return H(this)}),G("toBase64",function(Z){return P(this,Z)}),G("toBase64URI",function(){return P(this,!0)}),G("toBase64URL",function(){return P(this,!0)}),G("toUint8Array",function(){return B(this)})},J=function(){var G=function(Z,ie){return Object.defineProperty(Uint8Array.prototype,Z,z(ie))};G("toBase64",function(Z){return _(this,Z)}),G("toBase64URI",function(){return _(this,!0)}),G("toBase64URL",function(){return _(this,!0)})},ee=function(){K(),J()},Pe={version:t,VERSION:e,atob:k,atobPolyfill:D,btoa:b,btoaPolyfill:h,fromBase64:H,toBase64:P,encode:P,encodeURI:A,encodeURL:A,utob:C,btou:j,decode:H,isValid:L,fromUint8Array:_,toUint8Array:B,extendString:K,extendUint8Array:J,extendBuiltins:ee};return Pe.Base64={},Object.keys(Pe).forEach(function(G){return Pe.Base64[G]=Pe[G]}),Pe})});var _gt=v(RX=>{"use strict";Object.defineProperty(RX,"__esModule",{value:!0});RX.BasicAuth=void 0;var bgt=ygt(),__r=/^Basic /i;RX.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${bgt.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(__r,""),r=bgt.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 vgt=v(jX=>{"use strict";Object.defineProperty(jX,"__esModule",{value:!0});jX.BearerToken=void 0;var v_r=/^Bearer /i;jX.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(v_r,"").trim()}});var wgt=v(mk=>{"use strict";Object.defineProperty(mk,"__esModule",{value:!0});mk.BearerToken=mk.BasicAuth=void 0;var w_r=_gt();Object.defineProperty(mk,"BasicAuth",{enumerable:!0,get:function(){return w_r.BasicAuth}});var S_r=vgt();Object.defineProperty(mk,"BearerToken",{enumerable:!0,get:function(){return S_r.BearerToken}})});var q0e=v(lp=>{"use strict";var Sgt=lp&&lp.__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())})},xgt=lp&&lp.__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)}},Qg=lp&&lp.__await||function(t){return this instanceof Qg?(this.v=t,this):new Qg(t)},Cgt=lp&&lp.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof Qg?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(lp,"__esModule",{value:!0});lp.readableStreamAsyncIterable=lp.Stream=void 0;var x_r=ok(),C_r="data:",B0e=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=C_r,this.messageTerminator=`
`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return Cgt(this,arguments,function*(){var r,n;this.controller.signal;let o=Ogt(this.stream),i="",a=!1;try{for(var s=xgt(o),u;u=yield Qg(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 Qg(void 0);let f=yield Qg(this.parse(JSON.parse(d)));yield yield Qg(f),a=!1}}}catch(l){r={error:l}}finally{try{u&&!u.done&&(n=s.return)&&(yield Qg(n.call(s)))}finally{if(r)throw r.error}}})}[Symbol.asyncIterator](){return Cgt(this,arguments,function*(){var r,n;try{for(var o=xgt(this.iterMessages()),i;i=yield Qg(o.next()),!i.done;){let a=i.value;yield yield Qg(a)}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&(yield Qg(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 x_r.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};lp.Stream=B0e;function Ogt(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return Sgt(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 Sgt(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}lp.readableStreamAsyncIterable=Ogt});var Pgt=v(DX=>{"use strict";Object.defineProperty(DX,"__esModule",{value:!0});DX.Stream=void 0;var O_r=q0e();Object.defineProperty(DX,"Stream",{enumerable:!0,get:function(){return O_r.Stream}})});var Agt=v((Llo,Tgt)=>{"use strict";var U0e=Object.defineProperty,P_r=Object.getOwnPropertyDescriptor,E_r=Object.getOwnPropertyNames,T_r=Object.prototype.hasOwnProperty,A_r=(t,e)=>{for(var r in e)U0e(t,r,{get:e[r],enumerable:!0})},I_r=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of E_r(e))!T_r.call(t,o)&&o!==r&&U0e(t,o,{get:()=>e[o],enumerable:!(n=P_r(e,o))||n.enumerable});return t},M_r=t=>I_r(U0e({},"__esModule",{value:!0}),t),Egt={};A_r(Egt,{Blob:()=>D_r,File:()=>N_r,FormData:()=>j_r});Tgt.exports=M_r(Egt);var R_r=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:j_r,Blob:D_r,File:N_r}=R_r});var Ugt=v((Flo,qgt)=>{"use strict";var V0e=Object.defineProperty,L_r=Object.getOwnPropertyDescriptor,F_r=Object.getOwnPropertyNames,k_r=Object.prototype.hasOwnProperty,$_r=(t,e)=>{for(var r in e)V0e(t,r,{get:e[r],enumerable:!0})},B_r=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of F_r(e))!k_r.call(t,o)&&o!==r&&V0e(t,o,{get:()=>e[o],enumerable:!(n=L_r(e,o))||n.enumerable});return t},q_r=t=>B_r(V0e({},"__esModule",{value:!0}),t),W0e=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},ts=(t,e,r)=>(W0e(t,e,"read from private field"),r?r.call(t):e.get(t)),s_=(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)},C3=(t,e,r,n)=>(W0e(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),z0e=(t,e,r)=>(W0e(t,e,"access private method"),r),Lgt={};$_r(Lgt,{FormDataEncoder:()=>G_r,isFile:()=>s1,isFormData:()=>$gt});qgt.exports=q_r(Lgt);var DC=t=>typeof t=="function",U_r=t=>DC(t[Symbol.asyncIterator]),Igt=65536;function*Fgt(t){if(t.byteLength<=Igt){yield t;return}let e=0;for(;e<t.byteLength;){let r=Math.min(t.byteLength-e,Igt),n=t.buffer.slice(e,e+r);e+=n.byteLength,yield new Uint8Array(n)}}async function*z_r(t){let e=t.getReader();for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}async function*Mgt(t){for await(let e of t)yield*Fgt(e)}var H_r=t=>{if(U_r(t))return Mgt(t);if(DC(t.getReader))return Mgt(z_r(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},Rgt="abcdefghijklmnopqrstuvwxyz0123456789";function V_r(){let t=16,e="";for(;t--;)e+=Rgt[Math.random()*Rgt.length<<0];return e}var kgt=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==`
`||e===`
`&&n[r-1]!=="\r"?`\r
`:e),W_r=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function jgt(t){if(W_r(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function Dgt(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var K_r=t=>new Proxy(t,{get:(e,r)=>Dgt(e,r),has:(e,r)=>Dgt(e,r)!==void 0}),$gt=t=>!!(t&&DC(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&DC(t.append)&&DC(t.getAll)&&DC(t.entries)&&DC(t[Symbol.iterator])),Ngt=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),s1=t=>!!(t&&typeof t=="object"&&DC(t.constructor)&&t[Symbol.toStringTag]==="File"&&DC(t.stream)&&t.name!=null),J_r={enableAdditionalHeaders:!1},NX={writable:!1,configurable:!1},yT,O3,LX,P3,a1,E3,T3,FX,kX,K0e,H0e,Bgt,G_r=class{constructor(t,e,r){if(s_(this,kX),s_(this,H0e),s_(this,yT,`\r
`),s_(this,O3,void 0),s_(this,LX,void 0),s_(this,P3,"-".repeat(2)),s_(this,a1,new TextEncoder),s_(this,E3,void 0),s_(this,T3,void 0),s_(this,FX,void 0),!$gt(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(jgt(e)?r=e:n=e,n||(n=V_r()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!jgt(r))throw new TypeError("Expected options argument to be an object.");C3(this,T3,Array.from(t.entries())),C3(this,FX,{...J_r,...r}),C3(this,O3,ts(this,a1).encode(ts(this,yT))),C3(this,LX,ts(this,O3).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,C3(this,E3,ts(this,a1).encode(`${ts(this,P3)}${this.boundary}${ts(this,P3)}${ts(this,yT).repeat(2)}`));let o={"Content-Type":this.contentType},i=z0e(this,H0e,Bgt).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=K_r(Object.freeze(o)),Object.defineProperties(this,{boundary:NX,contentType:NX,contentLength:NX,headers:NX})}*values(){for(let[t,e]of ts(this,T3)){let r=s1(e)?e:ts(this,a1).encode(kgt(e));yield z0e(this,kX,K0e).call(this,t,r),yield r,yield ts(this,O3)}yield ts(this,E3)}async*encode(){for(let t of this.values())s1(t)?yield*H_r(t.stream()):yield*Fgt(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};yT=new WeakMap;O3=new WeakMap;LX=new WeakMap;P3=new WeakMap;a1=new WeakMap;E3=new WeakMap;T3=new WeakMap;FX=new WeakMap;kX=new WeakSet;K0e=function(t,e){let r="";if(r+=`${ts(this,P3)}${this.boundary}${ts(this,yT)}`,r+=`Content-Disposition: form-data; name="${Ngt(t)}"`,s1(e)&&(r+=`; filename="${Ngt(e.name)}"${ts(this,yT)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),ts(this,FX).enableAdditionalHeaders===!0){let n=s1(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${ts(this,yT)}Content-Length: ${n}`)}return ts(this,a1).encode(`${r}${ts(this,yT).repeat(2)}`)};H0e=new WeakSet;Bgt=function(){let t=0;for(let[e,r]of ts(this,T3)){let n=s1(r)?r:ts(this,a1).encode(kgt(r)),o=s1(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=z0e(this,kX,K0e).call(this,e,n).byteLength,t+=o,t+=ts(this,LX)}return String(t+ts(this,E3).byteLength)}});var Hgt=v(($lo,zgt)=>{zgt.exports=typeof self=="object"?self.FormData:window.FormData});var Vgt=v($l=>{"use strict";var Y_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]}),Z_r=$l&&$l.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hk=$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)&&Y_r(e,t,r);return Z_r(e,t),e},bT=$l&&$l.__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($l,"__esModule",{value:!0});$l.WebFormData=$l.Node16FormData=$l.Node18FormData=$l.newFormData=void 0;var $X=ok();function J0e(t){return typeof t=="object"&&t!=null&&"name"in t}function X_r(){return bT(this,void 0,void 0,function*(){let t;return $X.RUNTIME.type==="node"&&$X.RUNTIME.parsedVersion!=null&&$X.RUNTIME.parsedVersion>=18?t=new BX:$X.RUNTIME.type==="node"?t=new qX:t=new UX,yield t.setup(),t})}$l.newFormData=X_r;var BX=class{setup(){return bT(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>hk(Agt()))).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 bT(this,void 0,void 0,function*(){n==null&&J0e(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>hk(f3()))).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 bT(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>hk(Ugt()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>hk(f3()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};$l.Node18FormData=BX;var qX=class{setup(){return bT(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>hk(Hgt()))).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 bT(this,void 0,void 0,function*(){n==null&&J0e(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>hk(f3()))).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():{}}}};$l.Node16FormData=qX;var UX=class{setup(){return bT(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 bT(this,void 0,void 0,function*(){n==null&&J0e(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};$l.WebFormData=UX});var Wgt=v(u1=>{"use strict";var Q_r=u1&&u1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),evr=u1&&u1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Q_r(e,t,r)};Object.defineProperty(u1,"__esModule",{value:!0});evr(Vgt(),u1)});var Ec=v(zX=>{"use strict";Object.defineProperty(zX,"__esModule",{value:!0});zX.SchemaType=void 0;zX.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 cp=v(HX=>{"use strict";Object.defineProperty(HX,"__esModule",{value:!0});HX.getErrorMessageForIncorrectType=void 0;function tvr(t,e){return`Expected ${e}. Received ${rvr(t)}.`}HX.getErrorMessageForIncorrectType=tvr;function rvr(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 NC=v(VX=>{"use strict";Object.defineProperty(VX,"__esModule",{value:!0});VX.maybeSkipValidation=void 0;function nvr(t){return Object.assign(Object.assign({},t),{json:Kgt(t.json),parse:Kgt(t.parse)})}VX.maybeSkipValidation=nvr;function Kgt(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 G0e=v(WX=>{"use strict";Object.defineProperty(WX,"__esModule",{value:!0});WX.stringifyValidationError=void 0;function ovr(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}WX.stringifyValidationError=ovr});var Z0e=v(KX=>{"use strict";Object.defineProperty(KX,"__esModule",{value:!0});KX.JsonError=void 0;var ivr=G0e(),Y0e=class t extends Error{constructor(e){super(e.map(ivr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};KX.JsonError=Y0e});var Q0e=v(JX=>{"use strict";Object.defineProperty(JX,"__esModule",{value:!0});JX.ParseError=void 0;var avr=G0e(),X0e=class t extends Error{constructor(e){super(e.map(avr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};JX.ParseError=X0e});var Ygt=v(_T=>{"use strict";Object.defineProperty(_T,"__esModule",{value:!0});_T.transform=_T.optional=_T.getSchemaUtils=void 0;var svr=Ec(),uvr=Z0e(),lvr=Q0e();function eSe(t){return{optional:()=>Jgt(t),transform:e=>Ggt(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new lvr.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new uvr.JsonError(n.errors)}}}_T.getSchemaUtils=eSe;function Jgt(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:()=>svr.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),eSe(e))}_T.optional=Jgt;function Ggt(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),eSe(r))}_T.transform=Ggt});var sm=v(Eh=>{"use strict";Object.defineProperty(Eh,"__esModule",{value:!0});Eh.ParseError=Eh.JsonError=Eh.transform=Eh.optional=Eh.getSchemaUtils=void 0;var tSe=Ygt();Object.defineProperty(Eh,"getSchemaUtils",{enumerable:!0,get:function(){return tSe.getSchemaUtils}});Object.defineProperty(Eh,"optional",{enumerable:!0,get:function(){return tSe.optional}});Object.defineProperty(Eh,"transform",{enumerable:!0,get:function(){return tSe.transform}});var cvr=Z0e();Object.defineProperty(Eh,"JsonError",{enumerable:!0,get:function(){return cvr.JsonError}});var dvr=Q0e();Object.defineProperty(Eh,"ParseError",{enumerable:!0,get:function(){return dvr.ParseError}})});var Zgt=v(GX=>{"use strict";Object.defineProperty(GX,"__esModule",{value:!0});GX.date=void 0;var fvr=Ec(),rSe=cp(),pvr=NC(),mvr=sm(),hvr=/^([+-]?\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 gvr(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,rSe.getErrorMessageForIncorrectType)(e,"string")}]}:hvr.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,rSe.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,rSe.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>fvr.SchemaType.DATE};return Object.assign(Object.assign({},(0,pvr.maybeSkipValidation)(t)),(0,mvr.getSchemaUtils)(t))}GX.date=gvr});var Xgt=v(YX=>{"use strict";Object.defineProperty(YX,"__esModule",{value:!0});YX.date=void 0;var yvr=Zgt();Object.defineProperty(YX,"date",{enumerable:!0,get:function(){return yvr.date}})});var LC=v(ZX=>{"use strict";Object.defineProperty(ZX,"__esModule",{value:!0});ZX.createIdentitySchemaCreator=void 0;var bvr=sm(),_vr=NC();function vvr(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,_vr.maybeSkipValidation)(r)),(0,bvr.getSchemaUtils)(r))}}ZX.createIdentitySchemaCreator=vvr});var eyt=v(XX=>{"use strict";Object.defineProperty(XX,"__esModule",{value:!0});XX.enum_=void 0;var wvr=Ec(),Svr=LC(),Qgt=cp();function xvr(t){let e=new Set(t);return(0,Svr.createIdentitySchemaCreator)(wvr.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,Qgt.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,Qgt.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}XX.enum_=xvr});var nSe=v(QX=>{"use strict";Object.defineProperty(QX,"__esModule",{value:!0});QX.enum_=void 0;var Cvr=eyt();Object.defineProperty(QX,"enum_",{enumerable:!0,get:function(){return Cvr.enum_}})});var oSe=v(vT=>{"use strict";Object.defineProperty(vT,"__esModule",{value:!0});vT.getMemoizedSchema=vT.constructLazyBaseSchema=vT.lazy=void 0;var Ovr=sm();function Pvr(t){let e=tyt(t);return Object.assign(Object.assign({},e),(0,Ovr.getSchemaUtils)(e))}vT.lazy=Pvr;function tyt(t){return{parse:(e,r)=>eQ(t).parse(e,r),json:(e,r)=>eQ(t).json(e,r),getType:()=>eQ(t).getType()}}vT.constructLazyBaseSchema=tyt;function eQ(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}vT.getMemoizedSchema=eQ});var iSe=v(tQ=>{"use strict";Object.defineProperty(tQ,"__esModule",{value:!0});tQ.entries=void 0;function Evr(t){return Object.entries(t)}tQ.entries=Evr});var aSe=v(rQ=>{"use strict";Object.defineProperty(rQ,"__esModule",{value:!0});rQ.filterObject=void 0;function Tvr(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}rQ.filterObject=Tvr});var A3=v(nQ=>{"use strict";Object.defineProperty(nQ,"__esModule",{value:!0});nQ.isPlainObject=void 0;function Avr(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}nQ.isPlainObject=Avr});var sSe=v(oQ=>{"use strict";Object.defineProperty(oQ,"__esModule",{value:!0});oQ.keys=void 0;function Ivr(t){return Object.keys(t)}oQ.keys=Ivr});var ryt=v(iQ=>{"use strict";Object.defineProperty(iQ,"__esModule",{value:!0});iQ.partition=void 0;function Mvr(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}iQ.partition=Mvr});var iyt=v(gk=>{"use strict";Object.defineProperty(gk,"__esModule",{value:!0});gk.withParsedProperties=gk.getObjectLikeUtils=void 0;var Rvr=aSe(),jvr=cp(),Dvr=A3(),Nvr=sm();function nyt(t){return{withParsedProperties:e=>oyt(t,e)}}gk.getObjectLikeUtils=nyt;function oyt(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,Dvr.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,jvr.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,Rvr.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,Nvr.getSchemaUtils)(r)),nyt(r))}gk.withParsedProperties=oyt});var I3=v(yk=>{"use strict";Object.defineProperty(yk,"__esModule",{value:!0});yk.withParsedProperties=yk.getObjectLikeUtils=void 0;var ayt=iyt();Object.defineProperty(yk,"getObjectLikeUtils",{enumerable:!0,get:function(){return ayt.getObjectLikeUtils}});Object.defineProperty(yk,"withParsedProperties",{enumerable:!0,get:function(){return ayt.withParsedProperties}})});var uSe=v(bk=>{"use strict";Object.defineProperty(bk,"__esModule",{value:!0});bk.isProperty=bk.property=void 0;function Lvr(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}bk.property=Lvr;function Fvr(t){return t.isProperty}bk.isProperty=Fvr});var cSe=v(_k=>{"use strict";Object.defineProperty(_k,"__esModule",{value:!0});_k.getObjectUtils=_k.object=void 0;var R3=Ec(),syt=iSe(),uyt=aSe(),kvr=cp(),$vr=A3(),fyt=sSe(),Bvr=NC(),qvr=ryt(),pyt=I3(),myt=sm(),M3=uSe();function Uvr(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,M3.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,fyt.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,syt.entries)(t)){let u=(0,M3.isProperty)(s)?s.rawKey:a,l=(0,M3.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,dyt(l)&&i.push(u)}return lyt({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,syt.entries)(t)){let s=(0,M3.isProperty)(a)?a.valueSchema:a;dyt(s)&&o.push(i)}return lyt({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,M3.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:()=>R3.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,Bvr.maybeSkipValidation)(e)),(0,myt.getSchemaUtils)(e)),(0,pyt.getObjectLikeUtils)(e)),lSe(e))}_k.object=Uvr;function lyt({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,$vr.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,kvr.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 lSe(t){return{extend:e=>{let r={_getParsedProperties:()=>[...t._getParsedProperties(),...e._getParsedProperties()],_getRawProperties:()=>[...t._getRawProperties(),...e._getRawProperties()],parse:(n,o)=>cyt({extensionKeys:e._getRawProperties(),value:n,transformBase:i=>t.parse(i,o),transformExtension:i=>e.parse(i,o)}),json:(n,o)=>cyt({extensionKeys:e._getParsedProperties(),value:n,transformBase:i=>t.json(i,o),transformExtension:i=>e.json(i,o)}),getType:()=>R3.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,myt.getSchemaUtils)(r)),(0,pyt.getObjectLikeUtils)(r)),lSe(r))}}}_k.getObjectUtils=lSe;function cyt({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,qvr.partition)((0,fyt.keys)(e),l=>o.has(l)),s=r((0,uyt.filterObject)(e,a)),u=n((0,uyt.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 dyt(t){return!zvr(t)}function zvr(t){switch(t.getType()){case R3.SchemaType.ANY:case R3.SchemaType.UNKNOWN:case R3.SchemaType.OPTIONAL:return!0;default:return!1}}});var hyt=v(aQ=>{"use strict";Object.defineProperty(aQ,"__esModule",{value:!0});aQ.objectWithoutOptionalProperties=void 0;var Hvr=cSe();function Vvr(t){return(0,Hvr.object)(t)}aQ.objectWithoutOptionalProperties=Vvr});var dSe=v(Th=>{"use strict";Object.defineProperty(Th,"__esModule",{value:!0});Th.property=Th.isProperty=Th.objectWithoutOptionalProperties=Th.object=Th.getObjectUtils=void 0;var gyt=cSe();Object.defineProperty(Th,"getObjectUtils",{enumerable:!0,get:function(){return gyt.getObjectUtils}});Object.defineProperty(Th,"object",{enumerable:!0,get:function(){return gyt.object}});var Wvr=hyt();Object.defineProperty(Th,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return Wvr.objectWithoutOptionalProperties}});var yyt=uSe();Object.defineProperty(Th,"isProperty",{enumerable:!0,get:function(){return yyt.isProperty}});Object.defineProperty(Th,"property",{enumerable:!0,get:function(){return yyt.property}})});var byt=v(sQ=>{"use strict";Object.defineProperty(sQ,"__esModule",{value:!0});sQ.lazyObject=void 0;var Kvr=dSe(),Jvr=I3(),Gvr=sm(),fSe=oSe();function Yvr(t){let e=Object.assign(Object.assign({},(0,fSe.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,fSe.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,fSe.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,Gvr.getSchemaUtils)(e)),(0,Jvr.getObjectLikeUtils)(e)),(0,Kvr.getObjectUtils)(e))}sQ.lazyObject=Yvr});var _yt=v(vk=>{"use strict";Object.defineProperty(vk,"__esModule",{value:!0});vk.lazyObject=vk.lazy=void 0;var Zvr=oSe();Object.defineProperty(vk,"lazy",{enumerable:!0,get:function(){return Zvr.lazy}});var Xvr=byt();Object.defineProperty(vk,"lazyObject",{enumerable:!0,get:function(){return Xvr.lazyObject}})});var wyt=v(uQ=>{"use strict";Object.defineProperty(uQ,"__esModule",{value:!0});uQ.list=void 0;var Qvr=Ec(),ewr=cp(),twr=NC(),rwr=sm();function nwr(t){let e={parse:(r,n)=>vyt(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)=>vyt(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:()=>Qvr.SchemaType.LIST};return Object.assign(Object.assign({},(0,twr.maybeSkipValidation)(e)),(0,rwr.getSchemaUtils)(e))}uQ.list=nwr;function vyt(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,ewr.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var pSe=v(lQ=>{"use strict";Object.defineProperty(lQ,"__esModule",{value:!0});lQ.list=void 0;var owr=wyt();Object.defineProperty(lQ,"list",{enumerable:!0,get:function(){return owr.list}})});var Syt=v(cQ=>{"use strict";Object.defineProperty(cQ,"__esModule",{value:!0});cQ.stringLiteral=void 0;var iwr=Ec(),awr=LC(),swr=cp();function uwr(t){return(0,awr.createIdentitySchemaCreator)(iwr.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,swr.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}cQ.stringLiteral=uwr});var xyt=v(dQ=>{"use strict";Object.defineProperty(dQ,"__esModule",{value:!0});dQ.booleanLiteral=void 0;var lwr=Ec(),cwr=LC(),dwr=cp();function fwr(t){return(0,cwr.createIdentitySchemaCreator)(lwr.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,dwr.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}dQ.booleanLiteral=fwr});var Cyt=v(wk=>{"use strict";Object.defineProperty(wk,"__esModule",{value:!0});wk.booleanLiteral=wk.stringLiteral=void 0;var pwr=Syt();Object.defineProperty(wk,"stringLiteral",{enumerable:!0,get:function(){return pwr.stringLiteral}});var mwr=xyt();Object.defineProperty(wk,"booleanLiteral",{enumerable:!0,get:function(){return mwr.booleanLiteral}})});var Oyt=v(fQ=>{"use strict";Object.defineProperty(fQ,"__esModule",{value:!0});fQ.any=void 0;var hwr=Ec(),gwr=LC();fQ.any=(0,gwr.createIdentitySchemaCreator)(hwr.SchemaType.ANY,t=>({ok:!0,value:t}))});var Pyt=v(pQ=>{"use strict";Object.defineProperty(pQ,"__esModule",{value:!0});pQ.boolean=void 0;var ywr=Ec(),bwr=LC(),_wr=cp();pQ.boolean=(0,bwr.createIdentitySchemaCreator)(ywr.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,_wr.getErrorMessageForIncorrectType)(t,"boolean")}]})});var Eyt=v(mQ=>{"use strict";Object.defineProperty(mQ,"__esModule",{value:!0});mQ.number=void 0;var vwr=Ec(),wwr=LC(),Swr=cp();mQ.number=(0,wwr.createIdentitySchemaCreator)(vwr.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,Swr.getErrorMessageForIncorrectType)(t,"number")}]})});var Tyt=v(hQ=>{"use strict";Object.defineProperty(hQ,"__esModule",{value:!0});hQ.string=void 0;var xwr=Ec(),Cwr=LC(),Owr=cp();hQ.string=(0,Cwr.createIdentitySchemaCreator)(xwr.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,Owr.getErrorMessageForIncorrectType)(t,"string")}]})});var Ayt=v(gQ=>{"use strict";Object.defineProperty(gQ,"__esModule",{value:!0});gQ.unknown=void 0;var Pwr=Ec(),Ewr=LC();gQ.unknown=(0,Ewr.createIdentitySchemaCreator)(Pwr.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var Iyt=v(Ah=>{"use strict";Object.defineProperty(Ah,"__esModule",{value:!0});Ah.unknown=Ah.string=Ah.number=Ah.boolean=Ah.any=void 0;var Twr=Oyt();Object.defineProperty(Ah,"any",{enumerable:!0,get:function(){return Twr.any}});var Awr=Pyt();Object.defineProperty(Ah,"boolean",{enumerable:!0,get:function(){return Awr.boolean}});var Iwr=Eyt();Object.defineProperty(Ah,"number",{enumerable:!0,get:function(){return Iwr.number}});var Mwr=Tyt();Object.defineProperty(Ah,"string",{enumerable:!0,get:function(){return Mwr.string}});var Rwr=Ayt();Object.defineProperty(Ah,"unknown",{enumerable:!0,get:function(){return Rwr.unknown}})});var Ryt=v(yQ=>{"use strict";Object.defineProperty(yQ,"__esModule",{value:!0});yQ.record=void 0;var mSe=Ec(),jwr=iSe(),Dwr=cp(),Nwr=A3(),Lwr=NC(),Fwr=sm();function kwr(t,e){let r={parse:(n,o)=>Myt({value:n,isKeyNumeric:t.getType()===mSe.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)=>Myt({value:n,isKeyNumeric:t.getType()===mSe.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:()=>mSe.SchemaType.RECORD};return Object.assign(Object.assign({},(0,Lwr.maybeSkipValidation)(r)),(0,Fwr.getSchemaUtils)(r))}yQ.record=kwr;function Myt({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,Nwr.isPlainObject)(t)?(0,jwr.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,Dwr.getErrorMessageForIncorrectType)(t,"object")}]}}});var jyt=v(bQ=>{"use strict";Object.defineProperty(bQ,"__esModule",{value:!0});bQ.record=void 0;var $wr=Ryt();Object.defineProperty(bQ,"record",{enumerable:!0,get:function(){return $wr.record}})});var Dyt=v(_Q=>{"use strict";Object.defineProperty(_Q,"__esModule",{value:!0});_Q.set=void 0;var Bwr=Ec(),qwr=cp(),Uwr=NC(),zwr=pSe(),Hwr=sm();function Vwr(t){let e=(0,zwr.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,qwr.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>Bwr.SchemaType.SET};return Object.assign(Object.assign({},(0,Uwr.maybeSkipValidation)(r)),(0,Hwr.getSchemaUtils)(r))}_Q.set=Vwr});var Nyt=v(vQ=>{"use strict";Object.defineProperty(vQ,"__esModule",{value:!0});vQ.set=void 0;var Wwr=Dyt();Object.defineProperty(vQ,"set",{enumerable:!0,get:function(){return Wwr.set}})});var Fyt=v(wQ=>{"use strict";Object.defineProperty(wQ,"__esModule",{value:!0});wQ.undiscriminatedUnion=void 0;var Kwr=Ec(),Jwr=NC(),Gwr=sm();function Ywr(t){let e={parse:(r,n)=>Lyt((o,i)=>o.parse(r,i),t,n),json:(r,n)=>Lyt((o,i)=>o.json(r,i),t,n),getType:()=>Kwr.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,Jwr.maybeSkipValidation)(e)),(0,Gwr.getSchemaUtils)(e))}wQ.undiscriminatedUnion=Ywr;function Lyt(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 kyt=v(SQ=>{"use strict";Object.defineProperty(SQ,"__esModule",{value:!0});SQ.undiscriminatedUnion=void 0;var Zwr=Fyt();Object.defineProperty(SQ,"undiscriminatedUnion",{enumerable:!0,get:function(){return Zwr.undiscriminatedUnion}})});var $yt=v(xQ=>{"use strict";Object.defineProperty(xQ,"__esModule",{value:!0});xQ.discriminant=void 0;function Xwr(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}xQ.discriminant=Xwr});var qyt=v(Sk=>{"use strict";var Qwr=Sk&&Sk.__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(Sk,"__esModule",{value:!0});Sk.union=void 0;var e0r=Ec(),t0r=cp(),r0r=A3(),n0r=sSe(),o0r=NC(),i0r=nSe(),a0r=I3(),s0r=sm();function u0r(t,e){let r=typeof t=="string"?t:t.rawDiscriminant,n=typeof t=="string"?t:t.parsedDiscriminant,o=(0,i0r.enum_)((0,n0r.keys)(e)),i={parse:(a,s)=>Byt({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)=>Byt({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:()=>e0r.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,o0r.maybeSkipValidation)(i)),(0,s0r.getSchemaUtils)(i)),(0,a0r.getObjectLikeUtils)(i))}Sk.union=u0r;function Byt({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,r0r.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,t0r.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=Qwr(u,[typeof l=="symbol"?l:l+""]);if(c==null)return{ok:!1,errors:[{path:s,message:`Missing discriminant ("${e}")`}]};let f=n(c);if(!f.ok)return{ok:!1,errors:f.errors};let p=o(f.value);if(p==null)return i?{ok:!0,value:Object.assign({[r]:f.value},d)}:{ok:!1,errors:[{path:[...s,e],message:"Unexpected discriminant value"}]};let m=a(d,p);return m.ok?{ok:!0,value:Object.assign({[r]:c},m.value)}:m}});var Uyt=v(xk=>{"use strict";Object.defineProperty(xk,"__esModule",{value:!0});xk.union=xk.discriminant=void 0;var l0r=$yt();Object.defineProperty(xk,"discriminant",{enumerable:!0,get:function(){return l0r.discriminant}});var c0r=qyt();Object.defineProperty(xk,"union",{enumerable:!0,get:function(){return c0r.union}})});var zyt=v(gl=>{"use strict";var d0r=gl&&gl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),um=gl&&gl.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&d0r(e,t,r)};Object.defineProperty(gl,"__esModule",{value:!0});um(Xgt(),gl);um(nSe(),gl);um(_yt(),gl);um(pSe(),gl);um(Cyt(),gl);um(dSe(),gl);um(I3(),gl);um(Iyt(),gl);um(jyt(),gl);um(sm(),gl);um(Nyt(),gl);um(kyt(),gl);um(Uyt(),gl)});var Hyt=v(l1=>{"use strict";var f0r=l1&&l1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p0r=l1&&l1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&f0r(e,t,r)};Object.defineProperty(l1,"__esModule",{value:!0});p0r(zyt(),l1)});var U=v(Tc=>{"use strict";var Vyt=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]}),m0r=Tc&&Tc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j3=Tc&&Tc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Vyt(e,t,r)},h0r=Tc&&Tc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vyt(e,t,r);return m0r(e,t),e};Object.defineProperty(Tc,"__esModule",{value:!0});Tc.serialization=void 0;j3(ggt(),Tc);j3(wgt(),Tc);j3(Pgt(),Tc);j3(ok(),Tc);j3(Wgt(),Tc);Tc.serialization=h0r(Hyt())});var Kyt=v(js=>{"use strict";var D3=js&&js.__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())})},N3=js&&js.__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)}},ga=js&&js.__await||function(t){return this instanceof ga?(this.v=t,this):new ga(t)},L3=js&&js.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof ga?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(js,"__esModule",{value:!0});js.readableStreamAsyncIterable=js._decodeChunks=js.LineDecoder=js._iterSSEMessages=js.StreamUtils=void 0;var Ck=ys(),hSe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return L3(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=N3(Wyt(e,r)),c;c=yield ga(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 Ck.CohereError({message:`Error: ${f.error}`});yield yield ga(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 Ck.CohereError({message:`Error: ${f.message}, ${f.error}`});yield yield ga({event:d.event,data:f})}}}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=l.return)&&(yield ga(s.call(l)))}finally{if(a)throw a.error}}u=!0}catch(d){if(d instanceof Error&&d.name==="AbortError")return yield ga(void 0);throw d}finally{u||r?.abort()}})}return new t(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return L3(this,arguments,function*(){var s,u;let l=new wT,c=ySe(e);try{for(var d=N3(c),f;f=yield ga(d.next()),!f.done;){let p=f.value;for(let m of l.decode(p))yield yield ga(m)}}catch(p){s={error:p}}finally{try{f&&!f.done&&(u=d.return)&&(yield ga(u.call(d)))}finally{if(s)throw s.error}}for(let p of l.flush())yield yield ga(p)})}function i(){return L3(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=N3(o()),d;d=yield ga(c.next()),!d.done;){let f=d.value;l||f&&(yield yield ga(JSON.parse(f)))}}catch(f){s={error:f}}finally{try{d&&!d.done&&(u=c.return)&&(yield ga(u.call(c)))}finally{if(s)throw s.error}}l=!0}catch(f){if(f instanceof Error&&f.name==="AbortError")return yield ga(void 0);throw f}finally{l||r?.abort()}})}return new t(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller),new t(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new ReadableStream({start(){return D3(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return D3(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 D3(this,void 0,void 0,function*(){yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};js.StreamUtils=hSe;function Wyt(t,e){return L3(this,arguments,function*(){var n,o;if(!t.body)throw e?.abort(),new Ck.CohereError({message:"Attempted to iterate over a response with no body"});let i=new gSe,a=new wT,s=ySe(t.body);try{for(var u=N3(g0r(s)),l;l=yield ga(u.next()),!l.done;){let c=l.value;for(let d of a.decode(c)){let f=i.decode(d);f&&(yield yield ga(f))}}}catch(c){n={error:c}}finally{try{l&&!l.done&&(o=u.return)&&(yield ga(o.call(u)))}finally{if(n)throw n.error}}for(let c of a.flush()){let d=i.decode(c);d&&(yield yield ga(d))}})}js._iterSSEMessages=Wyt;function g0r(t){return L3(this,arguments,function*(){var r,n;let o=new Uint8Array;try{for(var i=N3(t),a;a=yield ga(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=y0r(o))!==-1;)yield yield ga(o.slice(0,c)),o=o.slice(c)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&(yield ga(n.call(i)))}finally{if(r)throw r.error}}o.length>0&&(yield yield ga(o))})}function y0r(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 gSe=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]=_0r(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},wT=class t{constructor(){this.buffer=[],this.trailingCR=!1}decode(e){let r=this.decodeText(e);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=t.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(t.NEWLINE_REGEXP);return n&&o.pop(),o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(e){var r;if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new Ck.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 Ck.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new Ck.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}};js.LineDecoder=wT;wT.NEWLINE_CHARS=new Set([`
`,"\r"]);wT.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function b0r(t){let e=new wT,r=[];for(let n of t)r.push(...e.decode(n));return r}js._decodeChunks=b0r;function _0r(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function ySe(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return D3(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 D3(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}js.readableStreamAsyncIterable=ySe});var bSe=v(u_=>{"use strict";var v0r=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]}),w0r=u_&&u_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S0r=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)&&v0r(e,t,r);return w0r(e,t),e};Object.defineProperty(u_,"__esModule",{value:!0});u_.V2ChatStreamRequestCitationMode=void 0;var x0r=S0r(U());u_.V2ChatStreamRequestCitationMode=x0r.serialization.enum_(["FAST","ACCURATE","OFF"])});var _Se=v(l_=>{"use strict";var C0r=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]}),O0r=l_&&l_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P0r=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)&&C0r(e,t,r);return O0r(e,t),e};Object.defineProperty(l_,"__esModule",{value:!0});l_.V2ChatRequestCitationMode=void 0;var E0r=P0r(U());l_.V2ChatRequestCitationMode=E0r.serialization.enum_(["FAST","ACCURATE","OFF"])});var Ok=v(c_=>{"use strict";var T0r=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]}),A0r=c_&&c_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I0r=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)&&T0r(e,t,r);return A0r(e,t),e};Object.defineProperty(c_,"__esModule",{value:!0});c_.TextContent=void 0;var Jyt=I0r(U());c_.TextContent=Jyt.serialization.object({text:Jyt.serialization.string()})});var vSe=v(d_=>{"use strict";var M0r=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]}),R0r=d_&&d_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j0r=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)&&M0r(e,t,r);return R0r(e,t),e};Object.defineProperty(d_,"__esModule",{value:!0});d_.Content=void 0;var D0r=j0r(U()),N0r=Ok();d_.Content=D0r.serialization.union("type",{text:N0r.TextContent}).transform({transform:t=>t,untransform:t=>t})});var SSe=v(f_=>{"use strict";var L0r=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]}),F0r=f_&&f_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k0r=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)&&L0r(e,t,r);return F0r(e,t),e};Object.defineProperty(f_,"__esModule",{value:!0});f_.UserMessageContent=void 0;var wSe=k0r(U()),$0r=vSe();f_.UserMessageContent=wSe.serialization.undiscriminatedUnion([wSe.serialization.string(),wSe.serialization.list($0r.Content)])});var c1=v(p_=>{"use strict";var B0r=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]}),q0r=p_&&p_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U0r=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)&&B0r(e,t,r);return q0r(e,t),e};Object.defineProperty(p_,"__esModule",{value:!0});p_.ChatDocument=void 0;var xSe=U0r(U());p_.ChatDocument=xSe.serialization.record(xSe.serialization.string(),xSe.serialization.string())});var CSe=v(m_=>{"use strict";var z0r=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]}),H0r=m_&&m_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V0r=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)&&z0r(e,t,r);return H0r(e,t),e};Object.defineProperty(m_,"__esModule",{value:!0});m_.UserMessage=void 0;var Gyt=V0r(U()),W0r=SSe(),K0r=c1();m_.UserMessage=Gyt.serialization.object({content:W0r.UserMessageContent,documents:Gyt.serialization.list(K0r.ChatDocument).optional()})});var PSe=v(h_=>{"use strict";var J0r=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]}),G0r=h_&&h_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y0r=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)&&J0r(e,t,r);return G0r(e,t),e};Object.defineProperty(h_,"__esModule",{value:!0});h_.ToolCall2Function=void 0;var OSe=Y0r(U());h_.ToolCall2Function=OSe.serialization.object({name:OSe.serialization.string().optional(),arguments:OSe.serialization.string().optional()})});var CQ=v(g_=>{"use strict";var Z0r=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]}),X0r=g_&&g_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q0r=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)&&Z0r(e,t,r);return X0r(e,t),e};Object.defineProperty(g_,"__esModule",{value:!0});g_.ToolCall2=void 0;var ESe=Q0r(U()),eSr=PSe();g_.ToolCall2=ESe.serialization.object({id:ESe.serialization.string().optional(),type:ESe.serialization.stringLiteral("function").optional(),function:eSr.ToolCall2Function.optional()})});var TSe=v(y_=>{"use strict";var tSr=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]}),rSr=y_&&y_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nSr=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)&&tSr(e,t,r);return rSr(e,t),e};Object.defineProperty(y_,"__esModule",{value:!0});y_.ToolSource=void 0;var Pk=nSr(U());y_.ToolSource=Pk.serialization.object({id:Pk.serialization.string().optional(),toolOutput:Pk.serialization.property("tool_output",Pk.serialization.record(Pk.serialization.string(),Pk.serialization.unknown()).optional())})});var ASe=v(b_=>{"use strict";var oSr=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]}),iSr=b_&&b_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aSr=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)&&oSr(e,t,r);return iSr(e,t),e};Object.defineProperty(b_,"__esModule",{value:!0});b_.DocumentSource=void 0;var F3=aSr(U());b_.DocumentSource=F3.serialization.object({id:F3.serialization.string().optional(),document:F3.serialization.record(F3.serialization.string(),F3.serialization.unknown()).optional()})});var ISe=v(__=>{"use strict";var sSr=__&&__.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uSr=__&&__.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lSr=__&&__.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sSr(e,t,r);return uSr(e,t),e};Object.defineProperty(__,"__esModule",{value:!0});__.Source=void 0;var cSr=lSr(U()),dSr=TSe(),fSr=ASe();__.Source=cSr.serialization.union("type",{tool:dSr.ToolSource,document:fSr.DocumentSource}).transform({transform:t=>t,untransform:t=>t})});var $3=v(v_=>{"use strict";var pSr=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]}),mSr=v_&&v_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hSr=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)&&pSr(e,t,r);return mSr(e,t),e};Object.defineProperty(v_,"__esModule",{value:!0});v_.Citation=void 0;var k3=hSr(U()),gSr=ISe();v_.Citation=k3.serialization.object({start:k3.serialization.number().optional(),end:k3.serialization.number().optional(),text:k3.serialization.string().optional(),sources:k3.serialization.list(gSr.Source).optional()})});var MSe=v(w_=>{"use strict";var ySr=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]}),bSr=w_&&w_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Sr=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)&&ySr(e,t,r);return bSr(e,t),e};Object.defineProperty(w_,"__esModule",{value:!0});w_.AssistantMessageContentItem=void 0;var vSr=_Sr(U()),wSr=Ok();w_.AssistantMessageContentItem=vSr.serialization.union("type",{text:wSr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var jSe=v(S_=>{"use strict";var SSr=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]}),xSr=S_&&S_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CSr=S_&&S_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SSr(e,t,r);return xSr(e,t),e};Object.defineProperty(S_,"__esModule",{value:!0});S_.AssistantMessageContent=void 0;var RSe=CSr(U()),OSr=MSe();S_.AssistantMessageContent=RSe.serialization.undiscriminatedUnion([RSe.serialization.string(),RSe.serialization.list(OSr.AssistantMessageContentItem)])});var DSe=v(x_=>{"use strict";var PSr=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]}),ESr=x_&&x_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TSr=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)&&PSr(e,t,r);return ESr(e,t),e};Object.defineProperty(x_,"__esModule",{value:!0});x_.AssistantMessage=void 0;var Ek=TSr(U()),ASr=CQ(),ISr=jSe(),MSr=$3();x_.AssistantMessage=Ek.serialization.object({toolCalls:Ek.serialization.property("tool_calls",Ek.serialization.list(ASr.ToolCall2).optional()),toolPlan:Ek.serialization.property("tool_plan",Ek.serialization.string().optional()),content:ISr.AssistantMessageContent.optional(),citations:Ek.serialization.list(MSr.Citation).optional()})});var NSe=v(C_=>{"use strict";var RSr=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]}),jSr=C_&&C_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DSr=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)&&RSr(e,t,r);return jSr(e,t),e};Object.defineProperty(C_,"__esModule",{value:!0});C_.SystemMessageContentItem=void 0;var NSr=DSr(U()),LSr=Ok();C_.SystemMessageContentItem=NSr.serialization.union("type",{text:LSr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var FSe=v(O_=>{"use strict";var FSr=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]}),kSr=O_&&O_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Sr=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)&&FSr(e,t,r);return kSr(e,t),e};Object.defineProperty(O_,"__esModule",{value:!0});O_.SystemMessageContent=void 0;var LSe=$Sr(U()),BSr=NSe();O_.SystemMessageContent=LSe.serialization.undiscriminatedUnion([LSe.serialization.string(),LSe.serialization.list(BSr.SystemMessageContentItem)])});var kSe=v(P_=>{"use strict";var qSr=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]}),USr=P_&&P_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zSr=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)&&qSr(e,t,r);return USr(e,t),e};Object.defineProperty(P_,"__esModule",{value:!0});P_.SystemMessage=void 0;var HSr=zSr(U()),VSr=FSe();P_.SystemMessage=HSr.serialization.object({content:VSr.SystemMessageContent})});var $Se=v(E_=>{"use strict";var WSr=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]}),KSr=E_&&E_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JSr=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)&&WSr(e,t,r);return KSr(e,t),e};Object.defineProperty(E_,"__esModule",{value:!0});E_.ToolContent=void 0;var OQ=JSr(U());E_.ToolContent=OQ.serialization.object({output:OQ.serialization.record(OQ.serialization.string(),OQ.serialization.unknown())})});var BSe=v(T_=>{"use strict";var GSr=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]}),YSr=T_&&T_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZSr=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)&&GSr(e,t,r);return YSr(e,t),e};Object.defineProperty(T_,"__esModule",{value:!0});T_.ToolMessage2ToolContentItem=void 0;var XSr=ZSr(U()),QSr=$Se();T_.ToolMessage2ToolContentItem=XSr.serialization.union("type",{tool_result_object:QSr.ToolContent}).transform({transform:t=>t,untransform:t=>t})});var qSe=v(A_=>{"use strict";var exr=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]}),txr=A_&&A_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rxr=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)&&exr(e,t,r);return txr(e,t),e};Object.defineProperty(A_,"__esModule",{value:!0});A_.ToolMessage2=void 0;var B3=rxr(U()),nxr=BSe();A_.ToolMessage2=B3.serialization.object({toolCallId:B3.serialization.property("tool_call_id",B3.serialization.string()),toolContent:B3.serialization.property("tool_content",B3.serialization.list(nxr.ToolMessage2ToolContentItem))})});var USe=v(I_=>{"use strict";var oxr=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]}),ixr=I_&&I_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),axr=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)&&oxr(e,t,r);return ixr(e,t),e};Object.defineProperty(I_,"__esModule",{value:!0});I_.ChatMessage2=void 0;var sxr=axr(U()),uxr=CSe(),lxr=DSe(),cxr=kSe(),dxr=qSe();I_.ChatMessage2=sxr.serialization.union("role",{user:uxr.UserMessage,assistant:lxr.AssistantMessage,system:cxr.SystemMessage,tool:dxr.ToolMessage2}).transform({transform:t=>t,untransform:t=>t})});var PQ=v(M_=>{"use strict";var fxr=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]}),pxr=M_&&M_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mxr=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)&&fxr(e,t,r);return pxr(e,t),e};Object.defineProperty(M_,"__esModule",{value:!0});M_.ChatMessages=void 0;var hxr=mxr(U()),gxr=USe();M_.ChatMessages=hxr.serialization.list(gxr.ChatMessage2)});var zSe=v(R_=>{"use strict";var yxr=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]}),bxr=R_&&R_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_xr=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)&&yxr(e,t,r);return bxr(e,t),e};Object.defineProperty(R_,"__esModule",{value:!0});R_.Tool2Function=void 0;var Tk=_xr(U());R_.Tool2Function=Tk.serialization.object({name:Tk.serialization.string().optional(),description:Tk.serialization.string().optional(),parameters:Tk.serialization.record(Tk.serialization.string(),Tk.serialization.unknown()).optional()})});var EQ=v(j_=>{"use strict";var vxr=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]}),wxr=j_&&j_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sxr=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)&&vxr(e,t,r);return wxr(e,t),e};Object.defineProperty(j_,"__esModule",{value:!0});j_.Tool2=void 0;var Yyt=Sxr(U()),xxr=zSe();j_.Tool2=Yyt.serialization.object({type:Yyt.serialization.stringLiteral("function").optional(),function:xxr.Tool2Function.optional()})});var TQ=v(D_=>{"use strict";var Cxr=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]}),Oxr=D_&&D_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pxr=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)&&Cxr(e,t,r);return Oxr(e,t),e};Object.defineProperty(D_,"__esModule",{value:!0});D_.ChatFinishReason=void 0;var Exr=Pxr(U());D_.ChatFinishReason=Exr.serialization.enum_(["complete","stop_sequence","max_tokens","tool_call","error","content_blocked","error_limit"])});var HSe=v(N_=>{"use strict";var Txr=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]}),Axr=N_&&N_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ixr=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)&&Txr(e,t,r);return Axr(e,t),e};Object.defineProperty(N_,"__esModule",{value:!0});N_.AssistantMessageResponseContentItem=void 0;var Mxr=Ixr(U()),Rxr=Ok();N_.AssistantMessageResponseContentItem=Mxr.serialization.union("type",{text:Rxr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var VSe=v(L_=>{"use strict";var jxr=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]}),Dxr=L_&&L_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nxr=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)&&jxr(e,t,r);return Dxr(e,t),e};Object.defineProperty(L_,"__esModule",{value:!0});L_.AssistantMessageResponse=void 0;var ST=Nxr(U()),Lxr=CQ(),Fxr=HSe(),kxr=$3();L_.AssistantMessageResponse=ST.serialization.object({role:ST.serialization.stringLiteral("assistant"),toolCalls:ST.serialization.property("tool_calls",ST.serialization.list(Lxr.ToolCall2).optional()),toolPlan:ST.serialization.property("tool_plan",ST.serialization.string().optional()),content:ST.serialization.list(Fxr.AssistantMessageResponseContentItem).optional(),citations:ST.serialization.list(kxr.Citation).optional()})});var WSe=v(F_=>{"use strict";var $xr=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]}),Bxr=F_&&F_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qxr=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)&&$xr(e,t,r);return Bxr(e,t),e};Object.defineProperty(F_,"__esModule",{value:!0});F_.UsageBilledUnits=void 0;var xT=qxr(U());F_.UsageBilledUnits=xT.serialization.object({inputTokens:xT.serialization.property("input_tokens",xT.serialization.number().optional()),outputTokens:xT.serialization.property("output_tokens",xT.serialization.number().optional()),searchUnits:xT.serialization.property("search_units",xT.serialization.number().optional()),classifications:xT.serialization.number().optional()})});var KSe=v(k_=>{"use strict";var Uxr=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]}),zxr=k_&&k_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hxr=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)&&Uxr(e,t,r);return zxr(e,t),e};Object.defineProperty(k_,"__esModule",{value:!0});k_.UsageTokens=void 0;var q3=Hxr(U());k_.UsageTokens=q3.serialization.object({inputTokens:q3.serialization.property("input_tokens",q3.serialization.number().optional()),outputTokens:q3.serialization.property("output_tokens",q3.serialization.number().optional())})});var AQ=v($_=>{"use strict";var Vxr=$_&&$_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wxr=$_&&$_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kxr=$_&&$_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vxr(e,t,r);return Wxr(e,t),e};Object.defineProperty($_,"__esModule",{value:!0});$_.Usage=void 0;var Zyt=Kxr(U()),Jxr=WSe(),Gxr=KSe();$_.Usage=Zyt.serialization.object({billedUnits:Zyt.serialization.property("billed_units",Jxr.UsageBilledUnits.optional()),tokens:Gxr.UsageTokens.optional()})});var Xyt=v(B_=>{"use strict";var Yxr=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]}),Zxr=B_&&B_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xxr=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)&&Yxr(e,t,r);return Zxr(e,t),e};Object.defineProperty(B_,"__esModule",{value:!0});B_.NonStreamedChatResponse2=void 0;var IQ=Xxr(U()),Qxr=TQ(),eCr=VSe(),tCr=AQ();B_.NonStreamedChatResponse2=IQ.serialization.object({id:IQ.serialization.string(),finishReason:IQ.serialization.property("finish_reason",Qxr.ChatFinishReason),prompt:IQ.serialization.string().optional(),message:eCr.AssistantMessageResponse.optional(),usage:tCr.Usage.optional()})});var lm=v(q_=>{"use strict";var rCr=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]}),nCr=q_&&q_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oCr=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)&&rCr(e,t,r);return nCr(e,t),e};Object.defineProperty(q_,"__esModule",{value:!0});q_.ChatStreamEventType=void 0;var iCr=oCr(U());q_.ChatStreamEventType=iCr.serialization.object({})});var JSe=v(U_=>{"use strict";var aCr=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]}),sCr=U_&&U_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uCr=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)&&aCr(e,t,r);return sCr(e,t),e};Object.defineProperty(U_,"__esModule",{value:!0});U_.ChatMessageStartEventDeltaMessage=void 0;var Qyt=uCr(U());U_.ChatMessageStartEventDeltaMessage=Qyt.serialization.object({role:Qyt.serialization.stringLiteral("assistant").optional()})});var GSe=v(z_=>{"use strict";var lCr=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]}),cCr=z_&&z_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dCr=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)&&lCr(e,t,r);return cCr(e,t),e};Object.defineProperty(z_,"__esModule",{value:!0});z_.ChatMessageStartEventDelta=void 0;var fCr=dCr(U()),pCr=JSe();z_.ChatMessageStartEventDelta=fCr.serialization.object({message:pCr.ChatMessageStartEventDeltaMessage.optional()})});var YSe=v(H_=>{"use strict";var mCr=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]}),hCr=H_&&H_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gCr=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)&&mCr(e,t,r);return hCr(e,t),e};Object.defineProperty(H_,"__esModule",{value:!0});H_.ChatMessageStartEvent=void 0;var ebt=gCr(U()),yCr=GSe(),bCr=lm();H_.ChatMessageStartEvent=ebt.serialization.object({id:ebt.serialization.string().optional(),delta:yCr.ChatMessageStartEventDelta.optional()}).extend(bCr.ChatStreamEventType)});var XSe=v(V_=>{"use strict";var _Cr=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]}),vCr=V_&&V_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wCr=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)&&_Cr(e,t,r);return vCr(e,t),e};Object.defineProperty(V_,"__esModule",{value:!0});V_.ChatContentStartEventDeltaMessageContent=void 0;var ZSe=wCr(U());V_.ChatContentStartEventDeltaMessageContent=ZSe.serialization.object({text:ZSe.serialization.string().optional(),type:ZSe.serialization.stringLiteral("text").optional()})});var QSe=v(W_=>{"use strict";var SCr=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]}),xCr=W_&&W_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CCr=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)&&SCr(e,t,r);return xCr(e,t),e};Object.defineProperty(W_,"__esModule",{value:!0});W_.ChatContentStartEventDeltaMessage=void 0;var OCr=CCr(U()),PCr=XSe();W_.ChatContentStartEventDeltaMessage=OCr.serialization.object({content:PCr.ChatContentStartEventDeltaMessageContent.optional()})});var exe=v(K_=>{"use strict";var ECr=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]}),TCr=K_&&K_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ACr=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)&&ECr(e,t,r);return TCr(e,t),e};Object.defineProperty(K_,"__esModule",{value:!0});K_.ChatContentStartEventDelta=void 0;var ICr=ACr(U()),MCr=QSe();K_.ChatContentStartEventDelta=ICr.serialization.object({message:MCr.ChatContentStartEventDeltaMessage.optional()})});var txe=v(J_=>{"use strict";var RCr=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]}),jCr=J_&&J_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DCr=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)&&RCr(e,t,r);return jCr(e,t),e};Object.defineProperty(J_,"__esModule",{value:!0});J_.ChatContentStartEvent=void 0;var tbt=DCr(U()),NCr=exe(),LCr=lm();J_.ChatContentStartEvent=tbt.serialization.object({index:tbt.serialization.number().optional(),delta:NCr.ChatContentStartEventDelta.optional()}).extend(LCr.ChatStreamEventType)});var rxe=v(G_=>{"use strict";var FCr=G_&&G_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kCr=G_&&G_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Cr=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)&&FCr(e,t,r);return kCr(e,t),e};Object.defineProperty(G_,"__esModule",{value:!0});G_.ChatContentDeltaEventDeltaMessageContent=void 0;var rbt=$Cr(U());G_.ChatContentDeltaEventDeltaMessageContent=rbt.serialization.object({text:rbt.serialization.string().optional()})});var nxe=v(Y_=>{"use strict";var BCr=Y_&&Y_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qCr=Y_&&Y_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UCr=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)&&BCr(e,t,r);return qCr(e,t),e};Object.defineProperty(Y_,"__esModule",{value:!0});Y_.ChatContentDeltaEventDeltaMessage=void 0;var zCr=UCr(U()),HCr=rxe();Y_.ChatContentDeltaEventDeltaMessage=zCr.serialization.object({content:HCr.ChatContentDeltaEventDeltaMessageContent.optional()})});var oxe=v(Z_=>{"use strict";var VCr=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]}),WCr=Z_&&Z_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KCr=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)&&VCr(e,t,r);return WCr(e,t),e};Object.defineProperty(Z_,"__esModule",{value:!0});Z_.ChatContentDeltaEventDelta=void 0;var JCr=KCr(U()),GCr=nxe();Z_.ChatContentDeltaEventDelta=JCr.serialization.object({message:GCr.ChatContentDeltaEventDeltaMessage.optional()})});var ixe=v(X_=>{"use strict";var YCr=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]}),ZCr=X_&&X_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XCr=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)&&YCr(e,t,r);return ZCr(e,t),e};Object.defineProperty(X_,"__esModule",{value:!0});X_.ChatContentDeltaEvent=void 0;var nbt=XCr(U()),QCr=oxe(),eOr=lm();X_.ChatContentDeltaEvent=nbt.serialization.object({index:nbt.serialization.number().optional(),delta:QCr.ChatContentDeltaEventDelta.optional()}).extend(eOr.ChatStreamEventType)});var axe=v(Q_=>{"use strict";var tOr=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]}),rOr=Q_&&Q_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nOr=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)&&tOr(e,t,r);return rOr(e,t),e};Object.defineProperty(Q_,"__esModule",{value:!0});Q_.ChatContentEndEvent=void 0;var obt=nOr(U()),oOr=lm();Q_.ChatContentEndEvent=obt.serialization.object({index:obt.serialization.number().optional()}).extend(oOr.ChatStreamEventType)});var uxe=v(ev=>{"use strict";var iOr=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]}),aOr=ev&&ev.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sOr=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)&&iOr(e,t,r);return aOr(e,t),e};Object.defineProperty(ev,"__esModule",{value:!0});ev.ChatToolPlanDeltaEventDelta=void 0;var sxe=sOr(U());ev.ChatToolPlanDeltaEventDelta=sxe.serialization.object({toolPlan:sxe.serialization.property("tool_plan",sxe.serialization.string().optional())})});var lxe=v(tv=>{"use strict";var uOr=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]}),lOr=tv&&tv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cOr=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)&&uOr(e,t,r);return lOr(e,t),e};Object.defineProperty(tv,"__esModule",{value:!0});tv.ChatToolPlanDeltaEvent=void 0;var dOr=cOr(U()),fOr=uxe(),pOr=lm();tv.ChatToolPlanDeltaEvent=dOr.serialization.object({delta:fOr.ChatToolPlanDeltaEventDelta.optional()}).extend(pOr.ChatStreamEventType)});var dxe=v(rv=>{"use strict";var mOr=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]}),hOr=rv&&rv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gOr=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)&&mOr(e,t,r);return hOr(e,t),e};Object.defineProperty(rv,"__esModule",{value:!0});rv.ChatToolCallStartEventDeltaToolCallFunction=void 0;var cxe=gOr(U());rv.ChatToolCallStartEventDeltaToolCallFunction=cxe.serialization.object({name:cxe.serialization.string().optional(),arguments:cxe.serialization.string().optional()})});var pxe=v(nv=>{"use strict";var yOr=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]}),bOr=nv&&nv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Or=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)&&yOr(e,t,r);return bOr(e,t),e};Object.defineProperty(nv,"__esModule",{value:!0});nv.ChatToolCallStartEventDeltaToolCall=void 0;var fxe=_Or(U()),vOr=dxe();nv.ChatToolCallStartEventDeltaToolCall=fxe.serialization.object({id:fxe.serialization.string().optional(),type:fxe.serialization.stringLiteral("function").optional(),function:vOr.ChatToolCallStartEventDeltaToolCallFunction.optional()})});var mxe=v(ov=>{"use strict";var wOr=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]}),SOr=ov&&ov.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xOr=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)&&wOr(e,t,r);return SOr(e,t),e};Object.defineProperty(ov,"__esModule",{value:!0});ov.ChatToolCallStartEventDelta=void 0;var ibt=xOr(U()),COr=pxe();ov.ChatToolCallStartEventDelta=ibt.serialization.object({toolCall:ibt.serialization.property("tool_call",COr.ChatToolCallStartEventDeltaToolCall.optional())})});var hxe=v(iv=>{"use strict";var OOr=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]}),POr=iv&&iv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EOr=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)&&OOr(e,t,r);return POr(e,t),e};Object.defineProperty(iv,"__esModule",{value:!0});iv.ChatToolCallStartEvent=void 0;var abt=EOr(U()),TOr=mxe(),AOr=lm();iv.ChatToolCallStartEvent=abt.serialization.object({index:abt.serialization.number().optional(),delta:TOr.ChatToolCallStartEventDelta.optional()}).extend(AOr.ChatStreamEventType)});var gxe=v(av=>{"use strict";var IOr=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]}),MOr=av&&av.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ROr=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)&&IOr(e,t,r);return MOr(e,t),e};Object.defineProperty(av,"__esModule",{value:!0});av.ChatToolCallDeltaEventDeltaToolCallFunction=void 0;var sbt=ROr(U());av.ChatToolCallDeltaEventDeltaToolCallFunction=sbt.serialization.object({arguments:sbt.serialization.string().optional()})});var yxe=v(sv=>{"use strict";var jOr=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]}),DOr=sv&&sv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NOr=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)&&jOr(e,t,r);return DOr(e,t),e};Object.defineProperty(sv,"__esModule",{value:!0});sv.ChatToolCallDeltaEventDeltaToolCall=void 0;var LOr=NOr(U()),FOr=gxe();sv.ChatToolCallDeltaEventDeltaToolCall=LOr.serialization.object({function:FOr.ChatToolCallDeltaEventDeltaToolCallFunction.optional()})});var bxe=v(uv=>{"use strict";var kOr=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}),BOr=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)&&kOr(e,t,r);return $Or(e,t),e};Object.defineProperty(uv,"__esModule",{value:!0});uv.ChatToolCallDeltaEventDelta=void 0;var ubt=BOr(U()),qOr=yxe();uv.ChatToolCallDeltaEventDelta=ubt.serialization.object({toolCall:ubt.serialization.property("tool_call",qOr.ChatToolCallDeltaEventDeltaToolCall.optional())})});var _xe=v(lv=>{"use strict";var UOr=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]}),zOr=lv&&lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HOr=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)&&UOr(e,t,r);return zOr(e,t),e};Object.defineProperty(lv,"__esModule",{value:!0});lv.ChatToolCallDeltaEvent=void 0;var lbt=HOr(U()),VOr=bxe(),WOr=lm();lv.ChatToolCallDeltaEvent=lbt.serialization.object({index:lbt.serialization.number().optional(),delta:VOr.ChatToolCallDeltaEventDelta.optional()}).extend(WOr.ChatStreamEventType)});var vxe=v(cv=>{"use strict";var KOr=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]}),JOr=cv&&cv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GOr=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)&&KOr(e,t,r);return JOr(e,t),e};Object.defineProperty(cv,"__esModule",{value:!0});cv.ChatToolCallEndEvent=void 0;var cbt=GOr(U()),YOr=lm();cv.ChatToolCallEndEvent=cbt.serialization.object({index:cbt.serialization.number().optional()}).extend(YOr.ChatStreamEventType)});var wxe=v(dv=>{"use strict";var ZOr=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]}),XOr=dv&&dv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QOr=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)&&ZOr(e,t,r);return XOr(e,t),e};Object.defineProperty(dv,"__esModule",{value:!0});dv.ChatMessageEndEventDelta=void 0;var dbt=QOr(U()),ePr=TQ(),tPr=AQ();dv.ChatMessageEndEventDelta=dbt.serialization.object({finishReason:dbt.serialization.property("finish_reason",ePr.ChatFinishReason.optional()),usage:tPr.Usage.optional()})});var Sxe=v(fv=>{"use strict";var rPr=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]}),nPr=fv&&fv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oPr=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)&&rPr(e,t,r);return nPr(e,t),e};Object.defineProperty(fv,"__esModule",{value:!0});fv.ChatMessageEndEvent=void 0;var fbt=oPr(U()),iPr=wxe(),aPr=lm();fv.ChatMessageEndEvent=fbt.serialization.object({id:fbt.serialization.string().optional(),delta:iPr.ChatMessageEndEventDelta.optional()}).extend(aPr.ChatStreamEventType)});var xxe=v(pv=>{"use strict";var sPr=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]}),uPr=pv&&pv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lPr=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)&&sPr(e,t,r);return uPr(e,t),e};Object.defineProperty(pv,"__esModule",{value:!0});pv.CitationStartEventDeltaMessage=void 0;var cPr=lPr(U()),dPr=$3();pv.CitationStartEventDeltaMessage=cPr.serialization.object({citations:dPr.Citation.optional()})});var Cxe=v(mv=>{"use strict";var fPr=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]}),pPr=mv&&mv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mPr=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)&&fPr(e,t,r);return pPr(e,t),e};Object.defineProperty(mv,"__esModule",{value:!0});mv.CitationStartEventDelta=void 0;var hPr=mPr(U()),gPr=xxe();mv.CitationStartEventDelta=hPr.serialization.object({message:gPr.CitationStartEventDeltaMessage.optional()})});var Oxe=v(hv=>{"use strict";var yPr=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]}),bPr=hv&&hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Pr=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)&&yPr(e,t,r);return bPr(e,t),e};Object.defineProperty(hv,"__esModule",{value:!0});hv.CitationStartEvent=void 0;var pbt=_Pr(U()),vPr=Cxe(),wPr=lm();hv.CitationStartEvent=pbt.serialization.object({index:pbt.serialization.number().optional(),delta:vPr.CitationStartEventDelta.optional()}).extend(wPr.ChatStreamEventType)});var Pxe=v(gv=>{"use strict";var SPr=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]}),xPr=gv&&gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CPr=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)&&SPr(e,t,r);return xPr(e,t),e};Object.defineProperty(gv,"__esModule",{value:!0});gv.CitationEndEvent=void 0;var mbt=CPr(U()),OPr=lm();gv.CitationEndEvent=mbt.serialization.object({index:mbt.serialization.number().optional()}).extend(OPr.ChatStreamEventType)});var hbt=v(yv=>{"use strict";var PPr=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]}),EPr=yv&&yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TPr=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)&&PPr(e,t,r);return EPr(e,t),e};Object.defineProperty(yv,"__esModule",{value:!0});yv.StreamedChatResponse2=void 0;var APr=TPr(U()),IPr=YSe(),MPr=txe(),RPr=ixe(),jPr=axe(),DPr=lxe(),NPr=hxe(),LPr=_xe(),FPr=vxe(),kPr=Oxe(),$Pr=Pxe(),BPr=Sxe();yv.StreamedChatResponse2=APr.serialization.union("type",{"message-start":IPr.ChatMessageStartEvent,"content-start":MPr.ChatContentStartEvent,"content-delta":RPr.ChatContentDeltaEvent,"content-end":jPr.ChatContentEndEvent,"tool-plan-delta":DPr.ChatToolPlanDeltaEvent,"tool-call-start":NPr.ChatToolCallStartEvent,"tool-call-delta":LPr.ChatToolCallDeltaEvent,"tool-call-end":FPr.ChatToolCallEndEvent,"citation-start":kPr.CitationStartEvent,"citation-end":$Pr.CitationEndEvent,"message-end":BPr.ChatMessageEndEvent}).transform({transform:t=>t,untransform:t=>t})});var Exe=v(wt=>{"use strict";var qPr=wt&&wt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),It=wt&&wt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qPr(e,t,r)};Object.defineProperty(wt,"__esModule",{value:!0});It(bSe(),wt);It(_Se(),wt);It(Ok(),wt);It(vSe(),wt);It(SSe(),wt);It(CSe(),wt);It(PSe(),wt);It(CQ(),wt);It(TSe(),wt);It(ASe(),wt);It(ISe(),wt);It($3(),wt);It(MSe(),wt);It(jSe(),wt);It(DSe(),wt);It(NSe(),wt);It(FSe(),wt);It(kSe(),wt);It($Se(),wt);It(BSe(),wt);It(qSe(),wt);It(USe(),wt);It(PQ(),wt);It(zSe(),wt);It(EQ(),wt);It(TQ(),wt);It(HSe(),wt);It(VSe(),wt);It(WSe(),wt);It(KSe(),wt);It(AQ(),wt);It(Xyt(),wt);It(lm(),wt);It(JSe(),wt);It(GSe(),wt);It(YSe(),wt);It(XSe(),wt);It(QSe(),wt);It(exe(),wt);It(txe(),wt);It(rxe(),wt);It(nxe(),wt);It(oxe(),wt);It(ixe(),wt);It(axe(),wt);It(uxe(),wt);It(lxe(),wt);It(dxe(),wt);It(pxe(),wt);It(mxe(),wt);It(hxe(),wt);It(gxe(),wt);It(yxe(),wt);It(bxe(),wt);It(_xe(),wt);It(vxe(),wt);It(wxe(),wt);It(Sxe(),wt);It(hbt(),wt)});var MQ=v(bv=>{"use strict";var UPr=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]}),zPr=bv&&bv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HPr=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)&&UPr(e,t,r);return zPr(e,t),e};Object.defineProperty(bv,"__esModule",{value:!0});bv.TextResponseFormat=void 0;var VPr=HPr(U());bv.TextResponseFormat=VPr.serialization.object({})});var Txe=v(_v=>{"use strict";var WPr=_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]}),KPr=_v&&_v.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JPr=_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)&&WPr(e,t,r);return KPr(e,t),e};Object.defineProperty(_v,"__esModule",{value:!0});_v.JsonResponseFormat2=void 0;var U3=JPr(U());_v.JsonResponseFormat2=U3.serialization.object({jsonSchema:U3.serialization.property("json_schema",U3.serialization.record(U3.serialization.string(),U3.serialization.unknown()).optional())})});var RQ=v(vv=>{"use strict";var GPr=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]}),YPr=vv&&vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZPr=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)&&GPr(e,t,r);return YPr(e,t),e};Object.defineProperty(vv,"__esModule",{value:!0});vv.ResponseFormat2=void 0;var XPr=ZPr(U()),QPr=MQ(),eEr=Txe();vv.ResponseFormat2=XPr.serialization.union("type",{text:QPr.TextResponseFormat,json_object:eEr.JsonResponseFormat2}).transform({transform:t=>t,untransform:t=>t})});var gbt=v(wv=>{"use strict";var tEr=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]}),rEr=wv&&wv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nEr=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)&&tEr(e,t,r);return rEr(e,t),e};Object.defineProperty(wv,"__esModule",{value:!0});wv.V2ChatStreamRequest=void 0;var Ds=nEr(U()),oEr=PQ(),iEr=EQ(),aEr=bSe(),sEr=RQ();wv.V2ChatStreamRequest=Ds.serialization.object({model:Ds.serialization.string(),messages:oEr.ChatMessages,tools:Ds.serialization.list(iEr.Tool2).optional(),citationMode:Ds.serialization.property("citation_mode",aEr.V2ChatStreamRequestCitationMode.optional()),responseFormat:Ds.serialization.property("response_format",sEr.ResponseFormat2.optional()),maxTokens:Ds.serialization.property("max_tokens",Ds.serialization.number().optional()),stopSequences:Ds.serialization.property("stop_sequences",Ds.serialization.list(Ds.serialization.string()).optional()),temperature:Ds.serialization.number().optional(),seed:Ds.serialization.number().optional(),frequencyPenalty:Ds.serialization.property("frequency_penalty",Ds.serialization.number().optional()),presencePenalty:Ds.serialization.property("presence_penalty",Ds.serialization.number().optional()),k:Ds.serialization.number().optional(),p:Ds.serialization.number().optional(),returnPrompt:Ds.serialization.property("return_prompt",Ds.serialization.boolean().optional())})});var ybt=v(Sv=>{"use strict";var uEr=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]}),lEr=Sv&&Sv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cEr=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)&&uEr(e,t,r);return lEr(e,t),e};Object.defineProperty(Sv,"__esModule",{value:!0});Sv.V2ChatRequest=void 0;var Ns=cEr(U()),dEr=PQ(),fEr=EQ(),pEr=_Se(),mEr=RQ();Sv.V2ChatRequest=Ns.serialization.object({model:Ns.serialization.string(),messages:dEr.ChatMessages,tools:Ns.serialization.list(fEr.Tool2).optional(),citationMode:Ns.serialization.property("citation_mode",pEr.V2ChatRequestCitationMode.optional()),responseFormat:Ns.serialization.property("response_format",mEr.ResponseFormat2.optional()),maxTokens:Ns.serialization.property("max_tokens",Ns.serialization.number().optional()),stopSequences:Ns.serialization.property("stop_sequences",Ns.serialization.list(Ns.serialization.string()).optional()),temperature:Ns.serialization.number().optional(),seed:Ns.serialization.number().optional(),frequencyPenalty:Ns.serialization.property("frequency_penalty",Ns.serialization.number().optional()),presencePenalty:Ns.serialization.property("presence_penalty",Ns.serialization.number().optional()),k:Ns.serialization.number().optional(),p:Ns.serialization.number().optional(),returnPrompt:Ns.serialization.property("return_prompt",Ns.serialization.boolean().optional())})});var Axe=v(Ak=>{"use strict";Object.defineProperty(Ak,"__esModule",{value:!0});Ak.V2ChatRequest=Ak.V2ChatStreamRequest=void 0;var hEr=gbt();Object.defineProperty(Ak,"V2ChatStreamRequest",{enumerable:!0,get:function(){return hEr.V2ChatStreamRequest}});var gEr=ybt();Object.defineProperty(Ak,"V2ChatRequest",{enumerable:!0,get:function(){return gEr.V2ChatRequest}})});var bbt=v(d1=>{"use strict";var yEr=d1&&d1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=d1&&d1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yEr(e,t,r)};Object.defineProperty(d1,"__esModule",{value:!0});bEr(Axe(),d1)});var vbt=v(CT=>{"use strict";var _Er=CT&&CT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_bt=CT&&CT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_Er(e,t,r)};Object.defineProperty(CT,"__esModule",{value:!0});_bt(Exe(),CT);_bt(bbt(),CT)});var Ixe=v(xv=>{"use strict";var vEr=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]}),wEr=xv&&xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SEr=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)&&vEr(e,t,r);return wEr(e,t),e};Object.defineProperty(xv,"__esModule",{value:!0});xv.CreateEmbedJobRequestTruncate=void 0;var xEr=SEr(U());xv.CreateEmbedJobRequestTruncate=xEr.serialization.enum_(["START","END"])});var Mxe=v(f1=>{"use strict";var CEr=f1&&f1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OEr=f1&&f1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&CEr(e,t,r)};Object.defineProperty(f1,"__esModule",{value:!0});OEr(Ixe(),f1)});var jQ=v(Cv=>{"use strict";var PEr=Cv&&Cv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EEr=Cv&&Cv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TEr=Cv&&Cv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PEr(e,t,r);return EEr(e,t),e};Object.defineProperty(Cv,"__esModule",{value:!0});Cv.EmbedInputType=void 0;var AEr=TEr(U());Cv.EmbedInputType=AEr.serialization.enum_(["search_document","search_query","classification","clustering"])});var DQ=v(Ov=>{"use strict";var IEr=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]}),MEr=Ov&&Ov.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),REr=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)&&IEr(e,t,r);return MEr(e,t),e};Object.defineProperty(Ov,"__esModule",{value:!0});Ov.EmbeddingType=void 0;var jEr=REr(U());Ov.EmbeddingType=jEr.serialization.enum_(["float","int8","uint8","binary","ubinary"])});var wbt=v(Pv=>{"use strict";var DEr=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]}),NEr=Pv&&Pv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LEr=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)&&DEr(e,t,r);return NEr(e,t),e};Object.defineProperty(Pv,"__esModule",{value:!0});Pv.CreateEmbedJobRequest=void 0;var OT=LEr(U()),FEr=jQ(),kEr=DQ(),$Er=Ixe();Pv.CreateEmbedJobRequest=OT.serialization.object({model:OT.serialization.string(),datasetId:OT.serialization.property("dataset_id",OT.serialization.string()),inputType:OT.serialization.property("input_type",FEr.EmbedInputType),name:OT.serialization.string().optional(),embeddingTypes:OT.serialization.property("embedding_types",OT.serialization.list(kEr.EmbeddingType).optional()),truncate:$Er.CreateEmbedJobRequestTruncate.optional()})});var Rxe=v(NQ=>{"use strict";Object.defineProperty(NQ,"__esModule",{value:!0});NQ.CreateEmbedJobRequest=void 0;var BEr=wbt();Object.defineProperty(NQ,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return BEr.CreateEmbedJobRequest}})});var Sbt=v(p1=>{"use strict";var qEr=p1&&p1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UEr=p1&&p1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qEr(e,t,r)};Object.defineProperty(p1,"__esModule",{value:!0});UEr(Rxe(),p1)});var Cbt=v(PT=>{"use strict";var zEr=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]}),xbt=PT&&PT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zEr(e,t,r)};Object.defineProperty(PT,"__esModule",{value:!0});xbt(Mxe(),PT);xbt(Sbt(),PT)});var jxe=v(Ev=>{"use strict";var HEr=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]}),VEr=Ev&&Ev.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WEr=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)&&HEr(e,t,r);return VEr(e,t),e};Object.defineProperty(Ev,"__esModule",{value:!0});Ev.DatasetType=void 0;var KEr=WEr(U());Ev.DatasetType=KEr.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 Dxe=v(Tv=>{"use strict";var JEr=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]}),GEr=Tv&&Tv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YEr=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)&&JEr(e,t,r);return GEr(e,t),e};Object.defineProperty(Tv,"__esModule",{value:!0});Tv.DatasetValidationStatus=void 0;var ZEr=YEr(U());Tv.DatasetValidationStatus=ZEr.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var Nxe=v(Av=>{"use strict";var XEr=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]}),QEr=Av&&Av.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eTr=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)&&XEr(e,t,r);return QEr(e,t),e};Object.defineProperty(Av,"__esModule",{value:!0});Av.DatasetPart=void 0;var cm=eTr(U());Av.DatasetPart=cm.serialization.object({id:cm.serialization.string(),name:cm.serialization.string(),url:cm.serialization.string().optional(),index:cm.serialization.number().optional(),sizeBytes:cm.serialization.property("size_bytes",cm.serialization.number().optional()),numRows:cm.serialization.property("num_rows",cm.serialization.number().optional()),originalUrl:cm.serialization.property("original_url",cm.serialization.string().optional()),samples:cm.serialization.list(cm.serialization.string()).optional()})});var LQ=v(Iv=>{"use strict";var tTr=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]}),rTr=Iv&&Iv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nTr=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)&&tTr(e,t,r);return rTr(e,t),e};Object.defineProperty(Iv,"__esModule",{value:!0});Iv.Dataset=void 0;var ka=nTr(U()),oTr=jxe(),iTr=Dxe(),aTr=Nxe();Iv.Dataset=ka.serialization.object({id:ka.serialization.string(),name:ka.serialization.string(),createdAt:ka.serialization.property("created_at",ka.serialization.date()),updatedAt:ka.serialization.property("updated_at",ka.serialization.date()),datasetType:ka.serialization.property("dataset_type",oTr.DatasetType),validationStatus:ka.serialization.property("validation_status",iTr.DatasetValidationStatus),validationError:ka.serialization.property("validation_error",ka.serialization.string().optional()),schema:ka.serialization.string().optional(),requiredFields:ka.serialization.property("required_fields",ka.serialization.list(ka.serialization.string()).optional()),preserveFields:ka.serialization.property("preserve_fields",ka.serialization.list(ka.serialization.string()).optional()),datasetParts:ka.serialization.property("dataset_parts",ka.serialization.list(aTr.DatasetPart).optional()),validationWarnings:ka.serialization.property("validation_warnings",ka.serialization.list(ka.serialization.string()).optional())})});var Pbt=v(Mv=>{"use strict";var sTr=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]}),uTr=Mv&&Mv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lTr=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)&&sTr(e,t,r);return uTr(e,t),e};Object.defineProperty(Mv,"__esModule",{value:!0});Mv.DatasetsListResponse=void 0;var Obt=lTr(U()),cTr=LQ();Mv.DatasetsListResponse=Obt.serialization.object({datasets:Obt.serialization.list(cTr.Dataset).optional()})});var Ebt=v(Rv=>{"use strict";var dTr=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]}),fTr=Rv&&Rv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pTr=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)&&dTr(e,t,r);return fTr(e,t),e};Object.defineProperty(Rv,"__esModule",{value:!0});Rv.DatasetsCreateResponseDatasetPartsItem=void 0;var ET=pTr(U());Rv.DatasetsCreateResponseDatasetPartsItem=ET.serialization.object({name:ET.serialization.string().optional(),numRows:ET.serialization.property("num_rows",ET.serialization.number().optional()),samples:ET.serialization.list(ET.serialization.string()).optional(),partKind:ET.serialization.property("part_kind",ET.serialization.string().optional())})});var Abt=v(jv=>{"use strict";var mTr=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]}),hTr=jv&&jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gTr=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)&&mTr(e,t,r);return hTr(e,t),e};Object.defineProperty(jv,"__esModule",{value:!0});jv.DatasetsCreateResponse=void 0;var Tbt=gTr(U());jv.DatasetsCreateResponse=Tbt.serialization.object({id:Tbt.serialization.string().optional()})});var Ibt=v(Dv=>{"use strict";var yTr=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]}),bTr=Dv&&Dv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Tr=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)&&yTr(e,t,r);return bTr(e,t),e};Object.defineProperty(Dv,"__esModule",{value:!0});Dv.DatasetsGetUsageResponse=void 0;var Lxe=_Tr(U());Dv.DatasetsGetUsageResponse=Lxe.serialization.object({organizationUsage:Lxe.serialization.property("organization_usage",Lxe.serialization.number().optional())})});var Mbt=v(Nv=>{"use strict";var vTr=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]}),wTr=Nv&&Nv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),STr=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)&&vTr(e,t,r);return wTr(e,t),e};Object.defineProperty(Nv,"__esModule",{value:!0});Nv.DatasetsGetResponse=void 0;var xTr=STr(U()),CTr=LQ();Nv.DatasetsGetResponse=xTr.serialization.object({dataset:CTr.Dataset})});var Fxe=v(ey=>{"use strict";var OTr=ey&&ey.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z3=ey&&ey.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&OTr(e,t,r)};Object.defineProperty(ey,"__esModule",{value:!0});z3(Pbt(),ey);z3(Ebt(),ey);z3(Abt(),ey);z3(Ibt(),ey);z3(Mbt(),ey)});var Rbt=v(Lv=>{"use strict";var PTr=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]}),ETr=Lv&&Lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TTr=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)&&PTr(e,t,r);return ETr(e,t),e};Object.defineProperty(Lv,"__esModule",{value:!0});Lv.Response=void 0;var kxe=TTr(U());Lv.Response=kxe.serialization.record(kxe.serialization.string(),kxe.serialization.unknown())});var jbt=v(Fv=>{"use strict";var ATr=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]}),ITr=Fv&&Fv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MTr=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)&&ATr(e,t,r);return ITr(e,t),e};Object.defineProperty(Fv,"__esModule",{value:!0});Fv.delete=void 0;Fv.delete=MTr(Rbt())});var Nbt=v(TT=>{"use strict";var RTr=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]}),Dbt=TT&&TT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&RTr(e,t,r)};Object.defineProperty(TT,"__esModule",{value:!0});Dbt(Fxe(),TT);Dbt(jbt(),TT)});var $xe=v(kv=>{"use strict";var jTr=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]}),DTr=kv&&kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NTr=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)&&jTr(e,t,r);return DTr(e,t),e};Object.defineProperty(kv,"__esModule",{value:!0});kv.BaseType=void 0;var LTr=NTr(U());kv.BaseType=LTr.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var Bxe=v($v=>{"use strict";var FTr=$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]}),kTr=$v&&$v.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Tr=$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)&&FTr(e,t,r);return kTr(e,t),e};Object.defineProperty($v,"__esModule",{value:!0});$v.Strategy=void 0;var BTr=$Tr(U());$v.Strategy=BTr.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var qxe=v(Bv=>{"use strict";var qTr=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]}),UTr=Bv&&Bv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zTr=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)&&qTr(e,t,r);return UTr(e,t),e};Object.defineProperty(Bv,"__esModule",{value:!0});Bv.BaseModel=void 0;var FQ=zTr(U()),HTr=$xe(),VTr=Bxe();Bv.BaseModel=FQ.serialization.object({name:FQ.serialization.string().optional(),version:FQ.serialization.string().optional(),baseType:FQ.serialization.property("base_type",HTr.BaseType),strategy:VTr.Strategy.optional()})});var Uxe=v(qv=>{"use strict";var WTr=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]}),KTr=qv&&qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JTr=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)&&WTr(e,t,r);return KTr(e,t),e};Object.defineProperty(qv,"__esModule",{value:!0});qv.Hyperparameters=void 0;var ty=JTr(U());qv.Hyperparameters=ty.serialization.object({earlyStoppingPatience:ty.serialization.property("early_stopping_patience",ty.serialization.number().optional()),earlyStoppingThreshold:ty.serialization.property("early_stopping_threshold",ty.serialization.number().optional()),trainBatchSize:ty.serialization.property("train_batch_size",ty.serialization.number().optional()),trainEpochs:ty.serialization.property("train_epochs",ty.serialization.number().optional()),learningRate:ty.serialization.property("learning_rate",ty.serialization.number().optional())})});var zxe=v(Uv=>{"use strict";var GTr=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]}),YTr=Uv&&Uv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZTr=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)&&GTr(e,t,r);return YTr(e,t),e};Object.defineProperty(Uv,"__esModule",{value:!0});Uv.WandbConfig=void 0;var H3=ZTr(U());Uv.WandbConfig=H3.serialization.object({project:H3.serialization.string(),apiKey:H3.serialization.property("api_key",H3.serialization.string()),entity:H3.serialization.string().optional()})});var kQ=v(zv=>{"use strict";var XTr=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]}),QTr=zv&&zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eAr=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)&&XTr(e,t,r);return QTr(e,t),e};Object.defineProperty(zv,"__esModule",{value:!0});zv.Settings=void 0;var Ik=eAr(U()),tAr=qxe(),rAr=Uxe(),nAr=zxe();zv.Settings=Ik.serialization.object({baseModel:Ik.serialization.property("base_model",tAr.BaseModel),datasetId:Ik.serialization.property("dataset_id",Ik.serialization.string()),hyperparameters:rAr.Hyperparameters.optional(),multiLabel:Ik.serialization.property("multi_label",Ik.serialization.boolean().optional()),wandb:nAr.WandbConfig.optional()})});var V3=v(Hv=>{"use strict";var oAr=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]}),iAr=Hv&&Hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aAr=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)&&oAr(e,t,r);return iAr(e,t),e};Object.defineProperty(Hv,"__esModule",{value:!0});Hv.Status=void 0;var sAr=aAr(U());Hv.Status=sAr.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var Mk=v(Vv=>{"use strict";var uAr=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]}),lAr=Vv&&Vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cAr=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)&&uAr(e,t,r);return lAr(e,t),e};Object.defineProperty(Vv,"__esModule",{value:!0});Vv.FinetunedModel=void 0;var xf=cAr(U()),dAr=kQ(),fAr=V3();Vv.FinetunedModel=xf.serialization.object({id:xf.serialization.string().optional(),name:xf.serialization.string(),creatorId:xf.serialization.property("creator_id",xf.serialization.string().optional()),organizationId:xf.serialization.property("organization_id",xf.serialization.string().optional()),settings:dAr.Settings,status:fAr.Status.optional(),createdAt:xf.serialization.property("created_at",xf.serialization.date().optional()),updatedAt:xf.serialization.property("updated_at",xf.serialization.date().optional()),completedAt:xf.serialization.property("completed_at",xf.serialization.date().optional()),lastUsed:xf.serialization.property("last_used",xf.serialization.date().optional())})});var Lbt=v(Wv=>{"use strict";var pAr=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]}),mAr=Wv&&Wv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hAr=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)&&pAr(e,t,r);return mAr(e,t),e};Object.defineProperty(Wv,"__esModule",{value:!0});Wv.ListFinetunedModelsResponse=void 0;var m1=hAr(U()),gAr=Mk();Wv.ListFinetunedModelsResponse=m1.serialization.object({finetunedModels:m1.serialization.property("finetuned_models",m1.serialization.list(gAr.FinetunedModel).optional()),nextPageToken:m1.serialization.property("next_page_token",m1.serialization.string().optional()),totalSize:m1.serialization.property("total_size",m1.serialization.number().optional())})});var kbt=v(Kv=>{"use strict";var yAr=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]}),bAr=Kv&&Kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Ar=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)&&yAr(e,t,r);return bAr(e,t),e};Object.defineProperty(Kv,"__esModule",{value:!0});Kv.CreateFinetunedModelResponse=void 0;var Fbt=_Ar(U()),vAr=Mk();Kv.CreateFinetunedModelResponse=Fbt.serialization.object({finetunedModel:Fbt.serialization.property("finetuned_model",vAr.FinetunedModel.optional())})});var Bbt=v(Jv=>{"use strict";var wAr=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]}),SAr=Jv&&Jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xAr=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)&&wAr(e,t,r);return SAr(e,t),e};Object.defineProperty(Jv,"__esModule",{value:!0});Jv.GetFinetunedModelResponse=void 0;var $bt=xAr(U()),CAr=Mk();Jv.GetFinetunedModelResponse=$bt.serialization.object({finetunedModel:$bt.serialization.property("finetuned_model",CAr.FinetunedModel.optional())})});var qbt=v(Gv=>{"use strict";var OAr=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]}),PAr=Gv&&Gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EAr=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)&&OAr(e,t,r);return PAr(e,t),e};Object.defineProperty(Gv,"__esModule",{value:!0});Gv.DeleteFinetunedModelResponse=void 0;var Hxe=EAr(U());Gv.DeleteFinetunedModelResponse=Hxe.serialization.record(Hxe.serialization.string(),Hxe.serialization.unknown())});var zbt=v(Yv=>{"use strict";var TAr=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]}),AAr=Yv&&Yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IAr=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)&&TAr(e,t,r);return AAr(e,t),e};Object.defineProperty(Yv,"__esModule",{value:!0});Yv.UpdateFinetunedModelResponse=void 0;var Ubt=IAr(U()),MAr=Mk();Yv.UpdateFinetunedModelResponse=Ubt.serialization.object({finetunedModel:Ubt.serialization.property("finetuned_model",MAr.FinetunedModel.optional())})});var Vxe=v(Zv=>{"use strict";var RAr=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]}),jAr=Zv&&Zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DAr=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)&&RAr(e,t,r);return jAr(e,t),e};Object.defineProperty(Zv,"__esModule",{value:!0});Zv.Event=void 0;var W3=DAr(U()),NAr=V3();Zv.Event=W3.serialization.object({userId:W3.serialization.property("user_id",W3.serialization.string().optional()),status:NAr.Status.optional(),createdAt:W3.serialization.property("created_at",W3.serialization.date().optional())})});var Hbt=v(Xv=>{"use strict";var LAr=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]}),FAr=Xv&&Xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kAr=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)&&LAr(e,t,r);return FAr(e,t),e};Object.defineProperty(Xv,"__esModule",{value:!0});Xv.ListEventsResponse=void 0;var Rk=kAr(U()),$Ar=Vxe();Xv.ListEventsResponse=Rk.serialization.object({events:Rk.serialization.list($Ar.Event).optional(),nextPageToken:Rk.serialization.property("next_page_token",Rk.serialization.string().optional()),totalSize:Rk.serialization.property("total_size",Rk.serialization.number().optional())})});var Wxe=v(Qv=>{"use strict";var BAr=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]}),qAr=Qv&&Qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UAr=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)&&BAr(e,t,r);return qAr(e,t),e};Object.defineProperty(Qv,"__esModule",{value:!0});Qv.TrainingStepMetrics=void 0;var AT=UAr(U());Qv.TrainingStepMetrics=AT.serialization.object({createdAt:AT.serialization.property("created_at",AT.serialization.date().optional()),stepNumber:AT.serialization.property("step_number",AT.serialization.number().optional()),metrics:AT.serialization.record(AT.serialization.string(),AT.serialization.number()).optional()})});var Vbt=v(ew=>{"use strict";var zAr=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]}),HAr=ew&&ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VAr=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)&&zAr(e,t,r);return HAr(e,t),e};Object.defineProperty(ew,"__esModule",{value:!0});ew.ListTrainingStepMetricsResponse=void 0;var K3=VAr(U()),WAr=Wxe();ew.ListTrainingStepMetricsResponse=K3.serialization.object({stepMetrics:K3.serialization.property("step_metrics",K3.serialization.list(WAr.TrainingStepMetrics).optional()),nextPageToken:K3.serialization.property("next_page_token",K3.serialization.string().optional())})});var Kxe=v($a=>{"use strict";var KAr=$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]}),Ac=$a&&$a.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KAr(e,t,r)};Object.defineProperty($a,"__esModule",{value:!0});Ac($xe(),$a);Ac(Bxe(),$a);Ac(qxe(),$a);Ac(Uxe(),$a);Ac(zxe(),$a);Ac(kQ(),$a);Ac(V3(),$a);Ac(Mk(),$a);Ac(Lbt(),$a);Ac(kbt(),$a);Ac(Bbt(),$a);Ac(qbt(),$a);Ac(zbt(),$a);Ac(Vxe(),$a);Ac(Hbt(),$a);Ac(Wxe(),$a);Ac(Vbt(),$a)});var Wbt=v(h1=>{"use strict";var JAr=h1&&h1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GAr=h1&&h1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&JAr(e,t,r)};Object.defineProperty(h1,"__esModule",{value:!0});GAr(Kxe(),h1)});var Jbt=v(dm=>{"use strict";var Kbt=dm&&dm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=dm&&dm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZAr=dm&&dm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Kbt(e,t,r);return YAr(e,t),e},XAr=dm&&dm.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Kbt(e,t,r)};Object.defineProperty(dm,"__esModule",{value:!0});dm.finetuning=void 0;dm.finetuning=ZAr(Wbt());XAr(Kxe(),dm)});var Gbt=v(tw=>{"use strict";var QAr=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]}),eIr=tw&&tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tIr=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)&&QAr(e,t,r);return eIr(e,t),e};Object.defineProperty(tw,"__esModule",{value:!0});tw.FinetuningUpdateFinetunedModelRequest=void 0;var dp=tIr(U()),rIr=kQ(),nIr=V3();tw.FinetuningUpdateFinetunedModelRequest=dp.serialization.object({name:dp.serialization.string(),creatorId:dp.serialization.property("creator_id",dp.serialization.string().optional()),organizationId:dp.serialization.property("organization_id",dp.serialization.string().optional()),settings:rIr.Settings,status:nIr.Status.optional(),createdAt:dp.serialization.property("created_at",dp.serialization.date().optional()),updatedAt:dp.serialization.property("updated_at",dp.serialization.date().optional()),completedAt:dp.serialization.property("completed_at",dp.serialization.date().optional()),lastUsed:dp.serialization.property("last_used",dp.serialization.date().optional())})});var Jxe=v($Q=>{"use strict";Object.defineProperty($Q,"__esModule",{value:!0});$Q.FinetuningUpdateFinetunedModelRequest=void 0;var oIr=Gbt();Object.defineProperty($Q,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return oIr.FinetuningUpdateFinetunedModelRequest}})});var Ybt=v(g1=>{"use strict";var iIr=g1&&g1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aIr=g1&&g1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&iIr(e,t,r)};Object.defineProperty(g1,"__esModule",{value:!0});aIr(Jxe(),g1)});var Xbt=v(IT=>{"use strict";var sIr=IT&&IT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zbt=IT&&IT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sIr(e,t,r)};Object.defineProperty(IT,"__esModule",{value:!0});Zbt(Jbt(),IT);Zbt(Ybt(),IT)});var BQ=v(nw=>{"use strict";var uIr=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]}),lIr=nw&&nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cIr=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)&&uIr(e,t,r);return lIr(e,t),e};Object.defineProperty(nw,"__esModule",{value:!0});nw.CreateConnectorOAuth=void 0;var rw=cIr(U());nw.CreateConnectorOAuth=rw.serialization.object({clientId:rw.serialization.property("client_id",rw.serialization.string().optional()),clientSecret:rw.serialization.property("client_secret",rw.serialization.string().optional()),authorizeUrl:rw.serialization.property("authorize_url",rw.serialization.string().optional()),tokenUrl:rw.serialization.property("token_url",rw.serialization.string().optional()),scope:rw.serialization.string().optional()})});var Gxe=v(ow=>{"use strict";var dIr=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]}),fIr=ow&&ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pIr=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)&&dIr(e,t,r);return fIr(e,t),e};Object.defineProperty(ow,"__esModule",{value:!0});ow.AuthTokenType=void 0;var mIr=pIr(U());ow.AuthTokenType=mIr.serialization.enum_(["bearer","basic","noscheme"])});var qQ=v(iw=>{"use strict";var hIr=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]}),gIr=iw&&iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yIr=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)&&hIr(e,t,r);return gIr(e,t),e};Object.defineProperty(iw,"__esModule",{value:!0});iw.CreateConnectorServiceAuth=void 0;var Qbt=yIr(U()),bIr=Gxe();iw.CreateConnectorServiceAuth=Qbt.serialization.object({type:bIr.AuthTokenType,token:Qbt.serialization.string()})});var e_t=v(sw=>{"use strict";var _Ir=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]}),vIr=sw&&sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wIr=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)&&_Ir(e,t,r);return vIr(e,t),e};Object.defineProperty(sw,"__esModule",{value:!0});sw.CreateConnectorRequest=void 0;var aw=wIr(U()),SIr=BQ(),xIr=qQ();sw.CreateConnectorRequest=aw.serialization.object({name:aw.serialization.string(),description:aw.serialization.string().optional(),url:aw.serialization.string(),excludes:aw.serialization.list(aw.serialization.string()).optional(),oauth:SIr.CreateConnectorOAuth.optional(),active:aw.serialization.boolean().optional(),continueOnFailure:aw.serialization.property("continue_on_failure",aw.serialization.boolean().optional()),serviceAuth:aw.serialization.property("service_auth",xIr.CreateConnectorServiceAuth.optional())})});var t_t=v(uw=>{"use strict";var CIr=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]}),OIr=uw&&uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PIr=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)&&CIr(e,t,r);return OIr(e,t),e};Object.defineProperty(uw,"__esModule",{value:!0});uw.UpdateConnectorRequest=void 0;var FC=PIr(U()),EIr=BQ(),TIr=qQ();uw.UpdateConnectorRequest=FC.serialization.object({name:FC.serialization.string().optional(),url:FC.serialization.string().optional(),excludes:FC.serialization.list(FC.serialization.string()).optional(),oauth:EIr.CreateConnectorOAuth.optional(),active:FC.serialization.boolean().optional(),continueOnFailure:FC.serialization.property("continue_on_failure",FC.serialization.boolean().optional()),serviceAuth:FC.serialization.property("service_auth",TIr.CreateConnectorServiceAuth.optional())})});var Yxe=v(jk=>{"use strict";Object.defineProperty(jk,"__esModule",{value:!0});jk.UpdateConnectorRequest=jk.CreateConnectorRequest=void 0;var AIr=e_t();Object.defineProperty(jk,"CreateConnectorRequest",{enumerable:!0,get:function(){return AIr.CreateConnectorRequest}});var IIr=t_t();Object.defineProperty(jk,"UpdateConnectorRequest",{enumerable:!0,get:function(){return IIr.UpdateConnectorRequest}})});var r_t=v(y1=>{"use strict";var MIr=y1&&y1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RIr=y1&&y1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&MIr(e,t,r)};Object.defineProperty(y1,"__esModule",{value:!0});RIr(Yxe(),y1)});var n_t=v(b1=>{"use strict";var jIr=b1&&b1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DIr=b1&&b1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jIr(e,t,r)};Object.defineProperty(b1,"__esModule",{value:!0});DIr(r_t(),b1)});var i_t=v(Oi=>{"use strict";var o_t=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]}),NIr=Oi&&Oi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J3=Oi&&Oi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o_t(e,t,r);return NIr(e,t),e},_1=Oi&&Oi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&o_t(e,t,r)};Object.defineProperty(Oi,"__esModule",{value:!0});Oi.connectors=Oi.finetuning=Oi.datasets=Oi.embedJobs=Oi.v2=void 0;Oi.v2=J3(vbt());_1(Exe(),Oi);Oi.embedJobs=J3(Cbt());_1(Mxe(),Oi);Oi.datasets=J3(Nbt());_1(Fxe(),Oi);Oi.finetuning=J3(Xbt());_1(Axe(),Oi);_1(Rxe(),Oi);Oi.connectors=J3(n_t());_1(Yxe(),Oi);_1(Jxe(),Oi)});var Zxe=v(lw=>{"use strict";var LIr=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]}),FIr=lw&&lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kIr=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)&&LIr(e,t,r);return FIr(e,t),e};Object.defineProperty(lw,"__esModule",{value:!0});lw.ChatStreamRequestPromptTruncation=void 0;var $Ir=kIr(U());lw.ChatStreamRequestPromptTruncation=$Ir.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var Xxe=v(cw=>{"use strict";var BIr=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]}),qIr=cw&&cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UIr=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)&&BIr(e,t,r);return qIr(e,t),e};Object.defineProperty(cw,"__esModule",{value:!0});cw.ChatStreamRequestCitationQuality=void 0;var zIr=UIr(U());cw.ChatStreamRequestCitationQuality=zIr.serialization.enum_(["fast","accurate","off"])});var s_t=v(dw=>{"use strict";var HIr=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]}),VIr=dw&&dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WIr=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)&&HIr(e,t,r);return VIr(e,t),e};Object.defineProperty(dw,"__esModule",{value:!0});dw.ChatStreamRequestConnectorsSearchOptions=void 0;var a_t=WIr(U());dw.ChatStreamRequestConnectorsSearchOptions=a_t.serialization.object({seed:a_t.serialization.number().optional()})});var Qxe=v(fw=>{"use strict";var KIr=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]}),JIr=fw&&fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GIr=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)&&KIr(e,t,r);return JIr(e,t),e};Object.defineProperty(fw,"__esModule",{value:!0});fw.ChatStreamRequestSafetyMode=void 0;var YIr=GIr(U());fw.ChatStreamRequestSafetyMode=YIr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var l_t=v(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]}),XIr=pw&&pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QIr=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 XIr(e,t),e};Object.defineProperty(pw,"__esModule",{value:!0});pw.UnprocessableEntityErrorBody=void 0;var u_t=QIr(U());pw.UnprocessableEntityErrorBody=u_t.serialization.object({data:u_t.serialization.string().optional()})});var d_t=v(mw=>{"use strict";var eMr=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]}),tMr=mw&&mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rMr=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)&&eMr(e,t,r);return tMr(e,t),e};Object.defineProperty(mw,"__esModule",{value:!0});mw.TooManyRequestsErrorBody=void 0;var c_t=rMr(U());mw.TooManyRequestsErrorBody=c_t.serialization.object({data:c_t.serialization.string().optional()})});var p_t=v(hw=>{"use strict";var nMr=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]}),oMr=hw&&hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iMr=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)&&nMr(e,t,r);return oMr(e,t),e};Object.defineProperty(hw,"__esModule",{value:!0});hw.ClientClosedRequestErrorBody=void 0;var f_t=iMr(U());hw.ClientClosedRequestErrorBody=f_t.serialization.object({data:f_t.serialization.string().optional()})});var h_t=v(gw=>{"use strict";var aMr=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]}),sMr=gw&&gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uMr=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)&&aMr(e,t,r);return sMr(e,t),e};Object.defineProperty(gw,"__esModule",{value:!0});gw.NotImplementedErrorBody=void 0;var m_t=uMr(U());gw.NotImplementedErrorBody=m_t.serialization.object({data:m_t.serialization.string().optional()})});var y_t=v(yw=>{"use strict";var lMr=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]}),cMr=yw&&yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dMr=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)&&lMr(e,t,r);return cMr(e,t),e};Object.defineProperty(yw,"__esModule",{value:!0});yw.GatewayTimeoutErrorBody=void 0;var g_t=dMr(U());yw.GatewayTimeoutErrorBody=g_t.serialization.object({data:g_t.serialization.string().optional()})});var eCe=v(bw=>{"use strict";var fMr=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]}),pMr=bw&&bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mMr=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)&&fMr(e,t,r);return pMr(e,t),e};Object.defineProperty(bw,"__esModule",{value:!0});bw.ChatRequestPromptTruncation=void 0;var hMr=mMr(U());bw.ChatRequestPromptTruncation=hMr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var tCe=v(_w=>{"use strict";var gMr=_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]}),yMr=_w&&_w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bMr=_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)&&gMr(e,t,r);return yMr(e,t),e};Object.defineProperty(_w,"__esModule",{value:!0});_w.ChatRequestCitationQuality=void 0;var _Mr=bMr(U());_w.ChatRequestCitationQuality=_Mr.serialization.enum_(["fast","accurate","off"])});var __t=v(vw=>{"use strict";var vMr=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]}),wMr=vw&&vw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SMr=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)&&vMr(e,t,r);return wMr(e,t),e};Object.defineProperty(vw,"__esModule",{value:!0});vw.ChatRequestConnectorsSearchOptions=void 0;var b_t=SMr(U());vw.ChatRequestConnectorsSearchOptions=b_t.serialization.object({seed:b_t.serialization.number().optional()})});var rCe=v(ww=>{"use strict";var xMr=ww&&ww.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CMr=ww&&ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OMr=ww&&ww.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xMr(e,t,r);return CMr(e,t),e};Object.defineProperty(ww,"__esModule",{value:!0});ww.ChatRequestSafetyMode=void 0;var PMr=OMr(U());ww.ChatRequestSafetyMode=PMr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var nCe=v(Sw=>{"use strict";var EMr=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]}),TMr=Sw&&Sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AMr=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)&&EMr(e,t,r);return TMr(e,t),e};Object.defineProperty(Sw,"__esModule",{value:!0});Sw.GenerateStreamRequestTruncate=void 0;var IMr=AMr(U());Sw.GenerateStreamRequestTruncate=IMr.serialization.enum_(["NONE","START","END"])});var oCe=v(xw=>{"use strict";var MMr=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]}),RMr=xw&&xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jMr=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)&&MMr(e,t,r);return RMr(e,t),e};Object.defineProperty(xw,"__esModule",{value:!0});xw.GenerateStreamRequestReturnLikelihoods=void 0;var DMr=jMr(U());xw.GenerateStreamRequestReturnLikelihoods=DMr.serialization.enum_(["GENERATION","ALL","NONE"])});var iCe=v(Cw=>{"use strict";var NMr=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]}),LMr=Cw&&Cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FMr=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)&&NMr(e,t,r);return LMr(e,t),e};Object.defineProperty(Cw,"__esModule",{value:!0});Cw.GenerateRequestTruncate=void 0;var kMr=FMr(U());Cw.GenerateRequestTruncate=kMr.serialization.enum_(["NONE","START","END"])});var aCe=v(Ow=>{"use strict";var $Mr=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]}),BMr=Ow&&Ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qMr=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)&&$Mr(e,t,r);return BMr(e,t),e};Object.defineProperty(Ow,"__esModule",{value:!0});Ow.GenerateRequestReturnLikelihoods=void 0;var UMr=qMr(U());Ow.GenerateRequestReturnLikelihoods=UMr.serialization.enum_(["GENERATION","ALL","NONE"])});var sCe=v(Pw=>{"use strict";var zMr=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]}),HMr=Pw&&Pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VMr=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)&&zMr(e,t,r);return HMr(e,t),e};Object.defineProperty(Pw,"__esModule",{value:!0});Pw.EmbedRequestTruncate=void 0;var WMr=VMr(U());Pw.EmbedRequestTruncate=WMr.serialization.enum_(["NONE","START","END"])});var uCe=v(Ew=>{"use strict";var KMr=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]}),JMr=Ew&&Ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GMr=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)&&KMr(e,t,r);return JMr(e,t),e};Object.defineProperty(Ew,"__esModule",{value:!0});Ew.ApiMetaApiVersion=void 0;var Dk=GMr(U());Ew.ApiMetaApiVersion=Dk.serialization.object({version:Dk.serialization.string(),isDeprecated:Dk.serialization.property("is_deprecated",Dk.serialization.boolean().optional()),isExperimental:Dk.serialization.property("is_experimental",Dk.serialization.boolean().optional())})});var lCe=v(Tw=>{"use strict";var YMr=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]}),ZMr=Tw&&Tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XMr=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)&&YMr(e,t,r);return ZMr(e,t),e};Object.defineProperty(Tw,"__esModule",{value:!0});Tw.ApiMetaBilledUnits=void 0;var MT=XMr(U());Tw.ApiMetaBilledUnits=MT.serialization.object({inputTokens:MT.serialization.property("input_tokens",MT.serialization.number().optional()),outputTokens:MT.serialization.property("output_tokens",MT.serialization.number().optional()),searchUnits:MT.serialization.property("search_units",MT.serialization.number().optional()),classifications:MT.serialization.number().optional()})});var cCe=v(Aw=>{"use strict";var QMr=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]}),eRr=Aw&&Aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tRr=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)&&QMr(e,t,r);return eRr(e,t),e};Object.defineProperty(Aw,"__esModule",{value:!0});Aw.ApiMetaTokens=void 0;var G3=tRr(U());Aw.ApiMetaTokens=G3.serialization.object({inputTokens:G3.serialization.property("input_tokens",G3.serialization.number().optional()),outputTokens:G3.serialization.property("output_tokens",G3.serialization.number().optional())})});var fm=v(Iw=>{"use strict";var rRr=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]}),nRr=Iw&&Iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oRr=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)&&rRr(e,t,r);return nRr(e,t),e};Object.defineProperty(Iw,"__esModule",{value:!0});Iw.ApiMeta=void 0;var Y3=oRr(U()),iRr=uCe(),aRr=lCe(),sRr=cCe();Iw.ApiMeta=Y3.serialization.object({apiVersion:Y3.serialization.property("api_version",iRr.ApiMetaApiVersion.optional()),billedUnits:Y3.serialization.property("billed_units",aRr.ApiMetaBilledUnits.optional()),tokens:sRr.ApiMetaTokens.optional(),warnings:Y3.serialization.list(Y3.serialization.string()).optional()})});var dCe=v(Mw=>{"use strict";var uRr=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]}),lRr=Mw&&Mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cRr=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)&&uRr(e,t,r);return lRr(e,t),e};Object.defineProperty(Mw,"__esModule",{value:!0});Mw.EmbedFloatsResponse=void 0;var v1=cRr(U()),dRr=fm();Mw.EmbedFloatsResponse=v1.serialization.object({id:v1.serialization.string(),embeddings:v1.serialization.list(v1.serialization.list(v1.serialization.number())),texts:v1.serialization.list(v1.serialization.string()),meta:dRr.ApiMeta.optional()})});var fCe=v(Rw=>{"use strict";var fRr=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]}),pRr=Rw&&Rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mRr=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)&&fRr(e,t,r);return pRr(e,t),e};Object.defineProperty(Rw,"__esModule",{value:!0});Rw.EmbedByTypeResponseEmbeddings=void 0;var Md=mRr(U());Rw.EmbedByTypeResponseEmbeddings=Md.serialization.object({float:Md.serialization.list(Md.serialization.list(Md.serialization.number())).optional(),int8:Md.serialization.list(Md.serialization.list(Md.serialization.number())).optional(),uint8:Md.serialization.list(Md.serialization.list(Md.serialization.number())).optional(),binary:Md.serialization.list(Md.serialization.list(Md.serialization.number())).optional(),ubinary:Md.serialization.list(Md.serialization.list(Md.serialization.number())).optional()})});var pCe=v(jw=>{"use strict";var hRr=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]}),gRr=jw&&jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yRr=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)&&hRr(e,t,r);return gRr(e,t),e};Object.defineProperty(jw,"__esModule",{value:!0});jw.EmbedByTypeResponse=void 0;var UQ=yRr(U()),bRr=fCe(),_Rr=fm();jw.EmbedByTypeResponse=UQ.serialization.object({id:UQ.serialization.string(),embeddings:bRr.EmbedByTypeResponseEmbeddings,texts:UQ.serialization.list(UQ.serialization.string()),meta:_Rr.ApiMeta.optional()})});var w_t=v(Dw=>{"use strict";var vRr=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]}),wRr=Dw&&Dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SRr=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)&&vRr(e,t,r);return wRr(e,t),e};Object.defineProperty(Dw,"__esModule",{value:!0});Dw.EmbedResponse=void 0;var v_t=SRr(U()),xRr=dCe(),CRr=pCe();Dw.EmbedResponse=v_t.serialization.union(v_t.serialization.discriminant("responseType","response_type"),{embeddings_floats:xRr.EmbedFloatsResponse,embeddings_by_type:CRr.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var hCe=v(Nw=>{"use strict";var ORr=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]}),PRr=Nw&&Nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ERr=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)&&ORr(e,t,r);return PRr(e,t),e};Object.defineProperty(Nw,"__esModule",{value:!0});Nw.RerankDocument=void 0;var mCe=ERr(U());Nw.RerankDocument=mCe.serialization.record(mCe.serialization.string(),mCe.serialization.string())});var gCe=v(Lw=>{"use strict";var TRr=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]}),ARr=Lw&&Lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IRr=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)&&TRr(e,t,r);return ARr(e,t),e};Object.defineProperty(Lw,"__esModule",{value:!0});Lw.RerankRequestDocumentsItem=void 0;var S_t=IRr(U()),MRr=hCe();Lw.RerankRequestDocumentsItem=S_t.serialization.undiscriminatedUnion([S_t.serialization.string(),MRr.RerankDocument])});var yCe=v(Fw=>{"use strict";var RRr=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]}),jRr=Fw&&Fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DRr=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)&&RRr(e,t,r);return jRr(e,t),e};Object.defineProperty(Fw,"__esModule",{value:!0});Fw.RerankResponseResultsItemDocument=void 0;var x_t=DRr(U());Fw.RerankResponseResultsItemDocument=x_t.serialization.object({text:x_t.serialization.string()})});var bCe=v(kw=>{"use strict";var NRr=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]}),LRr=kw&&kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FRr=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)&&NRr(e,t,r);return LRr(e,t),e};Object.defineProperty(kw,"__esModule",{value:!0});kw.RerankResponseResultsItem=void 0;var zQ=FRr(U()),kRr=yCe();kw.RerankResponseResultsItem=zQ.serialization.object({document:kRr.RerankResponseResultsItemDocument.optional(),index:zQ.serialization.number(),relevanceScore:zQ.serialization.property("relevance_score",zQ.serialization.number())})});var C_t=v($w=>{"use strict";var $Rr=$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]}),BRr=$w&&$w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qRr=$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)&&$Rr(e,t,r);return BRr(e,t),e};Object.defineProperty($w,"__esModule",{value:!0});$w.RerankResponse=void 0;var _Ce=qRr(U()),URr=bCe(),zRr=fm();$w.RerankResponse=_Ce.serialization.object({id:_Ce.serialization.string().optional(),results:_Ce.serialization.list(URr.RerankResponseResultsItem),meta:zRr.ApiMeta.optional()})});var vCe=v(Bw=>{"use strict";var HRr=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]}),VRr=Bw&&Bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WRr=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)&&HRr(e,t,r);return VRr(e,t),e};Object.defineProperty(Bw,"__esModule",{value:!0});Bw.ClassifyRequestTruncate=void 0;var KRr=WRr(U());Bw.ClassifyRequestTruncate=KRr.serialization.enum_(["NONE","START","END"])});var wCe=v(qw=>{"use strict";var JRr=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]}),GRr=qw&&qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YRr=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)&&JRr(e,t,r);return GRr(e,t),e};Object.defineProperty(qw,"__esModule",{value:!0});qw.ClassifyResponseClassificationsItemLabelsValue=void 0;var O_t=YRr(U());qw.ClassifyResponseClassificationsItemLabelsValue=O_t.serialization.object({confidence:O_t.serialization.number().optional()})});var SCe=v(Uw=>{"use strict";var ZRr=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]}),XRr=Uw&&Uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QRr=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)&&ZRr(e,t,r);return XRr(e,t),e};Object.defineProperty(Uw,"__esModule",{value:!0});Uw.ClassifyResponseClassificationsItemClassificationType=void 0;var e1r=QRr(U());Uw.ClassifyResponseClassificationsItemClassificationType=e1r.serialization.enum_(["single-label","multi-label"])});var xCe=v(zw=>{"use strict";var t1r=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]}),r1r=zw&&zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n1r=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)&&t1r(e,t,r);return r1r(e,t),e};Object.defineProperty(zw,"__esModule",{value:!0});zw.ClassifyResponseClassificationsItem=void 0;var Ih=n1r(U()),o1r=wCe(),i1r=SCe();zw.ClassifyResponseClassificationsItem=Ih.serialization.object({id:Ih.serialization.string(),input:Ih.serialization.string().optional(),prediction:Ih.serialization.string().optional(),predictions:Ih.serialization.list(Ih.serialization.string()),confidence:Ih.serialization.number().optional(),confidences:Ih.serialization.list(Ih.serialization.number()),labels:Ih.serialization.record(Ih.serialization.string(),o1r.ClassifyResponseClassificationsItemLabelsValue),classificationType:Ih.serialization.property("classification_type",i1r.ClassifyResponseClassificationsItemClassificationType)})});var P_t=v(Hw=>{"use strict";var a1r=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]}),s1r=Hw&&Hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u1r=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)&&a1r(e,t,r);return s1r(e,t),e};Object.defineProperty(Hw,"__esModule",{value:!0});Hw.ClassifyResponse=void 0;var CCe=u1r(U()),l1r=xCe(),c1r=fm();Hw.ClassifyResponse=CCe.serialization.object({id:CCe.serialization.string(),classifications:CCe.serialization.list(l1r.ClassifyResponseClassificationsItem),meta:c1r.ApiMeta.optional()})});var OCe=v(Vw=>{"use strict";var d1r=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]}),f1r=Vw&&Vw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p1r=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)&&d1r(e,t,r);return f1r(e,t),e};Object.defineProperty(Vw,"__esModule",{value:!0});Vw.SummarizeRequestLength=void 0;var m1r=p1r(U());Vw.SummarizeRequestLength=m1r.serialization.enum_(["short","medium","long"])});var PCe=v(Ww=>{"use strict";var h1r=Ww&&Ww.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),g1r=Ww&&Ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y1r=Ww&&Ww.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&h1r(e,t,r);return g1r(e,t),e};Object.defineProperty(Ww,"__esModule",{value:!0});Ww.SummarizeRequestFormat=void 0;var b1r=y1r(U());Ww.SummarizeRequestFormat=b1r.serialization.enum_(["paragraph","bullets"])});var ECe=v(Kw=>{"use strict";var _1r=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]}),v1r=Kw&&Kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w1r=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)&&_1r(e,t,r);return v1r(e,t),e};Object.defineProperty(Kw,"__esModule",{value:!0});Kw.SummarizeRequestExtractiveness=void 0;var S1r=w1r(U());Kw.SummarizeRequestExtractiveness=S1r.serialization.enum_(["low","medium","high"])});var E_t=v(Jw=>{"use strict";var x1r=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]}),C1r=Jw&&Jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O1r=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)&&x1r(e,t,r);return C1r(e,t),e};Object.defineProperty(Jw,"__esModule",{value:!0});Jw.SummarizeResponse=void 0;var TCe=O1r(U()),P1r=fm();Jw.SummarizeResponse=TCe.serialization.object({id:TCe.serialization.string().optional(),summary:TCe.serialization.string().optional(),meta:P1r.ApiMeta.optional()})});var T_t=v(Gw=>{"use strict";var E1r=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]}),T1r=Gw&&Gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A1r=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)&&E1r(e,t,r);return T1r(e,t),e};Object.defineProperty(Gw,"__esModule",{value:!0});Gw.TokenizeResponse=void 0;var Nk=A1r(U()),I1r=fm();Gw.TokenizeResponse=Nk.serialization.object({tokens:Nk.serialization.list(Nk.serialization.number()),tokenStrings:Nk.serialization.property("token_strings",Nk.serialization.list(Nk.serialization.string())),meta:I1r.ApiMeta.optional()})});var I_t=v(Yw=>{"use strict";var M1r=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]}),R1r=Yw&&Yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j1r=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)&&M1r(e,t,r);return R1r(e,t),e};Object.defineProperty(Yw,"__esModule",{value:!0});Yw.DetokenizeResponse=void 0;var A_t=j1r(U()),D1r=fm();Yw.DetokenizeResponse=A_t.serialization.object({text:A_t.serialization.string(),meta:D1r.ApiMeta.optional()})});var M_t=v(Zw=>{"use strict";var N1r=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]}),L1r=Zw&&Zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F1r=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)&&N1r(e,t,r);return L1r(e,t),e};Object.defineProperty(Zw,"__esModule",{value:!0});Zw.CheckApiKeyResponse=void 0;var Lk=F1r(U());Zw.CheckApiKeyResponse=Lk.serialization.object({valid:Lk.serialization.boolean(),organizationId:Lk.serialization.property("organization_id",Lk.serialization.string().optional()),ownerId:Lk.serialization.property("owner_id",Lk.serialization.string().optional())})});var Fk=v(Xw=>{"use strict";var k1r=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]}),$1r=Xw&&Xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B1r=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)&&k1r(e,t,r);return $1r(e,t),e};Object.defineProperty(Xw,"__esModule",{value:!0});Xw.ToolCall=void 0;var Z3=B1r(U());Xw.ToolCall=Z3.serialization.object({name:Z3.serialization.string(),parameters:Z3.serialization.record(Z3.serialization.string(),Z3.serialization.unknown())})});var ACe=v(Qw=>{"use strict";var q1r=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]}),U1r=Qw&&Qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z1r=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)&&q1r(e,t,r);return U1r(e,t),e};Object.defineProperty(Qw,"__esModule",{value:!0});Qw.ChatMessage=void 0;var HQ=z1r(U()),H1r=Fk();Qw.ChatMessage=HQ.serialization.object({message:HQ.serialization.string(),toolCalls:HQ.serialization.property("tool_calls",HQ.serialization.list(H1r.ToolCall).optional())})});var Q3=v(e0=>{"use strict";var V1r=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]}),W1r=e0&&e0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K1r=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)&&V1r(e,t,r);return W1r(e,t),e};Object.defineProperty(e0,"__esModule",{value:!0});e0.ToolResult=void 0;var X3=K1r(U()),J1r=Fk();e0.ToolResult=X3.serialization.object({call:J1r.ToolCall,outputs:X3.serialization.list(X3.serialization.record(X3.serialization.string(),X3.serialization.unknown()))})});var MCe=v(t0=>{"use strict";var G1r=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]}),Y1r=t0&&t0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z1r=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)&&G1r(e,t,r);return Y1r(e,t),e};Object.defineProperty(t0,"__esModule",{value:!0});t0.ToolMessage=void 0;var ICe=Z1r(U()),X1r=Q3();t0.ToolMessage=ICe.serialization.object({toolResults:ICe.serialization.property("tool_results",ICe.serialization.list(X1r.ToolResult).optional())})});var eH=v(r0=>{"use strict";var Q1r=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]}),ejr=r0&&r0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tjr=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)&&Q1r(e,t,r);return ejr(e,t),e};Object.defineProperty(r0,"__esModule",{value:!0});r0.Message=void 0;var rjr=tjr(U()),RCe=ACe(),njr=MCe();r0.Message=rjr.serialization.union("role",{CHATBOT:RCe.ChatMessage,SYSTEM:RCe.ChatMessage,USER:RCe.ChatMessage,TOOL:njr.ToolMessage}).transform({transform:t=>t,untransform:t=>t})});var VQ=v(n0=>{"use strict";var ojr=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]}),ijr=n0&&n0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ajr=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)&&ojr(e,t,r);return ijr(e,t),e};Object.defineProperty(n0,"__esModule",{value:!0});n0.ChatConnector=void 0;var kC=ajr(U());n0.ChatConnector=kC.serialization.object({id:kC.serialization.string(),userAccessToken:kC.serialization.property("user_access_token",kC.serialization.string().optional()),continueOnFailure:kC.serialization.property("continue_on_failure",kC.serialization.boolean().optional()),options:kC.serialization.record(kC.serialization.string(),kC.serialization.unknown()).optional()})});var jCe=v(o0=>{"use strict";var sjr=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]}),ujr=o0&&o0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ljr=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)&&sjr(e,t,r);return ujr(e,t),e};Object.defineProperty(o0,"__esModule",{value:!0});o0.ToolParameterDefinitionsValue=void 0;var WQ=ljr(U());o0.ToolParameterDefinitionsValue=WQ.serialization.object({description:WQ.serialization.string().optional(),type:WQ.serialization.string(),required:WQ.serialization.boolean().optional()})});var KQ=v(i0=>{"use strict";var cjr=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]}),djr=i0&&i0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fjr=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)&&cjr(e,t,r);return djr(e,t),e};Object.defineProperty(i0,"__esModule",{value:!0});i0.Tool=void 0;var kk=fjr(U()),pjr=jCe();i0.Tool=kk.serialization.object({name:kk.serialization.string(),description:kk.serialization.string(),parameterDefinitions:kk.serialization.property("parameter_definitions",kk.serialization.record(kk.serialization.string(),pjr.ToolParameterDefinitionsValue).optional())})});var DCe=v(a0=>{"use strict";var mjr=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]}),hjr=a0&&a0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gjr=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)&&mjr(e,t,r);return hjr(e,t),e};Object.defineProperty(a0,"__esModule",{value:!0});a0.JsonResponseFormat=void 0;var JQ=gjr(U());a0.JsonResponseFormat=JQ.serialization.object({schema:JQ.serialization.record(JQ.serialization.string(),JQ.serialization.unknown()).optional()})});var GQ=v(s0=>{"use strict";var yjr=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]}),bjr=s0&&s0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_jr=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)&&yjr(e,t,r);return bjr(e,t),e};Object.defineProperty(s0,"__esModule",{value:!0});s0.ResponseFormat=void 0;var vjr=_jr(U()),wjr=MQ(),Sjr=DCe();s0.ResponseFormat=vjr.serialization.union("type",{text:wjr.TextResponseFormat,json_object:Sjr.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var YQ=v(u0=>{"use strict";var xjr=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]}),Cjr=u0&&u0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ojr=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)&&xjr(e,t,r);return Cjr(e,t),e};Object.defineProperty(u0,"__esModule",{value:!0});u0.ChatCitation=void 0;var w1=Ojr(U());u0.ChatCitation=w1.serialization.object({start:w1.serialization.number(),end:w1.serialization.number(),text:w1.serialization.string(),documentIds:w1.serialization.property("document_ids",w1.serialization.list(w1.serialization.string()))})});var tH=v(l0=>{"use strict";var Pjr=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]}),Ejr=l0&&l0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tjr=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)&&Pjr(e,t,r);return Ejr(e,t),e};Object.defineProperty(l0,"__esModule",{value:!0});l0.ChatSearchQuery=void 0;var ZQ=Tjr(U());l0.ChatSearchQuery=ZQ.serialization.object({text:ZQ.serialization.string(),generationId:ZQ.serialization.property("generation_id",ZQ.serialization.string())})});var NCe=v(c0=>{"use strict";var Ajr=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]}),Ijr=c0&&c0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mjr=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)&&Ajr(e,t,r);return Ijr(e,t),e};Object.defineProperty(c0,"__esModule",{value:!0});c0.ChatSearchResultConnector=void 0;var R_t=Mjr(U());c0.ChatSearchResultConnector=R_t.serialization.object({id:R_t.serialization.string()})});var XQ=v(d0=>{"use strict";var Rjr=d0&&d0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jjr=d0&&d0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Djr=d0&&d0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rjr(e,t,r);return jjr(e,t),e};Object.defineProperty(d0,"__esModule",{value:!0});d0.ChatSearchResult=void 0;var $C=Djr(U()),Njr=tH(),Ljr=NCe();d0.ChatSearchResult=$C.serialization.object({searchQuery:$C.serialization.property("search_query",Njr.ChatSearchQuery.optional()),connector:Ljr.ChatSearchResultConnector,documentIds:$C.serialization.property("document_ids",$C.serialization.list($C.serialization.string())),errorMessage:$C.serialization.property("error_message",$C.serialization.string().optional()),continueOnFailure:$C.serialization.property("continue_on_failure",$C.serialization.boolean().optional())})});var $k=v(f0=>{"use strict";var Fjr=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]}),kjr=f0&&f0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$jr=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)&&Fjr(e,t,r);return kjr(e,t),e};Object.defineProperty(f0,"__esModule",{value:!0});f0.FinishReason=void 0;var Bjr=$jr(U());f0.FinishReason=Bjr.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var LCe=v(p0=>{"use strict";var qjr=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]}),Ujr=p0&&p0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zjr=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)&&qjr(e,t,r);return Ujr(e,t),e};Object.defineProperty(p0,"__esModule",{value:!0});p0.NonStreamedChatResponse=void 0;var Bl=zjr(U()),Hjr=YQ(),Vjr=c1(),Wjr=tH(),Kjr=XQ(),Jjr=$k(),Gjr=Fk(),Yjr=eH(),Zjr=fm();p0.NonStreamedChatResponse=Bl.serialization.object({text:Bl.serialization.string(),generationId:Bl.serialization.property("generation_id",Bl.serialization.string().optional()),citations:Bl.serialization.list(Hjr.ChatCitation).optional(),documents:Bl.serialization.list(Vjr.ChatDocument).optional(),isSearchRequired:Bl.serialization.property("is_search_required",Bl.serialization.boolean().optional()),searchQueries:Bl.serialization.property("search_queries",Bl.serialization.list(Wjr.ChatSearchQuery).optional()),searchResults:Bl.serialization.property("search_results",Bl.serialization.list(Kjr.ChatSearchResult).optional()),finishReason:Bl.serialization.property("finish_reason",Jjr.FinishReason.optional()),toolCalls:Bl.serialization.property("tool_calls",Bl.serialization.list(Gjr.ToolCall).optional()),chatHistory:Bl.serialization.property("chat_history",Bl.serialization.list(Yjr.Message).optional()),prompt:Bl.serialization.string().optional(),meta:Zjr.ApiMeta.optional()})});var h0=v(m0=>{"use strict";var Xjr=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]}),Qjr=m0&&m0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eDr=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)&&Xjr(e,t,r);return Qjr(e,t),e};Object.defineProperty(m0,"__esModule",{value:!0});m0.ChatStreamEvent=void 0;var tDr=eDr(U());m0.ChatStreamEvent=tDr.serialization.object({})});var kCe=v(g0=>{"use strict";var rDr=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]}),nDr=g0&&g0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oDr=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)&&rDr(e,t,r);return nDr(e,t),e};Object.defineProperty(g0,"__esModule",{value:!0});g0.ChatStreamStartEvent=void 0;var FCe=oDr(U()),iDr=h0();g0.ChatStreamStartEvent=FCe.serialization.object({generationId:FCe.serialization.property("generation_id",FCe.serialization.string())}).extend(iDr.ChatStreamEvent)});var BCe=v(y0=>{"use strict";var aDr=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]}),sDr=y0&&y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uDr=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)&&aDr(e,t,r);return sDr(e,t),e};Object.defineProperty(y0,"__esModule",{value:!0});y0.ChatSearchQueriesGenerationEvent=void 0;var $Ce=uDr(U()),lDr=tH(),cDr=h0();y0.ChatSearchQueriesGenerationEvent=$Ce.serialization.object({searchQueries:$Ce.serialization.property("search_queries",$Ce.serialization.list(lDr.ChatSearchQuery))}).extend(cDr.ChatStreamEvent)});var qCe=v(b0=>{"use strict";var dDr=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]}),fDr=b0&&b0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pDr=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)&&dDr(e,t,r);return fDr(e,t),e};Object.defineProperty(b0,"__esModule",{value:!0});b0.ChatSearchResultsEvent=void 0;var QQ=pDr(U()),mDr=XQ(),hDr=c1(),gDr=h0();b0.ChatSearchResultsEvent=QQ.serialization.object({searchResults:QQ.serialization.property("search_results",QQ.serialization.list(mDr.ChatSearchResult).optional()),documents:QQ.serialization.list(hDr.ChatDocument).optional()}).extend(gDr.ChatStreamEvent)});var UCe=v(_0=>{"use strict";var yDr=_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]}),bDr=_0&&_0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Dr=_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)&&yDr(e,t,r);return bDr(e,t),e};Object.defineProperty(_0,"__esModule",{value:!0});_0.ChatTextGenerationEvent=void 0;var j_t=_Dr(U()),vDr=h0();_0.ChatTextGenerationEvent=j_t.serialization.object({text:j_t.serialization.string()}).extend(vDr.ChatStreamEvent)});var zCe=v(v0=>{"use strict";var wDr=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]}),SDr=v0&&v0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xDr=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)&&wDr(e,t,r);return SDr(e,t),e};Object.defineProperty(v0,"__esModule",{value:!0});v0.ChatCitationGenerationEvent=void 0;var D_t=xDr(U()),CDr=YQ(),ODr=h0();v0.ChatCitationGenerationEvent=D_t.serialization.object({citations:D_t.serialization.list(CDr.ChatCitation)}).extend(ODr.ChatStreamEvent)});var HCe=v(w0=>{"use strict";var PDr=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]}),EDr=w0&&w0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TDr=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)&&PDr(e,t,r);return EDr(e,t),e};Object.defineProperty(w0,"__esModule",{value:!0});w0.ChatToolCallsGenerationEvent=void 0;var eee=TDr(U()),ADr=Fk(),IDr=h0();w0.ChatToolCallsGenerationEvent=eee.serialization.object({text:eee.serialization.string().optional(),toolCalls:eee.serialization.property("tool_calls",eee.serialization.list(ADr.ToolCall))}).extend(IDr.ChatStreamEvent)});var VCe=v(S0=>{"use strict";var MDr=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]}),RDr=S0&&S0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jDr=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)&&MDr(e,t,r);return RDr(e,t),e};Object.defineProperty(S0,"__esModule",{value:!0});S0.ChatStreamEndEventFinishReason=void 0;var DDr=jDr(U());S0.ChatStreamEndEventFinishReason=DDr.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var WCe=v(x0=>{"use strict";var NDr=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]}),LDr=x0&&x0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FDr=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)&&NDr(e,t,r);return LDr(e,t),e};Object.defineProperty(x0,"__esModule",{value:!0});x0.ChatStreamEndEvent=void 0;var N_t=FDr(U()),kDr=VCe(),$Dr=LCe(),BDr=h0();x0.ChatStreamEndEvent=N_t.serialization.object({finishReason:N_t.serialization.property("finish_reason",kDr.ChatStreamEndEventFinishReason),response:$Dr.NonStreamedChatResponse}).extend(BDr.ChatStreamEvent)});var KCe=v(C0=>{"use strict";var qDr=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]}),UDr=C0&&C0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zDr=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)&&qDr(e,t,r);return UDr(e,t),e};Object.defineProperty(C0,"__esModule",{value:!0});C0.ToolCallDelta=void 0;var rH=zDr(U());C0.ToolCallDelta=rH.serialization.object({name:rH.serialization.string().optional(),index:rH.serialization.number().optional(),parameters:rH.serialization.string().optional(),text:rH.serialization.string().optional()})});var JCe=v(O0=>{"use strict";var HDr=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]}),VDr=O0&&O0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WDr=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)&&HDr(e,t,r);return VDr(e,t),e};Object.defineProperty(O0,"__esModule",{value:!0});O0.ChatToolCallsChunkEvent=void 0;var L_t=WDr(U()),KDr=KCe(),JDr=h0();O0.ChatToolCallsChunkEvent=L_t.serialization.object({toolCallDelta:L_t.serialization.property("tool_call_delta",KDr.ToolCallDelta)}).extend(JDr.ChatStreamEvent)});var k_t=v(P0=>{"use strict";var GDr=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]}),YDr=P0&&P0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZDr=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)&&GDr(e,t,r);return YDr(e,t),e};Object.defineProperty(P0,"__esModule",{value:!0});P0.StreamedChatResponse=void 0;var F_t=ZDr(U()),XDr=kCe(),QDr=BCe(),eNr=qCe(),tNr=UCe(),rNr=zCe(),nNr=HCe(),oNr=WCe(),iNr=JCe();P0.StreamedChatResponse=F_t.serialization.union(F_t.serialization.discriminant("eventType","event_type"),{"stream-start":XDr.ChatStreamStartEvent,"search-queries-generation":QDr.ChatSearchQueriesGenerationEvent,"search-results":eNr.ChatSearchResultsEvent,"text-generation":tNr.ChatTextGenerationEvent,"citation-generation":rNr.ChatCitationGenerationEvent,"tool-calls-generation":nNr.ChatToolCallsGenerationEvent,"stream-end":oNr.ChatStreamEndEvent,"tool-calls-chunk":iNr.ChatToolCallsChunkEvent}).transform({transform:t=>t,untransform:t=>t})});var YCe=v(E0=>{"use strict";var aNr=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]}),sNr=E0&&E0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uNr=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)&&aNr(e,t,r);return sNr(e,t),e};Object.defineProperty(E0,"__esModule",{value:!0});E0.SingleGenerationTokenLikelihoodsItem=void 0;var GCe=uNr(U());E0.SingleGenerationTokenLikelihoodsItem=GCe.serialization.object({token:GCe.serialization.string(),likelihood:GCe.serialization.number()})});var ZCe=v(T0=>{"use strict";var lNr=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]}),cNr=T0&&T0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dNr=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)&&lNr(e,t,r);return cNr(e,t),e};Object.defineProperty(T0,"__esModule",{value:!0});T0.SingleGeneration=void 0;var S1=dNr(U()),fNr=YCe();T0.SingleGeneration=S1.serialization.object({id:S1.serialization.string(),text:S1.serialization.string(),index:S1.serialization.number().optional(),likelihood:S1.serialization.number().optional(),tokenLikelihoods:S1.serialization.property("token_likelihoods",S1.serialization.list(fNr.SingleGenerationTokenLikelihoodsItem).optional())})});var $_t=v(A0=>{"use strict";var pNr=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]}),mNr=A0&&A0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hNr=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)&&pNr(e,t,r);return mNr(e,t),e};Object.defineProperty(A0,"__esModule",{value:!0});A0.Generation=void 0;var tee=hNr(U()),gNr=ZCe(),yNr=fm();A0.Generation=tee.serialization.object({id:tee.serialization.string(),prompt:tee.serialization.string().optional(),generations:tee.serialization.list(gNr.SingleGeneration),meta:yNr.ApiMeta.optional()})});var nH=v(I0=>{"use strict";var bNr=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]}),_Nr=I0&&I0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vNr=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)&&bNr(e,t,r);return _Nr(e,t),e};Object.defineProperty(I0,"__esModule",{value:!0});I0.GenerateStreamEvent=void 0;var wNr=vNr(U());I0.GenerateStreamEvent=wNr.serialization.object({})});var XCe=v(M0=>{"use strict";var SNr=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]}),xNr=M0&&M0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CNr=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)&&SNr(e,t,r);return xNr(e,t),e};Object.defineProperty(M0,"__esModule",{value:!0});M0.GenerateStreamText=void 0;var oH=CNr(U()),ONr=nH();M0.GenerateStreamText=oH.serialization.object({text:oH.serialization.string(),index:oH.serialization.number().optional(),isFinished:oH.serialization.property("is_finished",oH.serialization.boolean())}).extend(ONr.GenerateStreamEvent)});var QCe=v(R0=>{"use strict";var PNr=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]}),ENr=R0&&R0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TNr=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)&&PNr(e,t,r);return ENr(e,t),e};Object.defineProperty(R0,"__esModule",{value:!0});R0.SingleGenerationInStream=void 0;var iH=TNr(U()),ANr=$k();R0.SingleGenerationInStream=iH.serialization.object({id:iH.serialization.string(),text:iH.serialization.string(),index:iH.serialization.number().optional(),finishReason:iH.serialization.property("finish_reason",ANr.FinishReason)})});var eOe=v(j0=>{"use strict";var INr=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]}),MNr=j0&&j0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RNr=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)&&INr(e,t,r);return MNr(e,t),e};Object.defineProperty(j0,"__esModule",{value:!0});j0.GenerateStreamEndResponse=void 0;var ree=RNr(U()),jNr=QCe();j0.GenerateStreamEndResponse=ree.serialization.object({id:ree.serialization.string(),prompt:ree.serialization.string().optional(),generations:ree.serialization.list(jNr.SingleGenerationInStream).optional()})});var tOe=v(D0=>{"use strict";var DNr=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]}),NNr=D0&&D0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LNr=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)&&DNr(e,t,r);return NNr(e,t),e};Object.defineProperty(D0,"__esModule",{value:!0});D0.GenerateStreamEnd=void 0;var nee=LNr(U()),FNr=$k(),kNr=eOe(),$Nr=nH();D0.GenerateStreamEnd=nee.serialization.object({isFinished:nee.serialization.property("is_finished",nee.serialization.boolean()),finishReason:nee.serialization.property("finish_reason",FNr.FinishReason.optional()),response:kNr.GenerateStreamEndResponse}).extend($Nr.GenerateStreamEvent)});var rOe=v(N0=>{"use strict";var BNr=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]}),qNr=N0&&N0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UNr=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)&&BNr(e,t,r);return qNr(e,t),e};Object.defineProperty(N0,"__esModule",{value:!0});N0.GenerateStreamError=void 0;var Bk=UNr(U()),zNr=$k(),HNr=nH();N0.GenerateStreamError=Bk.serialization.object({index:Bk.serialization.number().optional(),isFinished:Bk.serialization.property("is_finished",Bk.serialization.boolean()),finishReason:Bk.serialization.property("finish_reason",zNr.FinishReason),err:Bk.serialization.string()}).extend(HNr.GenerateStreamEvent)});var q_t=v(L0=>{"use strict";var VNr=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]}),WNr=L0&&L0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KNr=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)&&VNr(e,t,r);return WNr(e,t),e};Object.defineProperty(L0,"__esModule",{value:!0});L0.GenerateStreamedResponse=void 0;var B_t=KNr(U()),JNr=XCe(),GNr=tOe(),YNr=rOe();L0.GenerateStreamedResponse=B_t.serialization.union(B_t.serialization.discriminant("eventType","event_type"),{"text-generation":JNr.GenerateStreamText,"stream-end":GNr.GenerateStreamEnd,"stream-error":YNr.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var nOe=v(F0=>{"use strict";var ZNr=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]}),XNr=F0&&F0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QNr=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)&&ZNr(e,t,r);return XNr(e,t),e};Object.defineProperty(F0,"__esModule",{value:!0});F0.EmbedJobStatus=void 0;var eLr=QNr(U());F0.EmbedJobStatus=eLr.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var oOe=v(k0=>{"use strict";var tLr=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]}),rLr=k0&&k0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nLr=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)&&tLr(e,t,r);return rLr(e,t),e};Object.defineProperty(k0,"__esModule",{value:!0});k0.EmbedJobTruncate=void 0;var oLr=nLr(U());k0.EmbedJobTruncate=oLr.serialization.enum_(["START","END"])});var iOe=v($0=>{"use strict";var iLr=$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]}),aLr=$0&&$0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sLr=$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)&&iLr(e,t,r);return aLr(e,t),e};Object.defineProperty($0,"__esModule",{value:!0});$0.EmbedJob=void 0;var ry=sLr(U()),uLr=nOe(),lLr=oOe(),cLr=fm();$0.EmbedJob=ry.serialization.object({jobId:ry.serialization.property("job_id",ry.serialization.string()),name:ry.serialization.string().optional(),status:uLr.EmbedJobStatus,createdAt:ry.serialization.property("created_at",ry.serialization.date()),inputDatasetId:ry.serialization.property("input_dataset_id",ry.serialization.string()),outputDatasetId:ry.serialization.property("output_dataset_id",ry.serialization.string().optional()),model:ry.serialization.string(),truncate:lLr.EmbedJobTruncate,meta:cLr.ApiMeta.optional()})});var U_t=v(B0=>{"use strict";var dLr=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]}),fLr=B0&&B0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pLr=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)&&dLr(e,t,r);return fLr(e,t),e};Object.defineProperty(B0,"__esModule",{value:!0});B0.ListEmbedJobResponse=void 0;var aOe=pLr(U()),mLr=iOe();B0.ListEmbedJobResponse=aOe.serialization.object({embedJobs:aOe.serialization.property("embed_jobs",aOe.serialization.list(mLr.EmbedJob).optional())})});var z_t=v(q0=>{"use strict";var hLr=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]}),gLr=q0&&q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yLr=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)&&hLr(e,t,r);return gLr(e,t),e};Object.defineProperty(q0,"__esModule",{value:!0});q0.CreateEmbedJobResponse=void 0;var sOe=yLr(U()),bLr=fm();q0.CreateEmbedJobResponse=sOe.serialization.object({jobId:sOe.serialization.property("job_id",sOe.serialization.string()),meta:bLr.ApiMeta.optional()})});var lOe=v(U0=>{"use strict";var _Lr=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]}),vLr=U0&&U0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wLr=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)&&_Lr(e,t,r);return vLr(e,t),e};Object.defineProperty(U0,"__esModule",{value:!0});U0.ClassifyExample=void 0;var uOe=wLr(U());U0.ClassifyExample=uOe.serialization.object({text:uOe.serialization.string().optional(),label:uOe.serialization.string().optional()})});var H_t=v(z0=>{"use strict";var SLr=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]}),xLr=z0&&z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CLr=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)&&SLr(e,t,r);return xLr(e,t),e};Object.defineProperty(z0,"__esModule",{value:!0});z0.ParseInfo=void 0;var cOe=CLr(U());z0.ParseInfo=cOe.serialization.object({separator:cOe.serialization.string().optional(),delimiter:cOe.serialization.string().optional()})});var V_t=v(H0=>{"use strict";var OLr=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]}),PLr=H0&&H0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ELr=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)&&OLr(e,t,r);return PLr(e,t),e};Object.defineProperty(H0,"__esModule",{value:!0});H0.RerankerDataMetrics=void 0;var pm=ELr(U());H0.RerankerDataMetrics=pm.serialization.object({numTrainQueries:pm.serialization.property("num_train_queries",pm.serialization.number().optional()),numTrainRelevantPassages:pm.serialization.property("num_train_relevant_passages",pm.serialization.number().optional()),numTrainHardNegatives:pm.serialization.property("num_train_hard_negatives",pm.serialization.number().optional()),numEvalQueries:pm.serialization.property("num_eval_queries",pm.serialization.number().optional()),numEvalRelevantPassages:pm.serialization.property("num_eval_relevant_passages",pm.serialization.number().optional()),numEvalHardNegatives:pm.serialization.property("num_eval_hard_negatives",pm.serialization.number().optional())})});var W_t=v(V0=>{"use strict";var TLr=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]}),ALr=V0&&V0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ILr=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)&&TLr(e,t,r);return ALr(e,t),e};Object.defineProperty(V0,"__esModule",{value:!0});V0.ChatDataMetrics=void 0;var qk=ILr(U());V0.ChatDataMetrics=qk.serialization.object({numTrainTurns:qk.serialization.property("num_train_turns",qk.serialization.number().optional()),numEvalTurns:qk.serialization.property("num_eval_turns",qk.serialization.number().optional()),preamble:qk.serialization.string().optional()})});var dOe=v(W0=>{"use strict";var MLr=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]}),RLr=W0&&W0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jLr=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)&&MLr(e,t,r);return RLr(e,t),e};Object.defineProperty(W0,"__esModule",{value:!0});W0.LabelMetric=void 0;var Uk=jLr(U());W0.LabelMetric=Uk.serialization.object({totalExamples:Uk.serialization.property("total_examples",Uk.serialization.number().optional()),label:Uk.serialization.string().optional(),samples:Uk.serialization.list(Uk.serialization.string()).optional()})});var K_t=v(K0=>{"use strict";var DLr=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]}),NLr=K0&&K0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LLr=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)&&DLr(e,t,r);return NLr(e,t),e};Object.defineProperty(K0,"__esModule",{value:!0});K0.ClassifyDataMetrics=void 0;var fOe=LLr(U()),FLr=dOe();K0.ClassifyDataMetrics=fOe.serialization.object({labelMetrics:fOe.serialization.property("label_metrics",fOe.serialization.list(FLr.LabelMetric).optional())})});var pOe=v(J0=>{"use strict";var kLr=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]}),$Lr=J0&&J0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BLr=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)&&kLr(e,t,r);return $Lr(e,t),e};Object.defineProperty(J0,"__esModule",{value:!0});J0.FinetuneDatasetMetrics=void 0;var mm=BLr(U());J0.FinetuneDatasetMetrics=mm.serialization.object({trainableTokenCount:mm.serialization.property("trainable_token_count",mm.serialization.number().optional()),totalExamples:mm.serialization.property("total_examples",mm.serialization.number().optional()),trainExamples:mm.serialization.property("train_examples",mm.serialization.number().optional()),trainSizeBytes:mm.serialization.property("train_size_bytes",mm.serialization.number().optional()),evalExamples:mm.serialization.property("eval_examples",mm.serialization.number().optional()),evalSizeBytes:mm.serialization.property("eval_size_bytes",mm.serialization.number().optional())})});var hOe=v(G0=>{"use strict";var qLr=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]}),ULr=G0&&G0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zLr=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)&&qLr(e,t,r);return ULr(e,t),e};Object.defineProperty(G0,"__esModule",{value:!0});G0.MetricsEmbedDataFieldsItem=void 0;var mOe=zLr(U());G0.MetricsEmbedDataFieldsItem=mOe.serialization.object({name:mOe.serialization.string().optional(),count:mOe.serialization.number().optional()})});var gOe=v(Y0=>{"use strict";var HLr=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]}),VLr=Y0&&Y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WLr=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)&&HLr(e,t,r);return VLr(e,t),e};Object.defineProperty(Y0,"__esModule",{value:!0});Y0.MetricsEmbedData=void 0;var J_t=WLr(U()),KLr=hOe();Y0.MetricsEmbedData=J_t.serialization.object({fields:J_t.serialization.list(KLr.MetricsEmbedDataFieldsItem).optional()})});var G_t=v(Z0=>{"use strict";var JLr=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]}),GLr=Z0&&Z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YLr=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)&&JLr(e,t,r);return GLr(e,t),e};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.Metrics=void 0;var yOe=YLr(U()),ZLr=pOe(),XLr=gOe();Z0.Metrics=yOe.serialization.object({finetuneDatasetMetrics:yOe.serialization.property("finetune_dataset_metrics",ZLr.FinetuneDatasetMetrics.optional()),embedData:yOe.serialization.property("embed_data",XLr.MetricsEmbedData.optional())})});var bOe=v(Q0=>{"use strict";var QLr=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]}),eFr=Q0&&Q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tFr=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)&&QLr(e,t,r);return eFr(e,t),e};Object.defineProperty(Q0,"__esModule",{value:!0});Q0.ConnectorOAuth=void 0;var X0=tFr(U());Q0.ConnectorOAuth=X0.serialization.object({clientId:X0.serialization.property("client_id",X0.serialization.string().optional()),clientSecret:X0.serialization.property("client_secret",X0.serialization.string().optional()),authorizeUrl:X0.serialization.property("authorize_url",X0.serialization.string()),tokenUrl:X0.serialization.property("token_url",X0.serialization.string()),scope:X0.serialization.string().optional()})});var _Oe=v(eS=>{"use strict";var rFr=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]}),nFr=eS&&eS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oFr=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)&&rFr(e,t,r);return nFr(e,t),e};Object.defineProperty(eS,"__esModule",{value:!0});eS.ConnectorAuthStatus=void 0;var iFr=oFr(U());eS.ConnectorAuthStatus=iFr.serialization.enum_(["valid","expired"])});var zk=v(tS=>{"use strict";var aFr=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]}),sFr=tS&&tS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uFr=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)&&aFr(e,t,r);return sFr(e,t),e};Object.defineProperty(tS,"__esModule",{value:!0});tS.Connector=void 0;var yl=uFr(U()),lFr=bOe(),cFr=_Oe();tS.Connector=yl.serialization.object({id:yl.serialization.string(),organizationId:yl.serialization.property("organization_id",yl.serialization.string().optional()),name:yl.serialization.string(),description:yl.serialization.string().optional(),url:yl.serialization.string().optional(),createdAt:yl.serialization.property("created_at",yl.serialization.date()),updatedAt:yl.serialization.property("updated_at",yl.serialization.date()),excludes:yl.serialization.list(yl.serialization.string()).optional(),authType:yl.serialization.property("auth_type",yl.serialization.string().optional()),oauth:lFr.ConnectorOAuth.optional(),authStatus:yl.serialization.property("auth_status",cFr.ConnectorAuthStatus.optional()),active:yl.serialization.boolean().optional(),continueOnFailure:yl.serialization.property("continue_on_failure",yl.serialization.boolean().optional())})});var Y_t=v(rS=>{"use strict";var dFr=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]}),fFr=rS&&rS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pFr=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)&&dFr(e,t,r);return fFr(e,t),e};Object.defineProperty(rS,"__esModule",{value:!0});rS.ListConnectorsResponse=void 0;var oee=pFr(U()),mFr=zk();rS.ListConnectorsResponse=oee.serialization.object({connectors:oee.serialization.list(mFr.Connector),totalCount:oee.serialization.property("total_count",oee.serialization.number().optional())})});var Z_t=v(nS=>{"use strict";var hFr=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]}),gFr=nS&&nS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yFr=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)&&hFr(e,t,r);return gFr(e,t),e};Object.defineProperty(nS,"__esModule",{value:!0});nS.CreateConnectorResponse=void 0;var bFr=yFr(U()),_Fr=zk();nS.CreateConnectorResponse=bFr.serialization.object({connector:_Fr.Connector})});var X_t=v(oS=>{"use strict";var vFr=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]}),wFr=oS&&oS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SFr=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)&&vFr(e,t,r);return wFr(e,t),e};Object.defineProperty(oS,"__esModule",{value:!0});oS.GetConnectorResponse=void 0;var xFr=SFr(U()),CFr=zk();oS.GetConnectorResponse=xFr.serialization.object({connector:CFr.Connector})});var Q_t=v(iS=>{"use strict";var OFr=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]}),PFr=iS&&iS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EFr=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)&&OFr(e,t,r);return PFr(e,t),e};Object.defineProperty(iS,"__esModule",{value:!0});iS.DeleteConnectorResponse=void 0;var vOe=EFr(U());iS.DeleteConnectorResponse=vOe.serialization.record(vOe.serialization.string(),vOe.serialization.unknown())});var evt=v(aS=>{"use strict";var TFr=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]}),AFr=aS&&aS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IFr=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)&&TFr(e,t,r);return AFr(e,t),e};Object.defineProperty(aS,"__esModule",{value:!0});aS.UpdateConnectorResponse=void 0;var MFr=IFr(U()),RFr=zk();aS.UpdateConnectorResponse=MFr.serialization.object({connector:RFr.Connector})});var tvt=v(sS=>{"use strict";var jFr=sS&&sS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DFr=sS&&sS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NFr=sS&&sS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jFr(e,t,r);return DFr(e,t),e};Object.defineProperty(sS,"__esModule",{value:!0});sS.OAuthAuthorizeResponse=void 0;var wOe=NFr(U());sS.OAuthAuthorizeResponse=wOe.serialization.object({redirectUrl:wOe.serialization.property("redirect_url",wOe.serialization.string().optional())})});var SOe=v(uS=>{"use strict";var LFr=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]}),FFr=uS&&uS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kFr=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)&&LFr(e,t,r);return FFr(e,t),e};Object.defineProperty(uS,"__esModule",{value:!0});uS.CompatibleEndpoint=void 0;var $Fr=kFr(U());uS.CompatibleEndpoint=$Fr.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var xOe=v(cS=>{"use strict";var BFr=cS&&cS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qFr=cS&&cS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UFr=cS&&cS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BFr(e,t,r);return qFr(e,t),e};Object.defineProperty(cS,"__esModule",{value:!0});cS.GetModelResponse=void 0;var lS=UFr(U()),rvt=SOe();cS.GetModelResponse=lS.serialization.object({name:lS.serialization.string().optional(),endpoints:lS.serialization.list(rvt.CompatibleEndpoint).optional(),finetuned:lS.serialization.boolean().optional(),contextLength:lS.serialization.property("context_length",lS.serialization.number().optional()),tokenizerUrl:lS.serialization.property("tokenizer_url",lS.serialization.string().optional()),defaultEndpoints:lS.serialization.property("default_endpoints",lS.serialization.list(rvt.CompatibleEndpoint).optional())})});var nvt=v(dS=>{"use strict";var zFr=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]}),HFr=dS&&dS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VFr=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)&&zFr(e,t,r);return HFr(e,t),e};Object.defineProperty(dS,"__esModule",{value:!0});dS.ListModelsResponse=void 0;var iee=VFr(U()),WFr=xOe();dS.ListModelsResponse=iee.serialization.object({models:iee.serialization.list(WFr.GetModelResponse),nextPageToken:iee.serialization.property("next_page_token",iee.serialization.string().optional())})});var ovt=v(le=>{"use strict";var KFr=le&&le.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ye=le&&le.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KFr(e,t,r)};Object.defineProperty(le,"__esModule",{value:!0});ye(Zxe(),le);ye(Xxe(),le);ye(s_t(),le);ye(Qxe(),le);ye(l_t(),le);ye(d_t(),le);ye(p_t(),le);ye(h_t(),le);ye(y_t(),le);ye(eCe(),le);ye(tCe(),le);ye(__t(),le);ye(rCe(),le);ye(nCe(),le);ye(oCe(),le);ye(iCe(),le);ye(aCe(),le);ye(sCe(),le);ye(w_t(),le);ye(gCe(),le);ye(yCe(),le);ye(bCe(),le);ye(C_t(),le);ye(vCe(),le);ye(wCe(),le);ye(SCe(),le);ye(xCe(),le);ye(P_t(),le);ye(OCe(),le);ye(PCe(),le);ye(ECe(),le);ye(E_t(),le);ye(T_t(),le);ye(I_t(),le);ye(M_t(),le);ye(Fk(),le);ye(ACe(),le);ye(Q3(),le);ye(MCe(),le);ye(eH(),le);ye(VQ(),le);ye(c1(),le);ye(jCe(),le);ye(KQ(),le);ye(MQ(),le);ye(DCe(),le);ye(GQ(),le);ye(YQ(),le);ye(tH(),le);ye(NCe(),le);ye(XQ(),le);ye($k(),le);ye(uCe(),le);ye(lCe(),le);ye(cCe(),le);ye(fm(),le);ye(LCe(),le);ye(h0(),le);ye(kCe(),le);ye(BCe(),le);ye(qCe(),le);ye(UCe(),le);ye(zCe(),le);ye(HCe(),le);ye(VCe(),le);ye(WCe(),le);ye(KCe(),le);ye(JCe(),le);ye(k_t(),le);ye(Txe(),le);ye(RQ(),le);ye(xxe(),le);ye(Cxe(),le);ye(Oxe(),le);ye(Pxe(),le);ye(YCe(),le);ye(ZCe(),le);ye($_t(),le);ye(nH(),le);ye(XCe(),le);ye(QCe(),le);ye(eOe(),le);ye(tOe(),le);ye(rOe(),le);ye(q_t(),le);ye(jQ(),le);ye(DQ(),le);ye(dCe(),le);ye(fCe(),le);ye(pCe(),le);ye(nOe(),le);ye(oOe(),le);ye(iOe(),le);ye(U_t(),le);ye(z_t(),le);ye(hCe(),le);ye(lOe(),le);ye(Dxe(),le);ye(jxe(),le);ye(Nxe(),le);ye(H_t(),le);ye(V_t(),le);ye(W_t(),le);ye(dOe(),le);ye(K_t(),le);ye(pOe(),le);ye(hOe(),le);ye(gOe(),le);ye(G_t(),le);ye(LQ(),le);ye(bOe(),le);ye(_Oe(),le);ye(zk(),le);ye(Y_t(),le);ye(BQ(),le);ye(Gxe(),le);ye(qQ(),le);ye(Z_t(),le);ye(X_t(),le);ye(Q_t(),le);ye(evt(),le);ye(tvt(),le);ye(SOe(),le);ye(xOe(),le);ye(nvt(),le)});var ivt=v(fS=>{"use strict";var JFr=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]}),GFr=fS&&fS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YFr=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)&&JFr(e,t,r);return GFr(e,t),e};Object.defineProperty(fS,"__esModule",{value:!0});fS.ChatStreamRequest=void 0;var un=YFr(U()),ZFr=eH(),XFr=Zxe(),QFr=VQ(),ekr=c1(),tkr=Xxe(),rkr=KQ(),nkr=Q3(),okr=GQ(),ikr=Qxe();fS.ChatStreamRequest=un.serialization.object({message:un.serialization.string(),model:un.serialization.string().optional(),preamble:un.serialization.string().optional(),chatHistory:un.serialization.property("chat_history",un.serialization.list(ZFr.Message).optional()),conversationId:un.serialization.property("conversation_id",un.serialization.string().optional()),promptTruncation:un.serialization.property("prompt_truncation",XFr.ChatStreamRequestPromptTruncation.optional()),connectors:un.serialization.list(QFr.ChatConnector).optional(),searchQueriesOnly:un.serialization.property("search_queries_only",un.serialization.boolean().optional()),documents:un.serialization.list(ekr.ChatDocument).optional(),citationQuality:un.serialization.property("citation_quality",tkr.ChatStreamRequestCitationQuality.optional()),temperature:un.serialization.number().optional(),maxTokens:un.serialization.property("max_tokens",un.serialization.number().optional()),maxInputTokens:un.serialization.property("max_input_tokens",un.serialization.number().optional()),k:un.serialization.number().optional(),p:un.serialization.number().optional(),seed:un.serialization.number().optional(),stopSequences:un.serialization.property("stop_sequences",un.serialization.list(un.serialization.string()).optional()),frequencyPenalty:un.serialization.property("frequency_penalty",un.serialization.number().optional()),presencePenalty:un.serialization.property("presence_penalty",un.serialization.number().optional()),rawPrompting:un.serialization.property("raw_prompting",un.serialization.boolean().optional()),returnPrompt:un.serialization.property("return_prompt",un.serialization.boolean().optional()),tools:un.serialization.list(rkr.Tool).optional(),toolResults:un.serialization.property("tool_results",un.serialization.list(nkr.ToolResult).optional()),forceSingleStep:un.serialization.property("force_single_step",un.serialization.boolean().optional()),responseFormat:un.serialization.property("response_format",okr.ResponseFormat.optional()),safetyMode:un.serialization.property("safety_mode",ikr.ChatStreamRequestSafetyMode.optional())})});var avt=v(pS=>{"use strict";var akr=pS&&pS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),skr=pS&&pS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ukr=pS&&pS.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&akr(e,t,r);return skr(e,t),e};Object.defineProperty(pS,"__esModule",{value:!0});pS.ChatRequest=void 0;var ln=ukr(U()),lkr=eH(),ckr=eCe(),dkr=VQ(),fkr=c1(),pkr=tCe(),mkr=KQ(),hkr=Q3(),gkr=GQ(),ykr=rCe();pS.ChatRequest=ln.serialization.object({message:ln.serialization.string(),model:ln.serialization.string().optional(),preamble:ln.serialization.string().optional(),chatHistory:ln.serialization.property("chat_history",ln.serialization.list(lkr.Message).optional()),conversationId:ln.serialization.property("conversation_id",ln.serialization.string().optional()),promptTruncation:ln.serialization.property("prompt_truncation",ckr.ChatRequestPromptTruncation.optional()),connectors:ln.serialization.list(dkr.ChatConnector).optional(),searchQueriesOnly:ln.serialization.property("search_queries_only",ln.serialization.boolean().optional()),documents:ln.serialization.list(fkr.ChatDocument).optional(),citationQuality:ln.serialization.property("citation_quality",pkr.ChatRequestCitationQuality.optional()),temperature:ln.serialization.number().optional(),maxTokens:ln.serialization.property("max_tokens",ln.serialization.number().optional()),maxInputTokens:ln.serialization.property("max_input_tokens",ln.serialization.number().optional()),k:ln.serialization.number().optional(),p:ln.serialization.number().optional(),seed:ln.serialization.number().optional(),stopSequences:ln.serialization.property("stop_sequences",ln.serialization.list(ln.serialization.string()).optional()),frequencyPenalty:ln.serialization.property("frequency_penalty",ln.serialization.number().optional()),presencePenalty:ln.serialization.property("presence_penalty",ln.serialization.number().optional()),rawPrompting:ln.serialization.property("raw_prompting",ln.serialization.boolean().optional()),returnPrompt:ln.serialization.property("return_prompt",ln.serialization.boolean().optional()),tools:ln.serialization.list(mkr.Tool).optional(),toolResults:ln.serialization.property("tool_results",ln.serialization.list(hkr.ToolResult).optional()),forceSingleStep:ln.serialization.property("force_single_step",ln.serialization.boolean().optional()),responseFormat:ln.serialization.property("response_format",gkr.ResponseFormat.optional()),safetyMode:ln.serialization.property("safety_mode",ykr.ChatRequestSafetyMode.optional())})});var svt=v(mS=>{"use strict";var bkr=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]}),_kr=mS&&mS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vkr=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)&&bkr(e,t,r);return _kr(e,t),e};Object.defineProperty(mS,"__esModule",{value:!0});mS.GenerateStreamRequest=void 0;var Yi=vkr(U()),wkr=nCe(),Skr=oCe();mS.GenerateStreamRequest=Yi.serialization.object({prompt:Yi.serialization.string(),model:Yi.serialization.string().optional(),numGenerations:Yi.serialization.property("num_generations",Yi.serialization.number().optional()),maxTokens:Yi.serialization.property("max_tokens",Yi.serialization.number().optional()),truncate:wkr.GenerateStreamRequestTruncate.optional(),temperature:Yi.serialization.number().optional(),seed:Yi.serialization.number().optional(),preset:Yi.serialization.string().optional(),endSequences:Yi.serialization.property("end_sequences",Yi.serialization.list(Yi.serialization.string()).optional()),stopSequences:Yi.serialization.property("stop_sequences",Yi.serialization.list(Yi.serialization.string()).optional()),k:Yi.serialization.number().optional(),p:Yi.serialization.number().optional(),frequencyPenalty:Yi.serialization.property("frequency_penalty",Yi.serialization.number().optional()),presencePenalty:Yi.serialization.property("presence_penalty",Yi.serialization.number().optional()),returnLikelihoods:Yi.serialization.property("return_likelihoods",Skr.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:Yi.serialization.property("raw_prompting",Yi.serialization.boolean().optional())})});var uvt=v(hS=>{"use strict";var xkr=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]}),Ckr=hS&&hS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Okr=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)&&xkr(e,t,r);return Ckr(e,t),e};Object.defineProperty(hS,"__esModule",{value:!0});hS.GenerateRequest=void 0;var Zi=Okr(U()),Pkr=iCe(),Ekr=aCe();hS.GenerateRequest=Zi.serialization.object({prompt:Zi.serialization.string(),model:Zi.serialization.string().optional(),numGenerations:Zi.serialization.property("num_generations",Zi.serialization.number().optional()),maxTokens:Zi.serialization.property("max_tokens",Zi.serialization.number().optional()),truncate:Pkr.GenerateRequestTruncate.optional(),temperature:Zi.serialization.number().optional(),seed:Zi.serialization.number().optional(),preset:Zi.serialization.string().optional(),endSequences:Zi.serialization.property("end_sequences",Zi.serialization.list(Zi.serialization.string()).optional()),stopSequences:Zi.serialization.property("stop_sequences",Zi.serialization.list(Zi.serialization.string()).optional()),k:Zi.serialization.number().optional(),p:Zi.serialization.number().optional(),frequencyPenalty:Zi.serialization.property("frequency_penalty",Zi.serialization.number().optional()),presencePenalty:Zi.serialization.property("presence_penalty",Zi.serialization.number().optional()),returnLikelihoods:Zi.serialization.property("return_likelihoods",Ekr.GenerateRequestReturnLikelihoods.optional()),rawPrompting:Zi.serialization.property("raw_prompting",Zi.serialization.boolean().optional())})});var lvt=v(gS=>{"use strict";var Tkr=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]}),Akr=gS&&gS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ikr=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)&&Tkr(e,t,r);return Akr(e,t),e};Object.defineProperty(gS,"__esModule",{value:!0});gS.EmbedRequest=void 0;var x1=Ikr(U()),Mkr=jQ(),Rkr=DQ(),jkr=sCe();gS.EmbedRequest=x1.serialization.object({texts:x1.serialization.list(x1.serialization.string()),model:x1.serialization.string().optional(),inputType:x1.serialization.property("input_type",Mkr.EmbedInputType.optional()),embeddingTypes:x1.serialization.property("embedding_types",x1.serialization.list(Rkr.EmbeddingType).optional()),truncate:jkr.EmbedRequestTruncate.optional()})});var cvt=v(yS=>{"use strict";var Dkr=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]}),Nkr=yS&&yS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lkr=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)&&Dkr(e,t,r);return Nkr(e,t),e};Object.defineProperty(yS,"__esModule",{value:!0});yS.RerankRequest=void 0;var hm=Lkr(U()),Fkr=gCe();yS.RerankRequest=hm.serialization.object({model:hm.serialization.string().optional(),query:hm.serialization.string(),documents:hm.serialization.list(Fkr.RerankRequestDocumentsItem),topN:hm.serialization.property("top_n",hm.serialization.number().optional()),rankFields:hm.serialization.property("rank_fields",hm.serialization.list(hm.serialization.string()).optional()),returnDocuments:hm.serialization.property("return_documents",hm.serialization.boolean().optional()),maxChunksPerDoc:hm.serialization.property("max_chunks_per_doc",hm.serialization.number().optional())})});var dvt=v(bS=>{"use strict";var kkr=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]}),$kr=bS&&bS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bkr=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)&&kkr(e,t,r);return $kr(e,t),e};Object.defineProperty(bS,"__esModule",{value:!0});bS.ClassifyRequest=void 0;var Hk=Bkr(U()),qkr=lOe(),Ukr=vCe();bS.ClassifyRequest=Hk.serialization.object({inputs:Hk.serialization.list(Hk.serialization.string()),examples:Hk.serialization.list(qkr.ClassifyExample).optional(),model:Hk.serialization.string().optional(),preset:Hk.serialization.string().optional(),truncate:Ukr.ClassifyRequestTruncate.optional()})});var fvt=v(_S=>{"use strict";var zkr=_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]}),Hkr=_S&&_S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vkr=_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)&&zkr(e,t,r);return Hkr(e,t),e};Object.defineProperty(_S,"__esModule",{value:!0});_S.SummarizeRequest=void 0;var Vk=Vkr(U()),Wkr=OCe(),Kkr=PCe(),Jkr=ECe();_S.SummarizeRequest=Vk.serialization.object({text:Vk.serialization.string(),length:Wkr.SummarizeRequestLength.optional(),format:Kkr.SummarizeRequestFormat.optional(),model:Vk.serialization.string().optional(),extractiveness:Jkr.SummarizeRequestExtractiveness.optional(),temperature:Vk.serialization.number().optional(),additionalCommand:Vk.serialization.property("additional_command",Vk.serialization.string().optional())})});var pvt=v(vS=>{"use strict";var Gkr=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]}),Ykr=vS&&vS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zkr=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)&&Gkr(e,t,r);return Ykr(e,t),e};Object.defineProperty(vS,"__esModule",{value:!0});vS.TokenizeRequest=void 0;var COe=Zkr(U());vS.TokenizeRequest=COe.serialization.object({text:COe.serialization.string(),model:COe.serialization.string()})});var mvt=v(wS=>{"use strict";var Xkr=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]}),Qkr=wS&&wS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e$r=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)&&Xkr(e,t,r);return Qkr(e,t),e};Object.defineProperty(wS,"__esModule",{value:!0});wS.DetokenizeRequest=void 0;var aee=e$r(U());wS.DetokenizeRequest=aee.serialization.object({tokens:aee.serialization.list(aee.serialization.number()),model:aee.serialization.string()})});var hvt=v(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});rs.DetokenizeRequest=rs.TokenizeRequest=rs.SummarizeRequest=rs.ClassifyRequest=rs.RerankRequest=rs.EmbedRequest=rs.GenerateRequest=rs.GenerateStreamRequest=rs.ChatRequest=rs.ChatStreamRequest=void 0;var t$r=ivt();Object.defineProperty(rs,"ChatStreamRequest",{enumerable:!0,get:function(){return t$r.ChatStreamRequest}});var r$r=avt();Object.defineProperty(rs,"ChatRequest",{enumerable:!0,get:function(){return r$r.ChatRequest}});var n$r=svt();Object.defineProperty(rs,"GenerateStreamRequest",{enumerable:!0,get:function(){return n$r.GenerateStreamRequest}});var o$r=uvt();Object.defineProperty(rs,"GenerateRequest",{enumerable:!0,get:function(){return o$r.GenerateRequest}});var i$r=lvt();Object.defineProperty(rs,"EmbedRequest",{enumerable:!0,get:function(){return i$r.EmbedRequest}});var a$r=cvt();Object.defineProperty(rs,"RerankRequest",{enumerable:!0,get:function(){return a$r.RerankRequest}});var s$r=dvt();Object.defineProperty(rs,"ClassifyRequest",{enumerable:!0,get:function(){return s$r.ClassifyRequest}});var u$r=fvt();Object.defineProperty(rs,"SummarizeRequest",{enumerable:!0,get:function(){return u$r.SummarizeRequest}});var l$r=pvt();Object.defineProperty(rs,"TokenizeRequest",{enumerable:!0,get:function(){return l$r.TokenizeRequest}});var c$r=mvt();Object.defineProperty(rs,"DetokenizeRequest",{enumerable:!0,get:function(){return c$r.DetokenizeRequest}})});var gvt=v(C1=>{"use strict";var d$r=C1&&C1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f$r=C1&&C1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&d$r(e,t,r)};Object.defineProperty(C1,"__esModule",{value:!0});f$r(hvt(),C1)});var qC=v(BC=>{"use strict";var p$r=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]}),OOe=BC&&BC.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&p$r(e,t,r)};Object.defineProperty(BC,"__esModule",{value:!0});OOe(i_t(),BC);OOe(ovt(),BC);OOe(gvt(),BC)});var POe=v(Ko=>{"use strict";var m$r=Ko&&Ko.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),h$r=Ko&&Ko.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g$r=Ko&&Ko.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&m$r(e,t,r);return h$r(e,t),e},see=Ko&&Ko.__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())})},y$r=Ko&&Ko.__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(Ko,"__esModule",{value:!0});Ko.fetchOverride=Ko.parseAWSEvent=Ko.getEndpointFromUrl=Ko.getAuthHeaders=Ko.getUrl=Ko.mapResponseFromBedrock=void 0;var b$r=fge(),_$r=(ust(),Al(sst)),v$r=mlt(),w$r=Act(),S$r=f3(),x$r=U(),C$r=q0e(),O$r=Kyt(),aH=g$r(qC()),P$r=(t,e)=>see(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),E$r={chat:aH.StreamedChatResponse,generate:aH.GenerateStreamedResponse},T$r={chat:aH.NonStreamedChatResponse,embed:aH.EmbedResponse,generate:aH.Generation},A$r=(t,e,r)=>see(void 0,void 0,void 0,function*(){let n=t?E$r[e]:T$r[e],o={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},i=yield n.parseOrThrow(r,o);return n.jsonOrThrow(i,o)});Ko.mapResponseFromBedrock=A$r;var I$r=(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]};Ko.getUrl=I$r;var M$r=(t,e,r,n,o,i)=>see(void 0,void 0,void 0,function*(){let a=(0,_$r.fromNodeProviderChain)(),s=yield P$r(()=>{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 w$r.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:b$r.Sha256});delete r.connection,r.host=t.hostname;let l=new v$r.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});Ko.getAuthHeaders=M$r;var R$r=(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}`)};Ko.getEndpointFromUrl=R$r;var j$r=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}}};Ko.parseAWSEvent=j$r;var D$r=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>see(void 0,void 0,void 0,function*(){var a,s;let u=i.url.split("/").pop(),l=i.body;console.assert(l.model,"model is required");let c=!!l.stream,d=(0,Ko.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,Ko.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,x$r.fetcher)(i);if(!p.ok)return p;try{if(c){let b=(0,C$r.readableStreamAsyncIterable)(p.body),g=new O$r.LineDecoder,_=new S$r.PassThrough;try{for(var m=y$r(b),h;h=yield m.next(),!h.done;){let w=h.value;for(let x of g.decode(w)){let C=(0,Ko.parseAWSEvent)(x);if(C){let E=yield(0,Ko.mapResponseFromBedrock)(c,u,C);_.push(JSON.stringify(E)+`
`)}}}}catch(w){a={error:w}}finally{try{h&&!h.done&&(s=m.return)&&(yield s.call(m))}finally{if(a)throw a.error}}for(let w of g.flush()){let x=(0,Ko.parseAWSEvent)(w);if(x){let C=yield(0,Ko.mapResponseFromBedrock)(c,u,x);_.push(JSON.stringify(C)+`
`)}}return _.end(),{ok:!0,body:_}}else{let b=yield p.body;return{ok:!0,body:yield(0,Ko.mapResponseFromBedrock)(c,u,b)}}}catch(b){throw b}});Ko.fetchOverride=D$r});var UC=v(uee=>{"use strict";Object.defineProperty(uee,"__esModule",{value:!0});uee.CohereEnvironment=void 0;uee.CohereEnvironment={Production:"https://api.cohere.com"}});var RT=v((yvt,lee)=>{(function(t,e,r){typeof lee<"u"&&lee.exports?lee.exports=r():typeof define=="function"&&define.amd?define(r):e[t]=r()})("urljoin",yvt,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 TOe=v(mp=>{"use strict";var N$r=mp&&mp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L$r=mp&&mp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sH=mp&&mp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&N$r(e,t,r);return L$r(e,t),e},cee=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())})},F$r=mp&&mp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mp,"__esModule",{value:!0});mp.V2=void 0;var bvt=sH(UC()),fp=sH(U()),ns=sH(fC()),pp=sH(qC()),_vt=F$r(RT()),zC=sH(ys()),EOe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return cee(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:fp.fetcher)({url:(0,_vt.default)((o=yield fp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:bvt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fp.Supplier.get(this._options.clientName))!=null?yield fp.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":fp.RUNTIME.type,"X-Fern-Runtime-Version":fp.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},pp.V2ChatStreamRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!0}),responseType:"sse",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return new fp.Stream({stream:i.body,parse:a=>cee(this,void 0,void 0,function*(){return pp.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 ns.BadRequestError(i.error.body);case 401:throw new ns.UnauthorizedError(i.error.body);case 403:throw new ns.ForbiddenError(i.error.body);case 404:throw new ns.NotFoundError(i.error.body);case 422:throw new ns.UnprocessableEntityError(pp.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ns.TooManyRequestsError(pp.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ns.ClientClosedRequestError(pp.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ns.InternalServerError(i.error.body);case 501:throw new ns.NotImplementedError(pp.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ns.ServiceUnavailableError(i.error.body);case 504:throw new ns.GatewayTimeoutError(pp.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new zC.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new zC.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new zC.CohereTimeoutError;case"unknown":throw new zC.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return cee(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:fp.fetcher)({url:(0,_vt.default)((o=yield fp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:bvt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fp.Supplier.get(this._options.clientName))!=null?yield fp.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":fp.RUNTIME.type,"X-Fern-Runtime-Version":fp.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},pp.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 pp.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 ns.BadRequestError(i.error.body);case 401:throw new ns.UnauthorizedError(i.error.body);case 403:throw new ns.ForbiddenError(i.error.body);case 404:throw new ns.NotFoundError(i.error.body);case 422:throw new ns.UnprocessableEntityError(pp.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ns.TooManyRequestsError(pp.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ns.ClientClosedRequestError(pp.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ns.InternalServerError(i.error.body);case 501:throw new ns.NotImplementedError(pp.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ns.ServiceUnavailableError(i.error.body);case 504:throw new ns.GatewayTimeoutError(pp.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new zC.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new zC.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new zC.CohereTimeoutError;case"unknown":throw new zC.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return cee(this,void 0,void 0,function*(){let r=(e=yield fp.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new zC.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};mp.V2=EOe});var vvt=v(hp=>{"use strict";var k$r=hp&&hp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$$r=hp&&hp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lH=hp&&hp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&k$r(e,t,r);return $$r(e,t),e},uH=hp&&hp.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},B$r=hp&&hp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hp,"__esModule",{value:!0});hp.EmbedJobs=void 0;var dee=lH(UC()),Xi=lH(U()),Mr=lH(fC()),fee=B$r(RT()),ya=lH(qC()),Ic=lH(ys()),AOe=class{constructor(e={}){this._options=e}list(e){var r,n;return uH(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Xi.fetcher)({url:(0,fee.default)((n=yield Xi.Supplier.get(this._options.environment))!==null&&n!==void 0?n:dee.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xi.Supplier.get(this._options.clientName))!=null?yield Xi.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":Xi.RUNTIME.type,"X-Fern-Runtime-Version":Xi.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 ya.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 Mr.BadRequestError(o.error.body);case 401:throw new Mr.UnauthorizedError(o.error.body);case 403:throw new Mr.ForbiddenError(o.error.body);case 404:throw new Mr.NotFoundError(o.error.body);case 422:throw new Mr.UnprocessableEntityError(ya.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Mr.TooManyRequestsError(ya.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Mr.ClientClosedRequestError(ya.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Mr.InternalServerError(o.error.body);case 501:throw new Mr.NotImplementedError(ya.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Mr.ServiceUnavailableError(o.error.body);case 504:throw new Mr.GatewayTimeoutError(ya.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ic.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Ic.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Ic.CohereTimeoutError;case"unknown":throw new Ic.CohereError({message:o.error.errorMessage})}})}create(e,r){var n,o;return uH(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xi.fetcher)({url:(0,fee.default)((o=yield Xi.Supplier.get(this._options.environment))!==null&&o!==void 0?o:dee.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xi.Supplier.get(this._options.clientName))!=null?yield Xi.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":Xi.RUNTIME.type,"X-Fern-Runtime-Version":Xi.RUNTIME.version},contentType:"application/json",requestType:"json",body:ya.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 ya.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 Mr.BadRequestError(i.error.body);case 401:throw new Mr.UnauthorizedError(i.error.body);case 403:throw new Mr.ForbiddenError(i.error.body);case 404:throw new Mr.NotFoundError(i.error.body);case 422:throw new Mr.UnprocessableEntityError(ya.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Mr.TooManyRequestsError(ya.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Mr.ClientClosedRequestError(ya.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Mr.InternalServerError(i.error.body);case 501:throw new Mr.NotImplementedError(ya.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Mr.ServiceUnavailableError(i.error.body);case 504:throw new Mr.GatewayTimeoutError(ya.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})}})}get(e,r){var n,o;return uH(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xi.fetcher)({url:(0,fee.default)((o=yield Xi.Supplier.get(this._options.environment))!==null&&o!==void 0?o:dee.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xi.Supplier.get(this._options.clientName))!=null?yield Xi.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":Xi.RUNTIME.type,"X-Fern-Runtime-Version":Xi.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 ya.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 Mr.BadRequestError(i.error.body);case 401:throw new Mr.UnauthorizedError(i.error.body);case 403:throw new Mr.ForbiddenError(i.error.body);case 404:throw new Mr.NotFoundError(i.error.body);case 422:throw new Mr.UnprocessableEntityError(ya.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Mr.TooManyRequestsError(ya.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Mr.ClientClosedRequestError(ya.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Mr.InternalServerError(i.error.body);case 501:throw new Mr.NotImplementedError(ya.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Mr.ServiceUnavailableError(i.error.body);case 504:throw new Mr.GatewayTimeoutError(ya.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})}})}cancel(e,r){var n,o;return uH(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xi.fetcher)({url:(0,fee.default)((o=yield Xi.Supplier.get(this._options.environment))!==null&&o!==void 0?o:dee.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}/cancel`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xi.Supplier.get(this._options.clientName))!=null?yield Xi.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":Xi.RUNTIME.type,"X-Fern-Runtime-Version":Xi.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 Mr.BadRequestError(i.error.body);case 401:throw new Mr.UnauthorizedError(i.error.body);case 403:throw new Mr.ForbiddenError(i.error.body);case 404:throw new Mr.NotFoundError(i.error.body);case 422:throw new Mr.UnprocessableEntityError(ya.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Mr.TooManyRequestsError(ya.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Mr.ClientClosedRequestError(ya.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Mr.InternalServerError(i.error.body);case 501:throw new Mr.NotImplementedError(ya.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Mr.ServiceUnavailableError(i.error.body);case 504:throw new Mr.GatewayTimeoutError(ya.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 uH(this,void 0,void 0,function*(){let r=(e=yield Xi.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}`})}};hp.EmbedJobs=AOe});var wvt=v(gp=>{"use strict";var q$r=gp&&gp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),U$r=gp&&gp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fH=gp&&gp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q$r(e,t,r);return U$r(e,t),e},Wk=gp&&gp.__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())})},z$r=gp&&gp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gp,"__esModule",{value:!0});gp.Datasets=void 0;var cH=fH(UC()),yo=fH(U()),Wt=fH(fC()),dH=z$r(RT()),ei=fH(qC()),Ss=fH(ys()),IOe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return Wk(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:yo.fetcher)({url:(0,dH.default)((o=yield yo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:cH.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield yo.Supplier.get(this._options.clientName))!=null?yield yo.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":yo.RUNTIME.type,"X-Fern-Runtime-Version":yo.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 ei.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 Wt.BadRequestError(f.error.body);case 401:throw new Wt.UnauthorizedError(f.error.body);case 403:throw new Wt.ForbiddenError(f.error.body);case 404:throw new Wt.NotFoundError(f.error.body);case 422:throw new Wt.UnprocessableEntityError(ei.UnprocessableEntityErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Wt.TooManyRequestsError(ei.TooManyRequestsErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Wt.ClientClosedRequestError(ei.ClientClosedRequestErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Wt.InternalServerError(f.error.body);case 501:throw new Wt.NotImplementedError(ei.NotImplementedErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Wt.ServiceUnavailableError(f.error.body);case 504:throw new Wt.GatewayTimeoutError(ei.GatewayTimeoutErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ss.CohereError({statusCode:f.error.statusCode,body:f.error.body})}switch(f.error.reason){case"non-json":throw new Ss.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody});case"timeout":throw new Ss.CohereTimeoutError;case"unknown":throw new Ss.CohereError({message:f.error.errorMessage})}})}create(e,r,n,o){var i,a;return Wk(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 yo.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:yo.fetcher)({url:(0,dH.default)((a=yield yo.Supplier.get(this._options.environment))!==null&&a!==void 0?a:cH.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield yo.Supplier.get(this._options.clientName))!=null?yield yo.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":yo.RUNTIME.type,"X-Fern-Runtime-Version":yo.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 ei.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 Wt.BadRequestError(c.error.body);case 401:throw new Wt.UnauthorizedError(c.error.body);case 403:throw new Wt.ForbiddenError(c.error.body);case 404:throw new Wt.NotFoundError(c.error.body);case 422:throw new Wt.UnprocessableEntityError(ei.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Wt.TooManyRequestsError(ei.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Wt.ClientClosedRequestError(ei.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Wt.InternalServerError(c.error.body);case 501:throw new Wt.NotImplementedError(ei.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Wt.ServiceUnavailableError(c.error.body);case 504:throw new Wt.GatewayTimeoutError(ei.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ss.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new Ss.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new Ss.CohereTimeoutError;case"unknown":throw new Ss.CohereError({message:c.error.errorMessage})}})}getUsage(e){var r,n;return Wk(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:yo.fetcher)({url:(0,dH.default)((n=yield yo.Supplier.get(this._options.environment))!==null&&n!==void 0?n:cH.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield yo.Supplier.get(this._options.clientName))!=null?yield yo.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":yo.RUNTIME.type,"X-Fern-Runtime-Version":yo.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 ei.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 Wt.BadRequestError(o.error.body);case 401:throw new Wt.UnauthorizedError(o.error.body);case 403:throw new Wt.ForbiddenError(o.error.body);case 404:throw new Wt.NotFoundError(o.error.body);case 422:throw new Wt.UnprocessableEntityError(ei.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Wt.TooManyRequestsError(ei.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Wt.ClientClosedRequestError(ei.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Wt.InternalServerError(o.error.body);case 501:throw new Wt.NotImplementedError(ei.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Wt.ServiceUnavailableError(o.error.body);case 504:throw new Wt.GatewayTimeoutError(ei.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ss.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Ss.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Ss.CohereTimeoutError;case"unknown":throw new Ss.CohereError({message:o.error.errorMessage})}})}get(e,r){var n,o;return Wk(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:yo.fetcher)({url:(0,dH.default)((o=yield yo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:cH.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield yo.Supplier.get(this._options.clientName))!=null?yield yo.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":yo.RUNTIME.type,"X-Fern-Runtime-Version":yo.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 ei.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 Wt.BadRequestError(i.error.body);case 401:throw new Wt.UnauthorizedError(i.error.body);case 403:throw new Wt.ForbiddenError(i.error.body);case 404:throw new Wt.NotFoundError(i.error.body);case 422:throw new Wt.UnprocessableEntityError(ei.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Wt.TooManyRequestsError(ei.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Wt.ClientClosedRequestError(ei.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Wt.InternalServerError(i.error.body);case 501:throw new Wt.NotImplementedError(ei.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Wt.ServiceUnavailableError(i.error.body);case 504:throw new Wt.GatewayTimeoutError(ei.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ss.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ss.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ss.CohereTimeoutError;case"unknown":throw new Ss.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return Wk(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:yo.fetcher)({url:(0,dH.default)((o=yield yo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:cH.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield yo.Supplier.get(this._options.clientName))!=null?yield yo.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":yo.RUNTIME.type,"X-Fern-Runtime-Version":yo.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 ei.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 Wt.BadRequestError(i.error.body);case 401:throw new Wt.UnauthorizedError(i.error.body);case 403:throw new Wt.ForbiddenError(i.error.body);case 404:throw new Wt.NotFoundError(i.error.body);case 422:throw new Wt.UnprocessableEntityError(ei.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Wt.TooManyRequestsError(ei.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Wt.ClientClosedRequestError(ei.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Wt.InternalServerError(i.error.body);case 501:throw new Wt.NotImplementedError(ei.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Wt.ServiceUnavailableError(i.error.body);case 504:throw new Wt.GatewayTimeoutError(ei.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ss.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ss.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ss.CohereTimeoutError;case"unknown":throw new Ss.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return Wk(this,void 0,void 0,function*(){let r=(e=yield yo.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Ss.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};gp.Datasets=IOe});var Svt=v(yp=>{"use strict";var H$r=yp&&yp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V$r=yp&&yp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pH=yp&&yp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&H$r(e,t,r);return V$r(e,t),e},O1=yp&&yp.__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())})},W$r=yp&&yp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yp,"__esModule",{value:!0});yp.Connectors=void 0;var Kk=pH(UC()),xn=pH(U()),bt=pH(fC()),Jk=W$r(RT()),bn=pH(qC()),Qi=pH(ys()),MOe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return O1(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:xn.fetcher)({url:(0,Jk.default)((o=yield xn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Kk.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xn.Supplier.get(this._options.clientName))!=null?yield xn.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":xn.RUNTIME.type,"X-Fern-Runtime-Version":xn.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 bn.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 bt.BadRequestError(u.error.body);case 401:throw new bt.UnauthorizedError(u.error.body);case 403:throw new bt.ForbiddenError(u.error.body);case 404:throw new bt.NotFoundError(u.error.body);case 422:throw new bt.UnprocessableEntityError(bn.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new bt.TooManyRequestsError(bn.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new bt.ClientClosedRequestError(bn.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new bt.InternalServerError(u.error.body);case 501:throw new bt.NotImplementedError(bn.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new bt.ServiceUnavailableError(u.error.body);case 504:throw new bt.GatewayTimeoutError(bn.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qi.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new Qi.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new Qi.CohereTimeoutError;case"unknown":throw new Qi.CohereError({message:u.error.errorMessage})}})}create(e,r){var n,o;return O1(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xn.fetcher)({url:(0,Jk.default)((o=yield xn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Kk.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xn.Supplier.get(this._options.clientName))!=null?yield xn.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":xn.RUNTIME.type,"X-Fern-Runtime-Version":xn.RUNTIME.version},contentType:"application/json",requestType:"json",body:bn.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 bn.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 bt.BadRequestError(i.error.body);case 401:throw new bt.UnauthorizedError(i.error.body);case 403:throw new bt.ForbiddenError(i.error.body);case 404:throw new bt.NotFoundError(i.error.body);case 422:throw new bt.UnprocessableEntityError(bn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new bt.TooManyRequestsError(bn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new bt.ClientClosedRequestError(bn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new bt.InternalServerError(i.error.body);case 501:throw new bt.NotImplementedError(bn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new bt.ServiceUnavailableError(i.error.body);case 504:throw new bt.GatewayTimeoutError(bn.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Qi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Qi.CohereTimeoutError;case"unknown":throw new Qi.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return O1(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xn.fetcher)({url:(0,Jk.default)((o=yield xn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Kk.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xn.Supplier.get(this._options.clientName))!=null?yield xn.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":xn.RUNTIME.type,"X-Fern-Runtime-Version":xn.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 bn.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 bt.BadRequestError(i.error.body);case 401:throw new bt.UnauthorizedError(i.error.body);case 403:throw new bt.ForbiddenError(i.error.body);case 404:throw new bt.NotFoundError(i.error.body);case 422:throw new bt.UnprocessableEntityError(bn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new bt.TooManyRequestsError(bn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new bt.ClientClosedRequestError(bn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new bt.InternalServerError(i.error.body);case 501:throw new bt.NotImplementedError(bn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new bt.ServiceUnavailableError(i.error.body);case 504:throw new bt.GatewayTimeoutError(bn.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Qi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Qi.CohereTimeoutError;case"unknown":throw new Qi.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return O1(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:xn.fetcher)({url:(0,Jk.default)((o=yield xn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Kk.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xn.Supplier.get(this._options.clientName))!=null?yield xn.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":xn.RUNTIME.type,"X-Fern-Runtime-Version":xn.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 bn.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 bt.BadRequestError(i.error.body);case 401:throw new bt.UnauthorizedError(i.error.body);case 403:throw new bt.ForbiddenError(i.error.body);case 404:throw new bt.NotFoundError(i.error.body);case 422:throw new bt.UnprocessableEntityError(bn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new bt.TooManyRequestsError(bn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new bt.ClientClosedRequestError(bn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new bt.InternalServerError(i.error.body);case 501:throw new bt.NotImplementedError(bn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new bt.ServiceUnavailableError(i.error.body);case 504:throw new bt.GatewayTimeoutError(bn.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Qi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Qi.CohereTimeoutError;case"unknown":throw new Qi.CohereError({message:i.error.errorMessage})}})}update(e,r={},n){var o,i;return O1(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:xn.fetcher)({url:(0,Jk.default)((i=yield xn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Kk.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xn.Supplier.get(this._options.clientName))!=null?yield xn.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":xn.RUNTIME.type,"X-Fern-Runtime-Version":xn.RUNTIME.version},contentType:"application/json",requestType:"json",body:bn.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 bn.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 bt.BadRequestError(a.error.body);case 401:throw new bt.UnauthorizedError(a.error.body);case 403:throw new bt.ForbiddenError(a.error.body);case 404:throw new bt.NotFoundError(a.error.body);case 422:throw new bt.UnprocessableEntityError(bn.UnprocessableEntityErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new bt.TooManyRequestsError(bn.TooManyRequestsErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new bt.ClientClosedRequestError(bn.ClientClosedRequestErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new bt.InternalServerError(a.error.body);case 501:throw new bt.NotImplementedError(bn.NotImplementedErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new bt.ServiceUnavailableError(a.error.body);case 504:throw new bt.GatewayTimeoutError(bn.GatewayTimeoutErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qi.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new Qi.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new Qi.CohereTimeoutError;case"unknown":throw new Qi.CohereError({message:a.error.errorMessage})}})}oAuthAuthorize(e,r={},n){var o,i;return O1(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:xn.fetcher)({url:(0,Jk.default)((i=yield xn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Kk.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}/oauth/authorize`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield xn.Supplier.get(this._options.clientName))!=null?yield xn.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":xn.RUNTIME.type,"X-Fern-Runtime-Version":xn.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 bn.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 bt.BadRequestError(u.error.body);case 401:throw new bt.UnauthorizedError(u.error.body);case 403:throw new bt.ForbiddenError(u.error.body);case 404:throw new bt.NotFoundError(u.error.body);case 422:throw new bt.UnprocessableEntityError(bn.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new bt.TooManyRequestsError(bn.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new bt.ClientClosedRequestError(bn.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new bt.InternalServerError(u.error.body);case 501:throw new bt.NotImplementedError(bn.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new bt.ServiceUnavailableError(u.error.body);case 504:throw new bt.GatewayTimeoutError(bn.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Qi.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new Qi.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new Qi.CohereTimeoutError;case"unknown":throw new Qi.CohereError({message:u.error.errorMessage})}})}_getAuthorizationHeader(){var e;return O1(this,void 0,void 0,function*(){let r=(e=yield xn.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Qi.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};yp.Connectors=MOe});var Ovt=v(bp=>{"use strict";var K$r=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]}),J$r=bp&&bp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mH=bp&&bp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K$r(e,t,r);return J$r(e,t),e},ROe=bp&&bp.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},G$r=bp&&bp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(bp,"__esModule",{value:!0});bp.Models=void 0;var xvt=mH(UC()),gm=mH(U()),os=mH(fC()),Cvt=G$r(RT()),Mh=mH(qC()),HC=mH(ys()),jOe=class{constructor(e={}){this._options=e}get(e,r){var n,o;return ROe(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:gm.fetcher)({url:(0,Cvt.default)((o=yield gm.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xvt.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield gm.Supplier.get(this._options.clientName))!=null?yield gm.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":gm.RUNTIME.type,"X-Fern-Runtime-Version":gm.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 Mh.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 os.BadRequestError(i.error.body);case 401:throw new os.UnauthorizedError(i.error.body);case 403:throw new os.ForbiddenError(i.error.body);case 404:throw new os.NotFoundError(i.error.body);case 422:throw new os.UnprocessableEntityError(Mh.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new os.TooManyRequestsError(Mh.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new os.ClientClosedRequestError(Mh.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new os.InternalServerError(i.error.body);case 501:throw new os.NotImplementedError(Mh.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new os.ServiceUnavailableError(i.error.body);case 504:throw new os.GatewayTimeoutError(Mh.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new HC.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new HC.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new HC.CohereTimeoutError;case"unknown":throw new HC.CohereError({message:i.error.errorMessage})}})}list(e={},r){var n,o;return ROe(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:gm.fetcher)({url:(0,Cvt.default)((o=yield gm.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xvt.CohereEnvironment.Production,"v1/models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield gm.Supplier.get(this._options.clientName))!=null?yield gm.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":gm.RUNTIME.type,"X-Fern-Runtime-Version":gm.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 Mh.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 os.BadRequestError(c.error.body);case 401:throw new os.UnauthorizedError(c.error.body);case 403:throw new os.ForbiddenError(c.error.body);case 404:throw new os.NotFoundError(c.error.body);case 422:throw new os.UnprocessableEntityError(Mh.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new os.TooManyRequestsError(Mh.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new os.ClientClosedRequestError(Mh.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new os.InternalServerError(c.error.body);case 501:throw new os.NotImplementedError(Mh.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new os.ServiceUnavailableError(c.error.body);case 504:throw new os.GatewayTimeoutError(Mh.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new HC.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new HC.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new HC.CohereTimeoutError;case"unknown":throw new HC.CohereError({message:c.error.errorMessage})}})}_getAuthorizationHeader(){var e;return ROe(this,void 0,void 0,function*(){let r=(e=yield gm.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new HC.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};bp.Models=jOe});var Pvt=v(_p=>{"use strict";var Y$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]}),Z$r=_p&&_p.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hH=_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)&&Y$r(e,t,r);return Z$r(e,t),e},jT=_p&&_p.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},X$r=_p&&_p.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_p,"__esModule",{value:!0});_p.Finetuning=void 0;var P1=hH(UC()),Nr=hH(U()),Hr=hH(fC()),E1=X$r(RT()),VC=hH(qC()),li=hH(ys()),DOe=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){var n,o;return jT(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:Nr.fetcher)({url:(0,E1.default)((o=yield Nr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:P1.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Nr.Supplier.get(this._options.clientName))!=null?yield Nr.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":Nr.RUNTIME.type,"X-Fern-Runtime-Version":Nr.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 VC.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 Hr.BadRequestError(l.error.body);case 401:throw new Hr.UnauthorizedError(l.error.body);case 403:throw new Hr.ForbiddenError(l.error.body);case 404:throw new Hr.NotFoundError(l.error.body);case 500:throw new Hr.InternalServerError(l.error.body);case 503:throw new Hr.ServiceUnavailableError(l.error.body);default:throw new li.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new li.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new li.CohereTimeoutError;case"unknown":throw new li.CohereError({message:l.error.errorMessage})}})}createFinetunedModel(e,r){var n,o;return jT(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Nr.fetcher)({url:(0,E1.default)((o=yield Nr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:P1.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Nr.Supplier.get(this._options.clientName))!=null?yield Nr.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":Nr.RUNTIME.type,"X-Fern-Runtime-Version":Nr.RUNTIME.version},contentType:"application/json",requestType:"json",body:VC.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 VC.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 Hr.BadRequestError(i.error.body);case 401:throw new Hr.UnauthorizedError(i.error.body);case 403:throw new Hr.ForbiddenError(i.error.body);case 404:throw new Hr.NotFoundError(i.error.body);case 500:throw new Hr.InternalServerError(i.error.body);case 503:throw new Hr.ServiceUnavailableError(i.error.body);default:throw new li.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new li.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new li.CohereTimeoutError;case"unknown":throw new li.CohereError({message:i.error.errorMessage})}})}getFinetunedModel(e,r){var n,o;return jT(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Nr.fetcher)({url:(0,E1.default)((o=yield Nr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:P1.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Nr.Supplier.get(this._options.clientName))!=null?yield Nr.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":Nr.RUNTIME.type,"X-Fern-Runtime-Version":Nr.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 VC.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 Hr.BadRequestError(i.error.body);case 401:throw new Hr.UnauthorizedError(i.error.body);case 403:throw new Hr.ForbiddenError(i.error.body);case 404:throw new Hr.NotFoundError(i.error.body);case 500:throw new Hr.InternalServerError(i.error.body);case 503:throw new Hr.ServiceUnavailableError(i.error.body);default:throw new li.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new li.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new li.CohereTimeoutError;case"unknown":throw new li.CohereError({message:i.error.errorMessage})}})}deleteFinetunedModel(e,r){var n,o;return jT(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Nr.fetcher)({url:(0,E1.default)((o=yield Nr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:P1.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Nr.Supplier.get(this._options.clientName))!=null?yield Nr.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":Nr.RUNTIME.type,"X-Fern-Runtime-Version":Nr.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 VC.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 Hr.BadRequestError(i.error.body);case 401:throw new Hr.UnauthorizedError(i.error.body);case 403:throw new Hr.ForbiddenError(i.error.body);case 404:throw new Hr.NotFoundError(i.error.body);case 500:throw new Hr.InternalServerError(i.error.body);case 503:throw new Hr.ServiceUnavailableError(i.error.body);default:throw new li.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new li.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new li.CohereTimeoutError;case"unknown":throw new li.CohereError({message:i.error.errorMessage})}})}updateFinetunedModel(e,r,n){var o,i;return jT(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:Nr.fetcher)({url:(0,E1.default)((i=yield Nr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:P1.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Nr.Supplier.get(this._options.clientName))!=null?yield Nr.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":Nr.RUNTIME.type,"X-Fern-Runtime-Version":Nr.RUNTIME.version},contentType:"application/json",requestType:"json",body:VC.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 VC.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 Hr.BadRequestError(a.error.body);case 401:throw new Hr.UnauthorizedError(a.error.body);case 403:throw new Hr.ForbiddenError(a.error.body);case 404:throw new Hr.NotFoundError(a.error.body);case 500:throw new Hr.InternalServerError(a.error.body);case 503:throw new Hr.ServiceUnavailableError(a.error.body);default:throw new li.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new li.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new li.CohereTimeoutError;case"unknown":throw new li.CohereError({message:a.error.errorMessage})}})}listEvents(e,r={},n){var o,i;return jT(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:Nr.fetcher)({url:(0,E1.default)((i=yield Nr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:P1.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/events`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Nr.Supplier.get(this._options.clientName))!=null?yield Nr.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":Nr.RUNTIME.type,"X-Fern-Runtime-Version":Nr.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 VC.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 Hr.BadRequestError(c.error.body);case 401:throw new Hr.UnauthorizedError(c.error.body);case 403:throw new Hr.ForbiddenError(c.error.body);case 404:throw new Hr.NotFoundError(c.error.body);case 500:throw new Hr.InternalServerError(c.error.body);case 503:throw new Hr.ServiceUnavailableError(c.error.body);default:throw new li.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new li.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new li.CohereTimeoutError;case"unknown":throw new li.CohereError({message:c.error.errorMessage})}})}listTrainingStepMetrics(e,r={},n){var o,i;return jT(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:Nr.fetcher)({url:(0,E1.default)((i=yield Nr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:P1.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/training-step-metrics`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Nr.Supplier.get(this._options.clientName))!=null?yield Nr.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":Nr.RUNTIME.type,"X-Fern-Runtime-Version":Nr.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 VC.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 Hr.BadRequestError(l.error.body);case 401:throw new Hr.UnauthorizedError(l.error.body);case 403:throw new Hr.ForbiddenError(l.error.body);case 404:throw new Hr.NotFoundError(l.error.body);case 500:throw new Hr.InternalServerError(l.error.body);case 503:throw new Hr.ServiceUnavailableError(l.error.body);default:throw new li.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new li.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new li.CohereTimeoutError;case"unknown":throw new li.CohereError({message:l.error.errorMessage})}})}_getAuthorizationHeader(){var e;return jT(this,void 0,void 0,function*(){let r=(e=yield Nr.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new li.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};_p.Finetuning=DOe});var pee=v(wp=>{"use strict";var Q$r=wp&&wp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eBr=wp&&wp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gH=wp&&wp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Q$r(e,t,r);return eBr(e,t),e},vp=wp&&wp.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},tBr=wp&&wp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wp,"__esModule",{value:!0});wp.CohereClient=void 0;var ny=gH(UC()),dt=gH(U()),be=gH(fC()),rt=gH(qC()),oy=tBr(RT()),Tr=gH(ys()),rBr=TOe(),nBr=vvt(),oBr=wvt(),iBr=Svt(),aBr=Ovt(),sBr=Pvt(),NOe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:dt.fetcher)({url:(0,oy.default)((o=yield dt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ny.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield dt.Supplier.get(this._options.clientName))!=null?yield dt.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":dt.RUNTIME.type,"X-Fern-Runtime-Version":dt.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},rt.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 dt.Stream({stream:i.body,parse:a=>vp(this,void 0,void 0,function*(){return rt.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 be.BadRequestError(i.error.body);case 401:throw new be.UnauthorizedError(i.error.body);case 403:throw new be.ForbiddenError(i.error.body);case 404:throw new be.NotFoundError(i.error.body);case 422:throw new be.UnprocessableEntityError(rt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new be.TooManyRequestsError(rt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new be.ClientClosedRequestError(rt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new be.InternalServerError(i.error.body);case 501:throw new be.NotImplementedError(rt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new be.ServiceUnavailableError(i.error.body);case 504:throw new be.GatewayTimeoutError(rt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Tr.CohereTimeoutError;case"unknown":throw new Tr.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:dt.fetcher)({url:(0,oy.default)((o=yield dt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ny.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield dt.Supplier.get(this._options.clientName))!=null?yield dt.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":dt.RUNTIME.type,"X-Fern-Runtime-Version":dt.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},rt.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 rt.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 be.BadRequestError(i.error.body);case 401:throw new be.UnauthorizedError(i.error.body);case 403:throw new be.ForbiddenError(i.error.body);case 404:throw new be.NotFoundError(i.error.body);case 422:throw new be.UnprocessableEntityError(rt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new be.TooManyRequestsError(rt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new be.ClientClosedRequestError(rt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new be.InternalServerError(i.error.body);case 501:throw new be.NotImplementedError(rt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new be.ServiceUnavailableError(i.error.body);case 504:throw new be.GatewayTimeoutError(rt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Tr.CohereTimeoutError;case"unknown":throw new Tr.CohereError({message:i.error.errorMessage})}})}generateStream(e,r){var n,o;return vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:dt.fetcher)({url:(0,oy.default)((o=yield dt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ny.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield dt.Supplier.get(this._options.clientName))!=null?yield dt.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":dt.RUNTIME.type,"X-Fern-Runtime-Version":dt.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},rt.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 dt.Stream({stream:i.body,parse:a=>vp(this,void 0,void 0,function*(){return rt.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 be.BadRequestError(i.error.body);case 401:throw new be.UnauthorizedError(i.error.body);case 403:throw new be.ForbiddenError(i.error.body);case 404:throw new be.NotFoundError(i.error.body);case 422:throw new be.UnprocessableEntityError(rt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new be.TooManyRequestsError(rt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new be.ClientClosedRequestError(rt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new be.InternalServerError(i.error.body);case 501:throw new be.NotImplementedError(rt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new be.ServiceUnavailableError(i.error.body);case 504:throw new be.GatewayTimeoutError(rt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Tr.CohereTimeoutError;case"unknown":throw new Tr.CohereError({message:i.error.errorMessage})}})}generate(e,r){var n,o;return vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:dt.fetcher)({url:(0,oy.default)((o=yield dt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ny.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield dt.Supplier.get(this._options.clientName))!=null?yield dt.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":dt.RUNTIME.type,"X-Fern-Runtime-Version":dt.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},rt.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 rt.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 be.BadRequestError(i.error.body);case 401:throw new be.UnauthorizedError(i.error.body);case 403:throw new be.ForbiddenError(i.error.body);case 404:throw new be.NotFoundError(i.error.body);case 422:throw new be.UnprocessableEntityError(rt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new be.TooManyRequestsError(rt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new be.ClientClosedRequestError(rt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new be.InternalServerError(i.error.body);case 501:throw new be.NotImplementedError(rt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new be.ServiceUnavailableError(i.error.body);case 504:throw new be.GatewayTimeoutError(rt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Tr.CohereTimeoutError;case"unknown":throw new Tr.CohereError({message:i.error.errorMessage})}})}embed(e,r){var n,o;return vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:dt.fetcher)({url:(0,oy.default)((o=yield dt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ny.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield dt.Supplier.get(this._options.clientName))!=null?yield dt.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":dt.RUNTIME.type,"X-Fern-Runtime-Version":dt.RUNTIME.version},contentType:"application/json",requestType:"json",body:rt.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 rt.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 be.BadRequestError(i.error.body);case 401:throw new be.UnauthorizedError(i.error.body);case 403:throw new be.ForbiddenError(i.error.body);case 404:throw new be.NotFoundError(i.error.body);case 422:throw new be.UnprocessableEntityError(rt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new be.TooManyRequestsError(rt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new be.ClientClosedRequestError(rt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new be.InternalServerError(i.error.body);case 501:throw new be.NotImplementedError(rt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new be.ServiceUnavailableError(i.error.body);case 504:throw new be.GatewayTimeoutError(rt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Tr.CohereTimeoutError;case"unknown":throw new Tr.CohereError({message:i.error.errorMessage})}})}rerank(e,r){var n,o;return vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:dt.fetcher)({url:(0,oy.default)((o=yield dt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ny.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield dt.Supplier.get(this._options.clientName))!=null?yield dt.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":dt.RUNTIME.type,"X-Fern-Runtime-Version":dt.RUNTIME.version},contentType:"application/json",requestType:"json",body:rt.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 rt.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 be.BadRequestError(i.error.body);case 401:throw new be.UnauthorizedError(i.error.body);case 403:throw new be.ForbiddenError(i.error.body);case 404:throw new be.NotFoundError(i.error.body);case 422:throw new be.UnprocessableEntityError(rt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new be.TooManyRequestsError(rt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new be.ClientClosedRequestError(rt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new be.InternalServerError(i.error.body);case 501:throw new be.NotImplementedError(rt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new be.ServiceUnavailableError(i.error.body);case 504:throw new be.GatewayTimeoutError(rt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Tr.CohereTimeoutError;case"unknown":throw new Tr.CohereError({message:i.error.errorMessage})}})}classify(e,r){var n,o;return vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:dt.fetcher)({url:(0,oy.default)((o=yield dt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ny.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield dt.Supplier.get(this._options.clientName))!=null?yield dt.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":dt.RUNTIME.type,"X-Fern-Runtime-Version":dt.RUNTIME.version},contentType:"application/json",requestType:"json",body:rt.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 rt.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 be.BadRequestError(i.error.body);case 401:throw new be.UnauthorizedError(i.error.body);case 403:throw new be.ForbiddenError(i.error.body);case 404:throw new be.NotFoundError(i.error.body);case 422:throw new be.UnprocessableEntityError(rt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new be.TooManyRequestsError(rt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new be.ClientClosedRequestError(rt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new be.InternalServerError(i.error.body);case 501:throw new be.NotImplementedError(rt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new be.ServiceUnavailableError(i.error.body);case 504:throw new be.GatewayTimeoutError(rt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Tr.CohereTimeoutError;case"unknown":throw new Tr.CohereError({message:i.error.errorMessage})}})}summarize(e,r){var n,o;return vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:dt.fetcher)({url:(0,oy.default)((o=yield dt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ny.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield dt.Supplier.get(this._options.clientName))!=null?yield dt.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":dt.RUNTIME.type,"X-Fern-Runtime-Version":dt.RUNTIME.version},contentType:"application/json",requestType:"json",body:rt.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 rt.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 be.BadRequestError(i.error.body);case 401:throw new be.UnauthorizedError(i.error.body);case 403:throw new be.ForbiddenError(i.error.body);case 404:throw new be.NotFoundError(i.error.body);case 422:throw new be.UnprocessableEntityError(rt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new be.TooManyRequestsError(rt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new be.ClientClosedRequestError(rt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new be.InternalServerError(i.error.body);case 501:throw new be.NotImplementedError(rt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new be.ServiceUnavailableError(i.error.body);case 504:throw new be.GatewayTimeoutError(rt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Tr.CohereTimeoutError;case"unknown":throw new Tr.CohereError({message:i.error.errorMessage})}})}tokenize(e,r){var n,o;return vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:dt.fetcher)({url:(0,oy.default)((o=yield dt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ny.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield dt.Supplier.get(this._options.clientName))!=null?yield dt.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":dt.RUNTIME.type,"X-Fern-Runtime-Version":dt.RUNTIME.version},contentType:"application/json",requestType:"json",body:rt.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 rt.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 be.BadRequestError(i.error.body);case 401:throw new be.UnauthorizedError(i.error.body);case 403:throw new be.ForbiddenError(i.error.body);case 404:throw new be.NotFoundError(i.error.body);case 422:throw new be.UnprocessableEntityError(rt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new be.TooManyRequestsError(rt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new be.ClientClosedRequestError(rt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new be.InternalServerError(i.error.body);case 501:throw new be.NotImplementedError(rt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new be.ServiceUnavailableError(i.error.body);case 504:throw new be.GatewayTimeoutError(rt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Tr.CohereTimeoutError;case"unknown":throw new Tr.CohereError({message:i.error.errorMessage})}})}detokenize(e,r){var n,o;return vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:dt.fetcher)({url:(0,oy.default)((o=yield dt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ny.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield dt.Supplier.get(this._options.clientName))!=null?yield dt.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":dt.RUNTIME.type,"X-Fern-Runtime-Version":dt.RUNTIME.version},contentType:"application/json",requestType:"json",body:rt.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 rt.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 be.BadRequestError(i.error.body);case 401:throw new be.UnauthorizedError(i.error.body);case 403:throw new be.ForbiddenError(i.error.body);case 404:throw new be.NotFoundError(i.error.body);case 422:throw new be.UnprocessableEntityError(rt.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new be.TooManyRequestsError(rt.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new be.ClientClosedRequestError(rt.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new be.InternalServerError(i.error.body);case 501:throw new be.NotImplementedError(rt.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new be.ServiceUnavailableError(i.error.body);case 504:throw new be.GatewayTimeoutError(rt.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Tr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Tr.CohereTimeoutError;case"unknown":throw new Tr.CohereError({message:i.error.errorMessage})}})}checkApiKey(e){var r,n;return vp(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:dt.fetcher)({url:(0,oy.default)((n=yield dt.Supplier.get(this._options.environment))!==null&&n!==void 0?n:ny.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield dt.Supplier.get(this._options.clientName))!=null?yield dt.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":dt.RUNTIME.type,"X-Fern-Runtime-Version":dt.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 rt.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 be.BadRequestError(o.error.body);case 401:throw new be.UnauthorizedError(o.error.body);case 403:throw new be.ForbiddenError(o.error.body);case 404:throw new be.NotFoundError(o.error.body);case 422:throw new be.UnprocessableEntityError(rt.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new be.TooManyRequestsError(rt.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new be.ClientClosedRequestError(rt.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new be.InternalServerError(o.error.body);case 501:throw new be.NotImplementedError(rt.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new be.ServiceUnavailableError(o.error.body);case 504:throw new be.GatewayTimeoutError(rt.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Tr.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Tr.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Tr.CohereTimeoutError;case"unknown":throw new Tr.CohereError({message:o.error.errorMessage})}})}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new rBr.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new nBr.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new oBr.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new iBr.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new aBr.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new sBr.Finetuning(this._options)}_getAuthorizationHeader(){var e;return vp(this,void 0,void 0,function*(){let r=(e=yield dt.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Tr.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};wp.CohereClient=NOe});var FOe=v(mee=>{"use strict";Object.defineProperty(mee,"__esModule",{value:!0});mee.AwsClient=void 0;var uBr=pee(),LOe=class extends uBr.CohereClient{constructor(e){e.token="n/a",super(e)}};mee.AwsClient=LOe});var Evt=v(hee=>{"use strict";Object.defineProperty(hee,"__esModule",{value:!0});hee.BedrockClient=void 0;var lBr=POe(),cBr=FOe(),kOe=class extends cBr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,lBr.fetchOverride)("bedrock",e)}))}};hee.BedrockClient=kOe});var Tvt=v(gee=>{"use strict";Object.defineProperty(gee,"__esModule",{value:!0});gee.CohereClientV2=void 0;var dBr=TOe(),fBr=pee(),$Oe=class{constructor(e){this._options=e,this.client=new fBr.CohereClient(this._options),this.clientV2=new dBr.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}};gee.CohereClientV2=$Oe});var Avt=v(yee=>{"use strict";Object.defineProperty(yee,"__esModule",{value:!0});yee.CustomClient=void 0;var pBr=pee(),BOe=class extends pBr.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}};yee.CustomClient=BOe});var Ivt=v(bee=>{"use strict";Object.defineProperty(bee,"__esModule",{value:!0});bee.SagemakerClient=void 0;var mBr=FOe(),hBr=POe(),qOe=class extends mBr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,hBr.fetchOverride)("sagemaker",e)}))}};bee.SagemakerClient=qOe});var yH=v(ba=>{"use strict";var gBr=ba&&ba.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yBr=ba&&ba.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bBr=ba&&ba.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gBr(e,t,r);return yBr(e,t),e};Object.defineProperty(ba,"__esModule",{value:!0});ba.SagemakerClient=ba.CohereTimeoutError=ba.CohereError=ba.CohereEnvironment=ba.CohereClient=ba.CohereClientV2=ba.BedrockClient=ba.Cohere=void 0;ba.Cohere=bBr(fC());var _Br=Evt();Object.defineProperty(ba,"BedrockClient",{enumerable:!0,get:function(){return _Br.BedrockClient}});var vBr=Tvt();Object.defineProperty(ba,"CohereClientV2",{enumerable:!0,get:function(){return vBr.CohereClientV2}});var wBr=Avt();Object.defineProperty(ba,"CohereClient",{enumerable:!0,get:function(){return wBr.CustomClient}});var SBr=UC();Object.defineProperty(ba,"CohereEnvironment",{enumerable:!0,get:function(){return SBr.CohereEnvironment}});var Mvt=ys();Object.defineProperty(ba,"CohereError",{enumerable:!0,get:function(){return Mvt.CohereError}});Object.defineProperty(ba,"CohereTimeoutError",{enumerable:!0,get:function(){return Mvt.CohereTimeoutError}});var xBr=Ivt();Object.defineProperty(ba,"SagemakerClient",{enumerable:!0,get:function(){return xBr.SagemakerClient}})});function ay(t){t?(ql[0]=ql[16]=ql[1]=ql[2]=ql[3]=ql[4]=ql[5]=ql[6]=ql[7]=ql[8]=ql[9]=ql[10]=ql[11]=ql[12]=ql[13]=ql[14]=ql[15]=0,this.blocks=ql):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 CBr,cn,OBr,iy,ql,UOe,Rvt=O(()=>{"use strict";CBr=typeof window=="object"?window:{},cn="0123456789abcdef".split(""),OBr=[-2147483648,8388608,32768,128],iy=[24,16,8,0],ql=[];ay.prototype.update=function(t){if(!this.finalized){var e=typeof t!="string";e&&t.constructor===CBr.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]<<iy[o++&3];else for(o=this.start;n<i&&o<64;++n)r=t.charCodeAt(n),r<128?a[o>>2]|=r<<iy[o++&3]:r<2048?(a[o>>2]|=(192|r>>6)<<iy[o++&3],a[o>>2]|=(128|r&63)<<iy[o++&3]):r<55296||r>=57344?(a[o>>2]|=(224|r>>12)<<iy[o++&3],a[o>>2]|=(128|r>>6&63)<<iy[o++&3],a[o>>2]|=(128|r&63)<<iy[o++&3]):(r=65536+((r&1023)<<10|t.charCodeAt(++n)&1023),a[o>>2]|=(240|r>>18)<<iy[o++&3],a[o>>2]|=(128|r>>12&63)<<iy[o++&3],a[o>>2]|=(128|r>>6&63)<<iy[o++&3],a[o>>2]|=(128|r&63)<<iy[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}};ay.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=OBr[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()}};ay.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};ay.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4;return cn[t>>28&15]+cn[t>>24&15]+cn[t>>20&15]+cn[t>>16&15]+cn[t>>12&15]+cn[t>>8&15]+cn[t>>4&15]+cn[t&15]+cn[e>>28&15]+cn[e>>24&15]+cn[e>>20&15]+cn[e>>16&15]+cn[e>>12&15]+cn[e>>8&15]+cn[e>>4&15]+cn[e&15]+cn[r>>28&15]+cn[r>>24&15]+cn[r>>20&15]+cn[r>>16&15]+cn[r>>12&15]+cn[r>>8&15]+cn[r>>4&15]+cn[r&15]+cn[n>>28&15]+cn[n>>24&15]+cn[n>>20&15]+cn[n>>16&15]+cn[n>>12&15]+cn[n>>8&15]+cn[n>>4&15]+cn[n&15]+cn[o>>28&15]+cn[o>>24&15]+cn[o>>20&15]+cn[o>>16&15]+cn[o>>12&15]+cn[o>>8&15]+cn[o>>4&15]+cn[o&15]};ay.prototype.toString=ay.prototype.hex;ay.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]};ay.prototype.array=ay.prototype.digest;ay.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};UOe=t=>new ay(!0).update(t).hex()});var jvt=O(()=>{Rvt()});var Dvt,zOe,PBr,_ee,Nvt=O(()=>{jvt();FP();Dvt=(...t)=>UOe(t.join("_")),zOe=class{},PBr=new Map,_ee=class t extends zOe{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(Dvt(e,r))??null)}async update(e,r,n){this.cache.set(Dvt(e,r),n)}static global(){return new t(PBr)}}});function IBr(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 MBr(t,e){return t.length===1?[e.get(t.join(","))]:IBr(t,e).map(r=>e.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function RBr(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function VOe(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 Lvt,EBr,TBr,ABr,HOe,vee,Fvt=O(()=>{Lvt=$(Xfe(),1),EBr=Object.defineProperty,TBr=(t,e,r)=>e in t?EBr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ABr=(t,e,r)=>(TBr(t,typeof e!="symbol"?e+"":e,r),r);HOe=class{constructor(t,e){lc(this,"specialTokens");lc(this,"inverseSpecialTokens");lc(this,"patStr");lc(this,"textEncoder",new TextEncoder);lc(this,"textDecoder",new TextDecoder("utf-8"));lc(this,"rankMap",new Map);lc(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=Lvt.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=HOe.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=HOe.specialTokenRegex([...s]),c=t.match(l);if(c!=null)throw new Error(`The text contains a special token that is not allowed: ${c[0]}`)}let u=0;for(;;){let l=null,c=u;for(;o.lastIndex=c,l=o.exec(t),!(l==null||a.has(l[0]));)c=l.index+1;let d=l?.index??t.length;for(let p of t.substring(u,d).matchAll(n)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){i.push(h);continue}i.push(...MBr(m,this.rankMap))}if(l==null)break;let f=this.specialTokens[l[0]];i.push(f),u=l.index+l[0].length}return i}decode(t){let e=[],r=0;for(let i=0;i<t.length;++i){let a=t[i],s=this.textMap.get(a)??this.inverseSpecialTokens[a];s!=null&&(e.push(s),r+=s.length)}let n=new Uint8Array(r),o=0;for(let i of e)n.set(i,o),o+=i.length;return this.textDecoder.decode(n)}},vee=HOe;ABr(vee,"specialTokenRegex",t=>new RegExp(t.map(e=>RBr(e)).join("|"),"g"))});var kvt=O(()=>{Fvt()});async function $vt(t){return t in wee||(wee[t]=jBr.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new vee(e)).catch(e=>{throw delete wee[t],e})),await wee[t]}async function Bvt(t){return $vt(VOe(t))}var wee,jBr,WOe=O(()=>{kvt();NN();wee={},jBr=new Vp({})});function Mc(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 DBr,NBr,Gk,Yk,bH=O(()=>{Nvt();hz();FP();NN();WOe();lf();DBr=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;NBr=()=>!1,Gk=class extends gn{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??NBr(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}},Yk=class extends Gk{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=_ee.global():this.cache=void 0,this.caller=new Vp(n??{})}async getNumTokens(e){if(typeof e!="string")return 0;let r=Math.ceil(e.length/4);if(!this._encoding)try{this._encoding=await Bvt("modelName"in this?DBr(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 kN(e):Array.isArray(e)?new $N(e.map(Eg)):e}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:e,...r}){let n={...this._identifyingParams(),...r,_type:this._llmType(),_model:this._modelType()};return Object.entries(n).filter(([a,s])=>s!==void 0).map(([a,s])=>`${a}:${JSON.stringify(s)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(e){throw new Error("Use .toJSON() instead")}}});var ym=O(()=>{bH()});var Rd=O(()=>{DN()});var vxt=v(()=>{});var In=v((Nte,wxt)=>{(function(t,e){typeof Nte=="object"?wxt.exports=Nte=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(Nte,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=vxt()}catch{}var o=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function g(){}return function(_){var w;return g.prototype=_,w=new g,g.prototype=null,w}}(),a={},s=a.lib={},u=s.Base=function(){return{extend:function(g){var _=i(this);return g&&_.mixIn(g),(!_.hasOwnProperty("init")||this.init===_.init)&&(_.init=function(){_.$super.init.apply(this,arguments)}),_.init.prototype=_,_.$super=this,_},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var _ in g)g.hasOwnProperty(_)&&(this[_]=g[_]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=s.WordArray=u.extend({init:function(g,_){g=this.words=g||[],_!=r?this.sigBytes=_:this.sigBytes=g.length*4},toString:function(g){return(g||d).stringify(this)},concat:function(g){var _=this.words,w=g.words,x=this.sigBytes,C=g.sigBytes;if(this.clamp(),x%4)for(var E=0;E<C;E++){var P=w[E>>>2]>>>24-E%4*8&255;_[x+E>>>2]|=P<<24-(x+E)%4*8}else for(var A=0;A<C;A+=4)_[x+A>>>2]=w[A>>>2];return this.sigBytes+=C,this},clamp:function(){var g=this.words,_=this.sigBytes;g[_>>>2]&=4294967295<<32-_%4*8,g.length=e.ceil(_/4)},clone:function(){var g=u.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var _=[],w=0;w<g;w+=4)_.push(o());return new l.init(_,g)}}),c=a.enc={},d=c.Hex={stringify:function(g){for(var _=g.words,w=g.sigBytes,x=[],C=0;C<w;C++){var E=_[C>>>2]>>>24-C%4*8&255;x.push((E>>>4).toString(16)),x.push((E&15).toString(16))}return x.join("")},parse:function(g){for(var _=g.length,w=[],x=0;x<_;x+=2)w[x>>>3]|=parseInt(g.substr(x,2),16)<<24-x%8*4;return new l.init(w,_/2)}},f=c.Latin1={stringify:function(g){for(var _=g.words,w=g.sigBytes,x=[],C=0;C<w;C++){var E=_[C>>>2]>>>24-C%4*8&255;x.push(String.fromCharCode(E))}return x.join("")},parse:function(g){for(var _=g.length,w=[],x=0;x<_;x++)w[x>>>2]|=(g.charCodeAt(x)&255)<<24-x%4*8;return new l.init(w,_)}},p=c.Utf8={stringify:function(g){try{return decodeURIComponent(escape(f.stringify(g)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(g){return f.parse(unescape(encodeURIComponent(g)))}},m=s.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(g){typeof g=="string"&&(g=p.parse(g)),this._data.concat(g),this._nDataBytes+=g.sigBytes},_process:function(g){var _,w=this._data,x=w.words,C=w.sigBytes,E=this.blockSize,P=E*4,A=C/P;g?A=e.ceil(A):A=e.max((A|0)-this._minBufferSize,0);var I=A*E,R=e.min(I*4,C);if(I){for(var j=0;j<I;j+=E)this._doProcessBlock(x,j);_=x.splice(0,I),w.sigBytes-=R}return new l.init(_,R)},clone:function(){var g=u.clone.call(this);return g._data=this._data.clone(),g},_minBufferSize:0}),h=s.Hasher=m.extend({cfg:u.extend(),init:function(g){this.cfg=this.cfg.extend(g),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(g){return this._append(g),this._process(),this},finalize:function(g){g&&this._append(g);var _=this._doFinalize();return _},blockSize:512/32,_createHelper:function(g){return function(_,w){return new g.init(w).finalize(_)}},_createHmacHelper:function(g){return function(_,w){return new b.HMAC.init(g,w).finalize(_)}}}),b=a.algo={};return a}(Math);return t})});var JH=v((Lte,Sxt)=>{(function(t,e){typeof Lte=="object"?Sxt.exports=Lte=e(In()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Lte,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 Cxt=v((Fte,xxt)=>{(function(t,e){typeof Fte=="object"?xxt.exports=Fte=e(In()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Fte,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 Pxt=v((kte,Oxt)=>{(function(t,e){typeof kte=="object"?Oxt.exports=kte=e(In()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(kte,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 nA=v(($te,Ext)=>{(function(t,e){typeof $te=="object"?Ext.exports=$te=e(In()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})($te,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Base64={stringify:function(s){var u=s.words,l=s.sigBytes,c=this._map;s.clamp();for(var d=[],f=0;f<l;f+=3)for(var p=u[f>>>2]>>>24-f%4*8&255,m=u[f+1>>>2]>>>24-(f+1)%4*8&255,h=u[f+2>>>2]>>>24-(f+2)%4*8&255,b=p<<16|m<<8|h,g=0;g<4&&f+g*.75<l;g++)d.push(c.charAt(b>>>6*(3-g)&63));var _=c.charAt(64);if(_)for(;d.length%4;)d.push(_);return d.join("")},parse:function(s){var u=s.length,l=this._map,c=this._reverseMap;if(!c){c=this._reverseMap=[];for(var d=0;d<l.length;d++)c[l.charCodeAt(d)]=d}var f=l.charAt(64);if(f){var p=s.indexOf(f);p!==-1&&(u=p)}return a(s,u,c)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function a(s,u,l){for(var c=[],d=0,f=0;f<u;f++)if(f%4){var p=l[s.charCodeAt(f-1)]<<f%4*2,m=l[s.charCodeAt(f)]>>>6-f%4*2,h=p|m;c[d>>>2]|=h<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64})});var Axt=v((Bte,Txt)=>{(function(t,e){typeof Bte=="object"?Txt.exports=Bte=e(In()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Bte,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Base64url={stringify:function(s,u){u===void 0&&(u=!0);var l=s.words,c=s.sigBytes,d=u?this._safe_map:this._map;s.clamp();for(var f=[],p=0;p<c;p+=3)for(var m=l[p>>>2]>>>24-p%4*8&255,h=l[p+1>>>2]>>>24-(p+1)%4*8&255,b=l[p+2>>>2]>>>24-(p+2)%4*8&255,g=m<<16|h<<8|b,_=0;_<4&&p+_*.75<c;_++)f.push(d.charAt(g>>>6*(3-_)&63));var w=d.charAt(64);if(w)for(;f.length%4;)f.push(w);return f.join("")},parse:function(s,u){u===void 0&&(u=!0);var l=s.length,c=u?this._safe_map:this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var f=0;f<c.length;f++)d[c.charCodeAt(f)]=f}var p=c.charAt(64);if(p){var m=s.indexOf(p);m!==-1&&(l=m)}return a(s,l,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function a(s,u,l){for(var c=[],d=0,f=0;f<u;f++)if(f%4){var p=l[s.charCodeAt(f-1)]<<f%4*2,m=l[s.charCodeAt(f)]>>>6-f%4*2,h=p|m;c[d>>>2]|=h<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64url})});var oA=v((qte,Ixt)=>{(function(t,e){typeof qte=="object"?Ixt.exports=qte=e(In()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(qte,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[];(function(){for(var p=0;p<64;p++)s[p]=e.abs(e.sin(p+1))*4294967296|0})();var u=a.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,m){for(var h=0;h<16;h++){var b=m+h,g=p[b];p[b]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var _=this._hash.words,w=p[m+0],x=p[m+1],C=p[m+2],E=p[m+3],P=p[m+4],A=p[m+5],I=p[m+6],R=p[m+7],j=p[m+8],D=p[m+9],k=p[m+10],F=p[m+11],B=p[m+12],q=p[m+13],W=p[m+14],H=p[m+15],L=_[0],z=_[1],K=_[2],J=_[3];L=l(L,z,K,J,w,7,s[0]),J=l(J,L,z,K,x,12,s[1]),K=l(K,J,L,z,C,17,s[2]),z=l(z,K,J,L,E,22,s[3]),L=l(L,z,K,J,P,7,s[4]),J=l(J,L,z,K,A,12,s[5]),K=l(K,J,L,z,I,17,s[6]),z=l(z,K,J,L,R,22,s[7]),L=l(L,z,K,J,j,7,s[8]),J=l(J,L,z,K,D,12,s[9]),K=l(K,J,L,z,k,17,s[10]),z=l(z,K,J,L,F,22,s[11]),L=l(L,z,K,J,B,7,s[12]),J=l(J,L,z,K,q,12,s[13]),K=l(K,J,L,z,W,17,s[14]),z=l(z,K,J,L,H,22,s[15]),L=c(L,z,K,J,x,5,s[16]),J=c(J,L,z,K,I,9,s[17]),K=c(K,J,L,z,F,14,s[18]),z=c(z,K,J,L,w,20,s[19]),L=c(L,z,K,J,A,5,s[20]),J=c(J,L,z,K,k,9,s[21]),K=c(K,J,L,z,H,14,s[22]),z=c(z,K,J,L,P,20,s[23]),L=c(L,z,K,J,D,5,s[24]),J=c(J,L,z,K,W,9,s[25]),K=c(K,J,L,z,E,14,s[26]),z=c(z,K,J,L,j,20,s[27]),L=c(L,z,K,J,q,5,s[28]),J=c(J,L,z,K,C,9,s[29]),K=c(K,J,L,z,R,14,s[30]),z=c(z,K,J,L,B,20,s[31]),L=d(L,z,K,J,A,4,s[32]),J=d(J,L,z,K,j,11,s[33]),K=d(K,J,L,z,F,16,s[34]),z=d(z,K,J,L,W,23,s[35]),L=d(L,z,K,J,x,4,s[36]),J=d(J,L,z,K,P,11,s[37]),K=d(K,J,L,z,R,16,s[38]),z=d(z,K,J,L,k,23,s[39]),L=d(L,z,K,J,q,4,s[40]),J=d(J,L,z,K,w,11,s[41]),K=d(K,J,L,z,E,16,s[42]),z=d(z,K,J,L,I,23,s[43]),L=d(L,z,K,J,D,4,s[44]),J=d(J,L,z,K,B,11,s[45]),K=d(K,J,L,z,H,16,s[46]),z=d(z,K,J,L,C,23,s[47]),L=f(L,z,K,J,w,6,s[48]),J=f(J,L,z,K,R,10,s[49]),K=f(K,J,L,z,W,15,s[50]),z=f(z,K,J,L,A,21,s[51]),L=f(L,z,K,J,B,6,s[52]),J=f(J,L,z,K,E,10,s[53]),K=f(K,J,L,z,k,15,s[54]),z=f(z,K,J,L,x,21,s[55]),L=f(L,z,K,J,j,6,s[56]),J=f(J,L,z,K,H,10,s[57]),K=f(K,J,L,z,I,15,s[58]),z=f(z,K,J,L,q,21,s[59]),L=f(L,z,K,J,P,6,s[60]),J=f(J,L,z,K,F,10,s[61]),K=f(K,J,L,z,C,15,s[62]),z=f(z,K,J,L,D,21,s[63]),_[0]=_[0]+L|0,_[1]=_[1]+z|0,_[2]=_[2]+K|0,_[3]=_[3]+J|0},_doFinalize:function(){var p=this._data,m=p.words,h=this._nDataBytes*8,b=p.sigBytes*8;m[b>>>5]|=128<<24-b%32;var g=e.floor(h/4294967296),_=h;m[(b+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,m[(b+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,p.sigBytes=(m.length+1)*4,this._process();for(var w=this._hash,x=w.words,C=0;C<4;C++){var E=x[C];x[C]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}return w},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});function l(p,m,h,b,g,_,w){var x=p+(m&h|~m&b)+g+w;return(x<<_|x>>>32-_)+m}function c(p,m,h,b,g,_,w){var x=p+(m&b|h&~b)+g+w;return(x<<_|x>>>32-_)+m}function d(p,m,h,b,g,_,w){var x=p+(m^h^b)+g+w;return(x<<_|x>>>32-_)+m}function f(p,m,h,b,g,_,w){var x=p+(h^(m|~b))+g+w;return(x<<_|x>>>32-_)+m}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),t.MD5})});var VEe=v((Ute,Mxt)=>{(function(t,e){typeof Ute=="object"?Mxt.exports=Ute=e(In()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Ute,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.Hasher,i=e.algo,a=[],s=i.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,l){for(var c=this._hash.words,d=c[0],f=c[1],p=c[2],m=c[3],h=c[4],b=0;b<80;b++){if(b<16)a[b]=u[l+b]|0;else{var g=a[b-3]^a[b-8]^a[b-14]^a[b-16];a[b]=g<<1|g>>>31}var _=(d<<5|d>>>27)+h+a[b];b<20?_+=(f&p|~f&m)+1518500249:b<40?_+=(f^p^m)+1859775393:b<60?_+=(f&p|f&m|p&m)-1894007588:_+=(f^p^m)-899497514,h=m,m=p,p=f<<30|f>>>2,f=d,d=_}c[0]=c[0]+d|0,c[1]=c[1]+f|0,c[2]=c[2]+p|0,c[3]=c[3]+m|0,c[4]=c[4]+h|0},_doFinalize:function(){var u=this._data,l=u.words,c=this._nDataBytes*8,d=u.sigBytes*8;return l[d>>>5]|=128<<24-d%32,l[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),l[(d+64>>>9<<4)+15]=c,u.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var u=o.clone.call(this);return u._hash=this._hash.clone(),u}});e.SHA1=o._createHelper(s),e.HmacSHA1=o._createHmacHelper(s)}(),t.SHA1})});var Hte=v((zte,Rxt)=>{(function(t,e){typeof zte=="object"?Rxt.exports=zte=e(In()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(zte,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[],u=[];(function(){function d(h){for(var b=e.sqrt(h),g=2;g<=b;g++)if(!(h%g))return!1;return!0}function f(h){return(h-(h|0))*4294967296|0}for(var p=2,m=0;m<64;)d(p)&&(m<8&&(s[m]=f(e.pow(p,1/2))),u[m]=f(e.pow(p,1/3)),m++),p++})();var l=[],c=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(d,f){for(var p=this._hash.words,m=p[0],h=p[1],b=p[2],g=p[3],_=p[4],w=p[5],x=p[6],C=p[7],E=0;E<64;E++){if(E<16)l[E]=d[f+E]|0;else{var P=l[E-15],A=(P<<25|P>>>7)^(P<<14|P>>>18)^P>>>3,I=l[E-2],R=(I<<15|I>>>17)^(I<<13|I>>>19)^I>>>10;l[E]=A+l[E-7]+R+l[E-16]}var j=_&w^~_&x,D=m&h^m&b^h&b,k=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),F=(_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25),B=C+F+j+u[E]+l[E],q=k+D;C=x,x=w,w=_,_=g+B|0,g=b,b=h,h=m,m=B+q|0}p[0]=p[0]+m|0,p[1]=p[1]+h|0,p[2]=p[2]+b|0,p[3]=p[3]+g|0,p[4]=p[4]+_|0,p[5]=p[5]+w|0,p[6]=p[6]+x|0,p[7]=p[7]+C|0},_doFinalize:function(){var d=this._data,f=d.words,p=this._nDataBytes*8,m=d.sigBytes*8;return f[m>>>5]|=128<<24-m%32,f[(m+64>>>9<<4)+14]=e.floor(p/4294967296),f[(m+64>>>9<<4)+15]=p,d.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var d=i.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA256=i._createHelper(c),r.HmacSHA256=i._createHmacHelper(c)}(Math),t.SHA256})});var Dxt=v((Vte,jxt)=>{(function(t,e,r){typeof Vte=="object"?jxt.exports=Vte=e(In(),Hte()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(Vte,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 WEe=v((Wte,Nxt)=>{(function(t,e,r){typeof Wte=="object"?Nxt.exports=Wte=e(In(),JH()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(Wte,function(t){return function(){var e=t,r=e.lib,n=r.Hasher,o=e.x64,i=o.Word,a=o.WordArray,s=e.algo;function u(){return i.create.apply(i,arguments)}var l=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],c=[];(function(){for(var f=0;f<80;f++)c[f]=u()})();var d=s.SHA512=n.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(f,p){for(var m=this._hash.words,h=m[0],b=m[1],g=m[2],_=m[3],w=m[4],x=m[5],C=m[6],E=m[7],P=h.high,A=h.low,I=b.high,R=b.low,j=g.high,D=g.low,k=_.high,F=_.low,B=w.high,q=w.low,W=x.high,H=x.low,L=C.high,z=C.low,K=E.high,J=E.low,ee=P,Pe=A,G=I,Z=R,ie=j,Ie=D,st=k,Te=F,Qe=B,nt=q,Ht=W,Me=H,ht=L,Xt=z,nr=K,Fr=J,xe=0;xe<80;xe++){var te,ur,je=c[xe];if(xe<16)ur=je.high=f[p+xe*2]|0,te=je.low=f[p+xe*2+1]|0;else{var Ee=c[xe-15],re=Ee.high,oe=Ee.low,Se=(re>>>1|oe<<31)^(re>>>8|oe<<24)^re>>>7,ve=(oe>>>1|re<<31)^(oe>>>8|re<<24)^(oe>>>7|re<<25),qe=c[xe-2],kr=qe.high,pi=qe.low,sa=(kr>>>19|pi<<13)^(kr<<3|pi>>>29)^kr>>>6,uc=(pi>>>19|kr<<13)^(pi<<3|kr>>>29)^(pi>>>6|kr<<26),Wd=c[xe-7],ua=Wd.high,Ff=Wd.low,od=c[xe-16],Kd=od.high,$r=od.low;te=ve+Ff,ur=Se+ua+(te>>>0<ve>>>0?1:0),te=te+uc,ur=ur+sa+(te>>>0<uc>>>0?1:0),te=te+$r,ur=ur+Kd+(te>>>0<$r>>>0?1:0),je.high=ur,je.low=te}var Zy=Qe&Ht^~Qe&ht,dx=nt&Me^~nt&Xt,xP=ee&G^ee&ie^G&ie,Ya=Pe&Z^Pe&Ie^Z&Ie,Ps=(ee>>>28|Pe<<4)^(ee<<30|Pe>>>2)^(ee<<25|Pe>>>7),Pa=(Pe>>>28|ee<<4)^(Pe<<30|ee>>>2)^(Pe<<25|ee>>>7),Jd=(Qe>>>14|nt<<18)^(Qe>>>18|nt<<14)^(Qe<<23|nt>>>9),id=(nt>>>14|Qe<<18)^(nt>>>18|Qe<<14)^(nt<<23|Qe>>>9),ls=l[xe],kf=ls.high,Gd=ls.low,Cn=Fr+id,We=nr+Jd+(Cn>>>0<Fr>>>0?1:0),Cn=Cn+dx,We=We+Zy+(Cn>>>0<dx>>>0?1:0),Cn=Cn+Gd,We=We+kf+(Cn>>>0<Gd>>>0?1:0),Cn=Cn+te,We=We+ur+(Cn>>>0<te>>>0?1:0),Yd=Pa+Ya,Bp=Ps+xP+(Yd>>>0<Pa>>>0?1:0);nr=ht,Fr=Xt,ht=Ht,Xt=Me,Ht=Qe,Me=nt,nt=Te+Cn|0,Qe=st+We+(nt>>>0<Te>>>0?1:0)|0,st=ie,Te=Ie,ie=G,Ie=Z,G=ee,Z=Pe,Pe=Cn+Yd|0,ee=We+Bp+(Pe>>>0<Cn>>>0?1:0)|0}A=h.low=A+Pe,h.high=P+ee+(A>>>0<Pe>>>0?1:0),R=b.low=R+Z,b.high=I+G+(R>>>0<Z>>>0?1:0),D=g.low=D+Ie,g.high=j+ie+(D>>>0<Ie>>>0?1:0),F=_.low=F+Te,_.high=k+st+(F>>>0<Te>>>0?1:0),q=w.low=q+nt,w.high=B+Qe+(q>>>0<nt>>>0?1:0),H=x.low=H+Me,x.high=W+Ht+(H>>>0<Me>>>0?1:0),z=C.low=z+Xt,C.high=L+ht+(z>>>0<Xt>>>0?1:0),J=E.low=J+Fr,E.high=K+nr+(J>>>0<Fr>>>0?1:0)},_doFinalize:function(){var f=this._data,p=f.words,m=this._nDataBytes*8,h=f.sigBytes*8;p[h>>>5]|=128<<24-h%32,p[(h+128>>>10<<5)+30]=Math.floor(m/4294967296),p[(h+128>>>10<<5)+31]=m,f.sigBytes=p.length*4,this._process();var b=this._hash.toX32();return b},clone:function(){var f=n.clone.call(this);return f._hash=this._hash.clone(),f},blockSize:1024/32});e.SHA512=n._createHelper(d),e.HmacSHA512=n._createHmacHelper(d)}(),t.SHA512})});var Fxt=v((Kte,Lxt)=>{(function(t,e,r){typeof Kte=="object"?Lxt.exports=Kte=e(In(),JH(),WEe()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(Kte,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 $xt=v((Jte,kxt)=>{(function(t,e,r){typeof Jte=="object"?kxt.exports=Jte=e(In(),JH()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(Jte,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.x64,s=a.Word,u=r.algo,l=[],c=[],d=[];(function(){for(var m=1,h=0,b=0;b<24;b++){l[m+5*h]=(b+1)*(b+2)/2%64;var g=h%5,_=(2*m+3*h)%5;m=g,h=_}for(var m=0;m<5;m++)for(var h=0;h<5;h++)c[m+5*h]=h+(2*m+3*h)%5*5;for(var w=1,x=0;x<24;x++){for(var C=0,E=0,P=0;P<7;P++){if(w&1){var A=(1<<P)-1;A<32?E^=1<<A:C^=1<<A-32}w&128?w=w<<1^113:w<<=1}d[x]=s.create(C,E)}})();var f=[];(function(){for(var m=0;m<25;m++)f[m]=s.create()})();var p=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var m=this._state=[],h=0;h<25;h++)m[h]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(m,h){for(var b=this._state,g=this.blockSize/2,_=0;_<g;_++){var w=m[h+2*_],x=m[h+2*_+1];w=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,x=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360;var C=b[_];C.high^=x,C.low^=w}for(var E=0;E<24;E++){for(var P=0;P<5;P++){for(var A=0,I=0,R=0;R<5;R++){var C=b[P+5*R];A^=C.high,I^=C.low}var j=f[P];j.high=A,j.low=I}for(var P=0;P<5;P++)for(var D=f[(P+4)%5],k=f[(P+1)%5],F=k.high,B=k.low,A=D.high^(F<<1|B>>>31),I=D.low^(B<<1|F>>>31),R=0;R<5;R++){var C=b[P+5*R];C.high^=A,C.low^=I}for(var q=1;q<25;q++){var A,I,C=b[q],W=C.high,H=C.low,L=l[q];L<32?(A=W<<L|H>>>32-L,I=H<<L|W>>>32-L):(A=H<<L-32|W>>>64-L,I=W<<L-32|H>>>64-L);var z=f[c[q]];z.high=A,z.low=I}var K=f[0],J=b[0];K.high=J.high,K.low=J.low;for(var P=0;P<5;P++)for(var R=0;R<5;R++){var q=P+5*R,C=b[q],ee=f[q],Pe=f[(P+1)%5+5*R],G=f[(P+2)%5+5*R];C.high=ee.high^~Pe.high&G.high,C.low=ee.low^~Pe.low&G.low}var C=b[0],Z=d[E];C.high^=Z.high,C.low^=Z.low}},_doFinalize:function(){var m=this._data,h=m.words,b=this._nDataBytes*8,g=m.sigBytes*8,_=this.blockSize*32;h[g>>>5]|=1<<24-g%32,h[(e.ceil((g+1)/_)*_>>>5)-1]|=128,m.sigBytes=h.length*4,this._process();for(var w=this._state,x=this.cfg.outputLength/8,C=x/8,E=[],P=0;P<C;P++){var A=w[P],I=A.high,R=A.low;I=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,R=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,E.push(R),E.push(I)}return new o.init(E,x)},clone:function(){for(var m=i.clone.call(this),h=m._state=this._state.slice(0),b=0;b<25;b++)h[b]=h[b].clone();return m}});r.SHA3=i._createHelper(p),r.HmacSHA3=i._createHmacHelper(p)}(Math),t.SHA3})});var qxt=v((Gte,Bxt)=>{(function(t,e){typeof Gte=="object"?Bxt.exports=Gte=e(In()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Gte,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=o.create([0,1518500249,1859775393,2400959708,2840853838]),f=o.create([1352829926,1548603684,1836072691,2053994217,0]),p=a.RIPEMD160=i.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(x,C){for(var E=0;E<16;E++){var P=C+E,A=x[P];x[P]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}var I=this._hash.words,R=d.words,j=f.words,D=s.words,k=u.words,F=l.words,B=c.words,q,W,H,L,z,K,J,ee,Pe,G;K=q=I[0],J=W=I[1],ee=H=I[2],Pe=L=I[3],G=z=I[4];for(var Z,E=0;E<80;E+=1)Z=q+x[C+D[E]]|0,E<16?Z+=m(W,H,L)+R[0]:E<32?Z+=h(W,H,L)+R[1]:E<48?Z+=b(W,H,L)+R[2]:E<64?Z+=g(W,H,L)+R[3]:Z+=_(W,H,L)+R[4],Z=Z|0,Z=w(Z,F[E]),Z=Z+z|0,q=z,z=L,L=w(H,10),H=W,W=Z,Z=K+x[C+k[E]]|0,E<16?Z+=_(J,ee,Pe)+j[0]:E<32?Z+=g(J,ee,Pe)+j[1]:E<48?Z+=b(J,ee,Pe)+j[2]:E<64?Z+=h(J,ee,Pe)+j[3]:Z+=m(J,ee,Pe)+j[4],Z=Z|0,Z=w(Z,B[E]),Z=Z+G|0,K=G,G=Pe,Pe=w(ee,10),ee=J,J=Z;Z=I[1]+H+Pe|0,I[1]=I[2]+L+G|0,I[2]=I[3]+z+K|0,I[3]=I[4]+q+J|0,I[4]=I[0]+W+ee|0,I[0]=Z},_doFinalize:function(){var x=this._data,C=x.words,E=this._nDataBytes*8,P=x.sigBytes*8;C[P>>>5]|=128<<24-P%32,C[(P+64>>>9<<4)+14]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,x.sigBytes=(C.length+1)*4,this._process();for(var A=this._hash,I=A.words,R=0;R<5;R++){var j=I[R];I[R]=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360}return A},clone:function(){var x=i.clone.call(this);return x._hash=this._hash.clone(),x}});function m(x,C,E){return x^C^E}function h(x,C,E){return x&C|~x&E}function b(x,C,E){return(x|~C)^E}function g(x,C,E){return x&E|C&~E}function _(x,C,E){return x^(C|~E)}function w(x,C){return x<<C|x>>>32-C}r.RIPEMD160=i._createHelper(p),r.HmacRIPEMD160=i._createHmacHelper(p)}(Math),t.RIPEMD160})});var Zte=v((Yte,Uxt)=>{(function(t,e){typeof Yte=="object"?Uxt.exports=Yte=e(In()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Yte,function(t){(function(){var e=t,r=e.lib,n=r.Base,o=e.enc,i=o.Utf8,a=e.algo,s=a.HMAC=n.extend({init:function(u,l){u=this._hasher=new u.init,typeof l=="string"&&(l=i.parse(l));var c=u.blockSize,d=c*4;l.sigBytes>d&&(l=u.finalize(l)),l.clamp();for(var f=this._oKey=l.clone(),p=this._iKey=l.clone(),m=f.words,h=p.words,b=0;b<c;b++)m[b]^=1549556828,h[b]^=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 Hxt=v((Xte,zxt)=>{(function(t,e,r){typeof Xte=="object"?zxt.exports=Xte=e(In(),Hte(),Zte()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(Xte,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.SHA256,s=i.HMAC,u=i.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:25e4}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,c){for(var d=this.cfg,f=s.create(d.hasher,l),p=o.create(),m=o.create([1]),h=p.words,b=m.words,g=d.keySize,_=d.iterations;h.length<g;){var w=f.update(c).finalize(m);f.reset();for(var x=w.words,C=x.length,E=w,P=1;P<_;P++){E=f.finalize(E),f.reset();for(var A=E.words,I=0;I<C;I++)x[I]^=A[I]}p.concat(w),b[0]++}return p.sigBytes=g*4,p}});e.PBKDF2=function(l,c,d){return u.create(d).compute(l,c)}}(),t.PBKDF2})});var iO=v((Qte,Vxt)=>{(function(t,e,r){typeof Qte=="object"?Vxt.exports=Qte=e(In(),VEe(),Zte()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(Qte,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.MD5,s=i.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:1}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,l){for(var c,d=this.cfg,f=d.hasher.create(),p=o.create(),m=p.words,h=d.keySize,b=d.iterations;m.length<h;){c&&f.update(c),c=f.update(u).finalize(l),f.reset();for(var g=1;g<b;g++)c=f.finalize(c),f.reset();p.concat(c)}return p.sigBytes=h*4,p}});e.EvpKDF=function(u,l,c){return s.create(c).compute(u,l)}}(),t.EvpKDF})});var wl=v((ere,Wxt)=>{(function(t,e,r){typeof ere=="object"?Wxt.exports=ere=e(In(),iO()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(ere,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,D){return this.create(this._ENC_XFORM_MODE,j,D)},createDecryptor:function(j,D){return this.create(this._DEC_XFORM_MODE,j,D)},init:function(j,D,k){this.cfg=this.cfg.extend(k),this._xformMode=j,this._key=D,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 D=this._doFinalize();return D},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function j(D){return typeof D=="string"?R:P}return function(D){return{encrypt:function(k,F,B){return j(F).encrypt(D,k,F,B)},decrypt:function(k,F,B){return j(F).decrypt(D,k,F,B)}}}}()}),p=n.StreamCipher=f.extend({_doFinalize:function(){var j=this._process(!0);return j},blockSize:1}),m=r.mode={},h=n.BlockCipherMode=o.extend({createEncryptor:function(j,D){return this.Encryptor.create(j,D)},createDecryptor:function(j,D){return this.Decryptor.create(j,D)},init:function(j,D){this._cipher=j,this._iv=D}}),b=m.CBC=function(){var j=h.extend();j.Encryptor=j.extend({processBlock:function(k,F){var B=this._cipher,q=B.blockSize;D.call(this,k,F,q),B.encryptBlock(k,F),this._prevBlock=k.slice(F,F+q)}}),j.Decryptor=j.extend({processBlock:function(k,F){var B=this._cipher,q=B.blockSize,W=k.slice(F,F+q);B.decryptBlock(k,F),D.call(this,k,F,q),this._prevBlock=W}});function D(k,F,B){var q,W=this._iv;W?(q=W,this._iv=e):q=this._prevBlock;for(var H=0;H<B;H++)k[F+H]^=q[H]}return j}(),g=r.pad={},_=g.Pkcs7={pad:function(j,D){for(var k=D*4,F=k-j.sigBytes%k,B=F<<24|F<<16|F<<8|F,q=[],W=0;W<F;W+=4)q.push(B);var H=i.create(q,F);j.concat(H)},unpad:function(j){var D=j.words[j.sigBytes-1>>>2]&255;j.sigBytes-=D}},w=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:b,padding:_}),reset:function(){var j;f.reset.call(this);var D=this.cfg,k=D.iv,F=D.mode;this._xformMode==this._ENC_XFORM_MODE?j=F.createEncryptor:(j=F.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==j?this._mode.init(this,k&&k.words):(this._mode=j.call(F,this,k&&k.words),this._mode.__creator=j)},_doProcessBlock:function(j,D){this._mode.processBlock(j,D)},_doFinalize:function(){var j,D=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(D.pad(this._data,this.blockSize),j=this._process(!0)):(j=this._process(!0),D.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)}}),C=r.format={},E=C.OpenSSL={stringify:function(j){var D,k=j.ciphertext,F=j.salt;return F?D=i.create([1398893684,1701076831]).concat(F).concat(k):D=k,D.toString(l)},parse:function(j){var D,k=l.parse(j),F=k.words;return F[0]==1398893684&&F[1]==1701076831&&(D=i.create(F.slice(2,4)),F.splice(0,4),k.sigBytes-=16),x.create({ciphertext:k,salt:D})}},P=n.SerializableCipher=o.extend({cfg:o.extend({format:E}),encrypt:function(j,D,k,F){F=this.cfg.extend(F);var B=j.createEncryptor(k,F),q=B.finalize(D),W=B.cfg;return x.create({ciphertext:q,key:k,iv:W.iv,algorithm:j,mode:W.mode,padding:W.padding,blockSize:j.blockSize,formatter:F.format})},decrypt:function(j,D,k,F){F=this.cfg.extend(F),D=this._parse(D,F.format);var B=j.createDecryptor(k,F).finalize(D.ciphertext);return B},_parse:function(j,D){return typeof j=="string"?D.parse(j,this):j}}),A=r.kdf={},I=A.OpenSSL={execute:function(j,D,k,F,B){if(F||(F=i.random(64/8)),B)var q=d.create({keySize:D+k,hasher:B}).compute(j,F);else var q=d.create({keySize:D+k}).compute(j,F);var W=i.create(q.words.slice(D),k*4);return q.sigBytes=D*4,x.create({key:q,iv:W,salt:F})}},R=n.PasswordBasedCipher=P.extend({cfg:P.cfg.extend({kdf:I}),encrypt:function(j,D,k,F){F=this.cfg.extend(F);var B=F.kdf.execute(k,j.keySize,j.ivSize,F.salt,F.hasher);F.iv=B.iv;var q=P.encrypt.call(this,j,D,B.key,F);return q.mixIn(B),q},decrypt:function(j,D,k,F){F=this.cfg.extend(F),D=this._parse(D,F.format);var B=F.kdf.execute(k,j.keySize,j.ivSize,D.salt,F.hasher);F.iv=B.iv;var q=P.decrypt.call(this,j,D,B.key,F);return q}})}()})});var Jxt=v((tre,Kxt)=>{(function(t,e,r){typeof tre=="object"?Kxt.exports=tre=e(In(),wl()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(tre,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 Yxt=v((rre,Gxt)=>{(function(t,e,r){typeof rre=="object"?Gxt.exports=rre=e(In(),wl()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(rre,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 Xxt=v((nre,Zxt)=>{(function(t,e,r){typeof nre=="object"?Zxt.exports=nre=e(In(),wl()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(nre,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 eCt=v((ore,Qxt)=>{(function(t,e,r){typeof ore=="object"?Qxt.exports=ore=e(In(),wl()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(ore,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 rCt=v((ire,tCt)=>{(function(t,e,r){typeof ire=="object"?tCt.exports=ire=e(In(),wl()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(ire,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 oCt=v((are,nCt)=>{(function(t,e,r){typeof are=="object"?nCt.exports=are=e(In(),wl()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(are,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 aCt=v((sre,iCt)=>{(function(t,e,r){typeof sre=="object"?iCt.exports=sre=e(In(),wl()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(sre,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 uCt=v((ure,sCt)=>{(function(t,e,r){typeof ure=="object"?sCt.exports=ure=e(In(),wl()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(ure,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 cCt=v((lre,lCt)=>{(function(t,e,r){typeof lre=="object"?lCt.exports=lre=e(In(),wl()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(lre,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 fCt=v((cre,dCt)=>{(function(t,e,r){typeof cre=="object"?dCt.exports=cre=e(In(),wl()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(cre,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var mCt=v((dre,pCt)=>{(function(t,e,r){typeof dre=="object"?pCt.exports=dre=e(In(),wl()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(dre,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 gCt=v((fre,hCt)=>{(function(t,e,r){typeof fre=="object"?hCt.exports=fre=e(In(),nA(),oA(),iO(),wl()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(fre,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo,i=[],a=[],s=[],u=[],l=[],c=[],d=[],f=[],p=[],m=[];(function(){for(var g=[],_=0;_<256;_++)_<128?g[_]=_<<1:g[_]=_<<1^283;for(var w=0,x=0,_=0;_<256;_++){var C=x^x<<1^x<<2^x<<3^x<<4;C=C>>>8^C&255^99,i[w]=C,a[C]=w;var E=g[w],P=g[E],A=g[P],I=g[C]*257^C*16843008;s[w]=I<<24|I>>>8,u[w]=I<<16|I>>>16,l[w]=I<<8|I>>>24,c[w]=I;var I=A*16843009^P*65537^E*257^w*16843008;d[C]=I<<24|I>>>8,f[C]=I<<16|I>>>16,p[C]=I<<8|I>>>24,m[C]=I,w?(w=E^g[g[g[A^E]]],x^=g[g[x]]):w=x=1}})();var h=[0,1,2,4,8,16,32,64,128,27,54],b=o.AES=n.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var _=this._keyPriorReset=this._key,w=_.words,x=_.sigBytes/4,C=this._nRounds=x+6,E=(C+1)*4,P=this._keySchedule=[],A=0;A<E;A++)A<x?P[A]=w[A]:(g=P[A-1],A%x?x>6&&A%x==4&&(g=i[g>>>24]<<24|i[g>>>16&255]<<16|i[g>>>8&255]<<8|i[g&255]):(g=g<<8|g>>>24,g=i[g>>>24]<<24|i[g>>>16&255]<<16|i[g>>>8&255]<<8|i[g&255],g^=h[A/x|0]<<24),P[A]=P[A-x]^g);for(var I=this._invKeySchedule=[],R=0;R<E;R++){var A=E-R;if(R%4)var g=P[A];else var g=P[A-4];R<4||A<=4?I[R]=g:I[R]=d[i[g>>>24]]^f[i[g>>>16&255]]^p[i[g>>>8&255]]^m[i[g&255]]}}},encryptBlock:function(g,_){this._doCryptBlock(g,_,this._keySchedule,s,u,l,c,i)},decryptBlock:function(g,_){var w=g[_+1];g[_+1]=g[_+3],g[_+3]=w,this._doCryptBlock(g,_,this._invKeySchedule,d,f,p,m,a);var w=g[_+1];g[_+1]=g[_+3],g[_+3]=w},_doCryptBlock:function(g,_,w,x,C,E,P,A){for(var I=this._nRounds,R=g[_]^w[0],j=g[_+1]^w[1],D=g[_+2]^w[2],k=g[_+3]^w[3],F=4,B=1;B<I;B++){var q=x[R>>>24]^C[j>>>16&255]^E[D>>>8&255]^P[k&255]^w[F++],W=x[j>>>24]^C[D>>>16&255]^E[k>>>8&255]^P[R&255]^w[F++],H=x[D>>>24]^C[k>>>16&255]^E[R>>>8&255]^P[j&255]^w[F++],L=x[k>>>24]^C[R>>>16&255]^E[j>>>8&255]^P[D&255]^w[F++];R=q,j=W,D=H,k=L}var q=(A[R>>>24]<<24|A[j>>>16&255]<<16|A[D>>>8&255]<<8|A[k&255])^w[F++],W=(A[j>>>24]<<24|A[D>>>16&255]<<16|A[k>>>8&255]<<8|A[R&255])^w[F++],H=(A[D>>>24]<<24|A[k>>>16&255]<<16|A[R>>>8&255]<<8|A[j&255])^w[F++],L=(A[k>>>24]<<24|A[R>>>16&255]<<16|A[j>>>8&255]<<8|A[D&255])^w[F++];g[_]=q,g[_+1]=W,g[_+2]=H,g[_+3]=L},keySize:256/32});e.AES=n._createHelper(b)}(),t.AES})});var bCt=v((pre,yCt)=>{(function(t,e,r){typeof pre=="object"?yCt.exports=pre=e(In(),nA(),oA(),iO(),wl()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(pre,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.BlockCipher,i=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=i.DES=o.extend({_doReset:function(){for(var h=this._key,b=h.words,g=[],_=0;_<56;_++){var w=a[_]-1;g[_]=b[w>>>5]>>>31-w%32&1}for(var x=this._subKeys=[],C=0;C<16;C++){for(var E=x[C]=[],P=u[C],_=0;_<24;_++)E[_/6|0]|=g[(s[_]-1+P)%28]<<31-_%6,E[4+(_/6|0)]|=g[28+(s[_+24]-1+P)%28]<<31-_%6;E[0]=E[0]<<1|E[0]>>>31;for(var _=1;_<7;_++)E[_]=E[_]>>>(_-1)*4+3;E[7]=E[7]<<5|E[7]>>>27}for(var A=this._invSubKeys=[],_=0;_<16;_++)A[_]=x[15-_]},encryptBlock:function(h,b){this._doCryptBlock(h,b,this._subKeys)},decryptBlock:function(h,b){this._doCryptBlock(h,b,this._invSubKeys)},_doCryptBlock:function(h,b,g){this._lBlock=h[b],this._rBlock=h[b+1],f.call(this,4,252645135),f.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),f.call(this,1,1431655765);for(var _=0;_<16;_++){for(var w=g[_],x=this._lBlock,C=this._rBlock,E=0,P=0;P<8;P++)E|=l[P][((C^w[P])&c[P])>>>0];this._lBlock=C,this._rBlock=x^E}var A=this._lBlock;this._lBlock=this._rBlock,this._rBlock=A,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),h[b]=this._lBlock,h[b+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(h,b){var g=(this._lBlock>>>h^this._rBlock)&b;this._rBlock^=g,this._lBlock^=g<<h}function p(h,b){var g=(this._rBlock>>>h^this._lBlock)&b;this._lBlock^=g,this._rBlock^=g<<h}e.DES=o._createHelper(d);var m=i.TripleDES=o.extend({_doReset:function(){var h=this._key,b=h.words;if(b.length!==2&&b.length!==4&&b.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var g=b.slice(0,2),_=b.length<4?b.slice(0,2):b.slice(2,4),w=b.length<6?b.slice(0,2):b.slice(4,6);this._des1=d.createEncryptor(n.create(g)),this._des2=d.createEncryptor(n.create(_)),this._des3=d.createEncryptor(n.create(w))},encryptBlock:function(h,b){this._des1.encryptBlock(h,b),this._des2.decryptBlock(h,b),this._des3.encryptBlock(h,b)},decryptBlock:function(h,b){this._des3.decryptBlock(h,b),this._des2.encryptBlock(h,b),this._des1.decryptBlock(h,b)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=o._createHelper(m)}(),t.TripleDES})});var vCt=v((mre,_Ct)=>{(function(t,e,r){typeof mre=="object"?_Ct.exports=mre=e(In(),nA(),oA(),iO(),wl()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(mre,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=o.RC4=n.extend({_doReset:function(){for(var u=this._key,l=u.words,c=u.sigBytes,d=this._S=[],f=0;f<256;f++)d[f]=f;for(var f=0,p=0;f<256;f++){var m=f%c,h=l[m>>>2]>>>24-m%4*8&255;p=(p+d[f]+h)%256;var b=d[f];d[f]=d[p],d[p]=b}this._i=this._j=0},_doProcessBlock:function(u,l){u[l]^=a.call(this)},keySize:256/32,ivSize:0});function a(){for(var u=this._S,l=this._i,c=this._j,d=0,f=0;f<4;f++){l=(l+1)%256,c=(c+u[l])%256;var p=u[l];u[l]=u[c],u[c]=p,d|=u[(u[l]+u[c])%256]<<24-f*8}return this._i=l,this._j=c,d}e.RC4=n._createHelper(i);var s=o.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var u=this.cfg.drop;u>0;u--)a.call(this)}});e.RC4Drop=n._createHelper(s)}(),t.RC4})});var SCt=v((hre,wCt)=>{(function(t,e,r){typeof hre=="object"?wCt.exports=hre=e(In(),nA(),oA(),iO(),wl()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(hre,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.Rabbit=n.extend({_doReset:function(){for(var c=this._key.words,d=this.cfg.iv,f=0;f<4;f++)c[f]=(c[f]<<8|c[f]>>>24)&16711935|(c[f]<<24|c[f]>>>8)&4278255360;var p=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],m=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var f=0;f<4;f++)l.call(this);for(var f=0;f<8;f++)m[f]^=p[f+4&7];if(d){var h=d.words,b=h[0],g=h[1],_=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,w=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=_>>>16|w&4294901760,C=w<<16|_&65535;m[0]^=_,m[1]^=x,m[2]^=w,m[3]^=C,m[4]^=_,m[5]^=x,m[6]^=w,m[7]^=C;for(var f=0;f<4;f++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,b=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=b^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=n._createHelper(u)}(),t.Rabbit})});var CCt=v((gre,xCt)=>{(function(t,e,r){typeof gre=="object"?xCt.exports=gre=e(In(),nA(),oA(),iO(),wl()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(gre,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.RabbitLegacy=n.extend({_doReset:function(){var c=this._key.words,d=this.cfg.iv,f=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],p=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var m=0;m<4;m++)l.call(this);for(var m=0;m<8;m++)p[m]^=f[m+4&7];if(d){var h=d.words,b=h[0],g=h[1],_=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,w=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=_>>>16|w&4294901760,C=w<<16|_&65535;p[0]^=_,p[1]^=x,p[2]^=w,p[3]^=C,p[4]^=_,p[5]^=x,p[6]^=w,p[7]^=C;for(var m=0;m<4;m++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,b=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=b^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=n._createHelper(u)}(),t.RabbitLegacy})});var PCt=v((yre,OCt)=>{(function(t,e,r){typeof yre=="object"?OCt.exports=yre=e(In(),nA(),oA(),iO(),wl()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(yre,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo;let i=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var u={pbox:[],sbox:[]};function l(m,h){let b=h>>24&255,g=h>>16&255,_=h>>8&255,w=h&255,x=m.sbox[0][b]+m.sbox[1][g];return x=x^m.sbox[2][_],x=x+m.sbox[3][w],x}function c(m,h,b){let g=h,_=b,w;for(let x=0;x<i;++x)g=g^m.pbox[x],_=l(m,g)^_,w=g,g=_,_=w;return w=g,g=_,_=w,_=_^m.pbox[i],g=g^m.pbox[i+1],{left:g,right:_}}function d(m,h,b){let g=h,_=b,w;for(let x=i+1;x>1;--x)g=g^m.pbox[x],_=l(m,g)^_,w=g,g=_,_=w;return w=g,g=_,_=w,_=_^m.pbox[1],g=g^m.pbox[0],{left:g,right:_}}function f(m,h,b){for(let C=0;C<4;C++){m.sbox[C]=[];for(let E=0;E<256;E++)m.sbox[C][E]=s[C][E]}let g=0;for(let C=0;C<i+2;C++)m.pbox[C]=a[C]^h[g],g++,g>=b&&(g=0);let _=0,w=0,x=0;for(let C=0;C<i+2;C+=2)x=c(m,_,w),_=x.left,w=x.right,m.pbox[C]=_,m.pbox[C+1]=w;for(let C=0;C<4;C++)for(let E=0;E<256;E+=2)x=c(m,_,w),_=x.left,w=x.right,m.sbox[C][E]=_,m.sbox[C][E+1]=w;return!0}var p=o.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var m=this._keyPriorReset=this._key,h=m.words,b=m.sigBytes/4;f(u,h,b)}},encryptBlock:function(m,h){var b=c(u,m[h],m[h+1]);m[h]=b.left,m[h+1]=b.right},decryptBlock:function(m,h){var b=d(u,m[h],m[h+1]);m[h]=b.left,m[h+1]=b.right},blockSize:64/32,keySize:128/32,ivSize:64/32});e.Blowfish=n._createHelper(p)}(),t.Blowfish})});var eB=v((bre,ECt)=>{(function(t,e,r){typeof bre=="object"?ECt.exports=bre=e(In(),JH(),Cxt(),Pxt(),nA(),Axt(),oA(),VEe(),Hte(),Dxt(),WEe(),Fxt(),$xt(),qxt(),Zte(),Hxt(),iO(),wl(),Jxt(),Yxt(),Xxt(),eCt(),rCt(),oCt(),aCt(),uCt(),cCt(),fCt(),mCt(),gCt(),bCt(),vCt(),SCt(),CCt(),PCt()):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)})(bre,function(t){return t})});var sO,RCt=O(()=>{sO=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 KCt=v((aTe,sTe)=>{(function(t,e){typeof aTe=="object"&&typeof sTe<"u"?sTe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(aTe,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 uA=v((uTe,lTe)=>{(function(t,e){typeof uTe=="object"&&typeof lTe<"u"?lTe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(uTe,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",l="month",c="quarter",d="year",f="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(D){var k=["th","st","nd","rd"],F=D%100;return"["+D+(k[(F-20)%10]||k[F]||k[0])+"]"}},g=function(D,k,F){var B=String(D);return!B||B.length>=k?D:""+Array(k+1-B.length).join(F)+D},_={s:g,z:function(D){var k=-D.utcOffset(),F=Math.abs(k),B=Math.floor(F/60),q=F%60;return(k<=0?"+":"-")+g(B,2,"0")+":"+g(q,2,"0")},m:function D(k,F){if(k.date()<F.date())return-D(F,k);var B=12*(F.year()-k.year())+(F.month()-k.month()),q=k.clone().add(B,l),W=F-q<0,H=k.clone().add(B+(W?-1:1),l);return+(-(B+(F-q)/(W?q-H:H-q))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:l,y:d,w:u,d:s,D:f,h:a,m:i,s:o,ms:n,Q:c}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},w="en",x={};x[w]=b;var C="$isDayjsObject",E=function(D){return D instanceof R||!(!D||!D[C])},P=function D(k,F,B){var q;if(!k)return w;if(typeof k=="string"){var W=k.toLowerCase();x[W]&&(q=W),F&&(x[W]=F,q=W);var H=k.split("-");if(!q&&H.length>1)return D(H[0])}else{var L=k.name;x[L]=k,q=L}return!B&&q&&(w=q),q||!B&&w},A=function(D,k){if(E(D))return D.clone();var F=typeof k=="object"?k:{};return F.date=D,F.args=arguments,new R(F)},I=_;I.l=P,I.i=E,I.w=function(D,k){return A(D,{locale:k.$L,utc:k.$u,x:k.$x,$offset:k.$offset})};var R=function(){function D(F){this.$L=P(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[C]=!0}var k=D.prototype;return k.parse=function(F){this.$d=function(B){var q=B.date,W=B.utc;if(q===null)return new Date(NaN);if(I.u(q))return new Date;if(q instanceof Date)return new Date(q);if(typeof q=="string"&&!/Z$/i.test(q)){var H=q.match(m);if(H){var L=H[2]-1||0,z=(H[7]||"0").substring(0,3);return W?new Date(Date.UTC(H[1],L,H[3]||1,H[4]||0,H[5]||0,H[6]||0,z)):new Date(H[1],L,H[3]||1,H[4]||0,H[5]||0,H[6]||0,z)}}return new Date(q)}(F),this.init()},k.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},k.$utils=function(){return I},k.isValid=function(){return this.$d.toString()!==p},k.isSame=function(F,B){var q=A(F);return this.startOf(B)<=q&&q<=this.endOf(B)},k.isAfter=function(F,B){return A(F)<this.startOf(B)},k.isBefore=function(F,B){return this.endOf(B)<A(F)},k.$g=function(F,B,q){return I.u(F)?this[B]:this.set(q,F)},k.unix=function(){return Math.floor(this.valueOf()/1e3)},k.valueOf=function(){return this.$d.getTime()},k.startOf=function(F,B){var q=this,W=!!I.u(B)||B,H=I.p(F),L=function(ie,Ie){var st=I.w(q.$u?Date.UTC(q.$y,Ie,ie):new Date(q.$y,Ie,ie),q);return W?st:st.endOf(s)},z=function(ie,Ie){return I.w(q.toDate()[ie].apply(q.toDate("s"),(W?[0,0,0,0]:[23,59,59,999]).slice(Ie)),q)},K=this.$W,J=this.$M,ee=this.$D,Pe="set"+(this.$u?"UTC":"");switch(H){case d:return W?L(1,0):L(31,11);case l:return W?L(1,J):L(0,J+1);case u:var G=this.$locale().weekStart||0,Z=(K<G?K+7:K)-G;return L(W?ee-Z:ee+(6-Z),J);case s:case f:return z(Pe+"Hours",0);case a:return z(Pe+"Minutes",1);case i:return z(Pe+"Seconds",2);case o:return z(Pe+"Milliseconds",3);default:return this.clone()}},k.endOf=function(F){return this.startOf(F,!1)},k.$set=function(F,B){var q,W=I.p(F),H="set"+(this.$u?"UTC":""),L=(q={},q[s]=H+"Date",q[f]=H+"Date",q[l]=H+"Month",q[d]=H+"FullYear",q[a]=H+"Hours",q[i]=H+"Minutes",q[o]=H+"Seconds",q[n]=H+"Milliseconds",q)[W],z=W===s?this.$D+(B-this.$W):B;if(W===l||W===d){var K=this.clone().set(f,1);K.$d[L](z),K.init(),this.$d=K.set(f,Math.min(this.$D,K.daysInMonth())).$d}else L&&this.$d[L](z);return this.init(),this},k.set=function(F,B){return this.clone().$set(F,B)},k.get=function(F){return this[I.p(F)]()},k.add=function(F,B){var q,W=this;F=Number(F);var H=I.p(B),L=function(J){var ee=A(W);return I.w(ee.date(ee.date()+Math.round(J*F)),W)};if(H===l)return this.set(l,this.$M+F);if(H===d)return this.set(d,this.$y+F);if(H===s)return L(1);if(H===u)return L(7);var z=(q={},q[i]=e,q[a]=r,q[o]=t,q)[H]||1,K=this.$d.getTime()+F*z;return I.w(K,this)},k.subtract=function(F,B){return this.add(-1*F,B)},k.format=function(F){var B=this,q=this.$locale();if(!this.isValid())return q.invalidDate||p;var W=F||"YYYY-MM-DDTHH:mm:ssZ",H=I.z(this),L=this.$H,z=this.$m,K=this.$M,J=q.weekdays,ee=q.months,Pe=q.meridiem,G=function(Ie,st,Te,Qe){return Ie&&(Ie[st]||Ie(B,W))||Te[st].slice(0,Qe)},Z=function(Ie){return I.s(L%12||12,Ie,"0")},ie=Pe||function(Ie,st,Te){var Qe=Ie<12?"AM":"PM";return Te?Qe.toLowerCase():Qe};return W.replace(h,function(Ie,st){return st||function(Te){switch(Te){case"YY":return String(B.$y).slice(-2);case"YYYY":return I.s(B.$y,4,"0");case"M":return K+1;case"MM":return I.s(K+1,2,"0");case"MMM":return G(q.monthsShort,K,ee,3);case"MMMM":return G(ee,K);case"D":return B.$D;case"DD":return I.s(B.$D,2,"0");case"d":return String(B.$W);case"dd":return G(q.weekdaysMin,B.$W,J,2);case"ddd":return G(q.weekdaysShort,B.$W,J,3);case"dddd":return J[B.$W];case"H":return String(L);case"HH":return I.s(L,2,"0");case"h":return Z(1);case"hh":return Z(2);case"a":return ie(L,z,!0);case"A":return ie(L,z,!1);case"m":return String(z);case"mm":return I.s(z,2,"0");case"s":return String(B.$s);case"ss":return I.s(B.$s,2,"0");case"SSS":return I.s(B.$ms,3,"0");case"Z":return H}return null}(Ie)||H.replace(":","")})},k.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},k.diff=function(F,B,q){var W,H=this,L=I.p(B),z=A(F),K=(z.utcOffset()-this.utcOffset())*e,J=this-z,ee=function(){return I.m(H,z)};switch(L){case d:W=ee()/12;break;case l:W=ee();break;case c:W=ee()/3;break;case u:W=(J-K)/6048e5;break;case s:W=(J-K)/864e5;break;case a:W=J/r;break;case i:W=J/e;break;case o:W=J/t;break;default:W=J}return q?W:I.a(W)},k.daysInMonth=function(){return this.endOf(l).$D},k.$locale=function(){return x[this.$L]},k.locale=function(F,B){if(!F)return this.$L;var q=this.clone(),W=P(F,B,!0);return W&&(q.$L=W),q},k.clone=function(){return I.w(this.$d,this)},k.toDate=function(){return new Date(this.valueOf())},k.toJSON=function(){return this.isValid()?this.toISOString():null},k.toISOString=function(){return this.$d.toISOString()},k.toString=function(){return this.$d.toUTCString()},D}(),j=R.prototype;return A.prototype=j,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",l],["$y",d],["$D",f]].forEach(function(D){j[D[1]]=function(k){return this.$g(k,D[0],D[1])}}),A.extend=function(D,k){return D.$i||(D(k,R,A),D.$i=!0),A},A.locale=P,A.isDayjs=E,A.unix=function(D){return A(1e3*D)},A.en=x[w],A.Ls=x,A.p={},A})});var vo=v(rIe=>{"use strict";Object.defineProperty(rIe,"__esModule",{value:!0});rIe.pathToFunc=a6r;var i6r=Object.prototype.hasOwnProperty;function a6r(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!i6r.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 roe=v(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});Hh.SDK_METADATA=Hh.ServerList=Hh.ServerEu=void 0;Hh.serverURLFromOptions=u6r;var s6r=vo();Hh.ServerEu="eu";Hh.ServerList={[Hh.ServerEu]:"https://api.mistral.ai"};function u6r(t){let e=t.serverURL,r={};if(!e){let o=t.server??Hh.ServerEu;e=Hh.ServerList[o]||""}let n=(0,s6r.pathToFunc)(e)(r);return new URL(n)}Hh.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 oIe=v(nIe=>{"use strict";Object.defineProperty(nIe,"__esModule",{value:!0});nIe.readableStreamToArrayBuffer=l6r;async function l6r(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 iTt=v(noe=>{"use strict";Object.defineProperty(noe,"__esModule",{value:!0});noe.CustomUserAgentHook=void 0;var c6r=roe(),iIe=class{beforeRequest(e,r){let o=`mistral-client-typescript/${c6r.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};noe.CustomUserAgentHook=iIe});var sTt=v(ooe=>{"use strict";Object.defineProperty(ooe,"__esModule",{value:!0});ooe.DeprecationWarningHook=void 0;var aTt="x-model-deprecation-timestamp",aIe=class{afterSuccess(e,r){return r.headers.has(aTt)&&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(aTt)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};ooe.DeprecationWarningHook=aIe});var uTt=v(sIe=>{"use strict";Object.defineProperty(sIe,"__esModule",{value:!0});sIe.initHooks=p6r;var d6r=iTt(),f6r=sTt();function p6r(t){let e=new d6r.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new f6r.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var lTt=v(ioe=>{"use strict";Object.defineProperty(ioe,"__esModule",{value:!0});ioe.SDKHooks=void 0;var m6r=uTt(),uIe=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,m6r.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}}};ioe.SDKHooks=uIe});var mIe=v(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});Pp.ConnectionError=Pp.RequestTimeoutError=Pp.RequestAbortedError=Pp.InvalidRequestError=Pp.UnexpectedClientError=Pp.HTTPClientError=void 0;var NA=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)}};Pp.HTTPClientError=NA;var lIe=class extends NA{constructor(){super(...arguments),this.name="UnexpectedClientError"}};Pp.UnexpectedClientError=lIe;var cIe=class extends NA{constructor(){super(...arguments),this.name="InvalidRequestError"}};Pp.InvalidRequestError=cIe;var dIe=class extends NA{constructor(){super(...arguments),this.name="RequestAbortedError"}};Pp.RequestAbortedError=dIe;var fIe=class extends NA{constructor(){super(...arguments),this.name="RequestTimeoutError"}};Pp.RequestTimeoutError=fIe;var pIe=class extends NA{constructor(){super(...arguments),this.name="ConnectionError"}};Pp.ConnectionError=pIe});var Vh=v(GB=>{"use strict";Object.defineProperty(GB,"__esModule",{value:!0});GB.OK=h6r;GB.ERR=g6r;GB.unwrap=y6r;GB.unwrapAsync=b6r;function h6r(t){return{ok:!0,value:t}}function g6r(t){return{ok:!1,error:t}}function y6r(t){if(!t.ok)throw t.error;return t.value}async function b6r(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var R8=v(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.getParsedType=Fi.ZodParsedType=Fi.objectUtil=Fi.util=void 0;var hIe;(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})(hIe||(Fi.util=hIe={}));var cTt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(cTt||(Fi.objectUtil=cTt={}));Fi.ZodParsedType=hIe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var _6r=t=>{switch(typeof t){case"undefined":return Fi.ZodParsedType.undefined;case"string":return Fi.ZodParsedType.string;case"number":return isNaN(t)?Fi.ZodParsedType.nan:Fi.ZodParsedType.number;case"boolean":return Fi.ZodParsedType.boolean;case"function":return Fi.ZodParsedType.function;case"bigint":return Fi.ZodParsedType.bigint;case"symbol":return Fi.ZodParsedType.symbol;case"object":return Array.isArray(t)?Fi.ZodParsedType.array:t===null?Fi.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Fi.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?Fi.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?Fi.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?Fi.ZodParsedType.date:Fi.ZodParsedType.object;default:return Fi.ZodParsedType.unknown}};Fi.getParsedType=_6r});var aoe=v(LA=>{"use strict";Object.defineProperty(LA,"__esModule",{value:!0});LA.ZodError=LA.quotelessJson=LA.ZodIssueCode=void 0;var dTt=R8();LA.ZodIssueCode=dTt.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 v6r=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");LA.quotelessJson=v6r;var j8=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],u++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,dTt.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()}};LA.ZodError=j8;j8.create=t=>new j8(t)});var yIe=v(gIe=>{"use strict";Object.defineProperty(gIe,"__esModule",{value:!0});var Fj=R8(),kd=aoe(),w6r=(t,e)=>{let r;switch(t.code){case kd.ZodIssueCode.invalid_type:t.received===Fj.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case kd.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Fj.util.jsonStringifyReplacer)}`;break;case kd.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Fj.util.joinValues(t.keys,", ")}`;break;case kd.ZodIssueCode.invalid_union:r="Invalid input";break;case kd.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Fj.util.joinValues(t.options)}`;break;case kd.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Fj.util.joinValues(t.options)}, received '${t.received}'`;break;case kd.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case kd.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case kd.ZodIssueCode.invalid_date:r="Invalid date";break;case kd.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}"`:Fj.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case kd.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 kd.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 kd.ZodIssueCode.custom:r="Invalid input";break;case kd.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case kd.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case kd.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Fj.util.assertNever(t)}return{message:r}};gIe.default=w6r});var soe=v(HS=>{"use strict";var S6r=HS&&HS.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(HS,"__esModule",{value:!0});HS.getErrorMap=HS.setErrorMap=HS.defaultErrorMap=void 0;var fTt=S6r(yIe());HS.defaultErrorMap=fTt.default;var pTt=fTt.default;function x6r(t){pTt=t}HS.setErrorMap=x6r;function C6r(){return pTt}HS.getErrorMap=C6r});var _Ie=v(ni=>{"use strict";var O6r=ni&&ni.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ni,"__esModule",{value:!0});ni.isAsync=ni.isValid=ni.isDirty=ni.isAborted=ni.OK=ni.DIRTY=ni.INVALID=ni.ParseStatus=ni.addIssueToContext=ni.EMPTY_PATH=ni.makeIssue=void 0;var P6r=soe(),mTt=O6r(yIe()),E6r=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}};ni.makeIssue=E6r;ni.EMPTY_PATH=[];function T6r(t,e){let r=(0,P6r.getErrorMap)(),n=(0,ni.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===mTt.default?void 0:mTt.default].filter(o=>!!o)});t.common.issues.push(n)}ni.addIssueToContext=T6r;var bIe=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return ni.INVALID;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return ni.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}}};ni.ParseStatus=bIe;ni.INVALID=Object.freeze({status:"aborted"});var A6r=t=>({status:"dirty",value:t});ni.DIRTY=A6r;var I6r=t=>({status:"valid",value:t});ni.OK=I6r;var M6r=t=>t.status==="aborted";ni.isAborted=M6r;var R6r=t=>t.status==="dirty";ni.isDirty=R6r;var j6r=t=>t.status==="valid";ni.isValid=j6r;var D6r=t=>typeof Promise<"u"&&t instanceof Promise;ni.isAsync=D6r});var gTt=v(hTt=>{"use strict";Object.defineProperty(hTt,"__esModule",{value:!0})});var bTt=v(uoe=>{"use strict";Object.defineProperty(uoe,"__esModule",{value:!0});uoe.errorUtil=void 0;var yTt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(yTt||(uoe.errorUtil=yTt={}))});var MTt=v(X=>{"use strict";var coe=X&&X.__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)},wTt=X&&X.__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},D8,N8;Object.defineProperty(X,"__esModule",{value:!0});X.boolean=X.bigint=X.array=X.any=X.coerce=X.ZodFirstPartyTypeKind=X.late=X.ZodSchema=X.Schema=X.custom=X.ZodReadonly=X.ZodPipeline=X.ZodBranded=X.BRAND=X.ZodNaN=X.ZodCatch=X.ZodDefault=X.ZodNullable=X.ZodOptional=X.ZodTransformer=X.ZodEffects=X.ZodPromise=X.ZodNativeEnum=X.ZodEnum=X.ZodLiteral=X.ZodLazy=X.ZodFunction=X.ZodSet=X.ZodMap=X.ZodRecord=X.ZodTuple=X.ZodIntersection=X.ZodDiscriminatedUnion=X.ZodUnion=X.ZodObject=X.ZodArray=X.ZodVoid=X.ZodNever=X.ZodUnknown=X.ZodAny=X.ZodNull=X.ZodUndefined=X.ZodSymbol=X.ZodDate=X.ZodBoolean=X.ZodBigInt=X.ZodNumber=X.ZodString=X.datetimeRegex=X.ZodType=void 0;X.NEVER=X.void=X.unknown=X.union=X.undefined=X.tuple=X.transformer=X.symbol=X.string=X.strictObject=X.set=X.record=X.promise=X.preprocess=X.pipeline=X.ostring=X.optional=X.onumber=X.oboolean=X.object=X.number=X.nullable=X.null=X.never=X.nativeEnum=X.nan=X.map=X.literal=X.lazy=X.intersection=X.instanceof=X.function=X.enum=X.effect=X.discriminatedUnion=X.date=void 0;var loe=soe(),Rt=bTt(),Q=_Ie(),Xe=R8(),ze=aoe(),Kh=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}},_Tt=(t,e)=>{if((0,Q.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 ze.ZodError(t.common.issues);return this._error=r,this._error}}};function Kr(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 Jr=class{get description(){return this._def.description}_getType(e){return(0,Xe.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,Xe.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Q.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,Xe.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,Q.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,Xe.getParsedType)(e)},i=this._parseSync({data:e,path:o.path,parent:o});return _Tt(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,Xe.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:o});return(0,Q.isValid)(i)?{value:i.value}:{issues:o.common.issues}}catch(i){!((n=(r=i?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then(i=>(0,Q.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,Xe.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,Q.isAsync)(o)?o:Promise.resolve(o));return _Tt(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:ze.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 Im({schema:this,typeName:dr.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Wh.create(this,this._def)}nullable(){return WS.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wO.create(this)}promise(){return $A.create(this,this._def)}or(e){return Hj.create([this,e],this._def)}and(e){return Vj.create(this,e,this._def)}transform(e){return new Im({...Kr(this._def),schema:this,typeName:dr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Yj({...Kr(this._def),innerType:this,defaultValue:r,typeName:dr.ZodDefault})}brand(){return new L8({typeName:dr.ZodBranded,type:this,...Kr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Zj({...Kr(this._def),innerType:this,catchValue:r,typeName:dr.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return F8.create(this,e)}readonly(){return Xj.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};X.ZodType=Jr;X.Schema=Jr;X.ZodSchema=Jr;var N6r=/^c[^\s-]{8,}$/i,L6r=/^[0-9a-z]+$/,F6r=/^[0-9A-HJKMNP-TV-Z]{26}$/i,k6r=/^[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,$6r=/^[a-z0-9_-]{21}$/i,B6r=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,q6r=/^[-+]?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)?)??$/,U6r=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,z6r="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",vIe,H6r=/^(?:(?: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])$/,V6r=/^(?:(?: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])$/,W6r=/^(([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]))$/,K6r=/^(([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])$/,J6r=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,G6r=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,STt="((\\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])))",Y6r=new RegExp(`^${STt}$`);function xTt(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 Z6r(t){return new RegExp(`^${xTt(t)}$`)}function CTt(t){let e=`${STt}T${xTt(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}X.datetimeRegex=CTt;function X6r(t,e){return!!((e==="v4"||!e)&&H6r.test(t)||(e==="v6"||!e)&&W6r.test(t))}function Q6r(t,e){if(!B6r.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 e5r(t,e){return!!((e==="v4"||!e)&&V6r.test(t)||(e==="v6"||!e)&&K6r.test(t))}var FA=class t extends Jr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Xe.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(i,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.string,received:i.parsedType}),Q.INVALID}let n=new Q.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{code:ze.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,Q.addIssueToContext)(o,{code:ze.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,Q.addIssueToContext)(o,{code:ze.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,Q.addIssueToContext)(o,{code:ze.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")U6r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{validation:"email",code:ze.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")vIe||(vIe=new RegExp(z6r,"u")),vIe.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{validation:"emoji",code:ze.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")k6r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{validation:"uuid",code:ze.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")$6r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{validation:"nanoid",code:ze.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")N6r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{validation:"cuid",code:ze.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")L6r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{validation:"cuid2",code:ze.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")F6r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{validation:"ulid",code:ze.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,Q.addIssueToContext)(o,{validation:"url",code:ze.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,Q.addIssueToContext)(o,{validation:"regex",code:ze.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,Q.addIssueToContext)(o,{code:ze.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,Q.addIssueToContext)(o,{code:ze.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,Q.addIssueToContext)(o,{code:ze.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?CTt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{code:ze.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Y6r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{code:ze.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Z6r(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{code:ze.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?q6r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{validation:"duration",code:ze.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?X6r(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{validation:"ip",code:ze.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Q6r(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{validation:"jwt",code:ze.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?e5r(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{validation:"cidr",code:ze.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?J6r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{validation:"base64",code:ze.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?G6r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{validation:"base64url",code:ze.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):Xe.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:ze.ZodIssueCode.invalid_string,...Rt.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Rt.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Rt.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Rt.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Rt.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Rt.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Rt.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Rt.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Rt.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Rt.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Rt.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Rt.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Rt.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Rt.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,...Rt.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,...Rt.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Rt.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Rt.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Rt.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Rt.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Rt.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Rt.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Rt.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Rt.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,Rt.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};X.ZodString=FA;FA.create=t=>{var e;return new FA({checks:[],typeName:dr.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Kr(t)})};function t5r(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 kj=class t extends Jr{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)!==Xe.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(i,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.number,received:i.parsedType}),Q.INVALID}let n,o=new Q.ParseStatus;for(let i of this._def.checks)i.kind==="int"?Xe.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,Q.addIssueToContext)(n,{code:ze.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,Q.addIssueToContext)(n,{code:ze.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,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?t5r(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,Q.addIssueToContext)(n,{code:ze.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,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.not_finite,message:i.message}),o.dirty()):Xe.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Rt.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Rt.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Rt.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Rt.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Rt.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Rt.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Rt.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Rt.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Rt.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Rt.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Rt.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Rt.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Rt.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Rt.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"&&Xe.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)}};X.ZodNumber=kj;kj.create=t=>new kj({checks:[],typeName:dr.ZodNumber,coerce:t?.coerce||!1,...Kr(t)});var $j=class t extends Jr{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)!==Xe.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new Q.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,Q.addIssueToContext)(n,{code:ze.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,Q.addIssueToContext)(n,{code:ze.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,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Xe.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(r,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.bigint,received:r.parsedType}),Q.INVALID}gte(e,r){return this.setLimit("min",e,!0,Rt.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Rt.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Rt.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Rt.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Rt.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Rt.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Rt.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Rt.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Rt.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Rt.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}};X.ZodBigInt=$j;$j.create=t=>{var e;return new $j({checks:[],typeName:dr.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Kr(t)})};var Bj=class extends Jr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Xe.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.boolean,received:n.parsedType}),Q.INVALID}return(0,Q.OK)(e.data)}};X.ZodBoolean=Bj;Bj.create=t=>new Bj({typeName:dr.ZodBoolean,coerce:t?.coerce||!1,...Kr(t)});var qj=class t extends Jr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Xe.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(i,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.date,received:i.parsedType}),Q.INVALID}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(i,{code:ze.ZodIssueCode.invalid_date}),Q.INVALID}let n=new Q.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,Q.addIssueToContext)(o,{code:ze.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,Q.addIssueToContext)(o,{code:ze.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Xe.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Rt.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Rt.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}};X.ZodDate=qj;qj.create=t=>new qj({checks:[],coerce:t?.coerce||!1,typeName:dr.ZodDate,...Kr(t)});var ZB=class extends Jr{_parse(e){if(this._getType(e)!==Xe.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.symbol,received:n.parsedType}),Q.INVALID}return(0,Q.OK)(e.data)}};X.ZodSymbol=ZB;ZB.create=t=>new ZB({typeName:dr.ZodSymbol,...Kr(t)});var Uj=class extends Jr{_parse(e){if(this._getType(e)!==Xe.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.undefined,received:n.parsedType}),Q.INVALID}return(0,Q.OK)(e.data)}};X.ZodUndefined=Uj;Uj.create=t=>new Uj({typeName:dr.ZodUndefined,...Kr(t)});var zj=class extends Jr{_parse(e){if(this._getType(e)!==Xe.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.null,received:n.parsedType}),Q.INVALID}return(0,Q.OK)(e.data)}};X.ZodNull=zj;zj.create=t=>new zj({typeName:dr.ZodNull,...Kr(t)});var kA=class extends Jr{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,Q.OK)(e.data)}};X.ZodAny=kA;kA.create=t=>new kA({typeName:dr.ZodAny,...Kr(t)});var vO=class extends Jr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,Q.OK)(e.data)}};X.ZodUnknown=vO;vO.create=t=>new vO({typeName:dr.ZodUnknown,...Kr(t)});var xy=class extends Jr{_parse(e){let r=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(r,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.never,received:r.parsedType}),Q.INVALID}};X.ZodNever=xy;xy.create=t=>new xy({typeName:dr.ZodNever,...Kr(t)});var XB=class extends Jr{_parse(e){if(this._getType(e)!==Xe.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.void,received:n.parsedType}),Q.INVALID}return(0,Q.OK)(e.data)}};X.ZodVoid=XB;XB.create=t=>new XB({typeName:dr.ZodVoid,...Kr(t)});var wO=class t extends Jr{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==Xe.ZodParsedType.array)return(0,Q.addIssueToContext)(r,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.array,received:r.parsedType}),Q.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,Q.addIssueToContext)(r,{code:a?ze.ZodIssueCode.too_big:ze.ZodIssueCode.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&((0,Q.addIssueToContext)(r,{code:ze.ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&((0,Q.addIssueToContext)(r,{code:ze.ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new Kh(r,a,r.path,s)))).then(a=>Q.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Kh(r,a,r.path,s)));return Q.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Rt.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Rt.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Rt.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};X.ZodArray=wO;wO.create=(t,e)=>new wO({type:t,minLength:null,maxLength:null,exactLength:null,typeName:dr.ZodArray,...Kr(e)});function YB(t){if(t instanceof Ep){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Wh.create(YB(n))}return new Ep({...t._def,shape:()=>e})}else return t instanceof wO?new wO({...t._def,type:YB(t.element)}):t instanceof Wh?Wh.create(YB(t.unwrap())):t instanceof WS?WS.create(YB(t.unwrap())):t instanceof VS?VS.create(t.items.map(e=>YB(e))):t}var Ep=class t extends Jr{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=Xe.util.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Xe.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(l,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.object,received:l.parsedType}),Q.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof xy&&this._def.unknownKeys==="strip"))for(let l in o.data)a.includes(l)||s.push(l);let u=[];for(let l of a){let c=i[l],d=o.data[l];u.push({key:{status:"valid",value:l},value:c._parse(new Kh(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof xy){let l=this._def.unknownKeys;if(l==="passthrough")for(let c of s)u.push({key:{status:"valid",value:c},value:{status:"valid",value:o.data[c]}});else if(l==="strict")s.length>0&&((0,Q.addIssueToContext)(o,{code:ze.ZodIssueCode.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let c of s){let d=o.data[c];u.push({key:{status:"valid",value:c},value:l._parse(new Kh(o,d,o.path,c)),alwaysSet:c in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let c of u){let d=await c.key,f=await c.value;l.push({key:d,value:f,alwaysSet:c.alwaysSet})}return l}).then(l=>Q.ParseStatus.mergeObjectSync(n,l)):Q.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Rt.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,i,a,s;let u=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=Rt.errorUtil.errToObj(e).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:dr.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return Xe.util.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return Xe.util.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return YB(this)}partial(e){let r={};return Xe.util.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return Xe.util.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Wh;)i=i._def.innerType;r[n]=i}}),new t({...this._def,shape:()=>r})}keyof(){return OTt(Xe.util.objectKeys(this.shape))}};X.ZodObject=Ep;Ep.create=(t,e)=>new Ep({shape:()=>t,unknownKeys:"strip",catchall:xy.create(),typeName:dr.ZodObject,...Kr(e)});Ep.strictCreate=(t,e)=>new Ep({shape:()=>t,unknownKeys:"strict",catchall:xy.create(),typeName:dr.ZodObject,...Kr(e)});Ep.lazycreate=(t,e)=>new Ep({shape:t,unknownKeys:"strip",catchall:xy.create(),typeName:dr.ZodObject,...Kr(e)});var Hj=class extends Jr{_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 ze.ZodError(s.ctx.common.issues));return(0,Q.addIssueToContext)(r,{code:ze.ZodIssueCode.invalid_union,unionErrors:a}),Q.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let u of n){let l={...r,common:{...r.common,issues:[]},parent:null},c=u._parseSync({data:r.data,path:r.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!i&&(i={result:c,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new ze.ZodError(u));return(0,Q.addIssueToContext)(r,{code:ze.ZodIssueCode.invalid_union,unionErrors:s}),Q.INVALID}}get options(){return this._def.options}};X.ZodUnion=Hj;Hj.create=(t,e)=>new Hj({options:t,typeName:dr.ZodUnion,...Kr(e)});var _O=t=>t instanceof Wj?_O(t.schema):t instanceof Im?_O(t.innerType()):t instanceof Kj?[t.value]:t instanceof Jj?t.options:t instanceof Gj?Xe.util.objectValues(t.enum):t instanceof Yj?_O(t._def.innerType):t instanceof Uj?[void 0]:t instanceof zj?[null]:t instanceof Wh?[void 0,..._O(t.unwrap())]:t instanceof WS?[null,..._O(t.unwrap())]:t instanceof L8||t instanceof Xj?_O(t.unwrap()):t instanceof Zj?_O(t._def.innerType):[],doe=class t extends Jr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Xe.ZodParsedType.object)return(0,Q.addIssueToContext)(r,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.object,received:r.parsedType}),Q.INVALID;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):((0,Q.addIssueToContext)(r,{code:ze.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Q.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=_O(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new t({typeName:dr.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Kr(n)})}};X.ZodDiscriminatedUnion=doe;function wIe(t,e){let r=(0,Xe.getParsedType)(t),n=(0,Xe.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===Xe.ZodParsedType.object&&n===Xe.ZodParsedType.object){let o=Xe.util.objectKeys(e),i=Xe.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=wIe(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===Xe.ZodParsedType.array&&n===Xe.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=wIe(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===Xe.ZodParsedType.date&&n===Xe.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Vj=class extends Jr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if((0,Q.isAborted)(i)||(0,Q.isAborted)(a))return Q.INVALID;let s=wIe(i.value,a.value);return s.valid?(((0,Q.isDirty)(i)||(0,Q.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.invalid_intersection_types}),Q.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};X.ZodIntersection=Vj;Vj.create=(t,e,r)=>new Vj({left:t,right:e,typeName:dr.ZodIntersection,...Kr(r)});var VS=class t extends Jr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Xe.ZodParsedType.array)return(0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.array,received:n.parsedType}),Q.INVALID;if(n.data.length<this._def.items.length)return(0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new Kh(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Q.ParseStatus.mergeArray(r,a)):Q.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};X.ZodTuple=VS;VS.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new VS({items:t,typeName:dr.ZodTuple,rest:null,...Kr(e)})};var foe=class t extends Jr{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!==Xe.ZodParsedType.object)return(0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.object,received:n.parsedType}),Q.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Kh(n,s,n.path,s)),value:a._parse(new Kh(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Q.ParseStatus.mergeObjectAsync(r,o):Q.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Jr?new t({keyType:e,valueType:r,typeName:dr.ZodRecord,...Kr(n)}):new t({keyType:FA.create(),valueType:e,typeName:dr.ZodRecord,...Kr(r)})}};X.ZodRecord=foe;var QB=class extends Jr{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!==Xe.ZodParsedType.map)return(0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.map,received:n.parsedType}),Q.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new Kh(n,s,n.path,[l,"key"])),value:i._parse(new Kh(n,u,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,c=await u.value;if(l.status==="aborted"||c.status==="aborted")return Q.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let u of a){let l=u.key,c=u.value;if(l.status==="aborted"||c.status==="aborted")return Q.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};X.ZodMap=QB;QB.create=(t,e,r)=>new QB({valueType:e,keyType:t,typeName:dr.ZodMap,...Kr(r)});var eq=class t extends Jr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Xe.ZodParsedType.set)return(0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.set,received:n.parsedType}),Q.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&((0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(u){let l=new Set;for(let c of u){if(c.status==="aborted")return Q.INVALID;c.status==="dirty"&&r.dirty(),l.add(c.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((u,l)=>i._parse(new Kh(n,u,n.path,l)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:Rt.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Rt.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};X.ZodSet=eq;eq.create=(t,e)=>new eq({valueType:t,minSize:null,maxSize:null,typeName:dr.ZodSet,...Kr(e)});var poe=class t extends Jr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Xe.ZodParsedType.function)return(0,Q.addIssueToContext)(r,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.function,received:r.parsedType}),Q.INVALID;function n(s,u){return(0,Q.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,loe.getErrorMap)(),loe.defaultErrorMap].filter(l=>!!l),issueData:{code:ze.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,Q.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,loe.getErrorMap)(),loe.defaultErrorMap].filter(l=>!!l),issueData:{code:ze.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof $A){let s=this;return(0,Q.OK)(async function(...u){let l=new ze.ZodError([]),c=await s._def.args.parseAsync(u,i).catch(p=>{throw l.addIssue(n(u,p)),l}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw l.addIssue(o(d,p)),l})})}else{let s=this;return(0,Q.OK)(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new ze.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 ze.ZodError([o(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:VS.create(e).rest(vO.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||VS.create([]).rest(vO.create()),returns:r||vO.create(),typeName:dr.ZodFunction,...Kr(n)})}};X.ZodFunction=poe;var Wj=class extends Jr{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})}};X.ZodLazy=Wj;Wj.create=(t,e)=>new Wj({getter:t,typeName:dr.ZodLazy,...Kr(e)});var Kj=class extends Jr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(r,{received:r.data,code:ze.ZodIssueCode.invalid_literal,expected:this._def.value}),Q.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};X.ZodLiteral=Kj;Kj.create=(t,e)=>new Kj({value:t,typeName:dr.ZodLiteral,...Kr(e)});function OTt(t,e){return new Jj({values:t,typeName:dr.ZodEnum,...Kr(e)})}var Jj=class t extends Jr{constructor(){super(...arguments),D8.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,Q.addIssueToContext)(r,{expected:Xe.util.joinValues(n),received:r.parsedType,code:ze.ZodIssueCode.invalid_type}),Q.INVALID}if(coe(this,D8,"f")||wTt(this,D8,new Set(this._def.values),"f"),!coe(this,D8,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,Q.addIssueToContext)(r,{received:r.data,code:ze.ZodIssueCode.invalid_enum_value,options:n}),Q.INVALID}return(0,Q.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};X.ZodEnum=Jj;D8=new WeakMap;Jj.create=OTt;var Gj=class extends Jr{constructor(){super(...arguments),N8.set(this,void 0)}_parse(e){let r=Xe.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Xe.ZodParsedType.string&&n.parsedType!==Xe.ZodParsedType.number){let o=Xe.util.objectValues(r);return(0,Q.addIssueToContext)(n,{expected:Xe.util.joinValues(o),received:n.parsedType,code:ze.ZodIssueCode.invalid_type}),Q.INVALID}if(coe(this,N8,"f")||wTt(this,N8,new Set(Xe.util.getValidEnumValues(this._def.values)),"f"),!coe(this,N8,"f").has(e.data)){let o=Xe.util.objectValues(r);return(0,Q.addIssueToContext)(n,{received:n.data,code:ze.ZodIssueCode.invalid_enum_value,options:o}),Q.INVALID}return(0,Q.OK)(e.data)}get enum(){return this._def.values}};X.ZodNativeEnum=Gj;N8=new WeakMap;Gj.create=(t,e)=>new Gj({values:t,typeName:dr.ZodNativeEnum,...Kr(e)});var $A=class extends Jr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Xe.ZodParsedType.promise&&r.common.async===!1)return(0,Q.addIssueToContext)(r,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.promise,received:r.parsedType}),Q.INVALID;let n=r.parsedType===Xe.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,Q.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};X.ZodPromise=$A;$A.create=(t,e)=>new $A({type:t,typeName:dr.ZodPromise,...Kr(e)});var Im=class extends Jr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===dr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{(0,Q.addIssueToContext)(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return Q.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?Q.INVALID:u.status==="dirty"||r.value==="dirty"?(0,Q.DIRTY)(u.value):u});{if(r.value==="aborted")return Q.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Q.INVALID:s.status==="dirty"||r.value==="dirty"?(0,Q.DIRTY)(s.value):s}}if(o.type==="refinement"){let a=s=>{let u=o.refinement(s,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Q.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Q.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,Q.isValid)(a))return a;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,Q.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);Xe.util.assertNever(o)}};X.ZodEffects=Im;X.ZodTransformer=Im;Im.create=(t,e,r)=>new Im({schema:t,typeName:dr.ZodEffects,effect:e,...Kr(r)});Im.createWithPreprocess=(t,e,r)=>new Im({schema:e,effect:{type:"preprocess",transform:t},typeName:dr.ZodEffects,...Kr(r)});var Wh=class extends Jr{_parse(e){return this._getType(e)===Xe.ZodParsedType.undefined?(0,Q.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};X.ZodOptional=Wh;Wh.create=(t,e)=>new Wh({innerType:t,typeName:dr.ZodOptional,...Kr(e)});var WS=class extends Jr{_parse(e){return this._getType(e)===Xe.ZodParsedType.null?(0,Q.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};X.ZodNullable=WS;WS.create=(t,e)=>new WS({innerType:t,typeName:dr.ZodNullable,...Kr(e)});var Yj=class extends Jr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Xe.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};X.ZodDefault=Yj;Yj.create=(t,e)=>new Yj({innerType:t,typeName:dr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Kr(e)});var Zj=class extends Jr{_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,Q.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ze.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ze.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};X.ZodCatch=Zj;Zj.create=(t,e)=>new Zj({innerType:t,typeName:dr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Kr(e)});var tq=class extends Jr{_parse(e){if(this._getType(e)!==Xe.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,Q.addIssueToContext)(n,{code:ze.ZodIssueCode.invalid_type,expected:Xe.ZodParsedType.nan,received:n.parsedType}),Q.INVALID}return{status:"valid",value:e.data}}};X.ZodNaN=tq;tq.create=t=>new tq({typeName:dr.ZodNaN,...Kr(t)});X.BRAND=Symbol("zod_brand");var L8=class extends Jr{_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}};X.ZodBranded=L8;var F8=class t extends Jr{_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"?Q.INVALID:i.status==="dirty"?(r.dirty(),(0,Q.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Q.INVALID:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:dr.ZodPipeline})}};X.ZodPipeline=F8;var Xj=class extends Jr{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,Q.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,Q.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};X.ZodReadonly=Xj;Xj.create=(t,e)=>new Xj({innerType:t,typeName:dr.ZodReadonly,...Kr(e)});function vTt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function PTt(t,e={},r){return t?kA.create().superRefine((n,o)=>{var i,a;let s=t(n);if(s instanceof Promise)return s.then(u=>{var l,c;if(!u){let d=vTt(e,n),f=(c=(l=d.fatal)!==null&&l!==void 0?l:r)!==null&&c!==void 0?c:!0;o.addIssue({code:"custom",...d,fatal:f})}});if(!s){let u=vTt(e,n),l=(a=(i=u.fatal)!==null&&i!==void 0?i:r)!==null&&a!==void 0?a:!0;o.addIssue({code:"custom",...u,fatal:l})}}):kA.create()}X.custom=PTt;X.late={object:Ep.lazycreate};var dr;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(dr||(X.ZodFirstPartyTypeKind=dr={}));var r5r=(t,e={message:`Input not instance of ${t.name}`})=>PTt(r=>r instanceof t,e);X.instanceof=r5r;var ETt=FA.create;X.string=ETt;var TTt=kj.create;X.number=TTt;var n5r=tq.create;X.nan=n5r;var o5r=$j.create;X.bigint=o5r;var ATt=Bj.create;X.boolean=ATt;var i5r=qj.create;X.date=i5r;var a5r=ZB.create;X.symbol=a5r;var s5r=Uj.create;X.undefined=s5r;var u5r=zj.create;X.null=u5r;var l5r=kA.create;X.any=l5r;var c5r=vO.create;X.unknown=c5r;var d5r=xy.create;X.never=d5r;var f5r=XB.create;X.void=f5r;var p5r=wO.create;X.array=p5r;var m5r=Ep.create;X.object=m5r;var h5r=Ep.strictCreate;X.strictObject=h5r;var g5r=Hj.create;X.union=g5r;var y5r=doe.create;X.discriminatedUnion=y5r;var b5r=Vj.create;X.intersection=b5r;var _5r=VS.create;X.tuple=_5r;var v5r=foe.create;X.record=v5r;var w5r=QB.create;X.map=w5r;var S5r=eq.create;X.set=S5r;var x5r=poe.create;X.function=x5r;var C5r=Wj.create;X.lazy=C5r;var O5r=Kj.create;X.literal=O5r;var P5r=Jj.create;X.enum=P5r;var E5r=Gj.create;X.nativeEnum=E5r;var T5r=$A.create;X.promise=T5r;var ITt=Im.create;X.effect=ITt;X.transformer=ITt;var A5r=Wh.create;X.optional=A5r;var I5r=WS.create;X.nullable=I5r;var M5r=Im.createWithPreprocess;X.preprocess=M5r;var R5r=F8.create;X.pipeline=R5r;var j5r=()=>ETt().optional();X.ostring=j5r;var D5r=()=>TTt().optional();X.onumber=D5r;var N5r=()=>ATt().optional();X.oboolean=N5r;X.coerce={string:t=>FA.create({...t,coerce:!0}),number:t=>kj.create({...t,coerce:!0}),boolean:t=>Bj.create({...t,coerce:!0}),bigint:t=>$j.create({...t,coerce:!0}),date:t=>qj.create({...t,coerce:!0})};X.NEVER=Q.INVALID});var SIe=v(Jh=>{"use strict";var L5r=Jh&&Jh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rq=Jh&&Jh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&L5r(e,t,r)};Object.defineProperty(Jh,"__esModule",{value:!0});rq(soe(),Jh);rq(_Ie(),Jh);rq(gTt(),Jh);rq(R8(),Jh);rq(MTt(),Jh);rq(aoe(),Jh)});var we=v(Tp=>{"use strict";var RTt=Tp&&Tp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F5r=Tp&&Tp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k5r=Tp&&Tp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RTt(e,t,r);return F5r(e,t),e},$5r=Tp&&Tp.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&RTt(e,t,r)};Object.defineProperty(Tp,"__esModule",{value:!0});Tp.z=void 0;var jTt=k5r(SIe());Tp.z=jTt;$5r(SIe(),Tp);Tp.default=jTt});var OIe=v(Xl=>{"use strict";var B5r=Xl&&Xl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),q5r=Xl&&Xl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U5r=Xl&&Xl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&B5r(e,t,r);return q5r(e,t),e};Object.defineProperty(Xl,"__esModule",{value:!0});Xl.zodInbound=Xl.zodOutbound=void 0;Xl.bytesToBase64=DTt;Xl.bytesFromBase64=xIe;Xl.stringToBytes=CIe;Xl.stringFromBytes=NTt;Xl.stringToBase64=z5r;Xl.stringFromBase64=H5r;var moe=U5r(we());function DTt(t){return btoa(String.fromCodePoint(...t))}function xIe(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function CIe(t){return new TextEncoder().encode(t)}function NTt(t){return new TextDecoder().decode(t)}function z5r(t){return DTt(CIe(t))}function H5r(t){return NTt(xIe(t))}Xl.zodOutbound=moe.instanceof(Uint8Array).or(moe.string().transform(CIe));Xl.zodInbound=moe.instanceof(Uint8Array).or(moe.string().transform(xIe))});var EIe=v(PIe=>{"use strict";Object.defineProperty(PIe,"__esModule",{value:!0});PIe.isPlainObject=V5r;function V5r(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 Go=v(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.encodeDeepObjectQuery=Xn.encodePipeDelimitedQuery=Xn.encodeSpaceDelimitedQuery=Xn.encodeFormQuery=Xn.encodeJSONQuery=Xn.encodeSimple=Xn.encodePipeDelimited=Xn.encodeSpaceDelimited=Xn.encodeForm=Xn.EncodingError=void 0;Xn.encodeMatrix=W5r;Xn.encodeLabel=K5r;Xn.encodeBodyForm=J5r;Xn.encodeDeepObject=FTt;Xn.encodeDeepObjectObject=AIe;Xn.encodeJSON=kTt;Xn.queryJoin=$Tt;Xn.queryEncoder=oq;Xn.appendForm=Y5r;var LTt=OIe(),Cy=EIe(),k8=class extends Error{constructor(e){super(e),this.name="EncodingError"}};Xn.EncodingError=k8;function W5r(t,e,r){let n="",o=r?.explode?$8(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(nq(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=B8(u,f=>`${a(f)}`)?.join(","):(0,Cy.isPlainObject)(u)?c=goe(Object.entries(u),([p,m])=>`,${i(p)},${a(m)}`)?.join("").slice(1):c=`${a(u)}`,c==null))return;let d=i(s);l=`${d}=${c}`,l===`${d}=`&&(l=l.slice(0,-1)),l&&(n+=`;${l}`)}),n}function K5r(t,e,r){let n="",o=r?.explode?$8(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(nq(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=B8(u,c=>`${a(c)}`)?.join("."):(0,Cy.isPlainObject)(u)?l=goe(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,Cy.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function TIe(t){return(e,r,n)=>{let o="",i=n?.explode?$8(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(nq(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=B8(c,p=>`${s(p)}`)?.join(u):(0,Cy.isPlainObject)(c)?f=goe(Object.entries(c),([p,m])=>`${a(p)}${u}${s(m)}`)?.join(u):f=`${s(c)}`,f!=null&&(d=`${a(l)}=${f}`,!(!d||d==="=")&&(o+=`&${d}`)))}),o.slice(1)}}Xn.encodeForm=TIe(",");Xn.encodeSpaceDelimited=TIe(" ");Xn.encodePipeDelimited=TIe("|");function J5r(t,e,r){let n="",o=r?.explode?$8(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(nq(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,Cy.isPlainObject)(u)?c=JSON.stringify(u,hoe):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function FTt(t,e,r){if(e!=null){if(!(0,Cy.isPlainObject)(e))throw new k8(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return AIe(t,e,r)}}function AIe(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,Cy.isPlainObject)(e))throw new k8(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,Cy.isPlainObject)(a)){let c=AIe(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=B8(u,c=>`${o(s)}=${o(nq(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function kTt(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,hoe));return r?.explode?o:`${n(t)}=${o}`}var G5r=(t,e,r)=>{let n="",o=r?.explode?$8(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(nq(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=B8(u,c=>`${a(c)}`)?.join(","):(0,Cy.isPlainObject)(u)?l=goe(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,Cy.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};Xn.encodeSimple=G5r;function $8(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,Cy.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function nq(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,LTt.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,hoe):`${t}`}function hoe(t,e){return e instanceof Uint8Array?(0,LTt.bytesToBase64)(e):e}function B8(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 goe(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 $Tt(...t){return t.filter(Boolean).join("&")}function oq(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 $Tt(...i)}}Xn.encodeJSONQuery=oq(kTt);Xn.encodeFormQuery=oq(Xn.encodeForm);Xn.encodeSpaceDelimitedQuery=oq(Xn.encodeSpaceDelimited);Xn.encodePipeDelimitedQuery=oq(Xn.encodePipeDelimited);Xn.encodeDeepObjectQuery=oq(FTt);function Y5r(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 BTt=v(IIe=>{"use strict";Object.defineProperty(IIe,"__esModule",{value:!0});IIe.dlv=Z5r;function Z5r(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 RIe=v(Mm=>{"use strict";var X5r=Mm&&Mm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q5r=Mm&&Mm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eWr=Mm&&Mm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&X5r(e,t,r);return Q5r(e,t),e};Object.defineProperty(Mm,"__esModule",{value:!0});Mm.envSchema=void 0;Mm.env=tWr;Mm.resetEnv=rWr;var qTt=BTt(),MIe=eWr(we());Mm.envSchema=MIe.object({MISTRAL_API_KEY:MIe.string().optional(),MISTRAL_DEBUG:MIe.coerce.boolean().optional()});var q8;function tWr(){return q8||(q8=Mm.envSchema.parse((0,qTt.dlv)(globalThis,"process.env")??(0,qTt.dlv)(globalThis,"Deno.env")??{}),q8)}function rWr(){q8=void 0}});var U8=v(KS=>{"use strict";Object.defineProperty(KS,"__esModule",{value:!0});KS.HTTPClient=void 0;KS.matchContentType=zTt;KS.matchStatusCode=HTt;KS.matchResponse=iWr;KS.isConnectionError=aWr;KS.isTimeoutError=sWr;KS.isAbortError=uWr;var nWr=(t,e)=>e==null?fetch(t):fetch(t,e),jIe=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||nWr}async request(e){let r=e;for(let n of this.requestHooks){let o=await n(r);o&&(r=o)}try{let n=await this.fetcher(r);for(let o of this.responseHooks)await o(n,r);return n}catch(n){for(let o of this.requestErrorHooks)await o(n,r);throw n}}addHook(...e){if(e[0]==="beforeRequest")this.requestHooks.push(e[1]);else if(e[0]==="requestError")this.requestErrorHooks.push(e[1]);else if(e[0]==="response")this.responseHooks.push(e[1]);else throw new Error(`Invalid hook type: ${e[0]}`);return this}removeHook(...e){let r;if(e[0]==="beforeRequest")r=this.requestHooks;else if(e[0]==="requestError")r=this.requestErrorHooks;else if(e[0]==="response")r=this.responseHooks;else throw new Error(`Invalid hook type: ${e[0]}`);let n=r.findIndex(o=>o===e[1]);return n>=0&&r.splice(n,1),this}clone(){let e=new t(this.options);return e.requestHooks=this.requestHooks.slice(),e.requestErrorHooks=this.requestErrorHooks.slice(),e.responseHooks=this.responseHooks.slice(),e}};KS.HTTPClient=jIe;var UTt=/\s*;\s*/g;function zTt(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(UTt),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(UTt),[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 oWr=new RegExp("^[0-9]xx$","i");function HTt(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(!oWr.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 iWr(t,e,r){return HTt(t,e)&&zTt(t,r)}function aWr(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 sWr(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 uWr(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 WTt=v(eD=>{"use strict";Object.defineProperty(eD,"__esModule",{value:!0});eD.TemporaryError=eD.PermanentError=void 0;eD.retry=cWr;var VTt=U8(),lWr={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},z8=class t extends Error{constructor(e,r){let n=e;r?.cause&&(n+=`: ${r.cause}`),super(n,r),this.name="PermanentError",typeof this.cause>"u"&&(this.cause=r?.cause),Object.setPrototypeOf(this,t.prototype)}};eD.PermanentError=z8;var Qj=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};eD.TemporaryError=Qj;async function cWr(t,e){switch(e.config.strategy){case"backoff":return mWr(dWr(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??lWr);default:return await t()}}function dWr(t,e){return async()=>{try{let r=await t();if(pWr(r,e.statusCodes))throw new Qj("Response failed with retryable status code",r);return r}catch(r){throw r instanceof Qj||e.retryConnectionErrors&&((0,VTt.isTimeoutError)(r)||(0,VTt.isConnectionError)(r))?r:new z8("Permanent error",{cause:r})}}}var fWr=new RegExp("^[0-9]xx$","i");function pWr(t,e){let r=`${t.status}`;return e.some(n=>{if(!fWr.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 mWr(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 z8)throw u.cause;if(Date.now()-a>r){if(u instanceof Qj)return u.response;throw u}let c=0;u instanceof Qj&&(c=hWr(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await gWr(d),s++}}function hWr(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 gWr(t){return new Promise(e=>setTimeout(e,t))}});var Rm=v(qA=>{"use strict";var H8=qA&&qA.__classPrivateFieldSet||function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},Gh=qA&&qA.__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)},boe,JS,SO;Object.defineProperty(qA,"__esModule",{value:!0});qA.ClientSDK=void 0;var KTt=lTt(),iq=mIe(),BA=Vh(),yWr=OIe(),JTt=roe(),bWr=Go(),_Wr=RIe(),xO=U8(),vWr=WTt(),yoe=typeof globalThis>"u"?null:globalThis,wWr=typeof yoe=="object"&&yoe!=null&&"importScripts"in yoe&&typeof yoe.importScripts=="function",SWr=wWr||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",DIe=class{constructor(e={}){boe.set(this,void 0),JS.set(this,void 0),SO.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof KTt.SDKHooks?H8(this,JS,r.hooks,"f"):H8(this,JS,new KTt.SDKHooks,"f"),this._options={...e,hooks:Gh(this,JS,"f")};let n=(0,JTt.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=Gh(this,JS,"f").sdkInit({baseURL:n,client:e.httpClient||new xO.HTTPClient});this._baseURL=o,H8(this,boe,i,"f"),H8(this,SO,e.debugLogger,"f"),!Gh(this,SO,"f")&&(0,_Wr.env)().MISTRAL_DEBUG&&H8(this,SO,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,BA.ERR)(new iq.InvalidRequestError("No base URL provided for operation"));let c=new URL(l),d=new URL(i,c);i&&(c.pathname+=c.pathname.endsWith("/")?"":"/",c.pathname+=d.pathname.replace(/^\/+/,""));let f=a||"",p=[];for(let[E,P]of Object.entries(u?.queryParams||{})){let A=(0,bWr.encodeForm)(E,P,{charEncoding:"percent"});typeof A<"u"&&p.push(A)}if(p.length&&(f+=`&${p.join("&")}`),f){let E=f.startsWith("&")?f.slice(1):f;c.search=`?${E}`}let m=new Headers(s),h=u?.basic.username,b=u?.basic.password;if(h!=null||b!=null){let E=(0,yWr.stringToBase64)([h||"",b||""].join(":"));m.set("Authorization",`Basic ${E}`)}let g=new Headers(u?.headers||{});for(let[E,P]of g)m.set(E,P);let _=m.get("cookie")||"";for(let[E,P]of Object.entries(u?.cookies||{}))_+=`; ${E}=${P}`;_=_.startsWith("; ")?_.slice(2):_,m.set("cookie",_);let w=new Headers(n?.fetchOptions?.headers);for(let[E,P]of w)m.set(E,P);SWr||m.set(r.uaHeader??"user-agent",JTt.SDK_METADATA.userAgent);let x=n?.fetchOptions;if(!x?.signal&&r.timeoutMs&&r.timeoutMs>0){let E=AbortSignal.timeout(r.timeoutMs);x?x.signal=E:x={signal:E}}r.body instanceof ReadableStream&&(x?x.duplex="half":x={duplex:"half"});let C;try{C=Gh(this,JS,"f").beforeCreateRequest(e,{url:c,options:{...x,body:r.body??null,headers:m,method:o}})}catch(E){return(0,BA.ERR)(new iq.UnexpectedClientError("Create request hook failed to execute",{cause:E}))}return(0,BA.OK)(new Request(C.url,C.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,vWr.retry)(async()=>{let i=await Gh(this,JS,"f").beforeRequest(n,e.clone());await xWr(Gh(this,SO,"f"),i).catch(s=>Gh(this,SO,"f")?.log("Failed to log request:",s));let a=await Gh(this,boe,"f").request(i);try{if((0,xO.matchStatusCode)(a,o)){let s=await Gh(this,JS,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await Gh(this,JS,"f").afterSuccess(n,a)}finally{await CWr(Gh(this,SO,"f"),a,i).catch(s=>Gh(this,SO,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,BA.OK)(i),i=>{switch(!0){case(0,xO.isAbortError)(i):return(0,BA.ERR)(new iq.RequestAbortedError("Request aborted by client",{cause:i}));case(0,xO.isTimeoutError)(i):return(0,BA.ERR)(new iq.RequestTimeoutError("Request timed out",{cause:i}));case(0,xO.isConnectionError)(i):return(0,BA.ERR)(new iq.ConnectionError("Unable to make request",{cause:i}));default:return(0,BA.ERR)(new iq.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};qA.ClientSDK=DIe;boe=new WeakMap,JS=new WeakMap,SO=new WeakMap;var GTt=/^application\/(?:.{0,100}\+)?json/;async function xWr(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 GTt.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 CWr(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,xO.matchContentType)(e,"application/json")||GTt.test(o)):t.log(await e.clone().json());break;case(0,xO.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,xO.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,xO.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 LIe=v(_oe=>{"use strict";Object.defineProperty(_oe,"__esModule",{value:!0});_oe.SDKError=void 0;var NIe=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"}};_oe.SDKError=NIe});var J8=v(K8=>{"use strict";Object.defineProperty(K8,"__esModule",{value:!0});K8.EventStream=void 0;K8.discardSentinel=EWr;var V8=10,W8=13,YTt=new Set([V8,W8]),OWr=[new Uint8Array([W8,V8,W8,V8]),new Uint8Array([W8,W8]),new Uint8Array([V8,V8])],FIe=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=ZTt(r,s);if(u==null)continue;let l=r.slice(n,s);n=s+u.length;let c=kIe(l,this.decoder);c!=null&&(yield c)}n>0&&(r=r.slice(n),n=0)}if(r.length>0){let o=kIe(r,this.decoder);o!=null&&(yield o)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{e.releaseLock()}}};K8.EventStream=FIe;function ZTt(t,e){let r=t[e],n=t[e+1];if(r==null||n==null||!YTt.has(r)||!YTt.has(n))return null;for(let o of OWr){let i=PWr(e,t,o);if(i!=null)return i}return null}function PWr(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 kIe(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 EWr(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=ZTt(n,d);if(f==null)continue;let p=o,m=n.slice(p,d);o=d+f.length,kIe(m,TWr)?.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 TWr(t){return t}});var qIe=v(Oy=>{"use strict";var AWr=Oy&&Oy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Oy&&Oy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MWr=Oy&&Oy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AWr(e,t,r);return IWr(e,t),e};Object.defineProperty(Oy,"__esModule",{value:!0});Oy.SDKValidationError=void 0;Oy.formatZodError=BIe;var RWr=MWr(we()),$Ie=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 RWr.ZodError?`${this.rawMessage}
${BIe(this.cause)}`:this.toString()}};Oy.SDKValidationError=$Ie;function BIe(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(`${BIe(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var me=v(G8=>{"use strict";Object.defineProperty(G8,"__esModule",{value:!0});G8.parse=DWr;G8.safeParse=NWr;G8.collectExtraKeys=LWr;var jWr=we(),QTt=qIe(),XTt=Vh();function DWr(t,e,r){try{return e(t)}catch(n){throw n instanceof jWr.ZodError?new QTt.SDKValidationError(r,n,t):n}}function NWr(t,e,r){try{return(0,XTt.OK)(e(t))}catch(n){return(0,XTt.ERR)(new QTt.SDKValidationError(r,n,t))}}function LWr(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 Yo=v(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});Ql.jsonErr=$Wr;Ql.json=BWr;Ql.textErr=qWr;Ql.text=UWr;Ql.bytesErr=zWr;Ql.bytes=HWr;Ql.streamErr=VWr;Ql.stream=WWr;Ql.sseErr=KWr;Ql.sse=JWr;Ql.nilErr=GWr;Ql.nil=YWr;Ql.fail=ZWr;Ql.match=XWr;Ql.unpackHeaders=voe;Ql.discardResponseBody=oAt;var eAt=LIe(),FWr=J8(),tAt=U8(),rAt=EIe(),nAt=me(),kWr={json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function $Wr(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function BWr(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function qWr(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function UWr(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function zWr(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function HWr(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function VWr(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function WWr(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function KWr(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function JWr(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function GWr(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function YWr(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function ZWr(t){return{enc:"fail",codes:t}}function XWr(...t){return async function(r,n){let o,i;for(let l of t){let{codes:c}=l,d="ctype"in l?l.ctype:kWr[l.enc];if(d&&(0,tAt.matchResponse)(r,c,d)){i=l;break}else if(!d&&(0,tAt.matchStatusCode)(r,c)){i=l;break}}if(!i){let l=await r.text();return[{ok:!1,error:new eAt.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,FWr.discardSentinel)(r.body,i.sseSentinel):r.body;break;case"nil":o=await oAt(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 eAt.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:voe(r.headers)}:null,...(0,rAt.isPlainObject)(o)?o:null}:s?u={...n?.extraFields,...i.hdrs?{Headers:voe(r.headers)}:null,[s]:o}:i.hdrs?u={...n?.extraFields,...i.hdrs?{Headers:voe(r.headers)}:null,...(0,rAt.isPlainObject)(o)?o:null}:u=o,"err"in i){let l=(0,nAt.safeParse)(u,c=>i.schema.parse(c),"Response validation failed");return[l.ok?{ok:!1,error:l.value}:l,o]}else return[(0,nAt.safeParse)(u,l=>i.schema.parse(l),"Response validation failed"),o]}}var QWr=/, */;function voe(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(QWr);return e}async function oAt(t){let e=t.body?.getReader();if(e!=null)try{let r=!1;for(;!r;)r=(await e.read()).done}finally{e.releaseLock()}}});var ke=v(tD=>{"use strict";Object.defineProperty(tD,"__esModule",{value:!0});tD.invariant=e9r;tD.remap=t9r;tD.combineSignals=r9r;tD.abortSignalAny=iAt;tD.compactMap=n9r;var UIe=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function e9r(t,e){if(!t)throw new UIe(e)}function t9r(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 r9r(...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):iAt(e)}}function iAt(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 n9r(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}});var Zo=v(CO=>{"use strict";Object.defineProperty(CO,"__esModule",{value:!0});CO.SecurityError=CO.SecurityErrorCode=void 0;CO.resolveSecurity=aAt;CO.resolveGlobalSecurity=a9r;CO.extractSecurity=s9r;var o9r=RIe(),Soe;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(Soe||(CO.SecurityErrorCode=Soe={}));var xoe=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(Soe.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(Soe.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};CO.SecurityError=xoe;function aAt(...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":i9r(e,n);break;case"http:custom":break;case"http:bearer":woe(e,n);break;case"oauth2":woe(e,n);break;case"oauth2:password":woe(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":woe(e,n);break;default:throw xoe.unrecognizedType(o)}}),e)}function i9r(t,e){e.value!=null&&(t.basic=e.value)}function woe(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 a9r(t){return aAt([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,o9r.env)().MISTRAL_API_KEY}])}async function s9r(t){if(t!=null)return typeof t=="function"?t():t}});var zIe=v(Us=>{"use strict";var u9r=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]}),l9r=Us&&Us.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c9r=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)&&u9r(e,t,r);return l9r(e,t),e};Object.defineProperty(Us,"__esModule",{value:!0});Us.ImageURL$=Us.ImageURL$outboundSchema=Us.ImageURL$inboundSchema=void 0;Us.imageURLToJSON=f9r;Us.imageURLFromJSON=p9r;var UA=c9r(we()),d9r=me();Us.ImageURL$inboundSchema=UA.object({url:UA.string(),detail:UA.nullable(UA.string()).optional()});Us.ImageURL$outboundSchema=UA.object({url:UA.string(),detail:UA.nullable(UA.string()).optional()});var sAt;(function(t){t.inboundSchema=Us.ImageURL$inboundSchema,t.outboundSchema=Us.ImageURL$outboundSchema})(sAt||(Us.ImageURL$=sAt={}));function f9r(t){return JSON.stringify(Us.ImageURL$outboundSchema.parse(t))}function p9r(t){return(0,d9r.safeParse)(t,e=>Us.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var HIe=v(vr=>{"use strict";var m9r=vr&&vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),h9r=vr&&vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g9r=vr&&vr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&m9r(e,t,r);return h9r(e,t),e};Object.defineProperty(vr,"__esModule",{value:!0});vr.ImageURLChunk$=vr.ImageURLChunk$outboundSchema=vr.ImageURLChunk$inboundSchema=vr.ImageURLChunkType$=vr.ImageURLChunkType$outboundSchema=vr.ImageURLChunkType$inboundSchema=vr.ImageURLChunkImageURL$=vr.ImageURLChunkImageURL$outboundSchema=vr.ImageURLChunkImageURL$inboundSchema=vr.ImageURLChunkType=void 0;vr.imageURLChunkImageURLToJSON=y9r;vr.imageURLChunkImageURLFromJSON=b9r;vr.imageURLChunkToJSON=_9r;vr.imageURLChunkFromJSON=v9r;var Py=g9r(we()),dAt=ke(),fAt=me(),Coe=zIe();vr.ImageURLChunkType={ImageUrl:"image_url"};vr.ImageURLChunkImageURL$inboundSchema=Py.union([Coe.ImageURL$inboundSchema,Py.string()]);vr.ImageURLChunkImageURL$outboundSchema=Py.union([Coe.ImageURL$outboundSchema,Py.string()]);var uAt;(function(t){t.inboundSchema=vr.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=vr.ImageURLChunkImageURL$outboundSchema})(uAt||(vr.ImageURLChunkImageURL$=uAt={}));function y9r(t){return JSON.stringify(vr.ImageURLChunkImageURL$outboundSchema.parse(t))}function b9r(t){return(0,fAt.safeParse)(t,e=>vr.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}vr.ImageURLChunkType$inboundSchema=Py.nativeEnum(vr.ImageURLChunkType);vr.ImageURLChunkType$outboundSchema=vr.ImageURLChunkType$inboundSchema;var lAt;(function(t){t.inboundSchema=vr.ImageURLChunkType$inboundSchema,t.outboundSchema=vr.ImageURLChunkType$outboundSchema})(lAt||(vr.ImageURLChunkType$=lAt={}));vr.ImageURLChunk$inboundSchema=Py.object({image_url:Py.union([Coe.ImageURL$inboundSchema,Py.string()]),type:vr.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,dAt.remap)(t,{image_url:"imageUrl"}));vr.ImageURLChunk$outboundSchema=Py.object({imageUrl:Py.union([Coe.ImageURL$outboundSchema,Py.string()]),type:vr.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,dAt.remap)(t,{imageUrl:"image_url"}));var cAt;(function(t){t.inboundSchema=vr.ImageURLChunk$inboundSchema,t.outboundSchema=vr.ImageURLChunk$outboundSchema})(cAt||(vr.ImageURLChunk$=cAt={}));function _9r(t){return JSON.stringify(vr.ImageURLChunk$outboundSchema.parse(t))}function v9r(t){return(0,fAt.safeParse)(t,e=>vr.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var VIe=v(Qn=>{"use strict";var w9r=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]}),S9r=Qn&&Qn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x9r=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)&&w9r(e,t,r);return S9r(e,t),e};Object.defineProperty(Qn,"__esModule",{value:!0});Qn.ReferenceChunk$=Qn.ReferenceChunk$outboundSchema=Qn.ReferenceChunk$inboundSchema=Qn.ReferenceChunkType$=Qn.ReferenceChunkType$outboundSchema=Qn.ReferenceChunkType$inboundSchema=Qn.ReferenceChunkType=void 0;Qn.referenceChunkToJSON=O9r;Qn.referenceChunkFromJSON=P9r;var rD=x9r(we()),hAt=ke(),C9r=me();Qn.ReferenceChunkType={Reference:"reference"};Qn.ReferenceChunkType$inboundSchema=rD.nativeEnum(Qn.ReferenceChunkType);Qn.ReferenceChunkType$outboundSchema=Qn.ReferenceChunkType$inboundSchema;var pAt;(function(t){t.inboundSchema=Qn.ReferenceChunkType$inboundSchema,t.outboundSchema=Qn.ReferenceChunkType$outboundSchema})(pAt||(Qn.ReferenceChunkType$=pAt={}));Qn.ReferenceChunk$inboundSchema=rD.object({reference_ids:rD.array(rD.number().int()),type:Qn.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,hAt.remap)(t,{reference_ids:"referenceIds"}));Qn.ReferenceChunk$outboundSchema=rD.object({referenceIds:rD.array(rD.number().int()),type:Qn.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,hAt.remap)(t,{referenceIds:"reference_ids"}));var mAt;(function(t){t.inboundSchema=Qn.ReferenceChunk$inboundSchema,t.outboundSchema=Qn.ReferenceChunk$outboundSchema})(mAt||(Qn.ReferenceChunk$=mAt={}));function O9r(t){return JSON.stringify(Qn.ReferenceChunk$outboundSchema.parse(t))}function P9r(t){return(0,C9r.safeParse)(t,e=>Qn.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var Ooe=v(eo=>{"use strict";var E9r=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]}),T9r=eo&&eo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A9r=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)&&E9r(e,t,r);return T9r(e,t),e};Object.defineProperty(eo,"__esModule",{value:!0});eo.TextChunk$=eo.TextChunk$outboundSchema=eo.TextChunk$inboundSchema=eo.TextChunkType$=eo.TextChunkType$outboundSchema=eo.TextChunkType$inboundSchema=eo.TextChunkType=void 0;eo.textChunkToJSON=M9r;eo.textChunkFromJSON=R9r;var Y8=A9r(we()),I9r=me();eo.TextChunkType={Text:"text"};eo.TextChunkType$inboundSchema=Y8.nativeEnum(eo.TextChunkType);eo.TextChunkType$outboundSchema=eo.TextChunkType$inboundSchema;var gAt;(function(t){t.inboundSchema=eo.TextChunkType$inboundSchema,t.outboundSchema=eo.TextChunkType$outboundSchema})(gAt||(eo.TextChunkType$=gAt={}));eo.TextChunk$inboundSchema=Y8.object({text:Y8.string(),type:eo.TextChunkType$inboundSchema.default("text")});eo.TextChunk$outboundSchema=Y8.object({text:Y8.string(),type:eo.TextChunkType$outboundSchema.default("text")});var yAt;(function(t){t.inboundSchema=eo.TextChunk$inboundSchema,t.outboundSchema=eo.TextChunk$outboundSchema})(yAt||(eo.TextChunk$=yAt={}));function M9r(t){return JSON.stringify(eo.TextChunk$outboundSchema.parse(t))}function R9r(t){return(0,I9r.safeParse)(t,e=>eo.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var aq=v(zs=>{"use strict";var j9r=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]}),D9r=zs&&zs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N9r=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)&&j9r(e,t,r);return D9r(e,t),e};Object.defineProperty(zs,"__esModule",{value:!0});zs.ContentChunk$=zs.ContentChunk$outboundSchema=zs.ContentChunk$inboundSchema=void 0;zs.contentChunkToJSON=F9r;zs.contentChunkFromJSON=k9r;var Ap=N9r(we()),L9r=me(),_At=HIe(),vAt=VIe(),wAt=Ooe();zs.ContentChunk$inboundSchema=Ap.union([_At.ImageURLChunk$inboundSchema.and(Ap.object({type:Ap.literal("image_url")}).transform(t=>({type:t.type}))),wAt.TextChunk$inboundSchema.and(Ap.object({type:Ap.literal("text")}).transform(t=>({type:t.type}))),vAt.ReferenceChunk$inboundSchema.and(Ap.object({type:Ap.literal("reference")}).transform(t=>({type:t.type})))]);zs.ContentChunk$outboundSchema=Ap.union([_At.ImageURLChunk$outboundSchema.and(Ap.object({type:Ap.literal("image_url")}).transform(t=>({type:t.type}))),wAt.TextChunk$outboundSchema.and(Ap.object({type:Ap.literal("text")}).transform(t=>({type:t.type}))),vAt.ReferenceChunk$outboundSchema.and(Ap.object({type:Ap.literal("reference")}).transform(t=>({type:t.type})))]);var bAt;(function(t){t.inboundSchema=zs.ContentChunk$inboundSchema,t.outboundSchema=zs.ContentChunk$outboundSchema})(bAt||(zs.ContentChunk$=bAt={}));function F9r(t){return JSON.stringify(zs.ContentChunk$outboundSchema.parse(t))}function k9r(t){return(0,L9r.safeParse)(t,e=>zs.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var WIe=v(wo=>{"use strict";var $9r=wo&&wo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B9r=wo&&wo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q9r=wo&&wo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$9r(e,t,r);return B9r(e,t),e};Object.defineProperty(wo,"__esModule",{value:!0});wo.FunctionCall$=wo.FunctionCall$outboundSchema=wo.FunctionCall$inboundSchema=wo.Arguments$=wo.Arguments$outboundSchema=wo.Arguments$inboundSchema=void 0;wo.argumentsToJSON=U9r;wo.argumentsFromJSON=z9r;wo.functionCallToJSON=H9r;wo.functionCallFromJSON=V9r;var Hs=q9r(we()),CAt=me();wo.Arguments$inboundSchema=Hs.union([Hs.record(Hs.any()),Hs.string()]);wo.Arguments$outboundSchema=Hs.union([Hs.record(Hs.any()),Hs.string()]);var SAt;(function(t){t.inboundSchema=wo.Arguments$inboundSchema,t.outboundSchema=wo.Arguments$outboundSchema})(SAt||(wo.Arguments$=SAt={}));function U9r(t){return JSON.stringify(wo.Arguments$outboundSchema.parse(t))}function z9r(t){return(0,CAt.safeParse)(t,e=>wo.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}wo.FunctionCall$inboundSchema=Hs.object({name:Hs.string(),arguments:Hs.union([Hs.record(Hs.any()),Hs.string()])});wo.FunctionCall$outboundSchema=Hs.object({name:Hs.string(),arguments:Hs.union([Hs.record(Hs.any()),Hs.string()])});var xAt;(function(t){t.inboundSchema=wo.FunctionCall$inboundSchema,t.outboundSchema=wo.FunctionCall$outboundSchema})(xAt||(wo.FunctionCall$=xAt={}));function H9r(t){return JSON.stringify(wo.FunctionCall$outboundSchema.parse(t))}function V9r(t){return(0,CAt.safeParse)(t,e=>wo.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var zA=v(KIe=>{"use strict";Object.defineProperty(KIe,"__esModule",{value:!0});KIe.catchUnrecognizedEnum=W9r;function W9r(t){return t}});var Z8=v(Vs=>{"use strict";var K9r=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]}),J9r=Vs&&Vs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G9r=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)&&K9r(e,t,r);return J9r(e,t),e};Object.defineProperty(Vs,"__esModule",{value:!0});Vs.ToolTypes$=Vs.ToolTypes$outboundSchema=Vs.ToolTypes$inboundSchema=Vs.ToolTypes=void 0;var nD=G9r(we()),Y9r=zA();Vs.ToolTypes={Function:"function"};Vs.ToolTypes$inboundSchema=nD.union([nD.nativeEnum(Vs.ToolTypes),nD.string().transform(Y9r.catchUnrecognizedEnum)]);Vs.ToolTypes$outboundSchema=nD.union([nD.nativeEnum(Vs.ToolTypes),nD.string().and(nD.custom())]);var OAt;(function(t){t.inboundSchema=Vs.ToolTypes$inboundSchema,t.outboundSchema=Vs.ToolTypes$outboundSchema})(OAt||(Vs.ToolTypes$=OAt={}))});var Poe=v(Ws=>{"use strict";var Z9r=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]}),X9r=Ws&&Ws.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q9r=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)&&Z9r(e,t,r);return X9r(e,t),e};Object.defineProperty(Ws,"__esModule",{value:!0});Ws.ToolCall$=Ws.ToolCall$outboundSchema=Ws.ToolCall$inboundSchema=void 0;Ws.toolCallToJSON=tKr;Ws.toolCallFromJSON=rKr;var sq=Q9r(we()),eKr=me(),EAt=WIe(),TAt=Z8();Ws.ToolCall$inboundSchema=sq.object({id:sq.string().default("null"),type:TAt.ToolTypes$inboundSchema.optional(),function:EAt.FunctionCall$inboundSchema,index:sq.number().int().default(0)});Ws.ToolCall$outboundSchema=sq.object({id:sq.string().default("null"),type:TAt.ToolTypes$outboundSchema.optional(),function:EAt.FunctionCall$outboundSchema,index:sq.number().int().default(0)});var PAt;(function(t){t.inboundSchema=Ws.ToolCall$inboundSchema,t.outboundSchema=Ws.ToolCall$outboundSchema})(PAt||(Ws.ToolCall$=PAt={}));function tKr(t){return JSON.stringify(Ws.ToolCall$outboundSchema.parse(t))}function rKr(t){return(0,eKr.safeParse)(t,e=>Ws.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var HA=v(wr=>{"use strict";var nKr=wr&&wr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oKr=wr&&wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iKr=wr&&wr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nKr(e,t,r);return oKr(e,t),e};Object.defineProperty(wr,"__esModule",{value:!0});wr.AssistantMessage$=wr.AssistantMessage$outboundSchema=wr.AssistantMessage$inboundSchema=wr.AssistantMessageRole$=wr.AssistantMessageRole$outboundSchema=wr.AssistantMessageRole$inboundSchema=wr.AssistantMessageContent$=wr.AssistantMessageContent$outboundSchema=wr.AssistantMessageContent$inboundSchema=wr.AssistantMessageRole=void 0;wr.assistantMessageContentToJSON=aKr;wr.assistantMessageContentFromJSON=sKr;wr.assistantMessageToJSON=uKr;wr.assistantMessageFromJSON=lKr;var za=iKr(we()),RAt=ke(),jAt=me(),Eoe=aq(),DAt=Poe();wr.AssistantMessageRole={Assistant:"assistant"};wr.AssistantMessageContent$inboundSchema=za.union([za.string(),za.array(Eoe.ContentChunk$inboundSchema)]);wr.AssistantMessageContent$outboundSchema=za.union([za.string(),za.array(Eoe.ContentChunk$outboundSchema)]);var AAt;(function(t){t.inboundSchema=wr.AssistantMessageContent$inboundSchema,t.outboundSchema=wr.AssistantMessageContent$outboundSchema})(AAt||(wr.AssistantMessageContent$=AAt={}));function aKr(t){return JSON.stringify(wr.AssistantMessageContent$outboundSchema.parse(t))}function sKr(t){return(0,jAt.safeParse)(t,e=>wr.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}wr.AssistantMessageRole$inboundSchema=za.nativeEnum(wr.AssistantMessageRole);wr.AssistantMessageRole$outboundSchema=wr.AssistantMessageRole$inboundSchema;var IAt;(function(t){t.inboundSchema=wr.AssistantMessageRole$inboundSchema,t.outboundSchema=wr.AssistantMessageRole$outboundSchema})(IAt||(wr.AssistantMessageRole$=IAt={}));wr.AssistantMessage$inboundSchema=za.object({content:za.nullable(za.union([za.string(),za.array(Eoe.ContentChunk$inboundSchema)])).optional(),tool_calls:za.nullable(za.array(DAt.ToolCall$inboundSchema)).optional(),prefix:za.boolean().default(!1),role:wr.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,RAt.remap)(t,{tool_calls:"toolCalls"}));wr.AssistantMessage$outboundSchema=za.object({content:za.nullable(za.union([za.string(),za.array(Eoe.ContentChunk$outboundSchema)])).optional(),toolCalls:za.nullable(za.array(DAt.ToolCall$outboundSchema)).optional(),prefix:za.boolean().default(!1),role:wr.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,RAt.remap)(t,{toolCalls:"tool_calls"}));var MAt;(function(t){t.inboundSchema=wr.AssistantMessage$inboundSchema,t.outboundSchema=wr.AssistantMessage$outboundSchema})(MAt||(wr.AssistantMessage$=MAt={}));function uKr(t){return JSON.stringify(wr.AssistantMessage$outboundSchema.parse(t))}function lKr(t){return(0,jAt.safeParse)(t,e=>wr.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var uq=v(So=>{"use strict";var cKr=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]}),dKr=So&&So.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fKr=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)&&cKr(e,t,r);return dKr(e,t),e};Object.defineProperty(So,"__esModule",{value:!0});So.Prediction$=So.Prediction$outboundSchema=So.Prediction$inboundSchema=So.PredictionType$=So.PredictionType$outboundSchema=So.PredictionType$inboundSchema=So.PredictionType=void 0;So.predictionToJSON=mKr;So.predictionFromJSON=hKr;var oD=fKr(we()),pKr=me();So.PredictionType={Content:"content"};So.PredictionType$inboundSchema=oD.nativeEnum(So.PredictionType);So.PredictionType$outboundSchema=So.PredictionType$inboundSchema;var NAt;(function(t){t.inboundSchema=So.PredictionType$inboundSchema,t.outboundSchema=So.PredictionType$outboundSchema})(NAt||(So.PredictionType$=NAt={}));So.Prediction$inboundSchema=oD.object({type:oD.literal("content").default("content"),content:oD.string().default("")});So.Prediction$outboundSchema=oD.object({type:oD.literal("content").default("content"),content:oD.string().default("")});var LAt;(function(t){t.inboundSchema=So.Prediction$inboundSchema,t.outboundSchema=So.Prediction$outboundSchema})(LAt||(So.Prediction$=LAt={}));function mKr(t){return JSON.stringify(So.Prediction$outboundSchema.parse(t))}function hKr(t){return(0,pKr.safeParse)(t,e=>So.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var JIe=v(Ks=>{"use strict";var gKr=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]}),yKr=Ks&&Ks.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bKr=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)&&gKr(e,t,r);return yKr(e,t),e};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.JsonSchema$=Ks.JsonSchema$outboundSchema=Ks.JsonSchema$inboundSchema=void 0;Ks.jsonSchemaToJSON=vKr;Ks.jsonSchemaFromJSON=wKr;var Ip=bKr(we()),kAt=ke(),_Kr=me();Ks.JsonSchema$inboundSchema=Ip.object({name:Ip.string(),description:Ip.nullable(Ip.string()).optional(),schema:Ip.record(Ip.any()),strict:Ip.boolean().default(!1)}).transform(t=>(0,kAt.remap)(t,{schema:"schemaDefinition"}));Ks.JsonSchema$outboundSchema=Ip.object({name:Ip.string(),description:Ip.nullable(Ip.string()).optional(),schemaDefinition:Ip.record(Ip.any()),strict:Ip.boolean().default(!1)}).transform(t=>(0,kAt.remap)(t,{schemaDefinition:"schema"}));var FAt;(function(t){t.inboundSchema=Ks.JsonSchema$inboundSchema,t.outboundSchema=Ks.JsonSchema$outboundSchema})(FAt||(Ks.JsonSchema$=FAt={}));function vKr(t){return JSON.stringify(Ks.JsonSchema$outboundSchema.parse(t))}function wKr(t){return(0,_Kr.safeParse)(t,e=>Ks.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var GIe=v(Js=>{"use strict";var SKr=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]}),xKr=Js&&Js.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CKr=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)&&SKr(e,t,r);return xKr(e,t),e};Object.defineProperty(Js,"__esModule",{value:!0});Js.ResponseFormats$=Js.ResponseFormats$outboundSchema=Js.ResponseFormats$inboundSchema=Js.ResponseFormats=void 0;var OKr=CKr(we());Js.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};Js.ResponseFormats$inboundSchema=OKr.nativeEnum(Js.ResponseFormats);Js.ResponseFormats$outboundSchema=Js.ResponseFormats$inboundSchema;var $At;(function(t){t.inboundSchema=Js.ResponseFormats$inboundSchema,t.outboundSchema=Js.ResponseFormats$outboundSchema})($At||(Js.ResponseFormats$=$At={}))});var lq=v(Gs=>{"use strict";var PKr=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]}),EKr=Gs&&Gs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TKr=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)&&PKr(e,t,r);return EKr(e,t),e};Object.defineProperty(Gs,"__esModule",{value:!0});Gs.ResponseFormat$=Gs.ResponseFormat$outboundSchema=Gs.ResponseFormat$inboundSchema=void 0;Gs.responseFormatToJSON=IKr;Gs.responseFormatFromJSON=MKr;var Toe=TKr(we()),qAt=ke(),AKr=me(),UAt=JIe(),zAt=GIe();Gs.ResponseFormat$inboundSchema=Toe.object({type:zAt.ResponseFormats$inboundSchema.optional(),json_schema:Toe.nullable(UAt.JsonSchema$inboundSchema).optional()}).transform(t=>(0,qAt.remap)(t,{json_schema:"jsonSchema"}));Gs.ResponseFormat$outboundSchema=Toe.object({type:zAt.ResponseFormats$outboundSchema.optional(),jsonSchema:Toe.nullable(UAt.JsonSchema$outboundSchema).optional()}).transform(t=>(0,qAt.remap)(t,{jsonSchema:"json_schema"}));var BAt;(function(t){t.inboundSchema=Gs.ResponseFormat$inboundSchema,t.outboundSchema=Gs.ResponseFormat$outboundSchema})(BAt||(Gs.ResponseFormat$=BAt={}));function IKr(t){return JSON.stringify(Gs.ResponseFormat$outboundSchema.parse(t))}function MKr(t){return(0,AKr.safeParse)(t,e=>Gs.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var iD=v(Sr=>{"use strict";var RKr=Sr&&Sr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jKr=Sr&&Sr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DKr=Sr&&Sr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RKr(e,t,r);return jKr(e,t),e};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.SystemMessage$=Sr.SystemMessage$outboundSchema=Sr.SystemMessage$inboundSchema=Sr.Role$=Sr.Role$outboundSchema=Sr.Role$inboundSchema=Sr.SystemMessageContent$=Sr.SystemMessageContent$outboundSchema=Sr.SystemMessageContent$inboundSchema=Sr.Role=void 0;Sr.systemMessageContentToJSON=NKr;Sr.systemMessageContentFromJSON=LKr;Sr.systemMessageToJSON=FKr;Sr.systemMessageFromJSON=kKr;var Tf=DKr(we()),KAt=me(),Aoe=Ooe();Sr.Role={System:"system"};Sr.SystemMessageContent$inboundSchema=Tf.union([Tf.string(),Tf.array(Aoe.TextChunk$inboundSchema)]);Sr.SystemMessageContent$outboundSchema=Tf.union([Tf.string(),Tf.array(Aoe.TextChunk$outboundSchema)]);var HAt;(function(t){t.inboundSchema=Sr.SystemMessageContent$inboundSchema,t.outboundSchema=Sr.SystemMessageContent$outboundSchema})(HAt||(Sr.SystemMessageContent$=HAt={}));function NKr(t){return JSON.stringify(Sr.SystemMessageContent$outboundSchema.parse(t))}function LKr(t){return(0,KAt.safeParse)(t,e=>Sr.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}Sr.Role$inboundSchema=Tf.nativeEnum(Sr.Role);Sr.Role$outboundSchema=Sr.Role$inboundSchema;var VAt;(function(t){t.inboundSchema=Sr.Role$inboundSchema,t.outboundSchema=Sr.Role$outboundSchema})(VAt||(Sr.Role$=VAt={}));Sr.SystemMessage$inboundSchema=Tf.object({content:Tf.union([Tf.string(),Tf.array(Aoe.TextChunk$inboundSchema)]),role:Sr.Role$inboundSchema.default("system")});Sr.SystemMessage$outboundSchema=Tf.object({content:Tf.union([Tf.string(),Tf.array(Aoe.TextChunk$outboundSchema)]),role:Sr.Role$outboundSchema.default("system")});var WAt;(function(t){t.inboundSchema=Sr.SystemMessage$inboundSchema,t.outboundSchema=Sr.SystemMessage$outboundSchema})(WAt||(Sr.SystemMessage$=WAt={}));function FKr(t){return JSON.stringify(Sr.SystemMessage$outboundSchema.parse(t))}function kKr(t){return(0,KAt.safeParse)(t,e=>Sr.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var YIe=v(Ys=>{"use strict";var $Kr=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]}),BKr=Ys&&Ys.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qKr=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)&&$Kr(e,t,r);return BKr(e,t),e};Object.defineProperty(Ys,"__esModule",{value:!0});Ys.FunctionT$=Ys.FunctionT$outboundSchema=Ys.FunctionT$inboundSchema=void 0;Ys.functionToJSON=zKr;Ys.functionFromJSON=HKr;var Yh=qKr(we()),UKr=me();Ys.FunctionT$inboundSchema=Yh.object({name:Yh.string(),description:Yh.string().default(""),strict:Yh.boolean().default(!1),parameters:Yh.record(Yh.any())});Ys.FunctionT$outboundSchema=Yh.object({name:Yh.string(),description:Yh.string().default(""),strict:Yh.boolean().default(!1),parameters:Yh.record(Yh.any())});var JAt;(function(t){t.inboundSchema=Ys.FunctionT$inboundSchema,t.outboundSchema=Ys.FunctionT$outboundSchema})(JAt||(Ys.FunctionT$=JAt={}));function zKr(t){return JSON.stringify(Ys.FunctionT$outboundSchema.parse(t))}function HKr(t){return(0,UKr.safeParse)(t,e=>Ys.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var cq=v(Zs=>{"use strict";var VKr=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]}),WKr=Zs&&Zs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KKr=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)&&VKr(e,t,r);return WKr(e,t),e};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.Tool$=Zs.Tool$outboundSchema=Zs.Tool$inboundSchema=void 0;Zs.toolToJSON=GKr;Zs.toolFromJSON=YKr;var YAt=KKr(we()),JKr=me(),ZAt=YIe(),XAt=Z8();Zs.Tool$inboundSchema=YAt.object({type:XAt.ToolTypes$inboundSchema.optional(),function:ZAt.FunctionT$inboundSchema});Zs.Tool$outboundSchema=YAt.object({type:XAt.ToolTypes$outboundSchema.optional(),function:ZAt.FunctionT$outboundSchema});var GAt;(function(t){t.inboundSchema=Zs.Tool$inboundSchema,t.outboundSchema=Zs.Tool$outboundSchema})(GAt||(Zs.Tool$=GAt={}));function GKr(t){return JSON.stringify(Zs.Tool$outboundSchema.parse(t))}function YKr(t){return(0,JKr.safeParse)(t,e=>Zs.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var ZIe=v(Xs=>{"use strict";var ZKr=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]}),XKr=Xs&&Xs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QKr=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)&&ZKr(e,t,r);return XKr(e,t),e};Object.defineProperty(Xs,"__esModule",{value:!0});Xs.FunctionName$=Xs.FunctionName$outboundSchema=Xs.FunctionName$inboundSchema=void 0;Xs.functionNameToJSON=tJr;Xs.functionNameFromJSON=rJr;var Ioe=QKr(we()),eJr=me();Xs.FunctionName$inboundSchema=Ioe.object({name:Ioe.string()});Xs.FunctionName$outboundSchema=Ioe.object({name:Ioe.string()});var QAt;(function(t){t.inboundSchema=Xs.FunctionName$inboundSchema,t.outboundSchema=Xs.FunctionName$outboundSchema})(QAt||(Xs.FunctionName$=QAt={}));function tJr(t){return JSON.stringify(Xs.FunctionName$outboundSchema.parse(t))}function rJr(t){return(0,eJr.safeParse)(t,e=>Xs.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var dq=v(Qs=>{"use strict";var nJr=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]}),oJr=Qs&&Qs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iJr=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)&&nJr(e,t,r);return oJr(e,t),e};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.ToolChoice$=Qs.ToolChoice$outboundSchema=Qs.ToolChoice$inboundSchema=void 0;Qs.toolChoiceToJSON=sJr;Qs.toolChoiceFromJSON=uJr;var tIt=iJr(we()),aJr=me(),rIt=ZIe(),nIt=Z8();Qs.ToolChoice$inboundSchema=tIt.object({type:nIt.ToolTypes$inboundSchema.optional(),function:rIt.FunctionName$inboundSchema});Qs.ToolChoice$outboundSchema=tIt.object({type:nIt.ToolTypes$outboundSchema.optional(),function:rIt.FunctionName$outboundSchema});var eIt;(function(t){t.inboundSchema=Qs.ToolChoice$inboundSchema,t.outboundSchema=Qs.ToolChoice$outboundSchema})(eIt||(Qs.ToolChoice$=eIt={}));function sJr(t){return JSON.stringify(Qs.ToolChoice$outboundSchema.parse(t))}function uJr(t){return(0,aJr.safeParse)(t,e=>Qs.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var fq=v(eu=>{"use strict";var lJr=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]}),cJr=eu&&eu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dJr=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)&&lJr(e,t,r);return cJr(e,t),e};Object.defineProperty(eu,"__esModule",{value:!0});eu.ToolChoiceEnum$=eu.ToolChoiceEnum$outboundSchema=eu.ToolChoiceEnum$inboundSchema=eu.ToolChoiceEnum=void 0;var fJr=dJr(we());eu.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};eu.ToolChoiceEnum$inboundSchema=fJr.nativeEnum(eu.ToolChoiceEnum);eu.ToolChoiceEnum$outboundSchema=eu.ToolChoiceEnum$inboundSchema;var oIt;(function(t){t.inboundSchema=eu.ToolChoiceEnum$inboundSchema,t.outboundSchema=eu.ToolChoiceEnum$outboundSchema})(oIt||(eu.ToolChoiceEnum$=oIt={}))});var aD=v(xr=>{"use strict";var pJr=xr&&xr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mJr=xr&&xr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hJr=xr&&xr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pJr(e,t,r);return mJr(e,t),e};Object.defineProperty(xr,"__esModule",{value:!0});xr.ToolMessage$=xr.ToolMessage$outboundSchema=xr.ToolMessage$inboundSchema=xr.ToolMessageRole$=xr.ToolMessageRole$outboundSchema=xr.ToolMessageRole$inboundSchema=xr.ToolMessageContent$=xr.ToolMessageContent$outboundSchema=xr.ToolMessageContent$inboundSchema=xr.ToolMessageRole=void 0;xr.toolMessageContentToJSON=gJr;xr.toolMessageContentFromJSON=yJr;xr.toolMessageToJSON=bJr;xr.toolMessageFromJSON=_Jr;var ea=hJr(we()),uIt=ke(),lIt=me(),Moe=aq();xr.ToolMessageRole={Tool:"tool"};xr.ToolMessageContent$inboundSchema=ea.union([ea.string(),ea.array(Moe.ContentChunk$inboundSchema)]);xr.ToolMessageContent$outboundSchema=ea.union([ea.string(),ea.array(Moe.ContentChunk$outboundSchema)]);var iIt;(function(t){t.inboundSchema=xr.ToolMessageContent$inboundSchema,t.outboundSchema=xr.ToolMessageContent$outboundSchema})(iIt||(xr.ToolMessageContent$=iIt={}));function gJr(t){return JSON.stringify(xr.ToolMessageContent$outboundSchema.parse(t))}function yJr(t){return(0,lIt.safeParse)(t,e=>xr.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}xr.ToolMessageRole$inboundSchema=ea.nativeEnum(xr.ToolMessageRole);xr.ToolMessageRole$outboundSchema=xr.ToolMessageRole$inboundSchema;var aIt;(function(t){t.inboundSchema=xr.ToolMessageRole$inboundSchema,t.outboundSchema=xr.ToolMessageRole$outboundSchema})(aIt||(xr.ToolMessageRole$=aIt={}));xr.ToolMessage$inboundSchema=ea.object({content:ea.nullable(ea.union([ea.string(),ea.array(Moe.ContentChunk$inboundSchema)])),tool_call_id:ea.nullable(ea.string()).optional(),name:ea.nullable(ea.string()).optional(),role:xr.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,uIt.remap)(t,{tool_call_id:"toolCallId"}));xr.ToolMessage$outboundSchema=ea.object({content:ea.nullable(ea.union([ea.string(),ea.array(Moe.ContentChunk$outboundSchema)])),toolCallId:ea.nullable(ea.string()).optional(),name:ea.nullable(ea.string()).optional(),role:xr.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,uIt.remap)(t,{toolCallId:"tool_call_id"}));var sIt;(function(t){t.inboundSchema=xr.ToolMessage$inboundSchema,t.outboundSchema=xr.ToolMessage$outboundSchema})(sIt||(xr.ToolMessage$=sIt={}));function bJr(t){return JSON.stringify(xr.ToolMessage$outboundSchema.parse(t))}function _Jr(t){return(0,lIt.safeParse)(t,e=>xr.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var sD=v(Cr=>{"use strict";var vJr=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]}),wJr=Cr&&Cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SJr=Cr&&Cr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vJr(e,t,r);return wJr(e,t),e};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.UserMessage$=Cr.UserMessage$outboundSchema=Cr.UserMessage$inboundSchema=Cr.UserMessageRole$=Cr.UserMessageRole$outboundSchema=Cr.UserMessageRole$inboundSchema=Cr.UserMessageContent$=Cr.UserMessageContent$outboundSchema=Cr.UserMessageContent$inboundSchema=Cr.UserMessageRole=void 0;Cr.userMessageContentToJSON=xJr;Cr.userMessageContentFromJSON=CJr;Cr.userMessageToJSON=OJr;Cr.userMessageFromJSON=PJr;var qc=SJr(we()),pIt=me(),Roe=aq();Cr.UserMessageRole={User:"user"};Cr.UserMessageContent$inboundSchema=qc.union([qc.string(),qc.array(Roe.ContentChunk$inboundSchema)]);Cr.UserMessageContent$outboundSchema=qc.union([qc.string(),qc.array(Roe.ContentChunk$outboundSchema)]);var cIt;(function(t){t.inboundSchema=Cr.UserMessageContent$inboundSchema,t.outboundSchema=Cr.UserMessageContent$outboundSchema})(cIt||(Cr.UserMessageContent$=cIt={}));function xJr(t){return JSON.stringify(Cr.UserMessageContent$outboundSchema.parse(t))}function CJr(t){return(0,pIt.safeParse)(t,e=>Cr.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}Cr.UserMessageRole$inboundSchema=qc.nativeEnum(Cr.UserMessageRole);Cr.UserMessageRole$outboundSchema=Cr.UserMessageRole$inboundSchema;var dIt;(function(t){t.inboundSchema=Cr.UserMessageRole$inboundSchema,t.outboundSchema=Cr.UserMessageRole$outboundSchema})(dIt||(Cr.UserMessageRole$=dIt={}));Cr.UserMessage$inboundSchema=qc.object({content:qc.nullable(qc.union([qc.string(),qc.array(Roe.ContentChunk$inboundSchema)])),role:Cr.UserMessageRole$inboundSchema.default("user")});Cr.UserMessage$outboundSchema=qc.object({content:qc.nullable(qc.union([qc.string(),qc.array(Roe.ContentChunk$outboundSchema)])),role:Cr.UserMessageRole$outboundSchema.default("user")});var fIt;(function(t){t.inboundSchema=Cr.UserMessage$inboundSchema,t.outboundSchema=Cr.UserMessage$outboundSchema})(fIt||(Cr.UserMessage$=fIt={}));function OJr(t){return JSON.stringify(Cr.UserMessage$outboundSchema.parse(t))}function PJr(t){return(0,pIt.safeParse)(t,e=>Cr.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var SIt=v(kt=>{"use strict";var EJr=kt&&kt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TJr=kt&&kt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AJr=kt&&kt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EJr(e,t,r);return TJr(e,t),e};Object.defineProperty(kt,"__esModule",{value:!0});kt.AgentsCompletionRequest$=kt.AgentsCompletionRequest$outboundSchema=kt.AgentsCompletionRequest$inboundSchema=kt.AgentsCompletionRequestToolChoice$=kt.AgentsCompletionRequestToolChoice$outboundSchema=kt.AgentsCompletionRequestToolChoice$inboundSchema=kt.AgentsCompletionRequestMessages$=kt.AgentsCompletionRequestMessages$outboundSchema=kt.AgentsCompletionRequestMessages$inboundSchema=kt.AgentsCompletionRequestStop$=kt.AgentsCompletionRequestStop$outboundSchema=kt.AgentsCompletionRequestStop$inboundSchema=void 0;kt.agentsCompletionRequestStopToJSON=IJr;kt.agentsCompletionRequestStopFromJSON=MJr;kt.agentsCompletionRequestMessagesToJSON=RJr;kt.agentsCompletionRequestMessagesFromJSON=jJr;kt.agentsCompletionRequestToolChoiceToJSON=DJr;kt.agentsCompletionRequestToolChoiceFromJSON=NJr;kt.agentsCompletionRequestToJSON=LJr;kt.agentsCompletionRequestFromJSON=FJr;var Ge=AJr(we()),bIt=ke(),joe=me(),Doe=HA(),_It=uq(),vIt=lq(),Noe=iD(),wIt=cq(),Loe=dq(),Foe=fq(),koe=aD(),$oe=sD();kt.AgentsCompletionRequestStop$inboundSchema=Ge.union([Ge.string(),Ge.array(Ge.string())]);kt.AgentsCompletionRequestStop$outboundSchema=Ge.union([Ge.string(),Ge.array(Ge.string())]);var mIt;(function(t){t.inboundSchema=kt.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=kt.AgentsCompletionRequestStop$outboundSchema})(mIt||(kt.AgentsCompletionRequestStop$=mIt={}));function IJr(t){return JSON.stringify(kt.AgentsCompletionRequestStop$outboundSchema.parse(t))}function MJr(t){return(0,joe.safeParse)(t,e=>kt.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}kt.AgentsCompletionRequestMessages$inboundSchema=Ge.union([Noe.SystemMessage$inboundSchema.and(Ge.object({role:Ge.literal("system")}).transform(t=>({role:t.role}))),$oe.UserMessage$inboundSchema.and(Ge.object({role:Ge.literal("user")}).transform(t=>({role:t.role}))),Doe.AssistantMessage$inboundSchema.and(Ge.object({role:Ge.literal("assistant")}).transform(t=>({role:t.role}))),koe.ToolMessage$inboundSchema.and(Ge.object({role:Ge.literal("tool")}).transform(t=>({role:t.role})))]);kt.AgentsCompletionRequestMessages$outboundSchema=Ge.union([Noe.SystemMessage$outboundSchema.and(Ge.object({role:Ge.literal("system")}).transform(t=>({role:t.role}))),$oe.UserMessage$outboundSchema.and(Ge.object({role:Ge.literal("user")}).transform(t=>({role:t.role}))),Doe.AssistantMessage$outboundSchema.and(Ge.object({role:Ge.literal("assistant")}).transform(t=>({role:t.role}))),koe.ToolMessage$outboundSchema.and(Ge.object({role:Ge.literal("tool")}).transform(t=>({role:t.role})))]);var hIt;(function(t){t.inboundSchema=kt.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=kt.AgentsCompletionRequestMessages$outboundSchema})(hIt||(kt.AgentsCompletionRequestMessages$=hIt={}));function RJr(t){return JSON.stringify(kt.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function jJr(t){return(0,joe.safeParse)(t,e=>kt.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}kt.AgentsCompletionRequestToolChoice$inboundSchema=Ge.union([Loe.ToolChoice$inboundSchema,Foe.ToolChoiceEnum$inboundSchema]);kt.AgentsCompletionRequestToolChoice$outboundSchema=Ge.union([Loe.ToolChoice$outboundSchema,Foe.ToolChoiceEnum$outboundSchema]);var gIt;(function(t){t.inboundSchema=kt.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=kt.AgentsCompletionRequestToolChoice$outboundSchema})(gIt||(kt.AgentsCompletionRequestToolChoice$=gIt={}));function DJr(t){return JSON.stringify(kt.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function NJr(t){return(0,joe.safeParse)(t,e=>kt.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}kt.AgentsCompletionRequest$inboundSchema=Ge.object({max_tokens:Ge.nullable(Ge.number().int()).optional(),stream:Ge.boolean().default(!1),stop:Ge.union([Ge.string(),Ge.array(Ge.string())]).optional(),random_seed:Ge.nullable(Ge.number().int()).optional(),messages:Ge.array(Ge.union([Noe.SystemMessage$inboundSchema.and(Ge.object({role:Ge.literal("system")}).transform(t=>({role:t.role}))),$oe.UserMessage$inboundSchema.and(Ge.object({role:Ge.literal("user")}).transform(t=>({role:t.role}))),Doe.AssistantMessage$inboundSchema.and(Ge.object({role:Ge.literal("assistant")}).transform(t=>({role:t.role}))),koe.ToolMessage$inboundSchema.and(Ge.object({role:Ge.literal("tool")}).transform(t=>({role:t.role})))])),response_format:vIt.ResponseFormat$inboundSchema.optional(),tools:Ge.nullable(Ge.array(wIt.Tool$inboundSchema)).optional(),tool_choice:Ge.union([Loe.ToolChoice$inboundSchema,Foe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Ge.number().optional(),frequency_penalty:Ge.number().optional(),n:Ge.nullable(Ge.number().int()).optional(),prediction:_It.Prediction$inboundSchema.optional(),agent_id:Ge.string()}).transform(t=>(0,bIt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));kt.AgentsCompletionRequest$outboundSchema=Ge.object({maxTokens:Ge.nullable(Ge.number().int()).optional(),stream:Ge.boolean().default(!1),stop:Ge.union([Ge.string(),Ge.array(Ge.string())]).optional(),randomSeed:Ge.nullable(Ge.number().int()).optional(),messages:Ge.array(Ge.union([Noe.SystemMessage$outboundSchema.and(Ge.object({role:Ge.literal("system")}).transform(t=>({role:t.role}))),$oe.UserMessage$outboundSchema.and(Ge.object({role:Ge.literal("user")}).transform(t=>({role:t.role}))),Doe.AssistantMessage$outboundSchema.and(Ge.object({role:Ge.literal("assistant")}).transform(t=>({role:t.role}))),koe.ToolMessage$outboundSchema.and(Ge.object({role:Ge.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:vIt.ResponseFormat$outboundSchema.optional(),tools:Ge.nullable(Ge.array(wIt.Tool$outboundSchema)).optional(),toolChoice:Ge.union([Loe.ToolChoice$outboundSchema,Foe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Ge.number().optional(),frequencyPenalty:Ge.number().optional(),n:Ge.nullable(Ge.number().int()).optional(),prediction:_It.Prediction$outboundSchema.optional(),agentId:Ge.string()}).transform(t=>(0,bIt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var yIt;(function(t){t.inboundSchema=kt.AgentsCompletionRequest$inboundSchema,t.outboundSchema=kt.AgentsCompletionRequest$outboundSchema})(yIt||(kt.AgentsCompletionRequest$=yIt={}));function LJr(t){return JSON.stringify(kt.AgentsCompletionRequest$outboundSchema.parse(t))}function FJr(t){return(0,joe.safeParse)(t,e=>kt.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var MIt=v($t=>{"use strict";var kJr=$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]}),$Jr=$t&&$t.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BJr=$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)&&kJr(e,t,r);return $Jr(e,t),e};Object.defineProperty($t,"__esModule",{value:!0});$t.AgentsCompletionStreamRequest$=$t.AgentsCompletionStreamRequest$outboundSchema=$t.AgentsCompletionStreamRequest$inboundSchema=$t.AgentsCompletionStreamRequestToolChoice$=$t.AgentsCompletionStreamRequestToolChoice$outboundSchema=$t.AgentsCompletionStreamRequestToolChoice$inboundSchema=$t.AgentsCompletionStreamRequestMessages$=$t.AgentsCompletionStreamRequestMessages$outboundSchema=$t.AgentsCompletionStreamRequestMessages$inboundSchema=$t.AgentsCompletionStreamRequestStop$=$t.AgentsCompletionStreamRequestStop$outboundSchema=$t.AgentsCompletionStreamRequestStop$inboundSchema=void 0;$t.agentsCompletionStreamRequestStopToJSON=qJr;$t.agentsCompletionStreamRequestStopFromJSON=UJr;$t.agentsCompletionStreamRequestMessagesToJSON=zJr;$t.agentsCompletionStreamRequestMessagesFromJSON=HJr;$t.agentsCompletionStreamRequestToolChoiceToJSON=VJr;$t.agentsCompletionStreamRequestToolChoiceFromJSON=WJr;$t.agentsCompletionStreamRequestToJSON=KJr;$t.agentsCompletionStreamRequestFromJSON=JJr;var Ye=BJr(we()),EIt=ke(),Boe=me(),qoe=HA(),TIt=uq(),AIt=lq(),Uoe=iD(),IIt=cq(),zoe=dq(),Hoe=fq(),Voe=aD(),Woe=sD();$t.AgentsCompletionStreamRequestStop$inboundSchema=Ye.union([Ye.string(),Ye.array(Ye.string())]);$t.AgentsCompletionStreamRequestStop$outboundSchema=Ye.union([Ye.string(),Ye.array(Ye.string())]);var xIt;(function(t){t.inboundSchema=$t.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=$t.AgentsCompletionStreamRequestStop$outboundSchema})(xIt||($t.AgentsCompletionStreamRequestStop$=xIt={}));function qJr(t){return JSON.stringify($t.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function UJr(t){return(0,Boe.safeParse)(t,e=>$t.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}$t.AgentsCompletionStreamRequestMessages$inboundSchema=Ye.union([Uoe.SystemMessage$inboundSchema.and(Ye.object({role:Ye.literal("system")}).transform(t=>({role:t.role}))),Woe.UserMessage$inboundSchema.and(Ye.object({role:Ye.literal("user")}).transform(t=>({role:t.role}))),qoe.AssistantMessage$inboundSchema.and(Ye.object({role:Ye.literal("assistant")}).transform(t=>({role:t.role}))),Voe.ToolMessage$inboundSchema.and(Ye.object({role:Ye.literal("tool")}).transform(t=>({role:t.role})))]);$t.AgentsCompletionStreamRequestMessages$outboundSchema=Ye.union([Uoe.SystemMessage$outboundSchema.and(Ye.object({role:Ye.literal("system")}).transform(t=>({role:t.role}))),Woe.UserMessage$outboundSchema.and(Ye.object({role:Ye.literal("user")}).transform(t=>({role:t.role}))),qoe.AssistantMessage$outboundSchema.and(Ye.object({role:Ye.literal("assistant")}).transform(t=>({role:t.role}))),Voe.ToolMessage$outboundSchema.and(Ye.object({role:Ye.literal("tool")}).transform(t=>({role:t.role})))]);var CIt;(function(t){t.inboundSchema=$t.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=$t.AgentsCompletionStreamRequestMessages$outboundSchema})(CIt||($t.AgentsCompletionStreamRequestMessages$=CIt={}));function zJr(t){return JSON.stringify($t.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function HJr(t){return(0,Boe.safeParse)(t,e=>$t.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}$t.AgentsCompletionStreamRequestToolChoice$inboundSchema=Ye.union([zoe.ToolChoice$inboundSchema,Hoe.ToolChoiceEnum$inboundSchema]);$t.AgentsCompletionStreamRequestToolChoice$outboundSchema=Ye.union([zoe.ToolChoice$outboundSchema,Hoe.ToolChoiceEnum$outboundSchema]);var OIt;(function(t){t.inboundSchema=$t.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=$t.AgentsCompletionStreamRequestToolChoice$outboundSchema})(OIt||($t.AgentsCompletionStreamRequestToolChoice$=OIt={}));function VJr(t){return JSON.stringify($t.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function WJr(t){return(0,Boe.safeParse)(t,e=>$t.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}$t.AgentsCompletionStreamRequest$inboundSchema=Ye.object({max_tokens:Ye.nullable(Ye.number().int()).optional(),stream:Ye.boolean().default(!0),stop:Ye.union([Ye.string(),Ye.array(Ye.string())]).optional(),random_seed:Ye.nullable(Ye.number().int()).optional(),messages:Ye.array(Ye.union([Uoe.SystemMessage$inboundSchema.and(Ye.object({role:Ye.literal("system")}).transform(t=>({role:t.role}))),Woe.UserMessage$inboundSchema.and(Ye.object({role:Ye.literal("user")}).transform(t=>({role:t.role}))),qoe.AssistantMessage$inboundSchema.and(Ye.object({role:Ye.literal("assistant")}).transform(t=>({role:t.role}))),Voe.ToolMessage$inboundSchema.and(Ye.object({role:Ye.literal("tool")}).transform(t=>({role:t.role})))])),response_format:AIt.ResponseFormat$inboundSchema.optional(),tools:Ye.nullable(Ye.array(IIt.Tool$inboundSchema)).optional(),tool_choice:Ye.union([zoe.ToolChoice$inboundSchema,Hoe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Ye.number().optional(),frequency_penalty:Ye.number().optional(),n:Ye.nullable(Ye.number().int()).optional(),prediction:TIt.Prediction$inboundSchema.optional(),agent_id:Ye.string()}).transform(t=>(0,EIt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));$t.AgentsCompletionStreamRequest$outboundSchema=Ye.object({maxTokens:Ye.nullable(Ye.number().int()).optional(),stream:Ye.boolean().default(!0),stop:Ye.union([Ye.string(),Ye.array(Ye.string())]).optional(),randomSeed:Ye.nullable(Ye.number().int()).optional(),messages:Ye.array(Ye.union([Uoe.SystemMessage$outboundSchema.and(Ye.object({role:Ye.literal("system")}).transform(t=>({role:t.role}))),Woe.UserMessage$outboundSchema.and(Ye.object({role:Ye.literal("user")}).transform(t=>({role:t.role}))),qoe.AssistantMessage$outboundSchema.and(Ye.object({role:Ye.literal("assistant")}).transform(t=>({role:t.role}))),Voe.ToolMessage$outboundSchema.and(Ye.object({role:Ye.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:AIt.ResponseFormat$outboundSchema.optional(),tools:Ye.nullable(Ye.array(IIt.Tool$outboundSchema)).optional(),toolChoice:Ye.union([zoe.ToolChoice$outboundSchema,Hoe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Ye.number().optional(),frequencyPenalty:Ye.number().optional(),n:Ye.nullable(Ye.number().int()).optional(),prediction:TIt.Prediction$outboundSchema.optional(),agentId:Ye.string()}).transform(t=>(0,EIt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var PIt;(function(t){t.inboundSchema=$t.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=$t.AgentsCompletionStreamRequest$outboundSchema})(PIt||($t.AgentsCompletionStreamRequest$=PIt={}));function KJr(t){return JSON.stringify($t.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function JJr(t){return(0,Boe.safeParse)(t,e=>$t.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var XIe=v(tu=>{"use strict";var GJr=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]}),YJr=tu&&tu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZJr=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)&&GJr(e,t,r);return YJr(e,t),e};Object.defineProperty(tu,"__esModule",{value:!0});tu.ApiEndpoint$=tu.ApiEndpoint$outboundSchema=tu.ApiEndpoint$inboundSchema=tu.ApiEndpoint=void 0;var uD=ZJr(we()),XJr=zA();tu.ApiEndpoint={RootV1ChatCompletions:"/v1/chat/completions",RootV1Embeddings:"/v1/embeddings",RootV1FimCompletions:"/v1/fim/completions",RootV1Moderations:"/v1/moderations",RootV1ChatModerations:"/v1/chat/moderations"};tu.ApiEndpoint$inboundSchema=uD.union([uD.nativeEnum(tu.ApiEndpoint),uD.string().transform(XJr.catchUnrecognizedEnum)]);tu.ApiEndpoint$outboundSchema=uD.union([uD.nativeEnum(tu.ApiEndpoint),uD.string().and(uD.custom())]);var RIt;(function(t){t.inboundSchema=tu.ApiEndpoint$inboundSchema,t.outboundSchema=tu.ApiEndpoint$outboundSchema})(RIt||(tu.ApiEndpoint$=RIt={}))});var NIt=v(xo=>{"use strict";var QJr=xo&&xo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eGr=xo&&xo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tGr=xo&&xo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QJr(e,t,r);return eGr(e,t),e};Object.defineProperty(xo,"__esModule",{value:!0});xo.ArchiveFTModelOut$=xo.ArchiveFTModelOut$outboundSchema=xo.ArchiveFTModelOut$inboundSchema=xo.ArchiveFTModelOutObject$=xo.ArchiveFTModelOutObject$outboundSchema=xo.ArchiveFTModelOutObject$inboundSchema=xo.ArchiveFTModelOutObject=void 0;xo.archiveFTModelOutToJSON=nGr;xo.archiveFTModelOutFromJSON=oGr;var OO=tGr(we()),rGr=me();xo.ArchiveFTModelOutObject={Model:"model"};xo.ArchiveFTModelOutObject$inboundSchema=OO.nativeEnum(xo.ArchiveFTModelOutObject);xo.ArchiveFTModelOutObject$outboundSchema=xo.ArchiveFTModelOutObject$inboundSchema;var jIt;(function(t){t.inboundSchema=xo.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=xo.ArchiveFTModelOutObject$outboundSchema})(jIt||(xo.ArchiveFTModelOutObject$=jIt={}));xo.ArchiveFTModelOut$inboundSchema=OO.object({id:OO.string(),object:OO.literal("model").default("model"),archived:OO.boolean().default(!0)});xo.ArchiveFTModelOut$outboundSchema=OO.object({id:OO.string(),object:OO.literal("model").default("model"),archived:OO.boolean().default(!0)});var DIt;(function(t){t.inboundSchema=xo.ArchiveFTModelOut$inboundSchema,t.outboundSchema=xo.ArchiveFTModelOut$outboundSchema})(DIt||(xo.ArchiveFTModelOut$=DIt={}));function nGr(t){return JSON.stringify(xo.ArchiveFTModelOut$outboundSchema.parse(t))}function oGr(t){return(0,rGr.safeParse)(t,e=>xo.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var Koe=v(ru=>{"use strict";var iGr=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]}),aGr=ru&&ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sGr=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)&&iGr(e,t,r);return aGr(e,t),e};Object.defineProperty(ru,"__esModule",{value:!0});ru.ModelCapabilities$=ru.ModelCapabilities$outboundSchema=ru.ModelCapabilities$inboundSchema=void 0;ru.modelCapabilitiesToJSON=lGr;ru.modelCapabilitiesFromJSON=cGr;var Zh=sGr(we()),FIt=ke(),uGr=me();ru.ModelCapabilities$inboundSchema=Zh.object({completion_chat:Zh.boolean().default(!0),completion_fim:Zh.boolean().default(!1),function_calling:Zh.boolean().default(!0),fine_tuning:Zh.boolean().default(!1),vision:Zh.boolean().default(!1)}).transform(t=>(0,FIt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));ru.ModelCapabilities$outboundSchema=Zh.object({completionChat:Zh.boolean().default(!0),completionFim:Zh.boolean().default(!1),functionCalling:Zh.boolean().default(!0),fineTuning:Zh.boolean().default(!1),vision:Zh.boolean().default(!1)}).transform(t=>(0,FIt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var LIt;(function(t){t.inboundSchema=ru.ModelCapabilities$inboundSchema,t.outboundSchema=ru.ModelCapabilities$outboundSchema})(LIt||(ru.ModelCapabilities$=LIt={}));function lGr(t){return JSON.stringify(ru.ModelCapabilities$outboundSchema.parse(t))}function cGr(t){return(0,uGr.safeParse)(t,e=>ru.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var QIe=v(Co=>{"use strict";var dGr=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]}),fGr=Co&&Co.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pGr=Co&&Co.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dGr(e,t,r);return fGr(e,t),e};Object.defineProperty(Co,"__esModule",{value:!0});Co.BaseModelCard$=Co.BaseModelCard$outboundSchema=Co.BaseModelCard$inboundSchema=Co.Type$=Co.Type$outboundSchema=Co.Type$inboundSchema=Co.Type=void 0;Co.baseModelCardToJSON=hGr;Co.baseModelCardFromJSON=gGr;var qn=pGr(we()),BIt=ke(),mGr=me(),qIt=Koe();Co.Type={Base:"base"};Co.Type$inboundSchema=qn.nativeEnum(Co.Type);Co.Type$outboundSchema=Co.Type$inboundSchema;var kIt;(function(t){t.inboundSchema=Co.Type$inboundSchema,t.outboundSchema=Co.Type$outboundSchema})(kIt||(Co.Type$=kIt={}));Co.BaseModelCard$inboundSchema=qn.object({id:qn.string(),object:qn.string().default("model"),created:qn.number().int().optional(),owned_by:qn.string().default("mistralai"),capabilities:qIt.ModelCapabilities$inboundSchema,name:qn.nullable(qn.string()).optional(),description:qn.nullable(qn.string()).optional(),max_context_length:qn.number().int().default(32768),aliases:qn.array(qn.string()).optional(),deprecation:qn.nullable(qn.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:qn.nullable(qn.number()).optional(),type:qn.literal("base").default("base")}).transform(t=>(0,BIt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Co.BaseModelCard$outboundSchema=qn.object({id:qn.string(),object:qn.string().default("model"),created:qn.number().int().optional(),ownedBy:qn.string().default("mistralai"),capabilities:qIt.ModelCapabilities$outboundSchema,name:qn.nullable(qn.string()).optional(),description:qn.nullable(qn.string()).optional(),maxContextLength:qn.number().int().default(32768),aliases:qn.array(qn.string()).optional(),deprecation:qn.nullable(qn.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:qn.nullable(qn.number()).optional(),type:qn.literal("base").default("base")}).transform(t=>(0,BIt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var $It;(function(t){t.inboundSchema=Co.BaseModelCard$inboundSchema,t.outboundSchema=Co.BaseModelCard$outboundSchema})($It||(Co.BaseModelCard$=$It={}));function hGr(t){return JSON.stringify(Co.BaseModelCard$outboundSchema.parse(t))}function gGr(t){return(0,mGr.safeParse)(t,e=>Co.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var eMe=v(nu=>{"use strict";var yGr=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]}),bGr=nu&&nu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Gr=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)&&yGr(e,t,r);return bGr(e,t),e};Object.defineProperty(nu,"__esModule",{value:!0});nu.BatchError$=nu.BatchError$outboundSchema=nu.BatchError$inboundSchema=void 0;nu.batchErrorToJSON=wGr;nu.batchErrorFromJSON=SGr;var pq=_Gr(we()),vGr=me();nu.BatchError$inboundSchema=pq.object({message:pq.string(),count:pq.number().int().default(1)});nu.BatchError$outboundSchema=pq.object({message:pq.string(),count:pq.number().int().default(1)});var UIt;(function(t){t.inboundSchema=nu.BatchError$inboundSchema,t.outboundSchema=nu.BatchError$outboundSchema})(UIt||(nu.BatchError$=UIt={}));function wGr(t){return JSON.stringify(nu.BatchError$outboundSchema.parse(t))}function SGr(t){return(0,vGr.safeParse)(t,e=>nu.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var WIt=v(ou=>{"use strict";var xGr=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]}),CGr=ou&&ou.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OGr=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)&&xGr(e,t,r);return CGr(e,t),e};Object.defineProperty(ou,"__esModule",{value:!0});ou.BatchJobIn$=ou.BatchJobIn$outboundSchema=ou.BatchJobIn$inboundSchema=void 0;ou.batchJobInToJSON=EGr;ou.batchJobInFromJSON=TGr;var $d=OGr(we()),HIt=ke(),PGr=me(),VIt=XIe();ou.BatchJobIn$inboundSchema=$d.object({input_files:$d.array($d.string()),endpoint:VIt.ApiEndpoint$inboundSchema,model:$d.string(),metadata:$d.nullable($d.record($d.string())).optional(),timeout_hours:$d.number().int().default(24)}).transform(t=>(0,HIt.remap)(t,{input_files:"inputFiles",timeout_hours:"timeoutHours"}));ou.BatchJobIn$outboundSchema=$d.object({inputFiles:$d.array($d.string()),endpoint:VIt.ApiEndpoint$outboundSchema,model:$d.string(),metadata:$d.nullable($d.record($d.string())).optional(),timeoutHours:$d.number().int().default(24)}).transform(t=>(0,HIt.remap)(t,{inputFiles:"input_files",timeoutHours:"timeout_hours"}));var zIt;(function(t){t.inboundSchema=ou.BatchJobIn$inboundSchema,t.outboundSchema=ou.BatchJobIn$outboundSchema})(zIt||(ou.BatchJobIn$=zIt={}));function EGr(t){return JSON.stringify(ou.BatchJobIn$outboundSchema.parse(t))}function TGr(t){return(0,PGr.safeParse)(t,e=>ou.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var tMe=v(iu=>{"use strict";var AGr=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]}),IGr=iu&&iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MGr=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)&&AGr(e,t,r);return IGr(e,t),e};Object.defineProperty(iu,"__esModule",{value:!0});iu.BatchJobStatus$=iu.BatchJobStatus$outboundSchema=iu.BatchJobStatus$inboundSchema=iu.BatchJobStatus=void 0;var RGr=MGr(we());iu.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};iu.BatchJobStatus$inboundSchema=RGr.nativeEnum(iu.BatchJobStatus);iu.BatchJobStatus$outboundSchema=iu.BatchJobStatus$inboundSchema;var KIt;(function(t){t.inboundSchema=iu.BatchJobStatus$inboundSchema,t.outboundSchema=iu.BatchJobStatus$outboundSchema})(KIt||(iu.BatchJobStatus$=KIt={}))});var rMe=v(Oo=>{"use strict";var jGr=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]}),DGr=Oo&&Oo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NGr=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)&&jGr(e,t,r);return DGr(e,t),e};Object.defineProperty(Oo,"__esModule",{value:!0});Oo.BatchJobOut$=Oo.BatchJobOut$outboundSchema=Oo.BatchJobOut$inboundSchema=Oo.BatchJobOutObject$=Oo.BatchJobOutObject$outboundSchema=Oo.BatchJobOutObject$inboundSchema=Oo.BatchJobOutObject=void 0;Oo.batchJobOutToJSON=FGr;Oo.batchJobOutFromJSON=kGr;var lr=NGr(we()),YIt=ke(),LGr=me(),ZIt=eMe(),XIt=tMe();Oo.BatchJobOutObject={Batch:"batch"};Oo.BatchJobOutObject$inboundSchema=lr.nativeEnum(Oo.BatchJobOutObject);Oo.BatchJobOutObject$outboundSchema=Oo.BatchJobOutObject$inboundSchema;var JIt;(function(t){t.inboundSchema=Oo.BatchJobOutObject$inboundSchema,t.outboundSchema=Oo.BatchJobOutObject$outboundSchema})(JIt||(Oo.BatchJobOutObject$=JIt={}));Oo.BatchJobOut$inboundSchema=lr.object({id:lr.string(),object:lr.literal("batch").default("batch"),input_files:lr.array(lr.string()),metadata:lr.nullable(lr.record(lr.any())).optional(),endpoint:lr.string(),model:lr.string(),output_file:lr.nullable(lr.string()).optional(),error_file:lr.nullable(lr.string()).optional(),errors:lr.array(ZIt.BatchError$inboundSchema),status:XIt.BatchJobStatus$inboundSchema,created_at:lr.number().int(),total_requests:lr.number().int(),completed_requests:lr.number().int(),succeeded_requests:lr.number().int(),failed_requests:lr.number().int(),started_at:lr.nullable(lr.number().int()).optional(),completed_at:lr.nullable(lr.number().int()).optional()}).transform(t=>(0,YIt.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"}));Oo.BatchJobOut$outboundSchema=lr.object({id:lr.string(),object:lr.literal("batch").default("batch"),inputFiles:lr.array(lr.string()),metadata:lr.nullable(lr.record(lr.any())).optional(),endpoint:lr.string(),model:lr.string(),outputFile:lr.nullable(lr.string()).optional(),errorFile:lr.nullable(lr.string()).optional(),errors:lr.array(ZIt.BatchError$outboundSchema),status:XIt.BatchJobStatus$outboundSchema,createdAt:lr.number().int(),totalRequests:lr.number().int(),completedRequests:lr.number().int(),succeededRequests:lr.number().int(),failedRequests:lr.number().int(),startedAt:lr.nullable(lr.number().int()).optional(),completedAt:lr.nullable(lr.number().int()).optional()}).transform(t=>(0,YIt.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 GIt;(function(t){t.inboundSchema=Oo.BatchJobOut$inboundSchema,t.outboundSchema=Oo.BatchJobOut$outboundSchema})(GIt||(Oo.BatchJobOut$=GIt={}));function FGr(t){return JSON.stringify(Oo.BatchJobOut$outboundSchema.parse(t))}function kGr(t){return(0,LGr.safeParse)(t,e=>Oo.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var rMt=v(Po=>{"use strict";var $Gr=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]}),BGr=Po&&Po.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qGr=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)&&$Gr(e,t,r);return BGr(e,t),e};Object.defineProperty(Po,"__esModule",{value:!0});Po.BatchJobsOut$=Po.BatchJobsOut$outboundSchema=Po.BatchJobsOut$inboundSchema=Po.BatchJobsOutObject$=Po.BatchJobsOutObject$outboundSchema=Po.BatchJobsOutObject$inboundSchema=Po.BatchJobsOutObject=void 0;Po.batchJobsOutToJSON=zGr;Po.batchJobsOutFromJSON=HGr;var PO=qGr(we()),UGr=me(),tMt=rMe();Po.BatchJobsOutObject={List:"list"};Po.BatchJobsOutObject$inboundSchema=PO.nativeEnum(Po.BatchJobsOutObject);Po.BatchJobsOutObject$outboundSchema=Po.BatchJobsOutObject$inboundSchema;var QIt;(function(t){t.inboundSchema=Po.BatchJobsOutObject$inboundSchema,t.outboundSchema=Po.BatchJobsOutObject$outboundSchema})(QIt||(Po.BatchJobsOutObject$=QIt={}));Po.BatchJobsOut$inboundSchema=PO.object({data:PO.array(tMt.BatchJobOut$inboundSchema).optional(),object:PO.literal("list").default("list"),total:PO.number().int()});Po.BatchJobsOut$outboundSchema=PO.object({data:PO.array(tMt.BatchJobOut$outboundSchema).optional(),object:PO.literal("list").default("list"),total:PO.number().int()});var eMt;(function(t){t.inboundSchema=Po.BatchJobsOut$inboundSchema,t.outboundSchema=Po.BatchJobsOut$outboundSchema})(eMt||(Po.BatchJobsOut$=eMt={}));function zGr(t){return JSON.stringify(Po.BatchJobsOut$outboundSchema.parse(t))}function HGr(t){return(0,UGr.safeParse)(t,e=>Po.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var uMt=v(Bt=>{"use strict";var VGr=Bt&&Bt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WGr=Bt&&Bt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KGr=Bt&&Bt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VGr(e,t,r);return WGr(e,t),e};Object.defineProperty(Bt,"__esModule",{value:!0});Bt.ChatClassificationRequest$=Bt.ChatClassificationRequest$outboundSchema=Bt.ChatClassificationRequest$inboundSchema=Bt.ChatClassificationRequestInputs$=Bt.ChatClassificationRequestInputs$outboundSchema=Bt.ChatClassificationRequestInputs$inboundSchema=Bt.One$=Bt.One$outboundSchema=Bt.One$inboundSchema=Bt.Two$=Bt.Two$outboundSchema=Bt.Two$inboundSchema=void 0;Bt.twoToJSON=JGr;Bt.twoFromJSON=GGr;Bt.oneToJSON=YGr;Bt.oneFromJSON=ZGr;Bt.chatClassificationRequestInputsToJSON=XGr;Bt.chatClassificationRequestInputsFromJSON=QGr;Bt.chatClassificationRequestToJSON=e7r;Bt.chatClassificationRequestFromJSON=t7r;var de=KGr(we()),sMt=ke(),Joe=me(),Xh=HA(),Qh=iD(),eg=aD(),tg=sD();Bt.Two$inboundSchema=de.union([Qh.SystemMessage$inboundSchema.and(de.object({role:de.literal("system")}).transform(t=>({role:t.role}))),tg.UserMessage$inboundSchema.and(de.object({role:de.literal("user")}).transform(t=>({role:t.role}))),Xh.AssistantMessage$inboundSchema.and(de.object({role:de.literal("assistant")}).transform(t=>({role:t.role}))),eg.ToolMessage$inboundSchema.and(de.object({role:de.literal("tool")}).transform(t=>({role:t.role})))]);Bt.Two$outboundSchema=de.union([Qh.SystemMessage$outboundSchema.and(de.object({role:de.literal("system")}).transform(t=>({role:t.role}))),tg.UserMessage$outboundSchema.and(de.object({role:de.literal("user")}).transform(t=>({role:t.role}))),Xh.AssistantMessage$outboundSchema.and(de.object({role:de.literal("assistant")}).transform(t=>({role:t.role}))),eg.ToolMessage$outboundSchema.and(de.object({role:de.literal("tool")}).transform(t=>({role:t.role})))]);var nMt;(function(t){t.inboundSchema=Bt.Two$inboundSchema,t.outboundSchema=Bt.Two$outboundSchema})(nMt||(Bt.Two$=nMt={}));function JGr(t){return JSON.stringify(Bt.Two$outboundSchema.parse(t))}function GGr(t){return(0,Joe.safeParse)(t,e=>Bt.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}Bt.One$inboundSchema=de.union([Qh.SystemMessage$inboundSchema.and(de.object({role:de.literal("system")}).transform(t=>({role:t.role}))),tg.UserMessage$inboundSchema.and(de.object({role:de.literal("user")}).transform(t=>({role:t.role}))),Xh.AssistantMessage$inboundSchema.and(de.object({role:de.literal("assistant")}).transform(t=>({role:t.role}))),eg.ToolMessage$inboundSchema.and(de.object({role:de.literal("tool")}).transform(t=>({role:t.role})))]);Bt.One$outboundSchema=de.union([Qh.SystemMessage$outboundSchema.and(de.object({role:de.literal("system")}).transform(t=>({role:t.role}))),tg.UserMessage$outboundSchema.and(de.object({role:de.literal("user")}).transform(t=>({role:t.role}))),Xh.AssistantMessage$outboundSchema.and(de.object({role:de.literal("assistant")}).transform(t=>({role:t.role}))),eg.ToolMessage$outboundSchema.and(de.object({role:de.literal("tool")}).transform(t=>({role:t.role})))]);var oMt;(function(t){t.inboundSchema=Bt.One$inboundSchema,t.outboundSchema=Bt.One$outboundSchema})(oMt||(Bt.One$=oMt={}));function YGr(t){return JSON.stringify(Bt.One$outboundSchema.parse(t))}function ZGr(t){return(0,Joe.safeParse)(t,e=>Bt.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}Bt.ChatClassificationRequestInputs$inboundSchema=de.union([de.array(de.union([Qh.SystemMessage$inboundSchema.and(de.object({role:de.literal("system")}).transform(t=>({role:t.role}))),tg.UserMessage$inboundSchema.and(de.object({role:de.literal("user")}).transform(t=>({role:t.role}))),Xh.AssistantMessage$inboundSchema.and(de.object({role:de.literal("assistant")}).transform(t=>({role:t.role}))),eg.ToolMessage$inboundSchema.and(de.object({role:de.literal("tool")}).transform(t=>({role:t.role})))])),de.array(de.array(de.union([Qh.SystemMessage$inboundSchema.and(de.object({role:de.literal("system")}).transform(t=>({role:t.role}))),tg.UserMessage$inboundSchema.and(de.object({role:de.literal("user")}).transform(t=>({role:t.role}))),Xh.AssistantMessage$inboundSchema.and(de.object({role:de.literal("assistant")}).transform(t=>({role:t.role}))),eg.ToolMessage$inboundSchema.and(de.object({role:de.literal("tool")}).transform(t=>({role:t.role})))])))]);Bt.ChatClassificationRequestInputs$outboundSchema=de.union([de.array(de.union([Qh.SystemMessage$outboundSchema.and(de.object({role:de.literal("system")}).transform(t=>({role:t.role}))),tg.UserMessage$outboundSchema.and(de.object({role:de.literal("user")}).transform(t=>({role:t.role}))),Xh.AssistantMessage$outboundSchema.and(de.object({role:de.literal("assistant")}).transform(t=>({role:t.role}))),eg.ToolMessage$outboundSchema.and(de.object({role:de.literal("tool")}).transform(t=>({role:t.role})))])),de.array(de.array(de.union([Qh.SystemMessage$outboundSchema.and(de.object({role:de.literal("system")}).transform(t=>({role:t.role}))),tg.UserMessage$outboundSchema.and(de.object({role:de.literal("user")}).transform(t=>({role:t.role}))),Xh.AssistantMessage$outboundSchema.and(de.object({role:de.literal("assistant")}).transform(t=>({role:t.role}))),eg.ToolMessage$outboundSchema.and(de.object({role:de.literal("tool")}).transform(t=>({role:t.role})))])))]);var iMt;(function(t){t.inboundSchema=Bt.ChatClassificationRequestInputs$inboundSchema,t.outboundSchema=Bt.ChatClassificationRequestInputs$outboundSchema})(iMt||(Bt.ChatClassificationRequestInputs$=iMt={}));function XGr(t){return JSON.stringify(Bt.ChatClassificationRequestInputs$outboundSchema.parse(t))}function QGr(t){return(0,Joe.safeParse)(t,e=>Bt.ChatClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequestInputs' from JSON")}Bt.ChatClassificationRequest$inboundSchema=de.object({input:de.union([de.array(de.union([Qh.SystemMessage$inboundSchema.and(de.object({role:de.literal("system")}).transform(t=>({role:t.role}))),tg.UserMessage$inboundSchema.and(de.object({role:de.literal("user")}).transform(t=>({role:t.role}))),Xh.AssistantMessage$inboundSchema.and(de.object({role:de.literal("assistant")}).transform(t=>({role:t.role}))),eg.ToolMessage$inboundSchema.and(de.object({role:de.literal("tool")}).transform(t=>({role:t.role})))])),de.array(de.array(de.union([Qh.SystemMessage$inboundSchema.and(de.object({role:de.literal("system")}).transform(t=>({role:t.role}))),tg.UserMessage$inboundSchema.and(de.object({role:de.literal("user")}).transform(t=>({role:t.role}))),Xh.AssistantMessage$inboundSchema.and(de.object({role:de.literal("assistant")}).transform(t=>({role:t.role}))),eg.ToolMessage$inboundSchema.and(de.object({role:de.literal("tool")}).transform(t=>({role:t.role})))])))]),model:de.nullable(de.string())}).transform(t=>(0,sMt.remap)(t,{input:"inputs"}));Bt.ChatClassificationRequest$outboundSchema=de.object({inputs:de.union([de.array(de.union([Qh.SystemMessage$outboundSchema.and(de.object({role:de.literal("system")}).transform(t=>({role:t.role}))),tg.UserMessage$outboundSchema.and(de.object({role:de.literal("user")}).transform(t=>({role:t.role}))),Xh.AssistantMessage$outboundSchema.and(de.object({role:de.literal("assistant")}).transform(t=>({role:t.role}))),eg.ToolMessage$outboundSchema.and(de.object({role:de.literal("tool")}).transform(t=>({role:t.role})))])),de.array(de.array(de.union([Qh.SystemMessage$outboundSchema.and(de.object({role:de.literal("system")}).transform(t=>({role:t.role}))),tg.UserMessage$outboundSchema.and(de.object({role:de.literal("user")}).transform(t=>({role:t.role}))),Xh.AssistantMessage$outboundSchema.and(de.object({role:de.literal("assistant")}).transform(t=>({role:t.role}))),eg.ToolMessage$outboundSchema.and(de.object({role:de.literal("tool")}).transform(t=>({role:t.role})))])))]),model:de.nullable(de.string())}).transform(t=>(0,sMt.remap)(t,{inputs:"input"}));var aMt;(function(t){t.inboundSchema=Bt.ChatClassificationRequest$inboundSchema,t.outboundSchema=Bt.ChatClassificationRequest$outboundSchema})(aMt||(Bt.ChatClassificationRequest$=aMt={}));function e7r(t){return JSON.stringify(Bt.ChatClassificationRequest$outboundSchema.parse(t))}function t7r(t){return(0,Joe.safeParse)(t,e=>Bt.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var Goe=v(to=>{"use strict";var r7r=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]}),n7r=to&&to.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o7r=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)&&r7r(e,t,r);return n7r(e,t),e};Object.defineProperty(to,"__esModule",{value:!0});to.ChatCompletionChoice$=to.ChatCompletionChoice$outboundSchema=to.ChatCompletionChoice$inboundSchema=to.FinishReason$=to.FinishReason$outboundSchema=to.FinishReason$inboundSchema=to.FinishReason=void 0;to.chatCompletionChoiceToJSON=s7r;to.chatCompletionChoiceFromJSON=u7r;var Ey=o7r(we()),dMt=ke(),i7r=me(),a7r=zA(),fMt=HA();to.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};to.FinishReason$inboundSchema=Ey.union([Ey.nativeEnum(to.FinishReason),Ey.string().transform(a7r.catchUnrecognizedEnum)]);to.FinishReason$outboundSchema=Ey.union([Ey.nativeEnum(to.FinishReason),Ey.string().and(Ey.custom())]);var lMt;(function(t){t.inboundSchema=to.FinishReason$inboundSchema,t.outboundSchema=to.FinishReason$outboundSchema})(lMt||(to.FinishReason$=lMt={}));to.ChatCompletionChoice$inboundSchema=Ey.object({index:Ey.number().int(),message:fMt.AssistantMessage$inboundSchema,finish_reason:to.FinishReason$inboundSchema}).transform(t=>(0,dMt.remap)(t,{finish_reason:"finishReason"}));to.ChatCompletionChoice$outboundSchema=Ey.object({index:Ey.number().int(),message:fMt.AssistantMessage$outboundSchema,finishReason:to.FinishReason$outboundSchema}).transform(t=>(0,dMt.remap)(t,{finishReason:"finish_reason"}));var cMt;(function(t){t.inboundSchema=to.ChatCompletionChoice$inboundSchema,t.outboundSchema=to.ChatCompletionChoice$outboundSchema})(cMt||(to.ChatCompletionChoice$=cMt={}));function s7r(t){return JSON.stringify(to.ChatCompletionChoice$outboundSchema.parse(t))}function u7r(t){return(0,i7r.safeParse)(t,e=>to.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var wMt=v(qt=>{"use strict";var l7r=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]}),c7r=qt&&qt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d7r=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)&&l7r(e,t,r);return c7r(e,t),e};Object.defineProperty(qt,"__esModule",{value:!0});qt.ChatCompletionRequest$=qt.ChatCompletionRequest$outboundSchema=qt.ChatCompletionRequest$inboundSchema=qt.ChatCompletionRequestToolChoice$=qt.ChatCompletionRequestToolChoice$outboundSchema=qt.ChatCompletionRequestToolChoice$inboundSchema=qt.Messages$=qt.Messages$outboundSchema=qt.Messages$inboundSchema=qt.Stop$=qt.Stop$outboundSchema=qt.Stop$inboundSchema=void 0;qt.stopToJSON=f7r;qt.stopFromJSON=p7r;qt.messagesToJSON=m7r;qt.messagesFromJSON=h7r;qt.chatCompletionRequestToolChoiceToJSON=g7r;qt.chatCompletionRequestToolChoiceFromJSON=y7r;qt.chatCompletionRequestToJSON=b7r;qt.chatCompletionRequestFromJSON=_7r;var Ne=d7r(we()),yMt=ke(),Yoe=me(),Zoe=HA(),bMt=uq(),_Mt=lq(),Xoe=iD(),vMt=cq(),Qoe=dq(),eie=fq(),tie=aD(),rie=sD();qt.Stop$inboundSchema=Ne.union([Ne.string(),Ne.array(Ne.string())]);qt.Stop$outboundSchema=Ne.union([Ne.string(),Ne.array(Ne.string())]);var pMt;(function(t){t.inboundSchema=qt.Stop$inboundSchema,t.outboundSchema=qt.Stop$outboundSchema})(pMt||(qt.Stop$=pMt={}));function f7r(t){return JSON.stringify(qt.Stop$outboundSchema.parse(t))}function p7r(t){return(0,Yoe.safeParse)(t,e=>qt.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}qt.Messages$inboundSchema=Ne.union([Xoe.SystemMessage$inboundSchema.and(Ne.object({role:Ne.literal("system")}).transform(t=>({role:t.role}))),rie.UserMessage$inboundSchema.and(Ne.object({role:Ne.literal("user")}).transform(t=>({role:t.role}))),Zoe.AssistantMessage$inboundSchema.and(Ne.object({role:Ne.literal("assistant")}).transform(t=>({role:t.role}))),tie.ToolMessage$inboundSchema.and(Ne.object({role:Ne.literal("tool")}).transform(t=>({role:t.role})))]);qt.Messages$outboundSchema=Ne.union([Xoe.SystemMessage$outboundSchema.and(Ne.object({role:Ne.literal("system")}).transform(t=>({role:t.role}))),rie.UserMessage$outboundSchema.and(Ne.object({role:Ne.literal("user")}).transform(t=>({role:t.role}))),Zoe.AssistantMessage$outboundSchema.and(Ne.object({role:Ne.literal("assistant")}).transform(t=>({role:t.role}))),tie.ToolMessage$outboundSchema.and(Ne.object({role:Ne.literal("tool")}).transform(t=>({role:t.role})))]);var mMt;(function(t){t.inboundSchema=qt.Messages$inboundSchema,t.outboundSchema=qt.Messages$outboundSchema})(mMt||(qt.Messages$=mMt={}));function m7r(t){return JSON.stringify(qt.Messages$outboundSchema.parse(t))}function h7r(t){return(0,Yoe.safeParse)(t,e=>qt.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}qt.ChatCompletionRequestToolChoice$inboundSchema=Ne.union([Qoe.ToolChoice$inboundSchema,eie.ToolChoiceEnum$inboundSchema]);qt.ChatCompletionRequestToolChoice$outboundSchema=Ne.union([Qoe.ToolChoice$outboundSchema,eie.ToolChoiceEnum$outboundSchema]);var hMt;(function(t){t.inboundSchema=qt.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=qt.ChatCompletionRequestToolChoice$outboundSchema})(hMt||(qt.ChatCompletionRequestToolChoice$=hMt={}));function g7r(t){return JSON.stringify(qt.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function y7r(t){return(0,Yoe.safeParse)(t,e=>qt.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}qt.ChatCompletionRequest$inboundSchema=Ne.object({model:Ne.nullable(Ne.string()),temperature:Ne.nullable(Ne.number()).optional(),top_p:Ne.number().optional(),max_tokens:Ne.nullable(Ne.number().int()).optional(),stream:Ne.boolean().default(!1),stop:Ne.union([Ne.string(),Ne.array(Ne.string())]).optional(),random_seed:Ne.nullable(Ne.number().int()).optional(),messages:Ne.array(Ne.union([Xoe.SystemMessage$inboundSchema.and(Ne.object({role:Ne.literal("system")}).transform(t=>({role:t.role}))),rie.UserMessage$inboundSchema.and(Ne.object({role:Ne.literal("user")}).transform(t=>({role:t.role}))),Zoe.AssistantMessage$inboundSchema.and(Ne.object({role:Ne.literal("assistant")}).transform(t=>({role:t.role}))),tie.ToolMessage$inboundSchema.and(Ne.object({role:Ne.literal("tool")}).transform(t=>({role:t.role})))])),response_format:_Mt.ResponseFormat$inboundSchema.optional(),tools:Ne.nullable(Ne.array(vMt.Tool$inboundSchema)).optional(),tool_choice:Ne.union([Qoe.ToolChoice$inboundSchema,eie.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Ne.number().optional(),frequency_penalty:Ne.number().optional(),n:Ne.nullable(Ne.number().int()).optional(),prediction:bMt.Prediction$inboundSchema.optional(),safe_prompt:Ne.boolean().optional()}).transform(t=>(0,yMt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",safe_prompt:"safePrompt"}));qt.ChatCompletionRequest$outboundSchema=Ne.object({model:Ne.nullable(Ne.string()),temperature:Ne.nullable(Ne.number()).optional(),topP:Ne.number().optional(),maxTokens:Ne.nullable(Ne.number().int()).optional(),stream:Ne.boolean().default(!1),stop:Ne.union([Ne.string(),Ne.array(Ne.string())]).optional(),randomSeed:Ne.nullable(Ne.number().int()).optional(),messages:Ne.array(Ne.union([Xoe.SystemMessage$outboundSchema.and(Ne.object({role:Ne.literal("system")}).transform(t=>({role:t.role}))),rie.UserMessage$outboundSchema.and(Ne.object({role:Ne.literal("user")}).transform(t=>({role:t.role}))),Zoe.AssistantMessage$outboundSchema.and(Ne.object({role:Ne.literal("assistant")}).transform(t=>({role:t.role}))),tie.ToolMessage$outboundSchema.and(Ne.object({role:Ne.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:_Mt.ResponseFormat$outboundSchema.optional(),tools:Ne.nullable(Ne.array(vMt.Tool$outboundSchema)).optional(),toolChoice:Ne.union([Qoe.ToolChoice$outboundSchema,eie.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Ne.number().optional(),frequencyPenalty:Ne.number().optional(),n:Ne.nullable(Ne.number().int()).optional(),prediction:bMt.Prediction$outboundSchema.optional(),safePrompt:Ne.boolean().optional()}).transform(t=>(0,yMt.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 gMt;(function(t){t.inboundSchema=qt.ChatCompletionRequest$inboundSchema,t.outboundSchema=qt.ChatCompletionRequest$outboundSchema})(gMt||(qt.ChatCompletionRequest$=gMt={}));function b7r(t){return JSON.stringify(qt.ChatCompletionRequest$outboundSchema.parse(t))}function _7r(t){return(0,Yoe.safeParse)(t,e=>qt.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var mq=v(au=>{"use strict";var v7r=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]}),w7r=au&&au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S7r=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)&&v7r(e,t,r);return w7r(e,t),e};Object.defineProperty(au,"__esModule",{value:!0});au.UsageInfo$=au.UsageInfo$outboundSchema=au.UsageInfo$inboundSchema=void 0;au.usageInfoToJSON=C7r;au.usageInfoFromJSON=O7r;var VA=S7r(we()),xMt=ke(),x7r=me();au.UsageInfo$inboundSchema=VA.object({prompt_tokens:VA.number().int(),completion_tokens:VA.number().int(),total_tokens:VA.number().int()}).transform(t=>(0,xMt.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens"}));au.UsageInfo$outboundSchema=VA.object({promptTokens:VA.number().int(),completionTokens:VA.number().int(),totalTokens:VA.number().int()}).transform(t=>(0,xMt.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens"}));var SMt;(function(t){t.inboundSchema=au.UsageInfo$inboundSchema,t.outboundSchema=au.UsageInfo$outboundSchema})(SMt||(au.UsageInfo$=SMt={}));function C7r(t){return JSON.stringify(au.UsageInfo$outboundSchema.parse(t))}function O7r(t){return(0,x7r.safeParse)(t,e=>au.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var EMt=v(su=>{"use strict";var P7r=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]}),E7r=su&&su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T7r=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)&&P7r(e,t,r);return E7r(e,t),e};Object.defineProperty(su,"__esModule",{value:!0});su.ChatCompletionResponse$=su.ChatCompletionResponse$outboundSchema=su.ChatCompletionResponse$inboundSchema=void 0;su.chatCompletionResponseToJSON=I7r;su.chatCompletionResponseFromJSON=M7r;var rg=T7r(we()),A7r=me(),OMt=Goe(),PMt=mq();su.ChatCompletionResponse$inboundSchema=rg.object({id:rg.string(),object:rg.string(),model:rg.string(),usage:PMt.UsageInfo$inboundSchema,created:rg.number().int().optional(),choices:rg.array(OMt.ChatCompletionChoice$inboundSchema).optional()});su.ChatCompletionResponse$outboundSchema=rg.object({id:rg.string(),object:rg.string(),model:rg.string(),usage:PMt.UsageInfo$outboundSchema,created:rg.number().int().optional(),choices:rg.array(OMt.ChatCompletionChoice$outboundSchema).optional()});var CMt;(function(t){t.inboundSchema=su.ChatCompletionResponse$inboundSchema,t.outboundSchema=su.ChatCompletionResponse$outboundSchema})(CMt||(su.ChatCompletionResponse$=CMt={}));function I7r(t){return JSON.stringify(su.ChatCompletionResponse$outboundSchema.parse(t))}function M7r(t){return(0,A7r.safeParse)(t,e=>su.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var LMt=v(Ut=>{"use strict";var R7r=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]}),j7r=Ut&&Ut.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D7r=Ut&&Ut.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&R7r(e,t,r);return j7r(e,t),e};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.ChatCompletionStreamRequest$=Ut.ChatCompletionStreamRequest$outboundSchema=Ut.ChatCompletionStreamRequest$inboundSchema=Ut.ChatCompletionStreamRequestToolChoice$=Ut.ChatCompletionStreamRequestToolChoice$outboundSchema=Ut.ChatCompletionStreamRequestToolChoice$inboundSchema=Ut.ChatCompletionStreamRequestMessages$=Ut.ChatCompletionStreamRequestMessages$outboundSchema=Ut.ChatCompletionStreamRequestMessages$inboundSchema=Ut.ChatCompletionStreamRequestStop$=Ut.ChatCompletionStreamRequestStop$outboundSchema=Ut.ChatCompletionStreamRequestStop$inboundSchema=void 0;Ut.chatCompletionStreamRequestStopToJSON=N7r;Ut.chatCompletionStreamRequestStopFromJSON=L7r;Ut.chatCompletionStreamRequestMessagesToJSON=F7r;Ut.chatCompletionStreamRequestMessagesFromJSON=k7r;Ut.chatCompletionStreamRequestToolChoiceToJSON=$7r;Ut.chatCompletionStreamRequestToolChoiceFromJSON=B7r;Ut.chatCompletionStreamRequestToJSON=q7r;Ut.chatCompletionStreamRequestFromJSON=U7r;var Le=D7r(we()),RMt=ke(),nie=me(),oie=HA(),jMt=uq(),DMt=lq(),iie=iD(),NMt=cq(),aie=dq(),sie=fq(),uie=aD(),lie=sD();Ut.ChatCompletionStreamRequestStop$inboundSchema=Le.union([Le.string(),Le.array(Le.string())]);Ut.ChatCompletionStreamRequestStop$outboundSchema=Le.union([Le.string(),Le.array(Le.string())]);var TMt;(function(t){t.inboundSchema=Ut.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Ut.ChatCompletionStreamRequestStop$outboundSchema})(TMt||(Ut.ChatCompletionStreamRequestStop$=TMt={}));function N7r(t){return JSON.stringify(Ut.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function L7r(t){return(0,nie.safeParse)(t,e=>Ut.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}Ut.ChatCompletionStreamRequestMessages$inboundSchema=Le.union([iie.SystemMessage$inboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),lie.UserMessage$inboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),oie.AssistantMessage$inboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role}))),uie.ToolMessage$inboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role})))]);Ut.ChatCompletionStreamRequestMessages$outboundSchema=Le.union([iie.SystemMessage$outboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),lie.UserMessage$outboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),oie.AssistantMessage$outboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role}))),uie.ToolMessage$outboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role})))]);var AMt;(function(t){t.inboundSchema=Ut.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Ut.ChatCompletionStreamRequestMessages$outboundSchema})(AMt||(Ut.ChatCompletionStreamRequestMessages$=AMt={}));function F7r(t){return JSON.stringify(Ut.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function k7r(t){return(0,nie.safeParse)(t,e=>Ut.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}Ut.ChatCompletionStreamRequestToolChoice$inboundSchema=Le.union([aie.ToolChoice$inboundSchema,sie.ToolChoiceEnum$inboundSchema]);Ut.ChatCompletionStreamRequestToolChoice$outboundSchema=Le.union([aie.ToolChoice$outboundSchema,sie.ToolChoiceEnum$outboundSchema]);var IMt;(function(t){t.inboundSchema=Ut.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Ut.ChatCompletionStreamRequestToolChoice$outboundSchema})(IMt||(Ut.ChatCompletionStreamRequestToolChoice$=IMt={}));function $7r(t){return JSON.stringify(Ut.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function B7r(t){return(0,nie.safeParse)(t,e=>Ut.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}Ut.ChatCompletionStreamRequest$inboundSchema=Le.object({model:Le.nullable(Le.string()),temperature:Le.nullable(Le.number()).optional(),top_p:Le.number().optional(),max_tokens:Le.nullable(Le.number().int()).optional(),stream:Le.boolean().default(!0),stop:Le.union([Le.string(),Le.array(Le.string())]).optional(),random_seed:Le.nullable(Le.number().int()).optional(),messages:Le.array(Le.union([iie.SystemMessage$inboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),lie.UserMessage$inboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),oie.AssistantMessage$inboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role}))),uie.ToolMessage$inboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role})))])),response_format:DMt.ResponseFormat$inboundSchema.optional(),tools:Le.nullable(Le.array(NMt.Tool$inboundSchema)).optional(),tool_choice:Le.union([aie.ToolChoice$inboundSchema,sie.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Le.number().optional(),frequency_penalty:Le.number().optional(),n:Le.nullable(Le.number().int()).optional(),prediction:jMt.Prediction$inboundSchema.optional(),safe_prompt:Le.boolean().optional()}).transform(t=>(0,RMt.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"}));Ut.ChatCompletionStreamRequest$outboundSchema=Le.object({model:Le.nullable(Le.string()),temperature:Le.nullable(Le.number()).optional(),topP:Le.number().optional(),maxTokens:Le.nullable(Le.number().int()).optional(),stream:Le.boolean().default(!0),stop:Le.union([Le.string(),Le.array(Le.string())]).optional(),randomSeed:Le.nullable(Le.number().int()).optional(),messages:Le.array(Le.union([iie.SystemMessage$outboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),lie.UserMessage$outboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),oie.AssistantMessage$outboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role}))),uie.ToolMessage$outboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:DMt.ResponseFormat$outboundSchema.optional(),tools:Le.nullable(Le.array(NMt.Tool$outboundSchema)).optional(),toolChoice:Le.union([aie.ToolChoice$outboundSchema,sie.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Le.number().optional(),frequencyPenalty:Le.number().optional(),n:Le.nullable(Le.number().int()).optional(),prediction:jMt.Prediction$outboundSchema.optional(),safePrompt:Le.boolean().optional()}).transform(t=>(0,RMt.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 MMt;(function(t){t.inboundSchema=Ut.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=Ut.ChatCompletionStreamRequest$outboundSchema})(MMt||(Ut.ChatCompletionStreamRequest$=MMt={}));function q7r(t){return JSON.stringify(Ut.ChatCompletionStreamRequest$outboundSchema.parse(t))}function U7r(t){return(0,nie.safeParse)(t,e=>Ut.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var nMe=v(uu=>{"use strict";var z7r=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]}),H7r=uu&&uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V7r=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)&&z7r(e,t,r);return H7r(e,t),e};Object.defineProperty(uu,"__esModule",{value:!0});uu.MetricOut$=uu.MetricOut$outboundSchema=uu.MetricOut$inboundSchema=void 0;uu.metricOutToJSON=K7r;uu.metricOutFromJSON=J7r;var Mp=V7r(we()),kMt=ke(),W7r=me();uu.MetricOut$inboundSchema=Mp.object({train_loss:Mp.nullable(Mp.number()).optional(),valid_loss:Mp.nullable(Mp.number()).optional(),valid_mean_token_accuracy:Mp.nullable(Mp.number()).optional()}).transform(t=>(0,kMt.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));uu.MetricOut$outboundSchema=Mp.object({trainLoss:Mp.nullable(Mp.number()).optional(),validLoss:Mp.nullable(Mp.number()).optional(),validMeanTokenAccuracy:Mp.nullable(Mp.number()).optional()}).transform(t=>(0,kMt.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var FMt;(function(t){t.inboundSchema=uu.MetricOut$inboundSchema,t.outboundSchema=uu.MetricOut$outboundSchema})(FMt||(uu.MetricOut$=FMt={}));function K7r(t){return JSON.stringify(uu.MetricOut$outboundSchema.parse(t))}function J7r(t){return(0,W7r.safeParse)(t,e=>uu.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var oMe=v(lu=>{"use strict";var G7r=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]}),Y7r=lu&&lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z7r=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)&&G7r(e,t,r);return Y7r(e,t),e};Object.defineProperty(lu,"__esModule",{value:!0});lu.CheckpointOut$=lu.CheckpointOut$outboundSchema=lu.CheckpointOut$inboundSchema=void 0;lu.checkpointOutToJSON=Q7r;lu.checkpointOutFromJSON=eYr;var hq=Z7r(we()),BMt=ke(),X7r=me(),qMt=nMe();lu.CheckpointOut$inboundSchema=hq.object({metrics:qMt.MetricOut$inboundSchema,step_number:hq.number().int(),created_at:hq.number().int()}).transform(t=>(0,BMt.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));lu.CheckpointOut$outboundSchema=hq.object({metrics:qMt.MetricOut$outboundSchema,stepNumber:hq.number().int(),createdAt:hq.number().int()}).transform(t=>(0,BMt.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var $Mt;(function(t){t.inboundSchema=lu.CheckpointOut$inboundSchema,t.outboundSchema=lu.CheckpointOut$outboundSchema})($Mt||(lu.CheckpointOut$=$Mt={}));function Q7r(t){return JSON.stringify(lu.CheckpointOut$outboundSchema.parse(t))}function eYr(t){return(0,X7r.safeParse)(t,e=>lu.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var iMe=v(cu=>{"use strict";var tYr=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]}),rYr=cu&&cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nYr=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)&&tYr(e,t,r);return rYr(e,t),e};Object.defineProperty(cu,"__esModule",{value:!0});cu.ClassificationObject$=cu.ClassificationObject$outboundSchema=cu.ClassificationObject$inboundSchema=void 0;cu.classificationObjectToJSON=iYr;cu.classificationObjectFromJSON=aYr;var GS=nYr(we()),zMt=ke(),oYr=me();cu.ClassificationObject$inboundSchema=GS.object({categories:GS.record(GS.boolean()).optional(),category_scores:GS.record(GS.number()).optional()}).transform(t=>(0,zMt.remap)(t,{category_scores:"categoryScores"}));cu.ClassificationObject$outboundSchema=GS.object({categories:GS.record(GS.boolean()).optional(),categoryScores:GS.record(GS.number()).optional()}).transform(t=>(0,zMt.remap)(t,{categoryScores:"category_scores"}));var UMt;(function(t){t.inboundSchema=cu.ClassificationObject$inboundSchema,t.outboundSchema=cu.ClassificationObject$outboundSchema})(UMt||(cu.ClassificationObject$=UMt={}));function iYr(t){return JSON.stringify(cu.ClassificationObject$outboundSchema.parse(t))}function aYr(t){return(0,oYr.safeParse)(t,e=>cu.ClassificationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationObject' from JSON")}});var JMt=v(Eo=>{"use strict";var sYr=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]}),uYr=Eo&&Eo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lYr=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)&&sYr(e,t,r);return uYr(e,t),e};Object.defineProperty(Eo,"__esModule",{value:!0});Eo.ClassificationRequest$=Eo.ClassificationRequest$outboundSchema=Eo.ClassificationRequest$inboundSchema=Eo.ClassificationRequestInputs$=Eo.ClassificationRequestInputs$outboundSchema=Eo.ClassificationRequestInputs$inboundSchema=void 0;Eo.classificationRequestInputsToJSON=cYr;Eo.classificationRequestInputsFromJSON=dYr;Eo.classificationRequestToJSON=fYr;Eo.classificationRequestFromJSON=pYr;var ss=lYr(we()),WMt=ke(),KMt=me();Eo.ClassificationRequestInputs$inboundSchema=ss.union([ss.string(),ss.array(ss.string())]);Eo.ClassificationRequestInputs$outboundSchema=ss.union([ss.string(),ss.array(ss.string())]);var HMt;(function(t){t.inboundSchema=Eo.ClassificationRequestInputs$inboundSchema,t.outboundSchema=Eo.ClassificationRequestInputs$outboundSchema})(HMt||(Eo.ClassificationRequestInputs$=HMt={}));function cYr(t){return JSON.stringify(Eo.ClassificationRequestInputs$outboundSchema.parse(t))}function dYr(t){return(0,KMt.safeParse)(t,e=>Eo.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}Eo.ClassificationRequest$inboundSchema=ss.object({input:ss.union([ss.string(),ss.array(ss.string())]),model:ss.nullable(ss.string()).optional()}).transform(t=>(0,WMt.remap)(t,{input:"inputs"}));Eo.ClassificationRequest$outboundSchema=ss.object({inputs:ss.union([ss.string(),ss.array(ss.string())]),model:ss.nullable(ss.string()).optional()}).transform(t=>(0,WMt.remap)(t,{inputs:"input"}));var VMt;(function(t){t.inboundSchema=Eo.ClassificationRequest$inboundSchema,t.outboundSchema=Eo.ClassificationRequest$outboundSchema})(VMt||(Eo.ClassificationRequest$=VMt={}));function fYr(t){return JSON.stringify(Eo.ClassificationRequest$outboundSchema.parse(t))}function pYr(t){return(0,KMt.safeParse)(t,e=>Eo.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var ZMt=v(du=>{"use strict";var mYr=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]}),hYr=du&&du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gYr=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)&&mYr(e,t,r);return hYr(e,t),e};Object.defineProperty(du,"__esModule",{value:!0});du.ClassificationResponse$=du.ClassificationResponse$outboundSchema=du.ClassificationResponse$inboundSchema=void 0;du.classificationResponseToJSON=bYr;du.classificationResponseFromJSON=_Yr;var WA=gYr(we()),yYr=me(),YMt=iMe();du.ClassificationResponse$inboundSchema=WA.object({id:WA.string().optional(),model:WA.string().optional(),results:WA.array(YMt.ClassificationObject$inboundSchema).optional()});du.ClassificationResponse$outboundSchema=WA.object({id:WA.string().optional(),model:WA.string().optional(),results:WA.array(YMt.ClassificationObject$outboundSchema).optional()});var GMt;(function(t){t.inboundSchema=du.ClassificationResponse$inboundSchema,t.outboundSchema=du.ClassificationResponse$outboundSchema})(GMt||(du.ClassificationResponse$=GMt={}));function bYr(t){return JSON.stringify(du.ClassificationResponse$outboundSchema.parse(t))}function _Yr(t){return(0,yYr.safeParse)(t,e=>du.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var aMe=v(To=>{"use strict";var vYr=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]}),wYr=To&&To.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SYr=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)&&vYr(e,t,r);return wYr(e,t),e};Object.defineProperty(To,"__esModule",{value:!0});To.DeltaMessage$=To.DeltaMessage$outboundSchema=To.DeltaMessage$inboundSchema=To.Content$=To.Content$outboundSchema=To.Content$inboundSchema=void 0;To.contentToJSON=xYr;To.contentFromJSON=CYr;To.deltaMessageToJSON=OYr;To.deltaMessageFromJSON=PYr;var _a=SYr(we()),eRt=ke(),tRt=me(),cie=aq(),rRt=Poe();To.Content$inboundSchema=_a.union([_a.string(),_a.array(cie.ContentChunk$inboundSchema)]);To.Content$outboundSchema=_a.union([_a.string(),_a.array(cie.ContentChunk$outboundSchema)]);var XMt;(function(t){t.inboundSchema=To.Content$inboundSchema,t.outboundSchema=To.Content$outboundSchema})(XMt||(To.Content$=XMt={}));function xYr(t){return JSON.stringify(To.Content$outboundSchema.parse(t))}function CYr(t){return(0,tRt.safeParse)(t,e=>To.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}To.DeltaMessage$inboundSchema=_a.object({role:_a.nullable(_a.string()).optional(),content:_a.nullable(_a.union([_a.string(),_a.array(cie.ContentChunk$inboundSchema)])).optional(),tool_calls:_a.nullable(_a.array(rRt.ToolCall$inboundSchema)).optional()}).transform(t=>(0,eRt.remap)(t,{tool_calls:"toolCalls"}));To.DeltaMessage$outboundSchema=_a.object({role:_a.nullable(_a.string()).optional(),content:_a.nullable(_a.union([_a.string(),_a.array(cie.ContentChunk$outboundSchema)])).optional(),toolCalls:_a.nullable(_a.array(rRt.ToolCall$outboundSchema)).optional()}).transform(t=>(0,eRt.remap)(t,{toolCalls:"tool_calls"}));var QMt;(function(t){t.inboundSchema=To.DeltaMessage$inboundSchema,t.outboundSchema=To.DeltaMessage$outboundSchema})(QMt||(To.DeltaMessage$=QMt={}));function OYr(t){return JSON.stringify(To.DeltaMessage$outboundSchema.parse(t))}function PYr(t){return(0,tRt.safeParse)(t,e=>To.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var sMe=v(ro=>{"use strict";var EYr=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]}),TYr=ro&&ro.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AYr=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)&&EYr(e,t,r);return TYr(e,t),e};Object.defineProperty(ro,"__esModule",{value:!0});ro.CompletionResponseStreamChoice$=ro.CompletionResponseStreamChoice$outboundSchema=ro.CompletionResponseStreamChoice$inboundSchema=ro.CompletionResponseStreamChoiceFinishReason$=ro.CompletionResponseStreamChoiceFinishReason$outboundSchema=ro.CompletionResponseStreamChoiceFinishReason$inboundSchema=ro.CompletionResponseStreamChoiceFinishReason=void 0;ro.completionResponseStreamChoiceToJSON=RYr;ro.completionResponseStreamChoiceFromJSON=jYr;var jm=AYr(we()),iRt=ke(),IYr=me(),MYr=zA(),aRt=aMe();ro.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};ro.CompletionResponseStreamChoiceFinishReason$inboundSchema=jm.union([jm.nativeEnum(ro.CompletionResponseStreamChoiceFinishReason),jm.string().transform(MYr.catchUnrecognizedEnum)]);ro.CompletionResponseStreamChoiceFinishReason$outboundSchema=jm.union([jm.nativeEnum(ro.CompletionResponseStreamChoiceFinishReason),jm.string().and(jm.custom())]);var nRt;(function(t){t.inboundSchema=ro.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=ro.CompletionResponseStreamChoiceFinishReason$outboundSchema})(nRt||(ro.CompletionResponseStreamChoiceFinishReason$=nRt={}));ro.CompletionResponseStreamChoice$inboundSchema=jm.object({index:jm.number().int(),delta:aRt.DeltaMessage$inboundSchema,finish_reason:jm.nullable(ro.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,iRt.remap)(t,{finish_reason:"finishReason"}));ro.CompletionResponseStreamChoice$outboundSchema=jm.object({index:jm.number().int(),delta:aRt.DeltaMessage$outboundSchema,finishReason:jm.nullable(ro.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,iRt.remap)(t,{finishReason:"finish_reason"}));var oRt;(function(t){t.inboundSchema=ro.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=ro.CompletionResponseStreamChoice$outboundSchema})(oRt||(ro.CompletionResponseStreamChoice$=oRt={}));function RYr(t){return JSON.stringify(ro.CompletionResponseStreamChoice$outboundSchema.parse(t))}function jYr(t){return(0,IYr.safeParse)(t,e=>ro.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var uMe=v(fu=>{"use strict";var DYr=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]}),NYr=fu&&fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LYr=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)&&DYr(e,t,r);return NYr(e,t),e};Object.defineProperty(fu,"__esModule",{value:!0});fu.CompletionChunk$=fu.CompletionChunk$outboundSchema=fu.CompletionChunk$inboundSchema=void 0;fu.completionChunkToJSON=kYr;fu.completionChunkFromJSON=$Yr;var ng=LYr(we()),FYr=me(),uRt=sMe(),lRt=mq();fu.CompletionChunk$inboundSchema=ng.object({id:ng.string(),object:ng.string().optional(),created:ng.number().int().optional(),model:ng.string(),usage:lRt.UsageInfo$inboundSchema.optional(),choices:ng.array(uRt.CompletionResponseStreamChoice$inboundSchema)});fu.CompletionChunk$outboundSchema=ng.object({id:ng.string(),object:ng.string().optional(),created:ng.number().int().optional(),model:ng.string(),usage:lRt.UsageInfo$outboundSchema.optional(),choices:ng.array(uRt.CompletionResponseStreamChoice$outboundSchema)});var sRt;(function(t){t.inboundSchema=fu.CompletionChunk$inboundSchema,t.outboundSchema=fu.CompletionChunk$outboundSchema})(sRt||(fu.CompletionChunk$=sRt={}));function kYr(t){return JSON.stringify(fu.CompletionChunk$outboundSchema.parse(t))}function $Yr(t){return(0,FYr.safeParse)(t,e=>fu.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var fRt=v(pu=>{"use strict";var BYr=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]}),qYr=pu&&pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UYr=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)&&BYr(e,t,r);return qYr(e,t),e};Object.defineProperty(pu,"__esModule",{value:!0});pu.CompletionEvent$=pu.CompletionEvent$outboundSchema=pu.CompletionEvent$inboundSchema=void 0;pu.completionEventToJSON=HYr;pu.completionEventFromJSON=VYr;var X8=UYr(we()),zYr=me(),dRt=uMe();pu.CompletionEvent$inboundSchema=X8.object({data:X8.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:X8.ZodIssueCode.custom,message:`malformed json: ${r}`}),X8.NEVER}}).pipe(dRt.CompletionChunk$inboundSchema)});pu.CompletionEvent$outboundSchema=X8.object({data:dRt.CompletionChunk$outboundSchema});var cRt;(function(t){t.inboundSchema=pu.CompletionEvent$inboundSchema,t.outboundSchema=pu.CompletionEvent$outboundSchema})(cRt||(pu.CompletionEvent$=cRt={}));function HYr(t){return JSON.stringify(pu.CompletionEvent$outboundSchema.parse(t))}function VYr(t){return(0,zYr.safeParse)(t,e=>pu.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var mRt=v(mu=>{"use strict";var WYr=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]}),KYr=mu&&mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JYr=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)&&WYr(e,t,r);return KYr(e,t),e};Object.defineProperty(mu,"__esModule",{value:!0});mu.DeleteFileOut$=mu.DeleteFileOut$outboundSchema=mu.DeleteFileOut$inboundSchema=void 0;mu.deleteFileOutToJSON=YYr;mu.deleteFileOutFromJSON=ZYr;var KA=JYr(we()),GYr=me();mu.DeleteFileOut$inboundSchema=KA.object({id:KA.string(),object:KA.string(),deleted:KA.boolean()});mu.DeleteFileOut$outboundSchema=KA.object({id:KA.string(),object:KA.string(),deleted:KA.boolean()});var pRt;(function(t){t.inboundSchema=mu.DeleteFileOut$inboundSchema,t.outboundSchema=mu.DeleteFileOut$outboundSchema})(pRt||(mu.DeleteFileOut$=pRt={}));function YYr(t){return JSON.stringify(mu.DeleteFileOut$outboundSchema.parse(t))}function ZYr(t){return(0,GYr.safeParse)(t,e=>mu.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var gRt=v(hu=>{"use strict";var XYr=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]}),QYr=hu&&hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eZr=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)&&XYr(e,t,r);return QYr(e,t),e};Object.defineProperty(hu,"__esModule",{value:!0});hu.DeleteModelOut$=hu.DeleteModelOut$outboundSchema=hu.DeleteModelOut$inboundSchema=void 0;hu.deleteModelOutToJSON=rZr;hu.deleteModelOutFromJSON=nZr;var JA=eZr(we()),tZr=me();hu.DeleteModelOut$inboundSchema=JA.object({id:JA.string(),object:JA.string().default("model"),deleted:JA.boolean().default(!0)});hu.DeleteModelOut$outboundSchema=JA.object({id:JA.string(),object:JA.string().default("model"),deleted:JA.boolean().default(!0)});var hRt;(function(t){t.inboundSchema=hu.DeleteModelOut$inboundSchema,t.outboundSchema=hu.DeleteModelOut$outboundSchema})(hRt||(hu.DeleteModelOut$=hRt={}));function rZr(t){return JSON.stringify(hu.DeleteModelOut$outboundSchema.parse(t))}function nZr(t){return(0,tZr.safeParse)(t,e=>hu.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var lMe=v(gu=>{"use strict";var oZr=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]}),iZr=gu&&gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aZr=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)&&oZr(e,t,r);return iZr(e,t),e};Object.defineProperty(gu,"__esModule",{value:!0});gu.EventOut$=gu.EventOut$outboundSchema=gu.EventOut$inboundSchema=void 0;gu.eventOutToJSON=uZr;gu.eventOutFromJSON=lZr;var og=aZr(we()),bRt=ke(),sZr=me();gu.EventOut$inboundSchema=og.object({name:og.string(),data:og.nullable(og.record(og.any())).optional(),created_at:og.number().int()}).transform(t=>(0,bRt.remap)(t,{created_at:"createdAt"}));gu.EventOut$outboundSchema=og.object({name:og.string(),data:og.nullable(og.record(og.any())).optional(),createdAt:og.number().int()}).transform(t=>(0,bRt.remap)(t,{createdAt:"created_at"}));var yRt;(function(t){t.inboundSchema=gu.EventOut$inboundSchema,t.outboundSchema=gu.EventOut$outboundSchema})(yRt||(gu.EventOut$=yRt={}));function uZr(t){return JSON.stringify(gu.EventOut$outboundSchema.parse(t))}function lZr(t){return(0,sZr.safeParse)(t,e=>gu.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var die=v(Ao=>{"use strict";var cZr=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]}),dZr=Ao&&Ao.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fZr=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)&&cZr(e,t,r);return dZr(e,t),e};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.GithubRepositoryOut$=Ao.GithubRepositoryOut$outboundSchema=Ao.GithubRepositoryOut$inboundSchema=Ao.GithubRepositoryOutType$=Ao.GithubRepositoryOutType$outboundSchema=Ao.GithubRepositoryOutType$inboundSchema=Ao.GithubRepositoryOutType=void 0;Ao.githubRepositoryOutToJSON=mZr;Ao.githubRepositoryOutFromJSON=hZr;var Uc=fZr(we()),wRt=ke(),pZr=me();Ao.GithubRepositoryOutType={Github:"github"};Ao.GithubRepositoryOutType$inboundSchema=Uc.nativeEnum(Ao.GithubRepositoryOutType);Ao.GithubRepositoryOutType$outboundSchema=Ao.GithubRepositoryOutType$inboundSchema;var _Rt;(function(t){t.inboundSchema=Ao.GithubRepositoryOutType$inboundSchema,t.outboundSchema=Ao.GithubRepositoryOutType$outboundSchema})(_Rt||(Ao.GithubRepositoryOutType$=_Rt={}));Ao.GithubRepositoryOut$inboundSchema=Uc.object({type:Uc.literal("github").default("github"),name:Uc.string(),owner:Uc.string(),ref:Uc.nullable(Uc.string()).optional(),weight:Uc.number().default(1),commit_id:Uc.string()}).transform(t=>(0,wRt.remap)(t,{commit_id:"commitId"}));Ao.GithubRepositoryOut$outboundSchema=Uc.object({type:Uc.literal("github").default("github"),name:Uc.string(),owner:Uc.string(),ref:Uc.nullable(Uc.string()).optional(),weight:Uc.number().default(1),commitId:Uc.string()}).transform(t=>(0,wRt.remap)(t,{commitId:"commit_id"}));var vRt;(function(t){t.inboundSchema=Ao.GithubRepositoryOut$inboundSchema,t.outboundSchema=Ao.GithubRepositoryOut$outboundSchema})(vRt||(Ao.GithubRepositoryOut$=vRt={}));function mZr(t){return JSON.stringify(Ao.GithubRepositoryOut$outboundSchema.parse(t))}function hZr(t){return(0,pZr.safeParse)(t,e=>Ao.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var fie=v(yu=>{"use strict";var gZr=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]}),yZr=yu&&yu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bZr=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)&&gZr(e,t,r);return yZr(e,t),e};Object.defineProperty(yu,"__esModule",{value:!0});yu.JobMetadataOut$=yu.JobMetadataOut$outboundSchema=yu.JobMetadataOut$inboundSchema=void 0;yu.jobMetadataOutToJSON=vZr;yu.jobMetadataOutFromJSON=wZr;var oi=bZr(we()),xRt=ke(),_Zr=me();yu.JobMetadataOut$inboundSchema=oi.object({expected_duration_seconds:oi.nullable(oi.number().int()).optional(),cost:oi.nullable(oi.number()).optional(),cost_currency:oi.nullable(oi.string()).optional(),train_tokens_per_step:oi.nullable(oi.number().int()).optional(),train_tokens:oi.nullable(oi.number().int()).optional(),data_tokens:oi.nullable(oi.number().int()).optional(),estimated_start_time:oi.nullable(oi.number().int()).optional()}).transform(t=>(0,xRt.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));yu.JobMetadataOut$outboundSchema=oi.object({expectedDurationSeconds:oi.nullable(oi.number().int()).optional(),cost:oi.nullable(oi.number()).optional(),costCurrency:oi.nullable(oi.string()).optional(),trainTokensPerStep:oi.nullable(oi.number().int()).optional(),trainTokens:oi.nullable(oi.number().int()).optional(),dataTokens:oi.nullable(oi.number().int()).optional(),estimatedStartTime:oi.nullable(oi.number().int()).optional()}).transform(t=>(0,xRt.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 SRt;(function(t){t.inboundSchema=yu.JobMetadataOut$inboundSchema,t.outboundSchema=yu.JobMetadataOut$outboundSchema})(SRt||(yu.JobMetadataOut$=SRt={}));function vZr(t){return JSON.stringify(yu.JobMetadataOut$outboundSchema.parse(t))}function wZr(t){return(0,_Zr.safeParse)(t,e=>yu.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var pie=v(bu=>{"use strict";var SZr=bu&&bu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xZr=bu&&bu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CZr=bu&&bu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SZr(e,t,r);return xZr(e,t),e};Object.defineProperty(bu,"__esModule",{value:!0});bu.TrainingParameters$=bu.TrainingParameters$outboundSchema=bu.TrainingParameters$inboundSchema=void 0;bu.trainingParametersToJSON=PZr;bu.trainingParametersFromJSON=EZr;var vi=CZr(we()),ORt=ke(),OZr=me();bu.TrainingParameters$inboundSchema=vi.object({training_steps:vi.nullable(vi.number().int()).optional(),learning_rate:vi.number().default(1e-4),weight_decay:vi.nullable(vi.number()).optional(),warmup_fraction:vi.nullable(vi.number()).optional(),epochs:vi.nullable(vi.number()).optional(),fim_ratio:vi.nullable(vi.number()).optional(),seq_len:vi.nullable(vi.number().int()).optional()}).transform(t=>(0,ORt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));bu.TrainingParameters$outboundSchema=vi.object({trainingSteps:vi.nullable(vi.number().int()).optional(),learningRate:vi.number().default(1e-4),weightDecay:vi.nullable(vi.number()).optional(),warmupFraction:vi.nullable(vi.number()).optional(),epochs:vi.nullable(vi.number()).optional(),fimRatio:vi.nullable(vi.number()).optional(),seqLen:vi.nullable(vi.number().int()).optional()}).transform(t=>(0,ORt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var CRt;(function(t){t.inboundSchema=bu.TrainingParameters$inboundSchema,t.outboundSchema=bu.TrainingParameters$outboundSchema})(CRt||(bu.TrainingParameters$=CRt={}));function PZr(t){return JSON.stringify(bu.TrainingParameters$outboundSchema.parse(t))}function EZr(t){return(0,OZr.safeParse)(t,e=>bu.TrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParameters' from JSON")}});var mie=v(Io=>{"use strict";var TZr=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]}),AZr=Io&&Io.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IZr=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)&&TZr(e,t,r);return AZr(e,t),e};Object.defineProperty(Io,"__esModule",{value:!0});Io.WandbIntegrationOut$=Io.WandbIntegrationOut$outboundSchema=Io.WandbIntegrationOut$inboundSchema=Io.WandbIntegrationOutType$=Io.WandbIntegrationOutType$outboundSchema=Io.WandbIntegrationOutType$inboundSchema=Io.WandbIntegrationOutType=void 0;Io.wandbIntegrationOutToJSON=RZr;Io.wandbIntegrationOutFromJSON=jZr;var Af=IZr(we()),TRt=ke(),MZr=me();Io.WandbIntegrationOutType={Wandb:"wandb"};Io.WandbIntegrationOutType$inboundSchema=Af.nativeEnum(Io.WandbIntegrationOutType);Io.WandbIntegrationOutType$outboundSchema=Io.WandbIntegrationOutType$inboundSchema;var PRt;(function(t){t.inboundSchema=Io.WandbIntegrationOutType$inboundSchema,t.outboundSchema=Io.WandbIntegrationOutType$outboundSchema})(PRt||(Io.WandbIntegrationOutType$=PRt={}));Io.WandbIntegrationOut$inboundSchema=Af.object({type:Af.literal("wandb").default("wandb"),project:Af.string(),name:Af.nullable(Af.string()).optional(),run_name:Af.nullable(Af.string()).optional()}).transform(t=>(0,TRt.remap)(t,{run_name:"runName"}));Io.WandbIntegrationOut$outboundSchema=Af.object({type:Af.literal("wandb").default("wandb"),project:Af.string(),name:Af.nullable(Af.string()).optional(),runName:Af.nullable(Af.string()).optional()}).transform(t=>(0,TRt.remap)(t,{runName:"run_name"}));var ERt;(function(t){t.inboundSchema=Io.WandbIntegrationOut$inboundSchema,t.outboundSchema=Io.WandbIntegrationOut$outboundSchema})(ERt||(Io.WandbIntegrationOut$=ERt={}));function RZr(t){return JSON.stringify(Io.WandbIntegrationOut$outboundSchema.parse(t))}function jZr(t){return(0,MZr.safeParse)(t,e=>Io.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var $Rt=v(ut=>{"use strict";var DZr=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]}),NZr=ut&&ut.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LZr=ut&&ut.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DZr(e,t,r);return NZr(e,t),e};Object.defineProperty(ut,"__esModule",{value:!0});ut.DetailedJobOut$=ut.DetailedJobOut$outboundSchema=ut.DetailedJobOut$inboundSchema=ut.DetailedJobOutRepositories$=ut.DetailedJobOutRepositories$outboundSchema=ut.DetailedJobOutRepositories$inboundSchema=ut.DetailedJobOutIntegrations$=ut.DetailedJobOutIntegrations$outboundSchema=ut.DetailedJobOutIntegrations$inboundSchema=ut.DetailedJobOutObject$=ut.DetailedJobOutObject$outboundSchema=ut.DetailedJobOutObject$inboundSchema=ut.DetailedJobOutStatus$=ut.DetailedJobOutStatus$outboundSchema=ut.DetailedJobOutStatus$inboundSchema=ut.DetailedJobOutObject=ut.DetailedJobOutStatus=void 0;ut.detailedJobOutIntegrationsToJSON=FZr;ut.detailedJobOutIntegrationsFromJSON=kZr;ut.detailedJobOutRepositoriesToJSON=$Zr;ut.detailedJobOutRepositoriesFromJSON=BZr;ut.detailedJobOutToJSON=qZr;ut.detailedJobOutFromJSON=UZr;var tr=LZr(we()),DRt=ke(),cMe=me(),NRt=oMe(),LRt=lMe(),hie=die(),FRt=fie(),kRt=pie(),gie=mie();ut.DetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};ut.DetailedJobOutObject={Job:"job"};ut.DetailedJobOutStatus$inboundSchema=tr.nativeEnum(ut.DetailedJobOutStatus);ut.DetailedJobOutStatus$outboundSchema=ut.DetailedJobOutStatus$inboundSchema;var ARt;(function(t){t.inboundSchema=ut.DetailedJobOutStatus$inboundSchema,t.outboundSchema=ut.DetailedJobOutStatus$outboundSchema})(ARt||(ut.DetailedJobOutStatus$=ARt={}));ut.DetailedJobOutObject$inboundSchema=tr.nativeEnum(ut.DetailedJobOutObject);ut.DetailedJobOutObject$outboundSchema=ut.DetailedJobOutObject$inboundSchema;var IRt;(function(t){t.inboundSchema=ut.DetailedJobOutObject$inboundSchema,t.outboundSchema=ut.DetailedJobOutObject$outboundSchema})(IRt||(ut.DetailedJobOutObject$=IRt={}));ut.DetailedJobOutIntegrations$inboundSchema=gie.WandbIntegrationOut$inboundSchema;ut.DetailedJobOutIntegrations$outboundSchema=gie.WandbIntegrationOut$outboundSchema;var MRt;(function(t){t.inboundSchema=ut.DetailedJobOutIntegrations$inboundSchema,t.outboundSchema=ut.DetailedJobOutIntegrations$outboundSchema})(MRt||(ut.DetailedJobOutIntegrations$=MRt={}));function FZr(t){return JSON.stringify(ut.DetailedJobOutIntegrations$outboundSchema.parse(t))}function kZr(t){return(0,cMe.safeParse)(t,e=>ut.DetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutIntegrations' from JSON")}ut.DetailedJobOutRepositories$inboundSchema=hie.GithubRepositoryOut$inboundSchema;ut.DetailedJobOutRepositories$outboundSchema=hie.GithubRepositoryOut$outboundSchema;var RRt;(function(t){t.inboundSchema=ut.DetailedJobOutRepositories$inboundSchema,t.outboundSchema=ut.DetailedJobOutRepositories$outboundSchema})(RRt||(ut.DetailedJobOutRepositories$=RRt={}));function $Zr(t){return JSON.stringify(ut.DetailedJobOutRepositories$outboundSchema.parse(t))}function BZr(t){return(0,cMe.safeParse)(t,e=>ut.DetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutRepositories' from JSON")}ut.DetailedJobOut$inboundSchema=tr.object({id:tr.string(),auto_start:tr.boolean(),hyperparameters:kRt.TrainingParameters$inboundSchema,model:tr.string(),status:ut.DetailedJobOutStatus$inboundSchema,job_type:tr.string(),created_at:tr.number().int(),modified_at:tr.number().int(),training_files:tr.array(tr.string()),validation_files:tr.nullable(tr.array(tr.string())).optional(),object:tr.literal("job").default("job"),fine_tuned_model:tr.nullable(tr.string()).optional(),suffix:tr.nullable(tr.string()).optional(),integrations:tr.nullable(tr.array(gie.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:tr.nullable(tr.number().int()).optional(),repositories:tr.array(hie.GithubRepositoryOut$inboundSchema).optional(),metadata:tr.nullable(FRt.JobMetadataOut$inboundSchema).optional(),events:tr.array(LRt.EventOut$inboundSchema).optional(),checkpoints:tr.array(NRt.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,DRt.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"}));ut.DetailedJobOut$outboundSchema=tr.object({id:tr.string(),autoStart:tr.boolean(),hyperparameters:kRt.TrainingParameters$outboundSchema,model:tr.string(),status:ut.DetailedJobOutStatus$outboundSchema,jobType:tr.string(),createdAt:tr.number().int(),modifiedAt:tr.number().int(),trainingFiles:tr.array(tr.string()),validationFiles:tr.nullable(tr.array(tr.string())).optional(),object:tr.literal("job").default("job"),fineTunedModel:tr.nullable(tr.string()).optional(),suffix:tr.nullable(tr.string()).optional(),integrations:tr.nullable(tr.array(gie.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:tr.nullable(tr.number().int()).optional(),repositories:tr.array(hie.GithubRepositoryOut$outboundSchema).optional(),metadata:tr.nullable(FRt.JobMetadataOut$outboundSchema).optional(),events:tr.array(LRt.EventOut$outboundSchema).optional(),checkpoints:tr.array(NRt.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,DRt.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 jRt;(function(t){t.inboundSchema=ut.DetailedJobOut$inboundSchema,t.outboundSchema=ut.DetailedJobOut$outboundSchema})(jRt||(ut.DetailedJobOut$=jRt={}));function qZr(t){return JSON.stringify(ut.DetailedJobOut$outboundSchema.parse(t))}function UZr(t){return(0,cMe.safeParse)(t,e=>ut.DetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOut' from JSON")}});var HRt=v(Mo=>{"use strict";var zZr=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]}),HZr=Mo&&Mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VZr=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)&&zZr(e,t,r);return HZr(e,t),e};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.EmbeddingRequest$=Mo.EmbeddingRequest$outboundSchema=Mo.EmbeddingRequest$inboundSchema=Mo.Inputs$=Mo.Inputs$outboundSchema=Mo.Inputs$inboundSchema=void 0;Mo.inputsToJSON=WZr;Mo.inputsFromJSON=KZr;Mo.embeddingRequestToJSON=JZr;Mo.embeddingRequestFromJSON=GZr;var va=VZr(we()),URt=ke(),zRt=me();Mo.Inputs$inboundSchema=va.union([va.string(),va.array(va.string())]);Mo.Inputs$outboundSchema=va.union([va.string(),va.array(va.string())]);var BRt;(function(t){t.inboundSchema=Mo.Inputs$inboundSchema,t.outboundSchema=Mo.Inputs$outboundSchema})(BRt||(Mo.Inputs$=BRt={}));function WZr(t){return JSON.stringify(Mo.Inputs$outboundSchema.parse(t))}function KZr(t){return(0,zRt.safeParse)(t,e=>Mo.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}Mo.EmbeddingRequest$inboundSchema=va.object({input:va.union([va.string(),va.array(va.string())]),model:va.string().default("mistral-embed"),encoding_format:va.nullable(va.string()).optional()}).transform(t=>(0,URt.remap)(t,{input:"inputs",encoding_format:"encodingFormat"}));Mo.EmbeddingRequest$outboundSchema=va.object({inputs:va.union([va.string(),va.array(va.string())]),model:va.string().default("mistral-embed"),encodingFormat:va.nullable(va.string()).optional()}).transform(t=>(0,URt.remap)(t,{inputs:"input",encodingFormat:"encoding_format"}));var qRt;(function(t){t.inboundSchema=Mo.EmbeddingRequest$inboundSchema,t.outboundSchema=Mo.EmbeddingRequest$outboundSchema})(qRt||(Mo.EmbeddingRequest$=qRt={}));function JZr(t){return JSON.stringify(Mo.EmbeddingRequest$outboundSchema.parse(t))}function GZr(t){return(0,zRt.safeParse)(t,e=>Mo.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var dMe=v(_u=>{"use strict";var YZr=_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]}),ZZr=_u&&_u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XZr=_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)&&YZr(e,t,r);return ZZr(e,t),e};Object.defineProperty(_u,"__esModule",{value:!0});_u.EmbeddingResponseData$=_u.EmbeddingResponseData$outboundSchema=_u.EmbeddingResponseData$inboundSchema=void 0;_u.embeddingResponseDataToJSON=eXr;_u.embeddingResponseDataFromJSON=tXr;var YS=XZr(we()),QZr=me();_u.EmbeddingResponseData$inboundSchema=YS.object({object:YS.string().optional(),embedding:YS.array(YS.number()).optional(),index:YS.number().int().optional()});_u.EmbeddingResponseData$outboundSchema=YS.object({object:YS.string().optional(),embedding:YS.array(YS.number()).optional(),index:YS.number().int().optional()});var VRt;(function(t){t.inboundSchema=_u.EmbeddingResponseData$inboundSchema,t.outboundSchema=_u.EmbeddingResponseData$outboundSchema})(VRt||(_u.EmbeddingResponseData$=VRt={}));function eXr(t){return JSON.stringify(_u.EmbeddingResponseData$outboundSchema.parse(t))}function tXr(t){return(0,QZr.safeParse)(t,e=>_u.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var GRt=v(vu=>{"use strict";var rXr=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]}),nXr=vu&&vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oXr=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)&&rXr(e,t,r);return nXr(e,t),e};Object.defineProperty(vu,"__esModule",{value:!0});vu.EmbeddingResponse$=vu.EmbeddingResponse$outboundSchema=vu.EmbeddingResponse$inboundSchema=void 0;vu.embeddingResponseToJSON=aXr;vu.embeddingResponseFromJSON=sXr;var ZS=oXr(we()),iXr=me(),KRt=dMe(),JRt=mq();vu.EmbeddingResponse$inboundSchema=ZS.object({id:ZS.string(),object:ZS.string(),model:ZS.string(),usage:JRt.UsageInfo$inboundSchema,data:ZS.array(KRt.EmbeddingResponseData$inboundSchema)});vu.EmbeddingResponse$outboundSchema=ZS.object({id:ZS.string(),object:ZS.string(),model:ZS.string(),usage:JRt.UsageInfo$outboundSchema,data:ZS.array(KRt.EmbeddingResponseData$outboundSchema)});var WRt;(function(t){t.inboundSchema=vu.EmbeddingResponse$inboundSchema,t.outboundSchema=vu.EmbeddingResponse$outboundSchema})(WRt||(vu.EmbeddingResponse$=WRt={}));function aXr(t){return JSON.stringify(vu.EmbeddingResponse$outboundSchema.parse(t))}function sXr(t){return(0,iXr.safeParse)(t,e=>vu.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var Q8=v(wu=>{"use strict";var uXr=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]}),lXr=wu&&wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cXr=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)&&uXr(e,t,r);return lXr(e,t),e};Object.defineProperty(wu,"__esModule",{value:!0});wu.FilePurpose$=wu.FilePurpose$outboundSchema=wu.FilePurpose$inboundSchema=wu.FilePurpose=void 0;var lD=cXr(we()),dXr=zA();wu.FilePurpose={FineTune:"fine-tune",Batch:"batch"};wu.FilePurpose$inboundSchema=lD.union([lD.nativeEnum(wu.FilePurpose),lD.string().transform(dXr.catchUnrecognizedEnum)]);wu.FilePurpose$outboundSchema=lD.union([lD.nativeEnum(wu.FilePurpose),lD.string().and(lD.custom())]);var YRt;(function(t){t.inboundSchema=wu.FilePurpose$inboundSchema,t.outboundSchema=wu.FilePurpose$outboundSchema})(YRt||(wu.FilePurpose$=YRt={}))});var e6=v(Su=>{"use strict";var fXr=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]}),pXr=Su&&Su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mXr=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)&&fXr(e,t,r);return pXr(e,t),e};Object.defineProperty(Su,"__esModule",{value:!0});Su.SampleType$=Su.SampleType$outboundSchema=Su.SampleType$inboundSchema=Su.SampleType=void 0;var cD=mXr(we()),hXr=zA();Su.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};Su.SampleType$inboundSchema=cD.union([cD.nativeEnum(Su.SampleType),cD.string().transform(hXr.catchUnrecognizedEnum)]);Su.SampleType$outboundSchema=cD.union([cD.nativeEnum(Su.SampleType),cD.string().and(cD.custom())]);var ZRt;(function(t){t.inboundSchema=Su.SampleType$inboundSchema,t.outboundSchema=Su.SampleType$outboundSchema})(ZRt||(Su.SampleType$=ZRt={}))});var t6=v(xu=>{"use strict";var gXr=xu&&xu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yXr=xu&&xu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bXr=xu&&xu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gXr(e,t,r);return yXr(e,t),e};Object.defineProperty(xu,"__esModule",{value:!0});xu.Source$=xu.Source$outboundSchema=xu.Source$inboundSchema=xu.Source=void 0;var dD=bXr(we()),_Xr=zA();xu.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};xu.Source$inboundSchema=dD.union([dD.nativeEnum(xu.Source),dD.string().transform(_Xr.catchUnrecognizedEnum)]);xu.Source$outboundSchema=dD.union([dD.nativeEnum(xu.Source),dD.string().and(dD.custom())]);var XRt;(function(t){t.inboundSchema=xu.Source$inboundSchema,t.outboundSchema=xu.Source$outboundSchema})(XRt||(xu.Source$=XRt={}))});var fMe=v(Cu=>{"use strict";var vXr=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]}),wXr=Cu&&Cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SXr=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)&&vXr(e,t,r);return wXr(e,t),e};Object.defineProperty(Cu,"__esModule",{value:!0});Cu.FileSchema$=Cu.FileSchema$outboundSchema=Cu.FileSchema$inboundSchema=void 0;Cu.fileSchemaToJSON=CXr;Cu.fileSchemaFromJSON=OXr;var Bd=SXr(we()),e1t=ke(),xXr=me(),t1t=Q8(),r1t=e6(),n1t=t6();Cu.FileSchema$inboundSchema=Bd.object({id:Bd.string(),object:Bd.string(),bytes:Bd.number().int(),created_at:Bd.number().int(),filename:Bd.string(),purpose:t1t.FilePurpose$inboundSchema,sample_type:r1t.SampleType$inboundSchema,num_lines:Bd.nullable(Bd.number().int()).optional(),source:n1t.Source$inboundSchema}).transform(t=>(0,e1t.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Cu.FileSchema$outboundSchema=Bd.object({id:Bd.string(),object:Bd.string(),sizeBytes:Bd.number().int(),createdAt:Bd.number().int(),filename:Bd.string(),purpose:t1t.FilePurpose$outboundSchema,sampleType:r1t.SampleType$outboundSchema,numLines:Bd.nullable(Bd.number().int()).optional(),source:n1t.Source$outboundSchema}).transform(t=>(0,e1t.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var QRt;(function(t){t.inboundSchema=Cu.FileSchema$inboundSchema,t.outboundSchema=Cu.FileSchema$outboundSchema})(QRt||(Cu.FileSchema$=QRt={}));function CXr(t){return JSON.stringify(Cu.FileSchema$outboundSchema.parse(t))}function OXr(t){return(0,xXr.safeParse)(t,e=>Cu.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var i1t=v(Ou=>{"use strict";var PXr=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]}),EXr=Ou&&Ou.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TXr=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)&&PXr(e,t,r);return EXr(e,t),e};Object.defineProperty(Ou,"__esModule",{value:!0});Ou.FileSignedURL$=Ou.FileSignedURL$outboundSchema=Ou.FileSignedURL$inboundSchema=void 0;Ou.fileSignedURLToJSON=IXr;Ou.fileSignedURLFromJSON=MXr;var yie=TXr(we()),AXr=me();Ou.FileSignedURL$inboundSchema=yie.object({url:yie.string()});Ou.FileSignedURL$outboundSchema=yie.object({url:yie.string()});var o1t;(function(t){t.inboundSchema=Ou.FileSignedURL$inboundSchema,t.outboundSchema=Ou.FileSignedURL$outboundSchema})(o1t||(Ou.FileSignedURL$=o1t={}));function IXr(t){return JSON.stringify(Ou.FileSignedURL$outboundSchema.parse(t))}function MXr(t){return(0,AXr.safeParse)(t,e=>Ou.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var c1t=v(Ro=>{"use strict";var RXr=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]}),jXr=Ro&&Ro.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DXr=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)&&RXr(e,t,r);return jXr(e,t),e};Object.defineProperty(Ro,"__esModule",{value:!0});Ro.FIMCompletionRequest$=Ro.FIMCompletionRequest$outboundSchema=Ro.FIMCompletionRequest$inboundSchema=Ro.FIMCompletionRequestStop$=Ro.FIMCompletionRequestStop$outboundSchema=Ro.FIMCompletionRequestStop$inboundSchema=void 0;Ro.fimCompletionRequestStopToJSON=NXr;Ro.fimCompletionRequestStopFromJSON=LXr;Ro.fimCompletionRequestToJSON=FXr;Ro.fimCompletionRequestFromJSON=kXr;var fr=DXr(we()),u1t=ke(),l1t=me();Ro.FIMCompletionRequestStop$inboundSchema=fr.union([fr.string(),fr.array(fr.string())]);Ro.FIMCompletionRequestStop$outboundSchema=fr.union([fr.string(),fr.array(fr.string())]);var a1t;(function(t){t.inboundSchema=Ro.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=Ro.FIMCompletionRequestStop$outboundSchema})(a1t||(Ro.FIMCompletionRequestStop$=a1t={}));function NXr(t){return JSON.stringify(Ro.FIMCompletionRequestStop$outboundSchema.parse(t))}function LXr(t){return(0,l1t.safeParse)(t,e=>Ro.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}Ro.FIMCompletionRequest$inboundSchema=fr.object({model:fr.nullable(fr.string()),temperature:fr.nullable(fr.number()).optional(),top_p:fr.number().default(1),max_tokens:fr.nullable(fr.number().int()).optional(),stream:fr.boolean().default(!1),stop:fr.union([fr.string(),fr.array(fr.string())]).optional(),random_seed:fr.nullable(fr.number().int()).optional(),prompt:fr.string(),suffix:fr.nullable(fr.string()).optional(),min_tokens:fr.nullable(fr.number().int()).optional()}).transform(t=>(0,u1t.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));Ro.FIMCompletionRequest$outboundSchema=fr.object({model:fr.nullable(fr.string()),temperature:fr.nullable(fr.number()).optional(),topP:fr.number().default(1),maxTokens:fr.nullable(fr.number().int()).optional(),stream:fr.boolean().default(!1),stop:fr.union([fr.string(),fr.array(fr.string())]).optional(),randomSeed:fr.nullable(fr.number().int()).optional(),prompt:fr.string(),suffix:fr.nullable(fr.string()).optional(),minTokens:fr.nullable(fr.number().int()).optional()}).transform(t=>(0,u1t.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var s1t;(function(t){t.inboundSchema=Ro.FIMCompletionRequest$inboundSchema,t.outboundSchema=Ro.FIMCompletionRequest$outboundSchema})(s1t||(Ro.FIMCompletionRequest$=s1t={}));function FXr(t){return JSON.stringify(Ro.FIMCompletionRequest$outboundSchema.parse(t))}function kXr(t){return(0,l1t.safeParse)(t,e=>Ro.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var m1t=v(Pu=>{"use strict";var $Xr=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]}),BXr=Pu&&Pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qXr=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)&&$Xr(e,t,r);return BXr(e,t),e};Object.defineProperty(Pu,"__esModule",{value:!0});Pu.FIMCompletionResponse$=Pu.FIMCompletionResponse$outboundSchema=Pu.FIMCompletionResponse$inboundSchema=void 0;Pu.fimCompletionResponseToJSON=zXr;Pu.fimCompletionResponseFromJSON=HXr;var ig=qXr(we()),UXr=me(),f1t=Goe(),p1t=mq();Pu.FIMCompletionResponse$inboundSchema=ig.object({id:ig.string(),object:ig.string(),model:ig.string(),usage:p1t.UsageInfo$inboundSchema,created:ig.number().int().optional(),choices:ig.array(f1t.ChatCompletionChoice$inboundSchema).optional()});Pu.FIMCompletionResponse$outboundSchema=ig.object({id:ig.string(),object:ig.string(),model:ig.string(),usage:p1t.UsageInfo$outboundSchema,created:ig.number().int().optional(),choices:ig.array(f1t.ChatCompletionChoice$outboundSchema).optional()});var d1t;(function(t){t.inboundSchema=Pu.FIMCompletionResponse$inboundSchema,t.outboundSchema=Pu.FIMCompletionResponse$outboundSchema})(d1t||(Pu.FIMCompletionResponse$=d1t={}));function zXr(t){return JSON.stringify(Pu.FIMCompletionResponse$outboundSchema.parse(t))}function HXr(t){return(0,UXr.safeParse)(t,e=>Pu.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var _1t=v(jo=>{"use strict";var VXr=jo&&jo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WXr=jo&&jo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KXr=jo&&jo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VXr(e,t,r);return WXr(e,t),e};Object.defineProperty(jo,"__esModule",{value:!0});jo.FIMCompletionStreamRequest$=jo.FIMCompletionStreamRequest$outboundSchema=jo.FIMCompletionStreamRequest$inboundSchema=jo.FIMCompletionStreamRequestStop$=jo.FIMCompletionStreamRequestStop$outboundSchema=jo.FIMCompletionStreamRequestStop$inboundSchema=void 0;jo.fimCompletionStreamRequestStopToJSON=JXr;jo.fimCompletionStreamRequestStopFromJSON=GXr;jo.fimCompletionStreamRequestToJSON=YXr;jo.fimCompletionStreamRequestFromJSON=ZXr;var pr=KXr(we()),y1t=ke(),b1t=me();jo.FIMCompletionStreamRequestStop$inboundSchema=pr.union([pr.string(),pr.array(pr.string())]);jo.FIMCompletionStreamRequestStop$outboundSchema=pr.union([pr.string(),pr.array(pr.string())]);var h1t;(function(t){t.inboundSchema=jo.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=jo.FIMCompletionStreamRequestStop$outboundSchema})(h1t||(jo.FIMCompletionStreamRequestStop$=h1t={}));function JXr(t){return JSON.stringify(jo.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function GXr(t){return(0,b1t.safeParse)(t,e=>jo.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}jo.FIMCompletionStreamRequest$inboundSchema=pr.object({model:pr.nullable(pr.string()),temperature:pr.nullable(pr.number()).optional(),top_p:pr.number().default(1),max_tokens:pr.nullable(pr.number().int()).optional(),stream:pr.boolean().default(!0),stop:pr.union([pr.string(),pr.array(pr.string())]).optional(),random_seed:pr.nullable(pr.number().int()).optional(),prompt:pr.string(),suffix:pr.nullable(pr.string()).optional(),min_tokens:pr.nullable(pr.number().int()).optional()}).transform(t=>(0,y1t.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));jo.FIMCompletionStreamRequest$outboundSchema=pr.object({model:pr.nullable(pr.string()),temperature:pr.nullable(pr.number()).optional(),topP:pr.number().default(1),maxTokens:pr.nullable(pr.number().int()).optional(),stream:pr.boolean().default(!0),stop:pr.union([pr.string(),pr.array(pr.string())]).optional(),randomSeed:pr.nullable(pr.number().int()).optional(),prompt:pr.string(),suffix:pr.nullable(pr.string()).optional(),minTokens:pr.nullable(pr.number().int()).optional()}).transform(t=>(0,y1t.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var g1t;(function(t){t.inboundSchema=jo.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=jo.FIMCompletionStreamRequest$outboundSchema})(g1t||(jo.FIMCompletionStreamRequest$=g1t={}));function YXr(t){return JSON.stringify(jo.FIMCompletionStreamRequest$outboundSchema.parse(t))}function ZXr(t){return(0,b1t.safeParse)(t,e=>jo.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var pMe=v(Eu=>{"use strict";var XXr=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]}),QXr=Eu&&Eu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eQr=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)&&XXr(e,t,r);return QXr(e,t),e};Object.defineProperty(Eu,"__esModule",{value:!0});Eu.FTModelCapabilitiesOut$=Eu.FTModelCapabilitiesOut$outboundSchema=Eu.FTModelCapabilitiesOut$inboundSchema=void 0;Eu.ftModelCapabilitiesOutToJSON=rQr;Eu.ftModelCapabilitiesOutFromJSON=nQr;var XS=eQr(we()),w1t=ke(),tQr=me();Eu.FTModelCapabilitiesOut$inboundSchema=XS.object({completion_chat:XS.boolean().default(!0),completion_fim:XS.boolean().default(!1),function_calling:XS.boolean().default(!1),fine_tuning:XS.boolean().default(!1)}).transform(t=>(0,w1t.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));Eu.FTModelCapabilitiesOut$outboundSchema=XS.object({completionChat:XS.boolean().default(!0),completionFim:XS.boolean().default(!1),functionCalling:XS.boolean().default(!1),fineTuning:XS.boolean().default(!1)}).transform(t=>(0,w1t.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var v1t;(function(t){t.inboundSchema=Eu.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=Eu.FTModelCapabilitiesOut$outboundSchema})(v1t||(Eu.FTModelCapabilitiesOut$=v1t={}));function rQr(t){return JSON.stringify(Eu.FTModelCapabilitiesOut$outboundSchema.parse(t))}function nQr(t){return(0,tQr.safeParse)(t,e=>Eu.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var mMe=v(Do=>{"use strict";var oQr=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]}),iQr=Do&&Do.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aQr=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)&&oQr(e,t,r);return iQr(e,t),e};Object.defineProperty(Do,"__esModule",{value:!0});Do.FTModelCard$=Do.FTModelCard$outboundSchema=Do.FTModelCard$inboundSchema=Do.FTModelCardType$=Do.FTModelCardType$outboundSchema=Do.FTModelCardType$inboundSchema=Do.FTModelCardType=void 0;Do.ftModelCardToJSON=uQr;Do.ftModelCardFromJSON=lQr;var en=aQr(we()),C1t=ke(),sQr=me(),O1t=Koe();Do.FTModelCardType={FineTuned:"fine-tuned"};Do.FTModelCardType$inboundSchema=en.nativeEnum(Do.FTModelCardType);Do.FTModelCardType$outboundSchema=Do.FTModelCardType$inboundSchema;var S1t;(function(t){t.inboundSchema=Do.FTModelCardType$inboundSchema,t.outboundSchema=Do.FTModelCardType$outboundSchema})(S1t||(Do.FTModelCardType$=S1t={}));Do.FTModelCard$inboundSchema=en.object({id:en.string(),object:en.string().default("model"),created:en.number().int().optional(),owned_by:en.string().default("mistralai"),capabilities:O1t.ModelCapabilities$inboundSchema,name:en.nullable(en.string()).optional(),description:en.nullable(en.string()).optional(),max_context_length:en.number().int().default(32768),aliases:en.array(en.string()).optional(),deprecation:en.nullable(en.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:en.nullable(en.number()).optional(),type:en.literal("fine-tuned").default("fine-tuned"),job:en.string(),root:en.string(),archived:en.boolean().default(!1)}).transform(t=>(0,C1t.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Do.FTModelCard$outboundSchema=en.object({id:en.string(),object:en.string().default("model"),created:en.number().int().optional(),ownedBy:en.string().default("mistralai"),capabilities:O1t.ModelCapabilities$outboundSchema,name:en.nullable(en.string()).optional(),description:en.nullable(en.string()).optional(),maxContextLength:en.number().int().default(32768),aliases:en.array(en.string()).optional(),deprecation:en.nullable(en.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:en.nullable(en.number()).optional(),type:en.literal("fine-tuned").default("fine-tuned"),job:en.string(),root:en.string(),archived:en.boolean().default(!1)}).transform(t=>(0,C1t.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var x1t;(function(t){t.inboundSchema=Do.FTModelCard$inboundSchema,t.outboundSchema=Do.FTModelCard$outboundSchema})(x1t||(Do.FTModelCard$=x1t={}));function uQr(t){return JSON.stringify(Do.FTModelCard$outboundSchema.parse(t))}function lQr(t){return(0,sQr.safeParse)(t,e=>Do.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var I1t=v(No=>{"use strict";var cQr=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]}),dQr=No&&No.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fQr=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)&&cQr(e,t,r);return dQr(e,t),e};Object.defineProperty(No,"__esModule",{value:!0});No.FTModelOut$=No.FTModelOut$outboundSchema=No.FTModelOut$inboundSchema=No.FTModelOutObject$=No.FTModelOutObject$outboundSchema=No.FTModelOutObject$inboundSchema=No.FTModelOutObject=void 0;No.ftModelOutToJSON=mQr;No.ftModelOutFromJSON=hQr;var Xo=fQr(we()),T1t=ke(),pQr=me(),A1t=pMe();No.FTModelOutObject={Model:"model"};No.FTModelOutObject$inboundSchema=Xo.nativeEnum(No.FTModelOutObject);No.FTModelOutObject$outboundSchema=No.FTModelOutObject$inboundSchema;var P1t;(function(t){t.inboundSchema=No.FTModelOutObject$inboundSchema,t.outboundSchema=No.FTModelOutObject$outboundSchema})(P1t||(No.FTModelOutObject$=P1t={}));No.FTModelOut$inboundSchema=Xo.object({id:Xo.string(),object:Xo.literal("model").default("model"),created:Xo.number().int(),owned_by:Xo.string(),root:Xo.string(),archived:Xo.boolean(),name:Xo.nullable(Xo.string()).optional(),description:Xo.nullable(Xo.string()).optional(),capabilities:A1t.FTModelCapabilitiesOut$inboundSchema,max_context_length:Xo.number().int().default(32768),aliases:Xo.array(Xo.string()).optional(),job:Xo.string()}).transform(t=>(0,T1t.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength"}));No.FTModelOut$outboundSchema=Xo.object({id:Xo.string(),object:Xo.literal("model").default("model"),created:Xo.number().int(),ownedBy:Xo.string(),root:Xo.string(),archived:Xo.boolean(),name:Xo.nullable(Xo.string()).optional(),description:Xo.nullable(Xo.string()).optional(),capabilities:A1t.FTModelCapabilitiesOut$outboundSchema,maxContextLength:Xo.number().int().default(32768),aliases:Xo.array(Xo.string()).optional(),job:Xo.string()}).transform(t=>(0,T1t.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length"}));var E1t;(function(t){t.inboundSchema=No.FTModelOut$inboundSchema,t.outboundSchema=No.FTModelOut$outboundSchema})(E1t||(No.FTModelOut$=E1t={}));function mQr(t){return JSON.stringify(No.FTModelOut$outboundSchema.parse(t))}function hQr(t){return(0,pQr.safeParse)(t,e=>No.FTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelOut' from JSON")}});var hMe=v(Lo=>{"use strict";var gQr=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]}),yQr=Lo&&Lo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bQr=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)&&gQr(e,t,r);return yQr(e,t),e};Object.defineProperty(Lo,"__esModule",{value:!0});Lo.GithubRepositoryIn$=Lo.GithubRepositoryIn$outboundSchema=Lo.GithubRepositoryIn$inboundSchema=Lo.GithubRepositoryInType$=Lo.GithubRepositoryInType$outboundSchema=Lo.GithubRepositoryInType$inboundSchema=Lo.GithubRepositoryInType=void 0;Lo.githubRepositoryInToJSON=vQr;Lo.githubRepositoryInFromJSON=wQr;var zc=bQr(we()),_Qr=me();Lo.GithubRepositoryInType={Github:"github"};Lo.GithubRepositoryInType$inboundSchema=zc.nativeEnum(Lo.GithubRepositoryInType);Lo.GithubRepositoryInType$outboundSchema=Lo.GithubRepositoryInType$inboundSchema;var M1t;(function(t){t.inboundSchema=Lo.GithubRepositoryInType$inboundSchema,t.outboundSchema=Lo.GithubRepositoryInType$outboundSchema})(M1t||(Lo.GithubRepositoryInType$=M1t={}));Lo.GithubRepositoryIn$inboundSchema=zc.object({type:zc.literal("github").default("github"),name:zc.string(),owner:zc.string(),ref:zc.nullable(zc.string()).optional(),weight:zc.number().default(1),token:zc.string()});Lo.GithubRepositoryIn$outboundSchema=zc.object({type:zc.literal("github").default("github"),name:zc.string(),owner:zc.string(),ref:zc.nullable(zc.string()).optional(),weight:zc.number().default(1),token:zc.string()});var R1t;(function(t){t.inboundSchema=Lo.GithubRepositoryIn$inboundSchema,t.outboundSchema=Lo.GithubRepositoryIn$outboundSchema})(R1t||(Lo.GithubRepositoryIn$=R1t={}));function vQr(t){return JSON.stringify(Lo.GithubRepositoryIn$outboundSchema.parse(t))}function wQr(t){return(0,_Qr.safeParse)(t,e=>Lo.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var gMe=v(Tu=>{"use strict";var SQr=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]}),xQr=Tu&&Tu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CQr=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)&&SQr(e,t,r);return xQr(e,t),e};Object.defineProperty(Tu,"__esModule",{value:!0});Tu.TrainingFile$=Tu.TrainingFile$outboundSchema=Tu.TrainingFile$inboundSchema=void 0;Tu.trainingFileToJSON=PQr;Tu.trainingFileFromJSON=EQr;var gq=CQr(we()),D1t=ke(),OQr=me();Tu.TrainingFile$inboundSchema=gq.object({file_id:gq.string(),weight:gq.number().default(1)}).transform(t=>(0,D1t.remap)(t,{file_id:"fileId"}));Tu.TrainingFile$outboundSchema=gq.object({fileId:gq.string(),weight:gq.number().default(1)}).transform(t=>(0,D1t.remap)(t,{fileId:"file_id"}));var j1t;(function(t){t.inboundSchema=Tu.TrainingFile$inboundSchema,t.outboundSchema=Tu.TrainingFile$outboundSchema})(j1t||(Tu.TrainingFile$=j1t={}));function PQr(t){return JSON.stringify(Tu.TrainingFile$outboundSchema.parse(t))}function EQr(t){return(0,OQr.safeParse)(t,e=>Tu.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var yMe=v(Au=>{"use strict";var TQr=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]}),AQr=Au&&Au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IQr=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)&&TQr(e,t,r);return AQr(e,t),e};Object.defineProperty(Au,"__esModule",{value:!0});Au.TrainingParametersIn$=Au.TrainingParametersIn$outboundSchema=Au.TrainingParametersIn$inboundSchema=void 0;Au.trainingParametersInToJSON=RQr;Au.trainingParametersInFromJSON=jQr;var wi=IQr(we()),L1t=ke(),MQr=me();Au.TrainingParametersIn$inboundSchema=wi.object({training_steps:wi.nullable(wi.number().int()).optional(),learning_rate:wi.number().default(1e-4),weight_decay:wi.nullable(wi.number()).optional(),warmup_fraction:wi.nullable(wi.number()).optional(),epochs:wi.nullable(wi.number()).optional(),fim_ratio:wi.nullable(wi.number()).optional(),seq_len:wi.nullable(wi.number().int()).optional()}).transform(t=>(0,L1t.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));Au.TrainingParametersIn$outboundSchema=wi.object({trainingSteps:wi.nullable(wi.number().int()).optional(),learningRate:wi.number().default(1e-4),weightDecay:wi.nullable(wi.number()).optional(),warmupFraction:wi.nullable(wi.number()).optional(),epochs:wi.nullable(wi.number()).optional(),fimRatio:wi.nullable(wi.number()).optional(),seqLen:wi.nullable(wi.number().int()).optional()}).transform(t=>(0,L1t.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var N1t;(function(t){t.inboundSchema=Au.TrainingParametersIn$inboundSchema,t.outboundSchema=Au.TrainingParametersIn$outboundSchema})(N1t||(Au.TrainingParametersIn$=N1t={}));function RQr(t){return JSON.stringify(Au.TrainingParametersIn$outboundSchema.parse(t))}function jQr(t){return(0,MQr.safeParse)(t,e=>Au.TrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParametersIn' from JSON")}});var bMe=v(Fo=>{"use strict";var DQr=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]}),NQr=Fo&&Fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LQr=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)&&DQr(e,t,r);return NQr(e,t),e};Object.defineProperty(Fo,"__esModule",{value:!0});Fo.WandbIntegration$=Fo.WandbIntegration$outboundSchema=Fo.WandbIntegration$inboundSchema=Fo.WandbIntegrationType$=Fo.WandbIntegrationType$outboundSchema=Fo.WandbIntegrationType$inboundSchema=Fo.WandbIntegrationType=void 0;Fo.wandbIntegrationToJSON=kQr;Fo.wandbIntegrationFromJSON=$Qr;var Hc=LQr(we()),$1t=ke(),FQr=me();Fo.WandbIntegrationType={Wandb:"wandb"};Fo.WandbIntegrationType$inboundSchema=Hc.nativeEnum(Fo.WandbIntegrationType);Fo.WandbIntegrationType$outboundSchema=Fo.WandbIntegrationType$inboundSchema;var F1t;(function(t){t.inboundSchema=Fo.WandbIntegrationType$inboundSchema,t.outboundSchema=Fo.WandbIntegrationType$outboundSchema})(F1t||(Fo.WandbIntegrationType$=F1t={}));Fo.WandbIntegration$inboundSchema=Hc.object({type:Hc.literal("wandb").default("wandb"),project:Hc.string(),name:Hc.nullable(Hc.string()).optional(),api_key:Hc.string(),run_name:Hc.nullable(Hc.string()).optional()}).transform(t=>(0,$1t.remap)(t,{api_key:"apiKey",run_name:"runName"}));Fo.WandbIntegration$outboundSchema=Hc.object({type:Hc.literal("wandb").default("wandb"),project:Hc.string(),name:Hc.nullable(Hc.string()).optional(),apiKey:Hc.string(),runName:Hc.nullable(Hc.string()).optional()}).transform(t=>(0,$1t.remap)(t,{apiKey:"api_key",runName:"run_name"}));var k1t;(function(t){t.inboundSchema=Fo.WandbIntegration$inboundSchema,t.outboundSchema=Fo.WandbIntegration$outboundSchema})(k1t||(Fo.WandbIntegration$=k1t={}));function kQr(t){return JSON.stringify(Fo.WandbIntegration$outboundSchema.parse(t))}function $Qr(t){return(0,FQr.safeParse)(t,e=>Fo.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var W1t=v(Rr=>{"use strict";var BQr=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]}),qQr=Rr&&Rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UQr=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)&&BQr(e,t,r);return qQr(e,t),e};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.JobIn$=Rr.JobIn$outboundSchema=Rr.JobIn$inboundSchema=Rr.JobInRepositories$=Rr.JobInRepositories$outboundSchema=Rr.JobInRepositories$inboundSchema=Rr.JobInIntegrations$=Rr.JobInIntegrations$outboundSchema=Rr.JobInIntegrations$inboundSchema=void 0;Rr.jobInIntegrationsToJSON=zQr;Rr.jobInIntegrationsFromJSON=HQr;Rr.jobInRepositoriesToJSON=VQr;Rr.jobInRepositoriesFromJSON=WQr;Rr.jobInToJSON=KQr;Rr.jobInFromJSON=JQr;var wa=UQr(we()),z1t=ke(),_Me=me(),bie=hMe(),H1t=gMe(),V1t=yMe(),_ie=bMe();Rr.JobInIntegrations$inboundSchema=_ie.WandbIntegration$inboundSchema;Rr.JobInIntegrations$outboundSchema=_ie.WandbIntegration$outboundSchema;var B1t;(function(t){t.inboundSchema=Rr.JobInIntegrations$inboundSchema,t.outboundSchema=Rr.JobInIntegrations$outboundSchema})(B1t||(Rr.JobInIntegrations$=B1t={}));function zQr(t){return JSON.stringify(Rr.JobInIntegrations$outboundSchema.parse(t))}function HQr(t){return(0,_Me.safeParse)(t,e=>Rr.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}Rr.JobInRepositories$inboundSchema=bie.GithubRepositoryIn$inboundSchema;Rr.JobInRepositories$outboundSchema=bie.GithubRepositoryIn$outboundSchema;var q1t;(function(t){t.inboundSchema=Rr.JobInRepositories$inboundSchema,t.outboundSchema=Rr.JobInRepositories$outboundSchema})(q1t||(Rr.JobInRepositories$=q1t={}));function VQr(t){return JSON.stringify(Rr.JobInRepositories$outboundSchema.parse(t))}function WQr(t){return(0,_Me.safeParse)(t,e=>Rr.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}Rr.JobIn$inboundSchema=wa.object({model:wa.string(),training_files:wa.array(H1t.TrainingFile$inboundSchema).optional(),validation_files:wa.nullable(wa.array(wa.string())).optional(),hyperparameters:V1t.TrainingParametersIn$inboundSchema,suffix:wa.nullable(wa.string()).optional(),integrations:wa.nullable(wa.array(_ie.WandbIntegration$inboundSchema)).optional(),repositories:wa.array(bie.GithubRepositoryIn$inboundSchema).optional(),auto_start:wa.boolean().optional()}).transform(t=>(0,z1t.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart"}));Rr.JobIn$outboundSchema=wa.object({model:wa.string(),trainingFiles:wa.array(H1t.TrainingFile$outboundSchema).optional(),validationFiles:wa.nullable(wa.array(wa.string())).optional(),hyperparameters:V1t.TrainingParametersIn$outboundSchema,suffix:wa.nullable(wa.string()).optional(),integrations:wa.nullable(wa.array(_ie.WandbIntegration$outboundSchema)).optional(),repositories:wa.array(bie.GithubRepositoryIn$outboundSchema).optional(),autoStart:wa.boolean().optional()}).transform(t=>(0,z1t.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start"}));var U1t;(function(t){t.inboundSchema=Rr.JobIn$inboundSchema,t.outboundSchema=Rr.JobIn$outboundSchema})(U1t||(Rr.JobIn$=U1t={}));function KQr(t){return JSON.stringify(Rr.JobIn$outboundSchema.parse(t))}function JQr(t){return(0,_Me.safeParse)(t,e=>Rr.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var wMe=v(lt=>{"use strict";var GQr=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]}),YQr=lt&&lt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZQr=lt&&lt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GQr(e,t,r);return YQr(e,t),e};Object.defineProperty(lt,"__esModule",{value:!0});lt.JobOut$=lt.JobOut$outboundSchema=lt.JobOut$inboundSchema=lt.Repositories$=lt.Repositories$outboundSchema=lt.Repositories$inboundSchema=lt.Integrations$=lt.Integrations$outboundSchema=lt.Integrations$inboundSchema=lt.ObjectT$=lt.ObjectT$outboundSchema=lt.ObjectT$inboundSchema=lt.Status$=lt.Status$outboundSchema=lt.Status$inboundSchema=lt.ObjectT=lt.Status=void 0;lt.integrationsToJSON=XQr;lt.integrationsFromJSON=QQr;lt.repositoriesToJSON=een;lt.repositoriesFromJSON=ten;lt.jobOutToJSON=ren;lt.jobOutFromJSON=nen;var mr=ZQr(we()),X1t=ke(),vMe=me(),vie=die(),Q1t=fie(),ejt=pie(),wie=mie();lt.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};lt.ObjectT={Job:"job"};lt.Status$inboundSchema=mr.nativeEnum(lt.Status);lt.Status$outboundSchema=lt.Status$inboundSchema;var K1t;(function(t){t.inboundSchema=lt.Status$inboundSchema,t.outboundSchema=lt.Status$outboundSchema})(K1t||(lt.Status$=K1t={}));lt.ObjectT$inboundSchema=mr.nativeEnum(lt.ObjectT);lt.ObjectT$outboundSchema=lt.ObjectT$inboundSchema;var J1t;(function(t){t.inboundSchema=lt.ObjectT$inboundSchema,t.outboundSchema=lt.ObjectT$outboundSchema})(J1t||(lt.ObjectT$=J1t={}));lt.Integrations$inboundSchema=wie.WandbIntegrationOut$inboundSchema;lt.Integrations$outboundSchema=wie.WandbIntegrationOut$outboundSchema;var G1t;(function(t){t.inboundSchema=lt.Integrations$inboundSchema,t.outboundSchema=lt.Integrations$outboundSchema})(G1t||(lt.Integrations$=G1t={}));function XQr(t){return JSON.stringify(lt.Integrations$outboundSchema.parse(t))}function QQr(t){return(0,vMe.safeParse)(t,e=>lt.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}lt.Repositories$inboundSchema=vie.GithubRepositoryOut$inboundSchema;lt.Repositories$outboundSchema=vie.GithubRepositoryOut$outboundSchema;var Y1t;(function(t){t.inboundSchema=lt.Repositories$inboundSchema,t.outboundSchema=lt.Repositories$outboundSchema})(Y1t||(lt.Repositories$=Y1t={}));function een(t){return JSON.stringify(lt.Repositories$outboundSchema.parse(t))}function ten(t){return(0,vMe.safeParse)(t,e=>lt.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}lt.JobOut$inboundSchema=mr.object({id:mr.string(),auto_start:mr.boolean(),hyperparameters:ejt.TrainingParameters$inboundSchema,model:mr.string(),status:lt.Status$inboundSchema,job_type:mr.string(),created_at:mr.number().int(),modified_at:mr.number().int(),training_files:mr.array(mr.string()),validation_files:mr.nullable(mr.array(mr.string())).optional(),object:mr.literal("job").default("job"),fine_tuned_model:mr.nullable(mr.string()).optional(),suffix:mr.nullable(mr.string()).optional(),integrations:mr.nullable(mr.array(wie.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:mr.nullable(mr.number().int()).optional(),repositories:mr.array(vie.GithubRepositoryOut$inboundSchema).optional(),metadata:mr.nullable(Q1t.JobMetadataOut$inboundSchema).optional()}).transform(t=>(0,X1t.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"}));lt.JobOut$outboundSchema=mr.object({id:mr.string(),autoStart:mr.boolean(),hyperparameters:ejt.TrainingParameters$outboundSchema,model:mr.string(),status:lt.Status$outboundSchema,jobType:mr.string(),createdAt:mr.number().int(),modifiedAt:mr.number().int(),trainingFiles:mr.array(mr.string()),validationFiles:mr.nullable(mr.array(mr.string())).optional(),object:mr.literal("job").default("job"),fineTunedModel:mr.nullable(mr.string()).optional(),suffix:mr.nullable(mr.string()).optional(),integrations:mr.nullable(mr.array(wie.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:mr.nullable(mr.number().int()).optional(),repositories:mr.array(vie.GithubRepositoryOut$outboundSchema).optional(),metadata:mr.nullable(Q1t.JobMetadataOut$outboundSchema).optional()}).transform(t=>(0,X1t.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 Z1t;(function(t){t.inboundSchema=lt.JobOut$inboundSchema,t.outboundSchema=lt.JobOut$outboundSchema})(Z1t||(lt.JobOut$=Z1t={}));function ren(t){return JSON.stringify(lt.JobOut$outboundSchema.parse(t))}function nen(t){return(0,vMe.safeParse)(t,e=>lt.JobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobOut' from JSON")}});var ojt=v(ko=>{"use strict";var oen=ko&&ko.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ien=ko&&ko.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aen=ko&&ko.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oen(e,t,r);return ien(e,t),e};Object.defineProperty(ko,"__esModule",{value:!0});ko.JobsOut$=ko.JobsOut$outboundSchema=ko.JobsOut$inboundSchema=ko.JobsOutObject$=ko.JobsOutObject$outboundSchema=ko.JobsOutObject$inboundSchema=ko.JobsOutObject=void 0;ko.jobsOutToJSON=uen;ko.jobsOutFromJSON=len;var EO=aen(we()),sen=me(),njt=wMe();ko.JobsOutObject={List:"list"};ko.JobsOutObject$inboundSchema=EO.nativeEnum(ko.JobsOutObject);ko.JobsOutObject$outboundSchema=ko.JobsOutObject$inboundSchema;var tjt;(function(t){t.inboundSchema=ko.JobsOutObject$inboundSchema,t.outboundSchema=ko.JobsOutObject$outboundSchema})(tjt||(ko.JobsOutObject$=tjt={}));ko.JobsOut$inboundSchema=EO.object({data:EO.array(njt.JobOut$inboundSchema).optional(),object:EO.literal("list").default("list"),total:EO.number().int()});ko.JobsOut$outboundSchema=EO.object({data:EO.array(njt.JobOut$outboundSchema).optional(),object:EO.literal("list").default("list"),total:EO.number().int()});var rjt;(function(t){t.inboundSchema=ko.JobsOut$inboundSchema,t.outboundSchema=ko.JobsOut$outboundSchema})(rjt||(ko.JobsOut$=rjt={}));function uen(t){return JSON.stringify(ko.JobsOut$outboundSchema.parse(t))}function len(t){return(0,sen.safeParse)(t,e=>ko.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var ujt=v($o=>{"use strict";var cen=$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]}),den=$o&&$o.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fen=$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)&&cen(e,t,r);return den(e,t),e};Object.defineProperty($o,"__esModule",{value:!0});$o.LegacyJobMetadataOut$=$o.LegacyJobMetadataOut$outboundSchema=$o.LegacyJobMetadataOut$inboundSchema=$o.LegacyJobMetadataOutObject$=$o.LegacyJobMetadataOutObject$outboundSchema=$o.LegacyJobMetadataOutObject$inboundSchema=$o.LegacyJobMetadataOutObject=void 0;$o.legacyJobMetadataOutToJSON=men;$o.legacyJobMetadataOutFromJSON=hen;var Ar=fen(we()),sjt=ke(),pen=me();$o.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};$o.LegacyJobMetadataOutObject$inboundSchema=Ar.nativeEnum($o.LegacyJobMetadataOutObject);$o.LegacyJobMetadataOutObject$outboundSchema=$o.LegacyJobMetadataOutObject$inboundSchema;var ijt;(function(t){t.inboundSchema=$o.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=$o.LegacyJobMetadataOutObject$outboundSchema})(ijt||($o.LegacyJobMetadataOutObject$=ijt={}));$o.LegacyJobMetadataOut$inboundSchema=Ar.object({expected_duration_seconds:Ar.nullable(Ar.number().int()).optional(),cost:Ar.nullable(Ar.number()).optional(),cost_currency:Ar.nullable(Ar.string()).optional(),train_tokens_per_step:Ar.nullable(Ar.number().int()).optional(),train_tokens:Ar.nullable(Ar.number().int()).optional(),data_tokens:Ar.nullable(Ar.number().int()).optional(),estimated_start_time:Ar.nullable(Ar.number().int()).optional(),deprecated:Ar.boolean().default(!0),details:Ar.string(),epochs:Ar.nullable(Ar.number()).optional(),training_steps:Ar.nullable(Ar.number().int()).optional(),object:Ar.literal("job.metadata").default("job.metadata")}).transform(t=>(0,sjt.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"}));$o.LegacyJobMetadataOut$outboundSchema=Ar.object({expectedDurationSeconds:Ar.nullable(Ar.number().int()).optional(),cost:Ar.nullable(Ar.number()).optional(),costCurrency:Ar.nullable(Ar.string()).optional(),trainTokensPerStep:Ar.nullable(Ar.number().int()).optional(),trainTokens:Ar.nullable(Ar.number().int()).optional(),dataTokens:Ar.nullable(Ar.number().int()).optional(),estimatedStartTime:Ar.nullable(Ar.number().int()).optional(),deprecated:Ar.boolean().default(!0),details:Ar.string(),epochs:Ar.nullable(Ar.number()).optional(),trainingSteps:Ar.nullable(Ar.number().int()).optional(),object:Ar.literal("job.metadata").default("job.metadata")}).transform(t=>(0,sjt.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 ajt;(function(t){t.inboundSchema=$o.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=$o.LegacyJobMetadataOut$outboundSchema})(ajt||($o.LegacyJobMetadataOut$=ajt={}));function men(t){return JSON.stringify($o.LegacyJobMetadataOut$outboundSchema.parse(t))}function hen(t){return(0,pen.safeParse)(t,e=>$o.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var djt=v(Iu=>{"use strict";var gen=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]}),yen=Iu&&Iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ben=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)&&gen(e,t,r);return yen(e,t),e};Object.defineProperty(Iu,"__esModule",{value:!0});Iu.ListFilesOut$=Iu.ListFilesOut$outboundSchema=Iu.ListFilesOut$inboundSchema=void 0;Iu.listFilesOutToJSON=ven;Iu.listFilesOutFromJSON=wen;var GA=ben(we()),_en=me(),cjt=fMe();Iu.ListFilesOut$inboundSchema=GA.object({data:GA.array(cjt.FileSchema$inboundSchema),object:GA.string(),total:GA.number().int()});Iu.ListFilesOut$outboundSchema=GA.object({data:GA.array(cjt.FileSchema$outboundSchema),object:GA.string(),total:GA.number().int()});var ljt;(function(t){t.inboundSchema=Iu.ListFilesOut$inboundSchema,t.outboundSchema=Iu.ListFilesOut$outboundSchema})(ljt||(Iu.ListFilesOut$=ljt={}));function ven(t){return JSON.stringify(Iu.ListFilesOut$outboundSchema.parse(t))}function wen(t){return(0,_en.safeParse)(t,e=>Iu.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var hjt=v(Bo=>{"use strict";var Sen=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]}),xen=Bo&&Bo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cen=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)&&Sen(e,t,r);return xen(e,t),e};Object.defineProperty(Bo,"__esModule",{value:!0});Bo.ModelList$=Bo.ModelList$outboundSchema=Bo.ModelList$inboundSchema=Bo.Data$=Bo.Data$outboundSchema=Bo.Data$inboundSchema=void 0;Bo.dataToJSON=Oen;Bo.dataFromJSON=Pen;Bo.modelListToJSON=Een;Bo.modelListFromJSON=Ten;var ki=Cen(we()),mjt=me(),Sie=QIe(),xie=mMe();Bo.Data$inboundSchema=ki.union([Sie.BaseModelCard$inboundSchema.and(ki.object({type:ki.literal("base")}).transform(t=>({type:t.type}))),xie.FTModelCard$inboundSchema.and(ki.object({type:ki.literal("fine-tuned")}).transform(t=>({type:t.type})))]);Bo.Data$outboundSchema=ki.union([Sie.BaseModelCard$outboundSchema.and(ki.object({type:ki.literal("base")}).transform(t=>({type:t.type}))),xie.FTModelCard$outboundSchema.and(ki.object({type:ki.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var fjt;(function(t){t.inboundSchema=Bo.Data$inboundSchema,t.outboundSchema=Bo.Data$outboundSchema})(fjt||(Bo.Data$=fjt={}));function Oen(t){return JSON.stringify(Bo.Data$outboundSchema.parse(t))}function Pen(t){return(0,mjt.safeParse)(t,e=>Bo.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}Bo.ModelList$inboundSchema=ki.object({object:ki.string().default("list"),data:ki.array(ki.union([Sie.BaseModelCard$inboundSchema.and(ki.object({type:ki.literal("base")}).transform(t=>({type:t.type}))),xie.FTModelCard$inboundSchema.and(ki.object({type:ki.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});Bo.ModelList$outboundSchema=ki.object({object:ki.string().default("list"),data:ki.array(ki.union([Sie.BaseModelCard$outboundSchema.and(ki.object({type:ki.literal("base")}).transform(t=>({type:t.type}))),xie.FTModelCard$outboundSchema.and(ki.object({type:ki.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});var pjt;(function(t){t.inboundSchema=Bo.ModelList$inboundSchema,t.outboundSchema=Bo.ModelList$outboundSchema})(pjt||(Bo.ModelList$=pjt={}));function Een(t){return JSON.stringify(Bo.ModelList$outboundSchema.parse(t))}function Ten(t){return(0,mjt.safeParse)(t,e=>Bo.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var wjt=v(Mu=>{"use strict";var Aen=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]}),Ien=Mu&&Mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Men=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)&&Aen(e,t,r);return Ien(e,t),e};Object.defineProperty(Mu,"__esModule",{value:!0});Mu.RetrieveFileOut$=Mu.RetrieveFileOut$outboundSchema=Mu.RetrieveFileOut$inboundSchema=void 0;Mu.retrieveFileOutToJSON=jen;Mu.retrieveFileOutFromJSON=Den;var ec=Men(we()),yjt=ke(),Ren=me(),bjt=Q8(),_jt=e6(),vjt=t6();Mu.RetrieveFileOut$inboundSchema=ec.object({id:ec.string(),object:ec.string(),bytes:ec.number().int(),created_at:ec.number().int(),filename:ec.string(),purpose:bjt.FilePurpose$inboundSchema,sample_type:_jt.SampleType$inboundSchema,num_lines:ec.nullable(ec.number().int()).optional(),source:vjt.Source$inboundSchema,deleted:ec.boolean()}).transform(t=>(0,yjt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Mu.RetrieveFileOut$outboundSchema=ec.object({id:ec.string(),object:ec.string(),sizeBytes:ec.number().int(),createdAt:ec.number().int(),filename:ec.string(),purpose:bjt.FilePurpose$outboundSchema,sampleType:_jt.SampleType$outboundSchema,numLines:ec.nullable(ec.number().int()).optional(),source:vjt.Source$outboundSchema,deleted:ec.boolean()}).transform(t=>(0,yjt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var gjt;(function(t){t.inboundSchema=Mu.RetrieveFileOut$inboundSchema,t.outboundSchema=Mu.RetrieveFileOut$outboundSchema})(gjt||(Mu.RetrieveFileOut$=gjt={}));function jen(t){return JSON.stringify(Mu.RetrieveFileOut$outboundSchema.parse(t))}function Den(t){return(0,Ren.safeParse)(t,e=>Mu.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var Cjt=v(Ru=>{"use strict";var Nen=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]}),Len=Ru&&Ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fen=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)&&Nen(e,t,r);return Len(e,t),e};Object.defineProperty(Ru,"__esModule",{value:!0});Ru.Security$=Ru.Security$outboundSchema=Ru.Security$inboundSchema=void 0;Ru.securityToJSON=$en;Ru.securityFromJSON=Ben;var Cie=Fen(we()),xjt=ke(),ken=me();Ru.Security$inboundSchema=Cie.object({ApiKey:Cie.string().optional()}).transform(t=>(0,xjt.remap)(t,{ApiKey:"apiKey"}));Ru.Security$outboundSchema=Cie.object({apiKey:Cie.string().optional()}).transform(t=>(0,xjt.remap)(t,{apiKey:"ApiKey"}));var Sjt;(function(t){t.inboundSchema=Ru.Security$inboundSchema,t.outboundSchema=Ru.Security$outboundSchema})(Sjt||(Ru.Security$=Sjt={}));function $en(t){return JSON.stringify(Ru.Security$outboundSchema.parse(t))}function Ben(t){return(0,ken.safeParse)(t,e=>Ru.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var Ejt=v(qo=>{"use strict";var qen=qo&&qo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Uen=qo&&qo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zen=qo&&qo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qen(e,t,r);return Uen(e,t),e};Object.defineProperty(qo,"__esModule",{value:!0});qo.UnarchiveFTModelOut$=qo.UnarchiveFTModelOut$outboundSchema=qo.UnarchiveFTModelOut$inboundSchema=qo.UnarchiveFTModelOutObject$=qo.UnarchiveFTModelOutObject$outboundSchema=qo.UnarchiveFTModelOutObject$inboundSchema=qo.UnarchiveFTModelOutObject=void 0;qo.unarchiveFTModelOutToJSON=Ven;qo.unarchiveFTModelOutFromJSON=Wen;var TO=zen(we()),Hen=me();qo.UnarchiveFTModelOutObject={Model:"model"};qo.UnarchiveFTModelOutObject$inboundSchema=TO.nativeEnum(qo.UnarchiveFTModelOutObject);qo.UnarchiveFTModelOutObject$outboundSchema=qo.UnarchiveFTModelOutObject$inboundSchema;var Ojt;(function(t){t.inboundSchema=qo.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=qo.UnarchiveFTModelOutObject$outboundSchema})(Ojt||(qo.UnarchiveFTModelOutObject$=Ojt={}));qo.UnarchiveFTModelOut$inboundSchema=TO.object({id:TO.string(),object:TO.literal("model").default("model"),archived:TO.boolean().default(!1)});qo.UnarchiveFTModelOut$outboundSchema=TO.object({id:TO.string(),object:TO.literal("model").default("model"),archived:TO.boolean().default(!1)});var Pjt;(function(t){t.inboundSchema=qo.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=qo.UnarchiveFTModelOut$outboundSchema})(Pjt||(qo.UnarchiveFTModelOut$=Pjt={}));function Ven(t){return JSON.stringify(qo.UnarchiveFTModelOut$outboundSchema.parse(t))}function Wen(t){return(0,Hen.safeParse)(t,e=>qo.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var Ajt=v(ju=>{"use strict";var Ken=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]}),Jen=ju&&ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gen=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)&&Ken(e,t,r);return Jen(e,t),e};Object.defineProperty(ju,"__esModule",{value:!0});ju.UpdateFTModelIn$=ju.UpdateFTModelIn$outboundSchema=ju.UpdateFTModelIn$inboundSchema=void 0;ju.updateFTModelInToJSON=Zen;ju.updateFTModelInFromJSON=Xen;var QS=Gen(we()),Yen=me();ju.UpdateFTModelIn$inboundSchema=QS.object({name:QS.nullable(QS.string()).optional(),description:QS.nullable(QS.string()).optional()});ju.UpdateFTModelIn$outboundSchema=QS.object({name:QS.nullable(QS.string()).optional(),description:QS.nullable(QS.string()).optional()});var Tjt;(function(t){t.inboundSchema=ju.UpdateFTModelIn$inboundSchema,t.outboundSchema=ju.UpdateFTModelIn$outboundSchema})(Tjt||(ju.UpdateFTModelIn$=Tjt={}));function Zen(t){return JSON.stringify(ju.UpdateFTModelIn$outboundSchema.parse(t))}function Xen(t){return(0,Yen.safeParse)(t,e=>ju.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var Njt=v(Du=>{"use strict";var Qen=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]}),etn=Du&&Du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ttn=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)&&Qen(e,t,r);return etn(e,t),e};Object.defineProperty(Du,"__esModule",{value:!0});Du.UploadFileOut$=Du.UploadFileOut$outboundSchema=Du.UploadFileOut$inboundSchema=void 0;Du.uploadFileOutToJSON=ntn;Du.uploadFileOutFromJSON=otn;var qd=ttn(we()),Mjt=ke(),rtn=me(),Rjt=Q8(),jjt=e6(),Djt=t6();Du.UploadFileOut$inboundSchema=qd.object({id:qd.string(),object:qd.string(),bytes:qd.number().int(),created_at:qd.number().int(),filename:qd.string(),purpose:Rjt.FilePurpose$inboundSchema,sample_type:jjt.SampleType$inboundSchema,num_lines:qd.nullable(qd.number().int()).optional(),source:Djt.Source$inboundSchema}).transform(t=>(0,Mjt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Du.UploadFileOut$outboundSchema=qd.object({id:qd.string(),object:qd.string(),sizeBytes:qd.number().int(),createdAt:qd.number().int(),filename:qd.string(),purpose:Rjt.FilePurpose$outboundSchema,sampleType:jjt.SampleType$outboundSchema,numLines:qd.nullable(qd.number().int()).optional(),source:Djt.Source$outboundSchema}).transform(t=>(0,Mjt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var Ijt;(function(t){t.inboundSchema=Du.UploadFileOut$inboundSchema,t.outboundSchema=Du.UploadFileOut$outboundSchema})(Ijt||(Du.UploadFileOut$=Ijt={}));function ntn(t){return JSON.stringify(Du.UploadFileOut$outboundSchema.parse(t))}function otn(t){return(0,rtn.safeParse)(t,e=>Du.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var $jt=v(Uo=>{"use strict";var itn=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]}),atn=Uo&&Uo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),stn=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)&&itn(e,t,r);return atn(e,t),e};Object.defineProperty(Uo,"__esModule",{value:!0});Uo.ValidationError$=Uo.ValidationError$outboundSchema=Uo.ValidationError$inboundSchema=Uo.Loc$=Uo.Loc$outboundSchema=Uo.Loc$inboundSchema=void 0;Uo.locToJSON=utn;Uo.locFromJSON=ltn;Uo.validationErrorToJSON=ctn;Uo.validationErrorFromJSON=dtn;var Nu=stn(we()),kjt=me();Uo.Loc$inboundSchema=Nu.union([Nu.string(),Nu.number().int()]);Uo.Loc$outboundSchema=Nu.union([Nu.string(),Nu.number().int()]);var Ljt;(function(t){t.inboundSchema=Uo.Loc$inboundSchema,t.outboundSchema=Uo.Loc$outboundSchema})(Ljt||(Uo.Loc$=Ljt={}));function utn(t){return JSON.stringify(Uo.Loc$outboundSchema.parse(t))}function ltn(t){return(0,kjt.safeParse)(t,e=>Uo.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}Uo.ValidationError$inboundSchema=Nu.object({loc:Nu.array(Nu.union([Nu.string(),Nu.number().int()])),msg:Nu.string(),type:Nu.string()});Uo.ValidationError$outboundSchema=Nu.object({loc:Nu.array(Nu.union([Nu.string(),Nu.number().int()])),msg:Nu.string(),type:Nu.string()});var Fjt;(function(t){t.inboundSchema=Uo.ValidationError$inboundSchema,t.outboundSchema=Uo.ValidationError$outboundSchema})(Fjt||(Uo.ValidationError$=Fjt={}));function ctn(t){return JSON.stringify(Uo.ValidationError$outboundSchema.parse(t))}function dtn(t){return(0,kjt.safeParse)(t,e=>Uo.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var Mn=v(Be=>{"use strict";var ftn=Be&&Be.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ke=Be&&Be.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ftn(e,t,r)};Object.defineProperty(Be,"__esModule",{value:!0});Ke(SIt(),Be);Ke(MIt(),Be);Ke(XIe(),Be);Ke(NIt(),Be);Ke(HA(),Be);Ke(QIe(),Be);Ke(eMe(),Be);Ke(WIt(),Be);Ke(rMe(),Be);Ke(rMt(),Be);Ke(tMe(),Be);Ke(uMt(),Be);Ke(Goe(),Be);Ke(wMt(),Be);Ke(EMt(),Be);Ke(LMt(),Be);Ke(oMe(),Be);Ke(iMe(),Be);Ke(JMt(),Be);Ke(ZMt(),Be);Ke(uMe(),Be);Ke(fRt(),Be);Ke(sMe(),Be);Ke(aq(),Be);Ke(mRt(),Be);Ke(gRt(),Be);Ke(aMe(),Be);Ke($Rt(),Be);Ke(HRt(),Be);Ke(GRt(),Be);Ke(dMe(),Be);Ke(lMe(),Be);Ke(Q8(),Be);Ke(fMe(),Be);Ke(i1t(),Be);Ke(c1t(),Be);Ke(m1t(),Be);Ke(_1t(),Be);Ke(pMe(),Be);Ke(mMe(),Be);Ke(I1t(),Be);Ke(YIe(),Be);Ke(WIe(),Be);Ke(ZIe(),Be);Ke(hMe(),Be);Ke(die(),Be);Ke(zIe(),Be);Ke(HIe(),Be);Ke(W1t(),Be);Ke(fie(),Be);Ke(wMe(),Be);Ke(ojt(),Be);Ke(JIe(),Be);Ke(ujt(),Be);Ke(djt(),Be);Ke(nMe(),Be);Ke(Koe(),Be);Ke(hjt(),Be);Ke(uq(),Be);Ke(VIe(),Be);Ke(lq(),Be);Ke(GIe(),Be);Ke(wjt(),Be);Ke(e6(),Be);Ke(Cjt(),Be);Ke(t6(),Be);Ke(iD(),Be);Ke(Ooe(),Be);Ke(cq(),Be);Ke(Poe(),Be);Ke(dq(),Be);Ke(fq(),Be);Ke(aD(),Be);Ke(Z8(),Be);Ke(gMe(),Be);Ke(pie(),Be);Ke(yMe(),Be);Ke(Ejt(),Be);Ke(Ajt(),Be);Ke(Njt(),Be);Ke(mq(),Be);Ke(sD(),Be);Ke($jt(),Be);Ke(bMe(),Be);Ke(mie(),Be)});var zjt=v(tc=>{"use strict";var ptn=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]}),mtn=tc&&tc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qjt=tc&&tc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ptn(e,t,r);return mtn(e,t),e};Object.defineProperty(tc,"__esModule",{value:!0});tc.HTTPValidationError$=tc.HTTPValidationError$outboundSchema=tc.HTTPValidationError$inboundSchema=tc.HTTPValidationError=void 0;var r6=qjt(we()),Ujt=qjt(Mn()),n6=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"}};tc.HTTPValidationError=n6;tc.HTTPValidationError$inboundSchema=r6.object({detail:r6.array(Ujt.ValidationError$inboundSchema).optional()}).transform(t=>new n6(t));tc.HTTPValidationError$outboundSchema=r6.instanceof(n6).transform(t=>t.data$).pipe(r6.object({detail:r6.array(Ujt.ValidationError$outboundSchema).optional()}));var Bjt;(function(t){t.inboundSchema=tc.HTTPValidationError$inboundSchema,t.outboundSchema=tc.HTTPValidationError$outboundSchema})(Bjt||(tc.HTTPValidationError$=Bjt={}))});var Dm=v(ex=>{"use strict";var htn=ex&&ex.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Oie=ex&&ex.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&htn(e,t,r)};Object.defineProperty(ex,"__esModule",{value:!0});Oie(mIe(),ex);Oie(zjt(),ex);Oie(LIe(),ex);Oie(qIe(),ex)});var Wjt=v(AO=>{"use strict";var gtn=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]}),ytn=AO&&AO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SMe=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)&&gtn(e,t,r);return ytn(e,t),e};Object.defineProperty(AO,"__esModule",{value:!0});AO.agentsComplete=xtn;var btn=Go(),o6=SMe(Yo()),_tn=ke(),vtn=me(),Hjt=Zo(),wtn=vo(),Vjt=SMe(Mn()),Stn=SMe(Dm());async function xtn(t,e,r){let n=(0,vtn.safeParse)(e,_=>Vjt.AgentsCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,btn.encodeJSON)("body",o,{explode:!0}),a=(0,wtn.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,_tn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,Hjt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Hjt.resolveGlobalSecurity)(l),d={operationID:"agents_completion_v1_agents_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await o6.match(o6.json(200,Vjt.ChatCompletionResponse$inboundSchema),o6.jsonErr(422,Stn.HTTPValidationError$inboundSchema),o6.fail("4XX"),o6.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var Gjt=v(IO=>{"use strict";var Ctn=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]}),Otn=IO&&IO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pie=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)&&Ctn(e,t,r);return Otn(e,t),e};Object.defineProperty(IO,"__esModule",{value:!0});IO.agentsStream=jtn;var Ptn=Pie(we()),Etn=Go(),Ttn=J8(),i6=Pie(Yo()),Atn=ke(),Itn=me(),Kjt=Zo(),Mtn=vo(),Jjt=Pie(Mn()),Rtn=Pie(Dm());async function jtn(t,e,r){let n=(0,Itn.safeParse)(e,_=>Jjt.AgentsCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Etn.encodeJSON)("body",o,{explode:!0}),a=(0,Mtn.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,Atn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,Kjt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Kjt.resolveGlobalSecurity)(l),d={operationID:"stream_agents",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await i6.match(i6.sse(200,Ptn.instanceof(ReadableStream).transform(_=>new Ttn.EventStream({stream:_,decoder(w){return Jjt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),i6.jsonErr(422,Rtn.HTTPValidationError$inboundSchema),i6.fail("4XX"),i6.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var Zjt=v(Eie=>{"use strict";Object.defineProperty(Eie,"__esModule",{value:!0});Eie.Agents=void 0;var Dtn=Wjt(),Ntn=Gjt(),Ltn=Rm(),Yjt=Vh(),xMe=class extends Ltn.ClientSDK{async complete(e,r){return(0,Yjt.unwrapAsync)((0,Dtn.agentsComplete)(this,e,r))}async stream(e,r){return(0,Yjt.unwrapAsync)((0,Ntn.agentsStream)(this,e,r))}};Eie.Agents=xMe});var eDt=v(Lu=>{"use strict";var Ftn=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]}),ktn=Lu&&Lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$tn=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)&&Ftn(e,t,r);return ktn(e,t),e};Object.defineProperty(Lu,"__esModule",{value:!0});Lu.DeleteModelV1ModelsModelIdDeleteRequest$=Lu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Lu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;Lu.deleteModelV1ModelsModelIdDeleteRequestToJSON=qtn;Lu.deleteModelV1ModelsModelIdDeleteRequestFromJSON=Utn;var Tie=$tn(we()),Qjt=ke(),Btn=me();Lu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=Tie.object({model_id:Tie.string()}).transform(t=>(0,Qjt.remap)(t,{model_id:"modelId"}));Lu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Tie.object({modelId:Tie.string()}).transform(t=>(0,Qjt.remap)(t,{modelId:"model_id"}));var Xjt;(function(t){t.inboundSchema=Lu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=Lu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(Xjt||(Lu.DeleteModelV1ModelsModelIdDeleteRequest$=Xjt={}));function qtn(t){return JSON.stringify(Lu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function Utn(t){return(0,Btn.safeParse)(t,e=>Lu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var nDt=v(Fu=>{"use strict";var ztn=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]}),Htn=Fu&&Fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vtn=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)&&ztn(e,t,r);return Htn(e,t),e};Object.defineProperty(Fu,"__esModule",{value:!0});Fu.FilesApiRoutesDeleteFileRequest$=Fu.FilesApiRoutesDeleteFileRequest$outboundSchema=Fu.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;Fu.filesApiRoutesDeleteFileRequestToJSON=Ktn;Fu.filesApiRoutesDeleteFileRequestFromJSON=Jtn;var Aie=Vtn(we()),rDt=ke(),Wtn=me();Fu.FilesApiRoutesDeleteFileRequest$inboundSchema=Aie.object({file_id:Aie.string()}).transform(t=>(0,rDt.remap)(t,{file_id:"fileId"}));Fu.FilesApiRoutesDeleteFileRequest$outboundSchema=Aie.object({fileId:Aie.string()}).transform(t=>(0,rDt.remap)(t,{fileId:"file_id"}));var tDt;(function(t){t.inboundSchema=Fu.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=Fu.FilesApiRoutesDeleteFileRequest$outboundSchema})(tDt||(Fu.FilesApiRoutesDeleteFileRequest$=tDt={}));function Ktn(t){return JSON.stringify(Fu.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function Jtn(t){return(0,Wtn.safeParse)(t,e=>Fu.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var aDt=v(ku=>{"use strict";var Gtn=ku&&ku.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ytn=ku&&ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ztn=ku&&ku.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gtn(e,t,r);return Ytn(e,t),e};Object.defineProperty(ku,"__esModule",{value:!0});ku.FilesApiRoutesDownloadFileRequest$=ku.FilesApiRoutesDownloadFileRequest$outboundSchema=ku.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;ku.filesApiRoutesDownloadFileRequestToJSON=Qtn;ku.filesApiRoutesDownloadFileRequestFromJSON=ern;var Iie=Ztn(we()),iDt=ke(),Xtn=me();ku.FilesApiRoutesDownloadFileRequest$inboundSchema=Iie.object({file_id:Iie.string()}).transform(t=>(0,iDt.remap)(t,{file_id:"fileId"}));ku.FilesApiRoutesDownloadFileRequest$outboundSchema=Iie.object({fileId:Iie.string()}).transform(t=>(0,iDt.remap)(t,{fileId:"file_id"}));var oDt;(function(t){t.inboundSchema=ku.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=ku.FilesApiRoutesDownloadFileRequest$outboundSchema})(oDt||(ku.FilesApiRoutesDownloadFileRequest$=oDt={}));function Qtn(t){return JSON.stringify(ku.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function ern(t){return(0,Xtn.safeParse)(t,e=>ku.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var lDt=v($u=>{"use strict";var trn=$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]}),rrn=$u&&$u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nrn=$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)&&trn(e,t,r);return rrn(e,t),e};Object.defineProperty($u,"__esModule",{value:!0});$u.FilesApiRoutesGetSignedUrlRequest$=$u.FilesApiRoutesGetSignedUrlRequest$outboundSchema=$u.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;$u.filesApiRoutesGetSignedUrlRequestToJSON=irn;$u.filesApiRoutesGetSignedUrlRequestFromJSON=arn;var yq=nrn(we()),uDt=ke(),orn=me();$u.FilesApiRoutesGetSignedUrlRequest$inboundSchema=yq.object({file_id:yq.string(),expiry:yq.number().int().default(24)}).transform(t=>(0,uDt.remap)(t,{file_id:"fileId"}));$u.FilesApiRoutesGetSignedUrlRequest$outboundSchema=yq.object({fileId:yq.string(),expiry:yq.number().int().default(24)}).transform(t=>(0,uDt.remap)(t,{fileId:"file_id"}));var sDt;(function(t){t.inboundSchema=$u.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=$u.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(sDt||($u.FilesApiRoutesGetSignedUrlRequest$=sDt={}));function irn(t){return JSON.stringify($u.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function arn(t){return(0,orn.safeParse)(t,e=>$u.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var pDt=v(qu=>{"use strict";var srn=qu&&qu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),urn=qu&&qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dDt=qu&&qu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&srn(e,t,r);return urn(e,t),e};Object.defineProperty(qu,"__esModule",{value:!0});qu.FilesApiRoutesListFilesRequest$=qu.FilesApiRoutesListFilesRequest$outboundSchema=qu.FilesApiRoutesListFilesRequest$inboundSchema=void 0;qu.filesApiRoutesListFilesRequestToJSON=crn;qu.filesApiRoutesListFilesRequestFromJSON=drn;var Bu=dDt(we()),fDt=ke(),lrn=me(),bq=dDt(Mn());qu.FilesApiRoutesListFilesRequest$inboundSchema=Bu.object({page:Bu.number().int().default(0),page_size:Bu.number().int().default(100),sample_type:Bu.nullable(Bu.array(bq.SampleType$inboundSchema)).optional(),source:Bu.nullable(Bu.array(bq.Source$inboundSchema)).optional(),search:Bu.nullable(Bu.string()).optional(),purpose:Bu.nullable(bq.FilePurpose$inboundSchema).optional()}).transform(t=>(0,fDt.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));qu.FilesApiRoutesListFilesRequest$outboundSchema=Bu.object({page:Bu.number().int().default(0),pageSize:Bu.number().int().default(100),sampleType:Bu.nullable(Bu.array(bq.SampleType$outboundSchema)).optional(),source:Bu.nullable(Bu.array(bq.Source$outboundSchema)).optional(),search:Bu.nullable(Bu.string()).optional(),purpose:Bu.nullable(bq.FilePurpose$outboundSchema).optional()}).transform(t=>(0,fDt.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var cDt;(function(t){t.inboundSchema=qu.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=qu.FilesApiRoutesListFilesRequest$outboundSchema})(cDt||(qu.FilesApiRoutesListFilesRequest$=cDt={}));function crn(t){return JSON.stringify(qu.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function drn(t){return(0,lrn.safeParse)(t,e=>qu.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var gDt=v(Uu=>{"use strict";var frn=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]}),prn=Uu&&Uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mrn=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)&&frn(e,t,r);return prn(e,t),e};Object.defineProperty(Uu,"__esModule",{value:!0});Uu.FilesApiRoutesRetrieveFileRequest$=Uu.FilesApiRoutesRetrieveFileRequest$outboundSchema=Uu.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;Uu.filesApiRoutesRetrieveFileRequestToJSON=grn;Uu.filesApiRoutesRetrieveFileRequestFromJSON=yrn;var Mie=mrn(we()),hDt=ke(),hrn=me();Uu.FilesApiRoutesRetrieveFileRequest$inboundSchema=Mie.object({file_id:Mie.string()}).transform(t=>(0,hDt.remap)(t,{file_id:"fileId"}));Uu.FilesApiRoutesRetrieveFileRequest$outboundSchema=Mie.object({fileId:Mie.string()}).transform(t=>(0,hDt.remap)(t,{fileId:"file_id"}));var mDt;(function(t){t.inboundSchema=Uu.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=Uu.FilesApiRoutesRetrieveFileRequest$outboundSchema})(mDt||(Uu.FilesApiRoutesRetrieveFileRequest$=mDt={}));function grn(t){return JSON.stringify(Uu.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function yrn(t){return(0,hrn.safeParse)(t,e=>Uu.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var CMe=v(Ty=>{"use strict";var brn=Ty&&Ty.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_rn=Ty&&Ty.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vrn=Ty&&Ty.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&brn(e,t,r);return _rn(e,t),e};Object.defineProperty(Ty,"__esModule",{value:!0});Ty.blobLikeSchema=void 0;Ty.isBlobLike=yDt;var wrn=vrn(we());Ty.blobLikeSchema=wrn.custom(yDt,{message:"expected a Blob, File or Blob-like object",fatal:!0});function yDt(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 xDt=v(no=>{"use strict";var Srn=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]}),xrn=no&&no.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vDt=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)&&Srn(e,t,r);return xrn(e,t),e};Object.defineProperty(no,"__esModule",{value:!0});no.FilesApiRoutesUploadFileMultiPartBodyParams$=no.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=no.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=no.FileT$=no.FileT$outboundSchema=no.FileT$inboundSchema=void 0;no.fileToJSON=Orn;no.fileFromJSON=Prn;no.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=Ern;no.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=Trn;var rc=vDt(we()),wDt=me(),Crn=CMe(),SDt=vDt(Mn());no.FileT$inboundSchema=rc.object({fileName:rc.string(),content:rc.union([rc.instanceof(ReadableStream),rc.instanceof(Blob),rc.instanceof(ArrayBuffer),rc.instanceof(Uint8Array)])});no.FileT$outboundSchema=rc.object({fileName:rc.string(),content:rc.union([rc.instanceof(ReadableStream),rc.instanceof(Blob),rc.instanceof(ArrayBuffer),rc.instanceof(Uint8Array)])});var bDt;(function(t){t.inboundSchema=no.FileT$inboundSchema,t.outboundSchema=no.FileT$outboundSchema})(bDt||(no.FileT$=bDt={}));function Orn(t){return JSON.stringify(no.FileT$outboundSchema.parse(t))}function Prn(t){return(0,wDt.safeParse)(t,e=>no.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}no.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=rc.object({file:rc.lazy(()=>no.FileT$inboundSchema),purpose:SDt.FilePurpose$inboundSchema.optional()});no.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=rc.object({file:rc.lazy(()=>no.FileT$outboundSchema).or(Crn.blobLikeSchema),purpose:SDt.FilePurpose$outboundSchema.optional()});var _Dt;(function(t){t.inboundSchema=no.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=no.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(_Dt||(no.FilesApiRoutesUploadFileMultiPartBodyParams$=_Dt={}));function Ern(t){return JSON.stringify(no.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function Trn(t){return(0,wDt.safeParse)(t,e=>no.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var PDt=v(zu=>{"use strict";var Arn=zu&&zu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Irn=zu&&zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mrn=zu&&zu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Arn(e,t,r);return Irn(e,t),e};Object.defineProperty(zu,"__esModule",{value:!0});zu.JobsApiRoutesBatchCancelBatchJobRequest$=zu.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=zu.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;zu.jobsApiRoutesBatchCancelBatchJobRequestToJSON=jrn;zu.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=Drn;var Rie=Mrn(we()),ODt=ke(),Rrn=me();zu.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=Rie.object({job_id:Rie.string()}).transform(t=>(0,ODt.remap)(t,{job_id:"jobId"}));zu.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=Rie.object({jobId:Rie.string()}).transform(t=>(0,ODt.remap)(t,{jobId:"job_id"}));var CDt;(function(t){t.inboundSchema=zu.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=zu.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(CDt||(zu.JobsApiRoutesBatchCancelBatchJobRequest$=CDt={}));function jrn(t){return JSON.stringify(zu.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function Drn(t){return(0,Rrn.safeParse)(t,e=>zu.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var ADt=v(Hu=>{"use strict";var Nrn=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]}),Lrn=Hu&&Hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Frn=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)&&Nrn(e,t,r);return Lrn(e,t),e};Object.defineProperty(Hu,"__esModule",{value:!0});Hu.JobsApiRoutesBatchGetBatchJobRequest$=Hu.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=Hu.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;Hu.jobsApiRoutesBatchGetBatchJobRequestToJSON=$rn;Hu.jobsApiRoutesBatchGetBatchJobRequestFromJSON=Brn;var jie=Frn(we()),TDt=ke(),krn=me();Hu.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=jie.object({job_id:jie.string()}).transform(t=>(0,TDt.remap)(t,{job_id:"jobId"}));Hu.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=jie.object({jobId:jie.string()}).transform(t=>(0,TDt.remap)(t,{jobId:"job_id"}));var EDt;(function(t){t.inboundSchema=Hu.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=Hu.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(EDt||(Hu.JobsApiRoutesBatchGetBatchJobRequest$=EDt={}));function $rn(t){return JSON.stringify(Hu.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function Brn(t){return(0,krn.safeParse)(t,e=>Hu.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var DDt=v(Vu=>{"use strict";var qrn=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]}),Urn=Vu&&Vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MDt=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)&&qrn(e,t,r);return Urn(e,t),e};Object.defineProperty(Vu,"__esModule",{value:!0});Vu.JobsApiRoutesBatchGetBatchJobsRequest$=Vu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Vu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;Vu.jobsApiRoutesBatchGetBatchJobsRequestToJSON=Hrn;Vu.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=Vrn;var Sa=MDt(we()),RDt=ke(),zrn=me(),jDt=MDt(Mn());Vu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=Sa.object({page:Sa.number().int().default(0),page_size:Sa.number().int().default(100),model:Sa.nullable(Sa.string()).optional(),metadata:Sa.nullable(Sa.record(Sa.any())).optional(),created_after:Sa.nullable(Sa.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Sa.boolean().default(!1),status:Sa.nullable(jDt.BatchJobStatus$inboundSchema).optional()}).transform(t=>(0,RDt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe"}));Vu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Sa.object({page:Sa.number().int().default(0),pageSize:Sa.number().int().default(100),model:Sa.nullable(Sa.string()).optional(),metadata:Sa.nullable(Sa.record(Sa.any())).optional(),createdAfter:Sa.nullable(Sa.date().transform(t=>t.toISOString())).optional(),createdByMe:Sa.boolean().default(!1),status:Sa.nullable(jDt.BatchJobStatus$outboundSchema).optional()}).transform(t=>(0,RDt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me"}));var IDt;(function(t){t.inboundSchema=Vu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=Vu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(IDt||(Vu.JobsApiRoutesBatchGetBatchJobsRequest$=IDt={}));function Hrn(t){return JSON.stringify(Vu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function Vrn(t){return(0,zrn.safeParse)(t,e=>Vu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var FDt=v(Wu=>{"use strict";var Wrn=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]}),Krn=Wu&&Wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jrn=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)&&Wrn(e,t,r);return Krn(e,t),e};Object.defineProperty(Wu,"__esModule",{value:!0});Wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=Wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=Wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;Wu.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=Yrn;Wu.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=Zrn;var Die=Jrn(we()),LDt=ke(),Grn=me();Wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=Die.object({model_id:Die.string()}).transform(t=>(0,LDt.remap)(t,{model_id:"modelId"}));Wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=Die.object({modelId:Die.string()}).transform(t=>(0,LDt.remap)(t,{modelId:"model_id"}));var NDt;(function(t){t.inboundSchema=Wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=Wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(NDt||(Wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=NDt={}));function Yrn(t){return JSON.stringify(Wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function Zrn(t){return(0,Grn.safeParse)(t,e=>Wu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var BDt=v(Ku=>{"use strict";var Xrn=Ku&&Ku.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qrn=Ku&&Ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),enn=Ku&&Ku.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xrn(e,t,r);return Qrn(e,t),e};Object.defineProperty(Ku,"__esModule",{value:!0});Ku.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=Ku.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=Ku.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;Ku.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=rnn;Ku.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=nnn;var Nie=enn(we()),$Dt=ke(),tnn=me();Ku.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=Nie.object({job_id:Nie.string()}).transform(t=>(0,$Dt.remap)(t,{job_id:"jobId"}));Ku.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=Nie.object({jobId:Nie.string()}).transform(t=>(0,$Dt.remap)(t,{jobId:"job_id"}));var kDt;(function(t){t.inboundSchema=Ku.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=Ku.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(kDt||(Ku.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=kDt={}));function rnn(t){return JSON.stringify(Ku.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function nnn(t){return(0,tnn.safeParse)(t,e=>Ku.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}});var HDt=v(Ju=>{"use strict";var onn=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]}),inn=Ju&&Ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UDt=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)&&onn(e,t,r);return inn(e,t),e};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=Ju.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Ju.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=void 0;Ju.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=snn;Ju.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=unn;var zDt=UDt(we()),ann=me(),Lie=UDt(Mn());Ju.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=zDt.union([Lie.LegacyJobMetadataOut$inboundSchema,Lie.JobOut$inboundSchema]);Ju.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=zDt.union([Lie.LegacyJobMetadataOut$outboundSchema,Lie.JobOut$outboundSchema]);var qDt;(function(t){t.inboundSchema=Ju.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=Ju.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(qDt||(Ju.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=qDt={}));function snn(t){return JSON.stringify(Ju.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function unn(t){return(0,ann.safeParse)(t,e=>Ju.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var KDt=v(Gu=>{"use strict";var lnn=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]}),cnn=Gu&&Gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dnn=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)&&lnn(e,t,r);return cnn(e,t),e};Object.defineProperty(Gu,"__esModule",{value:!0});Gu.JobsApiRoutesFineTuningGetFineTuningJobRequest$=Gu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=Gu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;Gu.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=pnn;Gu.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=mnn;var Fie=dnn(we()),WDt=ke(),fnn=me();Gu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=Fie.object({job_id:Fie.string()}).transform(t=>(0,WDt.remap)(t,{job_id:"jobId"}));Gu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=Fie.object({jobId:Fie.string()}).transform(t=>(0,WDt.remap)(t,{jobId:"job_id"}));var VDt;(function(t){t.inboundSchema=Gu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=Gu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(VDt||(Gu.JobsApiRoutesFineTuningGetFineTuningJobRequest$=VDt={}));function pnn(t){return JSON.stringify(Gu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function mnn(t){return(0,fnn.safeParse)(t,e=>Gu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}});var ZDt=v(oo=>{"use strict";var hnn=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]}),gnn=oo&&oo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ynn=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)&&hnn(e,t,r);return gnn(e,t),e};Object.defineProperty(oo,"__esModule",{value:!0});oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=oo.Status$=oo.Status$outboundSchema=oo.Status$inboundSchema=oo.Status=void 0;oo.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=_nn;oo.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=vnn;var Qo=ynn(we()),YDt=ke(),bnn=me();oo.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};oo.Status$inboundSchema=Qo.nativeEnum(oo.Status);oo.Status$outboundSchema=oo.Status$inboundSchema;var JDt;(function(t){t.inboundSchema=oo.Status$inboundSchema,t.outboundSchema=oo.Status$outboundSchema})(JDt||(oo.Status$=JDt={}));oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Qo.object({page:Qo.number().int().default(0),page_size:Qo.number().int().default(100),model:Qo.nullable(Qo.string()).optional(),created_after:Qo.nullable(Qo.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Qo.boolean().default(!1),status:Qo.nullable(oo.Status$inboundSchema).optional(),wandb_project:Qo.nullable(Qo.string()).optional(),wandb_name:Qo.nullable(Qo.string()).optional(),suffix:Qo.nullable(Qo.string()).optional()}).transform(t=>(0,YDt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Qo.object({page:Qo.number().int().default(0),pageSize:Qo.number().int().default(100),model:Qo.nullable(Qo.string()).optional(),createdAfter:Qo.nullable(Qo.date().transform(t=>t.toISOString())).optional(),createdByMe:Qo.boolean().default(!1),status:Qo.nullable(oo.Status$outboundSchema).optional(),wandbProject:Qo.nullable(Qo.string()).optional(),wandbName:Qo.nullable(Qo.string()).optional(),suffix:Qo.nullable(Qo.string()).optional()}).transform(t=>(0,YDt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var GDt;(function(t){t.inboundSchema=oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(GDt||(oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=GDt={}));function _nn(t){return JSON.stringify(oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function vnn(t){return(0,bnn.safeParse)(t,e=>oo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var eNt=v(Yu=>{"use strict";var wnn=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]}),Snn=Yu&&Yu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xnn=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)&&wnn(e,t,r);return Snn(e,t),e};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.JobsApiRoutesFineTuningStartFineTuningJobRequest$=Yu.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=Yu.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;Yu.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=Onn;Yu.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=Pnn;var kie=xnn(we()),QDt=ke(),Cnn=me();Yu.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=kie.object({job_id:kie.string()}).transform(t=>(0,QDt.remap)(t,{job_id:"jobId"}));Yu.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=kie.object({jobId:kie.string()}).transform(t=>(0,QDt.remap)(t,{jobId:"job_id"}));var XDt;(function(t){t.inboundSchema=Yu.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=Yu.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(XDt||(Yu.JobsApiRoutesFineTuningStartFineTuningJobRequest$=XDt={}));function Onn(t){return JSON.stringify(Yu.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function Pnn(t){return(0,Cnn.safeParse)(t,e=>Yu.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}});var nNt=v(Zu=>{"use strict";var Enn=Zu&&Zu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tnn=Zu&&Zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ann=Zu&&Zu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Enn(e,t,r);return Tnn(e,t),e};Object.defineProperty(Zu,"__esModule",{value:!0});Zu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=Zu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=Zu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;Zu.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=Mnn;Zu.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=Rnn;var $ie=Ann(we()),rNt=ke(),Inn=me();Zu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=$ie.object({model_id:$ie.string()}).transform(t=>(0,rNt.remap)(t,{model_id:"modelId"}));Zu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=$ie.object({modelId:$ie.string()}).transform(t=>(0,rNt.remap)(t,{modelId:"model_id"}));var tNt;(function(t){t.inboundSchema=Zu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=Zu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(tNt||(Zu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=tNt={}));function Mnn(t){return JSON.stringify(Zu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function Rnn(t){return(0,Inn.safeParse)(t,e=>Zu.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var uNt=v(Xu=>{"use strict";var jnn=Xu&&Xu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Dnn=Xu&&Xu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iNt=Xu&&Xu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jnn(e,t,r);return Dnn(e,t),e};Object.defineProperty(Xu,"__esModule",{value:!0});Xu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=Xu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Xu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;Xu.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=Lnn;Xu.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=Fnn;var Bie=iNt(we()),aNt=ke(),Nnn=me(),sNt=iNt(Mn());Xu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=Bie.object({model_id:Bie.string(),UpdateFTModelIn:sNt.UpdateFTModelIn$inboundSchema}).transform(t=>(0,aNt.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));Xu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Bie.object({modelId:Bie.string(),updateFTModelIn:sNt.UpdateFTModelIn$outboundSchema}).transform(t=>(0,aNt.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var oNt;(function(t){t.inboundSchema=Xu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=Xu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(oNt||(Xu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=oNt={}));function Lnn(t){return JSON.stringify(Xu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function Fnn(t){return(0,Nnn.safeParse)(t,e=>Xu.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}});var mNt=v(zo=>{"use strict";var knn=zo&&zo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$nn=zo&&zo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dNt=zo&&zo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&knn(e,t,r);return $nn(e,t),e};Object.defineProperty(zo,"__esModule",{value:!0});zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=zo.RetrieveModelV1ModelsModelIdGetRequest$=zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;zo.retrieveModelV1ModelsModelIdGetRequestToJSON=Bnn;zo.retrieveModelV1ModelsModelIdGetRequestFromJSON=qnn;zo.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=Unn;zo.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=znn;var Rp=dNt(we()),fNt=ke(),pNt=me(),qie=dNt(Mn());zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=Rp.object({model_id:Rp.string()}).transform(t=>(0,fNt.remap)(t,{model_id:"modelId"}));zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=Rp.object({modelId:Rp.string()}).transform(t=>(0,fNt.remap)(t,{modelId:"model_id"}));var lNt;(function(t){t.inboundSchema=zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(lNt||(zo.RetrieveModelV1ModelsModelIdGetRequest$=lNt={}));function Bnn(t){return JSON.stringify(zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function qnn(t){return(0,pNt.safeParse)(t,e=>zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=Rp.union([qie.BaseModelCard$inboundSchema.and(Rp.object({type:Rp.literal("base")}).transform(t=>({type:t.type}))),qie.FTModelCard$inboundSchema.and(Rp.object({type:Rp.literal("fine-tuned")}).transform(t=>({type:t.type})))]);zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=Rp.union([qie.BaseModelCard$outboundSchema.and(Rp.object({type:Rp.literal("base")}).transform(t=>({type:t.type}))),qie.FTModelCard$outboundSchema.and(Rp.object({type:Rp.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var cNt;(function(t){t.inboundSchema=zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(cNt||(zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=cNt={}));function Unn(t){return JSON.stringify(zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function znn(t){return(0,pNt.safeParse)(t,e=>zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var Qu=v(ta=>{"use strict";var Hnn=ta&&ta.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xl=ta&&ta.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Hnn(e,t,r)};Object.defineProperty(ta,"__esModule",{value:!0});xl(eDt(),ta);xl(nDt(),ta);xl(aDt(),ta);xl(lDt(),ta);xl(pDt(),ta);xl(gDt(),ta);xl(xDt(),ta);xl(PDt(),ta);xl(ADt(),ta);xl(DDt(),ta);xl(FDt(),ta);xl(BDt(),ta);xl(HDt(),ta);xl(KDt(),ta);xl(ZDt(),ta);xl(eNt(),ta);xl(nNt(),ta);xl(uNt(),ta);xl(mNt(),ta)});var gNt=v(MO=>{"use strict";var Vnn=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]}),Wnn=MO&&MO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OMe=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)&&Vnn(e,t,r);return Wnn(e,t),e};Object.defineProperty(MO,"__esModule",{value:!0});MO.batchJobsCancel=Qnn;var Knn=Go(),Uie=OMe(Yo()),Jnn=ke(),Gnn=me(),hNt=Zo(),Ynn=vo(),Znn=OMe(Mn()),Xnn=OMe(Qu());async function Qnn(t,e,r){let n=(0,Gnn.safeParse)(e,_=>Xnn.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,Knn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Ynn.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,Jnn.compactMap)({Accept:"application/json"})),l=await(0,hNt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,hNt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_cancel_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Uie.match(Uie.json(200,Znn.BatchJobOut$inboundSchema),Uie.fail("4XX"),Uie.fail("5XX"))(b);return g.ok,g}});var vNt=v(RO=>{"use strict";var eon=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]}),ton=RO&&RO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Nt=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)&&eon(e,t,r);return ton(e,t),e};Object.defineProperty(RO,"__esModule",{value:!0});RO.batchJobsCreate=aon;var ron=Go(),zie=_Nt(Yo()),non=ke(),oon=me(),yNt=Zo(),ion=vo(),bNt=_Nt(Mn());async function aon(t,e,r){let n=(0,oon.safeParse)(e,g=>bNt.BatchJobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,ron.encodeJSON)("body",o,{explode:!0}),a=(0,ion.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,non.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,yNt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,yNt.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_batch_create_batch_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[b]=await zie.match(zie.json(200,bNt.BatchJobOut$inboundSchema),zie.fail("4XX"),zie.fail("5XX"))(h);return b.ok,b}});var SNt=v(jO=>{"use strict";var son=jO&&jO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uon=jO&&jO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PMe=jO&&jO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&son(e,t,r);return uon(e,t),e};Object.defineProperty(jO,"__esModule",{value:!0});jO.batchJobsGet=hon;var lon=Go(),Hie=PMe(Yo()),con=ke(),don=me(),wNt=Zo(),fon=vo(),pon=PMe(Mn()),mon=PMe(Qu());async function hon(t,e,r){let n=(0,don.safeParse)(e,_=>mon.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,lon.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,fon.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,con.compactMap)({Accept:"application/json"})),l=await(0,wNt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,wNt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Hie.match(Hie.json(200,pon.BatchJobOut$inboundSchema),Hie.fail("4XX"),Hie.fail("5XX"))(b);return g.ok,g}});var CNt=v(DO=>{"use strict";var gon=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]}),yon=DO&&DO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EMe=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)&&gon(e,t,r);return yon(e,t),e};Object.defineProperty(DO,"__esModule",{value:!0});DO.batchJobsList=Con;var bon=Go(),Vie=EMe(Yo()),_on=ke(),von=me(),xNt=Zo(),won=vo(),Son=EMe(Mn()),xon=EMe(Qu());async function Con(t,e,r){let n=(0,von.safeParse)(e,_=>xon.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,won.pathToFunc)("/v1/batch/jobs")(),s=(0,bon.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,_on.compactMap)({Accept:"application/json"})),l=await(0,xNt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,xNt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Vie.match(Vie.json(200,Son.BatchJobsOut$inboundSchema),Vie.fail("4XX"),Vie.fail("5XX"))(b);return g.ok,g}});var ONt=v(Kie=>{"use strict";Object.defineProperty(Kie,"__esModule",{value:!0});Kie.MistralJobs=void 0;var Oon=gNt(),Pon=vNt(),Eon=SNt(),Ton=CNt(),Aon=Rm(),Wie=Vh(),TMe=class extends Aon.ClientSDK{async list(e,r){return(0,Wie.unwrapAsync)((0,Ton.batchJobsList)(this,e,r))}async create(e,r){return(0,Wie.unwrapAsync)((0,Pon.batchJobsCreate)(this,e,r))}async get(e,r){return(0,Wie.unwrapAsync)((0,Eon.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,Wie.unwrapAsync)((0,Oon.batchJobsCancel)(this,e,r))}};Kie.MistralJobs=TMe});var PNt=v(Jie=>{"use strict";Object.defineProperty(Jie,"__esModule",{value:!0});Jie.Batch=void 0;var Ion=Rm(),Mon=ONt(),AMe=class extends Ion.ClientSDK{get jobs(){return this._jobs??(this._jobs=new Mon.MistralJobs(this._options))}};Jie.Batch=AMe});var ANt=v(NO=>{"use strict";var Ron=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]}),jon=NO&&NO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IMe=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)&&Ron(e,t,r);return jon(e,t),e};Object.defineProperty(NO,"__esModule",{value:!0});NO.chatComplete=$on;var Don=Go(),a6=IMe(Yo()),Non=ke(),Lon=me(),ENt=Zo(),Fon=vo(),TNt=IMe(Mn()),kon=IMe(Dm());async function $on(t,e,r){let n=(0,Lon.safeParse)(e,_=>TNt.ChatCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Don.encodeJSON)("body",o,{explode:!0}),a=(0,Fon.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,Non.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,ENt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,ENt.resolveGlobalSecurity)(l),d={operationID:"chat_completion_v1_chat_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await a6.match(a6.json(200,TNt.ChatCompletionResponse$inboundSchema),a6.jsonErr(422,kon.HTTPValidationError$inboundSchema),a6.fail("4XX"),a6.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var RNt=v(LO=>{"use strict";var Bon=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]}),qon=LO&&LO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gie=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)&&Bon(e,t,r);return qon(e,t),e};Object.defineProperty(LO,"__esModule",{value:!0});LO.chatStream=Gon;var Uon=Gie(we()),zon=Go(),Hon=J8(),s6=Gie(Yo()),Von=ke(),Won=me(),INt=Zo(),Kon=vo(),MNt=Gie(Mn()),Jon=Gie(Dm());async function Gon(t,e,r){let n=(0,Won.safeParse)(e,_=>MNt.ChatCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,zon.encodeJSON)("body",o,{explode:!0}),a=(0,Kon.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,Von.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,INt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,INt.resolveGlobalSecurity)(l),d={operationID:"stream_chat",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await s6.match(s6.sse(200,Uon.instanceof(ReadableStream).transform(_=>new Hon.EventStream({stream:_,decoder(w){return MNt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),s6.jsonErr(422,Jon.HTTPValidationError$inboundSchema),s6.fail("4XX"),s6.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var Yie=v(tx=>{"use strict";Object.defineProperty(tx,"__esModule",{value:!0});tx.getDefaultOptions=tx.defaultOptions=tx.ignoreOverride=void 0;tx.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");tx.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 Yon=t=>typeof t=="string"?{...tx.defaultOptions,name:t}:{...tx.defaultOptions,...t};tx.getDefaultOptions=Yon});var MMe=v(Zie=>{"use strict";Object.defineProperty(Zie,"__esModule",{value:!0});Zie.getRefs=void 0;var Zon=Yie(),Xon=t=>{let e=(0,Zon.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}]))}};Zie.getRefs=Xon});var YA=v(_q=>{"use strict";Object.defineProperty(_q,"__esModule",{value:!0});_q.setResponseValueAndErrors=_q.addErrorMessage=void 0;function jNt(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}_q.addErrorMessage=jNt;function Qon(t,e,r,n,o){t[e]=r,jNt(t,e,n,o)}_q.setResponseValueAndErrors=Qon});var RMe=v(Xie=>{"use strict";Object.defineProperty(Xie,"__esModule",{value:!0});Xie.parseAnyDef=void 0;function ein(){return{}}Xie.parseAnyDef=ein});var jMe=v(eae=>{"use strict";Object.defineProperty(eae,"__esModule",{value:!0});eae.parseArrayDef=void 0;var tin=we(),Qie=YA(),rin=el();function nin(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==tin.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,rin.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,Qie.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,Qie.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,Qie.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,Qie.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}eae.parseArrayDef=nin});var DMe=v(tae=>{"use strict";Object.defineProperty(tae,"__esModule",{value:!0});tae.parseBigintDef=void 0;var fD=YA();function oin(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}tae.parseBigintDef=oin});var NMe=v(rae=>{"use strict";Object.defineProperty(rae,"__esModule",{value:!0});rae.parseBooleanDef=void 0;function iin(){return{type:"boolean"}}rae.parseBooleanDef=iin});var oae=v(nae=>{"use strict";Object.defineProperty(nae,"__esModule",{value:!0});nae.parseBrandedDef=void 0;var ain=el();function sin(t,e){return(0,ain.parseDef)(t.type._def,e)}nae.parseBrandedDef=sin});var LMe=v(iae=>{"use strict";Object.defineProperty(iae,"__esModule",{value:!0});iae.parseCatchDef=void 0;var uin=el(),lin=(t,e)=>(0,uin.parseDef)(t.innerType._def,e);iae.parseCatchDef=lin});var FMe=v(aae=>{"use strict";Object.defineProperty(aae,"__esModule",{value:!0});aae.parseDateDef=void 0;var DNt=YA();function NNt(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>NNt(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 cin(t,e)}}aae.parseDateDef=NNt;var cin=(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,DNt.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,DNt.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var kMe=v(sae=>{"use strict";Object.defineProperty(sae,"__esModule",{value:!0});sae.parseDefaultDef=void 0;var din=el();function fin(t,e){return{...(0,din.parseDef)(t.innerType._def,e),default:t.defaultValue()}}sae.parseDefaultDef=fin});var $Me=v(uae=>{"use strict";Object.defineProperty(uae,"__esModule",{value:!0});uae.parseEffectsDef=void 0;var pin=el();function min(t,e){return e.effectStrategy==="input"?(0,pin.parseDef)(t.schema._def,e):{}}uae.parseEffectsDef=min});var BMe=v(lae=>{"use strict";Object.defineProperty(lae,"__esModule",{value:!0});lae.parseEnumDef=void 0;function hin(t){return{type:"string",enum:Array.from(t.values)}}lae.parseEnumDef=hin});var qMe=v(cae=>{"use strict";Object.defineProperty(cae,"__esModule",{value:!0});cae.parseIntersectionDef=void 0;var LNt=el(),gin=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function yin(t,e){let r=[(0,LNt.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,LNt.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(gin(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}cae.parseIntersectionDef=yin});var UMe=v(dae=>{"use strict";Object.defineProperty(dae,"__esModule",{value:!0});dae.parseLiteralDef=void 0;function bin(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}}dae.parseLiteralDef=bin});var fae=v(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.parseStringDef=Vc.zodPatterns=void 0;var pD=YA(),zMe;Vc.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:()=>(zMe===void 0&&(zMe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),zMe),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 _in(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":Ay(r,"email",n.message,e);break;case"format:idn-email":Ay(r,"idn-email",n.message,e);break;case"pattern:zod":If(r,Vc.zodPatterns.email,n.message,e);break}break;case"url":Ay(r,"uri",n.message,e);break;case"uuid":Ay(r,"uuid",n.message,e);break;case"regex":If(r,n.regex,n.message,e);break;case"cuid":If(r,Vc.zodPatterns.cuid,n.message,e);break;case"cuid2":If(r,Vc.zodPatterns.cuid2,n.message,e);break;case"startsWith":If(r,RegExp(`^${HMe(n.value,e)}`),n.message,e);break;case"endsWith":If(r,RegExp(`${HMe(n.value,e)}$`),n.message,e);break;case"datetime":Ay(r,"date-time",n.message,e);break;case"date":Ay(r,"date",n.message,e);break;case"time":Ay(r,"time",n.message,e);break;case"duration":Ay(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":{If(r,RegExp(HMe(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&Ay(r,"ipv4",n.message,e),n.version!=="v4"&&Ay(r,"ipv6",n.message,e);break}case"base64url":If(r,Vc.zodPatterns.base64url,n.message,e);break;case"jwt":If(r,Vc.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&If(r,Vc.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&If(r,Vc.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":If(r,Vc.zodPatterns.emoji(),n.message,e);break;case"ulid":{If(r,Vc.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Ay(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,pD.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{If(r,Vc.zodPatterns.base64,n.message,e);break}}break}case"nanoid":If(r,Vc.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}Vc.parseStringDef=_in;function HMe(t,e){return e.patternStrategy==="escape"?win(t):t}var vin=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function win(t){let e="";for(let r=0;r<t.length;r++)vin.has(t[r])||(e+="\\"),e+=t[r];return e}function Ay(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 If(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:FNt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,pD.setResponseValueAndErrors)(t,"pattern",FNt(e,n),r,n)}function FNt(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 mae=v(pae=>{"use strict";Object.defineProperty(pae,"__esModule",{value:!0});pae.parseRecordDef=void 0;var u6=we(),kNt=el(),Sin=fae(),xin=oae();function Cin(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===u6.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,kNt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,kNt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===u6.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,Sin.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===u6.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===u6.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===u6.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,xin.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}pae.parseRecordDef=Cin});var VMe=v(hae=>{"use strict";Object.defineProperty(hae,"__esModule",{value:!0});hae.parseMapDef=void 0;var $Nt=el(),Oin=mae();function Pin(t,e){if(e.mapStrategy==="record")return(0,Oin.parseRecordDef)(t,e);let r=(0,$Nt.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,$Nt.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}}}hae.parseMapDef=Pin});var WMe=v(gae=>{"use strict";Object.defineProperty(gae,"__esModule",{value:!0});gae.parseNativeEnumDef=void 0;function Ein(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}}gae.parseNativeEnumDef=Ein});var KMe=v(yae=>{"use strict";Object.defineProperty(yae,"__esModule",{value:!0});yae.parseNeverDef=void 0;function Tin(){return{not:{}}}yae.parseNeverDef=Tin});var JMe=v(bae=>{"use strict";Object.defineProperty(bae,"__esModule",{value:!0});bae.parseNullDef=void 0;function Ain(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}bae.parseNullDef=Ain});var _ae=v(ZA=>{"use strict";Object.defineProperty(ZA,"__esModule",{value:!0});ZA.parseUnionDef=ZA.primitiveMappings=void 0;var Iin=el();ZA.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Min(t,e){if(e.target==="openApi3")return BNt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in ZA.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=ZA.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 BNt(t,e)}ZA.parseUnionDef=Min;var BNt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,Iin.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 GMe=v(vae=>{"use strict";Object.defineProperty(vae,"__esModule",{value:!0});vae.parseNullableDef=void 0;var qNt=el(),UNt=_ae();function Rin(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:UNt.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[UNt.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,qNt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,qNt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}vae.parseNullableDef=Rin});var YMe=v(wae=>{"use strict";Object.defineProperty(wae,"__esModule",{value:!0});wae.parseNumberDef=void 0;var XA=YA();function jin(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,XA.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,XA.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,XA.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,XA.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,XA.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,XA.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,XA.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,XA.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}wae.parseNumberDef=jin});var XMe=v(Sae=>{"use strict";Object.defineProperty(Sae,"__esModule",{value:!0});Sae.parseObjectDef=void 0;var Din=we(),ZMe=el();function Nin(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,ZMe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,ZMe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function Lin(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 Din.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,ZMe.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:Nin(t,e)};return n.required.length||delete n.required,n}Sae.parseObjectDef=Lin});var QMe=v(xae=>{"use strict";Object.defineProperty(xae,"__esModule",{value:!0});xae.parseOptionalDef=void 0;var zNt=el(),Fin=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,zNt.parseDef)(t.innerType._def,e);let r=(0,zNt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};xae.parseOptionalDef=Fin});var eRe=v(Oae=>{"use strict";Object.defineProperty(Oae,"__esModule",{value:!0});Oae.parsePipelineDef=void 0;var Cae=el(),kin=(t,e)=>{if(e.pipeStrategy==="input")return(0,Cae.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,Cae.parseDef)(t.out._def,e);let r=(0,Cae.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,Cae.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};Oae.parsePipelineDef=kin});var tRe=v(Pae=>{"use strict";Object.defineProperty(Pae,"__esModule",{value:!0});Pae.parsePromiseDef=void 0;var $in=el();function Bin(t,e){return(0,$in.parseDef)(t.type._def,e)}Pae.parsePromiseDef=Bin});var rRe=v(Eae=>{"use strict";Object.defineProperty(Eae,"__esModule",{value:!0});Eae.parseSetDef=void 0;var HNt=YA(),qin=el();function Uin(t,e){let n={type:"array",uniqueItems:!0,items:(0,qin.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,HNt.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,HNt.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}Eae.parseSetDef=Uin});var oRe=v(Tae=>{"use strict";Object.defineProperty(Tae,"__esModule",{value:!0});Tae.parseTupleDef=void 0;var nRe=el();function zin(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,nRe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,nRe.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,nRe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}Tae.parseTupleDef=zin});var iRe=v(Aae=>{"use strict";Object.defineProperty(Aae,"__esModule",{value:!0});Aae.parseUndefinedDef=void 0;function Hin(){return{not:{}}}Aae.parseUndefinedDef=Hin});var aRe=v(Iae=>{"use strict";Object.defineProperty(Iae,"__esModule",{value:!0});Iae.parseUnknownDef=void 0;function Vin(){return{}}Iae.parseUnknownDef=Vin});var sRe=v(Mae=>{"use strict";Object.defineProperty(Mae,"__esModule",{value:!0});Mae.parseReadonlyDef=void 0;var Win=el(),Kin=(t,e)=>(0,Win.parseDef)(t.innerType._def,e);Mae.parseReadonlyDef=Kin});var el=v(Rae=>{"use strict";Object.defineProperty(Rae,"__esModule",{value:!0});Rae.parseDef=void 0;var Rn=we(),Jin=RMe(),Gin=jMe(),Yin=DMe(),Zin=NMe(),Xin=oae(),Qin=LMe(),ean=FMe(),tan=kMe(),ran=$Me(),nan=BMe(),oan=qMe(),ian=UMe(),aan=VMe(),san=WMe(),uan=KMe(),lan=JMe(),can=GMe(),dan=YMe(),fan=XMe(),pan=QMe(),man=eRe(),han=tRe(),gan=mae(),yan=rRe(),ban=fae(),_an=oRe(),van=iRe(),wan=_ae(),San=aRe(),xan=sRe(),Can=Yie();function VNt(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==Can.ignoreOverride)return a}if(n&&!r){let a=Oan(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=Ean(t,t.typeName,e);return i&&Tan(t,e,i),o.jsonSchema=i,i}Rae.parseDef=VNt;var Oan=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Pan(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}},Pan=(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("/")},Ean=(t,e,r)=>{switch(e){case Rn.ZodFirstPartyTypeKind.ZodString:return(0,ban.parseStringDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodNumber:return(0,dan.parseNumberDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodObject:return(0,fan.parseObjectDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodBigInt:return(0,Yin.parseBigintDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodBoolean:return(0,Zin.parseBooleanDef)();case Rn.ZodFirstPartyTypeKind.ZodDate:return(0,ean.parseDateDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodUndefined:return(0,van.parseUndefinedDef)();case Rn.ZodFirstPartyTypeKind.ZodNull:return(0,lan.parseNullDef)(r);case Rn.ZodFirstPartyTypeKind.ZodArray:return(0,Gin.parseArrayDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodUnion:case Rn.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,wan.parseUnionDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodIntersection:return(0,oan.parseIntersectionDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodTuple:return(0,_an.parseTupleDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodRecord:return(0,gan.parseRecordDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodLiteral:return(0,ian.parseLiteralDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodEnum:return(0,nan.parseEnumDef)(t);case Rn.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,san.parseNativeEnumDef)(t);case Rn.ZodFirstPartyTypeKind.ZodNullable:return(0,can.parseNullableDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodOptional:return(0,pan.parseOptionalDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodMap:return(0,aan.parseMapDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodSet:return(0,yan.parseSetDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodLazy:return VNt(t.getter()._def,r);case Rn.ZodFirstPartyTypeKind.ZodPromise:return(0,han.parsePromiseDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodNaN:case Rn.ZodFirstPartyTypeKind.ZodNever:return(0,uan.parseNeverDef)();case Rn.ZodFirstPartyTypeKind.ZodEffects:return(0,ran.parseEffectsDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodAny:return(0,Jin.parseAnyDef)();case Rn.ZodFirstPartyTypeKind.ZodUnknown:return(0,San.parseUnknownDef)();case Rn.ZodFirstPartyTypeKind.ZodDefault:return(0,tan.parseDefaultDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodBranded:return(0,Xin.parseBrandedDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodReadonly:return(0,xan.parseReadonlyDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodCatch:return(0,Qin.parseCatchDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodPipeline:return(0,man.parsePipelineDef)(t,r);case Rn.ZodFirstPartyTypeKind.ZodFunction:case Rn.ZodFirstPartyTypeKind.ZodVoid:case Rn.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},Tan=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var uRe=v(jae=>{"use strict";Object.defineProperty(jae,"__esModule",{value:!0});jae.zodToJsonSchema=void 0;var WNt=el(),Aan=MMe(),Ian=(t,e)=>{let r=(0,Aan.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:(0,WNt.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,WNt.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};jae.zodToJsonSchema=Ian});var KNt=v(Gr=>{"use strict";var Man=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]}),Un=Gr&&Gr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Man(e,t,r)};Object.defineProperty(Gr,"__esModule",{value:!0});Un(Yie(),Gr);Un(MMe(),Gr);Un(YA(),Gr);Un(el(),Gr);Un(RMe(),Gr);Un(jMe(),Gr);Un(DMe(),Gr);Un(NMe(),Gr);Un(oae(),Gr);Un(LMe(),Gr);Un(FMe(),Gr);Un(kMe(),Gr);Un($Me(),Gr);Un(BMe(),Gr);Un(qMe(),Gr);Un(UMe(),Gr);Un(VMe(),Gr);Un(WMe(),Gr);Un(KMe(),Gr);Un(JMe(),Gr);Un(GMe(),Gr);Un(YMe(),Gr);Un(XMe(),Gr);Un(QMe(),Gr);Un(eRe(),Gr);Un(tRe(),Gr);Un(sRe(),Gr);Un(mae(),Gr);Un(rRe(),Gr);Un(fae(),Gr);Un(oRe(),Gr);Un(iRe(),Gr);Un(_ae(),Gr);Un(aRe(),Gr);Un(uRe(),Gr);var Ran=uRe();Gr.default=Ran.zodToJsonSchema});var GNt=v(l6=>{"use strict";Object.defineProperty(l6,"__esModule",{value:!0});l6.transformToChatCompletionRequest=Dan;l6.convertToParsedChatCompletionResponse=Nan;l6.responseFormatFromZodObject=JNt;var jan=KNt();function Dan(t){let{responseFormat:e,...r}=t,n=JNt(e);return{...r,responseFormat:n}}function Nan(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 JNt(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,jan.zodToJsonSchema)(t),strict:!0}}}});var XNt=v(Nae=>{"use strict";Object.defineProperty(Nae,"__esModule",{value:!0});Nae.Chat=void 0;var YNt=ANt(),ZNt=RNt(),Lan=Rm(),Dae=Vh(),lRe=GNt(),cRe=class extends Lan.ClientSDK{async parse(e,r){let n=(0,lRe.transformToChatCompletionRequest)(e),o=await(0,Dae.unwrapAsync)((0,YNt.chatComplete)(this,n,r));return(0,lRe.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,lRe.transformToChatCompletionRequest)(e);return(0,Dae.unwrapAsync)((0,ZNt.chatStream)(this,n,r))}async complete(e,r){return(0,Dae.unwrapAsync)((0,YNt.chatComplete)(this,e,r))}async stream(e,r){return(0,Dae.unwrapAsync)((0,ZNt.chatStream)(this,e,r))}};Nae.Chat=cRe});var tLt=v(FO=>{"use strict";var Fan=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]}),kan=FO&&FO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dRe=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)&&Fan(e,t,r);return kan(e,t),e};Object.defineProperty(FO,"__esModule",{value:!0});FO.classifiersModerate=Han;var $an=Go(),c6=dRe(Yo()),Ban=ke(),qan=me(),QNt=Zo(),Uan=vo(),eLt=dRe(Mn()),zan=dRe(Dm());async function Han(t,e,r){let n=(0,qan.safeParse)(e,_=>eLt.ClassificationRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,$an.encodeJSON)("body",o,{explode:!0}),a=(0,Uan.pathToFunc)("/v1/moderations")(),s=new Headers((0,Ban.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,QNt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,QNt.resolveGlobalSecurity)(l),d={operationID:"moderations_v1_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await c6.match(c6.json(200,eLt.ClassificationResponse$inboundSchema),c6.jsonErr(422,zan.HTTPValidationError$inboundSchema),c6.fail("4XX"),c6.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var oLt=v(kO=>{"use strict";var Van=kO&&kO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wan=kO&&kO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fRe=kO&&kO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Van(e,t,r);return Wan(e,t),e};Object.defineProperty(kO,"__esModule",{value:!0});kO.classifiersModerateChat=Xan;var Kan=Go(),d6=fRe(Yo()),Jan=ke(),Gan=me(),rLt=Zo(),Yan=vo(),nLt=fRe(Mn()),Zan=fRe(Dm());async function Xan(t,e,r){let n=(0,Gan.safeParse)(e,_=>nLt.ChatClassificationRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Kan.encodeJSON)("body",o,{explode:!0}),a=(0,Yan.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,Jan.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,rLt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,rLt.resolveGlobalSecurity)(l),d={operationID:"moderations_chat_v1_chat_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await d6.match(d6.json(200,nLt.ClassificationResponse$inboundSchema),d6.jsonErr(422,Zan.HTTPValidationError$inboundSchema),d6.fail("4XX"),d6.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var aLt=v(Lae=>{"use strict";Object.defineProperty(Lae,"__esModule",{value:!0});Lae.Classifiers=void 0;var Qan=tLt(),esn=oLt(),tsn=Rm(),iLt=Vh(),pRe=class extends tsn.ClientSDK{async moderate(e,r){return(0,iLt.unwrapAsync)((0,Qan.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,iLt.unwrapAsync)((0,esn.classifiersModerateChat)(this,e,r))}};Lae.Classifiers=pRe});var lLt=v($O=>{"use strict";var rsn=$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]}),nsn=$O&&$O.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mRe=$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)&&rsn(e,t,r);return nsn(e,t),e};Object.defineProperty($O,"__esModule",{value:!0});$O.embeddingsCreate=lsn;var osn=Go(),f6=mRe(Yo()),isn=ke(),asn=me(),sLt=Zo(),ssn=vo(),uLt=mRe(Mn()),usn=mRe(Dm());async function lsn(t,e,r){let n=(0,asn.safeParse)(e,_=>uLt.EmbeddingRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,osn.encodeJSON)("body",o,{explode:!0}),a=(0,ssn.pathToFunc)("/v1/embeddings")(),s=new Headers((0,isn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,sLt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,sLt.resolveGlobalSecurity)(l),d={operationID:"embeddings_v1_embeddings_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await f6.match(f6.json(200,uLt.EmbeddingResponse$inboundSchema),f6.jsonErr(422,usn.HTTPValidationError$inboundSchema),f6.fail("4XX"),f6.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var cLt=v(Fae=>{"use strict";Object.defineProperty(Fae,"__esModule",{value:!0});Fae.Embeddings=void 0;var csn=lLt(),dsn=Rm(),fsn=Vh(),hRe=class extends dsn.ClientSDK{async create(e,r){return(0,fsn.unwrapAsync)((0,csn.embeddingsCreate)(this,e,r))}};Fae.Embeddings=hRe});var fLt=v(BO=>{"use strict";var psn=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]}),msn=BO&&BO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gRe=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)&&psn(e,t,r);return msn(e,t),e};Object.defineProperty(BO,"__esModule",{value:!0});BO.filesDelete=wsn;var hsn=Go(),kae=gRe(Yo()),gsn=ke(),ysn=me(),dLt=Zo(),bsn=vo(),_sn=gRe(Mn()),vsn=gRe(Qu());async function wsn(t,e,r){let n=(0,ysn.safeParse)(e,_=>vsn.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,hsn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,bsn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,gsn.compactMap)({Accept:"application/json"})),l=await(0,dLt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,dLt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_delete_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await kae.match(kae.json(200,_sn.DeleteFileOut$inboundSchema),kae.fail("4XX"),kae.fail("5XX"))(b);return g.ok,g}});var mLt=v(qO=>{"use strict";var Ssn=qO&&qO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xsn=qO&&qO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yRe=qO&&qO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ssn(e,t,r);return xsn(e,t),e};Object.defineProperty(qO,"__esModule",{value:!0});qO.filesDownload=Isn;var Csn=yRe(we()),Osn=Go(),$ae=yRe(Yo()),Psn=ke(),Esn=me(),pLt=Zo(),Tsn=vo(),Asn=yRe(Qu());async function Isn(t,e,r){let n=(0,Esn.safeParse)(e,_=>Asn.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,Osn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,Tsn.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,Psn.compactMap)({Accept:"application/octet-stream"})),l=await(0,pLt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,pLt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_download_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await $ae.match($ae.stream(200,Csn.instanceof(ReadableStream)),$ae.fail("4XX"),$ae.fail("5XX"))(b);return g.ok,g}});var yLt=v(UO=>{"use strict";var Msn=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]}),Rsn=UO&&UO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bRe=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)&&Msn(e,t,r);return Rsn(e,t),e};Object.defineProperty(UO,"__esModule",{value:!0});UO.filesGetSignedUrl=ksn;var hLt=Go(),Bae=bRe(Yo()),jsn=ke(),Dsn=me(),gLt=Zo(),Nsn=vo(),Lsn=bRe(Mn()),Fsn=bRe(Qu());async function ksn(t,e,r){let n=(0,Dsn.safeParse)(e,w=>Fsn.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,hLt.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,Nsn.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,hLt.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,jsn.compactMap)({Accept:"application/json"})),c=await(0,gLt.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,gLt.resolveGlobalSecurity)(d),p={operationID:"files_api_routes_get_signed_url",oAuth2Scopes:[],resolvedSecurity:f,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},m=t._createRequest(p,{security:f,method:"GET",baseURL:r?.serverURL,path:s,headers:l,query:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!m.ok)return m;let h=m.value,b=await t._do(h,{context:p,errorCodes:["4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!b.ok)return b;let g=b.value,[_]=await Bae.match(Bae.json(200,Lsn.FileSignedURL$inboundSchema),Bae.fail("4XX"),Bae.fail("5XX"))(g);return _.ok,_}});var _Lt=v(zO=>{"use strict";var $sn=zO&&zO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Bsn=zO&&zO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Re=zO&&zO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$sn(e,t,r);return Bsn(e,t),e};Object.defineProperty(zO,"__esModule",{value:!0});zO.filesList=Ksn;var qsn=Go(),qae=_Re(Yo()),Usn=ke(),zsn=me(),bLt=Zo(),Hsn=vo(),Vsn=_Re(Mn()),Wsn=_Re(Qu());async function Ksn(t,e,r){let n=(0,zsn.safeParse)(e,_=>Wsn.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,Hsn.pathToFunc)("/v1/files")(),s=(0,qsn.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,Usn.compactMap)({Accept:"application/json"})),l=await(0,bLt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,bLt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_list_files",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await qae.match(qae.json(200,Vsn.ListFilesOut$inboundSchema),qae.fail("4XX"),qae.fail("5XX"))(b);return g.ok,g}});var wLt=v(HO=>{"use strict";var Jsn=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]}),Gsn=HO&&HO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vRe=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)&&Jsn(e,t,r);return Gsn(e,t),e};Object.defineProperty(HO,"__esModule",{value:!0});HO.filesRetrieve=run;var Ysn=Go(),Uae=vRe(Yo()),Zsn=ke(),Xsn=me(),vLt=Zo(),Qsn=vo(),eun=vRe(Mn()),tun=vRe(Qu());async function run(t,e,r){let n=(0,Xsn.safeParse)(e,_=>tun.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,Ysn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,Qsn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,Zsn.compactMap)({Accept:"application/json"})),l=await(0,vLt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,vLt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_retrieve_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Uae.match(Uae.json(200,eun.RetrieveFileOut$inboundSchema),Uae.fail("4XX"),Uae.fail("5XX"))(b);return g.ok,g}});var SLt=v(wRe=>{"use strict";Object.defineProperty(wRe,"__esModule",{value:!0});wRe.isReadableStream=nun;function nun(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 CLt=v(VO=>{"use strict";var oun=VO&&VO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iun=VO&&VO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SRe=VO&&VO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oun(e,t,r);return iun(e,t),e};Object.defineProperty(VO,"__esModule",{value:!0});VO.filesUpload=mun;var zae=Go(),aun=oIe(),Hae=SRe(Yo()),sun=ke(),uun=me(),xLt=Zo(),lun=vo(),cun=SRe(Mn()),dun=SRe(Qu()),fun=CMe(),pun=SLt();async function mun(t,e,r){let n=(0,uun.safeParse)(e,g=>dun.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=new FormData;if((0,fun.isBlobLike)(o.file))(0,zae.appendForm)(i,"file",o.file);else if((0,pun.isReadableStream)(o.file.content)){let g=await(0,aun.readableStreamToArrayBuffer)(o.file.content),_=new Blob([g],{type:"application/octet-stream"});(0,zae.appendForm)(i,"file",_)}else(0,zae.appendForm)(i,"file",new Blob([o.file.content],{type:"application/octet-stream"}),o.file.fileName);o.purpose!==void 0&&(0,zae.appendForm)(i,"purpose",o.purpose);let a=(0,lun.pathToFunc)("/v1/files")(),s=new Headers((0,sun.compactMap)({Accept:"application/json"})),u=await(0,xLt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,xLt.resolveGlobalSecurity)(l),d={operationID:"files_api_routes_upload_file",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[b]=await Hae.match(Hae.json(200,cun.UploadFileOut$inboundSchema),Hae.fail("4XX"),Hae.fail("5XX"))(h);return b.ok,b}});var OLt=v(Vae=>{"use strict";Object.defineProperty(Vae,"__esModule",{value:!0});Vae.Files=void 0;var hun=fLt(),gun=mLt(),yun=yLt(),bun=_Lt(),_un=wLt(),vun=CLt(),wun=Rm(),vq=Vh(),xRe=class extends wun.ClientSDK{async upload(e,r){return(0,vq.unwrapAsync)((0,vun.filesUpload)(this,e,r))}async list(e,r){return(0,vq.unwrapAsync)((0,bun.filesList)(this,e,r))}async retrieve(e,r){return(0,vq.unwrapAsync)((0,_un.filesRetrieve)(this,e,r))}async delete(e,r){return(0,vq.unwrapAsync)((0,hun.filesDelete)(this,e,r))}async download(e,r){return(0,vq.unwrapAsync)((0,gun.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,vq.unwrapAsync)((0,yun.filesGetSignedUrl)(this,e,r))}};Vae.Files=xRe});var TLt=v(WO=>{"use strict";var Sun=WO&&WO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xun=WO&&WO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CRe=WO&&WO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Sun(e,t,r);return xun(e,t),e};Object.defineProperty(WO,"__esModule",{value:!0});WO.fimComplete=Aun;var Cun=Go(),p6=CRe(Yo()),Oun=ke(),Pun=me(),PLt=Zo(),Eun=vo(),ELt=CRe(Mn()),Tun=CRe(Dm());async function Aun(t,e,r){let n=(0,Pun.safeParse)(e,_=>ELt.FIMCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Cun.encodeJSON)("body",o,{explode:!0}),a=(0,Eun.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,Oun.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,PLt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,PLt.resolveGlobalSecurity)(l),d={operationID:"fim_completion_v1_fim_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await p6.match(p6.json(200,ELt.FIMCompletionResponse$inboundSchema),p6.jsonErr(422,Tun.HTTPValidationError$inboundSchema),p6.fail("4XX"),p6.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var MLt=v(KO=>{"use strict";var Iun=KO&&KO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mun=KO&&KO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wae=KO&&KO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Iun(e,t,r);return Mun(e,t),e};Object.defineProperty(KO,"__esModule",{value:!0});KO.fimStream=$un;var Run=Wae(we()),jun=Go(),Dun=J8(),m6=Wae(Yo()),Nun=ke(),Lun=me(),ALt=Zo(),Fun=vo(),ILt=Wae(Mn()),kun=Wae(Dm());async function $un(t,e,r){let n=(0,Lun.safeParse)(e,_=>ILt.FIMCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,jun.encodeJSON)("body",o,{explode:!0}),a=(0,Fun.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,Nun.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,ALt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,ALt.resolveGlobalSecurity)(l),d={operationID:"stream_fim",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,b={HttpMeta:{Response:h,Request:p}},[g]=await m6.match(m6.sse(200,Run.instanceof(ReadableStream).transform(_=>new Dun.EventStream({stream:_,decoder(w){return ILt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),m6.jsonErr(422,kun.HTTPValidationError$inboundSchema),m6.fail("4XX"),m6.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var jLt=v(Kae=>{"use strict";Object.defineProperty(Kae,"__esModule",{value:!0});Kae.Fim=void 0;var qun=TLt(),Uun=MLt(),zun=Rm(),RLt=Vh(),ORe=class extends zun.ClientSDK{async complete(e,r){return(0,RLt.unwrapAsync)((0,qun.fimComplete)(this,e,r))}async stream(e,r){return(0,RLt.unwrapAsync)((0,Uun.fimStream)(this,e,r))}};Kae.Fim=ORe});var NLt=v(JO=>{"use strict";var Hun=JO&&JO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Vun=JO&&JO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PRe=JO&&JO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Hun(e,t,r);return Vun(e,t),e};Object.defineProperty(JO,"__esModule",{value:!0});JO.fineTuningJobsCancel=Xun;var Wun=Go(),Jae=PRe(Yo()),Kun=ke(),Jun=me(),DLt=Zo(),Gun=vo(),Yun=PRe(Mn()),Zun=PRe(Qu());async function Xun(t,e,r){let n=(0,Jun.safeParse)(e,_=>Zun.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,Wun.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Gun.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,Kun.compactMap)({Accept:"application/json"})),l=await(0,DLt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,DLt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_cancel_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Jae.match(Jae.json(200,Yun.DetailedJobOut$inboundSchema),Jae.fail("4XX"),Jae.fail("5XX"))(b);return g.ok,g}});var FLt=v(GO=>{"use strict";var Qun=GO&&GO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eln=GO&&GO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ERe=GO&&GO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Qun(e,t,r);return eln(e,t),e};Object.defineProperty(GO,"__esModule",{value:!0});GO.fineTuningJobsCreate=sln;var tln=Go(),Gae=ERe(Yo()),rln=ke(),nln=me(),LLt=Zo(),oln=vo(),iln=ERe(Mn()),aln=ERe(Qu());async function sln(t,e,r){let n=(0,nln.safeParse)(e,g=>iln.JobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,tln.encodeJSON)("body",o,{explode:!0}),a=(0,oln.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,rln.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,LLt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,LLt.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_fine_tuning_create_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[b]=await Gae.match(Gae.json(200,aln.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),Gae.fail("4XX"),Gae.fail("5XX"))(h);return b.ok,b}});var $Lt=v(YO=>{"use strict";var uln=YO&&YO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lln=YO&&YO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TRe=YO&&YO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uln(e,t,r);return lln(e,t),e};Object.defineProperty(YO,"__esModule",{value:!0});YO.fineTuningJobsGet=gln;var cln=Go(),Yae=TRe(Yo()),dln=ke(),fln=me(),kLt=Zo(),pln=vo(),mln=TRe(Mn()),hln=TRe(Qu());async function gln(t,e,r){let n=(0,fln.safeParse)(e,_=>hln.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,cln.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,pln.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,dln.compactMap)({Accept:"application/json"})),l=await(0,kLt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,kLt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Yae.match(Yae.json(200,mln.DetailedJobOut$inboundSchema),Yae.fail("4XX"),Yae.fail("5XX"))(b);return g.ok,g}});var qLt=v(ZO=>{"use strict";var yln=ZO&&ZO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bln=ZO&&ZO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ARe=ZO&&ZO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yln(e,t,r);return bln(e,t),e};Object.defineProperty(ZO,"__esModule",{value:!0});ZO.fineTuningJobsList=Oln;var _ln=Go(),Zae=ARe(Yo()),vln=ke(),wln=me(),BLt=Zo(),Sln=vo(),xln=ARe(Mn()),Cln=ARe(Qu());async function Oln(t,e,r){let n=(0,wln.safeParse)(e,_=>Cln.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,Sln.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,_ln.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,vln.compactMap)({Accept:"application/json"})),l=await(0,BLt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,BLt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Zae.match(Zae.json(200,xln.JobsOut$inboundSchema),Zae.fail("4XX"),Zae.fail("5XX"))(b);return g.ok,g}});var zLt=v(XO=>{"use strict";var Pln=XO&&XO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Eln=XO&&XO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IRe=XO&&XO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Pln(e,t,r);return Eln(e,t),e};Object.defineProperty(XO,"__esModule",{value:!0});XO.fineTuningJobsStart=Dln;var Tln=Go(),Xae=IRe(Yo()),Aln=ke(),Iln=me(),ULt=Zo(),Mln=vo(),Rln=IRe(Mn()),jln=IRe(Qu());async function Dln(t,e,r){let n=(0,Iln.safeParse)(e,_=>jln.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,Tln.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Mln.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,Aln.compactMap)({Accept:"application/json"})),l=await(0,ULt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ULt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_start_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await Xae.match(Xae.json(200,Rln.DetailedJobOut$inboundSchema),Xae.fail("4XX"),Xae.fail("5XX"))(b);return g.ok,g}});var HLt=v(Qae=>{"use strict";Object.defineProperty(Qae,"__esModule",{value:!0});Qae.Jobs=void 0;var Nln=NLt(),Lln=FLt(),Fln=$Lt(),kln=qLt(),$ln=zLt(),Bln=Rm(),h6=Vh(),MRe=class extends Bln.ClientSDK{async list(e,r){return(0,h6.unwrapAsync)((0,kln.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,h6.unwrapAsync)((0,Lln.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,h6.unwrapAsync)((0,Fln.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,h6.unwrapAsync)((0,Nln.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,h6.unwrapAsync)((0,$ln.fineTuningJobsStart)(this,e,r))}};Qae.Jobs=MRe});var VLt=v(ese=>{"use strict";Object.defineProperty(ese,"__esModule",{value:!0});ese.FineTuning=void 0;var qln=Rm(),Uln=HLt(),RRe=class extends qln.ClientSDK{get jobs(){return this._jobs??(this._jobs=new Uln.Jobs(this._options))}};ese.FineTuning=RRe});var KLt=v(QO=>{"use strict";var zln=QO&&QO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hln=QO&&QO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jRe=QO&&QO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zln(e,t,r);return Hln(e,t),e};Object.defineProperty(QO,"__esModule",{value:!0});QO.modelsArchive=Zln;var Vln=Go(),tse=jRe(Yo()),Wln=ke(),Kln=me(),WLt=Zo(),Jln=vo(),Gln=jRe(Mn()),Yln=jRe(Qu());async function Zln(t,e,r){let n=(0,Kln.safeParse)(e,_=>Yln.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Vln.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Jln.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,Wln.compactMap)({Accept:"application/json"})),l=await(0,WLt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,WLt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_archive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await tse.match(tse.json(200,Gln.ArchiveFTModelOut$inboundSchema),tse.fail("4XX"),tse.fail("5XX"))(b);return g.ok,g}});var GLt=v(eP=>{"use strict";var Xln=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]}),Qln=eP&&eP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rse=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)&&Xln(e,t,r);return Qln(e,t),e};Object.defineProperty(eP,"__esModule",{value:!0});eP.modelsDelete=scn;var ecn=Go(),g6=rse(Yo()),tcn=ke(),rcn=me(),JLt=Zo(),ncn=vo(),ocn=rse(Mn()),icn=rse(Dm()),acn=rse(Qu());async function scn(t,e,r){let n=(0,rcn.safeParse)(e,w=>acn.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,ecn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,ncn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,tcn.compactMap)({Accept:"application/json"})),l=await(0,JLt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,JLt.resolveGlobalSecurity)(c),f={operationID:"delete_model_v1_models__model_id__delete",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,g={HttpMeta:{Response:b,Request:m}},[_]=await g6.match(g6.json(200,ocn.DeleteModelOut$inboundSchema),g6.jsonErr(422,icn.HTTPValidationError$inboundSchema),g6.fail("4XX"),g6.fail("5XX"))(b,{extraFields:g});return _.ok,_}});var ZLt=v(tP=>{"use strict";var ucn=tP&&tP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lcn=tP&&tP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DRe=tP&&tP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ucn(e,t,r);return lcn(e,t),e};Object.defineProperty(tP,"__esModule",{value:!0});tP.modelsList=mcn;var y6=DRe(Yo()),ccn=ke(),YLt=Zo(),dcn=vo(),fcn=DRe(Mn()),pcn=DRe(Dm());async function mcn(t,e){let r=(0,dcn.pathToFunc)("/v1/models")(),n=new Headers((0,ccn.compactMap)({Accept:"application/json"})),o=await(0,YLt.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,YLt.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 y6.match(y6.json(200,fcn.ModelList$inboundSchema),y6.jsonErr(422,pcn.HTTPValidationError$inboundSchema),y6.fail("4XX"),y6.fail("5XX"))(d,{extraFields:f});return p.ok,p}});var eFt=v(rP=>{"use strict";var hcn=rP&&rP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gcn=rP&&rP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NRe=rP&&rP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hcn(e,t,r);return gcn(e,t),e};Object.defineProperty(rP,"__esModule",{value:!0});rP.modelsRetrieve=Scn;var ycn=Go(),b6=NRe(Yo()),bcn=ke(),_cn=me(),XLt=Zo(),vcn=vo(),wcn=NRe(Dm()),QLt=NRe(Qu());async function Scn(t,e,r){let n=(0,_cn.safeParse)(e,w=>QLt.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,ycn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,vcn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,bcn.compactMap)({Accept:"application/json"})),l=await(0,XLt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,XLt.resolveGlobalSecurity)(c),f={operationID:"retrieve_model_v1_models__model_id__get",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,g={HttpMeta:{Response:b,Request:m}},[_]=await b6.match(b6.json(200,QLt.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),b6.jsonErr(422,wcn.HTTPValidationError$inboundSchema),b6.fail("4XX"),b6.fail("5XX"))(b,{extraFields:g});return _.ok,_}});var rFt=v(nP=>{"use strict";var xcn=nP&&nP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ccn=nP&&nP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LRe=nP&&nP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xcn(e,t,r);return Ccn(e,t),e};Object.defineProperty(nP,"__esModule",{value:!0});nP.modelsUnarchive=Mcn;var Ocn=Go(),nse=LRe(Yo()),Pcn=ke(),Ecn=me(),tFt=Zo(),Tcn=vo(),Acn=LRe(Mn()),Icn=LRe(Qu());async function Mcn(t,e,r){let n=(0,Ecn.safeParse)(e,_=>Icn.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Ocn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Tcn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,Pcn.compactMap)({Accept:"application/json"})),l=await(0,tFt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,tFt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_unarchive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await nse.match(nse.json(200,Acn.UnarchiveFTModelOut$inboundSchema),nse.fail("4XX"),nse.fail("5XX"))(b);return g.ok,g}});var iFt=v(oP=>{"use strict";var Rcn=oP&&oP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jcn=oP&&oP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FRe=oP&&oP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rcn(e,t,r);return jcn(e,t),e};Object.defineProperty(oP,"__esModule",{value:!0});oP.modelsUpdate=$cn;var nFt=Go(),ose=FRe(Yo()),Dcn=ke(),Ncn=me(),oFt=Zo(),Lcn=vo(),Fcn=FRe(Mn()),kcn=FRe(Qu());async function $cn(t,e,r){let n=(0,Ncn.safeParse)(e,_=>kcn.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,nFt.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,nFt.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Lcn.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,Dcn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,oFt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,oFt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_update_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"PATCH",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let b=h.value,[g]=await ose.match(ose.json(200,Fcn.FTModelOut$inboundSchema),ose.fail("4XX"),ose.fail("5XX"))(b);return g.ok,g}});var aFt=v(ise=>{"use strict";Object.defineProperty(ise,"__esModule",{value:!0});ise.Models=void 0;var Bcn=KLt(),qcn=GLt(),Ucn=ZLt(),zcn=eFt(),Hcn=rFt(),Vcn=iFt(),Wcn=Rm(),wq=Vh(),kRe=class extends Wcn.ClientSDK{async list(e){return(0,wq.unwrapAsync)((0,Ucn.modelsList)(this,e))}async retrieve(e,r){return(0,wq.unwrapAsync)((0,zcn.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,wq.unwrapAsync)((0,qcn.modelsDelete)(this,e,r))}async update(e,r){return(0,wq.unwrapAsync)((0,Vcn.modelsUpdate)(this,e,r))}async archive(e,r){return(0,wq.unwrapAsync)((0,Bcn.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,wq.unwrapAsync)((0,Hcn.modelsUnarchive)(this,e,r))}};ise.Models=kRe});var sFt=v(ase=>{"use strict";Object.defineProperty(ase,"__esModule",{value:!0});ase.Mistral=void 0;var Kcn=Rm(),Jcn=Zjt(),Gcn=PNt(),Ycn=XNt(),Zcn=aLt(),Xcn=cLt(),Qcn=OLt(),edn=jLt(),tdn=VLt(),rdn=aFt(),$Re=class extends Kcn.ClientSDK{get models(){return this._models??(this._models=new rdn.Models(this._options))}get files(){return this._files??(this._files=new Qcn.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new tdn.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new Gcn.Batch(this._options))}get chat(){return this._chat??(this._chat=new Ycn.Chat(this._options))}get fim(){return this._fim??(this._fim=new edn.Fim(this._options))}get agents(){return this._agents??(this._agents=new Jcn.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new Xcn.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new Zcn.Classifiers(this._options))}};ase.Mistral=$Re});var cFt=v(jp=>{"use strict";var uFt=jp&&jp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ndn=jp&&jp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lFt=jp&&jp.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&uFt(e,t,r)},odn=jp&&jp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uFt(e,t,r);return ndn(e,t),e};Object.defineProperty(jp,"__esModule",{value:!0});jp.files=void 0;lFt(roe(),jp);jp.files=odn(oIe());lFt(sFt(),jp)});var xFt=O(()=>{$P()});var CFt=O(()=>{Rd();xFt();Jp();ym()});var OFt=O(()=>{Mg()});var YRe=O(()=>{ym();HP();Jp();CFt();OFt()});var PFt={};$f(PFt,{AutocompleteCache:()=>E6});var E6,ZRe=O(()=>{mo();E6=class t{constructor(){this.cache=new Map,this.maxSize=200,this.ttlMs=10*60*1e3}static getInstance(){return t.instance||(t.instance=new t),t.instance}get(e){let r=this.cache.get(e);if(r){if(Date.now()-r.timestamp>this.ttlMs){this.cache.delete(e);return}return r.response}}set(e,r){if(this.cache.size>=this.maxSize){let n=this.cache.keys().next().value;this.cache.delete(n)}this.cache.set(e,{response:r,timestamp:Date.now()}),ae(`[AutocompleteCache] Cached response for key: ${e.slice(0,50)}...`)}clear(){this.cache.clear(),ae("[AutocompleteCache] Cleared autocomplete cache")}generateSentenceKey(e,r,n){let o={prefix:e.slice(-100),noteContext:r.slice(-200),relevantNotes:n.slice(0,100)};return`sentence:${JSON.stringify(o)}`}generateWordKey(e,r,n){let o={contextPrefix:e.slice(-50),contextSuffix:r.slice(0,50),words:n.slice(0,5)};return`word:${JSON.stringify(o)}`}getStats(){return{size:this.cache.size,maxSize:this.maxSize,ttlMs:this.ttlMs}}}});var rUt=v((tXo,tUt)=>{"use strict";var Fhn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";tUt.exports=Fhn});var aUt=v((rXo,iUt)=>{"use strict";var khn=rUt();function nUt(){}function oUt(){}oUt.resetWarningCache=nUt;iUt.exports=function(){function t(n,o,i,a,s,u){if(u!==khn){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:oUt,resetWarningCache:nUt};return r.PropTypes=r,r}});var uUt=v((iXo,sUt)=>{sUt.exports=aUt()();var nXo,oXo});var mUt=v(Hje=>{"use strict";Hje.__esModule=!0;Hje.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 s0n={};$f(s0n,{default:()=>Cle});module.exports=Al(s0n);Zr();var lpe=$(tp()),Mze=require("obsidian"),X9=null;function Nz(){return Mze.Platform.isDesktop&&X9||(X9=require("electron")?.remote?.safeStorage),X9}var cpe="enc_desk_",dpe="enc_web_",ppe="enc_",eK="dec_",EXt=new TextEncoder().encode("obsidian-copilot-v1"),Q9={name:"AES-GCM",iv:new Uint8Array(12)};async function fpe(){return await crypto.subtle.importKey("raw",EXt,Q9.name,!1,["encrypt","decrypt"])}async function Rze(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 upe(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await upe(n.apiKey||"")})))),Array.isArray(t.activeEmbeddingModels)&&(e.activeEmbeddingModels=await Promise.all(t.activeEmbeddingModels.map(async n=>({...n,apiKey:await upe(n.apiKey||"")})))),e}async function upe(t){if(!t||t.startsWith(ppe))return t;jze(t)&&(t=t.replace(eK,""));try{if(Nz()?.isEncryptionAvailable()){let o=Nz().encryptString(t);return cpe+o.toString("base64")}let e=await fpe(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(Q9,e,r);return dpe+AXt(n)}catch(e){return console.error("Encryption failed:",e),t}}async function Wn(t){if(!t||TXt(t))return t;if(jze(t))return t.replace(eK,"");if(t.startsWith(cpe)){let r=t.replace(cpe,""),n=lpe.Buffer.from(r,"base64");return Nz().decryptString(n)}if(t.startsWith(dpe)){let r=t.replace(dpe,""),n=await fpe(),o=Ize(r),i=await crypto.subtle.decrypt(Q9,n,o);return new TextDecoder().decode(i)}let e=t.replace(ppe,"");try{if(Nz()?.isEncryptionAvailable())try{let i=lpe.Buffer.from(e,"base64");return Nz().decryptString(i)}catch{}let r=await fpe(),n=Ize(e),o=await crypto.subtle.decrypt(Q9,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function TXt(t){return!t.startsWith(ppe)&&!t.startsWith(eK)}function jze(t){return t.startsWith(eK)}function AXt(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 Ize(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}mo();pf();Jt();Ffe();var Dze=Fx(null),rK=Fx(t=>{let e=t(Dze);return e!==null?e:t(RM).defaultModelKey},(t,e,r)=>{e(Dze,r)}),Nze=Fx(null),nK=Fx(t=>{let e=t(Nze);return e!==null?e:t(RM).defaultChainType},(t,e,r)=>{e(Nze,r)}),tK=Fx(null),Lze=Fx(!1);function Fze(t){cl.set(rK,t)}function oK(){return cl.get(rK)}function kze(t){return cl.sub(rK,t)}function iL(){return U9(rK,{store:cl})}function hb(){return cl.get(nK)}function FM(t){cl.set(nK,t)}function $ze(t){return cl.sub(nK,t)}function Rg(){return U9(nK,{store:cl})}function kM(t){cl.set(tK,t)}function hc(){return cl.get(tK)}function aL(t){return cl.sub(tK,()=>{t(cl.get(tK))})}function XP(t){cl.set(Lze,t)}function Bze(){return U9(Lze,{store:cl})}function $M(){return hb()==="project"}pf();var Pb=$(Y()),THe=require("obsidian"),AHe=$(_c());var PJ=$(Y());var vc=$(Y(),1);var uHe=$(Y(),1);function Mer(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function The(...t){return e=>t.forEach(r=>Mer(r,e))}function yi(...t){return uHe.useCallback(The(...t),t)}var LL=$(St(),1),Sb=vc.forwardRef((t,e)=>{let{children:r,...n}=t,o=vc.Children.toArray(r),i=o.find($er);if(i){let a=i.props.children,s=o.map(u=>u===i?vc.Children.count(a)>1?vc.Children.only(null):vc.isValidElement(a)?a.props.children:null:u);return(0,LL.jsx)(Ahe,{...n,ref:e,children:vc.isValidElement(a)?vc.cloneElement(a,void 0,s):null})}return(0,LL.jsx)(Ahe,{...n,ref:e,children:r})});Sb.displayName="Slot";var Ahe=vc.forwardRef((t,e)=>{let{children:r,...n}=t;if(vc.isValidElement(r)){let o=qer(r);return vc.cloneElement(r,{...Ber(n,r.props),ref:e?The(e,o):o})}return vc.Children.count(r)>1?vc.Children.only(null):null});Ahe.displayName="SlotClone";var ker=({children:t})=>(0,LL.jsx)(LL.Fragment,{children:t});function $er(t){return vc.isValidElement(t)&&t.type===ker}function Ber(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 qer(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 fHe(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=fHe(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function OJ(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=fHe(t))&&(n&&(n+=" "),n+=e);return n}var pHe=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,mHe=OJ,FL=(t,e)=>r=>{var n;if(e?.variants==null)return mHe(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=pHe(c)||pHe(d);return o[l][f]}),s=r&&Object.entries(r).reduce((l,c)=>{let[d,f]=c;return f===void 0||(l[d]=f),l},{}),u=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((l,c)=>{let{class:d,className:f,...p}=c;return Object.entries(p).every(m=>{let[h,b]=m;return Array.isArray(b)?b.includes({...i,...s}[h]):{...i,...s}[h]===b})?[...l,d,f]:l},[]);return mHe(t,a,u,r?.class,r?.className)};var Rhe="-",Uer=t=>{let e=Her(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(Rhe);return s[0]===""&&s.length!==1&&s.shift(),_He(s,e)||zer(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},_He=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?_He(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(Rhe);return e.validators.find(({validator:a})=>a(i))?.classGroupId},hHe=/^\[(.+)\]$/,zer=t=>{if(hHe.test(t)){let e=hHe.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},Her=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return Wer(Object.entries(t.classGroups),r).forEach(([i,a])=>{Mhe(a,n,i,e)}),n},Mhe=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:gHe(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(Ver(o)){Mhe(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{Mhe(a,gHe(e,i),r,n)})})},gHe=(t,e)=>{let r=t;return e.split(Rhe).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Ver=t=>t.isThemeGetter,Wer=(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,Ker=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)}}},vHe="!",Jer=t=>{let{separator:e,experimentalParseClassName:r}=t,n=e.length===1,o=e[0],i=e.length,a=s=>{let u=[],l=0,c=0,d;for(let b=0;b<s.length;b++){let g=s[b];if(l===0){if(g===o&&(n||s.slice(b,b+i)===e)){u.push(s.slice(c,b)),c=b+i;continue}if(g==="/"){d=b;continue}}g==="["?l++:g==="]"&&l--}let f=u.length===0?s:s.substring(c),p=f.startsWith(vHe),m=p?f.substring(1):f,h=d&&d>c?d-c:void 0;return{modifiers:u,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:h}};return r?s=>r({className:s,parseClassName:a}):a},Ger=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},Yer=t=>({cache:Ker(t.cacheSize),parseClassName:Jer(t),...Uer(t)}),Zer=/\s+/,Xer=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split(Zer),s="";for(let u=a.length-1;u>=0;u-=1){let l=a[u],{modifiers:c,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=r(l),m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){s=l+(s.length>0?" "+s:s);continue}if(h=n(f),!h){s=l+(s.length>0?" "+s:s);continue}m=!1}let b=Ger(c).join(":"),g=d?b+vHe:b,_=g+h;if(i.includes(_))continue;i.push(_);let w=o(h,m);for(let x=0;x<w.length;++x){let C=w[x];i.push(g+C)}s=l+(s.length>0?" "+s:s)}return s};function Qer(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=wHe(e))&&(n&&(n+=" "),n+=r);return n}var wHe=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=wHe(t[n]))&&(r&&(r+=" "),r+=e);return r};function yHe(t,...e){let r,n,o,i=a;function a(u){let l=e.reduce((c,d)=>d(c),t());return r=Yer(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=Xer(u,r);return o(u,c),c}return function(){return i(Qer.apply(null,arguments))}}var Ki=t=>{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},SHe=/^\[(?:([a-z-]+):)?(.+)\]$/i,etr=/^\d+\/\d+$/,ttr=new Set(["px","full","screen"]),rtr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ntr=/\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$/,otr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,itr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,atr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,rC=t=>kL(t)||ttr.has(t)||etr.test(t),vE=t=>$L(t,"length",mtr),kL=t=>!!t&&!Number.isNaN(Number(t)),Ihe=t=>$L(t,"number",kL),E2=t=>!!t&&Number.isInteger(Number(t)),str=t=>t.endsWith("%")&&kL(t.slice(0,-1)),Xr=t=>SHe.test(t),wE=t=>rtr.test(t),utr=new Set(["length","size","percentage"]),ltr=t=>$L(t,utr,xHe),ctr=t=>$L(t,"position",xHe),dtr=new Set(["image","url"]),ftr=t=>$L(t,dtr,gtr),ptr=t=>$L(t,"",htr),T2=()=>!0,$L=(t,e,r)=>{let n=SHe.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},mtr=t=>ntr.test(t)&&!otr.test(t),xHe=()=>!1,htr=t=>itr.test(t),gtr=t=>atr.test(t);var bHe=()=>{let t=Ki("colors"),e=Ki("spacing"),r=Ki("blur"),n=Ki("brightness"),o=Ki("borderColor"),i=Ki("borderRadius"),a=Ki("borderSpacing"),s=Ki("borderWidth"),u=Ki("contrast"),l=Ki("grayscale"),c=Ki("hueRotate"),d=Ki("invert"),f=Ki("gap"),p=Ki("gradientColorStops"),m=Ki("gradientColorStopPositions"),h=Ki("inset"),b=Ki("margin"),g=Ki("opacity"),_=Ki("padding"),w=Ki("saturate"),x=Ki("scale"),C=Ki("sepia"),E=Ki("skew"),P=Ki("space"),A=Ki("translate"),I=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",Xr,e],D=()=>[Xr,e],k=()=>["",rC,vE],F=()=>["auto",kL,Xr],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",Xr],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],K=()=>[kL,Xr];return{cacheSize:500,separator:":",theme:{colors:[T2],spacing:[rC,vE],blur:["none","",wE,Xr],brightness:K(),borderColor:[t],borderRadius:["none","","full",wE,Xr],borderSpacing:D(),borderWidth:k(),contrast:K(),grayscale:L(),hueRotate:K(),invert:L(),gap:D(),gradientColorStops:[t],gradientColorStopPositions:[str,vE],inset:j(),margin:j(),opacity:K(),padding:D(),saturate:K(),scale:K(),sepia:L(),skew:K(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",Xr]}],container:["container"],columns:[{columns:[wE]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...B(),Xr]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",E2,Xr]}],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",Xr]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",E2,Xr]}],"grid-cols":[{"grid-cols":[T2]}],"col-start-end":[{col:["auto",{span:["full",E2,Xr]},Xr]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[T2]}],"row-start-end":[{row:["auto",{span:[E2,Xr]},Xr]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Xr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Xr]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"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:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Xr,e]}],"min-w":[{"min-w":[Xr,e,"min","max","fit"]}],"max-w":[{"max-w":[Xr,e,"none","full","min","max","fit","prose",{screen:[wE]},wE]}],h:[{h:[Xr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Xr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Xr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Xr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",wE,vE]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ihe]}],"font-family":[{font:[T2]}],"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",Xr]}],"line-clamp":[{"line-clamp":["none",kL,Ihe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",rC,Xr]}],"list-image":[{"list-image":["none",Xr]}],"list-style-type":[{list:["none","disc","decimal",Xr]}],"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:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",rC,vE]}],"underline-offset":[{"underline-offset":["auto",rC,Xr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Xr]}],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",Xr]}],"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:[...B(),ctr]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",ltr]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ftr]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...q(),"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:q()}],"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:["",...q()]}],"outline-offset":[{"outline-offset":[rC,Xr]}],"outline-w":[{outline:[rC,vE]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:k()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[rC,vE]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",wE,ptr]}],"shadow-color":[{shadow:[T2]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",wE,Xr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Xr]}],duration:[{duration:K()}],ease:[{ease:["linear","in","out","in-out",Xr]}],delay:[{delay:K()}],animate:[{animate:["none","spin","ping","pulse","bounce",Xr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[E2,Xr]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Xr]}],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",Xr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Xr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[rC,vE,Ihe]}],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"]}}},ytr=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{A2(t,"cacheSize",e),A2(t,"prefix",r),A2(t,"separator",n),A2(t,"experimentalParseClassName",o);for(let s in a)btr(t[s],a[s]);for(let s in i)_tr(t[s],i[s]);return t},A2=(t,e,r)=>{r!==void 0&&(t[e]=r)},btr=(t,e)=>{if(e)for(let r in e)A2(t,r,e[r])},_tr=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},CHe=(t,...e)=>typeof t=="function"?yHe(bHe,t,...e):yHe(()=>ytr(bHe(),t),...e);var vtr=CHe({prefix:"tw-",extend:{classGroups:{"text-color":["text-muted","text-success","text-warning","text-error","text-accent"],"font-size":["text-smallest","text-smaller","text-small","text-ui-smaller","text-ui-small","text-ui-medium","text-ui-larger"]}}});function Ce(...t){return vtr(OJ(t))}var wtr=FL("tw-inline-flex tw-items-center tw-justify-center tw-gap-1 tw-whitespace-nowrap tw-rounded-md tw-text-sm tw-font-medium tw-transition-colors focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring disabled:tw-pointer-events-none disabled:tw-opacity-50 [&_svg]:tw-shrink-0",{variants:{variant:{default:"mod-cta tw-bg-interactive-accent tw-text-on-accent tw-shadow hover:tw-bg-interactive-accent-hover",destructive:"clickable-icon tw-bg-modifier-error tw-text-on-accent hover:tw-bg-modifier-error hover:tw-text-on-accent",secondary:"tw-bg-secondary tw-text-normal tw-shadow-sm hover:tw-bg-interactive-hover",ghost:"clickable-icon tw-bg-transparent hover:tw-bg-interactive-accent hover:tw-text-on-accent",link:"tw-text-accent tw-underline-offset-4 hover:tw-underline",success:"clickable-icon tw-bg-modifier-success tw-text-on-accent hover:tw-bg-modifier-success hover:tw-text-on-accent",ghost2:"clickable-icon tw-bg-transparent tw-text-faint tw-outline-none hover:tw-bg-transparent hover:tw-bg-opacity-100 hover:tw-text-normal focus-visible:tw-text-normal focus-visible:tw-outline-none focus-visible:tw-ring-0"},size:{default:"tw-h-9 tw-px-4 tw-py-2",sm:"tw-h-6 tw-rounded-md tw-px-3 tw-text-xs",lg:"tw-h-10 tw-rounded-md tw-px-8",icon:"tw-size-7",fit:"tw-gap-1 tw-px-1 tw-text-xs"}},defaultVariants:{variant:"default",size:"default"}}),he=PJ.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>PJ.createElement(n?Sb:"button",{className:Ce(wtr({variant:e,size:r,className:t})),ref:i,...o}));he.displayName="Button";Zr();var TJ=$(Y());var OHe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),EJ=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();var I2=$(Y());var PHe={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 EHe=(0,I2.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,I2.createElement)("svg",{ref:u,...PHe,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:EJ("lucide",o),...s},[...a.map(([l,c])=>(0,I2.createElement)(l,c)),...Array.isArray(i)?i:[i]]));var _e=(t,e)=>{let r=(0,TJ.forwardRef)(({className:n,...o},i)=>(0,TJ.createElement)(EHe,{ref:i,iconNode:e,className:EJ(`lucide-${OHe(t)}`,n),...o}));return r.displayName=`${t}`,r};var nC=_e("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]]);var M2=_e("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var tR=_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 Nl=_e("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var Di=_e("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var oC=_e("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var qg=_e("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var fa=_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 Ug=_e("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);var SE=_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 xE=_e("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var R2=_e("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var j2=_e("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);var D2=_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 xb=_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 Cb=_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 rm=_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 N2=_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 L2=_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 F2=_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 CE=_e("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);var OE=_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 k2=_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 iC=_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 $2=_e("FileInput",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);var B2=_e("FileOutput",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]]);var aC=_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 nR=_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 zg=_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 PE=_e("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);var q2=_e("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);var U2=_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 iR=_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 z2=_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 aR=_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 sC=_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 Ll=_e("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);var H2=_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 BL=_e("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);var EE=_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 uC=_e("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);var qL=_e("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);var UL=_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 Hg=_e("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var V2=_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 Ob=_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 W2=_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 zL=_e("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);var fh=_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 lC=_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 sp=_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 sR=_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 K2=_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 nm=_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 yf=_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 J2=_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 cC=_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 Ia=_e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);Jt();function Str({onCancel:t}){let e=ne(),r=jhe(e.defaultModelKey)&&jhe(e.embeddingModelKey);return Pb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Pb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Pb.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&Pb.default.createElement("div",{className:"tw-text-sm tw-text-warning"},"The Copilot Plus exclusive models will stop working. You can switch to the default models in the Settings.")),Pb.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},Pb.default.createElement(he,{variant:"ghost",onClick:t},"Close"),Pb.default.createElement(he,{variant:"default",onClick:()=>{uR(zx.EXPIRED_MODAL)}},"Renew Now ",Pb.default.createElement(rR,{className:"tw-size-4"}))))}var AJ=class extends THe.Modal{constructor(e){super(e),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:e}=this;this.root=(0,AHe.createRoot)(e);let r=()=>{this.close()};this.root.render(Pb.default.createElement(Str,{onCancel:r}))}onClose(){this.root.unmount()}};Zr();var Er=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype)}};Zr();Jt();yn();var Wvt=$(yH(),1);fc();OM();ym();lf();ud();function Ls(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return e._def||Object.values(Ur.ZodFirstPartyTypeKind).includes(e.constructor?.name??"NOT_INCLUDED")?!0:typeof e.parse=="function"&&typeof e.parseAsync=="function"&&typeof e.safeParse=="function"&&typeof e.safeParseAsync=="function"}function KOe(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function JOe(t){return t!==void 0&&gn.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function GOe(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(Ls(t.schema)||t.schema!=null&&typeof t.schema=="object"&&"type"in t.schema&&typeof t.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(t.schema.type))}function Ul(t){return GOe(t)||JOe(t)||KOe(t)}fc();pz();pz();function qvt(t){return Ls(t)?po(t):t}function _H(t){if(!t||typeof t!="object"||Object.keys(t).length===0||Array.isArray(t))return!1;if("type"in t)return typeof t.type=="string"?t.type==="string":Array.isArray(t.type)?t.type.every(e=>e==="string"):!1;if("enum"in t)return Array.isArray(t.enum)&&t.enum.length>0&&t.enum.every(e=>typeof e=="string");if("const"in t)return typeof t.const=="string";if("allOf"in t&&Array.isArray(t.allOf))return t.allOf.some(e=>_H(e));if("anyOf"in t&&Array.isArray(t.anyOf)||"oneOf"in t&&Array.isArray(t.oneOf)){let e="anyOf"in t?t.anyOf:t.oneOf;return e.length>0&&e.every(r=>_H(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=Nx(t);return r[e]?_H(r[e]):!1}return!1}function DT(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:qvt(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function SS(t,e){let r=typeof e=="number"?void 0:e,n;return Ul(t)?n={type:"function",function:DT(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}fc();OM();DN();bH();$P();lf();ib();T9();ZU();function YOe(t){let e=[];for(let r of t){let n=r;if(Array.isArray(r.content))for(let o=0;o<r.content.length;o++){let i=r.content[o];(EBe(i)||TBe(i))&&n===r&&(n=new r.constructor({...n,content:[...r.content.slice(0,o),ABe(i),...r.content.slice(o+1)]}))}e.push(n)}return e}var Fs=class t extends Yk{constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models",this._llmType()]}),Object.defineProperty(this,"disableStreaming",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async invoke(e,r){let n=t._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].message}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}async*_streamIterator(e,r){if(this._streamResponseChunks===t.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(e,r);else{let o=t._convertInputToPromptValue(e).toChatMessages(),[i,a]=this._separateRunnableConfigFromCallOptionsCompat(r),s={...i.metadata,...this.getLsParams(a)},u=await Es.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(),[YOe(o)],i.runId,void 0,l,void 0,void 0,i.runName),d,f;try{for await(let p of this._streamResponseChunks(o,a,c?.[0])){if(p.message.id==null){let m=c?.at(0)?.runId;m!=null&&p.message._updateId(`run-${m}`)}p.message.response_metadata={...p.generationInfo,...p.message.response_metadata},yield p.message,d?d=d.concat(p):d=p,ede(p.message)&&p.message.usage_metadata!==void 0&&(f={tokenUsage:{promptTokens:p.message.usage_metadata.input_tokens,completionTokens:p.message.usage_metadata.output_tokens,totalTokens:p.message.usage_metadata.total_tokens}})}}catch(p){throw await Promise.all((c??[]).map(m=>m?.handleLLMError(p))),p}await Promise.all((c??[]).map(p=>p?.handleLLMEnd({generations:[[d]],llmOutput:f})))}}getLsParams(e){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:r}}async _generateUncached(e,r,n,o){let i=e.map(d=>d.map(Eg)),a;if(o!==void 0&&o.length===i.length)a=o;else{let d={...n.metadata,...this.getLsParams(r)},f=await Es.configure(n.callbacks,this.callbacks,n.tags,this.tags,d,this.metadata,{verbose:this.verbose}),p={options:r,invocation_params:this?.invocationParams(r),batch_size:1};a=await f?.handleChatModelStart(this.toJSON(),i.map(YOe),n.runId,void 0,p,void 0,void 0,n.runName)}let s=[],u=[];if(!!a?.[0].handlers.find(Wce)&&!this.disableStreaming&&i.length===1&&this._streamResponseChunks!==t.prototype._streamResponseChunks)try{let d=await this._streamResponseChunks(i[0],r,a?.[0]),f,p;for await(let m of d){if(m.message.id==null){let h=a?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}f===void 0?f=m:f=Il(f,m),ede(m.message)&&m.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:m.message.usage_metadata.input_tokens,completionTokens:m.message.usage_metadata.output_tokens,totalTokens:m.message.usage_metadata.total_tokens}})}if(f===void 0)throw new Error("Received empty response from chat model call.");s.push([f]),await a?.[0].handleLLMEnd({generations:s,llmOutput:p})}catch(d){throw await a?.[0].handleLLMError(d),d}else{let d=await Promise.allSettled(i.map((f,p)=>this._generate(f,{...r,promptIndex:p},a?.[p])));await Promise.all(d.map(async(f,p)=>{if(f.status==="fulfilled"){let m=f.value;for(let h of m.generations){if(h.message.id==null){let b=a?.at(0)?.runId;b!=null&&h.message._updateId(`run-${b}`)}h.message.response_metadata={...h.generationInfo,...h.message.response_metadata}}return m.generations.length===1&&(m.generations[0].message.response_metadata={...m.llmOutput,...m.generations[0].message.response_metadata}),s[p]=m.generations,u[p]=m.llmOutput,a?.[p]?.handleLLMEnd({generations:[m.generations],llmOutput:m.llmOutput})}else return await a?.[p]?.handleLLMError(f.reason),Promise.reject(f.reason)}))}let c={generations:s,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(c,sz,{value:a?{runIds:a?.map(d=>d.runId)}:void 0,configurable:!0}),c}async _generateCached({messages:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i}){let a=e.map(b=>b.map(Eg)),s={...i.metadata,...this.getLsParams(o)},u=await Es.configure(i.callbacks,this.callbacks,i.tags,this.tags,s,this.metadata,{verbose:this.verbose}),l={options:o,invocation_params:this?.invocationParams(o),batch_size:1},c=await u?.handleChatModelStart(this.toJSON(),a.map(YOe),i.runId,void 0,l,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(a.map(async(b,g)=>{let _=t._convertInputToPromptValue(b).toString(),w=await r.lookup(_,n);return w==null&&d.push(g),w}))).map((b,g)=>({result:b,runManager:c?.[g]})).filter(({result:b})=>b.status==="fulfilled"&&b.value!=null||b.status==="rejected"),m=[];await Promise.all(p.map(async({result:b,runManager:g},_)=>{if(b.status==="fulfilled"){let w=b.value;return m[_]=w.map(x=>("message"in x&&Xm(x.message)&&hi(x.message)&&(x.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0}),x.generationInfo={...x.generationInfo,tokenUsage:{}},x)),w.length&&await g?.handleLLMNewToken(w[0].text),g?.handleLLMEnd({generations:[w]},void 0,void 0,void 0,{cached:!0})}else return await g?.handleLLMError(b.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(b.reason)}));let h={generations:m,missingPromptIndices:d,startedRunManagers:c};return Object.defineProperty(h,sz,{value:c?{runIds:c?.map(b=>b.runId)}:void 0,configurable:!0}),h}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(m=>m.map(Eg)),[a,s]=this._separateRunnableConfigFromCallOptionsCompat(o);if(a.callbacks=a.callbacks??n,!this.cache)return this._generateUncached(i,s,a);let{cache:u}=this,l=this._getSerializedCacheKeyParametersForCall(s),{generations:c,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:i,cache:u,llmStringKey:l,parsedOptions:s,handledOptions:a}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>i[h]),s,a,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,b)=>{let g=d[b];c[g]=h;let _=t._convertInputToPromptValue(i[g]).toString();return u.update(_,l,h)})),p=m.llmOutput??{}}return{generations:c,llmOutput:p}}invocationParams(e){return{}}_modelType(){return"base_chat_model"}serialize(){return{...this.invocationParams(),_type:this._llmType(),_model:this._modelType()}}async generatePrompt(e,r,n){let o=e.map(i=>i.toChatMessages());return this.generate(o,r,n)}async call(e,r,n){return(await this.generate([e.map(Eg)],r,n)).generations[0][0].message}async callPrompt(e,r,n){let o=e.toChatMessages();return this.call(o,r,n)}async predictMessages(e,r,n){return this.call(e,r,n)}async predict(e,r,n){let o=new ps(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;Ls(n)?l=[{type:"function",function:{name:u,description:i,parameters:po(n)}}]:("name"in n&&(u=n.name),l=[{type:"function",function:{name:u,description:i,parameters:n}}]);let c=this.bindTools(l),d=uf.from(h=>{if(!h.tool_calls||h.tool_calls.length===0)throw new Error("No tool calls found in the response.");let b=h.tool_calls.find(g=>g.name===u);if(!b)throw new Error(`No tool call found with name ${u}.`);return b.args});if(!s)return c.pipe(d).withConfig({runName:"StructuredOutput"});let f=so.assign({parsed:(h,b)=>d.invoke(h.raw,b)}),p=so.assign({parsed:()=>null}),m=f.withFallbacks({fallbacks:[p]});return si.from([{raw:c},m]).withConfig({runName:"StructuredOutputRunnable"})}};Rd();bM();var Rc=[];for(See=0;See<256;++See)Rc.push((See+256).toString(16).slice(1));var See;function Uvt(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]]).toLowerCase()}var xee,LBr=new Uint8Array(16);function ZOe(){if(!xee&&(xee=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!xee))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return xee(LBr)}var FBr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),XOe={randomUUID:FBr};function kBr(t,e,r){if(XOe.randomUUID&&!e&&!t)return XOe.randomUUID();t=t||{};var n=t.random||(t.rng||ZOe)();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 Uvt(n)}var QOe=kBr;function zvt(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 Cee(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=>hi(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 BBr(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function Hvt(t){return t._getType()==="tool"}function Vvt(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 qBr(t){if(t){if(t.every(BBr))return t;if(t.every(Mc))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:Vvt(e.function.parameters)}));if(t.every(Ul))return t.map(e=>{let r=po(e.schema);return{name:e.name,description:e.description??"",parameterDefinitions:Vvt(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var Oee=class extends Fs{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??et("COHERE_API_KEY");if(!r)throw new Error("No API key provided for ChatCohere.");this.client=new Wvt.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:qBr(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(!(hi(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=Cee(c,s);i.push(d),s=[]}}else i.push(Cee(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=Cee(c,s);i.push(d),s=[]}}else i.push(Cee(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(Hvt(o)){let i=o,a=n.filter(s=>hi(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:zvt(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!Hvt(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>hi(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:zvt(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:QOe().substring(0,32),function:{name:n.name,arguments:n.parameters},type:"function"});return r}_convertCohereToolCallToLangchain(e){return e.map(r=>({name:r.function.name,args:r.function.arguments,id:r.id,type:"tool_call"}))}async _generate(e,r,n){let o={},i=this._getChatRequest(e,r);if(this.streaming){let c=this._streamResponseChunks(e,r,n),d={};for await(let p of c){let m=p.generationInfo?.completion??0;d[m]===void 0?d[m]=p:d[m]=d[m].concat(p)}return{generations:Object.entries(d).sort(([p],[m])=>parseInt(p,10)-parseInt(m,10)).map(([p,m])=>m),llmOutput:{estimatedTokenUsage:o}}}let a=await this.caller.callWithOptions({signal:r.signal},async()=>{let c;try{c=await this.client.chat(i)}catch(d){throw d.status=d.status??d.statusCode,d}return c});if(a.meta?.tokens){let{inputTokens:c,outputTokens:d}=a.meta.tokens;d&&(o.completionTokens=(o.completionTokens??0)+d),c&&(o.promptTokens=(o.promptTokens??0)+c),o.totalTokens=(o.totalTokens??0)+(o.promptTokens??0)+(o.completionTokens??0)}let s={...a};delete s.text,a.toolCalls&&a.toolCalls.length>0&&(s.toolCalls=this._formatCohereToolCalls(a.toolCalls));let u=[];return"toolCalls"in s&&(u=this._convertCohereToolCallToLangchain(s.toolCalls)),{generations:[{text:a.text,message:new fn({content:a.text,additional_kwargs:s,tool_calls:u,usage_metadata:{input_tokens:o.promptTokens??0,output_tokens:o.completionTokens??0,total_tokens:o.totalTokens??0}}),generationInfo:s}],llmOutput:{estimatedTokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=this._getChatRequest(e,r),i=await this.caller.call(async()=>{let a;try{a=await this.client.chatStream(o)}catch(s){throw s.status=s.status??s.statusCode,s}return a});for await(let a of i)if(a.eventType==="text-generation")yield new Ln({text:a.text,message:new or({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new Ln({text:"",message:new or({content:"",additional_kwargs:{...a}}),generationInfo:{...a}});else if(a.eventType==="stream-end"&&(this.streamUsage||r.streamUsage)){let s=a.response.meta?.tokens?.inputTokens??0,u=a.response.meta?.tokens?.outputTokens??0,l={...a.response};a.response.toolCalls&&a.response.toolCalls.length>0&&(l.toolCalls=this._formatCohereToolCalls(a.response.toolCalls));let c=[],d=l.toolCalls??[];d.length>0&&(c=d.map(f=>({name:f.function.name,args:f.function.arguments,id:f.id,index:f.index,type:"tool_call_chunk"}))),yield new Ln({text:"",message:new or({content:"",additional_kwargs:{eventType:"stream-end"},tool_call_chunks:c,usage_metadata:{input_tokens:s,output_tokens:u,total_tokens:s+u}}),generationInfo:{eventType:"stream-end",...l}})}}_combineLLMOutput(...e){return e.reduce((r,n)=>{if(n&&n.estimatedTokenUsage){let o=r.estimatedTokenUsage?.completionTokens??0,i=r.estimatedTokenUsage?.promptTokens??0,a=r.estimatedTokenUsage?.totalTokens??0;o+=n.estimatedTokenUsage.completionTokens??0,i+=n.estimatedTokenUsage.promptTokens??0,a+=n.estimatedTokenUsage.totalTokens??0,r.estimatedTokenUsage={completionTokens:o,promptTokens:i,totalTokens:a}}return r},{estimatedTokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}get lc_secrets(){return{apiKey:"COHERE_API_KEY",api_key:"COHERE_API_KEY"}}get lc_aliases(){return{apiKey:"cohere_api_key",api_key:"cohere_api_key"}}};var UBr=$(yH(),1);OM();DN();$P();bH();ib();ZU();var Jvt=$(yH(),1);NN();var Cf=class{constructor(e){Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.caller=new Vp(e??{})}};var Of=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),a=r[i]||[];return r[i]=a.concat([n]),r},[]);var Pee=class extends Cf{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||et("COHERE_API_KEY");if(!n)throw new Error("Cohere API key not found");if(this.client=new Jvt.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=Of(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 zBr=$(yH(),1);var Gvt;(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(Gvt||(Gvt={}));var Yvt;(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(Yvt||(Yvt={}));var Zvt;(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(Zvt||(Zvt={}));var Xvt=["user","model","function","system"],T1;(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"})(T1||(T1={}));var A1;(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"})(A1||(A1={}));var Qvt;(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(Qvt||(Qvt={}));var ewt;(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(ewt||(ewt={}));var vH;(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"})(vH||(vH={}));var twt;(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"})(twt||(twt={}));var I1;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(I1||(I1={}));var rwt;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(rwt||(rwt={}));var jd=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},NT=class extends jd{constructor(e,r){super(e),this.response=r}},Tee=class extends jd{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},xS=class extends jd{};var HBr="https://generativelanguage.googleapis.com",VBr="v1beta",WBr="0.21.0",KBr="genai-js",M1;(function(t){t.GENERATE_CONTENT="generateContent",t.STREAM_GENERATE_CONTENT="streamGenerateContent",t.COUNT_TOKENS="countTokens",t.EMBED_CONTENT="embedContent",t.BATCH_EMBED_CONTENTS="batchEmbedContents"})(M1||(M1={}));var ePe=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)||VBr,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||HBr}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};function JBr(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${KBr}/${WBr}`),e.join(" ")}async function GBr(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",JBr(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 xS(`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 xS(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new xS(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function YBr(t,e,r,n,o,i){let a=new ePe(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},eqr(i)),{method:"POST",headers:await GBr(a),body:o})}}async function xH(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await YBr(t,e,r,n,o,i);return ZBr(s,u,a)}async function ZBr(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){XBr(o,t)}return n.ok||await QBr(n,t),n}function XBr(t,e){let r=t;throw t instanceof Tee||t instanceof xS||(r=new jd(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function QBr(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 Tee(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function eqr(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 rPe(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.`),Eee(t.candidates[0]))throw new NT(`${LT(t)}`,t);return tqr(t)}else if(t.promptFeedback)throw new NT(`Text not available. ${LT(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.`),Eee(t.candidates[0]))throw new NT(`${LT(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),nwt(t)[0]}else if(t.promptFeedback)throw new NT(`Function call not available. ${LT(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.`),Eee(t.candidates[0]))throw new NT(`${LT(t)}`,t);return nwt(t)}else if(t.promptFeedback)throw new NT(`Function call not available. ${LT(t)}`,t)},t}function tqr(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 nwt(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 rqr=[vH.RECITATION,vH.SAFETY,vH.LANGUAGE];function Eee(t){return!!t.finishReason&&rqr.includes(t.finishReason)}function LT(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];Eee(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function wH(t){return this instanceof wH?(this.v=t,this):new wH(t)}function nqr(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof wH?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 owt=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;function oqr(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=sqr(e),[n,o]=r.tee();return{stream:aqr(n),response:iqr(o)}}async function iqr(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return rPe(uqr(e));e.push(o)}}function aqr(t){return nqr(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield wH(r.read());if(o)break;yield yield wH(rPe(n))}})}function sqr(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 jd("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match(owt),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new jd(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match(owt)}return i()})}}})}function uqr(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 uwt(t,e,r,n){let o=await xH(e,M1.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return oqr(o)}async function lwt(t,e,r,n){let i=await(await xH(e,M1.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:rPe(i)}}function cwt(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 SH(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 lqr(e)}function lqr(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 jd("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 jd("No content is provided for sending chat message.");return n?e:r}function cqr(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 xS("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=SH(t);n.contents=[i]}return{generateContentRequest:n}}function iwt(t){let e;return t.contents?e=t:e={contents:[SH(t)]},t.systemInstruction&&(e.systemInstruction=cwt(t.systemInstruction)),e}function dqr(t){return typeof t=="string"||Array.isArray(t)?{content:SH(t)}:t}var awt=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],fqr={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};function pqr(t){let e=!1;for(let r of t){let{role:n,parts:o}=r;if(!e&&n!=="user")throw new jd(`First content should be with role 'user', got ${n}`);if(!Xvt.includes(n))throw new jd(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(Xvt)}`);if(!Array.isArray(o))throw new jd("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new jd("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 awt)u in s&&(i[u]+=1);let a=fqr[n];for(let s of awt)if(!a.includes(s)&&i[s]>0)throw new jd(`Content with role '${n}' can't contain '${s}' part`);e=!0}}var swt="SILENT_ERROR",tPe=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&&(pqr(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=SH(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(()=>lwt(this._apiKey,this.model,c,d)).then(p=>{var m;if(p.response.candidates&&p.response.candidates.length>0){this._history.push(l);let h=Object.assign({parts:[],role:"model"},(m=p.response.candidates)===null||m===void 0?void 0:m[0].content);this._history.push(h)}else{let h=LT(p.response);h&&console.warn(`sendMessage() was unsuccessful. ${h}. Inspect response object for details.`)}f=p}),await this._sendPromise,f}async sendMessageStream(e,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=SH(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=uwt(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(swt)}).then(p=>p.response).then(p=>{if(p.candidates&&p.candidates.length>0){this._history.push(l);let m=Object.assign({},p.candidates[0].content);m.role||(m.role="model"),this._history.push(m)}else{let m=LT(p);m&&console.warn(`sendMessageStream() was unsuccessful. ${m}. Inspect response object for details.`)}}).catch(p=>{p.message!==swt&&console.error(p)}),f}};async function mqr(t,e,r,n){return(await xH(e,M1.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function hqr(t,e,r,n){return(await xH(e,M1.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function gqr(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await xH(e,M1.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var Aee=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=cwt(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=iwt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return lwt(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=iwt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return uwt(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 tPe(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=cqr(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 mqr(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=dqr(e),o=Object.assign(Object.assign({},this._requestOptions),r);return hqr(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return gqr(this.apiKey,this.model,e,n)}};var R1=class{constructor(e){this.apiKey=e}getGenerativeModel(e,r){if(!e.model)throw new jd("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new Aee(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new xS("Cached content must contain a `name` field.");if(!e.model)throw new xS("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 xS(`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 Aee(this.apiKey,i,n)}};Jp();fc();function Zk(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(Zk):typeof e[r]=="object"&&e[r]!==null&&(e[r]=Zk(e[r])));return e}return t}function Iee(t){let e=Zk(po(t)),{$schema:r,...n}=e;return n}function dwt(t){let e=Zk(t),{$schema:r,...n}=e;return n}Rd();ym();function yqr(t){let e=t._getType();return fs.isInstance(t)?t.role:e==="tool"?e:t.name??e}function bqr(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 _qr(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};throw new Error("Invalid media content")}function vqr(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 _qr(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 nPe(t,e,r=!1){return t.reduce((n,o,i)=>{if(!Xm(o))throw new Error("Unsupported message input");let a=yqr(o);if(a==="system"&&i!==0)throw new Error("System message should be the first one");let s=bqr(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=vqr(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 fwt(t,e){if(!t.candidates||t.candidates.length===0||!t.candidates[0])return{generations:[],llmOutput:{filters:t.promptFeedback}};let r=t.functionCalls(),[n]=t.candidates,{content:o,...i}=n,a;o?.parts.length===1&&o.parts[0].text?a=o.parts[0].text:a=o.parts.map(l=>"text"in l?{type:"text",text:l.text}:"executableCode"in l?{type:"executableCode",executableCode:l.executableCode}:"codeExecutionResult"in l?{type:"codeExecutionResult",codeExecutionResult:l.codeExecutionResult}:l);let s="";return typeof a=="string"?s=a:"text"in a[0]&&(s=a[0].text),{generations:[{text:s,message:new fn({content:a,tool_calls:r?.map(l=>({...l,type:"tool_call"})),additional_kwargs:{...i},usage_metadata:e?.usageMetadata}),generationInfo:i}]}}function pwt(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 Ln({text:s,message:new or({content:a||"",name:o?o.role:void 0,tool_call_chunks:u,additional_kwargs:{},usage_metadata:e.usageMetadata}),generationInfo:i})}function mwt(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(Ul(e)){let r=Iee(e.schema);return{name:e.name,description:e.description,parameters:r}}return Mc(e)?{name:e.function.name,description:e.function.description??"A function available to call.",parameters:dwt(e.function.parameters)}:e})}]}Mg();var CH=class extends PM{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 Wp(`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)}};ym();function oPe(t,e){let r=wqr(t),n=xqr(r,e);return{tools:r,toolConfig:n}}function wqr(t){let e=[],r=[];return t.forEach(o=>{if(Ul(o)){let[i]=mwt([o]);i.functionDeclarations&&e.push(...i.functionDeclarations)}else if(Mc(o)){let{functionDeclarations:i}=Sqr(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 Sqr(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:Zk(t.function.parameters)}]}}function xqr(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:I1.ANY,auto:I1.AUTO,none:I1.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:I1.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var Mee=class extends Fs{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??et("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 R1(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 R1(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:oPe(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?oPe(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=nPe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[c]=o;this.client.systemInstruction=c,i=o.slice(1)}let a=this.invocationParams(r);if(this.streaming){let c={},d=this._streamResponseChunks(e,r,n),f={};for await(let m of d){let h=m.generationInfo?.completion??0;f[h]===void 0?f[h]=m:f[h]=f[h].concat(m)}return{generations:Object.entries(f).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),llmOutput:{estimatedTokenUsage:c}}}let s=await this.completionWithRetry({...a,contents:i}),u;if("usageMetadata"in s.response){let c=s.response.usageMetadata;u={input_tokens:c.promptTokenCount??0,output_tokens:c.candidatesTokenCount??0,total_tokens:c.totalTokenCount??0}}let l=fwt(s.response,{usageMetadata:u});return await n?.handleLLMNewToken(l.generations[0].text??""),l}async*_streamResponseChunks(e,r,n){let o=nPe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[d]=o;this.client.systemInstruction=d,i=o.slice(1)}let s={...this.invocationParams(r),contents:i},u=await this.caller.callWithOptions({signal:r?.signal},async()=>{let{stream:d}=await this.client.generateContentStream(s);return d}),l,c=0;for await(let d of u){if("usageMetadata"in d&&this.streamUsage!==!1&&r.streamUsage!==!1){let p=d.usageMetadata;if(!l)l={input_tokens:p.promptTokenCount,output_tokens:p.candidatesTokenCount,total_tokens:p.totalTokenCount};else{let m=p.candidatesTokenCount-l.output_tokens;l={input_tokens:0,output_tokens:m,total_tokens:m}}}let f=pwt(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(Ls(n)){let m=Iee(n);l=[{functionDeclarations:[{name:s,description:m.description??"A function available to call.",parameters:m}]}],u=new CH({returnSingle:!0,keyName:s,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(m=n,s=n.name):m={name:s,description:n.description??"",parameters:n},l=[{functionDeclarations:[m]}],u=new CH({returnSingle:!0,keyName:s})}let c=this.bind({tools:l,tool_choice:s});if(!a)return c.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let d=so.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=so.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return si.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}};var Ree=class extends Cf{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??et("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 R1(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=Of(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 jc=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},Pf={searchParams:"URLSearchParams"in jc,iterable:"Symbol"in jc&&"iterator"in Symbol,blob:"FileReader"in jc&&"Blob"in jc&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in jc,arrayBuffer:"ArrayBuffer"in jc};function Cqr(t){return t&&DataView.prototype.isPrototypeOf(t)}Pf.arrayBuffer&&(hwt=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],ywt=ArrayBuffer.isView||function(t){return t&&hwt.indexOf(Object.prototype.toString.call(t))>-1});var hwt,ywt;function Xk(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 aPe(t){return typeof t!="string"&&(t=String(t)),t}function sPe(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return Pf.iterable&&(e[Symbol.iterator]=function(){return e}),e}function bl(t){this.map={},t instanceof bl?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)}bl.prototype.append=function(t,e){t=Xk(t),e=aPe(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};bl.prototype.delete=function(t){delete this.map[Xk(t)]};bl.prototype.get=function(t){return t=Xk(t),this.has(t)?this.map[t]:null};bl.prototype.has=function(t){return this.map.hasOwnProperty(Xk(t))};bl.prototype.set=function(t,e){this.map[Xk(t)]=aPe(e)};bl.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};bl.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),sPe(t)};bl.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),sPe(t)};bl.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),sPe(t)};Pf.iterable&&(bl.prototype[Symbol.iterator]=bl.prototype.entries);function iPe(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function bwt(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function Oqr(t){var e=new FileReader,r=bwt(e);return e.readAsArrayBuffer(t),r}function Pqr(t){var e=new FileReader,r=bwt(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function Eqr(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 gwt(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function _wt(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:Pf.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:Pf.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:Pf.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():Pf.arrayBuffer&&Pf.blob&&Cqr(t)?(this._bodyArrayBuffer=gwt(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Pf.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||ywt(t))?this._bodyArrayBuffer=gwt(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):Pf.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},Pf.blob&&(this.blob=function(){var t=iPe(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=iPe(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(Pf.blob)return this.blob().then(Oqr);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var t=iPe(this);if(t)return t;if(this._bodyBlob)return Pqr(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Eqr(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},Pf.formData&&(this.formData=function(){return this.text().then(Iqr)}),this.json=function(){return this.text().then(JSON.parse)},this}var Tqr=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function Aqr(t){var e=t.toUpperCase();return Tqr.indexOf(e)>-1?e:t}function D1(t,e){if(!(this instanceof D1))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 D1){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new bl(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 bl(e.headers)),this.method=Aqr(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in jc){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()}}}D1.prototype.clone=function(){return new D1(this,{body:this._bodyInit})};function Iqr(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 Mqr(t){var e=new bl,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}_wt.call(D1.prototype);function CS(t,e){if(!(this instanceof CS))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 bl(e.headers),this.url=e.url||"",this._initBody(t)}_wt.call(CS.prototype);CS.prototype.clone=function(){return new CS(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new bl(this.headers),url:this.url})};CS.error=function(){var t=new CS(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var Rqr=[301,302,303,307,308];CS.redirect=function(t,e){if(Rqr.indexOf(e)===-1)throw new RangeError("Invalid status code");return new CS(null,{status:e,headers:{location:t}})};var j1=jc.DOMException;try{new j1}catch{j1=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},j1.prototype=Object.create(Error.prototype),j1.prototype.constructor=j1}function vwt(t,e){return new Promise(function(r,n){var o=new D1(t,e);if(o.signal&&o.signal.aborted)return n(new j1("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:Mqr(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 CS(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 j1("Aborted","AbortError"))},0)};function s(l){try{return l===""&&jc.location.href?jc.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&&(Pf.blob?i.responseType="blob":Pf.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof bl||jc.Headers&&e.headers instanceof jc.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(Xk(l)),i.setRequestHeader(l,aPe(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)})}vwt.polyfill=!0;jc.fetch||(jc.fetch=vwt,jc.Headers=bl,jc.Request=D1,jc.Response=CS);var jqr="0.5.14",Swt="11434",xwt=`http://127.0.0.1:${Swt}`,Dqr=Object.defineProperty,Nqr=(t,e,r)=>e in t?Dqr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uPe=(t,e,r)=>(Nqr(t,typeof e!="symbol"?e+"":e,r),r),cPe=class t extends Error{constructor(e,r){super(e),this.error=e,this.status_code=r,this.name="ResponseError",Error.captureStackTrace&&Error.captureStackTrace(this,t)}},dPe=class{constructor(e,r,n){uPe(this,"abortController"),uPe(this,"itr"),uPe(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.")}},fPe=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 cPe(e,t.status)};function Lqr(){if(typeof window<"u"&&window.navigator){let t=navigator;return"userAgentData"in t&&t.userAgentData?.platform?`${t.userAgentData.platform.toLowerCase()} Browser/${navigator.userAgent};`:navigator.platform?`${navigator.platform.toLowerCase()} Browser/${navigator.userAgent};`:`unknown Browser/${navigator.userAgent};`}else if(typeof process<"u")return`${process.arch} ${process.platform} Node.js/${process.version}`;return""}function Fqr(t){if(t instanceof Headers){let e={};return t.forEach((r,n)=>{e[n]=r}),e}else return Array.isArray(t)?Object.fromEntries(t):t||{}}var pPe=async(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${jqr} (${Lqr()})`};r.headers=Fqr(r.headers);let o=Object.fromEntries(Object.entries(r.headers).filter(([i])=>!Object.keys(n).some(a=>a.toLowerCase()===i.toLowerCase())));return r.headers={...n,...o},t(e,r)},wwt=async(t,e,r)=>{let n=await pPe(t,e,{headers:r?.headers});return await fPe(n),n},Qk=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await pPe(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await fPe(a),a},kqr=async(t,e,r,n)=>{let o=await pPe(t,e,{method:"DELETE",body:JSON.stringify(r),headers:n?.headers});return await fPe(o),o},$qr=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)}},Bqr=t=>{if(!t)return xwt;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=Swt);let o=`${r.protocol}//${r.hostname}:${n}${r.pathname}`;return o.endsWith("/")&&(o=o.slice(0,-1)),o},qqr=Object.defineProperty,Uqr=(t,e,r)=>e in t?qqr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lPe=(t,e,r)=>(Uqr(t,typeof e!="symbol"?e+"":e,r),r),e$=class{constructor(e){lPe(this,"config"),lPe(this,"fetch"),lPe(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=Bqr(e?.host??xwt)),this.fetch=e?.fetch??fetch}abort(){for(let e of this.ongoingStreamedRequests)e.abort();this.ongoingStreamedRequests.length=0}async processStreamableRequest(e,r){r.stream=r.stream??!1;let n=`${this.config.host}/api/${e}`;if(r.stream){let i=new AbortController,a=await Qk(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=$qr(a.body),u=new dPe(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await Qk(this.fetch,n,r,{headers:this.config.headers})).json()}async encodeImage(e){if(typeof e!="string"){let r=new Uint8Array(e),n="",o=r.byteLength;for(let i=0;i<o;i++)n+=String.fromCharCode(r[i]);return btoa(n)}return e}async generate(e){return e.images&&(e.images=await Promise.all(e.images.map(this.encodeImage.bind(this)))),this.processStreamableRequest("generate",e)}async chat(e){if(e.messages)for(let r of e.messages)r.images&&(r.images=await Promise.all(r.images.map(this.encodeImage.bind(this))));return this.processStreamableRequest("chat",e)}async create(e){return this.processStreamableRequest("create",{...e})}async pull(e){return this.processStreamableRequest("pull",{name:e.model,stream:e.stream,insecure:e.insecure})}async push(e){return this.processStreamableRequest("push",{name:e.model,stream:e.stream,insecure:e.insecure})}async delete(e){return await kqr(this.fetch,`${this.config.host}/api/delete`,{name:e.model},{headers:this.config.headers}),{status:"success"}}async copy(e){return await Qk(this.fetch,`${this.config.host}/api/copy`,{...e},{headers:this.config.headers}),{status:"success"}}async list(){return await(await wwt(this.fetch,`${this.config.host}/api/tags`,{headers:this.config.headers})).json()}async show(e){return await(await Qk(this.fetch,`${this.config.host}/api/show`,{...e},{headers:this.config.headers})).json()}async embed(e){return await(await Qk(this.fetch,`${this.config.host}/api/embed`,{...e},{headers:this.config.headers})).json()}async embeddings(e){return await(await Qk(this.fetch,`${this.config.host}/api/embeddings`,{...e},{headers:this.config.headers})).json()}async ps(){return await(await wwt(this.fetch,`${this.config.host}/api/ps`,{headers:this.config.headers})).json()}},Abo=new e$;Rd();Jp();ib();Mg();fc();var Dc=[];for(jee=0;jee<256;++jee)Dc.push((jee+256).toString(16).slice(1));var jee;function Cwt(t,e=0){return(Dc[t[e+0]]+Dc[t[e+1]]+Dc[t[e+2]]+Dc[t[e+3]]+"-"+Dc[t[e+4]]+Dc[t[e+5]]+"-"+Dc[t[e+6]]+Dc[t[e+7]]+"-"+Dc[t[e+8]]+Dc[t[e+9]]+"-"+Dc[t[e+10]]+Dc[t[e+11]]+Dc[t[e+12]]+Dc[t[e+13]]+Dc[t[e+14]]+Dc[t[e+15]]).toLowerCase()}var Dee,zqr=new Uint8Array(16);function mPe(){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(zqr)}var Hqr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),hPe={randomUUID:Hqr};function Vqr(t,e,r){if(hPe.randomUUID&&!e&&!t)return hPe.randomUUID();t=t||{};var n=t.random||(t.rng||mPe)();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 Cwt(n)}var gPe=Vqr;function yPe(t,e){return new or({content:t.content??"",tool_call_chunks:t.tool_calls?.map(r=>({name:r.function.name,args:JSON.stringify(r.function.arguments),type:"tool_call_chunk",index:0,id:gPe()})),response_metadata:e?.responseMetadata,usage_metadata:e?.usageMetadata})}function Owt(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function Wqr(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 Kqr(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:[Owt(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[Owt(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function Jqr(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 Gqr(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function Pwt(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return Kqr(e);if(e._getType()==="ai")return Wqr(e);if(e._getType()==="system")return Jqr(e);if(e._getType()==="tool")return Gqr(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var Nee=class extends Fs{static lc_name(){return"ChatOllama"}constructor(e){super(e??{}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"llama3"}),Object.defineProperty(this,"numa",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numBatch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numGpu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mainGpu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lowVram",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"f16Kv",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logitsAll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"vocabOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useMmap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useMlock",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"embeddingOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numThread",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numKeep",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"seed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numPredict",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topK",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tfsZ",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"typicalP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"repeatLastN",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"repeatPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mirostat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mirostatTau",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mirostatEta",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"penalizeNewline",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"format",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"checkOrPullModel",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:"http://127.0.0.1:11434"}),this.client=new e$({host:e?.baseUrl,headers:e?.headers}),this.baseUrl=e?.baseUrl??this.baseUrl,this.model=e?.model??this.model,this.numa=e?.numa,this.numCtx=e?.numCtx,this.numBatch=e?.numBatch,this.numGpu=e?.numGpu,this.mainGpu=e?.mainGpu,this.lowVram=e?.lowVram,this.f16Kv=e?.f16Kv,this.logitsAll=e?.logitsAll,this.vocabOnly=e?.vocabOnly,this.useMmap=e?.useMmap,this.useMlock=e?.useMlock,this.embeddingOnly=e?.embeddingOnly,this.numThread=e?.numThread,this.numKeep=e?.numKeep,this.seed=e?.seed,this.numPredict=e?.numPredict,this.topK=e?.topK,this.topP=e?.topP,this.tfsZ=e?.tfsZ,this.typicalP=e?.typicalP,this.repeatLastN=e?.repeatLastN,this.temperature=e?.temperature,this.repeatPenalty=e?.repeatPenalty,this.presencePenalty=e?.presencePenalty,this.frequencyPenalty=e?.frequencyPenalty,this.mirostat=e?.mirostat,this.mirostatTau=e?.mirostatTau,this.mirostatEta=e?.mirostatEta,this.penalizeNewline=e?.penalizeNewline,this.streaming=e?.streaming,this.format=e?.format,this.keepAlive=e?.keepAlive,this.checkOrPullModel=e?.checkOrPullModel??this.checkOrPullModel}_llmType(){return"ollama"}async pull(e,r){let{stream:n,insecure:o,logProgress:i}={stream:!0,...r};if(n)for await(let a of await this.client.pull({model:e,insecure:o,stream:n}))i&&console.log(a);else{let a=await this.client.pull({model:e,insecure:o});i&&console.log(a)}}bindTools(e,r){return this.bind({tools:e.map(n=>SS(n)),...r})}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"ollama",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.options?.temperature??void 0,ls_max_tokens:r.options?.num_predict??void 0,ls_stop:e.stop}}invocationParams(e){if(e?.tool_choice)throw new Error("Tool choice is not supported for ChatOllama.");return{model:this.model,format:e?.format??this.format,keep_alive:this.keepAlive,options:{numa:this.numa,num_ctx:this.numCtx,num_batch:this.numBatch,num_gpu:this.numGpu,main_gpu:this.mainGpu,low_vram:this.lowVram,f16_kv:this.f16Kv,logits_all:this.logitsAll,vocab_only:this.vocabOnly,use_mmap:this.useMmap,use_mlock:this.useMlock,embedding_only:this.embeddingOnly,num_thread:this.numThread,num_keep:this.numKeep,seed:this.seed,num_predict:this.numPredict,top_k:this.topK,top_p:this.topP,tfs_z:this.tfsZ,typical_p:this.typicalP,repeat_last_n:this.repeatLastN,temperature:this.temperature,repeat_penalty:this.repeatPenalty,presence_penalty:this.presencePenalty,frequency_penalty:this.frequencyPenalty,mirostat:this.mirostat,mirostat_tau:this.mirostatTau,mirostat_eta:this.mirostatEta,penalize_newline:this.penalizeNewline,stop:e?.stop},tools:e?.tools?.length?e.tools.map(r=>SS(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=Il(o,a.message):o=a.message;let i=new fn({id:o?.id,content:o?.content??"",tool_calls:o?.tool_calls,response_metadata:o?.response_metadata,usage_metadata:o?.usage_metadata});return{generations:[{text:typeof i.content=="string"?i.content:"",message:i}]}}async*_streamResponseChunks(e,r,n){this.checkOrPullModel&&(await this.checkModelExistsOnMachine(this.model)||await this.pull(this.model,{logProgress:!0}));let o=this.invocationParams(r),i=Pwt(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 Ln({text:c.content,message:yPe(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 Ln({text:c.content??"",message:yPe(c)}),await n?.handleLLMNewToken(c.content??"")}yield new Ln({text:"",message:new or({content:"",response_metadata:u,usage_metadata:a})})}withStructuredOutput(e,r){if(r?.method===void 0||r?.method==="jsonSchema"){let n=Ls(e),o=n?po(e):e,i=this.bind({format:o}),a=n?pc.fromZodSchema(e):new mc;if(!r?.includeRaw)return i.pipe(a);let s=so.assign({parsed:(c,d)=>a.invoke(c.raw,d)}),u=so.assign({parsed:()=>null}),l=s.withFallbacks({fallbacks:[u]});return si.from([{raw:i},l])}else return super.withStructuredOutput(e,r)}};var Lee=class extends Cf{constructor(e){super({maxConcurrency:1,...e}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"mxbai-embed-large"}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:"http://localhost:11434"}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requestOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"truncate",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.client=new e$({host:e?.baseUrl,headers:e?.headers?new Headers(e.headers):void 0}),this.baseUrl=e?.baseUrl??this.baseUrl,this.model=e?.model??this.model,this.keepAlive=e?.keepAlive,this.truncate=e?.truncate??this.truncate,this.requestOptions=e?.requestOptions?this._convertOptions(e?.requestOptions):void 0}_convertOptions(e){let r={},n={embeddingOnly:"embedding_only",frequencyPenalty:"frequency_penalty",keepAlive:"keep_alive",logitsAll:"logits_all",lowVram:"low_vram",mainGpu:"main_gpu",mirostat:"mirostat",mirostatEta:"mirostat_eta",mirostatTau:"mirostat_tau",numBatch:"num_batch",numCtx:"num_ctx",numGpu:"num_gpu",numKeep:"num_keep",numPredict:"num_predict",numThread:"num_thread",penalizeNewline:"penalize_newline",presencePenalty:"presence_penalty",repeatLastN:"repeat_last_n",repeatPenalty:"repeat_penalty",temperature:"temperature",stop:"stop",tfsZ:"tfs_z",topK:"top_k",topP:"top_p",typicalP:"typical_p",useMlock:"use_mlock",useMmap:"use_mmap",vocabOnly:"vocab_only",f16Kv:"f16_kv",numa:"numa",seed:"seed"};for(let[o,i]of Object.entries(e)){let a=n[o];a?r[a]=i:r[o]=i}return r}async embedDocuments(e){return this.embeddingWithRetry(e)}async embedQuery(e){return(await this.embeddingWithRetry([e]))[0]}async embeddingWithRetry(e){return(await this.caller.call(()=>this.client.embed({model:this.model,input:e,keep_alive:this.keepAlive,options:this.requestOptions,truncate:this.truncate}))).embeddings}};Rd();var Fee="RFC3986",kee={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},Ewt="RFC1738";var Yqr=Array.isArray,OS=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var bPe=1024,Twt=(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+=bPe){let u=i.length>=bPe?i.slice(s,s+bPe):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===Ewt&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=OS[d];continue}if(d<2048){l[l.length]=OS[192|d>>6]+OS[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=OS[224|d>>12]+OS[128|d>>6&63]+OS[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=OS[240|d>>18]+OS[128|d>>12&63]+OS[128|d>>6&63]+OS[128|d&63]}a+=l.join("")}return a};function Awt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function _Pe(t,e){if(Yqr(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var Zqr=Object.prototype.hasOwnProperty,Iwt={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},PS=Array.isArray,Xqr=Array.prototype.push,Mwt=function(t,e){Xqr.apply(t,PS(e)?e:[e])},Qqr=Date.prototype.toISOString,_l={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Twt,encodeValuesOnly:!1,format:Fee,formatter:kee[Fee],indices:!1,serializeDate(t){return Qqr.call(t)},skipNulls:!1,strictNullHandling:!1};function eUr(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var vPe={};function Rwt(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,b,g){let _=t,w=g,x=0,C=!1;for(;(w=w.get(vPe))!==void 0&&!C;){let R=w.get(t);if(x+=1,typeof R<"u"){if(R===x)throw new RangeError("Cyclic object value");C=!0}typeof w.get(vPe)>"u"&&(x=0)}if(typeof l=="function"?_=l(e,_):_ instanceof Date?_=f?.(_):r==="comma"&&PS(_)&&(_=_Pe(_,function(R){return R instanceof Date?f?.(R):R})),_===null){if(i)return u&&!h?u(e,_l.encoder,b,"key",p):e;_=""}if(eUr(_)||Awt(_)){if(u){let R=h?e:u(e,_l.encoder,b,"key",p);return[m?.(R)+"="+m?.(u(_,_l.encoder,b,"value",p))]}return[m?.(e)+"="+m?.(String(_))]}let E=[];if(typeof _>"u")return E;let P;if(r==="comma"&&PS(_))h&&u&&(_=_Pe(_,u)),P=[{value:_.length>0?_.join(",")||null:void 0}];else if(PS(l))P=l;else{let R=Object.keys(_);P=c?R.sort(c):R}let A=s?String(e).replace(/\./g,"%2E"):String(e),I=n&&PS(_)&&_.length===1?A+"[]":A;if(o&&PS(_)&&_.length===0)return I+"[]";for(let R=0;R<P.length;++R){let j=P[R],D=typeof j=="object"&&typeof j.value<"u"?j.value:_[j];if(a&&D===null)continue;let k=d&&s?j.replace(/\./g,"%2E"):j,F=PS(_)?typeof r=="function"?r(I,k):I:I+(d?"."+k:"["+k+"]");g.set(t,x);let B=new WeakMap;B.set(vPe,g),Mwt(E,Rwt(D,F,r,n,o,i,a,s,r==="comma"&&h&&PS(_)?null:u,l,c,d,f,p,m,h,b,B))}return E}function tUr(t=_l){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||_l.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=Fee;if(typeof t.format<"u"){if(!Zqr.call(kee,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=kee[r],o=_l.filter;(typeof t.filter=="function"||PS(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in Iwt?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=_l.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:_l.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:_l.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:_l.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:_l.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?_l.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:_l.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:_l.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:_l.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:_l.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:_l.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:_l.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:_l.strictNullHandling}}function wPe(t,e={}){let r=t,n=tUr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):PS(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=Iwt[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||Mwt(a,Rwt(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 N1="4.95.1";var jwt=!1,L1,SPe,nUr,oUr,iUr,xPe,aUr,$ee,CPe,OPe,PPe,Bee,EPe;function Dwt(t,e={auto:!1}){if(jwt)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(L1)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${L1}'\``);jwt=e.auto,L1=t.kind,SPe=t.fetch,nUr=t.Request,oUr=t.Response,iUr=t.Headers,xPe=t.FormData,aUr=t.Blob,$ee=t.File,CPe=t.ReadableStream,OPe=t.getMultipartRequestOptions,PPe=t.getDefaultAgent,Bee=t.fileFromPath,EPe=t.isFsReadStream}var qee=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function Nwt({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 qee(a)}),getDefaultAgent:a=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads")},isFsReadStream:a=>!1}}var TPe=()=>{L1||Dwt(Nwt(),{auto:!0})};TPe();var ft=class extends Error{},ks=class t extends ft{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.request_id=o?.["x-request-id"],this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new WC({message:n,cause:Uee(r)});let i=r?.error;return e===400?new t$(e,i,n,o):e===401?new r$(e,i,n,o):e===403?new n$(e,i,n,o):e===404?new o$(e,i,n,o):e===409?new i$(e,i,n,o):e===422?new a$(e,i,n,o):e===429?new s$(e,i,n,o):e>=500?new u$(e,i,n,o):new t(e,i,n,o)}},Pi=class extends ks{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},WC=class extends ks{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Ef=class extends WC{constructor({message:e}={}){super({message:e??"Request timed out."})}},t$=class extends ks{},r$=class extends ks{},n$=class extends ks{},o$=class extends ks{},i$=class extends ks{},a$=class extends ks{},s$=class extends ks{},u$=class extends ks{},l$=class extends ft{constructor(){super("Could not parse response content as the length limit was reached")}},c$=class extends ft{constructor(){super("Could not parse response content as the request was rejected by the content filter")}};var zee=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},F1=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)},bm,k1=class{constructor(){bm.set(this,void 0),this.buffer=new Uint8Array,zee(this,bm,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?new TextEncoder().encode(e):e,n=new Uint8Array(this.buffer.length+r.length);n.set(this.buffer),n.set(r,this.buffer.length),this.buffer=n;let o=[],i;for(;(i=lUr(this.buffer,F1(this,bm,"f")))!=null;){if(i.carriage&&F1(this,bm,"f")==null){zee(this,bm,i.index,"f");continue}if(F1(this,bm,"f")!=null&&(i.index!==F1(this,bm,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,F1(this,bm,"f")-1))),this.buffer=this.buffer.slice(F1(this,bm,"f")),zee(this,bm,null,"f");continue}let a=F1(this,bm,"f")!==null?i.preceding-1:i.preceding,s=this.decodeText(this.buffer.slice(0,a));o.push(s),this.buffer=this.buffer.slice(i.index),zee(this,bm,null,"f")}return o}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new ft(`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 ft(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new ft("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
`):[]}};bm=new WeakMap;k1.NEWLINE_CHARS=new Set([`
`,"\r"]);k1.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function lUr(t,e){for(let o=e??0;o<t.length;o++){if(t[o]===10)return{preceding:o,index:o+1,carriage:!1};if(t[o]===13)return{preceding:o,index:o+1,carriage:!0}}return null}function Lwt(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}function APe(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 ES=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;async function*o(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let i=!1;try{for await(let a of cUr(e,r))if(!i){if(a.data.startsWith("[DONE]")){i=!0;continue}if(a.event===null||a.event.startsWith("response.")||a.event.startsWith("transcript.")){let s;try{s=JSON.parse(a.data)}catch(u){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),u}if(s&&s.error)throw new ks(void 0,s.error,void 0,MPe(e.headers));yield s}else{let s;try{s=JSON.parse(a.data)}catch(u){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),u}if(a.event=="error")throw new ks(void 0,s.error,s.message,void 0);yield{event:a.event,data:s}}}i=!0}catch(a){if(a instanceof Error&&a.name==="AbortError")return;throw a}finally{i||r.abort()}}return new t(o,r)}static fromReadableStream(e,r){let n=!1;async function*o(){let a=new k1,s=APe(e);for await(let u of s)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let s of o())a||s&&(yield JSON.parse(s));a=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{a||r.abort()}}return new t(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller),new t(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new CPe({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*cUr(t,e){if(!t.body)throw e.abort(),new ft("Attempted to iterate over a response with no body");let r=new IPe,n=new k1,o=APe(t.body);for await(let i of dUr(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*dUr(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=Lwt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var IPe=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]=fUr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function fUr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var Fwt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",kwt=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&OH(t),OH=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",pUr=t=>kwt(t)||Fwt(t)||EPe(t);async function DPe(t,e,r){if(t=await t,kwt(t))return t;if(Fwt(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=OH(o)?[await o.arrayBuffer()]:[o];return new $ee(i,e,r)}let n=await mUr(t);if(e||(e=gUr(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new $ee(n,e,r)}async function mUr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(OH(t))e.push(await t.arrayBuffer());else if(yUr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${hUr(t)}`);return e}function hUr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function gUr(t){return RPe(t.name)||RPe(t.filename)||RPe(t.path)?.split(/[\\/]/).pop()}var RPe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},yUr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",NPe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var Rh=async t=>{let e=await $wt(t.body);return OPe(e,t)},$wt=async t=>{let e=new xPe;return await Promise.all(Object.entries(t||{}).map(([r,n])=>jPe(e,r,n))),e};var jPe=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(pUr(r)){let n=await DPe(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>jPe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>jPe(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 _Ur=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},vUr=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)},Hee;TPe();async function Vwt(t){let{response:e}=t;if(t.options.stream)return KC("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):ES.fromSSEResponse(e,t.controller);if(e.status===204)return null;if(t.options.__binaryResponse)return e;let n=e.headers.get("content-type")?.split(";")[0]?.trim();if(n?.includes("application/json")||n?.endsWith("+json")){let a=await e.json();return KC("response",e.status,e.url,e.headers,a),Wwt(a,e)}let i=await e.text();return KC("response",e.status,e.url,e.headers,i),i}function Wwt(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 Wee=class t extends Promise{constructor(e,r=Vwt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>Wwt(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)}},Kee=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=LPe("maxRetries",r),this.timeout=LPe("timeout",n),this.httpAgent=o,this.fetch=i??SPe}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...CUr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${TUr()}`}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&&OH(o?.body)?new DataView(await o.body.arrayBuffer()):o?.body instanceof DataView?o.body:o?.body instanceof ArrayBuffer?new DataView(o.body):o&&ArrayBuffer.isView(o?.body)?new DataView(o.body.buffer):o?.body;return{method:e,path:r,...o,body:i}}))}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:a,headers:s={}}=n,u=ArrayBuffer.isView(n.body)||n.__binaryRequest&&typeof n.body=="string"?n.body:NPe(n.body)?n.body.body:n.body?JSON.stringify(n.body,null,2):null,l=this.calculateContentLength(u),c=this.buildURL(i,a);"timeout"in n&&LPe("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let d=n.httpAgent??this.httpAgent??PPe(c),f=n.timeout+1e3;typeof d?.options?.timeout=="number"&&f>(d.options.timeout??0)&&(d.options.timeout=f),this.idempotencyHeader&&o!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=e.idempotencyKey);let p=this.buildHeaders({options:n,headers:s,contentLength:l,retryCount:r});return{req:{method:o,...u&&{body:u},headers:p,...d&&{agent:d},signal:n.signal??null},url:c,timeout:n.timeout}}buildHeaders({options:e,headers:r,contentLength:n,retryCount:o}){let i={};n&&(i["content-length"]=n);let a=this.defaultHeaders(e);return zwt(i,a),zwt(i,r),NPe(e.body)&&L1!=="node"&&delete i["content-type"],Vee(a,"x-stainless-retry-count")===void 0&&Vee(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),Vee(a,"x-stainless-timeout")===void 0&&Vee(r,"x-stainless-timeout")===void 0&&e.timeout&&(i["x-stainless-timeout"]=String(Math.trunc(e.timeout/1e3))),this.validateHeaders(i,r),i}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(r=>[...r])):{...e}:{}}makeStatusError(e,r,n,o){return ks.generate(e,r,n,o)}request(e,r=null){return new Wee(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}),KC("request",a,n,i.headers),n.signal?.aborted)throw new Pi;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(Uee);if(l instanceof Error){if(n.signal?.aborted)throw new Pi;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new Ef:new WC({cause:l})}let c=MPe(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let b=`retrying, ${r} attempts remaining`;return KC(`response (error; ${b})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(b=>Uee(b).message),f=OUr(d),p=f?void 0:d;throw KC(`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 FPe(this,n,e)}buildURL(e,r){let n=EUr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return Kwt(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 ft(`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 JC(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 ${N1}`}},PH=class{constructor(e,r,n,o){Hee.set(this,void 0),_Ur(this,Hee,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 ft("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 vUr(this,Hee,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Hee=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},FPe=class extends Wee{constructor(e,r,n){super(r,async o=>new n(e,o.response,await Vwt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},MPe=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),wUr={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},Vr=t=>typeof t=="object"&&t!==null&&!Kwt(t)&&Object.keys(t).every(e=>Jwt(wUr,e)),SUr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":N1,"X-Stainless-OS":qwt(Deno.build.os),"X-Stainless-Arch":Bwt(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":N1,"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":N1,"X-Stainless-OS":qwt(process.platform),"X-Stainless-Arch":Bwt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=xUr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":N1,"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":N1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function xUr(){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 Bwt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",qwt=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"),Uwt,CUr=()=>Uwt??(Uwt=SUr()),OUr=t=>{try{return JSON.parse(t)}catch{return}},PUr=/^[a-z][a-z0-9+.-]*:/i,EUr=t=>PUr.test(t),JC=t=>new Promise(e=>setTimeout(e,t)),LPe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new ft(`${t} must be an integer`);if(e<0)throw new ft(`${t} must be a positive integer`);return e},Uee=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 FT=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function Kwt(t){if(!t)return!0;for(let e in t)return!1;return!0}function Jwt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function zwt(t,e){for(let r in e){if(!Jwt(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 Hwt=new Set(["authorization","api-key"]);function KC(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)Hwt.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)Hwt.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${t}`,...r)}}var TUr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),Gwt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",AUr=t=>typeof t?.get=="function";var Vee=(t,e)=>{let r=e.toLowerCase();if(AUr(t)){let n=e[0]?.toUpperCase()+e.substring(1).replace(/([^\w])(\w)/g,(o,i,a)=>i+a.toUpperCase());for(let o of[e,r,e.toUpperCase(),n]){let i=t.get(o);if(i)return i}}for(let[n,o]of Object.entries(t))if(n.toLowerCase()===r)return Array.isArray(o)?(o.length<=1||console.warn(`Received ${o.length} entries for the ${e} header, using the first entry.`),o[0]):o};var Ywt=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=e.charCodeAt(o);return Array.from(new Float32Array(n.buffer))}};function d$(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var TS=class extends PH{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}},Gn=class extends PH{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageParams(){let e=this.nextPageInfo();if(!e)return null;if("params"in e)return e.params;let r=Object.fromEntries(e.url.searchParams);return Object.keys(r).length?r:null}nextPageInfo(){let e=this.getPaginatedItems();if(!e.length)return null;let r=e[e.length-1]?.id;return r?{params:{after:r}}:null}};var Ze=class{constructor(e){this._client=e}};var f$=class extends Ze{list(e,r={},n){return Vr(r)?this.list(e,{},r):this._client.getAPIList(`/chat/completions/${e}/messages`,Jee,{query:r,...n})}};var $T=class extends Ze{constructor(){super(...arguments),this.messages=new f$(this._client)}create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1})}retrieve(e,r){return this._client.get(`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return Vr(e)?this.list({},e):this._client.getAPIList("/chat/completions",BT,{query:e,...r})}del(e,r){return this._client.delete(`/chat/completions/${e}`,r)}},BT=class extends Gn{},Jee=class extends Gn{};$T.ChatCompletionsPage=BT;$T.Messages=f$;var GC=class extends Ze{constructor(){super(...arguments),this.completions=new $T(this._client)}};GC.Completions=$T;GC.ChatCompletionsPage=BT;var p$=class extends Ze{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}};var m$=class extends Ze{create(e,r){return this._client.post("/audio/transcriptions",Rh({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}}))}};var h$=class extends Ze{create(e,r){return this._client.post("/audio/translations",Rh({body:e,...r,__metadata:{model:e.model}}))}};var AS=class extends Ze{constructor(){super(...arguments),this.transcriptions=new m$(this._client),this.translations=new h$(this._client),this.speech=new p$(this._client)}};AS.Transcriptions=m$;AS.Translations=h$;AS.Speech=p$;var qT=class extends Ze{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 Vr(e)?this.list({},e):this._client.getAPIList("/batches",$1,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},$1=class extends Gn{};qT.BatchesPage=$1;var B1=class extends Ze{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 Vr(e)?this.list({},e):this._client.getAPIList("/assistants",g$,{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}})}},g$=class extends Gn{};B1.AssistantsPage=g$;function kPe(t){return typeof t.parse=="function"}var UT=t=>t?.role==="assistant",$Pe=t=>t?.role==="function",BPe=t=>t?.role==="tool";var sy=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},Ba=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)},qPe,Gee,Yee,EH,TH,Zee,AH,YC,IH,Xee,Qee,y$,Zwt,zT=class{constructor(){qPe.add(this),this.controller=new AbortController,Gee.set(this,void 0),Yee.set(this,()=>{}),EH.set(this,()=>{}),TH.set(this,void 0),Zee.set(this,()=>{}),AH.set(this,()=>{}),YC.set(this,{}),IH.set(this,!1),Xee.set(this,!1),Qee.set(this,!1),y$.set(this,!1),sy(this,Gee,new Promise((e,r)=>{sy(this,Yee,e,"f"),sy(this,EH,r,"f")}),"f"),sy(this,TH,new Promise((e,r)=>{sy(this,Zee,e,"f"),sy(this,AH,r,"f")}),"f"),Ba(this,Gee,"f").catch(()=>{}),Ba(this,TH,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},Ba(this,qPe,"m",Zwt).bind(this))},0)}_connected(){this.ended||(Ba(this,Yee,"f").call(this),this._emit("connect"))}get ended(){return Ba(this,IH,"f")}get errored(){return Ba(this,Xee,"f")}get aborted(){return Ba(this,Qee,"f")}abort(){this.controller.abort()}on(e,r){return(Ba(this,YC,"f")[e]||(Ba(this,YC,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Ba(this,YC,"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(Ba(this,YC,"f")[e]||(Ba(this,YC,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{sy(this,y$,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){sy(this,y$,!0,"f"),await Ba(this,TH,"f")}_emit(e,...r){if(Ba(this,IH,"f"))return;e==="end"&&(sy(this,IH,!0,"f"),Ba(this,Zee,"f").call(this));let n=Ba(this,YC,"f")[e];if(n&&(Ba(this,YC,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Ba(this,y$,"f")&&!n?.length&&Promise.reject(o),Ba(this,EH,"f").call(this,o),Ba(this,AH,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Ba(this,y$,"f")&&!n?.length&&Promise.reject(o),Ba(this,EH,"f").call(this,o),Ba(this,AH,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Gee=new WeakMap,Yee=new WeakMap,EH=new WeakMap,TH=new WeakMap,Zee=new WeakMap,AH=new WeakMap,YC=new WeakMap,IH=new WeakMap,Xee=new WeakMap,Qee=new WeakMap,y$=new WeakMap,qPe=new WeakSet,Zwt=function(e){if(sy(this,Xee,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Pi),e instanceof Pi)return sy(this,Qee,!0,"f"),this._emit("abort",e);if(e instanceof ft)return this._emit("error",e);if(e instanceof Error){let r=new ft(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new ft(String(e)))};function Xwt(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function MH(t){return t?.$brand==="auto-parseable-response-format"}function Qwt(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 q1(t){return t?.$brand==="auto-parseable-tool"}function e0t(t,e){return!e||!UPe(e)?{...t,choices:t.choices.map(r=>({...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:RH(t,e)}function RH(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new l$;if(n.finish_reason==="content_filter")throw new c$;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>FUr(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?LUr(e,n.message.content):null}}});return{...t,choices:r}}function LUr(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 FUr(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:q1(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function t0t(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return q1(r)||r?.function.strict||!1}function UPe(t){return MH(t.response_format)?!0:t.tools?.some(e=>q1(e)||e.type==="function"&&e.function.strict===!0)??!1}function r0t(t){for(let e of t??[]){if(e.type!=="function")throw new ft(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new ft(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Sp=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)},Dd,zPe,ete,HPe,VPe,WPe,o0t,KPe,n0t=10,b$=class extends zT{constructor(){super(...arguments),Dd.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),($Pe(e)||BPe(e))&&e.content)this._emit("functionCallResult",e.content);else if(UT(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(UT(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 ft("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),Sp(this,Dd,"m",zPe).call(this)}async finalMessage(){return await this.done(),Sp(this,Dd,"m",ete).call(this)}async finalFunctionCall(){return await this.done(),Sp(this,Dd,"m",HPe).call(this)}async finalFunctionCallResult(){return await this.done(),Sp(this,Dd,"m",VPe).call(this)}async totalUsage(){return await this.done(),Sp(this,Dd,"m",WPe).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=Sp(this,Dd,"m",ete).call(this);r&&this._emit("finalMessage",r);let n=Sp(this,Dd,"m",zPe).call(this);n&&this._emit("finalContent",n);let o=Sp(this,Dd,"m",HPe).call(this);o&&this._emit("finalFunctionCall",o);let i=Sp(this,Dd,"m",VPe).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",Sp(this,Dd,"m",WPe).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Sp(this,Dd,"m",o0t).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(RH(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=n0t}=n||{},c={};for(let f of r.functions)c[f.name||f.function.name]=f;let d=r.functions.map(f=>({name:f.name||f.function.name,parameters:f.parameters,description:f.description}));for(let f of r.messages)this._addMessage(f,!1);for(let f=0;f<l;++f){let m=(await this._createChatCompletion(e,{...s,function_call:i,functions:d,messages:[...this.messages]},n)).choices[0]?.message;if(!m)throw new ft("missing message in ChatCompletion response");if(!m.function_call)return;let{name:h,arguments:b}=m.function_call,g=c[h];if(g){if(u&&u!==h){let C=`Invalid function_call: ${JSON.stringify(h)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,name:h,content:C});continue}}else{let C=`Invalid function_call: ${JSON.stringify(h)}. Available options are: ${d.map(E=>JSON.stringify(E.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:h,content:C});continue}let _;try{_=kPe(g)?await g.parse(b):b}catch(C){this._addMessage({role:o,name:h,content:C instanceof Error?C.message:String(C)});continue}let w=await g.function(_,this),x=Sp(this,Dd,"m",KPe).call(this,w);if(this._addMessage({role:o,name:h,content:x}),u)return}}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i?.function?.name,{maxChatCompletions:l=n0t}=n||{},c=r.tools.map(p=>{if(q1(p)){if(!p.$callback)throw new ft("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of c)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?c.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;p<l;++p){let h=(await this._createChatCompletion(e,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!h)throw new ft("missing message in ChatCompletion response");if(!h.tool_calls?.length)return;for(let b of h.tool_calls){if(b.type!=="function")continue;let g=b.id,{name:_,arguments:w}=b.function,x=d[_];if(x){if(u&&u!==_){let A=`Invalid tool_call: ${JSON.stringify(_)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:g,content:A});continue}}else{let A=`Invalid tool_call: ${JSON.stringify(_)}. Available options are: ${Object.keys(d).map(I=>JSON.stringify(I)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:A});continue}let C;try{C=kPe(x)?await x.parse(w):w}catch(A){let I=A instanceof Error?A.message:String(A);this._addMessage({role:o,tool_call_id:g,content:I});continue}let E=await x.function(C,this),P=Sp(this,Dd,"m",KPe).call(this,E);if(this._addMessage({role:o,tool_call_id:g,content:P}),u)return}}}};Dd=new WeakSet,zPe=function(){return Sp(this,Dd,"m",ete).call(this).content??null},ete=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(UT(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 ft("stream ended without producing a ChatCompletionMessage with role=assistant")},HPe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(UT(r)&&r?.function_call)return r.function_call;if(UT(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},VPe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if($Pe(r)&&r.content!=null||BPe(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}},WPe=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},o0t=function(e){if(e.n!=null&&e.n>1)throw new ft("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},KPe=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};var jH=class t extends b${static runFunctions(e,r,n){let o=new t,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return o._run(()=>o._runFunctions(e,r,i)),o}static runTools(e,r,n){let o=new t,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}_addMessage(e,r=!0){super._addMessage(e,r),UT(e)&&e.content&&this._emit("content",e.content)}};var zl={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},JPe=class extends Error{},GPe=class extends Error{};function kUr(t,e=zl.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return $Ur(t.trim(),e)}var $Ur=(t,e)=>{let r=t.length,n=0,o=f=>{throw new JPe(`${f} at position ${n}`)},i=f=>{throw new GPe(`${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"||zl.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||zl.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||zl.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||zl.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||zl.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||zl.NAN&e&&r-n<3&&"NaN".startsWith(t.substring(n))?(n+=3,NaN):c()),s=()=>{let f=n,p=!1;for(n++;n<r&&(t[n]!=='"'||p&&t[n-1]==="\\");)p=t[n]==="\\"?!p:!1,n++;if(t.charAt(n)=='"')try{return JSON.parse(t.substring(f,++n-Number(p)))}catch(m){i(String(m))}else if(zl.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&&zl.OBJ&e)return f;let p=s();d(),n++;try{let m=a();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(zl.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(zl.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(zl.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&zl.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(zl.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&&!(zl.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&zl.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;n<r&&`
\r `.includes(t[n]);)n++};return a()},YPe=t=>kUr(t,zl.ALL^zl.NUM);var _$=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},_i=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)},vl,ZC,v$,HT,ZPe,tte,XPe,QPe,eEe,rte,tEe,i0t,w$=class t extends b${constructor(e){super(),vl.add(this),ZC.set(this,void 0),v$.set(this,void 0),HT.set(this,void 0),_$(this,ZC,e,"f"),_$(this,v$,[],"f")}get currentChatCompletionSnapshot(){return _i(this,HT,"f")}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createChatCompletion(e,r,n){let o=new t(r);return o._run(()=>o._runChatCompletion(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(e,r,n){super._createChatCompletion;let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),_i(this,vl,"m",ZPe).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)_i(this,vl,"m",XPe).call(this,a);if(i.controller.signal?.aborted)throw new Pi;return this._addChatCompletion(_i(this,vl,"m",rte).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),_i(this,vl,"m",ZPe).call(this),this._connected();let o=ES.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(_i(this,vl,"m",rte).call(this)),_i(this,vl,"m",XPe).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new Pi;return this._addChatCompletion(_i(this,vl,"m",rte).call(this))}[(ZC=new WeakMap,v$=new WeakMap,HT=new WeakMap,vl=new WeakSet,ZPe=function(){this.ended||_$(this,HT,void 0,"f")},tte=function(r){let n=_i(this,v$,"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},_i(this,v$,"f")[r.index]=n,n)},XPe=function(r){if(this.ended)return;let n=_i(this,vl,"m",i0t).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=_i(this,vl,"m",tte).call(this,i);i.finish_reason&&(_i(this,vl,"m",eEe).call(this,i),a.current_tool_call_index!=null&&_i(this,vl,"m",QPe).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(_i(this,vl,"m",eEe).call(this,i),a.current_tool_call_index!=null&&_i(this,vl,"m",QPe).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))}}},QPe=function(r,n){if(_i(this,vl,"m",tte).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=_i(this,ZC,"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:q1(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},eEe=function(r){let n=_i(this,vl,"m",tte).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=_i(this,vl,"m",tEe).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}))},rte=function(){if(this.ended)throw new ft("stream has ended, this shouldn't happen");let r=_i(this,HT,"f");if(!r)throw new ft("request ended without sending any chunks");return _$(this,HT,void 0,"f"),_$(this,v$,[],"f"),BUr(r,_i(this,ZC,"f"))},tEe=function(){let r=_i(this,ZC,"f")?.response_format;return MH(r)?r:null},i0t=function(r){var n,o,i,a;let s=_i(this,HT,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=_$(this,HT,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=s.choices[f];if(h||(h=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:E,refusal:P,...A}=p;Object.assign(h.logprobs,A),E&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...E)),P&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...P))}if(d&&(h.finish_reason=d,_i(this,ZC,"f")&&UPe(_i(this,ZC,"f")))){if(d==="length")throw new l$;if(d==="content_filter")throw new c$}if(Object.assign(h,m),!c)continue;let{content:b,refusal:g,function_call:_,role:w,tool_calls:x,...C}=c;if(Object.assign(h.message,C),g&&(h.message.refusal=(h.message.refusal||"")+g),w&&(h.message.role=w),_&&(h.message.function_call?(_.name&&(h.message.function_call.name=_.name),_.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=_.arguments)):h.message.function_call=_),b&&(h.message.content=(h.message.content||"")+b,!h.message.refusal&&_i(this,vl,"m",tEe).call(this)&&(h.message.parsed=YPe(h.message.content))),x){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:E,id:P,type:A,function:I,...R}of x){let j=(a=h.message.tool_calls)[E]??(a[E]={});Object.assign(j,R),P&&(j.id=P),A&&(j.type=A),I&&(j.function??(j.function={name:I.name??"",arguments:""})),I?.name&&(j.function.name=I.name),I?.arguments&&(j.function.arguments+=I.arguments,t0t(_i(this,ZC,"f"),j)&&(j.function.parsed_arguments=YPe(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 ES(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function BUr(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 ft(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:b,...g}=l,_=l.role;if(!_)throw new ft(`missing role for choice ${d}`);if(h){let{arguments:w,name:x}=h;if(w==null)throw new ft(`missing function_call.arguments for choice ${d}`);if(!x)throw new ft(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:w,name:x},role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return b?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:_,content:m,refusal:l.refusal??null,tool_calls:b.map((w,x)=>{let{function:C,type:E,id:P,...A}=w,{arguments:I,name:R,...j}=C||{};if(P==null)throw new ft(`missing choices[${d}].tool_calls[${x}].id
${nte(t)}`);if(E==null)throw new ft(`missing choices[${d}].tool_calls[${x}].type
${nte(t)}`);if(R==null)throw new ft(`missing choices[${d}].tool_calls[${x}].function.name
${nte(t)}`);if(I==null)throw new ft(`missing choices[${d}].tool_calls[${x}].function.arguments
${nte(t)}`);return{...A,id:P,type:E,function:{...j,name:R,arguments:I}}})}}:{...p,message:{...g,content:m,role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return e0t(u,e)}function nte(t){return JSON.stringify(t)}var DH=class t extends w${static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runFunctions(e,r,n){let o=new t(null),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return o._run(()=>o._runFunctions(e,r,i)),o}static runTools(e,r,n){let o=new t(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}};var NH=class extends Ze{parse(e,r){return r0t(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>RH(n,e))}runFunctions(e,r){return e.stream?DH.runFunctions(this._client,e,r):jH.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?DH.runTools(this._client,e,r):jH.runTools(this._client,e,r)}stream(e,r){return w$.createChatCompletion(this._client,e,r)}};var S$=class extends Ze{constructor(){super(...arguments),this.completions=new NH(this._client)}};(function(t){t.Completions=NH})(S$||(S$={}));var x$=class extends Ze{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}};var C$=class extends Ze{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}};var VT=class extends Ze{constructor(){super(...arguments),this.sessions=new x$(this._client),this.transcriptionSessions=new C$(this._client)}};VT.Sessions=x$;VT.TranscriptionSessions=C$;var Ft=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)},_m=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},Nc,rEe,IS,ote,uy,z1,O$,U1,ste,vm,ite,ate,kH,LH,FH,a0t,s0t,u0t,l0t,c0t,d0t,f0t,MS=class t extends zT{constructor(){super(...arguments),Nc.add(this),rEe.set(this,[]),IS.set(this,{}),ote.set(this,{}),uy.set(this,void 0),z1.set(this,void 0),O$.set(this,void 0),U1.set(this,void 0),ste.set(this,void 0),vm.set(this,void 0),ite.set(this,void 0),ate.set(this,void 0),kH.set(this,void 0)}[(rEe=new WeakMap,IS=new WeakMap,ote=new WeakMap,uy=new WeakMap,z1=new WeakMap,O$=new WeakMap,U1=new WeakMap,ste=new WeakMap,vm=new WeakMap,ite=new WeakMap,ate=new WeakMap,kH=new WeakMap,Nc=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=ES.fromReadableStream(e,this.controller);for await(let i of o)Ft(this,Nc,"m",LH).call(this,i);if(o.controller.signal?.aborted)throw new Pi;return this._addRun(Ft(this,Nc,"m",FH).call(this))}toReadableStream(){return new ES(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o,i){let a=new t;return a._run(()=>a._runToolAssistantStream(e,r,n,o,{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),a}async _createToolAssistantStream(e,r,n,o,i){let a=i?.signal;a&&(a.aborted&&this.controller.abort(),a.addEventListener("abort",()=>this.controller.abort()));let s={...o,stream:!0},u=await e.submitToolOutputs(r,n,s,{...i,signal:this.controller.signal});this._connected();for await(let l of u)Ft(this,Nc,"m",LH).call(this,l);if(u.controller.signal?.aborted)throw new Pi;return this._addRun(Ft(this,Nc,"m",FH).call(this))}static createThreadAssistantStream(e,r,n){let o=new t;return o._run(()=>o._threadAssistantStream(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,r,n,o){let i=new t;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return Ft(this,ite,"f")}currentRun(){return Ft(this,ate,"f")}currentMessageSnapshot(){return Ft(this,uy,"f")}currentRunStepSnapshot(){return Ft(this,kH,"f")}async finalRunSteps(){return await this.done(),Object.values(Ft(this,IS,"f"))}async finalMessages(){return await this.done(),Object.values(Ft(this,ote,"f"))}async finalRun(){if(await this.done(),!Ft(this,z1,"f"))throw Error("Final run was not received.");return Ft(this,z1,"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)Ft(this,Nc,"m",LH).call(this,s);if(a.controller.signal?.aborted)throw new Pi;return this._addRun(Ft(this,Nc,"m",FH).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)Ft(this,Nc,"m",LH).call(this,u);if(s.controller.signal?.aborted)throw new Pi;return this._addRun(Ft(this,Nc,"m",FH).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(d$(i)&&d$(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(!d$(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)}};LH=function(e){if(!this.ended)switch(_m(this,ite,e,"f"),Ft(this,Nc,"m",u0t).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":Ft(this,Nc,"m",f0t).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":Ft(this,Nc,"m",s0t).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":Ft(this,Nc,"m",a0t).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},FH=function(){if(this.ended)throw new ft("stream has ended, this shouldn't happen");if(!Ft(this,z1,"f"))throw Error("Final run has not been received");return Ft(this,z1,"f")},a0t=function(e){let[r,n]=Ft(this,Nc,"m",c0t).call(this,e,Ft(this,uy,"f"));_m(this,uy,r,"f"),Ft(this,ote,"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!=Ft(this,O$,"f")){if(Ft(this,U1,"f"))switch(Ft(this,U1,"f").type){case"text":this._emit("textDone",Ft(this,U1,"f").text,Ft(this,uy,"f"));break;case"image_file":this._emit("imageFileDone",Ft(this,U1,"f").image_file,Ft(this,uy,"f"));break}_m(this,O$,o.index,"f")}_m(this,U1,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(Ft(this,O$,"f")!==void 0){let o=e.data.content[Ft(this,O$,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,Ft(this,uy,"f"));break;case"text":this._emit("textDone",o.text,Ft(this,uy,"f"));break}}Ft(this,uy,"f")&&this._emit("messageDone",e.data),_m(this,uy,void 0,"f")}},s0t=function(e){let r=Ft(this,Nc,"m",l0t).call(this,e);switch(_m(this,kH,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==Ft(this,ste,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(Ft(this,vm,"f")&&this._emit("toolCallDone",Ft(this,vm,"f")),_m(this,ste,i.index,"f"),_m(this,vm,r.step_details.tool_calls[i.index],"f"),Ft(this,vm,"f")&&this._emit("toolCallCreated",Ft(this,vm,"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":_m(this,kH,void 0,"f"),e.data.step_details.type=="tool_calls"&&Ft(this,vm,"f")&&(this._emit("toolCallDone",Ft(this,vm,"f")),_m(this,vm,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},u0t=function(e){Ft(this,rEe,"f").push(e),this._emit("event",e)},l0t=function(e){switch(e.event){case"thread.run.step.created":return Ft(this,IS,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=Ft(this,IS,"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=MS.accumulateDelta(r,n.delta);Ft(this,IS,"f")[e.data.id]=o}return Ft(this,IS,"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":Ft(this,IS,"f")[e.data.id]=e.data;break}if(Ft(this,IS,"f")[e.data.id])return Ft(this,IS,"f")[e.data.id];throw new Error("No snapshot available")},c0t=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]=Ft(this,Nc,"m",d0t).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")},d0t=function(e,r){return MS.accumulateDelta(r,e)},f0t=function(e){switch(_m(this,ate,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":_m(this,z1,e.data,"f"),Ft(this,vm,"f")&&(this._emit("toolCallDone",Ft(this,vm,"f")),_m(this,vm,void 0,"f"));break;case"thread.run.cancelling":break}};var H1=class extends Ze{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 Vr(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,P$,{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}})}},P$=class extends Gn{};H1.MessagesPage=P$;var V1=class extends Ze{retrieve(e,r,n,o={},i){return Vr(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 Vr(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,E$,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},E$=class extends Gn{};V1.RunStepsPage=E$;var XC=class extends Ze{constructor(){super(...arguments),this.steps=new V1(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 Vr(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,T$,{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 MS.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 JC(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return MS.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 MS.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},T$=class extends Gn{};XC.RunsPage=T$;XC.Steps=V1;XC.RunStepsPage=E$;var RS=class extends Ze{constructor(){super(...arguments),this.runs=new XC(this._client),this.messages=new H1(this._client)}create(e={},r){return Vr(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 MS.createThreadAssistantStream(e,this._client.beta.threads,r)}};RS.Runs=XC;RS.RunsPage=T$;RS.Messages=H1;RS.MessagesPage=P$;var ly=class extends Ze{constructor(){super(...arguments),this.realtime=new VT(this._client),this.chat=new S$(this._client),this.assistants=new B1(this._client),this.threads=new RS(this._client)}};ly.Realtime=VT;ly.Assistants=B1;ly.AssistantsPage=g$;ly.Threads=RS;var W1=class extends Ze{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}};var K1=class extends Ze{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&KC("Request","User defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(KC("response","Decoding base64 embeddings to float32 array"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=Ywt(u)}),a)))}};var J1=class extends Ze{retrieve(e,r,n,o){return this._client.get(`/evals/${e}/runs/${r}/output_items/${n}`,o)}list(e,r,n={},o){return Vr(n)?this.list(e,r,{},n):this._client.getAPIList(`/evals/${e}/runs/${r}/output_items`,A$,{query:n,...o})}},A$=class extends Gn{};J1.OutputItemListResponsesPage=A$;var QC=class extends Ze{constructor(){super(...arguments),this.outputItems=new J1(this._client)}create(e,r,n){return this._client.post(`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){return this._client.get(`/evals/${e}/runs/${r}`,n)}list(e,r={},n){return Vr(r)?this.list(e,{},r):this._client.getAPIList(`/evals/${e}/runs`,I$,{query:r,...n})}del(e,r,n){return this._client.delete(`/evals/${e}/runs/${r}`,n)}cancel(e,r,n){return this._client.post(`/evals/${e}/runs/${r}`,n)}},I$=class extends Gn{};QC.RunListResponsesPage=I$;QC.OutputItems=J1;QC.OutputItemListResponsesPage=A$;var jS=class extends Ze{constructor(){super(...arguments),this.runs=new QC(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(`/evals/${e}`,r)}update(e,r,n){return this._client.post(`/evals/${e}`,{body:r,...n})}list(e={},r){return Vr(e)?this.list({},e):this._client.getAPIList("/evals",G1,{query:e,...r})}del(e,r){return this._client.delete(`/evals/${e}`,r)}},G1=class extends Gn{};jS.EvalListResponsesPage=G1;jS.Runs=QC;jS.RunListResponsesPage=I$;var WT=class extends Ze{create(e,r){return this._client.post("/files",Rh({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return Vr(e)?this.list({},e):this._client.getAPIList("/files",Y1,{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 JC(r),a=await this.retrieve(e),Date.now()-i>n)throw new Ef({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},Y1=class extends Gn{};WT.FileObjectsPage=Y1;var Z1=class extends Ze{create(e,r,n){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,M$,{body:r,method:"post",...n})}retrieve(e,r={},n){return Vr(r)?this.retrieve(e,{},r):this._client.get(`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}del(e,r){return this._client.delete(`/fine_tuning/checkpoints/${e}/permissions`,r)}},M$=class extends TS{};Z1.PermissionCreateResponsesPage=M$;var KT=class extends Ze{constructor(){super(...arguments),this.permissions=new Z1(this._client)}};KT.Permissions=Z1;KT.PermissionCreateResponsesPage=M$;var X1=class extends Ze{list(e,r={},n){return Vr(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,R$,{query:r,...n})}},R$=class extends Gn{};X1.FineTuningJobCheckpointsPage=R$;var DS=class extends Ze{constructor(){super(...arguments),this.checkpoints=new X1(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 Vr(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",j$,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return Vr(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,D$,{query:r,...n})}},j$=class extends Gn{},D$=class extends Gn{};DS.FineTuningJobsPage=j$;DS.FineTuningJobEventsPage=D$;DS.Checkpoints=X1;DS.FineTuningJobCheckpointsPage=R$;var cy=class extends Ze{constructor(){super(...arguments),this.jobs=new DS(this._client),this.checkpoints=new KT(this._client)}};cy.Jobs=DS;cy.FineTuningJobsPage=j$;cy.FineTuningJobEventsPage=D$;cy.Checkpoints=KT;var Q1=class extends Ze{createVariation(e,r){return this._client.post("/images/variations",Rh({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",Rh({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}};var JT=class extends Ze{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",ej,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},ej=class extends TS{};JT.ModelsPage=ej;var tj=class extends Ze{create(e,r){return this._client.post("/moderations",{body:e,...r})}};function p0t(t,e){return!e||!nzr(e)?{...t,output_parsed:null,output:t.output.map(r=>r.type==="function_call"?{...r,parsed_arguments:null}:r.type==="message"?{...r,content:r.content.map(n=>({...n,parsed:null}))}:r)}:nEe(t,e)}function nEe(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:azr(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:rzr(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||oEe(n),Object.defineProperty(n,"output_parsed",{enumerable:!0,get(){for(let o of n.output)if(o.type==="message"){for(let i of o.content)if(i.type==="output_text"&&i.parsed!==null)return i.parsed}return null}}),n}function rzr(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function nzr(t){return!!MH(t.text?.format)}function ozr(t){return t?.$brand==="auto-parseable-tool"}function izr(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function azr(t,e){let r=izr(t.tools??[],e.name);return{...e,...e,parsed_arguments:ozr(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function oEe(t){let e=[];for(let r of t.output)if(r.type==="message")for(let n of r.content)n.type==="output_text"&&e.push(n.text);t.output_text=e.join("")}var N$=class extends Ze{list(e,r={},n){return Vr(r)?this.list(e,{},r):this._client.getAPIList(`/responses/${e}/input_items`,ute,{query:r,...n})}};var L$=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},GT=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},F$,lte,YT,cte,m0t,h0t,g0t,y0t,dte=class t extends zT{constructor(e){super(),F$.add(this),lte.set(this,void 0),YT.set(this,void 0),cte.set(this,void 0),L$(this,lte,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),GT(this,F$,"m",m0t).call(this);let i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)GT(this,F$,"m",h0t).call(this,a);if(i.controller.signal?.aborted)throw new Pi;return GT(this,F$,"m",g0t).call(this)}[(lte=new WeakMap,YT=new WeakMap,cte=new WeakMap,F$=new WeakSet,m0t=function(){this.ended||L$(this,YT,void 0,"f")},h0t=function(r){if(this.ended)return;let n=GT(this,F$,"m",y0t).call(this,r);switch(this._emit("event",r),r.type){case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new ft(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new ft(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new ft(`expected content to be 'output_text', got ${i.type}`);this._emit("response.output_text.delta",{...r,snapshot:i.text})}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new ft(`missing output at index ${r.output_index}`);o.type==="function_call"&&this._emit("response.function_call_arguments.delta",{...r,snapshot:o.arguments});break}default:this._emit(r.type,r);break}},g0t=function(){if(this.ended)throw new ft("stream has ended, this shouldn't happen");let r=GT(this,YT,"f");if(!r)throw new ft("request ended without sending any events");L$(this,YT,void 0,"f");let n=uzr(r,GT(this,lte,"f"));return L$(this,cte,n,"f"),n},y0t=function(r){let n=GT(this,YT,"f");if(!n){if(r.type!=="response.created")throw new ft(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=L$(this,YT,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new ft(`missing output at index ${r.output_index}`);o.type==="message"&&o.content.push(r.part);break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new ft(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new ft(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new ft(`expected content to be 'output_text', got ${i.type}`);i.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new ft(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{L$(this,YT,r.response,"f");break}}return n},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=GT(this,cte,"f");if(!e)throw new ft("stream ended without producing a ChatCompletion");return e}};function uzr(t,e){return p0t(t,e)}var ZT=class extends Ze{constructor(){super(...arguments),this.inputItems=new N$(this._client)}create(e,r){return this._client.post("/responses",{body:e,...r,stream:e.stream??!1})._thenUnwrap(n=>("object"in n&&n.object==="response"&&oEe(n),n))}retrieve(e,r={},n){return Vr(r)?this.retrieve(e,{},r):this._client.get(`/responses/${e}`,{query:r,...n})}del(e,r){return this._client.delete(`/responses/${e}`,{...r,headers:{Accept:"*/*",...r?.headers}})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>nEe(n,e))}stream(e,r){return dte.createResponse(this._client,e,r)}},ute=class extends Gn{};ZT.InputItems=N$;var k$=class extends Ze{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,Rh({body:r,...n}))}};var XT=class extends Ze{constructor(){super(...arguments),this.parts=new k$(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})}};XT.Parts=k$;var b0t=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 QT=class extends Ze{create(e,r,n){return this._client.post(`/vector_stores/${e}/files`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}retrieve(e,r,n){return this._client.get(`/vector_stores/${e}/files/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}update(e,r,n,o){return this._client.post(`/vector_stores/${e}/files/${r}`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}list(e,r={},n){return Vr(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,eA,{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 JC(s);break;case"failed":case"completed":return a}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}content(e,r,n){return this._client.getAPIList(`/vector_stores/${e}/files/${r}/content`,$$,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},eA=class extends Gn{},$$=class extends TS{};QT.VectorStoreFilesPage=eA;QT.FileContentResponsesPage=$$;var B$=class extends Ze{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 Vr(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,eA,{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 JC(s);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,a=Math.min(i,r.length),s=this._client,u=r.values(),l=[...n];async function c(f){for(let p of f){let m=await s.files.create({file:p,purpose:"assistants"},o);l.push(m.id)}}let d=Array(a).fill(u).map(c);return await b0t(d),await this.createAndPoll(e,{file_ids:l})}};var wm=class extends Ze{constructor(){super(...arguments),this.files=new QT(this._client),this.fileBatches=new B$(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 Vr(e)?this.list({},e):this._client.getAPIList("/vector_stores",rj,{query:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}del(e,r){return this._client.delete(`/vector_stores/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}search(e,r,n){return this._client.getAPIList(`/vector_stores/${e}/search`,nj,{body:r,method:"post",...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},rj=class extends Gn{},nj=class extends TS{};wm.VectorStoresPage=rj;wm.VectorStoreSearchResponsesPage=nj;wm.Files=QT;wm.VectorStoreFilesPage=eA;wm.FileContentResponsesPage=$$;wm.FileBatches=B$;var v0t,Lt=class extends Kee{constructor({baseURL:e=FT("OPENAI_BASE_URL"),apiKey:r=FT("OPENAI_API_KEY"),organization:n=FT("OPENAI_ORG_ID")??null,project:o=FT("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new ft("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&&Gwt())throw new ft(`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 W1(this),this.chat=new GC(this),this.embeddings=new K1(this),this.files=new WT(this),this.images=new Q1(this),this.audio=new AS(this),this.moderations=new tj(this),this.models=new JT(this),this.fineTuning=new cy(this),this.vectorStores=new wm(this),this.beta=new ly(this),this.batches=new qT(this),this.uploads=new XT(this),this.responses=new ZT(this),this.evals=new jS(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 wPe(e,{arrayFormat:"brackets"})}};v0t=Lt;Lt.OpenAI=v0t;Lt.DEFAULT_TIMEOUT=6e5;Lt.OpenAIError=ft;Lt.APIError=ks;Lt.APIConnectionError=WC;Lt.APIConnectionTimeoutError=Ef;Lt.APIUserAbortError=Pi;Lt.NotFoundError=o$;Lt.ConflictError=i$;Lt.RateLimitError=s$;Lt.BadRequestError=t$;Lt.AuthenticationError=r$;Lt.InternalServerError=u$;Lt.PermissionDeniedError=n$;Lt.UnprocessableEntityError=a$;Lt.toFile=DPe;Lt.fileFromPath=Bee;Lt.Completions=W1;Lt.Chat=GC;Lt.ChatCompletionsPage=BT;Lt.Embeddings=K1;Lt.Files=WT;Lt.FileObjectsPage=Y1;Lt.Images=Q1;Lt.Audio=AS;Lt.Moderations=tj;Lt.Models=JT;Lt.ModelsPage=ej;Lt.FineTuning=cy;Lt.VectorStores=wm;Lt.VectorStoresPage=rj;Lt.VectorStoreSearchResponsesPage=nj;Lt.Beta=ly;Lt.Batches=qT;Lt.BatchesPage=$1;Lt.Uploads=XT;Lt.Responses=ZT;Lt.Evals=jS;Lt.EvalListResponsesPage=G1;var fte=class extends Lt{constructor({baseURL:e=FT("OPENAI_BASE_URL"),apiKey:r=FT("AZURE_OPENAI_API_KEY"),apiVersion:n=FT("OPENAI_API_VERSION"),endpoint:o,deployment:i,azureADTokenProvider:a,dangerouslyAllowBrowser:s,...u}={}){if(!n)throw new ft("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof a=="function"&&(s=!0),!a&&!r)throw new ft("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(a&&r)throw new ft("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(r??(r=_0t),u.defaultQuery={...u.defaultQuery,"api-version":n},e){if(o)throw new ft("baseURL and endpoint are mutually exclusive")}else{if(o||(o=process.env.AZURE_OPENAI_ENDPOINT),!o)throw new ft("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");e=`${o}/openai`}super({apiKey:r,baseURL:e,...u,...s!==void 0?{dangerouslyAllowBrowser:s}:{}}),this.apiVersion="",this._azureADTokenProvider=a,this.apiVersion=n,this.deploymentName=i}buildRequest(e,r={}){if(pzr.has(e.path)&&e.method==="post"&&e.body!==void 0){if(!d$(e.body))throw new Error("Expected request body to be an object");let n=this.deploymentName||e.body.model||e.__metadata?.model;n!==void 0&&!this.baseURL.includes("/deployments")&&(e.path=`/deployments/${n}${e.path}`)}return super.buildRequest(e,r)}async _getAzureADToken(){if(typeof this._azureADTokenProvider=="function"){let e=await this._azureADTokenProvider();if(!e||typeof e!="string")throw new ft(`Expected 'azureADTokenProvider' argument to return a string but it returned ${e}`);return e}}authHeaders(e){return{}}async prepareOptions(e){if(e.headers?.["api-key"])return super.prepareOptions(e);let r=await this._getAzureADToken();if(e.headers??(e.headers={}),r)e.headers.Authorization=`Bearer ${r}`;else if(this.apiKey!==_0t)e.headers["api-key"]=this.apiKey;else throw new ft("Unable to handle auth");return super.prepareOptions(e)}},pzr=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations"]),_0t="<Missing Key>";Rd();ym();Jp();Mg();FN();afe();UP();SM();function xp(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=AN(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new Wp([`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 NS(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 Sm(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var iEe=class extends AM{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(hi(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=>xp(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}},Lc=class extends iEe{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 Wp(`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}};fc();var S0t=Symbol("Let zodToJsonSchema decide on which parser to use"),w0t={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"},x0t=t=>typeof t=="string"?{...w0t,basePath:["#"],definitions:{},name:t}:{...w0t,basePath:["#"],definitions:{},...t};var $H=t=>"_def"in t?t._def:t;function C0t(t){if(!t)return!0;for(let e in t)return!1;return!0}var O0t=t=>{let e=x0t(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])=>[$H(o),{def:$H(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function aEe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Bn(t,e,r,n,o){t[e]=r,aEe(t,e,n,o)}ud();function P0t(){return{}}ud();function E0t(t,e){let r={type:"array"};return t.type?._def?.typeName!==se.ZodAny&&(r.items=sr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Bn(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Bn(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Bn(r,"minItems",t.exactLength.value,t.exactLength.message,e),Bn(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function T0t(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?Bn(r,"minimum",n.value,n.message,e):Bn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Bn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Bn(r,"maximum",n.value,n.message,e):Bn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Bn(r,"maximum",n.value,n.message,e));break;case"multipleOf":Bn(r,"multipleOf",n.value,n.message,e);break}return r}function A0t(){return{type:"boolean"}}function I0t(t,e){return sr(t.type._def,e)}var M0t=(t,e)=>sr(t.innerType._def,e);function sEe(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>sEe(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 mzr(t,e)}}var mzr=(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":Bn(r,"minimum",n.value,n.message,e);break;case"max":Bn(r,"maximum",n.value,n.message,e);break}return r};function R0t(t,e){return{...sr(t.innerType._def,e),default:t.defaultValue()}}function j0t(t,e,r){return e.effectStrategy==="input"?sr(t.schema._def,e,r):{}}function D0t(t){return{type:"string",enum:[...t.values]}}var hzr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function N0t(t,e){let r=[sr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),sr(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(hzr(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 L0t(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}}ud();var uEe,oj={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:()=>(uEe===void 0&&(uEe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),uEe),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 pte(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?gzr(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":Bn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":Bn(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":dy(r,"email",o.message,e);break;case"format:idn-email":dy(r,"idn-email",o.message,e);break;case"pattern:zod":fy(r,oj.email,o.message,e);break}break;case"url":dy(r,"uri",o.message,e);break;case"uuid":dy(r,"uuid",o.message,e);break;case"regex":fy(r,o.regex,o.message,e);break;case"cuid":fy(r,oj.cuid,o.message,e);break;case"cuid2":fy(r,oj.cuid2,o.message,e);break;case"startsWith":fy(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":fy(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":dy(r,"date-time",o.message,e);break;case"date":dy(r,"date",o.message,e);break;case"time":dy(r,"time",o.message,e);break;case"duration":dy(r,"duration",o.message,e);break;case"length":Bn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),Bn(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{fy(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&dy(r,"ipv4",o.message,e),o.version!=="v4"&&dy(r,"ipv6",o.message,e);break}case"emoji":fy(r,oj.emoji,o.message,e);break;case"ulid":{fy(r,oj.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{dy(r,"binary",o.message,e);break}case"contentEncoding:base64":{Bn(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{fy(r,oj.base64,o.message,e);break}}break}case"nanoid":fy(r,oj.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var gzr=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),dy=(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}}})):Bn(t,"format",e,r,n)},fy=(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:F0t(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Bn(t,"pattern",F0t(e,n),r,n)},F0t=(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 mte(t,e){if(e.target==="openApi3"&&t.keyType?._def.typeName===se.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:sr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:sr(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===se.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(pte(t.keyType._def,e)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===se.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}function k0t(t,e){if(e.mapStrategy==="record")return mte(t,e);let r=sr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=sr(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 $0t(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 B0t(){return{not:{}}}function q0t(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var BH={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function z0t(t,e){if(e.target==="openApi3")return U0t(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in BH&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=BH[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 U0t(t,e)}var U0t=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>sr(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 H0t(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:BH[t.innerType._def.typeName],nullable:!0}:{type:[BH[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=sr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=sr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function V0t(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",aEe(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Bn(r,"minimum",n.value,n.message,e):Bn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Bn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Bn(r,"maximum",n.value,n.message,e):Bn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Bn(r,"maximum",n.value,n.message,e));break;case"multipleOf":Bn(r,"multipleOf",n.value,n.message,e);break}return r}function yzr(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":sr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":sr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function W0t(t,e){let r={type:"object",...Object.entries(t.shape()).reduce((n,[o,i])=>{if(i===void 0||i._def===void 0)return n;let a=[...e.currentPath,"properties",o],s=sr(i._def,{...e,currentPath:a,propertyPath:a});return s===void 0?n:(e.openaiStrictMode&&i.isOptional()&&!i.isNullable()&&console.warn(`Zod field at \`${a.join("/")}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required
This will become an error in a future version of the SDK.`),{properties:{...n.properties,[o]:s},required:i.isOptional()&&!e.openaiStrictMode?n.required:[...n.required,o]})},{properties:{},required:[]}),additionalProperties:yzr(t,e)};return r.required.length||delete r.required,r}var K0t=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return sr(t.innerType._def,e);let r=sr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};var J0t=(t,e)=>{if(e.pipeStrategy==="input")return sr(t.in._def,e);if(e.pipeStrategy==="output")return sr(t.out._def,e);let r=sr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=sr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function G0t(t,e){return sr(t.type._def,e)}function Y0t(t,e){let n={type:"array",uniqueItems:!0,items:sr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Bn(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Bn(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function Z0t(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>sr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:sr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>sr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function X0t(){return{not:{}}}function Q0t(){return{}}var eSt=(t,e)=>sr(t.innerType._def,e);function sr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==S0t)return a}if(n&&!r){let a=bzr(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=vzr(t,t.typeName,e,r);return i&&wzr(t,e,i),o.jsonSchema=i,i}var bzr=(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:_zr(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}},_zr=(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("/")},vzr=(t,e,r,n)=>{switch(e){case se.ZodString:return pte(t,r);case se.ZodNumber:return V0t(t,r);case se.ZodObject:return W0t(t,r);case se.ZodBigInt:return T0t(t,r);case se.ZodBoolean:return A0t();case se.ZodDate:return sEe(t,r);case se.ZodUndefined:return X0t();case se.ZodNull:return q0t(r);case se.ZodArray:return E0t(t,r);case se.ZodUnion:case se.ZodDiscriminatedUnion:return z0t(t,r);case se.ZodIntersection:return N0t(t,r);case se.ZodTuple:return Z0t(t,r);case se.ZodRecord:return mte(t,r);case se.ZodLiteral:return L0t(t,r);case se.ZodEnum:return D0t(t);case se.ZodNativeEnum:return $0t(t);case se.ZodNullable:return H0t(t,r);case se.ZodOptional:return K0t(t,r);case se.ZodMap:return k0t(t,r);case se.ZodSet:return Y0t(t,r);case se.ZodLazy:return sr(t.getter()._def,r);case se.ZodPromise:return G0t(t,r);case se.ZodNaN:case se.ZodNever:return B0t();case se.ZodEffects:return j0t(t,r,n);case se.ZodAny:return P0t();case se.ZodUnknown:return Q0t();case se.ZodDefault:return R0t(t,r);case se.ZodBranded:return I0t(t,r);case se.ZodReadonly:return eSt(t,r);case se.ZodCatch:return M0t(t,r);case se.ZodPipeline:return J0t(t,r);case se.ZodFunction:case se.ZodVoid:case se.ZodSymbol:return;default:return(o=>{})(e)}},wzr=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var tSt=(t,e)=>{let r=O0t(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=sr(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(C0t(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]=sr($H(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 rSt(t,e){return tSt(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function q$(t,e,r){return Xwt({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:rSt(t,{name:e})}},n=>t.parse(JSON.parse(n)))}function hte(t){return Qwt({type:"function",function:{name:t.name,parameters:rSt(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 eO(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}fc();function qH(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function tO(t){let e;return t.constructor.name===Ef.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Pi.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=qH(t,"INVALID_TOOL_RESULTS"):t.status===401?e=qH(t,"MODEL_AUTHENTICATION"):t.status===429?e=qH(t,"MODEL_RATE_LIMIT"):t.status===404?e=qH(t,"MODEL_NOT_FOUND"):e=t,e}function lEe(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 Szr(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function nSt(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(oSt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function oSt(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}: ${gte(o,e)},`):r.push(`${n}?: ${gte(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function gte(t,e){if(Szr(t))return t.anyOf.map(r=>gte(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["{",oSt(t,e+2),"}"].join(`
`);case"array":return t.items?`${gte(t.items,e)}[]`:"any[]";default:return""}}function iSt(t,e){let r;return Ul(t)?r=SS(t):r=t,e?.strict!==void 0&&(r.function.strict=e.strict),r}function xzr(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 fEe(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(!fs.isInstance(t))throw new Error("Invalid generic chat message");return xzr(t)}default:throw new Error(`Unknown message type: ${e}`)}}function dEe(t,e){return t.flatMap(r=>{let n=fEe(r);n==="system"&&pEe(e)&&(n="developer");let o={role:n,content:r.content};if(r.name!=null&&(o.name=r.name),r.additional_kwargs.function_call!=null&&(o.function_call=r.additional_kwargs.function_call,o.content=""),hi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(NS),o.content=""):(r.additional_kwargs.tool_calls!=null&&(o.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(o.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let i={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[o,i]}return o})}var U$="__openai_function_call_ids__";function aSt(t,e){return t.flatMap(r=>{let n=fEe(r);if(n==="system"&&pEe(e)&&(n="developer"),n==="function")throw new Error("Function messages are not supported in Responses API");if(n==="tool"){let i=r;return i.additional_kwargs?.type==="computer_call_output"?{type:"computer_call_output",output:(()=>{if(typeof i.content=="string")return{type:"computer_screenshot",image_url:i.content};if(Array.isArray(i.content)){let s=i.content.find(l=>l.type==="computer_screenshot");if(s)return s;let u=i.content.find(l=>l.type==="image_url");if(u)return{type:"computer_screenshot",image_url:typeof u.image_url=="string"?u.image_url:u.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:i.tool_call_id}:{type:"function_call_output",call_id:i.tool_call_id,id:i.id,output:typeof i.content!="string"?JSON.stringify(i.content):i.content}}if(n==="assistant"){let i=[];r.additional_kwargs.reasoning!=null&&(c=>typeof c=="object"&&c!=null&&"type"in c&&c.type==="reasoning")(r.additional_kwargs.reasoning)&&i.push(r.additional_kwargs.reasoning);let{content:a}=r;r.additional_kwargs.refusal!=null&&(typeof a=="string"&&(a=[{type:"output_text",text:a,annotations:[]}]),a=[...a,{type:"refusal",refusal:r.additional_kwargs.refusal}]),i.push({type:"message",role:"assistant",content:typeof a=="string"?a:a.flatMap(l=>l.type==="text"?{type:"output_text",text:l.text,annotations:l.annotations??[]}:l.type==="output_text"||l.type==="refusal"?l:[])});let s=r.additional_kwargs[U$];hi(r)&&r.tool_calls?.length?i.push(...r.tool_calls.map(l=>({type:"function_call",name:l.name,arguments:JSON.stringify(l.args),call_id:l.id,id:s?.[l.id]}))):r.additional_kwargs.tool_calls!=null&&i.push(...r.additional_kwargs.tool_calls.map(l=>({type:"function_call",name:l.function.name,call_id:l.id,id:s?.[l.id],arguments:l.function.arguments})));let u=r.response_metadata.output?.length?r.response_metadata.output:r.additional_kwargs.tool_outputs;if(u!=null){let l=u,c=l?.filter(f=>f.type==="reasoning"),d=l?.filter(f=>f.type==="computer_call");c.length>0&&d.length>0&&i.push(...c),d.length>0&&i.push(...d)}return i}let o=typeof r.content=="string"?r.content:r.content.flatMap(i=>{if(i.type==="text")return{type:"input_text",text:i.text};if(i.type==="image_url"){let a=typeof i.image_url=="string"?i.image_url:i.image_url.url,s=typeof i.image_url=="string"?"auto":i.image_url.detail;return{type:"input_image",image_url:a,detail:s}}return i.type==="input_text"||i.type==="input_image"||i.type==="input_file"?i:[]});return n==="user"||n==="system"||n==="developer"?{type:"message",role:n,content:o}:(console.warn(`Unsupported role found when converting to OpenAI Responses API: ${n}`),[])})}function uSt(t){if(t.error){let a=new Error(t.error.message);throw a.name=t.error.code,a}let e=[],r=[],n=[],o={model:t.model,created_at:t.created_at,id:t.id,incomplete_details:t.incomplete_details,metadata:t.metadata,object:t.object,status:t.status,user:t.user,model_name:t.model},i={};for(let a of t.output)if(a.type==="message")e.push(...a.content.flatMap(s=>s.type==="output_text"?("parsed"in s&&s.parsed!=null&&(i.parsed=s.parsed),{type:"text",text:s.text,annotations:s.annotations}):s.type==="refusal"?(i.refusal=s.refusal,[]):s));else if(a.type==="function_call"){let s={function:{name:a.name,arguments:a.arguments},id:a.call_id};try{r.push(xp(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Sm(s,l))}i[U$]??(i[U$]={}),a.id&&(i[U$][a.call_id]=a.id)}else a.type==="reasoning"?i.reasoning=a:(i.tool_outputs??(i.tool_outputs=[]),i.tool_outputs.push(a));return new fn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function Czr(t){let e=[],r={},n,o=[],i={},a={},s;if(t.type==="response.output_text.delta")e.push({type:"text",text:t.delta,index:t.content_index});else if(t.type==="response.output_text.annotation.added")e.push({type:"text",text:"",annotations:[t.annotation],index:t.content_index});else if(t.type==="response.output_item.added"&&t.item.type==="message")s=t.item.id;else if(t.type==="response.output_item.added"&&t.item.type==="function_call")o.push({type:"tool_call_chunk",name:t.item.name,args:t.item.arguments,id:t.item.id,index:t.output_index}),a[U$]={[t.item.call_id]:t.item.id};else if(t.type==="response.output_item.done"&&(t.item.type==="web_search_call"||t.item.type==="file_search_call"||t.item.type==="computer_call"))a.tool_outputs=[t.item];else if(t.type==="response.created")i.id=t.response.id,i.model_name=t.response.model,i.model=t.response.model;else if(t.type==="response.completed"){let u=uSt(t.response);n=t.response.usage,t.response.text?.format?.type==="json_schema"&&(a.parsed??(a.parsed=JSON.parse(u.text)));for(let[l,c]of Object.entries(t.response))l!=="id"&&(i[l]=c)}else if(t.type==="response.function_call_arguments.delta")o.push({type:"tool_call_chunk",args:t.delta,index:t.output_index});else if(t.type==="response.web_search_call.completed"||t.type==="response.file_search_call.completed")r={tool_outputs:{id:t.item_id,type:t.type.replace("response.","").replace(".completed",""),status:"completed"}};else if(t.type==="response.refusal.done")a.refusal=t.refusal;else return null;return new Ln({text:e.map(u=>u.text).join(""),message:new or({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function cEe(t){return"type"in t&&t.type!=="function"}function Ozr(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function sSt(t,e){return Mc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:iSt(t,e)}function pEe(t){return t?.startsWith("o1")||t?.startsWith("o3")||t?.startsWith("o4")}var LS=class extends Fs{static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning_effort"]}get lc_secrets(){return{openAIApiKey:"OPENAI_API_KEY",apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{modelName:"model",openAIApiKey:"openai_api_key",apiKey:"openai_api_key"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","reasoningEffort","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","modelName","model","modelKwargs","stop","stopSequences","timeout","openAIApiKey","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming"]}constructor(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logitBias",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gpt-3.5-turbo"}),Object.defineProperty(this,"modelKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topLogprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"openAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__includeRawResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportsStrictToolCalling",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modalities",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reasoningEffort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useResponsesApi",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.openAIApiKey=e?.apiKey??e?.openAIApiKey??e?.configuration?.apiKey??et("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??et("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelName=this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoningEffort=e?.reasoningEffort,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.useResponsesApi=e?.useResponsesApi??this.useResponsesApi,this.disableStreaming=e?.disableStreaming??this.disableStreaming,this.model==="o1"&&(this.disableStreaming=!0),this.streaming=e?.streaming??!1,this.disableStreaming&&(this.streaming=!1),this.streamUsage=e?.streamUsage??this.streamUsage,this.disableStreaming&&(this.streamUsage=!1),this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling)}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.bind({tools:e.map(o=>cEe(o)?o:sSt(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&yte(e.json_schema.schema)?q$(e.json_schema.schema,e.json_schema.name,{description:e.json_schema.description}):e}invocationParams(e,r){let n;if(e?.strict!==void 0?n=e.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this._useResponseApi(e)){let s={model:this.model,temperature:this.temperature,top_p:this.topP,user:this.user,stream:this.streaming,previous_response_id:e?.previous_response_id,truncation:e?.truncation,include:e?.include,tools:e?.tools?.length?e.tools.map(l=>cEe(l)?l:Mc(l)?{type:"function",name:l.function.name,parameters:l.function.parameters,description:l.function.description,strict:n}:null).filter(l=>l!==null):void 0,tool_choice:Ozr(e?.tool_choice)?e?.tool_choice:(()=>{let l=lEe(e?.tool_choice);if(typeof l=="object"&&"type"in l)return{type:"function",name:l.function.name}})(),text:(()=>{if(e?.text)return e.text;let l=this.createResponseFormat(e?.response_format);return l?.type==="json_schema"?l.json_schema.schema!=null?{format:{type:"json_schema",schema:l.json_schema.schema,description:l.json_schema.description,name:l.json_schema.name,strict:l.json_schema.strict}}:void 0:{format:l}})(),parallel_tool_calls:e?.parallel_tool_calls,max_output_tokens:this.maxTokens===-1?void 0:this.maxTokens,...this.modelKwargs},u=e?.reasoning_effort??this.reasoningEffort;return u!==void 0&&(s.reasoning={effort:u}),s}let o={};e?.stream_options!==void 0?o={stream_options:e.stream_options}:this.streamUsage&&(this.streaming||r?.streaming)&&(o={stream_options:{include_usage:!0}});let i={model:this.model,temperature:this.temperature,top_p:this.topP,frequency_penalty:this.frequencyPenalty,presence_penalty:this.presencePenalty,logprobs:this.logprobs,top_logprobs:this.topLogprobs,n:this.n,logit_bias:this.logitBias,stop:e?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:e?.functions,function_call:e?.function_call,tools:e?.tools?.length?e.tools.map(s=>sSt(s,{strict:n})):void 0,tool_choice:lEe(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),pEe(i.model)?i.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens:i.max_tokens=this.maxTokens===-1?void 0:this.maxTokens,i}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=e.tool_calls;switch(e.role){case"assistant":{let o=[],i=[];for(let u of n??[])try{o.push(xp(u,{returnId:!0}))}catch(l){i.push(Sm(u,l.message))}let a={function_call:e.function_call,tool_calls:n};this.__includeRawResponse!==void 0&&(a.__raw_response=r);let s={model_name:r.model,...r.system_fingerprint?{usage:{...r.usage},system_fingerprint:r.system_fingerprint}:{}};return e.audio&&(a.audio=e.audio),new fn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new fs(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 of({content:i,response_metadata:s});if(o==="assistant"){let u=[];if(Array.isArray(e.tool_calls))for(let l of e.tool_calls)u.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new or({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new fd({content:i,response_metadata:s}):o==="developer"?new fd({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new zp({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new eh({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new nf({content:i,role:o,response_metadata:s})}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}async*_streamResponseChunks(e,r,n){if(this._useResponseApi(r)){let l=await this.responseApiWithRetry({...this.invocationParams(r,{streaming:!0}),input:aSt(e,this.model),stream:!0},r);for await(let c of l){let d=Czr(c);d!=null&&(yield d)}return}let o=dEe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new Ln({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new Ln({message:new or({content:"",response_metadata:{usage:{...u}},usage_metadata:{input_tokens:u.prompt_tokens,output_tokens:u.completion_tokens,total_tokens:u.total_tokens,...Object.keys(l).length>0&&{input_token_details:l},...Object.keys(c).length>0&&{output_token_details:c}}}),text:""})}if(r.signal?.aborted)throw new Error("AbortError")}identifyingParams(){return this._identifyingParams()}async _responseApiGenerate(e,r,n){let o=this.invocationParams(r);if(o.stream){let s=this._streamResponseChunks(e,r,n),u;for await(let l of s)l.message.response_metadata={...l.generationInfo,...l.message.response_metadata},u=u?.concat(l)??l;return{generations:u?[u]:[],llmOutput:{estimatedTokenUsage:u?.message?.usage_metadata}}}let i=aSt(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:uSt(a)}],llmOutput:{id:a.id,estimatedTokenUsage:a.usage?{promptTokens:a.usage.input_tokens,completionTokens:a.usage.output_tokens,totalTokens:a.usage.total_tokens}:void 0}}}_useResponseApi(e){let r=e?.tools?.some(cEe),n=e?.previous_response_id!=null||e?.text!=null||e?.truncation!=null||e?.include!=null;return this.useResponsesApi||r||n}async _generate(e,r,n){if(this._useResponseApi(r))return this._responseApiGenerate(e,r,n);let o={},i=this.invocationParams(r),a=dEe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let b={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};b.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},hi(b.message)&&(b.message.usage_metadata=o),b.message=new fn(Object.fromEntries(Object.entries(b.message).filter(([g])=>!g.startsWith("lc_")))),p.push(b)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async getEstimatedTokenCountFromPrompt(e,r,n){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(r&&n!=="auto"){let i=nSt(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(fEe(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 tO(o)}})}async responseApiWithRetry(e,r){return this.caller.call(async()=>{let n=this._getClientOptions(r);try{return e.text?.format?.type==="json_schema"&&!e.stream?await this.client.responses.parse(e,n):await this.client.responses.create(e,n)}catch(o){throw tO(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 tO(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=eO(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Lt(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;Pzr(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"}}),yte(n)?u=pc.fromZodSchema(n):u=new mc;else if(i==="jsonSchema")if(s=this.bind({response_format:{type:"json_schema",json_schema:{name:o??"extract",description:n.description,schema:n,strict:r?.strict}}}),yte(n)){let f=pc.fromZodSchema(n);u=uf.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new mc;else{let f=o??"extract";if(yte(n)){let p=po(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 Lc({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 Lc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=so.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=so.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return si.from([{raw:s},d])}};function yte(t){return typeof t?.parse=="function"}function Pzr(t){return t!==void 0&&typeof t.schema=="object"}ym();Rd();var rO=class extends Cf{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??et("OPENAI_API_KEY");this.organization=r?.configuration?.organization??et("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=Of(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=eO(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Lt(i)}let r={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw tO(n)}})}};var bte=class extends rO{constructor(e){super(e),Object.defineProperty(this,"azureOpenAIApiVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureOpenAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureADTokenProvider",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureOpenAIApiInstanceName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureOpenAIApiDeploymentName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureOpenAIBasePath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.batchSize=e?.batchSize??1,this.azureOpenAIApiKey=e?.azureOpenAIApiKey??e?.apiKey??et("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=e?.azureOpenAIApiVersion??e?.openAIApiVersion??et("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=e?.azureOpenAIBasePath??et("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=e?.azureOpenAIApiInstanceName??et("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(e?.azureOpenAIApiEmbeddingsDeploymentName||e?.azureOpenAIApiDeploymentName)??(et("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||et("AZURE_OPENAI_API_DEPLOYMENT_NAME")),this.azureADTokenProvider=e?.azureADTokenProvider}async embeddingWithRetry(e){if(!this.client){let n={azureOpenAIApiDeploymentName:this.azureOpenAIApiDeploymentName,azureOpenAIApiInstanceName:this.azureOpenAIApiInstanceName,azureOpenAIApiKey:this.azureOpenAIApiKey,azureOpenAIBasePath:this.azureOpenAIBasePath,azureADTokenProvider:this.azureADTokenProvider,baseURL:this.clientConfig.baseURL},o=eO(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};this.azureADTokenProvider||(i.apiKey=n.azureOpenAIApiKey),i.baseURL||delete i.baseURL,i.defaultHeaders={...i.defaultHeaders,"User-Agent":i.defaultHeaders?.["User-Agent"]?`${i.defaultHeaders["User-Agent"]}: langchainjs-azure-openai-v2`:"langchainjs-azure-openai-v2"},this.client=new fte({apiVersion:this.azureOpenAIApiVersion,azureADTokenProvider:this.azureADTokenProvider,deployment:this.azureOpenAIApiDeploymentName,...i})}let r={};return this.azureOpenAIApiKey&&(r.headers={"api-key":this.azureOpenAIApiKey,...r.headers},r.query={"api-version":this.azureOpenAIApiVersion,...r.query}),this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw tO(n)}})}};ud();pz();$P();bH();nb();IN();jN();t9();var _te=class extends Gk{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=on(r);return NP(e)?(n=e.args,o={...o,toolCall:e}):n=e,this.call(n,o)}async call(e,r,n){let o=NP(e)?e.args:e,i;if(Ls(this.schema))try{i=await this.schema.parseAsync(o)}catch(m){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
Details: ${m.message}`),new wM(h,JSON.stringify(e))}else{let m=Hi(o,this.schema);if(!m.valid){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
Details: ${m.errors.map(b=>`${b.keywordLocation}: ${b.error}`).join(`
`)}`),new wM(h,JSON.stringify(e))}i=o}let a=CM(r),u=await Es.configure(a.callbacks,this.callbacks,a.tags||n,this.tags,a.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof e=="string"?e:JSON.stringify(e),a.runId,void 0,void 0,void 0,a.runName);delete a.runId;let l;try{l=await this._call(i,u,a)}catch(m){throw await u?.handleToolError(m),m}let c,d;if(this.responseFormat==="content_and_artifact")if(Array.isArray(l)&&l.length===2)[c,d]=l;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.
Result: ${JSON.stringify(l)}`);else c=l;let f;NP(e)&&(f=e.id),!f&&PBe(a)&&(f=a.toolCall.id);let p=Ezr({content:c,artifact:d,toolCallId:f,name:this.name});return await u?.handleToolEnd(p),p}},nO=class extends _te{constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:Ur.object({input:Ur.string().optional()}).transform(r=>r.input)})}call(e,r){let n=typeof e=="string"||e==null?{input:e}:e;return super.call(n,r)}},mEe=class extends nO{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=CM(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)}},hEe=class extends _te{static lc_name(){return"DynamicStructuredTool"}constructor(e){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect,this.schema=e.schema}async call(e,r,n){let o=CM(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 xm(t,e){let r=e.schema&&Ls(e.schema)&&(!("shape"in e.schema)||!e.schema.shape),n=_H(e.schema);if(!e.schema||r||n)return new mEe({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(a,s,u)=>new Promise((l,c)=>{let d=Qa(u,{callbacks:s?.getChild()});pd.runWithConfig(Hp(d),async()=>{try{l(t(a,d))}catch(f){c(f)}})})});let o=e.schema,i=e.description??e.schema.description??`${e.name} tool`;return new hEe({...e,description:i,schema:o,func:async(a,s,u)=>new Promise((l,c)=>{let d=Qa(u,{callbacks:s?.getChild()});pd.runWithConfig(Hp(d),async()=>{try{l(t(a,d))}catch(f){c(f)}})})})}function Ezr(t){let{content:e,artifact:r,toolCallId:n}=t;return n&&!DBe(e)?typeof e=="string"||Array.isArray(e)&&e.every(o=>typeof o=="object")?new Ax({content:e,artifact:r,tool_call_id:n,name:t.name}):new Ax({content:Tzr(e),artifact:r,tool_call_id:n,name:t.name}):e}function Tzr(t){try{return JSON.stringify(t,null,2)}catch{return`${t}`}}var gEe=class extends nO{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??et("OPENAI_API_KEY"),n=e?.organization??et("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseURL:e?.baseUrl};this.client=new Lt(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(gEe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var Ste=require("obsidian");var vte=class extends Cf{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||et("JINA_API_KEY")||et("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=Of(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 wte=class extends vte{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}};var Azr={"copilot-plus":rO,"copilot-plus-jina":wte,openai:rO,cohereai:Pee,google:Ree,"azure openai":bte,ollama:Lee,"lm-studio":rO,"3rd party (openai-format)":rO},$s=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>ne().plusLicenseKey,"copilot-plus-jina":()=>ne().plusLicenseKey,openai:()=>ne().openAIApiKey,cohereai:()=>ne().cohereApiKey,google:()=>ne().googleApiKey,"azure openai":()=>ne().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>""};this.initialize(),Mi(()=>this.initialize())}initialize(){let e=ne().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let r=Azr[e.provider];if(!r)throw console.warn(`Unknown provider: ${e.provider} for model: ${e.name}`),new Error(`Unknown provider: ${e.provider} for model: ${e.name}`);return r}buildModelMap(e){t.modelMap={};let r=t.modelMap;e.forEach(n=>{if(n.enabled){if(!Object.values(JP).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=Dr(n);r[a]={hasApiKey:!!i,EmbeddingConstructor:o,vendor:n.provider}}})}static getModelName(e){let r=e;if("model"in r&&r.model)return r.model;if("modelName"in r&&r.modelName)return r.modelName;throw new Error(`Embeddings instance missing model or modelName properties: ${e}`)}getCustomModel(e){return this.activeEmbeddingModels.filter(r=>{let n=Dr(r);return e===n})[0]}async getEmbeddingsAPI(){let{embeddingModelKey:e}=ne();if(!t.modelMap.hasOwnProperty(e))throw new Er(`No embedding model found for: ${e}`);let r=this.getCustomModel(e);if(r.plusExclusive&&!ne().isPlusUser)throw new Ste.Notice("Plus-only model, please consider upgrading to Plus to access it."),new Er("Plus-only model selected but user is not on Plus plan");if(r.believerExclusive){let a=await Ei.getInstance().validateLicenseKey();if(!a.plan||a.plan.toLowerCase()!=="believer")throw new Ste.Notice("Believer-only model, please consider upgrading to Believer to access it."),new Er("Believer-only model selected but user is not on Believer plan")}let n=t.modelMap[e];if(!n.hasApiKey)throw new Er(`API key is not provided for the embedding model: ${e}`);let o=await this.getEmbeddingConfig(r);try{return t.embeddingModel=new n.EmbeddingConstructor(o),t.embeddingModel}catch(i){throw new Er(`Error creating embedding model: ${e}. ${i.message}`)}}async getEmbeddingConfig(e){let r=ne(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await Wn(r.plusLicenseKey),timeout:1e4,batchSize:ne().embeddingBatchSize,configuration:{baseURL:GP,fetch:e.enableCors?As:void 0}},"copilot-plus-jina":{model:n,apiKey:await Wn(r.plusLicenseKey),timeout:1e4,batchSize:ne().embeddingBatchSize,dimensions:e.dimensions,baseUrl:GP+"/embeddings",configuration:{fetch:e.enableCors?As:void 0}},openai:{modelName:n,apiKey:await Wn(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:ne().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?As:void 0}},cohereai:{model:n,apiKey:await Wn(e.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await Wn(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await Wn(e.apiKey||r.azureOpenAIApiKey),azureOpenAIApiInstanceName:e.azureOpenAIApiInstanceName||r.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:e.azureOpenAIApiEmbeddingDeploymentName||r.azureOpenAIApiEmbeddingDeploymentName,azureOpenAIApiVersion:e.azureOpenAIApiVersion||r.azureOpenAIApiVersion},ollama:{baseUrl:e.baseUrl||"http://localhost:11434",model:n,truncate:!0,headers:{Authorization:`Bearer ${await Wn(e.apiKey||"default-key")}`}},"lm-studio":{modelName:n,openAIApiKey:await Wn(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?As:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await Wn(e.apiKey||""),batchSize:ne().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?As: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 Ste.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: `+En(n)+`
with CORS Error: `+En(o);throw new Error(i)}}}};Jt();var YH=require("obsidian");mo();Jt();yn();var dSt={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"},fSt={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},UH=Object.keys(dSt);function pSt(t){return t!==void 0&&UH.includes(t)?dSt[t]:void 0}var Izr=Date.now().toString().slice(5),Mzr=0;var mSt=BigInt(1e3),hSt=BigInt(1e6),gSt=BigInt(1e9);var yEe=65535;function Ti(t,e){if(e.length<yEe)Array.prototype.push.apply(t,e);else{let r=e.length;for(let n=0;n<r;n+=yEe)Array.prototype.push.apply(t,e.slice(n,n+yEe))}}function bSt(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 Rzr(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function jzr(){return typeof process<"u"&&process.release&&process.release.name==="node"}function ySt(){return BigInt(Math.floor(performance.now()*1e6))}function ij(t){return typeof t=="number"&&(t=BigInt(t)),t<mSt?`${t}ns`:t<hSt?`${t/mSt}\u03BCs`:t<gSt?`${t/hSt}ms`:`${t/gSt}s`}function py(){return Rzr()?ySt():jzr()||typeof process<"u"&&typeof process?.hrtime?.bigint=="function"?process.hrtime.bigint():typeof performance<"u"?ySt():BigInt(0)}function zH(){return`${Izr}-${Mzr++}`}function z$(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 _St(t,e){return e[1]===t[1]?t[0]-e[0]:e[1]-t[1]}function H$(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 xte(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 V$(t,e){return xte(t,[e])[e]}var Dzr={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344};function bEe(t,e){let r=Dzr[e];if(r===void 0)throw new Error(Mt("INVALID_DISTANCE_SUFFIX",t).message);return t*r}function Cte(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 Bs(t){return t?.constructor?.name==="AsyncFunction"}var Nzr=UH.join(`
- `),Lzr={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:
- ${Nzr}`,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 Mt(t,...e){let r=new Error(bSt(Lzr[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}function vSt(t){return{raw:Number(t),formatted:ij(t)}}function wSt(t){if(t.id){if(typeof t.id!="string")throw Mt("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return zH()}function _Ee(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(oO(n)){let i=wEe(n);if(!Array.isArray(o)||o.length!==i)throw Mt("INVALID_INPUT_VECTOR",r,i,o.length);continue}if(W$(n)){if(!Array.isArray(o))return r;let i=vEe(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=_Ee(o,n);if(i)return r+"."+i;continue}if(typeof o!==n)return r}}}var Fzr={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},kzr={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"};function SSt(t){return t==="geopoint"}function oO(t){return typeof t=="string"&&/^vector\[\d+\]$/.test(t)}function W$(t){return typeof t=="string"&&Fzr[t]}function vEe(t){return kzr[t]}function wEe(t){let e=Number(t.slice(7,-1));switch(!0){case isNaN(e):throw Mt("INVALID_VECTOR_VALUE",t);case e<=0:throw Mt("INVALID_VECTOR_SIZE",t);default:return e}}function xSt(){return{idToInternalId:new Map,internalIdToId:[],save:$zr,load:Bzr}}function $zr(t){return{internalIdToId:t.internalIdToId}}function Bzr(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 ci(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?ci(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 Uzr(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function zzr(t,e){let r=ci(t.sharedInternalDocumentStore,e);return t.docs[r]}function Hzr(t,e){let r=e.length,n=Array.from({length:r});for(let o=0;o<r;o++){let i=ci(t.sharedInternalDocumentStore,e[o]);n[o]=t.docs[i]}return n}function Vzr(t){return t.docs}function Wzr(t,e,r){let n=ci(t.sharedInternalDocumentStore,e);return typeof t.docs[n]<"u"?!1:(t.docs[n]=r,t.count++,!0)}function Kzr(t,e){let r=ci(t.sharedInternalDocumentStore,e);return typeof t.docs[r]>"u"?!1:(delete t.docs[r],t.count--,!0)}function Jzr(t){return t.count}function Gzr(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function Yzr(t){return{docs:t.docs,count:t.count}}function CSt(){return{create:Uzr,get:zzr,getMultiple:Hzr,getAll:Vzr,store:Wzr,remove:Kzr,count:Jzr,load:Gzr,save:Yzr}}var OSt=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"];function PSt(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),Mt("PLUGIN_CRASHED")}return r}var ESt=["tokenizer","index","documentsStore","sorter"],SEe=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"];function my(t,e,r,n){if(t.some(Bs))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function aj(t,e,r){if(t.some(Bs))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function K$(t,e,r,n,o){if(t.some(Bs))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function J$(t,e,r,n){if(t.some(Bs))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function TSt(t,e){if(t.some(Bs))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}function xEe(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(Dh(t.l),Dh(t.r))+1,e.h=Math.max(Dh(e.l),Dh(e.r))+1,e}function CEe(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(Dh(t.l),Dh(t.r))+1,e.h=Math.max(Dh(e.l),Dh(e.r))+1,e}function ISt(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 OEe(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 PEe(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 MSt(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 RSt(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}var ASt=0;function jSt(t,e,r,n=500){function o(i,a,s){if(i===null)return ASt++,{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 ASt%n===0?Xzr(i,a):i}t.root=o(t.root,e,r)}function Xzr(t,e){t.h=1+Math.max(Dh(t.l),Dh(t.r));let r=Dh(t.l)-Dh(t.r);return r>1&&e<t.l.k?CEe(t):r<-1&&e>t.r.k?xEe(t):r>1&&e>t.l.k?(t.l=xEe(t.l),CEe(t)):r<-1&&e<t.r.k?(t.r=CEe(t.r),xEe(t)):t}function Dh(t){return t!==null?t.h:-1}function DSt(t,e){let r=MSt(t.root,e);return r===null?null:r.v}function Qzr(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 NSt(t,e,r){let n=MSt(t.root,r);if(n){if(n.v.length===1){Qzr(t,r);return}n.v.splice(n.v.indexOf(e),1)}}function LSt(){return{numberToDocumentId:new Map}}function FSt(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function kSt(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 $St(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 BSt(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 H$(i)}}throw new Error("Invalid operation")}function e2r(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 EEe(t,e,r){let n=e2r(t,e,r);return{distance:n,isBounded:n>=0}}var TEe=class{constructor(e,r,n){lc(this,"k");lc(this,"s");lc(this,"c",{});lc(this,"d",[]);lc(this,"e");lc(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 G$(t,e){t.w=e.w+t.s}function Ote(t,e){t.d.push(e)}function t2r(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function AEe(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(z$(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&EEe(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),z$(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))AEe(t.c[i],e,r,n,o);return e}function qSt(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 sj(t=!1,e="",r=""){return new TEe(r,e,t)}function USt(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=qSt(u,a),d=c.length;if(u===a){Ote(s,r),s.e=!0;return}let f=u[d];if(d<l&&d===a.length){let p=sj(!0,a,i);p.c[f]=s;let m=p.c[f];m.s=u.substring(d),m.k=f,t.c[i]=p,G$(p,t),G$(m,p),Ote(p,r);return}if(d<l&&d<a.length){let p=sj(!1,c,i);p.c[f]=s,t.c[i]=p;let m=p.c[f];m.s=u.substring(d),m.k=f;let h=a[d],b=sj(!0,e.substring(o+d),h);Ote(b,r),p.c[h]=b,G$(p,t),G$(b,p),G$(m,p);return}o+=l-1,t=s}else{let u=sj(!0,a,i);Ote(u,r),t.c[i]=u,G$(u,t);return}}}function HH(t,e,r,n,o,i){if(!(n<0)){if(t.w.startsWith(e)){AEe(t,i,e,!1,0);return}if(t.e){let{w:a,d:s}=t;if(a&&(EEe(e,a,o).isBounded&&(i[a]=[]),z$(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&&HH(t.c[e[r]],e,r+1,n,o,i),HH(t,e,r+1,n-1,o,i);for(let a in t.c)HH(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&HH(t.c[a],e,r+1,n-1,o,i)}}}function IEe(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,HH(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=qSt(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 AEe(t,i,e,r,n),i}}function zSt(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||t2r(t,r)}else return!1}return!0}function HSt(){return{root:null}}function VSt(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 WSt(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 KSt(t,e,r,n=!0,o="asc",i=!1){let a=i?YSt:GSt,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 JSt(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=n2r(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=r2r(e);if(n){let u=o?YSt:GSt;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 r2r(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 n2r(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 GSt(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 YSt(t,e){let n=.0033528106647474805,o=(1-n)*6378137,i=Math.PI/180,a=t.lat*i,s=e.lat*i,u=(e.lon-t.lon)*i,l=Math.atan((1-n)*Math.tan(a)),c=Math.atan((1-n)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(c),m=Math.cos(c),h=u,b,g=1e3,_,w,x,C,E;do{let D=Math.sin(h),k=Math.cos(h);x=Math.sqrt(m*D*(m*D)+(f*p-d*m*k)*(f*p-d*m*k)),C=d*p+f*m*k,E=Math.atan2(x,C),_=f*m*D/x,w=1-_*_;let F=C-2*d*p/w,B=n/16*w*(4+n*(4-3*w));b=h,h=u+(1-B)*n*_*(E+B*x*(F+B*C*(-1+2*F*F)))}while(Math.abs(h-b)>1e-12&&--g>0);let P=w*(6378137*6378137-o*o)/(o*o),A=1+P/16384*(4096+P*(-768+P*(320-175*P))),I=P/1024*(256+P*(-128+P*(74-47*P))),R=I*x*(C-2*d*p/w+I/4*(C*(-1+2*x*x)-I/6*E*(-3+4*x*x)*(-3+4*E*E)));return o*A*(E-R)}function Pte(t,e,r=0,n){if(e===0)throw Mt("INVALID_BOOST_VALUE");let o=new Map,i=t.length;for(let h=0;h<i;h++){let b=t[h],g=b.length;for(let _=0;_<g;_++){let[w,x]=b[_],C=x*e,E=o.get(w)?.[0];E!==void 0?o.set(w,[E*1.5+C,(o?.get(w)?.[1]||0)+1]):o.set(w,[C,1])}}let a=[];for(let h of o.entries())a.push([h[0],h[1][0]]);let s=a.sort((h,b)=>b[1]-h[1]);if(r===1)return s;let u=s.length,l=[];for(let h of o.entries())l.push([h[0],h[1][0],h[1][1]]);let c=l.sort((h,b)=>h[2]>b[2]?-1:h[2]<b[2]?1:h[1]>b[1]?-1:h[1]<b[1]?1:0),d;for(let h=0;h<u&&c[h][2]===n;h++)d=h;if(typeof d>"u"){if(r===0)return[];d=0}let f=c.length,p=new Array(f);for(let h=0;h<f;h++)p[h]=[c[h][0],c[h][1]];if(r===0)return p.slice(0,d+1);let m=d+Math.ceil(r*100*(u-d)/100);return p.slice(0,u+m)}function MEe(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 REe(t,e){let r=0;for(let n=0;n<e;n++)r+=t[n]*t[n];return Math.sqrt(r)}function Ete(t,e,r,n=.8){let o=REe(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 o2r(t,e,r,n,o){let i=ci(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 i2r(t,e,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=ci(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 a2r(t,e,r,n){let o=ci(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 s2r(t,e,r){t.tokenOccurrences[e][r]--}function u2r(t,e,r,n,o){let i=Array.from(o),a=e.avgFieldLength[r],s=e.fieldLengths[r],u=e.tokenOccurrences[r],l=e.frequencies[r],c=typeof u[n]=="number"?u[n]??0:0,d=[],f=i.length;for(let p=0;p<f;p++){let m=ci(e.sharedInternalDocumentStore,i[p]),h=l?.[m]?.[n]??0,b=MEe(h,c,t.docsCount,s[m],a,t.params.relevance);d.push([m,b])}return d}function XSt(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)){XSt(t,e,a,n,s);continue}if(oO(a))n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a,n.vectorIndexes[s]={size:wEe(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:RSt(0,[]),isArray:u};break;case"string":case"string[]":n.indexes[s]={type:"Radix",node:sj(),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:LSt(),isArray:u};break;case"geopoint":n.indexes[s]={type:"BKD",node:HSt(),isArray:u};break;default:throw Mt("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,s)}n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a}}return n}function l2r(t,e,r,n,o,i,a,s){return u=>{let l=ci(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;jSt(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),USt(d,p,l);break}case"Flat":{FSt(d,u,l);break}case"BKD":{VSt(d,u,[l]);break}}}}function c2r(t,e,r,n,o,i,a,s,u,l){if(oO(i))return d2r(e,r,o,n);let c=l2r(t,e,r,n,a,s,u,l);if(!W$(i))return c(o);let d=o,f=d.length;for(let p=0;p<f;p++)c(d[p])}function d2r(t,e,r,n){r instanceof Float32Array||(r=new Float32Array(r));let o=t.vectorIndexes[e].size,i=REe(r,o);t.vectorIndexes[e].vectors[n]=[i,r]}function ZSt(t,e,r,n,o,i,a,s,u){let l=ci(e.sharedInternalDocumentStore,n);if(oO(i))return delete e.vectorIndexes[r].vectors[n],!0;let{type:c,node:d}=e.indexes[r];switch(c){case"AVL":return NSt(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),zSt(d,p,l);return!0}case"Flat":return kSt(d,l,o),!0;case"BKD":return WSt(d,o,l),!1}}function f2r(t,e,r,n,o,i,a,s,u){if(!W$(i))return ZSt(t,e,r,n,o,i,a,s,u);let l=vEe(i),c=o,d=c.length;for(let f=0;f<d;f++)ZSt(t,e,r,n,c[f],l,a,s,u);return!0}function p2r(t,e,r,n){if(!(r in e.tokenOccurrences))return[];let{node:o,type:i}=e.indexes[r];if(i!=="Radix")throw Mt("WRONG_SEARCH_PROPERTY_TYPE",r);let{exact:a,tolerance:s}=t.params,u=IEe(o,{term:n,exact:a,tolerance:s}),l=new Set;for(let c in u)if(z$(u,c))for(let f of u[c])l.add(f);return t.index.calculateResultScores(t,e,r,n,Array.from(l))}function m2r(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 Mt("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:m="m",inside:h=!0,highPrecision:b=!1}=a[d],g=bEe(f,m),_=KSt(s.root,p,g,h,void 0,b);Ti(o[i],_.flatMap(({docIDs:w})=>w))}else{let{coordinates:f,inside:p=!0,highPrecision:m=!1}=a[d],h=JSt(s.root,f,p,void 0,m);Ti(o[i],h.flatMap(({docIDs:b})=>b))}continue}if(u==="Radix"&&(typeof a=="string"||Array.isArray(a))){for(let d of[a].flat()){let f=t.tokenizer.tokenize(d,t.language,i);for(let p of f){let m=IEe(s,{term:p,exact:!0});Ti(o[i],Object.values(m).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw Mt("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?BSt:$St;Ti(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=OEe(s,f,!1);break}case"gte":{p=OEe(s,f,!0);break}case"lt":{p=PEe(s,f,!1);break}case"lte":{p=PEe(s,f,!0);break}case"eq":{p=DSt(s,f)??[];break}case"between":{let[m,h]=f;p=ISt(s,m,h);break}}Ti(o[i],p)}}return H$(Object.values(o))}function h2r(t){return t.searchableProperties}function g2r(t){return t.searchablePropertiesWithTypes}function QSt(t){let e=sj(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]=QSt(t.c[r]);return e}function y2r(t){return{numberToDocumentId:new Map(t)}}function b2r(t){return Array.from(t.numberToDocumentId.entries())}function _2r(t,e){let{indexes:r,vectorIndexes:n,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}=e,c={},d={};for(let f of Object.keys(r)){let{node:p,type:m,isArray:h}=r[f];switch(m){case"Radix":c[f]={type:"Radix",node:QSt(p),isArray:h};break;case"Flat":c[f]={type:"Flat",node:y2r(p),isArray:h};break;default:c[f]=r[f]}}for(let f of Object.keys(n)){let p=n[f].vectors;for(let m in p)p[m]=[p[m][0],new Float32Array(p[m][1])];d[f]={size:n[f].size,vectors:p}}return{sharedInternalDocumentStore:t,indexes:c,vectorIndexes:d,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}}function v2r(t){let{indexes:e,vectorIndexes:r,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}=t,l={};for(let d of Object.keys(r)){let f=r[d].vectors;for(let p in f)f[p]=[f[p][0],Array.from(f[p][1])];l[d]={size:r[d].size,vectors:f}}let c={};for(let d of Object.keys(e)){let{type:f,node:p,isArray:m}=e[d];if(f!=="Flat"){c[d]=e[d];continue}c[d]={type:"Flat",node:b2r(p),isArray:m}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function ext(){return{create:XSt,insert:c2r,remove:f2r,insertDocumentScoreParameters:o2r,insertTokenScoreParameters:i2r,removeDocumentScoreParameters:a2r,removeTokenScoreParameters:s2r,calculateResultScores:u2r,search:p2r,searchByWhereClause:m2r,getSearchableProperties:h2r,getSearchablePropertiesWithTypes:g2r,load:_2r,save:v2r}}function txt(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=txt(t,e,s,n,u);Ti(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!oO(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 Mt("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function S2r(t,e,r,n){return n?.enabled!==!1?txt(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function x2r(t,e,r,n){if(!t.enabled)return;t.isSorted=!1;let o=ci(t.sharedInternalDocumentStore,r),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&jEe(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function rxt(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)E2r(t,r);t.isSorted=!0}function C2r(t,e,r){return e[1].localeCompare(r[1],pSt(t))}function O2r(t,e){return t[1]-e[1]}function P2r(t,e){return e[1]?-1:1}function E2r(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=C2r.bind(null,t.language);break;case"number":n=O2r.bind(null);break;case"boolean":n=P2r.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 T2r(t){let e=Object.keys(t.sorts);for(let r of e)jEe(t,r)}function jEe(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 A2r(t,e,r){if(!t.enabled)return;let n=t.sorts[e],o=ci(t.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function I2r(t,e,r){if(!t.enabled)throw Mt("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw Mt("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return jEe(t,n),rxt(t),e.sort((a,s)=>{let u=i.docs.get(ci(t.sharedInternalDocumentStore,a[0])),l=i.docs.get(ci(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 M2r(t){return t.enabled?t.sortableProperties:[]}function R2r(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function j2r(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 D2r(t){if(!t.enabled)return{enabled:!1};T2r(t),rxt(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 nxt(){return{create:S2r,insert:x2r,remove:A2r,save:D2r,load:j2r,sortBy:I2r,getSortableProperties:M2r,getSortablePropertiesWithTypes:R2r}}var L2r=[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 F2r(t){return t<192||t>383?t:L2r[t-192]||t}function oxt(t){let e=[];for(let r=0;r<t.length;r++)e[r]=F2r(t.charCodeAt(r));return String.fromCharCode(...e)}var k2r={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"},$2r={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},B2r="[^aeiou]",Ate="[aeiouy]",FS=B2r+"[^aeiouy]*",VH=Ate+"[aeiou]*",DEe="^("+FS+")?"+VH+FS,q2r="^("+FS+")?"+VH+FS+"("+VH+")?$",Tte="^("+FS+")?"+VH+FS+VH+FS,ixt="^("+FS+")?"+Ate;function axt(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(DEe),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(ixt),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+FS+Ate+"[^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(ixt),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(DEe),e&&n.test(e)&&(t=e+k2r[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(DEe),e&&n.test(e)&&(t=e+$2r[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(Tte),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(Tte),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(Tte),o=new RegExp(q2r),i=new RegExp("^"+FS+Ate+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(Tte),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}function NEe(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=oxt(e),this.normalizationCache.set(r,e),e)}function U2r(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function sxt(t,e,r){if(e&&e!==this.language)throw Mt("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=fSt[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=U2r(n);return this.allowDuplicates?o:Array.from(new Set(o))}function LEe(t={}){if(!t.language)t.language="english";else if(!UH.includes(t.language))throw Mt("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw Mt("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=axt;else throw Mt("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 Mt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw Mt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw Mt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:sxt,language:t.language,stemmer:e,stemmerSkipProperties:new Set(t.stemmerSkipProperties?[t.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(t.tokenizeSkipProperties?[t.tokenizeSkipProperties].flat():[]),stopWords:r,allowDuplicates:!!t.allowDuplicates,normalizeToken:NEe,normalizationCache:new Map};return n.tokenize=sxt.bind(n),n.normalizeToken=NEe,n}function H2r(t){let e={formatElapsedTime:vSt,getDocumentIndexId:wSt,getDocumentProperties:xte,validateSchema:_Ee};for(let r of SEe){let n=r;if(t[n]){if(typeof t[n]!="function")throw Mt("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!ESt.includes(r)&&!SEe.includes(r))throw Mt("UNSUPPORTED_COMPONENT",r)}function Y$({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=zH());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=LEe(a):a=LEe({language:r??"english"}),n.tokenizer&&r)throw Mt("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=xSt();s||(s=ext()),l||(l=nxt()),u||(u=CSt()),H2r(n);let{getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,formatElapsedTime:m}=n,h={data:{},caches:{},schema:t,tokenizer:a,index:s,sorter:l,documentsStore:u,internalDocumentIDStore:c,getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],afterUpdateMultiple:[],beforeUpdateMultiple:[],afterCreate:[],formatElapsedTime:m,id:o,plugins:i,version:V2r()};h.data={index:h.index.create(h,c,t),docs:h.documentsStore.create(h,c),sorting:h.sorter.create(h,c,t,e)};for(let g of OSt)h[g]=(h[g]??[]).concat(PSt(h,g));let b=h.afterCreate;return b&&TSt(b,h),h}function V2r(){return"{{VERSION}}"}var Ite="fulltext",FEe="hybrid",kEe="vector";var tA=Symbol("orama.insertions"),rA=Symbol("orama.removals");var uxt=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)};function $Ee(t){typeof t[tA]!="number"&&(queueMicrotask(()=>{t[tA]=void 0}),t[tA]=0),t[tA]>1e3?(uxt("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[tA]=-1):t[tA]>=0&&t[tA]++}function BEe(t){typeof t[rA]!="number"&&(queueMicrotask(()=>{t[rA]=void 0}),t[rA]=0),t[rA]>1e3?(uxt("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[rA]=-1):t[rA]>=0&&t[rA]++}function WH(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw Mt("SCHEMA_VALIDATION_FAILURE",i);return Bs(t.index.beforeInsert)||Bs(t.index.insert)||Bs(t.index.afterInsert)?G2r(t,e,r,n,o):Y2r(t,e,r,n,o)}var K2r=new Set(["enum","enum[]"]),J2r=new Set(["string","number"]);async function G2r(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Mt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Mt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await my(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=c[f];lxt(m,h,f,p)}return await Z2r(t,s,l,d,u,r,e,o),n||await my(t.afterInsert,t,s,e),$Ee(t),s}function Y2r(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Mt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Mt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||my(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=c[f];lxt(m,h,f,p)}return X2r(t,s,l,d,u,r,e,o),n||my(t.afterInsert,t,s,e),$Ee(t),s}function lxt(t,e,r,n){if(!(SSt(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(oO(e)&&Array.isArray(n))&&!(W$(e)&&Array.isArray(n))&&!(K2r.has(e)&&J2r.has(t))&&t!==e)throw Mt("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function Z2r(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 X2r(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 uj(t,e,r,n){return Bs(t.index.beforeRemove)||Bs(t.index.remove)||Bs(t.index.afterRemove)?Q2r(t,e,r,n):e4r(t,e,r,n)}async function Q2r(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,ci(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await my(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let b=f[h];if(typeof b>"u")continue;let g=d[h];await t.index.beforeRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l),await t.index.remove(t.index,t.data.index,h,e,b,g,r,t.tokenizer,l)||(o=!1),await t.index.afterRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l)}let p=await t.sorter.getSortableProperties(t.data.sorting),m=await t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||await my(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),BEe(t),o}function e4r(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,ci(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||my(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let b=f[h];if(typeof b>"u")continue;let g=d[h];t.index.beforeRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l),t.index.remove(t.index,t.data.index,h,e,b,g,r,t.tokenizer,l)||(o=!1),t.index.afterRemove?.(t.data.index,h,u,b,g,r,t.tokenizer,l)}let p=t.sorter.getSortableProperties(t.data.sorting),m=t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||my(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),BEe(t),o}function KH(t,e,r,n,o){return Bs(t.index.beforeRemove)||Bs(t.index.remove)||Bs(t.index.afterRemove)||Bs(t.beforeRemoveMultiple)||Bs(t.afterRemoveMultiple)?t4r(t,e,r,n,o):r4r(t,e,r,n,o)}async function t4r(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>jh(t.internalDocumentIDStore,ci(t.internalDocumentIDStore,s)));return o||await aj(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 uj(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await aj(t.afterRemoveMultiple,t,a),i}function r4r(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>jh(t.internalDocumentIDStore,ci(t.internalDocumentIDStore,l)));o||aj(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)uj(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||aj(t.afterRemoveMultiple,t,a),i}function n4r(t,e){return t[1]-e[1]}function o4r(t,e){return e[1]-t[1]}function i4r(t="desc"){return t.toLowerCase()==="asc"?n4r:o4r}function Z$(t,e,r){let n={},o=e.map(([l])=>l),i=t.documentsStore.getMultiple(t.data.docs,o),a=Object.keys(r),s=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let l of a){let c;if(s[l]==="number"){let{ranges:d}=r[l],f=d.length,p=Array.from({length:f});for(let m=0;m<f;m++){let h=d[m];p[m]=[`${h.from}-${h.to}`,0]}c=Object.fromEntries(p)}n[l]={count:0,values:c??{}}}let u=i.length;for(let l=0;l<u;l++){let c=i[l];for(let d of a){let f=d.includes(".")?V$(c,d):c[d],p=s[d],m=n[d].values;switch(p){case"number":{let h=r[d].ranges;cxt(h,m)(f);break}case"number[]":{let h=new Set,b=r[d].ranges,g=cxt(b,m,h);for(let _ of f)g(_);break}case"boolean":case"enum":case"string":{dxt(m,p)(f);break}case"boolean[]":case"enum[]":case"string[]":{let g=dxt(m,p==="boolean[]"?"boolean":"string",new Set);for(let _ of f)g(_);break}default:throw Mt("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=i4r(d.sort);c.values=Object.fromEntries(Object.entries(c.values).sort(f).slice(d.offset??0,d.limit??10))}}return n}function cxt(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 dxt(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 X$(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 a4r={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},fxt=["string","number","boolean"];function Q$(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 Mt("UNKNOWN_GROUP_BY_PROPERTY",_);if(!fxt.includes(i[_]))throw Mt("INVALID_GROUP_BY_PROPERTY",_,fxt.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],w={property:_,perValue:{}},x=new Set;for(let C=0;C<u;C++){let E=s[C],P=V$(E,_);if(typeof P>"u")continue;let A=typeof P!="boolean"?P:""+P,I=w.perValue[A]??{indexes:[],count:0};I.count>=l||(I.indexes.push(C),I.count++,w.perValue[A]=I,x.add(P))}c.push(Array.from(x)),d[_]=w}let f=pxt(c),p=f.length,m=[];for(let g=0;g<p;g++){let _=f[g],w=_.length,x={values:[],indexes:[]},C=[];for(let E=0;E<w;E++){let P=_[E],A=n[E];C.push(d[A].perValue[typeof P!="boolean"?P:""+P].indexes),x.values.push(P)}x.indexes=H$(C).sort((E,P)=>E-P),x.indexes.length!==0&&m.push(x)}let h=m.length,b=Array.from({length:h});for(let g=0;g<h;g++){let _=m[g],w=r.reduce||a4r,x=_.indexes.map(A=>({id:a[A],score:e[A][1],document:s[A]})),C=w.reducer.bind(null,_.values),E=w.getInitialValue(_.indexes.length),P=x.reduce(C,E);b[g]={values:_.values,result:P}}return b}function pxt(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=pxt(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 mxt(t,e,r){let n=py(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(Mte,e.relevance??{});let s=Object.keys(t.data.index.vectorIndexes),u=e.facets&&Object.keys(e.facets).length>0,{limit:l=10,offset:c=0,term:d,properties:f,threshold:p=0,distinctOn:m,includeVectors:h=!1}=e,b=e.preflight===!0,{index:g,docs:_}=t.data,w=t.tokenizer.tokenize(d??"",r),x=t.caches.propertiesToSearch;if(!x){let D=t.index.getSearchablePropertiesWithTypes(g);x=t.index.getSearchableProperties(g),x=x.filter(k=>D[k].startsWith("string")),t.caches.propertiesToSearch=x}if(f&&f!=="*"){for(let D of f)if(!x.includes(D))throw Mt("UNKNOWN_INDEX",D,x.join(", "));x=x.filter(D=>f.includes(D))}let C=lj(t.tokenizer,t.index,t.documentsStore,r,e,x,w,t.documentsStore.count(_),n),E=Object.keys(e.where??{}).length>0,P=[];E&&(P=t.index.searchByWhereClause(C,g,e.where));let A=w.length;if(A||f?.length){let D=x.length;for(let k=0;k<D;k++){let F=x[k],B=C.indexMap[F];if(A!==0)for(let L=0;L<A;L++){let z=w[L],K=t.index.search(C,g,F,z);Ti(B[z],K)}else{B[""]=[];let L=t.index.search(C,g,F,"");Ti(B[""],L)}let q=Object.values(B);C.docsIntersection[F]=Pte(q,e?.boost?.[F]??1,p,A);let W=C.docsIntersection[F],H=W.length;for(let L=0;L<H;L++){let[z,K]=W[L],J=C.uniqueDocsIDs[z];J?C.uniqueDocsIDs[z]=J+K+.5:C.uniqueDocsIDs[z]=K}}}else w.length===0&&d?C.uniqueDocsIDs={}:C.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(D=>[D,0]));let I=Object.entries(C.uniqueDocsIDs).map(([D,k])=>[+D,k]);if(E&&(I=X$(P,I)),e.sortBy)if(typeof e.sortBy=="function"){let D=I.map(([B])=>B),F=t.documentsStore.getMultiple(t.data.docs,D).map((B,q)=>[I[q][0],I[q][1],B]);F.sort(e.sortBy),I=F.map(([B,q])=>[B,q])}else I=t.sorter.sortBy(t.data.sorting,I,e.sortBy).map(([D,k])=>[ci(t.internalDocumentIDStore,D),k]);else I=I.sort(_St);let R;b||(R=m?hxt(t,I,c,l,m):Rte(t,I,c,l));let j={elapsed:{formatted:"",raw:0},hits:[],count:I.length};if(typeof R<"u"&&(j.hits=R.filter(Boolean),h||Cte(j,s)),u){let D=Z$(t,I,e.facets);j.facets=D}return e.groupBy&&(j.groups=Q$(t,I,e.groupBy)),j.elapsed=t.formatElapsedTime(py()-C.timeStart),j}async function a(){t.beforeSearch&&await J$(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await K$(t.afterSearch,t,e,r,s),s}return o?a():i()}function qEe(t,e,r="english"){let n=py(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw Mt("INVALID_VECTOR_INPUT",Object.keys(s).join(", "));let{limit:u=10,offset:l=0,includeVectors:c=!1}=e,d=t.data.index.vectorIndexes[s.property],f=d.size,p=d.vectors,m=e.facets&&Object.keys(e.facets).length>0,h=Object.keys(e.where??{}).length>0,{index:b,docs:g}=t.data;if(s?.value.length!==f)throw s?.property===void 0||s?.value.length===void 0?Mt("INVALID_INPUT_VECTOR","undefined",f,"undefined"):Mt("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let _=Ete(s.value,p,f,e.similarity).map(([D,k])=>[ci(t.internalDocumentIDStore,D),k]),w=t.caches.propertiesToSearch;if(!w){let D=t.index.getSearchablePropertiesWithTypes(b);w=t.index.getSearchableProperties(b),w=w.filter(k=>D[k].startsWith("string")),t.caches.propertiesToSearch=w}let x=[],C=lj(t.tokenizer,t.index,t.documentsStore,r,e,w,x,t.documentsStore.count(g),n),E=[];h&&(E=t.index.searchByWhereClause(C,b,e.where),_=X$(E,_));let P=[];m&&(P=Z$(t,_,e.facets));let A=Array.from({length:u});for(let D=0;D<u;D++){let k=_[D+l];if(!k)break;let F=t.data.docs.docs[k[0]];if(F){c||(F[s.property]=null);let B={id:jh(t.internalDocumentIDStore,k[0]),score:k[1],document:F};A[D]=B}}let I=[];e.groupBy&&(I=Q$(t,_,e.groupBy));let j=py()-n;return{count:_.length,hits:A.filter(Boolean),elapsed:{raw:Number(j),formatted:ij(j)},...P?{facets:P}:{},...I?{groups:I}:{}}}async function a(){t.beforeSearch&&await J$(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await K$(t.afterSearch,t,e,r,s),s}return o?a():i()}function yxt(t,e,r){let n=py(),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=s4r(t,e,r),f=u4r(t,e),{index:p,docs:m}=t.data,h=e.hybridWeights,b=c4r(d,f,e.term??"",h),g=t.tokenizer.tokenize(e.term??"",r),_=t.caches.propertiesToSearch;if(!_){let j=t.index.getSearchablePropertiesWithTypes(p);_=t.index.getSearchableProperties(p),_=_.filter(D=>j[D].startsWith("string")),t.caches.propertiesToSearch=_}if(e.properties&&e.properties!=="*"){for(let j of e.properties)if(!_.includes(j))throw Mt("UNKNOWN_INDEX",j,_.join(", "));_=_.filter(j=>e.properties.includes(j))}let w=lj(t.tokenizer,t.index,t.documentsStore,r,e,_,g,t.documentsStore.count(m),n),x=Object.keys(e.where??{}).length>0,C=[];x&&(C=t.index.searchByWhereClause(w,p,e.where),b=X$(C,b));let E;c&&(E=Z$(t,b,e.facets));let P;e.groupBy&&(P=Q$(t,b,e.groupBy));let A=Rte(t,b,s,u).filter(Boolean),I=py(),R={count:b.length,elapsed:{raw:Number(I-n),formatted:ij(I-n)},hits:A,...E?{facets:E}:{},...P?{groups:P}:{}};if(!l){let j=Object.keys(t.data.index.vectorIndexes);Cte(R,j)}return R}async function a(){t.beforeSearch&&await J$(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await K$(t.afterSearch,t,e,r,s),s}return o?a():i()}function s4r(t,e,r){let n=py();e.relevance=Object.assign(Mte,e.relevance??{});let{term:o="",properties:i,threshold:a=0}=e,{index:s,docs:u}=t.data,l=t.tokenizer.tokenize(o,r),c=t.caches.propertiesToSearch;if(!c){let m=t.index.getSearchablePropertiesWithTypes(s);c=t.index.getSearchableProperties(s),c=c.filter(h=>m[h].startsWith("string")),t.caches.propertiesToSearch=c}if(i&&i!=="*"){let m=new Set(c),h=new Set(i);for(let b of i)if(!m.has(b))throw Mt("UNKNOWN_INDEX",b,c.join(", "));c=c.filter(b=>h.has(b))}let d=lj(t.tokenizer,t.index,t.documentsStore,r,e,c,l,t.documentsStore.count(u),n),f=l.length;if(f||i&&i.length>0){let m=c.length;for(let h=0;h<m;h++){let b=c[h];if(f!==0)for(let C=0;C<f;C++){let E=l[C],P=t.index.search(d,s,b,E);Ti(d.indexMap[b][E],P)}else{let C=[];d.indexMap[b][""]=C;let E=t.index.search(d,s,b,"");Ti(C,E)}let g=d.indexMap[b],_=Object.values(g);d.docsIntersection[b]=Pte(_,e?.boost?.[b]??1,a,f);let w=d.docsIntersection[b],x=w.length;for(let C=0;C<x;C++){let[E,P]=w[C],A=d.uniqueDocsIDs[E];d.uniqueDocsIDs[E]=A?A+P+.5:P}}}else l.length===0&&o?d.uniqueDocsIDs={}:d.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(m=>[m,0]));let p=Object.entries(d.uniqueDocsIDs).map(([m,h])=>[+m,h]).sort((m,h)=>h[1]-m[1]);return bxt(p)}function u4r(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 Mt("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw Mt("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=Ete(r.value,i,o,e.similarity).map(([s,u])=>[ci(t.internalDocumentIDStore,s),u]);return bxt(a)}function UEe([,t]){return t}function bxt(t){let e=Math.max.apply(Math,t.map(UEe));return t.map(([r,n])=>[r,n/e])}function gxt(t,e){return t/e}function l4r(t,e){return(r,n)=>r*t+n*e}function c4r(t,e,r,n){let o=Math.max.apply(Math,t.map(UEe)),i=Math.max.apply(Math,e.map(UEe)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:d4r(r),l=new Map,c=t.length,d=l4r(s,u);for(let p=0;p<c;p++){let[m,h]=t[p],b=gxt(h,o),g=d(b,0);l.set(m,g)}let f=e.length;for(let p=0;p<f;p++){let[m,h]=e[p],b=gxt(h,i),g=l.get(m)??0;l.set(m,g+d(0,b))}return[...l].sort((p,m)=>m[1]-p[1])}function d4r(t){return{text:.5,vector:.5}}var Mte={k:1.2,b:.75,d:.5};function lj(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 Fc(t,e,r){let n=e.mode??Ite;if(n===Ite)return mxt(t,e,r);if(n===kEe)return qEe(t,e);if(n===FEe)return yxt(t,e);throw Mt("INVALID_SEARCH_MODE",n)}function hxt(t,e,r,n,o){let i=t.data.docs,a=new Map,s=[],u=new Set,l=e.length,c=0;for(let d=0;d<l;d++){let f=e[d];if(typeof f>"u")continue;let[p,m]=f;if(u.has(p))continue;let h=t.documentsStore.get(i,p),b=V$(h,o);if(!(typeof b>"u"||a.has(b))&&(a.set(b,!0),c++,!(c<=r)&&(s.push({id:jh(t.internalDocumentIDStore,p),score:m,document:h}),u.add(p),c>=r+n)))break}return s}function Rte(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 jte(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 zEe(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 oIo=new Error("timeout while waiting for mutex to become available"),iIo=new Error("mutex already locked"),p4r=new Error("request for lock canceled"),m4r=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())})},HEe=class{constructor(e,r=p4r){this._value=e,this._cancelError=r,this._queue=[],this._weightedWaiters=[]}acquire(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((n,o)=>{let i={resolve:n,reject:o,weight:e,priority:r},a=_xt(this._queue,s=>r<=s.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return m4r(this,arguments,void 0,function*(r,n=1,o=0){let[i,a]=yield this.acquire(n,o);try{return yield r(i)}finally{a()}})}waitForUnlock(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,r)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),h4r(this._weightedWaiters[e-1],{resolve:n,priority:r})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){let r=this._value;this._value-=e.weight,e.resolve([r,this._newReleaser(e.weight)])}_newReleaser(e){let r=!1;return()=>{r||(r=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){let r=this._weightedWaiters[e-1];r&&(r.forEach(n=>n.resolve()),this._weightedWaiters[e-1]=[])}else{let e=this._queue[0].priority;for(let r=this._value;r>0;r--){let n=this._weightedWaiters[r-1];if(!n)continue;let o=n.findIndex(i=>i.priority<=e);(o===-1?n:n.splice(0,o)).forEach(i=>i.resolve())}}}_couldLockImmediately(e,r){return(this._queue.length===0||this._queue[0].priority<r)&&e<=this._value}};function h4r(t,e){let r=_xt(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function _xt(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var g4r=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())})},Dte=class{constructor(e){this._semaphore=new HEe(1,e)}acquire(){return g4r(this,arguments,void 0,function*(e=0){let[,r]=yield this._semaphore.acquire(1,e);return r})}runExclusive(e,r=0){return this._semaphore.runExclusive(()=>e(),1,r)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}};var MCt=$(eB()),kS=require("obsidian");Jt();var KEe="copilot-index-chunk-",y4r=".json",_re=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${KEe}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${KEe}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${y4r}`}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,[]);ne().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,ne().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),ne().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 zEe(e),n=ne().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(ne().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)),ne().debug&&console.log("Saved empty database state");return}let a=this.distributeDocumentsToPartitions(i,n),s={numPartitions:n,vectorLength:e.schema.embedding.match(/\d+/)[0],schema:e.schema,lastModified:Date.now(),documentPartitions:Object.fromEntries(i.map(l=>[l.id,this.assignDocumentToPartition(l.id,n)]))};await this.saveMetadata(s);let u={...r,docs:{docs:{},count:0},index:{...r.index,vectorIndexes:void 0}};for(let[l,c]of a.entries()){let d={index:{vectorIndexes:{embedding:{size:r.index.vectorIndexes.embedding.size,vectors:Object.fromEntries(Object.entries(r.index.vectorIndexes.embedding.vectors).filter(([m])=>c.some(h=>h.id===m)))}}},docs:{docs:Object.fromEntries(c.map((m,h)=>[(h+1).toString(),m])),count:c.length}},f=l===0?{...u,docs:d.docs,index:{...u.index,vectorIndexes:d.index.vectorIndexes}}:d,p=this.getChunkPath(l);await this.ensureDirectoryExists(p),await this.app.vault.adapter.write(p,JSON.stringify(f)),ne().debug&&console.log(`Saved partition ${l+1}/${n}`)}ne().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new Er(`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 Er("Invalid legacy database format");let l=await Y$({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await jte(l,u),l}let r=await this.loadMetadata(),n=await Y$({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 Er("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++):ne().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 jte(n,o),n}catch(e){throw console.error("Error loading database:",e),new Er(`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}/${KEe}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new Er(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(ne().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 Er("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new Er("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))}};Jt();yn();var JEe=require("obsidian");async function ACt(t){if(!t)throw new Er("Embedding instance not found.");try{let r=await t.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new Er("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${$s.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new Er("Failed to determine embedding vector length. Please check your embedding model settings.")}}async function ICt(t){let e="",{inclusions:r,exclusions:n}=Om(),o=t.vault.getMarkdownFiles().filter(i=>Cp(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function Cm(t){let e=[];return e.push(...t.split(",").map(r=>decodeURIComponent(r.trim())).filter(r=>r.length>0)),e}function b4r(){return ne().qaExclusions?Cm(ne().qaExclusions):[]}function _4r(){return ne().qaInclusions?Cm(ne().qaInclusions):[]}function Om(t){let e=t?.inclusions?Cm(t.inclusions):t?.isProject?[]:_4r(),r=t?.exclusions?Cm(t.exclusions):t?.isProject?[]:b4r();return{inclusions:e.length>0?iA(e):null,exclusions:r.length>0?iA(r):null}}function Cp(t,e,r){return!(r&&TCt(t.path,r)||e&&!TCt(t.path,e))}function iA(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 vre({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function v4r(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof JEe.TFile){let n=Tz(r);if(e.some(o=>n.includes(JN(o))))return!0}return!1}function w4r(t,e){if(e.length===0)return!1;let r=t.toLowerCase();return e.some(n=>{let o=n.slice(1).toLowerCase();return r.endsWith(o)})}function S4r(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 x4r(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof JEe.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function TCt(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return v4r(t,r??[])||w4r(t,n??[])||S4r(t,o??[])||x4r(t,i??[])}function wre(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 aO=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new Dte;Mi(async()=>{let r=ne();kS.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):kS.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await $s.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(ae("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await $s.getInstance().getEmbeddingsAPI()),ae("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new Er("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new _re(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),kS.Platform.isMobile&&ne().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new Er("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),ae("Loaded existing chunked Orama database from disk."),this.oramaDb}catch(n){fe("Failed to load existing database, creating new one:",n)}let r=await this.createNewDb(e);return this.oramaDb=r,r}catch(r){fe("Error initializing Orama database:",r),new kS.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(kS.Platform.isMobile&&ne().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await $s.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new Er("Orama database not found.")}catch(e){throw fe("Failed to initialize database during save:",e),new Er("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,ne().debug&&ae("Orama database saved successfully at:",this.dbPath)}catch(e){throw fe("Error saving Orama database:",e),e}}}async clearIndex(e){try{this.oramaDb||await this.initializeDB(e),await this.chunkedStorage?.clearStorage(),await new Promise(r=>setTimeout(r,100)),this.oramaDb=await this.createNewDb(e),await this.saveDB(),new kS.Notice("Local Copilot index cleared successfully."),ae("Local Copilot index cleared successfully, new instance created.")}catch(r){throw fe("Error clearing the local Copilot index:",r),new kS.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new Er("Orama database not found.");try{let r=await Fc(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await KH(this.oramaDb,r.hits.map(n=>n.id),500),ne().debug&&ae(`Deleted document from local Copilot index: ${e}`)),this.markUnsavedChanges()}catch(r){fe("Error deleting document from local Copilotindex:",r)}}getDb(){return this.oramaDb||console.warn("Database not initialized. Some features may be limited."),this.oramaDb}async getIsIndexLoaded(){return this.isIndexLoaded}async waitForInitialization(){await this.initializationPromise}onunload(){this.hasUnsavedChanges&&this.saveDB()}getCurrentDbPath(){return this.dbPath}async getDbPath(){let e=this.app.vault.getRoot().path,r;if(ne().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),ae("Created directory:",r))}return r}getVaultIdentifier(){let e=this.app.vault.getName();return(0,MCt.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new Er("Embedding instance not found.");let r=await ACt(e);if(!r||r===0)throw new Er("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await Y$({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return ae(`Created new Orama database for ${this.dbPath}. Embedding model: ${$s.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 Fc(e,{term:r,properties:["path"],exact:!0,includeVectors:!0})).hits:void 0}static async getDocsByEmbedding(e,r,n){return(await Fc(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 Fc(e,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return r.hits.length>0?r.hits[0].document.mtime:0}catch(r){return fe("Error getting latest file mtime from VectorDB:",r),0}}createDynamicSchema(e){return{id:"string",title:"string",path:"string",content:"string",embedding:`vector[${e}]`,embeddingModel:"string",created_at:"number",ctime:"number",mtime:"number",tags:"string[]",extension:"string"}}async upsert(e){if(!this.oramaDb)throw new Error("DB not initialized");let r=this.oramaDb;return await this.upsertMutex.runExclusive(async()=>{try{let n=this.chunkedStorage?.assignDocumentToPartition(e.id,ne().numPartitions),o=await Fc(r,{term:e.id,properties:["id"],limit:1});o.hits.length>0&&await uj(r,o.hits[0].id);try{return await WH(r,e),ae(`${o.hits.length>0?"Updated":"Inserted"} document ${e.id} in partition ${n}`),this.markUnsavedChanges(),e}catch(i){if(fe(`Failed to ${o.hits.length>0?"update":"insert"} document ${e.id}:`,i),o.hits.length>0)try{await WH(r,o.hits[0].document)}catch(a){fe("Failed to restore previous document version:",a)}return}}catch(n){fe(`Error upserting document ${e.id}:`,n);return}})}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let e=await Fc(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return e.hits.length>0?e.hits[0].document.mtime:0}catch(e){return fe("Error getting latest file mtime from VectorDB:",e),0}}async checkAndHandleEmbeddingModelChange(e){if(!this.oramaDb){ae("Embedding model change detected. Orama database not found. Initializing new database...");try{return await this.initializeDB(e),!0}catch(o){throw fe("Failed to initialize database:",o),new Er("Failed to initialize Orama database. Please check your embedding model settings.")}}let r=await Fc(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=$s.getModelName(e);if(!QUe(n,o))return new kS.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),ae("Detected change in embedding model. Rebuilding Copilot index from scratch."),this.oramaDb=await this.createNewDb(e),await this.saveDB(),!0}else ae("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await Fc(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){ae("Orama database not found during garbage collection. Attempting to initialize...");try{let e=await $s.getInstance().getEmbeddingsAPI();if(!e)throw new Er("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new Er("Failed to initialize database after attempt.")}catch(e){throw fe("Failed to initialize database during garbage collection:",e),new Er("Failed to initialize database. Please check your embedding model settings.")}}try{let e=this.app.vault.getMarkdownFiles(),r=new Set(e.map(i=>i.path)),o=(await t.getAllDocuments(this.oramaDb)).filter(i=>!r.has(i.path));return o.length===0?0:(ae("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(o.map(i=>i.path))).join(", ")),o.length===1?await uj(this.oramaDb,o[0].id):await KH(this.oramaDb,o.map(i=>i.id),500),await this.saveDB(),o.length)}catch(e){throw fe("Error garbage collecting the Copilot index:",e),new Er("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new Er("Orama database not found.");try{let e=await t.getAllDocuments(this.oramaDb),r=new Set;return e.forEach(n=>{r.add(n.path)}),Array.from(r).sort()}catch(e){throw fe("Error getting indexed files:",e),new Er("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await Fc(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw fe("Error checking if database is empty:",e),new Er("Failed to check if database is empty.")}}async hasIndex(e){if(!this.oramaDb)return!1;let r=await t.getDocsByPath(this.oramaDb,e);return r!==void 0&&r.length>0}async hasEmbeddings(e){if(!this.oramaDb)return!1;let r=await t.getDocsByPath(this.oramaDb,e);return!r||r.length===0?!1:r.every(n=>n?.document?.embedding&&Array.isArray(n.document.embedding)&&n.document.embedding.length>0)}async getDocsJsonByPaths(e){if(!this.oramaDb)throw new Er("Orama database not found.");let r={};for(let n of e){let o=await t.getDocsByPath(this.oramaDb,n);o&&o.length>0&&(r[n]=o.map(i=>({id:i.document.id,title:i.document.title,path:i.document.path,content:i.document.content,metadata:i.document.metadata,embedding:i.document.embedding,embeddingModel:i.document.embeddingModel,tags:i.document.tags,extension:i.document.extension,nchars:i.document.nchars})))}return r}markFileMissingEmbeddings(e){this.filesWithoutEmbeddings.add(e)}clearFilesMissingEmbeddings(){this.filesWithoutEmbeddings.clear()}getFilesMissingEmbeddings(){return Array.from(this.filesWithoutEmbeddings)}isFileMissingEmbeddings(e){return this.filesWithoutEmbeddings.has(e)}async checkIndexIntegrity(){if(!this.oramaDb)throw new Er("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?ae("Files missing embeddings after integrity check:",r.join(", ")):ae("Index integrity check completed. All documents have embeddings.")}catch(e){throw fe("Error checking index integrity:",e),new Er("Failed to check index integrity.")}}};pf();Jt();var tB=require("obsidian");var C4r=5e3,Sre=class{constructor(e,r,n){this.app=e;this.indexOps=r;this.dbOps=n;this.debounceTimer=null;this.lastActiveFile=null;this.lastActiveFileMtime=null;this.handleActiveLeafChange=async e=>{if(tB.Platform.isMobile&&ne().disableIndexOnMobile||hb()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof tB.MarkdownView?i.file:null,this.lastActiveFileMtime=this.lastActiveFile?.stat?.mtime??null,!(!n||n===this.lastActiveFile)&&!(!n?.stat?.mtime||o===null)&&n.extension==="md"){let{inclusions:a,exclusions:s}=Om(),u=Cp(n,a,s),l=o!==null&&n.stat.mtime>o;u&&l&&this.debouncedReindexFile(n)}};this.debouncedReindexFile=e=>{this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{ne().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},C4r)};this.handleFileDelete=async e=>{e instanceof tB.TFile&&await this.dbOps.removeDocs(e.path)};this.initializeEventListeners()}initializeEventListeners(){ne().debug&&console.log("Copilot Plus: Initializing event listeners"),this.app.workspace.on("active-leaf-change",this.handleActiveLeafChange),this.app.vault.on("delete",this.handleFileDelete)}cleanup(){this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.app.workspace.off("active-leaf-change",this.handleActiveLeafChange),this.app.vault.off("delete",this.handleFileDelete)}unload(){this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.lastActiveFile=null,this.lastActiveFileMtime=null,this.app.workspace.off("active-leaf-change",this.handleActiveLeafChange),this.app.vault.off("delete",this.handleFileDelete)}};Zr();mo();var GH=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()}};Jt();yn();var jCt=$(eB());RCt();lf();var xre=class extends gn{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)}};WOe();var GEe=class extends xre{constructor(e){if(super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","document_transformers","text_splitters"]}),Object.defineProperty(this,"chunkSize",{enumerable:!0,configurable:!0,writable:!0,value:1e3}),Object.defineProperty(this,"chunkOverlap",{enumerable:!0,configurable:!0,writable:!0,value:200}),Object.defineProperty(this,"keepSeparator",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lengthFunction",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.chunkSize=e?.chunkSize??this.chunkSize,this.chunkOverlap=e?.chunkOverlap??this.chunkOverlap,this.keepSeparator=e?.keepSeparator??this.keepSeparator,this.lengthFunction=e?.lengthFunction??(r=>r.length),this.chunkOverlap>=this.chunkSize)throw new Error("Cannot have chunkOverlap >= chunkSize")}async transformDocuments(e,r={}){return this.splitDocuments(e,r)}splitOnSeparator(e,r){let n;if(r)if(this.keepSeparator){let o=r.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&");n=e.split(new RegExp(`(?=${o})`))}else n=e.split(r);else n=e.split("");return n.filter(o=>o!=="")}async createDocuments(e,r=[],n={}){let o=r.length>0?r:[...Array(e.length)].map(()=>({})),{chunkHeader:i="",chunkOverlapHeader:a="(cont'd) ",appendChunkOverlapHeader:s=!1}=n,u=new Array;for(let l=0;l<e.length;l+=1){let c=e[l],d=1,f=null,p=-1;for(let m of await this.splitText(c)){let h=i,b=c.indexOf(m,p+1);if(f===null){let x=this.numberOfNewLines(c,0,b);d+=x}else{let x=p+await this.lengthFunction(f);if(x<b){let C=this.numberOfNewLines(c,x,b);d+=C}else if(x>b){let C=this.numberOfNewLines(c,b,x);d-=C}s&&(h+=a)}let g=this.numberOfNewLines(m),_=o[l].loc&&typeof o[l].loc=="object"?{...o[l].loc}:{};_.lines={from:d,to:d+g};let w={...o[l],loc:_};h+=m,u.push(new sO({pageContent:h,metadata:w})),d+=g,f=m,p=b}}return u}numberOfNewLines(e,r,n){return(e.slice(r,n).match(/\n/g)||[]).length}async splitDocuments(e,r={}){let n=e.filter(a=>a.pageContent!==void 0),o=n.map(a=>a.pageContent),i=n.map(a=>a.metadata);return this.createDocuments(o,i,r)}joinDocs(e,r){let n=e.join(r).trim();return n===""?null:n}async mergeSplits(e,r){let n=[],o=[],i=0;for(let s of e){let u=await this.lengthFunction(s);if(i+u+o.length*r.length>this.chunkSize&&(i>this.chunkSize&&console.warn(`Created a chunk of size ${i}, +
which is longer than the specified ${this.chunkSize}`),o.length>0)){let l=this.joinDocs(o,r);for(l!==null&&n.push(l);i>this.chunkOverlap||i+u+o.length*r.length>this.chunkSize&&i>0;)i-=await this.lengthFunction(o[0]),o.shift()}o.push(s),i+=u}let a=this.joinDocs(o,r);return a!==null&&n.push(a),n}};var Cre=class t extends GEe{static lc_name(){return"RecursiveCharacterTextSplitter"}constructor(e){super(e),Object.defineProperty(this,"separators",{enumerable:!0,configurable:!0,writable:!0,value:[`
`,`
`," ",""]}),this.separators=e?.separators??this.separators,this.keepSeparator=e?.keepSeparator??!0}async _splitText(e,r){let n=[],o=r[r.length-1],i;for(let l=0;l<r.length;l+=1){let c=r[l];if(c===""){o=c;break}if(e.includes(c)){o=c,i=r.slice(l+1);break}}let a=this.splitOnSeparator(e,o),s=[],u=this.keepSeparator?"":o;for(let l of a)if(await this.lengthFunction(l)<this.chunkSize)s.push(l);else{if(s.length){let c=await this.mergeSplits(s,u);n.push(...c),s=[]}if(!i)n.push(l);else{let c=await this._splitText(l,i);n.push(...c)}}if(s.length){let l=await this.mergeSplits(s,u);n.push(...l)}return n}async splitText(e){return this._splitText(e,this.separators)}static fromLanguage(e,r){return new t({...r,separators:t.getSeparatorsForLanguage(e)})}static getSeparatorsForLanguage(e){if(e==="cpp")return[`
class `,`
void `,`
int `,`
float `,`
double `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="go")return[`
func `,`
var `,`
const `,`
type `,`
if `,`
for `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="java")return[`
class `,`
public `,`
protected `,`
private `,`
static `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="js")return[`
function `,`
const `,`
let `,`
var `,`
class `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
default `,`
`,`
`," ",""];if(e==="php")return[`
function `,`
class `,`
if `,`
foreach `,`
while `,`
do `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="proto")return[`
message `,`
service `,`
enum `,`
option `,`
import `,`
syntax `,`
`,`
`," ",""];if(e==="python")return[`
class `,`
def `,`
def `,`
`,`
`," ",""];if(e==="rst")return[`
===
`,`
---
`,`
***
`,`
.. `,`
`,`
`," ",""];if(e==="ruby")return[`
def `,`
class `,`
if `,`
unless `,`
while `,`
for `,`
do `,`
begin `,`
rescue `,`
`,`
`," ",""];if(e==="rust")return[`
fn `,`
const `,`
let `,`
if `,`
while `,`
for `,`
loop `,`
match `,`
const `,`
`,`
`," ",""];if(e==="scala")return[`
class `,`
object `,`
def `,`
val `,`
var `,`
if `,`
for `,`
while `,`
match `,`
case `,`
`,`
`," ",""];if(e==="swift")return[`
func `,`
class `,`
struct `,`
enum `,`
if `,`
for `,`
while `,`
do `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="markdown")return[`
## `,`
### `,`
#### `,`
##### `,`
###### `,"```\n\n",`
***
`,`
---
`,`
___
`,`
`,`
`," ",""];if(e==="latex")return[`
\\chapter{`,`
\\section{`,`
\\subsection{`,`
\\subsubsection{`,`
\\begin{enumerate}`,`
\\begin{itemize}`,`
\\begin{description}`,`
\\begin{list}`,`
\\begin{quote}`,`
\\begin{quotation}`,`
\\begin{verse}`,`
\\begin{verbatim}`,`
\\begin{align}`,"$$","$",`
`,`
`," ",""];if(e==="html")return["<body>","<div>","<p>","<br>","<li>","<h1>","<h2>","<h3>","<h4>","<h5>","<h6>","<span>","<table>","<tr>","<td>","<th>","<ul>","<ol>","<header>","<footer>","<nav>","<head>","<style>","<script>","<meta>","<title>"," ",""];if(e==="sol")return[`
pragma `,`
using `,`
contract `,`
interface `,`
library `,`
constructor `,`
type `,`
function `,`
event `,`
modifier `,`
error `,`
struct `,`
enum `,`
if `,`
for `,`
while `,`
do while `,`
assembly `,`
`,`
`," ",""];throw new Error(`Language ${e} is not supported.`)}};var $S=require("obsidian");var Ore=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=ne();this.rateLimiter=new GH(o.embeddingRequestsPerMin),this.embeddingBatchSize=o.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize,Mi(async()=>{let i=ne();this.rateLimiter=new GH(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 $S.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 $S.Notice("No valid content to index."),0;for(let s=0;s<a.length&&!this.state.isIndexingCancelled;s+=this.embeddingBatchSize){await this.handlePause();let u=a.slice(s,s+this.embeddingBatchSize);try{await this.rateLimiter.wait();let l=await n.embedDocuments(u.map(f=>f.content));if(!l||l.length!==u.length)throw new Error(`Embedding model returned ${l?.length??0} embeddings for ${u.length} documents`);for(let f=0;f<u.length;f++){let p=u[f],m=l[f];if(!m||!Array.isArray(m)||m.length===0){fe(`Invalid embedding for document ${p.fileInfo.path}: ${m}`),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}try{await this.dbOps.upsert({...p.fileInfo,id:this.getDocHash(p.content),content:p.content,embedding:m,created_at:Date.now(),nchars:p.content.length}),this.state.processedFiles.add(p.fileInfo.path)}catch(h){this.handleError(h,{filePath:p.fileInfo.path,errors:r}),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}}this.state.indexedCount=this.state.processedFiles.size,this.updateIndexingNoticeMessage();let c=Math.floor((this.state.indexedCount-u.length)/this.checkpointInterval);Math.floor(this.state.indexedCount/this.checkpointInterval)>c&&(await this.dbOps.saveDB(),console.log("Copilot index checkpoint save completed."))}catch(l){if(this.handleError(l,{filePath:u?.[0]?.fileInfo?.path,errors:r,batch:u}),this.isRateLimitError(l))break}}return this.finalizeIndexing(r),setTimeout(()=>{this.dbOps.saveDB().then(()=>{ae("Copilot index final save completed."),this.dbOps.checkIndexIntegrity().catch(s=>{fe("Background integrity check failed:",s)})}).catch(s=>{fe("Background save failed:",s)})},100),this.state.indexedCount}catch(n){return this.handleError(n),0}}async prepareAllChunks(e){let r=await this.embeddingsManager.getEmbeddingsAPI();if(!r)return console.error("Embedding instance not found."),[];let n=$s.getModelName(r),o=Cre.fromLanguage("markdown",{chunkSize:uze}),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:Ml(new Date(a.stat.ctime)).display,modified:Ml(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,jCt.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=Om(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>Cp(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(!Cp(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 ae([`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 $S.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 $S.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=ne(),o=Cm(n.qaInclusions);o.length>0&&r.push(`Inclusions: ${o.join(", ")}`);let a=[...wre(this.app),...Cm(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 $S.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 $S.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 $S.Notice("Indexing cancelled");return}e.length>0?new $S.Notice(`Indexing completed with ${e.length} errors. Check console for details.`):new $S.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(),ne().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 Li=class t{constructor(){this.embeddingsManager=$s.getInstance(),this.dbOps=new aO(app),this.indexOps=new Ore(app,this.dbOps,this.embeddingsManager),this.eventHandler=new Sre(app,this.indexOps,this.dbOps),this.initializationPromise=this.initialize(),this.setupSettingsSubscription()}static getInstance(){return t.instance||(t.instance=new t),t.instance}setupSettingsSubscription(){this.lastKnownSettings={...ne()};let e=async()=>{let r=ne(),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())}};Mi(()=>{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 Er&&r.message.includes("Vault adapter not available")&&(e--,e>0)){await new Promise(n=>setTimeout(n,100));continue}new YH.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(),YH.Platform.isMobile&&ne().disableIndexOnMobile?(new YH.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)}};Jt();var YEe="copilot-plus-flash",O4r=YEe+"|"+"copilot-plus",ZEe="copilot-plus-small",XEe=ZEe+"|"+"copilot-plus";function jhe(t){return t.split("|")[1]==="copilot-plus"}function rB(){return Pn().isPlusUser}async function Pre(){return(await Ei.getInstance().validateLicenseKey()).isValid}function DCt(){let t=O4r,e=XEe,r=ne().embeddingModelKey;Fze(t),FM("copilot_plus"),WP({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e&&Li.getInstance().indexVaultToVectorStore()}function QEe(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function uR(t){window.open(QEe(t),"_blank")}function NCt(){Je("isPlusUser",!0)}function LCt(){let t=ne().isPlusUser;Je("isPlusUser",!1),t&&new AJ(app).open()}Jt();var FCt=$(tp()),kCt=require("obsidian"),Ei=class t{constructor(){this.pluginVersion="Unknown"}static getInstance(){return t.instance||(t.instance=new t),t.instance}checkLicenseKey(){if(!ne().plusLicenseKey)throw new kCt.Notice("Copilot Plus license key not found. Please enter your license key in the settings."),new Error("License key not initialized")}setPluginVersion(e){this.pluginVersion=e}async makeRequest(e,r,n="POST",o=!1,i=!1){i||this.checkLicenseKey(),r.user_id=ne().userId;let a=new URL(`${GP}${e}`);n==="GET"&&Object.entries(r).forEach(([l,c])=>{a.searchParams.append(l,c)});let s=await fetch(a.toString(),{method:n,headers:{"Content-Type":"application/json",...!o&&{Authorization:`Bearer ${await Wn(ne().plusLicenseKey)}`},"X-Client-Version":this.pluginVersion},...n==="POST"&&{body:JSON.stringify(r)}}),u=await s.json();if(!s.ok)try{let l=u.detail,c=new Error(l.reason);return c.name=l.error,{data:null,error:c}}catch{return{data:null,error:new Error("Unknown error")}}return ae(`==== ${e} request ====:`,u),{data:u}}async makeFormDataRequest(e,r,n=!1){n||this.checkLicenseKey(),r.append("user_id",ne().userId);let o=new URL(`${GP}${e}`);try{let i=await fetch(o.toString(),{method:"POST",headers:{Authorization:`Bearer ${await Wn(ne().plusLicenseKey)}`,"X-Client-Version":this.pluginVersion},body:r}),a=await i.json();if(!i.ok)try{let s=a.detail,u=new Error(s.reason);return u.name=s.error,{data:null,error:u}}catch{return{data:null,error:new Error(`HTTP error: ${i.status}`)}}return ae(`==== ${e} FormData request ====:`,a),{data:a}}catch(i){return{data:null,error:i instanceof Error?i:new Error(String(i))}}}async validateLicenseKey(){let{data:e,error:r}=await this.makeRequest("/license",{license_key:await Wn(ne().plusLicenseKey)},"POST",!0,!0);return r?r.message==="Invalid license key"?(LCt(),{isValid:!1}):{isValid:void 0}:(NCt(),{isValid:!0,plan:e?.plan})}async broca(e,r){let{data:n,error:o}=await this.makeRequest("/broca",{message:e,is_project_mode:r});if(o)throw o;if(!n)throw new Error("No data returned from broca");return n}async rerank(e,r){let{data:n,error:o}=await this.makeRequest("/rerank",{query:e,documents:r,model:"rerank-2"});if(o)throw o;if(!n)throw new Error("No data returned from rerank");return n}async url4llm(e){let{data:r,error:n}=await this.makeRequest("/url4llm",{url:e});if(n)throw n;if(!r)throw new Error("No data returned from url4llm");return r}async pdf4llm(e){let r=FCt.Buffer.from(e).toString("base64"),{data:n,error:o}=await this.makeRequest("/pdf4llm",{pdf:r});if(o)throw o;if(!n)throw new Error("No data returned from pdf4llm");return n}async docs4llm(e,r){let n=new FormData,o=this.getMimeTypeFromExtension(r),i=new Blob([e],{type:o}),a=`file.${r}`,s=new File([i],a,{type:o});n.append("files",s),n.append("file_type",r);let{data:u,error:l}=await this.makeFormDataRequest("/docs4llm",n);if(l)throw l;if(!u)throw new Error("No data returned from docs4llm");return u}getMimeTypeFromExtension(e){return{pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",epub:"application/epub+zip",txt:"text/plain",rtf:"application/rtf",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",tiff:"image/tiff",webp:"image/webp",html:"text/html",htm:"text/html",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xls:"application/vnd.ms-excel",csv:"text/csv",mp3:"audio/mpeg",mp4:"video/mp4",wav:"audio/wav",webm:"video/webm"}[e.toLowerCase()]||"application/octet-stream"}async webSearch(e){let{data:r,error:n}=await this.makeRequest("/websearch",{query:e});if(n)throw n;if(!r)throw new Error("No data returned from websearch");return r}async youtube4llm(e){let{data:r,error:n}=await this.makeRequest("/youtube4llm",{url:e});if(n)throw n;if(!r)throw new Error("No data returned from youtube4llm");return r}async autocomplete(e,r="",n=""){let{data:o,error:i}=await this.makeRequest("/autocomplete",{prompt:e,note_context:r,relevant_notes:n,max_tokens:64});if(i)throw i;if(!o)throw new Error("No data returned from autocomplete");return o}async wordcomplete(e,r="",n){let{data:o,error:i}=await this.makeRequest("/wordcomplete",{prefix:e,suffix:r,suggestions:n});if(i)throw i;if(!o)throw new Error("No data returned from wordcomplete");return o}};mo();var $Ct=$(eB()),nB=class t{constructor(e){this.memoryCache=new Map;this.cacheDir=e}static getInstance(e=".copilot/file-content-cache"){return t.instance||(t.instance=new t(e)),t.instance}async ensureCacheDir(){await app.vault.adapter.exists(this.cacheDir)||(ae("Creating file cache directory:",this.cacheDir),await app.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e,r){let n=`${e.path}:${e.stat.size}:${e.stat.mtime}${r?`:${r}`:""}`;return(0,$Ct.MD5)(n).toString()}getCachePath(e){return`${this.cacheDir}/${e}.json`}async get(e){try{let r=this.memoryCache.get(e);if(r)return ae("Memory cache hit for file:",e),r.content;let n=this.getCachePath(e);if(await app.vault.adapter.exists(n)){ae("File cache hit:",e);let o=await app.vault.adapter.read(n),i=JSON.parse(o);return this.memoryCache.set(e,i),i.content}return ae("Cache miss for file:",e),null}catch(r){return fe("Error reading from file cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCachePath(e),o={content:r,timestamp:Date.now()};this.memoryCache.set(e,o),await app.vault.adapter.write(n,JSON.stringify(o)),ae("Cached file content:",e)}catch(n){fe("Error writing to file cache:",n)}}async remove(e){try{this.memoryCache.delete(e);let r=this.getCachePath(e);await app.vault.adapter.exists(r)&&(await app.vault.adapter.remove(r),ae("Removed file from cache:",e))}catch(r){fe("Error removing file from cache:",r)}}async clear(){try{if(this.memoryCache.clear(),await app.vault.adapter.exists(this.cacheDir)){let e=await app.vault.adapter.list(this.cacheDir);ae("Clearing file cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){fe("Error clearing file cache:",e)}}};mo();Jt();var BCt=$(eB()),Ere=require("obsidian"),P4r=5e3,hy=class t{constructor(){this.cacheDir=".copilot/project-context-cache";this.memoryCache=new Map;this.debounceTimer=null;this.handleFileEvent=e=>{e instanceof Ere.TFile&&this.debouncedHandleFileChange(e)};this.debouncedHandleFileChange=e=>{this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{this.handleFileChange(e),this.debounceTimer=null},P4r)};this.vault=app.vault,this.fileCache=nB.getInstance(),this.initializeEventListeners()}static getInstance(){return t.instance||(t.instance=new t),t.instance}cleanup(){this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.vault.off("create",this.handleFileEvent),this.vault.off("modify",this.handleFileEvent),this.vault.off("delete",this.handleFileEvent),this.vault.off("rename",this.handleFileEvent)}initializeEventListeners(){this.vault.on("create",this.handleFileEvent),this.vault.on("modify",this.handleFileEvent),this.vault.on("delete",this.handleFileEvent),this.vault.on("rename",this.handleFileEvent)}async handleFileChange(e){try{if(e.extension!=="md")return;let n=ne().projectList||[];for(let o of n){let{inclusions:i,exclusions:a}=Om({inclusions:o.contextSource.inclusions,exclusions:o.contextSource.exclusions,isProject:!0});Cp(e,i,a)&&(await this.invalidateMarkdownContext(o),ae(`Invalidated markdown context for project ${o.name} due to file change: ${e.path}`))}}catch(r){fe("Error handling file change for project context cache:",r)}}async ensureCacheDir(){await this.vault.adapter.exists(this.cacheDir)||(ae("Creating project context cache directory:",this.cacheDir),await this.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){return(0,BCt.MD5)(e.id).toString()}getCachePath(e){return`${this.cacheDir}/${e}.json`}async get(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);if(n)return ae("Memory cache hit for project:",e.name),n;let o=this.getCachePath(r);if(await this.vault.adapter.exists(o)){ae("File cache hit for project:",e.name);let i=await this.vault.adapter.read(o),a=JSON.parse(i);return this.memoryCache.set(r,a),a}return ae("Cache miss for project:",e.name),null}catch(r){return fe("Error reading from project context cache:",r),null}}getSync(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);return n?(ae("Memory cache hit for project:",e.name),n):(ae("Memory cache miss for project:",e.name),null)}catch(r){return fe("Error reading from project context memory cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);ae("Caching context for project:",e.name),this.memoryCache.set(n,r),await this.vault.adapter.write(o,JSON.stringify(r))}catch(n){fe("Error writing to project context cache:",n)}}createEmptyCache(){return{markdownContext:"",webContexts:{},youtubeContexts:{},fileContexts:{},timestamp:Date.now(),markdownNeedsReload:!1}}async clearAllCache(){try{let e=new Set;for(let r of Array.from(this.memoryCache.values()))if(r?.fileContexts)for(let n in r.fileContexts)r.fileContexts[n]?.cacheKey&&e.add(r.fileContexts[n].cacheKey);if(this.memoryCache.clear(),await this.vault.adapter.exists(this.cacheDir)){let r=await this.vault.adapter.list(this.cacheDir);ae("Clearing project context cache, removing files:",r.files.length),await Promise.all(r.files.map(n=>this.vault.adapter.remove(n)))}for(let r of e)await this.fileCache.remove(r);ae(`Cleared ${e.size} file content cache entries associated with projects`)}catch(e){fe("Error clearing project context cache:",e)}}async clearForProject(e){try{ae(`[clearForProject] Starting for project: ${e.name} (ID: ${e.id})`);let r=this.getCacheKey(e),n=await this.get(e),o=0;if(n?.fileContexts){let a=Object.keys(n.fileContexts);if(a.length>0){ae(`[clearForProject] Project ${e.name}: Found ${a.length} file contexts to remove from FileCache.`);for(let s in n.fileContexts){let u=n.fileContexts[s];u&&u.cacheKey?(await this.fileCache.remove(u.cacheKey),o++):kx(`[clearForProject] Project ${e.name}: Skipped removing FileCache entry for file ${s} due to missing cacheKey.`)}ae(`[clearForProject] Project ${e.name}: Attempted to clear ${o} entries from FileCache.`)}}else ae(`[clearForProject] Project ${e.name}: No fileContexts found in existing project cache to clear from FileCache.`);this.memoryCache.delete(r),ae(`[clearForProject] Project ${e.name}: Removed from ProjectContextCache memory.`);let i=this.getCachePath(r);await this.vault.adapter.exists(i)?(await this.vault.adapter.remove(i),ae(`[clearForProject] Project ${e.name}: Successfully removed main project cache file: ${i}`)):ae(`[clearForProject] Project ${e.name}: Main project cache file not found (already deleted or never existed): ${i}`),ae(`[clearForProject] Completed for project: ${e.name}`)}catch(r){fe(`[clearForProject] Error for project ${e.name} (ID: ${e.id}):`,r)}}async invalidateMarkdownContext(e,r=!1){let n=await this.get(e);n&&(n.markdownContext="",n.markdownNeedsReload=!0,r&&(n.webContexts={},n.youtubeContexts={},ae(`Flagged Web/YouTube contexts for full reload for project ${e.name}`)),await this.set(e,n),await this.cleanupProjectFileReferences(e),ae(`Invalidated markdown context for project ${e.name}`))}async updateMarkdownContext(e,r){let n=await this.get(e)||this.createEmptyCache();n.markdownContext=r,n.markdownNeedsReload=!1,await this.set(e,n),ae(`Updated markdown context for project ${e.name}`)}async clearMarkdownContext(e){let r=await this.get(e);r&&(r.markdownContext="",r.markdownNeedsReload=!0,await this.set(e,r))}async getFileContext(e,r){try{if(!r||typeof r!="string")return fe("Error getting file context: filePath is invalid.",{project:e.name,filePath:r}),null;let n=await this.get(e);if(!n||!n.fileContexts||!n.fileContexts[r])return null;let o=n.fileContexts[r];if(!o||!o.cacheKey||typeof o.cacheKey!="string"||o.cacheKey.trim()==="")return kx(`Missing, invalid, or empty cacheKey for filePath: ${r} in project ${e.name}. Entry will be treated as a cache miss.`,{project:e.name,filePath:r,fileContextEntry:o}),null;let{cacheKey:i}=o;return typeof i!="string"?(kx(`cacheKey is not a string for filePath: ${r} in project ${e.name}. Treating as cache miss.`,{project:e.name,filePath:r,cacheKey:i}),null):await this.fileCache.get(i)}catch(n){return fe(`Error getting file context for ${r} in project ${e.name}:`,n),null}}async setFileContext(e,r,n){try{let o=await this.get(e)||this.createEmptyCache();o.fileContexts||(o.fileContexts={});let i=this.vault.getAbstractFileByPath(r);if(!(i instanceof Ere.TFile))throw new Error(`File not found: ${r}`);let a=this.fileCache.getCacheKey(i,e.id);await this.fileCache.set(a,n),o.fileContexts[r]={timestamp:Date.now(),cacheKey:a},await this.set(e,o),ae(`Added/updated file context for ${r} in project ${e.name}`)}catch(o){fe(`Error setting file context for ${r}:`,o)}}async removeFileContext(e,r){try{let n=await this.get(e);if(n&&n.fileContexts[r]){let{cacheKey:o}=n.fileContexts[r];delete n.fileContexts[r],await this.set(e,n),await this.fileCache.remove(o),ae(`Removed file context for ${r} in project ${e.name}`)}}catch(n){fe(`Error removing file context for ${r}:`,n)}}async cleanupProjectFileReferences(e){try{let r=await this.get(e);if(!r||!r.fileContexts)return;let{inclusions:n,exclusions:o}=Om({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=0,a={};for(let s in r.fileContexts){let u=this.vault.getAbstractFileByPath(s);!(u instanceof Ere.TFile)||!Cp(u,n,o)?i++:a[s]=r.fileContexts[s]}i>0&&(r.fileContexts=a,await this.set(e,r),ae(`Removed ${i} file references from project ${e.name} that no longer match inclusion patterns`))}catch(r){fe(`Error cleaning up project file references for ${e.name}:`,r)}}async updateProjectFilesFromPatterns(e,r){try{ae(`[updateProjectFilesFromPatterns] Starting for project: ${e.name}`),r.fileContexts||(r.fileContexts={});let{inclusions:n,exclusions:o}=Om({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=this.vault.getFiles(),a=0;for(let s of i)if(Cp(s,n,o)){if(r.fileContexts[s.path])continue;let u=this.fileCache.getCacheKey(s,e.id);r.fileContexts[s.path]={timestamp:Date.now(),cacheKey:u},a++}a>0&&ae(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${a} new file references to context (in memory).`),ae(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(n){fe(`[updateProjectFilesFromPatterns] Error for project ${e.name}:`,n)}return r}async removeWebUrl(e,r){let n=await this.get(e);n?.webContexts?.[r]&&(delete n.webContexts[r],await this.set(e,n),ae(`Removed web context for URL ${r} in project ${e.name}`))}async updateWebUrl(e,r,n){let o=await this.get(e)||this.createEmptyCache();o.webContexts||(o.webContexts={}),o.webContexts[r]=n,await this.set(e,o),ae(`Updated web context for URL ${r} in project ${e.name}`)}async removeYoutubeUrl(e,r){let n=await this.get(e);n?.youtubeContexts?.[r]&&(delete n.youtubeContexts[r],await this.set(e,n),ae(`Removed YouTube context for URL ${r} in project ${e.name}`))}async updateYoutubeUrl(e,r,n){let o=await this.get(e)||this.createEmptyCache();o.youtubeContexts||(o.youtubeContexts={}),o.youtubeContexts[r]=n,await this.set(e,o),ae(`Updated YouTube context for URL ${r} in project ${e.name}`)}};pf();Zr();yn();function qCt(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===gi?gi:fb,message:o.trim(),isVisible:!0,timestamp:i?zfe(i):null}),n=a.startsWith("**user**:")?gi:fb,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===gi?gi:fb,message:o.trim(),isVisible:!0,timestamp:i?zfe(i):null}),r}async function cj(t,e){await e.clearChatMemory();for(let r=0;r<t.length-1;r++){let n=t[r];if(n.sender===gi){let o=t[r+1];o?.sender===fb&&await e.getMemory().saveContext({input:n.message},{output:o.message})}}}Zr();mo();mo();yn();var dj=require("obsidian"),BS=class{static async isImageUrl(e,r){try{let n,o=!1;try{let i=new URL(e),a=i.pathname,s=a.lastIndexOf("."),u=a.lastIndexOf("/");if(s>u&&s>-1&&(n=a.substring(s+1).toLowerCase()),n&&!this.IMAGE_EXTENSIONS.some(c=>c.toLowerCase()===`.${n}`))return fe(`Unsupported image format from URL path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;try{let c=(await As(e,{method:"HEAD",headers:{}})).headers.get("content-type");return c?.startsWith("image/")?!0:(console.warn(`HEAD request succeeded for ${e} but Content-Type (${c}) is not image/*.`),!1)}catch(l){console.warn(`HEAD request failed for URL: ${e}. Proceeding to heuristic check.`,l);let c=i.searchParams,f=[c.has("w")||c.has("width"),c.has("h")||c.has("height"),c.has("format"),c.has("fit"),c.has("quality"),i.pathname.includes("/image/"),i.pathname.includes("/images/"),i.pathname.includes("/img/"),c.has("auto"),c.has("crop")].filter(Boolean).length;return f>=2?(fe(`Identified as image based on URL heuristics (indicator count: ${f}): ${e}`),!0):!1}}catch{o=!0;let i=e.lastIndexOf(".");if(i>-1)n=e.substring(i+1).toLowerCase();else return!1}if(o)if(n&&this.IMAGE_EXTENSIONS.some(i=>i.toLowerCase()===`.${n}`)){let i=r.getAbstractFileByPath(e);return i instanceof dj.TFile?i.stat.size>this.MAX_IMAGE_SIZE?(fe(`Vault file too large: ${i.stat.size} bytes for path: ${e}`),!1):!0:(fe(`File with image extension not found in vault: ${e}.`),!1)}else return n&&fe(`Unsupported image format for potential vault path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;return fe(`Could not determine image status for URL/path: ${e}`),!1}catch(n){return fe(`Unexpected error in isImageUrl for "${e}":`,n),!1}}static async handleVaultImage(e,r){try{if(e.stat.size>this.MAX_IMAGE_SIZE)return fe(`Image too large: ${e.stat.size} bytes, skipping: ${e.path}`),null;let n=await r.readBinary(e),o=await this.getMimeType(n,e.extension);if(!o.startsWith("image/"))return fe(`Invalid MIME type: ${o}, skipping: ${e.path}`),null;let a=Buffer.from(n).toString("base64");return`data:${o};base64,${a}`}catch(n){return fe("Error processing vault image:",n),null}}static async handleWebImage(e){try{let r=await As(e,{method:"GET",headers:{}});if(!r.ok)return fe(`Failed to fetch image: ${r.statusText}, URL: ${e}`),null;let n=r.headers.get("content-type");if(!n?.startsWith("image/"))return fe(`Invalid content type: ${n}, URL: ${e}`),null;let o=await r.arrayBuffer();if(o.byteLength>this.MAX_IMAGE_SIZE)return fe(`Image too large: ${o.byteLength} bytes, URL: ${e}`),null;let a=Buffer.from(o).toString("base64");return`data:${n};base64,${a}`}catch(r){return fe("Error converting web image to base64:",r),null}}static async handleLocalImage(e,r){try{let n=decodeURIComponent(e.replace("app://","")),o=r.getAbstractFileByPath(n);if(!o||!(o instanceof dj.TFile))return fe(`Local image not found: ${n}`),null;if(o.stat.size>this.MAX_IMAGE_SIZE)return fe(`Image too large: ${o.stat.size} bytes, path: ${n}`),null;let i=await r.readBinary(o),a=await this.getMimeType(i,o.extension);if(!a.startsWith("image/"))return fe(`Invalid MIME type: ${a}, path: ${n}`),null;let u=Buffer.from(i).toString("base64");return`data:${a};base64,${u}`}catch(n){return fe("Error processing local image:",n),null}}static async imageToBase64(e,r){if(e.startsWith("data:"))return e;if(e.startsWith("attachment:")){let o=e.substring(11),i=r.getAbstractFileByPath(o);return i instanceof dj.TFile?await this.handleVaultImage(i,r):(console.warn(`Could not find attachment file in vault: ${o}`),null)}if(e.startsWith("app://"))return await this.handleLocalImage(e,r);let n=r.getAbstractFileByPath(e);return n instanceof dj.TFile?await this.handleVaultImage(n,r):await this.handleWebImage(e)}static async convertToBase64(e,r){let n=await this.imageToBase64(e,r);return n?{type:"image_url",image_url:{url:n}}:(fe(`Failed to convert image to base64: ${e}`),null)}static async getMimeType(e,r){let n=new Uint8Array(e.slice(0,4));if(n[0]===255&&n[1]===216)return"image/jpeg";if(n[0]===137&&n[1]===80)return"image/png";if(n[0]===71&&n[1]===73)return"image/gif";if(n[0]===82&&n[1]===73)return"image/webp";if(n[0]===66&&n[1]===77)return"image/bmp";if(n[0]===60&&n[1]===115)throw new Error("SVG files are not supported");let o=this.MIME_TYPES[r.toLowerCase()];if(!o){let i=`Unsupported image extension: ${r}`;throw fe(i),new Error(i)}return o}};BS.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],BS.MAX_IMAGE_SIZE=3*1024*1024,BS.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp"};var fj=class t{static async processUrlBatch(e,r,n){try{let i=(await Promise.all(e.map(s=>t.processSingleUrl(s,r,n)))).filter(s=>s!==null),a=r.map(s=>`Image read failed for: ${s}`);return{successfulImages:i,failureDescriptions:a}}catch(o){return fe("Error processing URL batch:",o),{successfulImages:[],failureDescriptions:e.map(i=>`Image read failed for: ${i}`)}}}static async processSingleUrl(e,r,n){try{if(!await BS.isImageUrl(e,n))return null;let o=await BS.convertToBase64(e,n);return o||(r.push(e),null)}catch(o){return fe(`Failed to process image: ${e}`,o),r.push(e),null}}static async processChatImageBatch(e,r,n){try{let o=e.filter(u=>u.type==="image_url"&&!!u.image_url?.url),a=(await Promise.all(o.map(u=>t.processChatSingleImage(u,r,n)))).filter(u=>u!==null),s=r.map(u=>`Image read failed for: ${u}`);return{successfulImages:a,failureDescriptions:s}}catch(o){fe("Error processing chat image batch:",o);let i=e.filter(a=>a.type==="image_url"&&!!a.image_url?.url).map(a=>a.image_url.url);return{successfulImages:[],failureDescriptions:i.map(a=>`Image read failed for: ${a}`)}}}static async processChatSingleImage(e,r,n){try{let o=await BS.convertToBase64(e.image_url.url,n);return o||(r.push(e.image_url.url),null)}catch(o){return fe(`Failed to process chat image: ${e.image_url.url}`,o),r.push(e.image_url.url),null}}static showFailedImagesNotice(e){e.length>0&&new dj.Notice(`Failed to process images:
${e.join(`
`)}`)}};yn();var oB=class t{constructor(){this.mentions=new Map,this.brevilabsClient=Ei.getInstance()}static getInstance(){return t.instance||(t.instance=new t),t.instance}extractAllUrls(e){let r=/https?:\/\/[^\s"'<>]+/g;return(e.match(r)||[]).map(n=>n.replace(/,+$/,"")).filter((n,o,i)=>i.indexOf(n)===o)}extractUrls(e){let r=/https?:\/\/[^\s"'<>]+/g;return(e.match(r)||[]).map(n=>n.replace(/,+$/,"")).filter((n,o,i)=>i.indexOf(n)===o).filter(n=>!nze(n))}async processUrl(e){try{return await this.brevilabsClient.url4llm(e)}catch(r){return console.error(`Error processing URL ${e}:`,r),{response:e,elapsed_time_ms:0}}}async processUrls(e){let r=this.extractUrls(e),n="",o=[];if(r.length===0)return{urlContext:"",imageUrls:[]};let i=r.map(async s=>{if(await BS.isImageUrl(s,app.vault))return o.push(s),null;if(!this.mentions.has(s)){let u=await this.processUrl(s);this.mentions.set(s,{type:"url",original:s,processed:u.response})}return this.mentions.get(s)});return(await Promise.all(i)).forEach(s=>{s?.processed&&(n+=`
Content from ${s.original}:
${s.processed}`)}),{urlContext:n,imageUrls:o}}getMentions(){return this.mentions}clearMentions(){this.mentions.clear()}};Jt();mo();var UCt=$(eB()),Tre=class t{constructor(){this.cacheDir=".copilot/pdf-cache"}static getInstance(){return t.instance||(t.instance=new t),t.instance}async ensureCacheDir(){await app.vault.adapter.exists(this.cacheDir)||(ae("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,UCt.MD5)(r).toString();return ae("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)){ae("Cache hit for PDF:",e.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return ae("Cache miss for PDF:",e.path),null}catch(r){return fe("Error reading from PDF cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);ae("Caching PDF response for:",e.path),await app.vault.adapter.write(o,JSON.stringify(r))}catch(n){fe("Error writing to PDF cache:",n)}}async clear(){try{if(await app.vault.adapter.exists(this.cacheDir)){let e=await app.vault.adapter.list(this.cacheDir);ae("Clearing PDF cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){fe("Error clearing PDF cache:",e)}}};mo();var zCt=require("obsidian");var Ire,HCt,Are=class{constructor(e){this.vault=e;QLe(this,Ire)}async load(e){let r=await this.vault.read(e),{nodes:n=[],edges:o=[]}=JSON.parse(r),i=await Promise.all(n.map(async u=>{if(u.type==="file"&&u.file){let l=this.vault.getAbstractFileByPath(u.file),c=l instanceof zCt.TFile?await this.vault.cachedRead(l):"";return{...u,content:c}}return u.type==="text"?{...u,content:u.text??""}:{...u,content:""}})),a=[...o];eFe(this,Ire,HCt).call(this,i,a);let s=Object.fromEntries(i.map(u=>[u.id,u]));return{nodes:i,edges:a,byId:s}}buildPrompt(e){let r=new Map,n=e.nodes.filter(s=>s.type==="group");for(let s of n){let u=e.nodes.filter(l=>{if(l.id===s.id)return!1;let c=l.x+l.width/2,d=l.y+l.height/2;return c>=s.x&&d>=s.y&&c<=s.x+s.width&&d<=s.y+s.height});r.set(s.label||s.id,u)}let o=`This canvas contains the following elements:
`,i=s=>{switch(s.type){case"file":return`- File: ${s.file}
Content:
${s.content}
`;case"text":return`- Text: "${s.text}"
`;case"link":return`- Link: ${s.url}
`;default:return""}};n.forEach(s=>{let u=s.label||s.id,l=r.get(u)||[];o+=`Group "${u}" contains:
`,l.forEach(c=>{o+=i(c)}),o+=`
`});let a=e.nodes.filter(s=>s.type==="group"?!1:!Array.from(r.values()).flat().some(u=>u.id===s.id));return a.length>0&&(o+=`Elements outside of groups:
`,a.forEach(s=>{o+=i(s)})),o+=`
When describing this canvas, please:
`,o+=`- Use the actual titles/names of elements instead of their IDs
`,o+=`- Pay attention to the content and relationships between elements
`,o+=`- Describe files by their names, links by their URLs, and text nodes by their content
`,o}};Ire=new WeakSet,HCt=function(e,r){let n=e.filter(o=>o.type==="group");for(let o of n)for(let i of e){if(i.id===o.id)continue;let a=i.x+i.width/2,s=i.y+i.height/2;a>=o.x&&s>=o.y&&a<=o.x+o.width&&s<=o.y+o.height&&r.push({id:crypto.randomUUID(),fromNode:o.id,toNode:i.id,label:"contains"})}};var eTe=class{constructor(){this.supportedExtensions=["md"]}async parseFile(e,r){return await r.read(e)}},Mre=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=Tre.getInstance()}async parseFile(e,r){try{ae("Parsing PDF file:",e.path);let n=await this.pdfCache.get(e);if(n)return ae("Using cached PDF content for:",e.path),n.response;let o=await r.readBinary(e);ae("Calling pdf4llm API for:",e.path);let i=await this.brevilabsClient.pdf4llm(o);return await this.pdfCache.set(e,i),i.response}catch(n){return fe(`Error extracting content from PDF ${e.path}:`,n),`[Error: Could not extract content from PDF ${e.basename}]`}}async clearCache(){ae("Clearing PDF cache"),await this.pdfCache.clear()}},tTe=class{constructor(){this.supportedExtensions=["canvas"]}async parseFile(e,r){try{ae("Parsing Canvas file:",e.path);let n=new Are(r),o=await n.load(e);return n.buildPrompt(o)}catch(n){return fe(`Error parsing Canvas file ${e.path}:`,n),`[Error: Could not parse Canvas file ${e.basename}]`}}},rTe=class{constructor(e,r=null){this.supportedExtensions=["pdf","602","abw","cgm","cwk","doc","docx","docm","dot","dotm","hwp","key","lwp","mw","mcw","pages","pbd","ppt","pptm","pptx","pot","potm","potx","rtf","sda","sdd","sdp","sdw","sgl","sti","sxi","sxw","stw","sxg","txt","uof","uop","uot","vor","wpd","wps","xml","zabw","epub","jpg","jpeg","png","gif","bmp","svg","tiff","webp","web","htm","html","xlsx","xls","xlsm","xlsb","xlw","csv","dif","sylk","slk","prn","numbers","et","ods","fods","uos1","uos2","dbf","wk1","wk2","wk3","wk4","wks","123","wq1","wq2","wb1","wb2","wb3","qpw","xlr","eth","tsv","mp3","mp4","mpeg","mpga","m4a","wav","webm"];this.brevilabsClient=e,this.projectContextCache=hy.getInstance(),this.currentProject=r}async parseFile(e,r){try{if(ae(`[Docs4LLMParser] Project ${this.currentProject?.name}: Parsing ${e.extension} file: ${e.path}`),!this.currentProject)throw fe("[Docs4LLMParser] No project context for parsing file: ",e.path),new Error("No project context provided for file parsing");let n=await this.projectContextCache.getFileContext(this.currentProject,e.path);if(n)return ae(`[Docs4LLMParser] Project ${this.currentProject.name}: Using cached content for: ${e.path}`),n;ae(`[Docs4LLMParser] Project ${this.currentProject.name}: Cache miss for: ${e.path}. Proceeding to API call.`);let o=await r.readBinary(e);ae(`[Docs4LLMParser] Project ${this.currentProject.name}: Calling docs4llm API for: ${e.path}`);let i=await this.brevilabsClient.docs4llm(o,e.extension);if(!i||!i.response)throw new Error("Empty response from docs4llm API");let a="";return typeof i.response=="string"?a=i.response:typeof i.response=="object"?i.response.text?a=i.response.text:i.response.content?a=i.response.content:a=JSON.stringify(i.response,null,2):a=String(i.response),await this.projectContextCache.setFileContext(this.currentProject,e.path,a),ae(`[Docs4LLMParser] Project ${this.currentProject.name}: Successfully processed and cached: ${e.path}`),a}catch(n){throw fe(`[Docs4LLMParser] Project ${this.currentProject?.name}: Error processing file ${e.path}:`,n),n}}async clearCache(){ae("Cache clearing is now handled at the project level")}},aA=class{constructor(e,r,n=!1,o=null){this.parsers=new Map;this.isProjectMode=n,this.currentProject=o,this.registerParser(new eTe),this.registerParser(new rTe(e,o)),n||this.registerParser(new Mre(e)),this.registerParser(new tTe)}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 Mre&&await e.clearCache()}};yn();var P6=require("obsidian");pf();Zr();yn();async function Rre(t,e){let r=`Given the following conversation and a follow up question,
summarize the conversation as context and keep the follow up question unchanged, in its original language.
If the follow up question is unrelated to its preceding messages, return this follow up question directly.
If it is related, then combine the summary and the follow up question to construct a standalone question.
Make sure to keep any [[]] wrapped note titles in the question unchanged.
If there's nothing in the chat history, just return the follow up question.
Chat History:
{chat_history}
Follow Up Input: {question}
Standalone question:`,n=e.map(({role:o,content:i})=>`${o}: ${i}`).join(`
`);return await Bx(async()=>{let i=await Hl.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]);return XN(i.content)})}Zr();mo();Jt();var nTe=require("obsidian"),VCt=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";case"@composer":return"Edit existing notes or create new notes.";default:return""}},iB=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 nTe.Notice(n.message):new nTe.Notice("An error occurred while executing the tool. Check console for details."),null}}};yn();var nEt=require("obsidian");Zr();mo();Jt();yn();HP();$P();lf();nb();var jre=class extends gn{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,on(r))}async getRelevantDocuments(e,r){let n=on(CM(r)),i=await(await Es.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 sA=class extends jre{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"];this.queryRewritePrompt=Xf.fromTemplate(`Please write a passage to answer the question. If you don't know the answer, just make up a passage.
Question: {question}
Passage:`)}async getRelevantDocuments(r,n){return Bx(async()=>{let o=$x(r,app.vault),i=o.map(h=>h.basename),a=[...new Set([...this.options.salientTerms,...i])],s=await this.getExplicitChunks(o),u=r;n?.runName!=="no_hyde"&&(u=await this.rewriteQuery(r));let l=await this.getOramaChunks(u,a,this.options.textWeight),c=this.filterAndFormatChunks(l,s),d=c;if(c.length===0)return ne().debug&&console.log("No chunks found for query:",r),d;let f=c.reduce((h,b)=>{let g=b.metadata.score;return typeof g=="number"&&!isNaN(g)?Math.max(h,g):h},0),p=c.every(h=>typeof h.metadata.score!="number"||isNaN(h.metadata.score)),m=this.options.useRerankerThreshold&&(f<this.options.useRerankerThreshold||p);return m&&(d=(await Ei.getInstance().rerank(r,c.map(b=>b.pageContent.slice(0,3e3)))).response.data.map(b=>({...c[b.index],metadata:{...c[b.index].metadata,rerank_score:b.relevance_score}}))),ne().debug&&(console.log("*** HYBRID RETRIEVER DEBUG INFO: ***"),n?.runName!=="no_hyde"&&(console.log(`
Original Query: `,r),console.log("Rewritten Query: ",u)),console.log(`
Explicit Chunks: `,s),console.log("Orama Chunks: ",l),console.log("Combined Chunks: ",c),console.log("Max Orama Score: ",f),m?console.log("Reranked Chunks: ",d):console.log("No reranking applied.")),d})}async rewriteQuery(r){try{let n=await this.queryRewritePrompt.format({question:r}),o=await Bx(()=>Hl.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke(n));return o&&"content"in o?XN(o.content):(console.warn("Unexpected rewrittenQuery format. Falling back to original query."),r)}catch(n){return console.error("Error in rewriteQuery:",n),r}}async getExplicitChunks(r){let n=[];for(let o of r){let i=await Li.getInstance().getDb(),a=await aO.getDocsByPath(i,o.path);if(a){let s=a.map(u=>new sO({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 Li.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&&(ne().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);ae("==== Daily note date range: ====",d[0],d[d.length-1]);let f=$x(d.join(", "),app.vault),m=(await this.getExplicitChunks(f)).map(w=>({...w,metadata:{...w.metadata,includeInContext:!0}}));ae("==== Modified time range: ====",l,c),s.where={mtime:{between:[l,c]}};let b=(await Fc(a,s)).hits.map(w=>new sO({pageContent:w.document.content,metadata:{...w.document.metadata,score:w.score,path:w.document.path,mtime:w.document.mtime,ctime:w.document.ctime,title:w.document.title,id:w.document.id,embeddingModel:w.document.embeddingModel,tags:w.document.tags,extension:w.document.extension,created_at:w.document.created_at,nchars:w.document.nchars}})),g=[...m,...b];return Array.from(new Set(g.map(w=>w.metadata.id))).map(w=>g.find(x=>x.metadata.id===w)).filter(w=>w!==void 0)}ne().debug&&console.log(`==== Orama Search Params: ====
`,s);let u=await Fc(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 sO({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 $s.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}}))}};Jt();ud();var oTe=xm(async({timeRange:t,query:e,salientTerms:r})=>{if(await Li.getInstance().isIndexEmpty())throw new Er(K9);let o=t!==void 0,i=ne().maxSourceChunks<Gfe?Gfe:ne().maxSourceChunks;ne().debug&&console.log("returnAll:",o);let u=(await new sA({minSimilarityScore:o?0:.1,maxK:o?1e3:i,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:lze,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:Ur.object({timeRange:Ur.object({startTime:Ur.any(),endTime:Ur.any()}).optional(),query:Ur.string().describe("The search query"),salientTerms:Ur.array(Ur.string()).describe("List of salient terms extracted from the query")})}),WCt=xm(async()=>{try{let t=await Li.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"}),iTe=xm(async({query:t,chatHistory:e})=>{try{let r=await Rre(t,e),n=await Ei.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:Ur.object({query:Ur.string().describe("The search query"),chatHistory:Ur.array(Ur.object({role:Ur.enum(["user","assistant"]),content:Ur.string()})).describe("Previous conversation turns")})});var YCt=$(KCt(),1),ZH=$(uA(),1);var Yn;(function(t){t[t.AM=0]="AM",t[t.PM=1]="PM"})(Yn||(Yn={}));var qs;(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"})(qs||(qs={}));var Pm;(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"})(Pm||(Pm={}));function JCt(t,e){e=e.add(1,"day"),pj(t,e),aB(t,e)}function gy(t,e){t.assign("day",e.date()),t.assign("month",e.month()+1),t.assign("year",e.year())}function Dre(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",Yn.AM):t.assign("meridiem",Yn.PM)}function pj(t,e){t.imply("day",e.date()),t.imply("month",e.month()+1),t.imply("year",e.year())}function aB(t,e){t.imply("hour",e.hour()),t.imply("minute",e.minute()),t.imply("second",e.second()),t.imply("millisecond",e.millisecond())}var cTe=$(uA(),1);var E4r={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=>GCt(t,Pm.MARCH,qs.SUNDAY,2),dstEnd:t=>GCt(t,Pm.OCTOBER,qs.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=>lA(t,Pm.MARCH,qs.SUNDAY,2,2),dstEnd:t=>lA(t,Pm.NOVEMBER,qs.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=>lA(t,Pm.MARCH,qs.SUNDAY,2,2),dstEnd:t=>lA(t,Pm.NOVEMBER,qs.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=>lA(t,Pm.MARCH,qs.SUNDAY,2,2),dstEnd:t=>lA(t,Pm.NOVEMBER,qs.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=>lA(t,Pm.MARCH,qs.SUNDAY,2,2),dstEnd:t=>lA(t,Pm.NOVEMBER,qs.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 lA(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 GCt(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 Nre(t,e,r={}){if(t==null)return null;if(typeof t=="number")return t;let n=r[t]??E4r[t];return n==null?null:typeof n=="number"?n:e==null?null:(0,cTe.default)(e).isAfter(n.dstStart(e.getFullYear()))&&!(0,cTe.default)(e).isAfter(n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}ZH.default.extend(YCt.default);var cA=class{constructor(e){e=e??new Date,e instanceof Date?this.instant=e:(this.instant=e.instant??new Date,this.timezoneOffset=Nre(e.timezone,this.instant))}getDateWithAdjustedTimezone(){return new Date(this.instant.getTime()+this.getSystemTimezoneAdjustmentMinute(this.instant)*6e4)}getSystemTimezoneAdjustmentMinute(e,r){(!e||e.getTime()<0)&&(e=new Date);let n=-e.getTimezoneOffset(),o=r??this.timezoneOffset??n;return n-o}},Zn=class t{constructor(e,r){if(this._tags=new Set,this.reference=e,this.knownValues={},this.impliedValues={},r)for(let o in r)this.knownValues[o]=r[o];let n=(0,ZH.default)(e.instant);this.imply("day",n.date()),this.imply("month",n.month()+1),this.imply("year",n.year()),this.imply("hour",12),this.imply("minute",0),this.imply("second",0),this.imply("millisecond",0)}get(e){return e in this.knownValues?this.knownValues[e]:e in this.impliedValues?this.impliedValues[e]:null}isCertain(e){return e in this.knownValues}getCertainComponents(){return Object.keys(this.knownValues)}imply(e,r){return e in this.knownValues?this:(this.impliedValues[e]=r,this)}assign(e,r){return this.knownValues[e]=r,delete this.impliedValues[e],this}delete(e){delete this.knownValues[e],delete this.impliedValues[e]}clone(){let e=new t(this.reference);e.knownValues={},e.impliedValues={};for(let r in this.knownValues)e.knownValues[r]=this.knownValues[r];for(let r in this.impliedValues)e.impliedValues[r]=this.impliedValues[r];return e}isOnlyDate(){return!this.isCertain("hour")&&!this.isCertain("minute")&&!this.isCertain("second")}isOnlyTime(){return!this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")&&!this.isCertain("year")}isOnlyWeekdayComponent(){return this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")}isDateWithUnknownYear(){return this.isCertain("month")&&!this.isCertain("year")}isValidDate(){let e=this.dateWithoutTimezoneAdjustment();return!(e.getFullYear()!==this.get("year")||e.getMonth()!==this.get("month")-1||e.getDate()!==this.get("day")||this.get("hour")!=null&&e.getHours()!=this.get("hour")||this.get("minute")!=null&&e.getMinutes()!=this.get("minute"))}toString(){return`[ParsingComponents {
tags: ${JSON.stringify(Array.from(this._tags).sort())},
knownValues: ${JSON.stringify(this.knownValues)},
impliedValues: ${JSON.stringify(this.impliedValues)}},
reference: ${JSON.stringify(this.reference)}]`}dayjs(){return(0,ZH.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,ZH.default)(e.instant);for(let i in r)n=n.add(r[i],i);let o=new t(e);return r.hour||r.minute||r.second?(Dre(o,n),gy(o,n),e.timezoneOffset!==null&&o.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(aB(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}},uO=class t{constructor(e,r,n,o,i){this.reference=e,this.refDate=e.instant,this.index=r,this.text=n,this.start=o||new Zn(e),this.end=i}clone(){let e=new t(this.reference,this.index,this.text);return e.start=this.start?this.start.clone():null,e.end=this.end?this.end.clone():null,e}date(){return this.start.date()}tags(){let e=new Set(this.start.tags());if(this.end)for(let r of this.end.tags())e.add(r);return e}toString(){let e=Array.from(this.tags()).sort();return`[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(e)} ...}]`}};function dTe(t,e,r="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${t}${n}(?:${r}${n}){0,10}`}function T4r(t){let e;return t instanceof Array?e=[...t]:t instanceof Map?e=Array.from(t.keys()):e=Object.keys(t),e}function kc(t){return`(?:${T4r(t).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var ZCt=$(uA(),1);function Lre(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function dA(t,e,r){let n=(0,ZCt.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 mTe={sunday:0,sun:0,"sun.":0,monday:1,mon:1,"mon.":1,tuesday:2,tue:2,"tue.":2,wednesday:3,wed:3,"wed.":3,thursday:4,thurs:4,"thurs.":4,thur:4,"thur.":4,thu:4,"thu.":4,friday:5,fri:5,"fri.":5,saturday:6,sat:6,"sat.":6},hTe={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},Nh={...hTe,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},fTe={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},pTe={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},QCt={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"},XH={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",...QCt},eOt=`(?:${kc(fTe)}|[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 A4r(t){let e=t.toLowerCase();return fTe[e]!==void 0?fTe[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 sB=`(?:${kc(pTe)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;function uB(t){let e=t.toLowerCase();return pTe[e]!==void 0?pTe[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}var fA="(?:[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 pA(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 Lre(e)}var tOt=`(${eOt})\\s{0,3}(${kc(XH)})`,XCt=new RegExp(tOt,"i"),I4r=`(${eOt})\\s{0,3}(${kc(QCt)})`,rOt="\\s{0,5},?(?:\\s*and)?\\s{0,5}",lO=dTe("(?:(?:about|around)\\s{0,3})?",tOt,rOt),mA=dTe("(?:(?:about|around)\\s{0,3})?",I4r,rOt);function Lh(t){let e={},r=t,n=XCt.exec(r);for(;n;)M4r(e,n),r=r.substring(n[0].length).trim(),n=XCt.exec(r);return Object.keys(e).length==0?null:e}function M4r(t,e){if(e[0].match(/^[a-zA-Z]+$/))return;let r=A4r(e[1]),n=XH[e[2].toLowerCase()];t[n]=r}var ti=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 R4r=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${lO})(?=\\W|$)`,"i"),j4r=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${lO})(?=\\W|$)`,"i"),D4r=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${mA})(?=\\W|$)`,"i"),QH=class extends ti{constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?D4r:e.option.forwardDate?R4r:j4r}innerExtract(e,r){if(r[0].match(/^for\s*the\s*\w+/))return null;let n=Lh(r[1]);return n?Zn.createRelativeFromReference(e.reference,n):null}};var N4r=new RegExp(`(?:on\\s{0,3})?(${sB})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${sB}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${kc(Nh)})(?:(?:-|/|,?\\s{0,3})(${fA}(?!\\w)))?(?=\\W|$)`,"i"),nOt=1,oOt=2,L4r=3,iOt=4,eV=class extends ti{innerPattern(){return N4r}innerExtract(e,r){let n=e.createParsingResult(r.index,r[0]),o=Nh[r[L4r].toLowerCase()],i=uB(r[nOt]);if(i>31)return r.index=r.index+r[nOt].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[iOt]){let a=pA(r[iOt]);n.start.assign("year",a)}else{let a=dA(e.refDate,i,o);n.start.imply("year",a)}if(r[oOt]){let a=uB(r[oOt]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};var F4r=new RegExp(`(${kc(Nh)})(?:-|/|\\s*,?\\s*)(${sB})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${sB})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${fA}))?(?=\\W|$)(?!\\:\\d)`,"i"),k4r=1,aOt=2,gTe=3,yTe=4,tV=class extends ti{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return F4r}innerExtract(e,r){let n=Nh[r[k4r].toLowerCase()],o=uB(r[aOt]);if(o>31||this.shouldSkipYearLikeDate&&!r[gTe]&&!r[yTe]&&r[aOt].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[yTe]){let u=pA(r[yTe]);i.assign("year",u)}else{let u=dA(e.refDate,o,n);i.imply("year",u)}if(!r[gTe])return i;let a=uB(r[gTe]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}};var $4r=new RegExp(`((?:in)\\s*)?(${kc(Nh)})\\s*(?:[,-]?\\s*(${fA})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),B4r=1,q4r=2,sOt=3,rV=class extends ti{innerPattern(){return $4r}innerExtract(e,r){let n=r[q4r].toLowerCase();if(r[0].length<=3&&!hTe[n])return null;let o=e.createParsingResult(r.index+(r[B4r]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=Nh[n];if(o.start.assign("month",i),r[sOt]){let a=pA(r[sOt]);o.start.assign("year",a)}else{let a=dA(e.refDate,1,i);o.start.imply("year",a)}return o}};var U4r=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${kc(Nh)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),z4r=1,H4r=2,uOt=3,V4r=4,nV=class extends ti{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return U4r}innerExtract(e,r){let n=parseInt(r[z4r]),o=parseInt(r[V4r]),i=r[uOt]?parseInt(r[uOt]):Nh[r[H4r].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 W4r=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),K4r=1,J4r=2,oV=class extends ti{innerPattern(){return W4r}innerExtract(e,r){let n=parseInt(r[J4r]),o=parseInt(r[K4r]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}};function G4r(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 Y4r(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 lOt=2,lB=3,Fre=4,kre=5,iV=6,$re=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[lOt]);if(s>100){if(this.strictMode||r[lB]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[lB]!=null){if(r[lB].length==1&&!r[iV])return null;i=parseInt(r[lB])}if(i>=60)return null;if(s>12&&(a=Yn.PM),r[iV]!=null){if(s>12)return null;let u=r[iV][0].toLowerCase();u=="a"&&(a=Yn.AM,s==12&&(s=0)),u=="p"&&(a=Yn.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",Yn.AM):o.imply("meridiem",Yn.PM),r[kre]!=null){let u=parseInt(r[kre].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[Fre]!=null){let u=parseInt(r[Fre]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(e,r,n){let o=e.createParsingComponents();if(r[kre]!=null){let u=parseInt(r[kre].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[Fre]!=null){let u=parseInt(r[Fre]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[lOt]),a=0,s=-1;if(r[lB]!=null?a=parseInt(r[lB]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=Yn.PM),r[iV]!=null){if(i>12)return null;let u=r[iV][0].toLowerCase();u=="a"&&(s=Yn.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=Yn.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==Yn.AM?(n.start.imply("meridiem",Yn.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",Yn.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",Yn.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",Yn.PM)):i>12?o.imply("meridiem",Yn.PM):i<=12&&o.imply("meridiem",Yn.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=G4r(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=Y4r(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}};var aV=class extends $re{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",Yn.PM)):o<6&&n.assign("meridiem",Yn.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",Yn.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",Yn.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}};function hA(t){let e={};for(let r in t)e[r]=-t[r];return e}function cOt(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 Z4r=new RegExp(`(${lO})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),X4r=new RegExp(`(${mA})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),sV=class extends ti{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?X4r:Z4r}innerExtract(e,r){let n=Lh(r[1]);if(!n)return null;let o=hA(n);return Zn.createRelativeFromReference(e.reference,o)}};var Q4r=new RegExp(`(${lO})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),e3r=new RegExp(`(${mA})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),t3r=1,uV=class extends ti{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?e3r:Q4r}innerExtract(e,r){let n=Lh(r[t3r]);return n?Zn.createRelativeFromReference(e.reference,n):null}};var Bre=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},Fh=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 lV=class extends Fh{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 cV=class extends lV{patternBetween(){return/^\s*(to|-||until|through|till)\s*$/i}};function bTe(t,e){let r=t.clone(),n=t.start,o=e.start;if(r.start=dOt(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=dOt(i,a);if(t.end==null&&s.date().getTime()<r.start.date().getTime()){let u=s.dayjs().add(1,"day");s.isCertain("day")?gy(s,u):pj(s,u)}r.end=s}return r}function dOt(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")==Yn.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 dV=class extends Fh{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()?bTe(r,n):bTe(n,r);return o.index=r.index,o.text=r.text+e+n.text,o}};var cB=class extends dV{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}};var r3r=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),fV=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=r3r.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=Nre(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 n3r=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),o3r=1,i3r=2,a3r=3,pV=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=n3r.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[i3r]),s=parseInt(i[a3r]||"0"),u=a*60+s;u>14*60||(i[o3r]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}};var gA=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 fOt=$(uA(),1);var mV=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,fOt.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),pj(n.start,o),n.end&&n.end.isOnlyTime()&&(pj(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),pj(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 hV=class extends Bre{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 s3r=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"),u3r=1,l3r=2,c3r=3,pOt=4,d3r=5,mOt=6,hOt=7,f3r=8,gOt=9,yOt=10,gV=class extends ti{innerPattern(){return s3r}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[u3r]),month:parseInt(r[l3r]),day:parseInt(r[c3r])});if(r[pOt]!=null&&(n.assign("hour",parseInt(r[pOt])),n.assign("minute",parseInt(r[d3r])),r[mOt]!=null&&n.assign("second",parseInt(r[mOt])),r[hOt]!=null&&n.assign("millisecond",parseInt(r[hOt])),r[f3r]!=null)){let o=0;if(r[gOt]){let i=parseInt(r[gOt]),a=0;r[yOt]!=null&&(a=parseInt(r[yOt])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}};var yV=class extends Fh{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 bOt(t,e=!1){return t.parsers.unshift(new gV),t.refiners.unshift(new yV),t.refiners.unshift(new pV),t.refiners.unshift(new gA),t.refiners.push(new fV),t.refiners.push(new gA),t.refiners.push(new mV),t.refiners.push(new hV(e)),t}var MOt=$(uA(),1);var dB=$(uA(),1);function _Ot(t){let e=(0,dB.default)(t.instant),r=new Zn(t,{});return gy(r,e),Dre(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function vOt(t){let e=(0,dB.default)(t.instant),r=new Zn(t,{});return gy(r,e),aB(r,e),r.addTag("casualReference/today"),r}function wOt(t){return p3r(t,1).addTag("casualReference/yesterday")}function p3r(t,e){return xOt(t,-e)}function SOt(t){return xOt(t,1).addTag("casualReference/tomorrow")}function xOt(t,e){let r=(0,dB.default)(t.instant),n=new Zn(t,{});return r=r.add(e,"day"),gy(n,r),aB(n,r),n}function COt(t,e=22){let r=(0,dB.default)(t.instant),n=new Zn(t,{});return gy(n,r),n.imply("hour",e),n.imply("meridiem",Yn.PM),n.addTag("casualReference/tonight"),n}function OOt(t,e=20){let r=new Zn(t,{});return r.imply("meridiem",Yn.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function POt(t){let e=new Zn(t,{}),r=(0,dB.default)(t.instant);return r.hour()>2&&JCt(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function EOt(t,e=6){let r=new Zn(t,{});return r.imply("meridiem",Yn.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function TOt(t,e=15){let r=new Zn(t,{});return r.imply("meridiem",Yn.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function AOt(t){let e=new Zn(t,{});return e.imply("meridiem",Yn.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var m3r=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,bV=class extends ti{innerPattern(e){return m3r}innerExtract(e,r){let n=(0,MOt.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=_Ot(e.reference);break;case"today":i=vOt(e.reference);break;case"yesterday":i=wOt(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=SOt(e.reference);break;case"tonight":i=COt(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),gy(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}};var h3r=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,_V=class extends ti{innerPattern(){return h3r}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=TOt(e.reference);break;case"evening":case"night":n=OOt(e.reference);break;case"midnight":n=POt(e.reference);break;case"morning":n=EOt(e.reference);break;case"noon":case"midday":n=AOt(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}};function ROt(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=g3r(n,e,r),i=new Zn(t);return i=cOt(i,{day:o}),i.assign("weekday",e),i}function g3r(t,e,r){let n=t.getDay();switch(r){case"this":return qre(t,e);case"last":return jOt(t,e);case"next":return n==qs.SUNDAY?e==qs.SUNDAY?7:e:n==qs.SATURDAY?e==qs.SATURDAY?7:e==qs.SUNDAY?8:1+e:e<n&&e!=qs.SUNDAY?qre(t,e):qre(t,e)+7}return y3r(t,e)}function y3r(t,e){let r=jOt(t,e),n=qre(t,e);return n<-r?n:r}function qre(t,e){let r=t.getDay(),n=e-r;return n<0&&(n+=7),n}function jOt(t,e){let r=t.getDay(),n=e-r;return n>=0&&(n-=7),n}var b3r=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${kc(mTe)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),_3r=1,v3r=2,w3r=3,vV=class extends ti{innerPattern(){return b3r}innerExtract(e,r){let n=r[v3r].toLowerCase(),o=mTe[n],i=r[_3r],a=r[w3r],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"),ROt(e.reference,o,u)}};var DOt=$(uA(),1);var S3r=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${kc(XH)})(?=\\s*)(?=\\W|$)`,"i"),x3r=1,C3r=2,wV=class extends ti{innerPattern(){return S3r}innerExtract(e,r){let n=r[x3r].toLowerCase(),o=r[C3r].toLowerCase(),i=XH[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,Zn.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,Zn.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,DOt.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 O3r=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"),P3r=1,E3r=5,NOt=2,LOt=3,_Te=4,SV=class{constructor(e){this.groupNumberMonth=e?LOt:NOt,this.groupNumberDay=e?NOt:LOt}pattern(){return O3r}extract(e,r){let n=r.index+r[P3r].length,o=r.index+r[0].length-r[E3r].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[_Te]&&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[_Te]){let l=parseInt(r[_Te]),c=Lre(l);a.start.assign("year",c)}else{let l=dA(e.refDate,u,s);a.start.imply("year",l)}return a}};var T3r=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${lO})(?=\\W|$)`,"i"),A3r=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${mA})(?=\\W|$)`,"i"),xV=class extends ti{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?T3r:A3r}innerExtract(e,r){let n=r[1].toLowerCase(),o=Lh(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=hA(o);break}return Zn.createRelativeFromReference(e.reference,o)}};function I3r(t){return t.text.match(/^[+-]/i)!=null}function FOt(t){return t.text.match(/^-/i)!=null}var CV=class extends Fh{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?I3r(n)||FOt(n):!1}mergeResults(e,r,n,o){let i=Lh(n.text);FOt(n)&&(i=hA(i));let a=Zn.createRelativeFromReference(new cA(r.start.date()),i);return new uO(r.reference,r.index,`${r.text}${e}${n.text}`,a)}};function kOt(t){return t.text.match(/\s+(before|from)$/i)!=null}function M3r(t){return t.text.match(/\s+(after|since)$/i)!=null}var OV=class extends Fh{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!kOt(r)&&!M3r(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=Lh(r.text);kOt(r)&&(o=hA(o));let i=Zn.createRelativeFromReference(new cA(n.start.date()),o);return new uO(n.reference,r.index,`${r.text}${e}${n.text}`,i)}};var R3r=new RegExp(`^\\s*(${fA})`,"i"),j3r=1,PV=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=R3r.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=pA(i[j3r]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}};var mj=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new bV),r.parsers.push(new _V),r.parsers.push(new rV),r.parsers.push(new wV),r.parsers.push(new xV),r}createConfiguration(e=!0,r=!1){let n=bOt({parsers:[new SV(r),new QH(e),new eV,new tV(r),new vV,new oV,new aV(e),new sV(e),new uV(e)],refiners:[new cB]},e);return n.parsers.unshift(new nV(e)),n.refiners.unshift(new OV),n.refiners.unshift(new CV),n.refiners.unshift(new gA),n.refiners.push(new cB),n.refiners.push(new PV),n.refiners.push(new cV),n}};var fB=class t{constructor(e){this.defaultConfig=new mj,e=e||this.defaultConfig.createCasualConfiguration(),this.parsers=[...e.parsers],this.refiners=[...e.refiners]}clone(){return new t({parsers:[...this.parsers],refiners:[...this.refiners]})}parseDate(e,r,n){let o=this.parse(e,r,n);return o.length>0?o[0].start.date():null}parse(e,r,n){let o=new vTe(e,r,n),i=[];return this.parsers.forEach(a=>{let s=t.executeParser(o,a);i=i.concat(s)}),i.sort((a,s)=>a.index-s.index),this.refiners.forEach(function(a){i=a.refine(o,i)}),i}static executeParser(e,r){let n=[],o=r.pattern(e),i=e.text,a=e.text,s=o.exec(a);for(;s;){let u=s.index+i.length-a.length;s.index=u;let l=r.extract(e,s);if(!l){a=i.substring(s.index+1),s=o.exec(a);continue}let c=null;l instanceof uO?c=l:l instanceof Zn?(c=e.createParsingResult(s.index,s[0]),c.start=l):c=e.createParsingResult(s.index,s[0],l);let d=c.index,f=c.text;e.debug(()=>console.log(`${r.constructor.name} extracted (at index=${d}) '${f}'`)),n.push(c),a=i.substring(d+f.length),s=o.exec(a)}return n}},vTe=class{constructor(e,r,n){this.text=e,this.reference=new cA(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof Zn?e:new Zn(this.reference,e)}createParsingResult(e,r,n,o){let i=typeof r=="string"?r:this.text.substring(e,r),a=n?this.createParsingComponents(n):null,s=o?this.createParsingComponents(o):null;return new uO(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 wTe=new mj,$Ot=new fB(wTe.createCasualConfiguration(!1)),D3r=new fB(wTe.createConfiguration(!0,!1)),tNo=new fB(wTe.createCasualConfiguration(!0));var L3r=$Ot;function STe(t,e,r){return L3r.parse(t,e,r)}var cO=class extends Error{},Ure=class extends cO{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},zre=class extends cO{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Hre=class extends cO{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},yy=class extends cO{},pB=class extends cO{constructor(e){super(`Invalid unit ${e}`)}},is=class extends cO{},by=class extends cO{constructor(){super("Zone is an abstract class")}};var it="numeric",_y="short",Em="long",yA={year:it,month:it,day:it},EV={year:it,month:_y,day:it},xTe={year:it,month:_y,day:it,weekday:_y},TV={year:it,month:Em,day:it},AV={year:it,month:Em,day:it,weekday:Em},IV={hour:it,minute:it},MV={hour:it,minute:it,second:it},RV={hour:it,minute:it,second:it,timeZoneName:_y},jV={hour:it,minute:it,second:it,timeZoneName:Em},DV={hour:it,minute:it,hourCycle:"h23"},NV={hour:it,minute:it,second:it,hourCycle:"h23"},LV={hour:it,minute:it,second:it,hourCycle:"h23",timeZoneName:_y},FV={hour:it,minute:it,second:it,hourCycle:"h23",timeZoneName:Em},kV={year:it,month:it,day:it,hour:it,minute:it},$V={year:it,month:it,day:it,hour:it,minute:it,second:it},BV={year:it,month:_y,day:it,hour:it,minute:it},qV={year:it,month:_y,day:it,hour:it,minute:it,second:it},CTe={year:it,month:_y,day:it,weekday:_y,hour:it,minute:it},UV={year:it,month:Em,day:it,hour:it,minute:it,timeZoneName:_y},zV={year:it,month:Em,day:it,hour:it,minute:it,second:it,timeZoneName:_y},HV={year:it,month:Em,day:it,weekday:Em,hour:it,minute:it,timeZoneName:Em},VV={year:it,month:Em,day:it,weekday:Em,hour:it,minute:it,second:it,timeZoneName:Em};var Op=class{get type(){throw new by}get name(){throw new by}get ianaName(){return this.name}get isUniversal(){throw new by}offsetName(e,r){throw new by}formatOffset(e,r){throw new by}offset(e){throw new by}equals(e){throw new by}get isValid(){throw new by}};var OTe=null,bA=class t extends Op{static get instance(){return OTe===null&&(OTe=new t),OTe}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Wre(e,r,n)}formatOffset(e,r){return _A(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Jre={};function k3r(t){return Jre[t]||(Jre[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"})),Jre[t]}var $3r={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function B3r(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 q3r(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o<r.length;o++){let{type:i,value:a}=r[o],s=$3r[i];i==="era"?n[s]=a:er(s)||(n[s]=parseInt(a,10))}return n}var Kre={},Nd=class t extends Op{static create(e){return Kre[e]||(Kre[e]=new t(e)),Kre[e]}static resetCache(){Kre={},Jre={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Wre(e,r,n,this.name)}formatOffset(e,r){return _A(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=k3r(this.name),[o,i,a,s,u,l,c]=n.formatToParts?q3r(n,r):B3r(n,r);s==="BC"&&(o=-Math.abs(o)+1);let f=mB({year:o,month:i,day:a,hour:u===24?0:u,minute:l,second:c,millisecond:0}),p=+r,m=p%1e3;return p-=m>=0?m:1e3+m,(f-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var BOt={};function U3r(t,e={}){let r=JSON.stringify([t,e]),n=BOt[r];return n||(n=new Intl.ListFormat(t,e),BOt[r]=n),n}var PTe={};function ETe(t,e={}){let r=JSON.stringify([t,e]),n=PTe[r];return n||(n=new Intl.DateTimeFormat(t,e),PTe[r]=n),n}var TTe={};function z3r(t,e={}){let r=JSON.stringify([t,e]),n=TTe[r];return n||(n=new Intl.NumberFormat(t,e),TTe[r]=n),n}var ATe={};function H3r(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=ATe[o];return i||(i=new Intl.RelativeTimeFormat(t,e),ATe[o]=i),i}var WV=null;function V3r(){return WV||(WV=new Intl.DateTimeFormat().resolvedOptions().locale,WV)}var qOt={};function W3r(t){let e=qOt[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,qOt[t]=e}return e}function K3r(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=ETe(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=ETe(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function J3r(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function G3r(t){let e=[];for(let r=1;r<=12;r++){let n=Wr.utc(2009,r,1);e.push(t(n))}return e}function Y3r(t){let e=[];for(let r=1;r<=7;r++){let n=Wr.utc(2016,11,13+r);e.push(t(n))}return e}function Gre(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function Z3r(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 ITe=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=z3r(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):hB(e,3);return qa(r,this.padTo)}}},MTe=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&&Nd.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=ETe(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()}},RTe=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&Yre()&&(this.rtf=H3r(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):UOt(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},X3r={firstDay:1,minimalDays:4,weekend:[6,7]},_o=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,n,o,i=!1){let a=e||bo.defaultLocale,s=a||(i?"en-US":V3r()),u=r||bo.defaultNumberingSystem,l=n||bo.defaultOutputCalendar,c=KV(o)||bo.defaultWeekSettings;return new t(s,u,l,c,a)}static resetCache(){WV=null,PTe={},TTe={},ATe={}}static fromObject({locale:e,numberingSystem:r,outputCalendar:n,weekSettings:o}={}){return t.create(e,r,n,o)}constructor(e,r,n,o,i){let[a,s,u]=K3r(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=J3r(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=Z3r(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&r?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,KV(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 Gre(this,e,jTe,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=G3r(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return Gre(this,e,DTe,()=>{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]=Y3r(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return Gre(this,void 0,()=>NTe,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Wr.utc(2016,11,13,9),Wr.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Gre(this,e,LTe,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[Wr.utc(-40,1,1),Wr.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 ITe(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new MTe(e,this.intl,r)}relFormatter(e={}){return new RTe(this.intl,this.isEnglish(),e)}listFormatter(e={}){return U3r(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:Zre()?W3r(this.locale):X3r}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 kTe=null,Vl=class t extends Op{static get utcInstance(){return kTe===null&&(kTe=new t(0)),kTe}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let r=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new t(hj(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${_A(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${_A(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return _A(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 gB=class extends Op{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 vy(t,e){let r;if(er(t)||t===null)return e;if(t instanceof Op)return t;if(zOt(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?bA.instance:n==="utc"||n==="gmt"?Vl.utcInstance:Vl.parseSpecifier(n)||Nd.create(t)}else return wy(t)?Vl.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new gB(t)}var $Te={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},HOt={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]},Q3r=$Te.hanidec.replace(/[\[|\]]/g,"").split("");function VOt(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($Te.hanidec)!==-1)e+=Q3r.indexOf(t[r]);else for(let o in HOt){let[i,a]=HOt[o];n>=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}var yB={};function WOt(){yB={}}function kh({numberingSystem:t},e=""){let r=t||"latn";return yB[r]||(yB[r]={}),yB[r][e]||(yB[r][e]=new RegExp(`${$Te[r]}${e}`)),yB[r][e]}var KOt=()=>Date.now(),JOt="system",GOt=null,YOt=null,ZOt=null,XOt=60,QOt,ePt=null,bo=class{static get now(){return KOt}static set now(e){KOt=e}static set defaultZone(e){JOt=e}static get defaultZone(){return vy(JOt,bA.instance)}static get defaultLocale(){return GOt}static set defaultLocale(e){GOt=e}static get defaultNumberingSystem(){return YOt}static set defaultNumberingSystem(e){YOt=e}static get defaultOutputCalendar(){return ZOt}static set defaultOutputCalendar(e){ZOt=e}static get defaultWeekSettings(){return ePt}static set defaultWeekSettings(e){ePt=KV(e)}static get twoDigitCutoffYear(){return XOt}static set twoDigitCutoffYear(e){XOt=e%100}static get throwOnInvalid(){return QOt}static set throwOnInvalid(e){QOt=e}static resetCaches(){_o.resetCache(),Nd.resetCache(),Wr.resetCache(),WOt()}};var Wl=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var tPt=[0,31,59,90,120,151,181,212,243,273,304,334],rPt=[0,31,60,91,121,152,182,213,244,274,305,335];function $h(t,e){return new Wl("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Xre(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 nPt(t,e,r){return r+(yj(t)?rPt:tPt)[e-1]}function oPt(t,e){let r=yj(t)?rPt:tPt,n=r.findIndex(i=>i<e),o=e-r[n];return{month:n+1,day:o}}function Qre(t,e){return(t-e+7)%7+1}function JV(t,e=4,r=1){let{year:n,month:o,day:i}=t,a=nPt(n,o,i),s=Qre(Xre(n,o,i),r),u=Math.floor((a-s+14-e)/7),l;return u<1?(l=n-1,u=gj(l,e,r)):u>gj(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...YV(t)}}function BTe(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=Qre(Xre(n,1,e),r),s=vA(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=vA(l)):u>s?(l=n+1,u-=vA(n)):l=n;let{month:c,day:d}=oPt(l,u);return{year:l,month:c,day:d,...YV(t)}}function ene(t){let{year:e,month:r,day:n}=t,o=nPt(e,r,n);return{year:e,ordinal:o,...YV(t)}}function qTe(t){let{year:e,ordinal:r}=t,{month:n,day:o}=oPt(e,r);return{year:e,month:n,day:o,...YV(t)}}function UTe(t,e){if(!er(t.localWeekday)||!er(t.localWeekNumber)||!er(t.localWeekYear)){if(!er(t.weekday)||!er(t.weekNumber)||!er(t.weekYear))throw new yy("Cannot mix locale-based week fields with ISO-based week fields");return er(t.localWeekday)||(t.weekday=t.localWeekday),er(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),er(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 iPt(t,e=4,r=1){let n=GV(t.weekYear),o=Tm(t.weekNumber,1,gj(t.weekYear,e,r)),i=Tm(t.weekday,1,7);return n?o?i?!1:$h("weekday",t.weekday):$h("week",t.weekNumber):$h("weekYear",t.weekYear)}function aPt(t){let e=GV(t.year),r=Tm(t.ordinal,1,vA(t.year));return e?r?!1:$h("ordinal",t.ordinal):$h("year",t.year)}function zTe(t){let e=GV(t.year),r=Tm(t.month,1,12),n=Tm(t.day,1,bB(t.year,t.month));return e?r?n?!1:$h("day",t.day):$h("month",t.month):$h("year",t.year)}function HTe(t){let{hour:e,minute:r,second:n,millisecond:o}=t,i=Tm(e,0,23)||e===24&&r===0&&n===0&&o===0,a=Tm(r,0,59),s=Tm(n,0,59),u=Tm(o,0,999);return i?a?s?u?!1:$h("millisecond",o):$h("second",n):$h("minute",r):$h("hour",e)}function er(t){return typeof t>"u"}function wy(t){return typeof t=="number"}function GV(t){return typeof t=="number"&&t%1===0}function zOt(t){return typeof t=="string"}function uPt(t){return Object.prototype.toString.call(t)==="[object Date]"}function Yre(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Zre(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function lPt(t){return Array.isArray(t)?t:[t]}function VTe(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 cPt(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function wA(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function KV(t){if(t==null)return null;if(typeof t!="object")throw new is("Week settings must be an object");if(!Tm(t.firstDay,1,7)||!Tm(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Tm(e,1,7)))throw new is("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Tm(t,e,r){return GV(t)&&t>=e&&t<=r}function eHr(t,e){return t-e*Math.floor(t/e)}function qa(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function dO(t){if(!(er(t)||t===null||t===""))return parseInt(t,10)}function SA(t){if(!(er(t)||t===null||t===""))return parseFloat(t)}function ZV(t){if(!(er(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function hB(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function yj(t){return t%4===0&&(t%100!==0||t%400===0)}function vA(t){return yj(t)?366:365}function bB(t,e){let r=eHr(e-1,12)+1,n=t+(e-r)/12;return r===2?yj(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function mB(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 sPt(t,e,r){return-Qre(Xre(t,1,e),r)+e-1}function gj(t,e=4,r=1){let n=sPt(t,e,r),o=sPt(t+1,e,r);return(vA(t)-n+o)/7}function XV(t){return t>99?t:t>bo.twoDigitCutoffYear?1900+t:2e3+t}function Wre(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 hj(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 WTe(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new is(`Invalid unit value ${t}`);return e}function _B(t,e){let r={};for(let n in t)if(wA(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=WTe(o)}return r}function _A(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}${qa(r,2)}:${qa(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${qa(r,2)}${qa(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function YV(t){return cPt(t,["hour","minute","second","millisecond"])}var tHr=["January","February","March","April","May","June","July","August","September","October","November","December"],KTe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],rHr=["J","F","M","A","M","J","J","A","S","O","N","D"];function jTe(t){switch(t){case"narrow":return[...rHr];case"short":return[...KTe];case"long":return[...tHr];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 JTe=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],GTe=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],nHr=["M","T","W","T","F","S","S"];function DTe(t){switch(t){case"narrow":return[...nHr];case"short":return[...GTe];case"long":return[...JTe];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var NTe=["AM","PM"],oHr=["Before Christ","Anno Domini"],iHr=["BC","AD"],aHr=["B","A"];function LTe(t){switch(t){case"narrow":return[...aHr];case"short":return[...iHr];case"long":return[...oHr];default:return null}}function dPt(t){return NTe[t.hour<12?0:1]}function fPt(t,e){return DTe(e)[t.weekday-1]}function pPt(t,e){return jTe(e)[t.month-1]}function mPt(t,e){return LTe(e)[t.year<0?0:1]}function UOt(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 hPt(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var sHr={D:yA,DD:EV,DDD:TV,DDDD:AV,t:IV,tt:MV,ttt:RV,tttt:jV,T:DV,TT:NV,TTT:LV,TTTT:FV,f:kV,ff:BV,fff:UV,ffff:HV,F:$V,FF:qV,FFF:zV,FFFF:VV},Kl=class t{static create(e,r={}){return new t(e,r)}static parseFormat(e){let r=null,n="",o=!1,i=[];for(let a=0;a<e.length;a++){let s=e.charAt(a);s==="'"?(n.length>0&&i.push({literal:o||/^\s+$/.test(n),val:n}),r=null,n="",o=!o):o||s===r?n+=s:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=s,r=s)}return n.length>0&&i.push({literal:o||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return sHr[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 qa(e,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",o=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(p,m)=>this.loc.extract(e,p,m),a=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",s=()=>n?dPt(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,m)=>n?pPt(e,p):i(m?{month:p}:{month:p,day:"numeric"},"month"),l=(p,m)=>n?fPt(e,p):i(m?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),c=p=>{let m=t.macroTokenToFormatOpts(p);return m?this.formatWithSystemDefault(e,m):p},d=p=>n?mPt(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 hPt(t.parseFormat(r),f)}formatDurationFromString(e,r){let n=u=>{switch(u[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},o=u=>l=>{let c=n(l);return c?this.num(u.get(c),l.length):l},i=t.parseFormat(r),a=i.reduce((u,{literal:l,val:c})=>l?u:u.concat(c),[]),s=e.shiftTo(...a.map(n).filter(u=>u));return hPt(i,o(s))}};var yPt=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function wB(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function SB(...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 xB(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 bPt(...t){return(e,r)=>{let n={},o;for(o=0;o<t.length;o++)n[t[o]]=dO(e[r+o]);return[n,null,r+o]}}var _Pt=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,uHr=`(?:${_Pt.source}?(?:\\[(${yPt.source})\\])?)?`,YTe=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,vPt=RegExp(`${YTe.source}${uHr}`),ZTe=RegExp(`(?:T${vPt.source})?`),lHr=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,cHr=/(\d{4})-?W(\d\d)(?:-?(\d))?/,dHr=/(\d{4})-?(\d{3})/,fHr=bPt("weekYear","weekNumber","weekDay"),pHr=bPt("year","ordinal"),mHr=/(\d{4})-(\d\d)-(\d\d)/,wPt=RegExp(`${YTe.source} ?(?:${_Pt.source}|(${yPt.source}))?`),hHr=RegExp(`(?: ${wPt.source})?`);function vB(t,e,r){let n=t[e];return er(n)?r:dO(n)}function gHr(t,e){return[{year:vB(t,e),month:vB(t,e+1,1),day:vB(t,e+2,1)},null,e+3]}function CB(t,e){return[{hours:vB(t,e,0),minutes:vB(t,e+1,0),seconds:vB(t,e+2,0),milliseconds:ZV(t[e+3])},null,e+4]}function QV(t,e){let r=!t[e]&&!t[e+1],n=hj(t[e+1],t[e+2]),o=r?null:Vl.instance(n);return[{},o,e+3]}function e8(t,e){let r=t[e]?Nd.create(t[e]):null;return[{},r,e+1]}var yHr=RegExp(`^T?${YTe.source}$`),bHr=/^-?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 _Hr(t){let[e,r,n,o,i,a,s,u,l]=t,c=e[0]==="-",d=u&&u[0]==="-",f=(p,m=!1)=>p!==void 0&&(m||p&&c)?-p:p;return[{years:f(SA(r)),months:f(SA(n)),weeks:f(SA(o)),days:f(SA(i)),hours:f(SA(a)),minutes:f(SA(s)),seconds:f(SA(u),u==="-0"),milliseconds:f(ZV(l),d)}]}var vHr={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 XTe(t,e,r,n,o,i,a){let s={year:e.length===2?XV(dO(e)):dO(e),month:KTe.indexOf(r)+1,day:dO(n),hour:dO(o),minute:dO(i)};return a&&(s.second=dO(a)),t&&(s.weekday=t.length>3?JTe.indexOf(t)+1:GTe.indexOf(t)+1),s}var wHr=/^(?:(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 SHr(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=XTe(e,o,n,r,i,a,s),p;return u?p=vHr[u]:l?p=0:p=hj(c,d),[f,new Vl(p)]}function xHr(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var CHr=/^(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$/,OHr=/^(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$/,PHr=/^(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 gPt(t){let[,e,r,n,o,i,a,s]=t;return[XTe(e,o,n,r,i,a,s),Vl.utcInstance]}function EHr(t){let[,e,r,n,o,i,a,s]=t;return[XTe(e,s,r,n,o,i,a),Vl.utcInstance]}var THr=wB(lHr,ZTe),AHr=wB(cHr,ZTe),IHr=wB(dHr,ZTe),MHr=wB(vPt),SPt=SB(gHr,CB,QV,e8),RHr=SB(fHr,CB,QV,e8),jHr=SB(pHr,CB,QV,e8),DHr=SB(CB,QV,e8);function xPt(t){return xB(t,[THr,SPt],[AHr,RHr],[IHr,jHr],[MHr,DHr])}function CPt(t){return xB(xHr(t),[wHr,SHr])}function OPt(t){return xB(t,[CHr,gPt],[OHr,gPt],[PHr,EHr])}function PPt(t){return xB(t,[bHr,_Hr])}var NHr=SB(CB);function EPt(t){return xB(t,[yHr,NHr])}var LHr=wB(mHr,hHr),FHr=wB(wPt),kHr=SB(CB,QV,e8);function TPt(t){return xB(t,[LHr,SPt],[FHr,kHr])}var APt="Invalid Duration",MPt={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}},$Hr={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},...MPt},Bh=146097/400,OB=146097/4800,BHr={years:{quarters:4,months:12,weeks:Bh/7,days:Bh,hours:Bh*24,minutes:Bh*24*60,seconds:Bh*24*60*60,milliseconds:Bh*24*60*60*1e3},quarters:{months:3,weeks:Bh/28,days:Bh/4,hours:Bh*24/4,minutes:Bh*24*60/4,seconds:Bh*24*60*60/4,milliseconds:Bh*24*60*60*1e3/4},months:{weeks:OB/7,days:OB,hours:OB*24,minutes:OB*24*60,seconds:OB*24*60*60,milliseconds:OB*24*60*60*1e3},...MPt},bj=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],qHr=bj.slice(0).reverse();function xA(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 Ua(n)}function RPt(t,e){let r=e.milliseconds??0;for(let n of qHr.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function IPt(t,e){let r=RPt(t,e)<0?-1:1;bj.reduceRight((n,o)=>{if(er(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),bj.reduce((n,o)=>{if(er(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function UHr(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var Ua=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?BHr:$Hr;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||_o.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,r){return t.fromObject({milliseconds:e},r)}static fromObject(e,r={}){if(e==null||typeof e!="object")throw new is(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:_B(e,t.normalizeUnit),loc:_o.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(wy(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new is(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=PPt(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,r){let[n]=EPt(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,r=null){if(!e)throw new is("need to specify a reason the Duration is invalid");let n=e instanceof Wl?e:new Wl(e,r);if(bo.throwOnInvalid)throw new Hre(n);return new t({invalid:n})}static normalizeUnit(e){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!r)throw new pB(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?Kl.create(this.loc,n).formatDurationFromString(this,e):APt}toHuman(e={}){if(!this.isValid)return APt;let r=bj.map(n=>{let o=this.values[n];return er(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+=hB(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},Wr.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?RPt(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e),n={};for(let o of bj)(wA(r.values,o)||wA(this.values,o))&&(n[o]=r.get(o)+this.get(o));return xA(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e);return this.plus(r.negate())}mapUnits(e){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=WTe(e(this.values[n],n));return xA(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,..._B(e,t.normalizeUnit)};return xA(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 xA(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return IPt(this.matrix,e),xA(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=UHr(this.normalize().shiftToAll().toObject());return xA(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(a=>t.normalizeUnit(a));let r={},n={},o=this.toObject(),i;for(let a of bj)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;wy(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else wy(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 IPt(this.matrix,r),xA(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 xA(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 bj)if(!r(this.values[n],e.values[n]))return!1;return!0}};var PB="Invalid Interval";function zHr(t,e){return!t||!t.isValid?fO.invalid("missing or invalid start"):!e||!e.isValid?fO.invalid("missing or invalid end"):e<t?fO.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 fO=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,r=null){if(!e)throw new is("need to specify a reason the Interval is invalid");let n=e instanceof Wl?e:new Wl(e,r);if(bo.throwOnInvalid)throw new zre(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=EB(e),o=EB(r),i=zHr(n,o);return i??new t({start:n,end:o})}static after(e,r){let n=Ua.fromDurationLike(r),o=EB(e);return t.fromDateTimes(o,o.plus(n))}static before(e,r){let n=Ua.fromDurationLike(r),o=EB(e);return t.fromDateTimes(o.minus(n),o)}static fromISO(e,r){let[n,o]=(e||"").split("/",2);if(n&&o){let i,a;try{i=Wr.fromISO(n,r),a=i.isValid}catch{a=!1}let s,u;try{s=Wr.fromISO(o,r),u=s.isValid}catch{u=!1}if(a&&u)return t.fromDateTimes(i,s);if(a){let l=Ua.fromISO(o,r);if(l.isValid)return t.after(i,l)}else if(u){let l=Ua.fromISO(n,r);if(l.isValid)return t.before(s,l)}}return t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",r){if(!this.isValid)return NaN;let n=this.start.startOf(e,r),o;return r?.useLocaleWeeks?o=this.end.reconfigure({locale:n.locale}):o=this.end,o=o.startOf(e,r),Math.floor(o.diff(n,e).get(e))+(o.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:r}={}){return this.isValid?t.fromDateTimes(e||this.s,r||this.e):this}splitAt(...e){if(!this.isValid)return[];let r=e.map(EB).filter(a=>this.contains(a)).sort((a,s)=>a.toMillis()-s.toMillis()),n=[],{s:o}=this,i=0;for(;o<this.e;){let a=r[i]||this.e,s=+a>+this.e?this.e:a;n.push(t.fromDateTimes(o,s)),o=s,i+=1}return n}splitBy(e){let r=Ua.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,o=1,i,a=[];for(;n<this.e;){let s=this.start.plus(r.mapUnits(u=>u*o));i=+s>+this.e?this.e:s,a.push(t.fromDateTimes(n,i)),n=i,o+=1}return a}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let r=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return r>=n?null:t.fromDateTimes(r,n)}union(e){if(!this.isValid)return this;let r=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return t.fromDateTimes(r,n)}static merge(e){let[r,n]=e.sort((o,i)=>o.s-i.s).reduce(([o,i],a)=>i?i.overlaps(a)||i.abutsStart(a)?[o,i.union(a)]:[o.concat([i]),a]:[o,a],[[],null]);return n&&r.push(n),r}static xor(e){let r=null,n=0,o=[],i=e.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),a=Array.prototype.concat(...i),s=a.sort((u,l)=>u.time-l.time);for(let u of s)n+=u.type==="s"?1:-1,n===1?r=u.time:(r&&+r!=+u.time&&o.push(t.fromDateTimes(r,u.time)),r=null);return t.merge(o)}difference(...e){return t.xor([this].concat(e)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:PB}[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=yA,r={}){return this.isValid?Kl.create(this.s.loc.clone(r),e).formatInterval(this):PB}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:PB}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:PB}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:PB}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:PB}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):Ua.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var pO=class{static hasDST(e=bo.defaultZone){let r=Wr.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return Nd.isValidZone(e)}static normalizeZone(e){return vy(e,bo.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||_o.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||_o.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||_o.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||_o.create(r,n,i)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||_o.create(r,n,i)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||_o.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||_o.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return _o.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return _o.create(r,null,"gregory").eras(e)}static features(){return{relative:Yre(),localeWeek:Zre()}}};function jPt(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(Ua.fromMillis(n).as("days"))}function HHr(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=jPt(u,l);return(c-c%7)/7}],["days",jPt]],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 DPt(t,e,r,n){let[o,i,a,s]=HHr(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=Ua.fromObject(i,n);return l.length>0?Ua.fromMillis(u,n).shiftTo(...l).plus(c):c}var VHr="missing Intl.DateTimeFormat.formatToParts support";function Jo(t,e=r=>r){return{regex:t,deser:([r])=>e(VOt(r))}}var WHr="\xA0",FPt=`[ ${WHr}]`,kPt=new RegExp(FPt,"g");function KHr(t){return t.replace(/\./g,"\\.?").replace(kPt,FPt)}function NPt(t){return t.replace(/\./g,"").replace(kPt," ").toLowerCase()}function Sy(t,e){return t===null?null:{regex:RegExp(t.map(KHr).join("|")),deser:([r])=>t.findIndex(n=>NPt(r)===NPt(n))+e}}function LPt(t,e){return{regex:t,deser:([,r,n])=>hj(r,n),groups:e}}function tne(t){return{regex:t,deser:([e])=>e}}function JHr(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function GHr(t,e){let r=kh(e),n=kh(e,"{2}"),o=kh(e,"{3}"),i=kh(e,"{4}"),a=kh(e,"{6}"),s=kh(e,"{1,2}"),u=kh(e,"{1,3}"),l=kh(e,"{1,6}"),c=kh(e,"{1,9}"),d=kh(e,"{2,4}"),f=kh(e,"{4,6}"),p=b=>({regex:RegExp(JHr(b.val)),deser:([g])=>g,literal:!0}),h=(b=>{if(t.literal)return p(b);switch(b.val){case"G":return Sy(e.eras("short"),0);case"GG":return Sy(e.eras("long"),0);case"y":return Jo(l);case"yy":return Jo(d,XV);case"yyyy":return Jo(i);case"yyyyy":return Jo(f);case"yyyyyy":return Jo(a);case"M":return Jo(s);case"MM":return Jo(n);case"MMM":return Sy(e.months("short",!0),1);case"MMMM":return Sy(e.months("long",!0),1);case"L":return Jo(s);case"LL":return Jo(n);case"LLL":return Sy(e.months("short",!1),1);case"LLLL":return Sy(e.months("long",!1),1);case"d":return Jo(s);case"dd":return Jo(n);case"o":return Jo(u);case"ooo":return Jo(o);case"HH":return Jo(n);case"H":return Jo(s);case"hh":return Jo(n);case"h":return Jo(s);case"mm":return Jo(n);case"m":return Jo(s);case"q":return Jo(s);case"qq":return Jo(n);case"s":return Jo(s);case"ss":return Jo(n);case"S":return Jo(u);case"SSS":return Jo(o);case"u":return tne(c);case"uu":return tne(s);case"uuu":return Jo(r);case"a":return Sy(e.meridiems(),0);case"kkkk":return Jo(i);case"kk":return Jo(d,XV);case"W":return Jo(s);case"WW":return Jo(n);case"E":case"c":return Jo(r);case"EEE":return Sy(e.weekdays("short",!1),1);case"EEEE":return Sy(e.weekdays("long",!1),1);case"ccc":return Sy(e.weekdays("short",!0),1);case"cccc":return Sy(e.weekdays("long",!0),1);case"Z":case"ZZ":return LPt(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return LPt(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return tne(/[a-z_+-/]{1,256}?/i);case" ":return tne(/[^\S\n\r]/);default:return p(b)}})(t)||{invalidReason:VHr};return h.token=t,h}var YHr={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 ZHr(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=YHr[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function XHr(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function QHr(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(wA(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 eVr(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 er(t.z)||(r=Nd.create(t.z)),er(t.Z)||(r||(r=new Vl(t.Z)),n=t.Z),er(t.q)||(t.M=(t.q-1)*3+1),er(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),er(t.u)||(t.S=ZV(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}var QTe=null;function tVr(){return QTe||(QTe=Wr.fromMillis(1555555555555)),QTe}function rVr(t,e){if(t.literal)return t;let r=Kl.macroTokenToFormatOpts(t.val),n=rAe(r,e);return n==null||n.includes(void 0)?t:n}function eAe(t,e){return Array.prototype.concat(...t.map(r=>rVr(r,e)))}var t8=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=eAe(Kl.parseFormat(r),e),this.units=this.tokens.map(n=>GHr(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=XHr(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=QHr(e,this.regex,this.handlers),[o,i,a]=n?eVr(n):[null,null,void 0];if(wA(n,"a")&&wA(n,"H"))throw new yy("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 tAe(t,e,r){return new t8(t,r).explainFromTokens(e)}function $Pt(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=tAe(t,e,r);return[n,o,i,a]}function rAe(t,e){if(!t)return null;let n=Kl.create(e,t).dtFormatter(tVr()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>ZHr(a,t,i))}var nAe="Invalid DateTime",BPt=864e13;function r8(t){return new Wl("unsupported zone",`the zone "${t.name}" is not supported`)}function oAe(t){return t.weekData===null&&(t.weekData=JV(t.c)),t.weekData}function iAe(t){return t.localWeekData===null&&(t.localWeekData=JV(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function _j(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Wr({...r,...e,old:r})}function KPt(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 rne(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 one(t,e,r){return KPt(mB(t),e,r)}function qPt(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,bB(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=Ua.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=mB(i),[u,l]=KPt(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function TB(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=Wr.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return Wr.invalid(new Wl("unparsable",`the input "${o}" can't be parsed as ${n}`))}function nne(t,e,r=!0){return t.isValid?Kl.create(_o.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function aAe(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=qa(t.c.year,r?6:4),e?(n+="-",n+=qa(t.c.month),n+="-",n+=qa(t.c.day)):(n+=qa(t.c.month),n+=qa(t.c.day)),n}function UPt(t,e,r,n,o,i){let a=qa(t.c.hour);return e?(a+=":",a+=qa(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=qa(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=qa(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=qa(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=qa(Math.trunc(-t.o/60)),a+=":",a+=qa(Math.trunc(-t.o%60))):(a+="+",a+=qa(Math.trunc(t.o/60)),a+=":",a+=qa(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}var JPt={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},nVr={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},oVr={ordinal:1,hour:0,minute:0,second:0,millisecond:0},GPt=["year","month","day","hour","minute","second","millisecond"],iVr=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],aVr=["year","ordinal","hour","minute","second","millisecond"];function sVr(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 pB(t);return e}function zPt(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return sVr(t)}}function uVr(t){return ane[t]||(ine===void 0&&(ine=bo.now()),ane[t]=t.offset(ine)),ane[t]}function HPt(t,e){let r=vy(e.zone,bo.defaultZone);if(!r.isValid)return Wr.invalid(r8(r));let n=_o.fromObject(e),o,i;if(er(t.year))o=bo.now();else{for(let u of GPt)er(t[u])&&(t[u]=JPt[u]);let a=zTe(t)||HTe(t);if(a)return Wr.invalid(a);let s=uVr(r);[o,i]=one(t,s,r)}return new Wr({ts:o,zone:r,loc:n,o:i})}function VPt(t,e,r){let n=er(r.round)?!0:r.round,o=(a,s)=>(a=hB(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 WPt(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 ine,ane={},Wr=class t{constructor(e){let r=e.zone||bo.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new Wl("invalid input"):null)||(r.isValid?null:r8(r));this.ts=er(e.ts)?bo.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=wy(e.o)&&!e.old?e.o:r.offset(this.ts);o=rne(this.ts,s),n=Number.isNaN(o.year)?new Wl("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=e.loc||_o.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=o,this.o=i,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,r]=WPt(arguments),[n,o,i,a,s,u,l]=r;return HPt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=WPt(arguments),[n,o,i,a,s,u,l]=r;return e.zone=Vl.utcInstance,HPt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=uPt(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let o=vy(r.zone,bo.defaultZone);return o.isValid?new t({ts:n,zone:o,loc:_o.fromObject(r)}):t.invalid(r8(o))}static fromMillis(e,r={}){if(wy(e))return e<-BPt||e>BPt?t.invalid("Timestamp out of range"):new t({ts:e,zone:vy(r.zone,bo.defaultZone),loc:_o.fromObject(r)});throw new is(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(wy(e))return new t({ts:e*1e3,zone:vy(r.zone,bo.defaultZone),loc:_o.fromObject(r)});throw new is("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=vy(r.zone,bo.defaultZone);if(!n.isValid)return t.invalid(r8(n));let o=_o.fromObject(r),i=_B(e,zPt),{minDaysInFirstWeek:a,startOfWeek:s}=UTe(i,o),u=bo.now(),l=er(r.specificOffset)?n.offset(u):r.specificOffset,c=!er(i.ordinal),d=!er(i.year),f=!er(i.month)||!er(i.day),p=d||f,m=i.weekYear||i.weekNumber;if((p||c)&&m)throw new yy("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new yy("Can't mix ordinal dates with month/day");let h=m||i.weekday&&!p,b,g,_=rne(u,l);h?(b=iVr,g=nVr,_=JV(_,a,s)):c?(b=aVr,g=oVr,_=ene(_)):(b=GPt,g=JPt);let w=!1;for(let R of b){let j=i[R];er(j)?w?i[R]=g[R]:i[R]=_[R]:w=!0}let x=h?iPt(i,a,s):c?aPt(i):zTe(i),C=x||HTe(i);if(C)return t.invalid(C);let E=h?BTe(i,a,s):c?qTe(i):i,[P,A]=one(E,l,n),I=new t({ts:P,zone:n,o:A,loc:o});return i.weekday&&p&&e.weekday!==I.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${I.toISO()}`):I.isValid?I:t.invalid(I.invalid)}static fromISO(e,r={}){let[n,o]=xPt(e);return TB(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=CPt(e);return TB(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=OPt(e);return TB(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(er(e)||er(r))throw new is("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=_o.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=$Pt(a,e,r);return c?t.invalid(c):TB(s,u,n,`format ${r}`,e,l)}static fromString(e,r,n={}){return t.fromFormat(e,r,n)}static fromSQL(e,r={}){let[n,o]=TPt(e);return TB(n,o,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new is("need to specify a reason the DateTime is invalid");let n=e instanceof Wl?e:new Wl(e,r);if(bo.throwOnInvalid)throw new Ure(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=rAe(e,_o.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(e,r={}){return eAe(Kl.parseFormat(e),_o.fromObject(r)).map(o=>o.val).join("")}static resetCache(){ine=void 0,ane={}}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?oAe(this).weekYear:NaN}get weekNumber(){return this.isValid?oAe(this).weekNumber:NaN}get weekday(){return this.isValid?oAe(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?iAe(this).weekday:NaN}get localWeekNumber(){return this.isValid?iAe(this).weekNumber:NaN}get localWeekYear(){return this.isValid?iAe(this).weekYear:NaN}get ordinal(){return this.isValid?ene(this.c).ordinal:NaN}get monthShort(){return this.isValid?pO.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?pO.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?pO.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?pO.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=mB(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=rne(u,a),d=rne(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[_j(this,{ts:u}),_j(this,{ts:l})]:[this]}get isInLeapYear(){return yj(this.year)}get daysInMonth(){return bB(this.year,this.month)}get daysInYear(){return this.isValid?vA(this.year):NaN}get weeksInWeekYear(){return this.isValid?gj(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?gj(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:o}=Kl.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(e=0,r={}){return this.setZone(Vl.instance(e),r)}toLocal(){return this.setZone(bo.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=vy(e,bo.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]=one(a,i,e)}return _j(this,{ts:o,zone:e})}else return t.invalid(r8(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return _j(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=_B(e,zPt),{minDaysInFirstWeek:n,startOfWeek:o}=UTe(r,this.loc),i=!er(r.weekYear)||!er(r.weekNumber)||!er(r.weekday),a=!er(r.ordinal),s=!er(r.year),u=!er(r.month)||!er(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new yy("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new yy("Can't mix ordinal dates with month/day");let d;i?d=BTe({...JV(this.c,n,o),...r},n,o):er(r.ordinal)?(d={...this.toObject(),...r},er(r.day)&&(d.day=Math.min(bB(d.year,d.month),d.day))):d=qTe({...ene(this.c),...r});let[f,p]=one(d,this.o,this.zone);return _j(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=Ua.fromDurationLike(e);return _j(this,qPt(this,r))}minus(e){if(!this.isValid)return this;let r=Ua.fromDurationLike(e).negate();return _j(this,qPt(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=Ua.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?Kl.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):nAe}toLocaleString(e=yA,r={}){return this.isValid?Kl.create(this.loc.clone(r),e).formatDateTime(this):nAe}toLocaleParts(e={}){return this.isValid?Kl.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=aAe(this,a);return s+="T",s+=UPt(this,a,r,n,o,i),s}toISODate({format:e="extended"}={}){return this.isValid?aAe(this,e==="extended"):null}toISOWeekDate(){return nne(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":"")+UPt(this,a==="extended",r,e,n,i):null}toRFC2822(){return nne(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return nne(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?aAe(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")),nne(this,o,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():nAe}[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 Ua.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=lPt(r).map(Ua.normalizeUnit),a=e.valueOf()>this.valueOf(),s=a?this:e,u=a?e:this,l=DPt(s,u,i,o);return a?l.negate():l}diffNow(e="milliseconds",r={}){return this.diff(t.now(),e,r)}until(e){return this.isValid?fO.fromDateTimes(this,e):this}hasSame(e,r,n){if(!this.isValid)return!1;let o=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(r,n)<=o&&o<=i.endOf(r,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let r=e.base||t.fromObject({},{zone:this.zone}),n=e.padding?this<r?-e.padding:e.padding:0,o=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(o=e.unit,i=void 0),VPt(r,this.plus(n),{...e,numeric:"always",units:o,unit:i})}toRelativeCalendar(e={}){return this.isValid?VPt(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new is("min requires all arguments be DateTimes");return VTe(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new is("max requires all arguments be DateTimes");return VTe(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=_o.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return tAe(a,e,r)}static fromStringExplain(e,r,n={}){return t.fromFormatExplain(e,r,n)}static buildFormatParser(e,r={}){let{locale:n=null,numberingSystem:o=null}=r,i=_o.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new t8(i,e)}static fromFormatParser(e,r,n={}){if(er(e)||er(r))throw new is("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=_o.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!a.equals(r.locale))throw new is(`fromFormatParser called with a locale of ${a}, but the format parser was created for ${r.locale}`);let{result:s,zone:u,specificOffset:l,invalidReason:c}=r.explainFromTokens(e);return c?t.invalid(c):TB(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return yA}static get DATE_MED(){return EV}static get DATE_MED_WITH_WEEKDAY(){return xTe}static get DATE_FULL(){return TV}static get DATE_HUGE(){return AV}static get TIME_SIMPLE(){return IV}static get TIME_WITH_SECONDS(){return MV}static get TIME_WITH_SHORT_OFFSET(){return RV}static get TIME_WITH_LONG_OFFSET(){return jV}static get TIME_24_SIMPLE(){return DV}static get TIME_24_WITH_SECONDS(){return NV}static get TIME_24_WITH_SHORT_OFFSET(){return LV}static get TIME_24_WITH_LONG_OFFSET(){return FV}static get DATETIME_SHORT(){return kV}static get DATETIME_SHORT_WITH_SECONDS(){return $V}static get DATETIME_MED(){return BV}static get DATETIME_MED_WITH_SECONDS(){return qV}static get DATETIME_MED_WITH_WEEKDAY(){return CTe}static get DATETIME_FULL(){return UV}static get DATETIME_FULL_WITH_SECONDS(){return zV}static get DATETIME_HUGE(){return HV}static get DATETIME_HUGE_WITH_SECONDS(){return VV}};function EB(t){if(Wr.isDateTime(t))return t;if(t&&t.valueOf&&wy(t.valueOf()))return Wr.fromJSDate(t);if(t&&typeof t=="object")return Wr.fromObject(t);throw new is(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var YPt=require("obsidian");ud();async function lVr(){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 ZPt=xm(async()=>lVr(),{name:"getCurrentTime",description:"Get the current time in various formats, including timezone information",schema:Ur.object({})}),XPt={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 cVr(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 dVr(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 fVr(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=STe(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=Wr.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 pVr(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=XPt[r[1]],o=e.year;n>e.month&&o--;let i=Wr.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 mVr(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=Wr.fromObject({year:n,month:1,day:1}),i=Wr.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 hVr(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=Wr.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 gVr(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=XPt[r[1].toLowerCase()],o=parseInt(r[2]),i=Wr.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 yVr(t){let e=Wr.now(),r=t.toLowerCase().replace("@vault","").trim(),n=cVr(r,e)||dVr(r,e)||fVr(r,e)||pVr(r,e)||gVr(r,e)||hVr(r,e)||mVr(r,e);if(n)return{startTime:n8(n.start),endTime:n8(n.end)};let o=STe(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=Wr.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?Wr.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:n8(i),endTime:n8(a)}}console.warn(`Unable to parse time expression: ${t}`)}function n8(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 QPt=xm(async({timeExpression:t})=>yVr(t),{name:"getTimeRangeMs",description:"Get a time range in milliseconds based on a natural language time expression",schema:Ur.object({timeExpression:Ur.string().describe("A natural language time expression (e.g., 'last week', 'from July 1 to July 15')")})});function bVr(t){let e=t.toString().length===10?t*1e3:t,r=Wr.fromMillis(e);return n8(r)}var eEt=xm(async({epoch:t})=>bVr(t),{name:"getTimeInfoByEpoch",description:"Convert a Unix timestamp (in seconds or milliseconds) to detailed time information",schema:Ur.object({epoch:Ur.number().describe("Unix timestamp in seconds or milliseconds")})});function _Vr(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 vVr(t="25min"){let e=_Vr(t);return new Promise(r=>{setTimeout(()=>{new YPt.Notice(`Pomodoro timer (${t}) completed! Take a break!`),r()},e)})}var sAe=xm(async({interval:t="25min"})=>(vVr(t),`Pomodoro timer started. It will end in ${t}.`),{name:"startPomodoro",description:"Start a Pomodoro timer with a customizable interval",schema:Ur.object({interval:Ur.string().optional().describe("Time interval (e.g., '25min', '5s', '1h'). Default is 25min.")})});ud();function wVr(t){return"children"in t&&"path"in t}function SVr(t){return"path"in t&&!("children"in t)}function xVr(t){let e=t.split(".");return e.length>1&&e.pop()?.toLowerCase()||""}function uAe(t,e=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=Om();for(let u of t.children)if(SVr(u)){if(Cp(u,i,a)){e&&r.push(u.name);let l=xVr(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(wVr(u)){let l=uAe(u,e);if(Object.keys(l).length>0&&(o[u.name]=l[u.name],l[u.name].extensionCounts))for(let[c,d]of Object.entries(l[u.name].extensionCounts))n[c]=(n[c]||0)+d}let s={};return Object.keys(n).length>0&&(s.extensionCounts=n),e&&r.length>0&&(s.files=r),Object.keys(o).length>0&&(s.subFolders=o),Object.keys(s).length===0?{}:t.name?{[t.name]:s}:{vault:s}}var tEt=t=>xm(async()=>{let e=uAe(t,!0),r=`A JSON represents the file tree as a nested structure:
* The root object has a key "vault" which contains a FileTreeNode object.
* Each FileTreeNode has these properties:
* files: An array of filenames in the current directory (if any files exist)
* subFolders: An object mapping folder names to their FileTreeNode objects (if any subfolders exist)
* extensionCounts: An object with counts of file extensions in this folder and all subfolders
`,n=JSON.stringify(e);if(n.length>5e5){let o=uAe(t,!1);return r+JSON.stringify(o)}return r+n},{name:"getFileTree",description:"Get the file tree as a nested structure of folders and files",schema:Ur.void()});ud();var lAe=xm(async({url:t})=>{try{let e=await Ei.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:Ur.object({url:Ur.string().describe("The YouTube video URL"),brevilabsClient:Ur.any().describe("The BrevilabsClient instance")})});yn();var o8=["@vault","@composer","@web","@youtube","@pomodoro"],vj=class{static initTools(e){this.tools.length===0&&(this.tools=[ZPt,eEt,QPt,oTe,WCt,sAe,iTe,lAe,tEt(e.getRoot())])}static async analyzeIntent(e){try{let r=await Ei.getInstance().broca(e,$M());if(!r?.response)throw new Error(r?.detail||"Broca API call failed");let n=r.response.tool_calls,o=r.response.salience_terms,i=[],a;for(let s of n){let u=this.tools.find(l=>l.name===s.tool);if(u){let l=s.args||{};if(u.name==="getTimeRangeMs"&&(a=await iB.callTool(u,l)),u.name=="getFileTree"&&$M())continue;i.push({tool:u,args:l})}}return await this.processAtCommands(e,i,{timeRange:a,salientTerms:o}),i}catch(r){throw console.error("Error in intent analysis:",r),r}}static async processAtCommands(e,r,n){let o=e.toLowerCase(),{timeRange:i,salientTerms:a}=n;if(o.includes("@vault")&&(a.length>0||i)){let s=this.removeAtCommands(e);r.push({tool:oTe,args:{timeRange:i||void 0,query:s,salientTerms:a}})}if(o.includes("@web")){let s=this.removeAtCommands(e),l=await Hl.instance.getCurrentChainManager().memoryManager.getMemory().loadMemoryVariables({}),c=YN(l);r.push({tool:iTe,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:sAe,args:{interval:u}})}if(o.includes("@youtube")){let s=Az(e);s&&r.push({tool:lAe,args:{url:s}})}}static removeAtCommands(e){return e.split(" ").filter(r=>!o8.includes(r.toLowerCase())).join(" ").trim()}};vj.tools=[];var sne=class{constructor(e){this.updateCurrentAiMessage=e;this.hasOpenThinkBlock=!1;this.fullResponse=""}handleClaude37Chunk(e){let r="";for(let n of e)switch(n.type){case"text":r+=n.text;break;case"thinking":return this.hasOpenThinkBlock||(this.fullResponse+=`
<think>`,this.hasOpenThinkBlock=!0),this.fullResponse+=n.thinking,this.updateCurrentAiMessage(this.fullResponse),!0}return r&&(this.fullResponse+=r),!1}handleDeepseekChunk(e){return typeof e.content=="string"&&(this.fullResponse+=e.content),e.additional_kwargs?.reasoning_content?(this.hasOpenThinkBlock||(this.fullResponse+=`
<think>`,this.hasOpenThinkBlock=!0),this.fullResponse+=e.additional_kwargs.reasoning_content,!0):!1}processChunk(e){let r=!1;Array.isArray(e.content)?r=this.handleClaude37Chunk(e.content):r=this.handleDeepseekChunk(e),this.hasOpenThinkBlock&&!r&&(this.fullResponse+="</think>",this.hasOpenThinkBlock=!1),this.updateCurrentAiMessage(this.fullResponse)}close(){return this.hasOpenThinkBlock&&(this.fullResponse+="</think>",this.updateCurrentAiMessage(this.fullResponse)),this.fullResponse}},i8=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:fb,isVisible:!0,timestamp:Ml(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=En(e);r&&console.error("Error during LLM invocation:",i);let a=e?.response?.data?.error||i,s=a?.code||i,u="";if(e?.message?.includes("Invalid license key")?u="Invalid Copilot Plus license key. Please check your license key in settings.":s==="model_not_found"?u="You do not have access to this model or the model does not exist, please check with your API provider.":u=`${s}`,console.error(a),n&&o){o("");let l=u.search("Troubleshooting URL");u=l!==-1?u.slice(0,l):u,i.search(/401|invalid|not valid/gi)!==-1&&(u=`Something went wrong. Please check if you have set your API key.
Path: Settings > copilot plugin > Basic Tab > Set Keys.
Or check model config
Error Details: `+u),n({message:u,isErrorMessage:!0,sender:fb,isVisible:!0,timestamp:Ml(new Date)})}else new nEt.Notice(u),console.error(a)}},une=class extends i8{async run(e,r,n,o,i){let{debug:a=!1}=i,s=new sne(n);try{let l=await this.chainManager.getChain().stream({input:e.message});for await(let c of l){if(r.signal.aborted)break;s.processChunk(c)}}catch(u){await this.handleError(u,a,o,n)}return this.handleResponse(s.close(),e,r,o,n,a)}},lne=class extends i8{async run(e,r,n,o,i){let{debug:a=!1}=i,s="";try{if(await this.chainManager.vectorStoreManager.isIndexEmpty())return this.handleResponse(K9,e,r,o,n,a);let c=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),d=YN(c),f=await this.chainManager.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=tze(this.chainManager.getRetrievedDocuments());if(r.length>0){let n=r.map(o=>`- [[${o}]]`).join(`
`);e+=`
#### Sources:
`+n}return e}},a8=class extends i8{isYoutubeOnlyMessage(e){let r=e.trim(),n=r.includes("@youtube"),o=Az(r),i=r.split(/\s+/).filter(a=>a!=="@youtube"&&a.length>0);return n&&o!==null&&i.length===1}async processImageUrls(e){let r=[],n=await fj.processUrlBatch(e,r,this.chainManager.app.vault);return fj.showFailedImagesNotice(r),n}async processChatInputImages(e){let r=[],n=await fj.processChatImageBatch(e,r,this.chainManager.app.vault);return fj.showFailedImagesNotice(r),n}async extractEmbeddedImages(e){let r=/!\[\[(.*?\.(png|jpg|jpeg|gif|webp|bmp|svg))\]\]/g;return[...e.matchAll(r)].map(i=>i[1])}async buildMessageContent(e,r){let n=[],o=[],i=ne(),a=[],s=r.context?.urls;if(s&&s.length>0&&a.push({urls:s,type:"context"}),i.passMarkdownImages){let d=await this.extractEmbeddedImages(e);d.length>0&&a.push({urls:d,type:"embedded"})}for(let d of a){let f=await this.processImageUrls(d.urls);o.push(...f.successfulImages),n.push(...f.failureDescriptions)}let u=r.content;if(u&&u.length>0){let d=await this.processChatInputImages(u);o.push(...d.successfulImages),n.push(...d.failureDescriptions)}let l=e;n.length>0&&(l=`${e}
Note:
${n.join(`
`)}
`);let c=[{type:"text",text:l}];return o.length>0&&c.push(...o),c}hasCapability(e,r){let n=e.modelName||e.model||"";return this.chainManager.chatModelManager.findModelByName(n)?.capabilities?.includes(r)??!1}isMultimodalModel(e){return this.hasCapability(e,"vision")}async streamMultimodalResponse(e,r,n,o,i){let s=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),u=YN(s),l=[],c=await this.getSystemPrompt();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:ize(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 _ of u)l.push({role:_.role,content:_.content});let f=this.chainManager.chatModelManager.getChatModel(),m=this.isMultimodalModel(f)?await this.buildMessageContent(e,r):e;l.push({role:"user",content:m});let h=m instanceof Array?m[0].text:m;ae("Enhanced user message: ",h),ae(`==== Final Request to AI ====
`,l);let b=new sne(o),g=await Bx(()=>this.chainManager.chatModelManager.getChatModel().stream(l));for await(let _ of g){if(n.signal.aborted)break;b.processChunk(_)}return b.close()}async run(e,r,n,o,i){let{debug:a=!1,updateLoadingMessage:s}=i,u="",l=[];try{if(this.isYoutubeOnlyMessage(e.message)){let _=Az(e.message),w="Transcript not available. Only videos with the auto transcript option turned on are supported at the moment.";if(_)try{let x=await Ei.getInstance().youtube4llm(_);return x.response.transcript?this.handleResponse(x.response.transcript,e,r,o,n,a):this.handleResponse(w,e,r,o,n,a)}catch(x){return console.error("Error processing YouTube video:",x),this.handleResponse(w,e,r,o,n,a)}}a&&console.log("==== Step 1: Analyzing intent ====");let c,d=e.originalMessage||e.message;try{c=await vj.analyzeIntent(d)}catch(_){return this.handleResponse(YUe(_),e,r,o,n,a)}let f=e.message.split(" ").filter(_=>!o8.includes(_.toLowerCase())).join(" ").trim(),p=await this.executeToolCalls(c,a,s),m=p.find(_=>_.tool==="localSearch"&&_.output&&_.output.length>0),b=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),g=YN(b);if(m){a&&console.log("==== Step 2: Processing local search results ====");let _=JSON.parse(m.output);a&&console.log("==== Step 3: Condensing Question ====");let w=await Rre(f,g);a&&console.log("Condensed standalone question: ",w),a&&console.log("==== Step 4: Preparing context ====");let x=this.getTimeExpression(c),C=this.prepareLocalSearchResult(_,x),E=p.filter(I=>I.tool==="getCurrentTime"),P=this.prepareEnhancedUserMessage(w,E);a&&console.log(C),a&&console.log("==== Step 5: Invoking QA Chain ====");let A=await this.chainManager.promptManager.getQAPrompt({question:P,context:C,systemMessage:""});u=await this.streamMultimodalResponse(A,e,r,n,a),l=this.getSources(_)}else{let _=this.prepareEnhancedUserMessage(f,p);ae("No local search results. Using standard LLM Chain."),u=await this.streamMultimodalResponse(_,e,r,n,a)}}catch(c){s?.(Ux.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?.(Ux.READING_FILES):i.tool.name==="webSearch"?n?.(Ux.SEARCHING_WEB):i.tool.name==="getFileTree"&&n?.(Ux.READING_FILE_TREE);let a=await iB.callTool(i.tool,i.args);o.push({tool:i.tool.name,output:a})}return o}prepareEnhancedUserMessage(e,r){let n="";if(r.length>0){let o=r.filter(i=>i.output!=null);o.length>0&&(n=`
# Additional context:
`+o.map(i=>`<${i.tool}>
${typeof i.output!="string"?JSON.stringify(i.output):i.output}
</${i.tool}>`).join(`
`))}return`${e}${n}`}getTimeExpression(e){let r=e.find(n=>n.tool.name==="getTimeRangeMs");return r?r.args.timeExpression:""}prepareLocalSearchResult(e,r){let n=e.filter(s=>s.includeInContext),o=n.reduce((s,u)=>s+u.content.length,0),i=n;if(o>Yfe){let s=Yfe/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}`}async getSystemPrompt(){return KP()}},cne=class extends a8{async getSystemPrompt(){let e=KP(),r=hc();if(!r)return e;let n=await Hl.instance.getProjectContext(r.id);return e=`${e}
<project_system_prompt>
${r.systemPrompt}
</project_system_prompt>`,n&&(e=`${e}
<project_context>
${n}
</project_context>`),e}};mo();Jt();yn();HP();var pse=require("obsidian");Zr();mo();Jt();yn();var wj="0.39.0";var oEt=!1,Sj,cAe,OVr,PVr,EVr,iEt,TVr,dne,dAe,aEt,fAe,fne,sEt;function uEt(t,e={auto:!1}){if(oEt)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${t.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(Sj)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${t.kind}'\` after \`import '@anthropic-ai/sdk/shims/${Sj}'\``);oEt=e.auto,Sj=t.kind,cAe=t.fetch,OVr=t.Request,PVr=t.Response,EVr=t.Headers,iEt=t.FormData,TVr=t.Blob,dne=t.File,dAe=t.ReadableStream,aEt=t.getMultipartRequestOptions,fAe=t.getDefaultAgent,fne=t.fileFromPath,sEt=t.isFsReadStream}var pne=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function lEt({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 pne(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}}Sj||uEt(lEt(),{auto:!0});var _r=class extends Error{},Jl=class t extends _r{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.request_id=o?.["request-id"],this.error=r}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new CA({message:n,cause:mne(r)});let i=r;return e===400?new s8(e,i,n,o):e===401?new u8(e,i,n,o):e===403?new l8(e,i,n,o):e===404?new c8(e,i,n,o):e===409?new d8(e,i,n,o):e===422?new f8(e,i,n,o):e===429?new p8(e,i,n,o):e>=500?new m8(e,i,n,o):new t(e,i,n,o)}},$c=class extends Jl{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},CA=class extends Jl{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},AB=class extends CA{constructor({message:e}={}){super({message:e??"Request timed out."})}},s8=class extends Jl{},u8=class extends Jl{},l8=class extends Jl{},c8=class extends Jl{},d8=class extends Jl{},f8=class extends Jl{},p8=class extends Jl{},m8=class extends Jl{};var hne=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},xj=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)},Am,mO=class{constructor(){Am.set(this,void 0),this.buffer=new Uint8Array,hne(this,Am,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?new TextEncoder().encode(e):e,n=new Uint8Array(this.buffer.length+r.length);n.set(this.buffer),n.set(r,this.buffer.length),this.buffer=n;let o=[],i;for(;(i=MVr(this.buffer,xj(this,Am,"f")))!=null;){if(i.carriage&&xj(this,Am,"f")==null){hne(this,Am,i.index,"f");continue}if(xj(this,Am,"f")!=null&&(i.index!==xj(this,Am,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,xj(this,Am,"f")-1))),this.buffer=this.buffer.slice(xj(this,Am,"f")),hne(this,Am,null,"f");continue}let a=xj(this,Am,"f")!==null?i.preceding-1:i.preceding,s=this.decodeText(this.buffer.slice(0,a));o.push(s),this.buffer=this.buffer.slice(i.index),hne(this,Am,null,"f")}return o}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new _r(`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 _r(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new _r("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
`):[]}};Am=new WeakMap;mO.NEWLINE_CHARS=new Set([`
`,"\r"]);mO.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function MVr(t,e){for(let o=e??0;o<t.length;o++){if(t[o]===10)return{preceding:o,index:o+1,carriage:!1};if(t[o]===13)return{preceding:o,index:o+1,carriage:!0}}return null}function cEt(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}function h8(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 qS=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;async function*o(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let i=!1;try{for await(let a of RVr(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 Jl.generate(void 0,`SSE Error: ${a.data}`,a.data,mAe(e.headers))}i=!0}catch(a){if(a instanceof Error&&a.name==="AbortError")return;throw a}finally{i||r.abort()}}return new t(o,r)}static fromReadableStream(e,r){let n=!1;async function*o(){let a=new mO,s=h8(e);for await(let u of s)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let s of o())a||s&&(yield JSON.parse(s));a=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{a||r.abort()}}return new t(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller),new t(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new dAe({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*RVr(t,e){if(!t.body)throw e.abort(),new _r("Attempted to iterate over a response with no body");let r=new pAe,n=new mO,o=h8(t.body);for await(let i of jVr(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*jVr(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=cEt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var pAe=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]=DVr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function DVr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var NVr=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",LVr=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&g8(t),g8=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 dEt(t,e,r){if(t=await t,LVr(t))return t;if(NVr(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=g8(o)?[await o.arrayBuffer()]:[o];return new dne(i,e,r)}let n=await FVr(t);if(e||(e=$Vr(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new dne(n,e,r)}async function FVr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(g8(t))e.push(await t.arrayBuffer());else if(BVr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${kVr(t)}`);return e}function kVr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function $Vr(t){return hAe(t.name)||hAe(t.filename)||hAe(t.path)?.split(/[\\/]/).pop()}var hAe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},BVr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",gAe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var UVr=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},zVr=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)},gne;async function gEt(t){let{response:e}=t;if(t.options.stream)return IB("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):qS.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 IB("response",e.status,e.url,e.headers,i),yEt(i,e)}let o=await e.text();return IB("response",e.status,e.url,e.headers,o),o}function yEt(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}var bne=class t extends Promise{constructor(e,r=gEt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>yEt(e(await this.parseResponse(r),r),r.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},_ne=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=yAe("maxRetries",r),this.timeout=yAe("timeout",n),this.httpAgent=o,this.fetch=i??cAe}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...KVr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${XVr()}`}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&&g8(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:gAe(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&&yAe("timeout",e.timeout),e.timeout=e.timeout??this.timeout;let c=e.httpAgent??this.httpAgent??fAe(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 hEt(i,a),hEt(i,r),gAe(e.body)&&Sj!=="node"&&delete i["content-type"],yne(a,"x-stainless-retry-count")===void 0&&yne(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),yne(a,"x-stainless-timeout")===void 0&&yne(r,"x-stainless-timeout")===void 0&&e.timeout&&(i["x-stainless-timeout"]=String(e.timeout)),this.validateHeaders(i,r),i}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new _r("Streaming is strongly recommended for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-python#streaming-responses for more details");return 600*1e3}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(r=>[...r])):{...e}:{}}makeStatusError(e,r,n,o){return Jl.generate(e,r,n,o)}request(e,r=null){return new bne(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}),IB("request",a,n,i.headers),n.signal?.aborted)throw new $c;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(mne);if(l instanceof Error){if(n.signal?.aborted)throw new $c;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new AB:new CA({cause:l})}let c=mAe(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let b=`retrying, ${r} attempts remaining`;return IB(`response (error; ${b})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(b=>mne(b).message),f=JVr(d),p=f?void 0:d;throw IB(`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 bAe(this,n,e)}buildURL(e,r){let n=YVr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return y8(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 _r(`Cannot stringify type ${typeof n}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout(e,r,n,o){let{signal:i,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let s=setTimeout(()=>o.abort(),n),u={signal:o.signal,...a};u.method&&(u.method=u.method.toUpperCase());let l=60*1e3,c=setTimeout(()=>{if(u&&u?.agent?.sockets)for(let d of Object.values(u?.agent?.sockets).flat())d?.setKeepAlive&&d.setKeepAlive(!0,l)},l);return this.fetch.call(void 0,e,u).finally(()=>{clearTimeout(s),clearTimeout(c)})}shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n){let o,i=n?.["retry-after-ms"];if(i){let s=parseFloat(i);Number.isNaN(s)||(o=s)}let a=n?.["retry-after"];if(a&&!o){let s=parseFloat(a);Number.isNaN(s)?o=Date.parse(a)-Date.now():o=s*1e3}if(!(o&&0<=o&&o<60*1e3)){let s=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,s)}return await ZVr(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 ${wj}`}},vne=class{constructor(e,r,n,o){gne.set(this,void 0),UVr(this,gne,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 _r("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 zVr(this,gne,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(gne=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},bAe=class extends bne{constructor(e,r,n){super(r,async o=>new n(e,o.response,await gEt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},mAe=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),HVr={method:!0,path:!0,query:!0,body:!0,headers:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__binaryRequest:!0,__binaryResponse:!0,__streamClass:!0},qh=t=>typeof t=="object"&&t!==null&&!y8(t)&&Object.keys(t).every(e=>bEt(HVr,e)),VVr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":wj,"X-Stainless-OS":pEt(Deno.build.os),"X-Stainless-Arch":fEt(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":wj,"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":wj,"X-Stainless-OS":pEt(process.platform),"X-Stainless-Arch":fEt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=WVr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":wj,"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":wj,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function WVr(){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 fEt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",pEt=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"),mEt,KVr=()=>mEt??(mEt=VVr()),JVr=t=>{try{return JSON.parse(t)}catch{return}},GVr=/^[a-z][a-z0-9+.-]*:/i,YVr=t=>GVr.test(t),ZVr=t=>new Promise(e=>setTimeout(e,t)),yAe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new _r(`${t} must be an integer`);if(e<0)throw new _r(`${t} must be a positive integer`);return e},mne=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null)try{return new Error(JSON.stringify(t))}catch{}return new Error(String(t))};var wne=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function y8(t){if(!t)return!0;for(let e in t)return!1;return!0}function bEt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function hEt(t,e){for(let r in e){if(!bEt(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 IB(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Anthropic:DEBUG:${t}`,...e)}var XVr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),_Et=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",QVr=t=>typeof t?.get=="function";var yne=(t,e)=>{let r=e.toLowerCase();if(QVr(t)){let n=e[0]?.toUpperCase()+e.substring(1).replace(/([^\w])(\w)/g,(o,i,a)=>i+a.toUpperCase());for(let o of[e,r,e.toUpperCase(),n]){let i=t.get(o);if(i)return i}}for(let[n,o]of Object.entries(t))if(n.toLowerCase()===r)return Array.isArray(o)?(o.length<=1||console.warn(`Received ${o.length} entries for the ${e} header, using the first entry.`),o[0]):o};var US=class extends vne{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1,this.first_id=n.first_id||null,this.last_id=n.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageParams(){let e=this.nextPageInfo();if(!e)return null;if("params"in e)return e.params;let r=Object.fromEntries(e.url.searchParams);return Object.keys(r).length?r:null}nextPageInfo(){if(this.options.query?.before_id){let r=this.first_id;return r?{params:{before_id:r}}:null}let e=this.last_id;return e?{params:{after_id:e}}:null}};var Gl=class{constructor(e){this._client=e}};var Cj=class extends Gl{retrieve(e,r){return this._client.get(`/v1/models/${e}?beta=true`,r)}list(e={},r){return qh(e)?this.list({},e):this._client.getAPIList("/v1/models?beta=true",MB,{query:e,...r})}},MB=class extends US{};Cj.BetaModelInfosPage=MB;var RB=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new mO;for await(let r of this.iterator)for(let n of e.decode(r))yield JSON.parse(n);for(let r of e.flush())yield JSON.parse(r)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,r){if(!e.body)throw r.abort(),new _r("Attempted to iterate over a response with no body");return new t(h8(e.body),r)}};var Oj=class extends Gl{create(e,r){let{betas:n,...o}=e;return this._client.post("/v1/messages/batches?beta=true",{body:o,...r,headers:{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),...r?.headers}})}retrieve(e,r={},n){if(qh(r))return this.retrieve(e,{},r);let{betas:o}=r;return this._client.get(`/v1/messages/batches/${e}?beta=true`,{...n,headers:{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),...n?.headers}})}list(e={},r){if(qh(e))return this.list({},e);let{betas:n,...o}=e;return this._client.getAPIList("/v1/messages/batches?beta=true",jB,{query:o,...r,headers:{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),...r?.headers}})}delete(e,r={},n){if(qh(r))return this.delete(e,{},r);let{betas:o}=r;return this._client.delete(`/v1/messages/batches/${e}?beta=true`,{...n,headers:{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),...n?.headers}})}cancel(e,r={},n){if(qh(r))return this.cancel(e,{},r);let{betas:o}=r;return this._client.post(`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),...n?.headers}})}async results(e,r={},n){if(qh(r))return this.results(e,{},r);let o=await this.retrieve(e);if(!o.results_url)throw new _r(`No batch \`results_url\`; Has it finished processing? ${o.processing_status} - ${o.id}`);let{betas:i}=r;return this._client.get(o.results_url,{...n,headers:{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary",...n?.headers},__binaryResponse:!0})._thenUnwrap((a,s)=>RB.fromResponse(s.response,s.controller))}},jB=class extends US{};Oj.BetaMessageBatchesPage=jB;var n8r=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},DB=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),DB(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),DB(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),DB(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),DB(t);break;case"delimiter":return t=t.slice(0,t.length-1),DB(t);break}return t},o8r=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},i8r=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},Sne=t=>JSON.parse(i8r(o8r(DB(n8r(t)))));var Ld=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},pn=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)},Uh,OA,b8,xne,_8,v8,Cne,w8,hO,S8,One,Pne,NB,Ene,Tne,_Ae,vEt,vAe,wAe,SAe,xAe,wEt,SEt="__json_buf",Ane=class t{constructor(){Uh.add(this),this.messages=[],this.receivedMessages=[],OA.set(this,void 0),this.controller=new AbortController,b8.set(this,void 0),xne.set(this,()=>{}),_8.set(this,()=>{}),v8.set(this,void 0),Cne.set(this,()=>{}),w8.set(this,()=>{}),hO.set(this,{}),S8.set(this,!1),One.set(this,!1),Pne.set(this,!1),NB.set(this,!1),Ene.set(this,void 0),Tne.set(this,void 0),vAe.set(this,e=>{if(Ld(this,One,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new $c),e instanceof $c)return Ld(this,Pne,!0,"f"),this._emit("abort",e);if(e instanceof _r)return this._emit("error",e);if(e instanceof Error){let r=new _r(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new _r(String(e)))}),Ld(this,b8,new Promise((e,r)=>{Ld(this,xne,e,"f"),Ld(this,_8,r,"f")}),"f"),Ld(this,v8,new Promise((e,r)=>{Ld(this,Cne,e,"f"),Ld(this,w8,r,"f")}),"f"),pn(this,b8,"f").catch(()=>{}),pn(this,v8,"f").catch(()=>{})}get response(){return pn(this,Ene,"f")}get request_id(){return pn(this,Tne,"f")}async withResponse(){let e=await pn(this,b8,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let o=new t;for(let i of r.messages)o._addMessageParam(i);return o._run(()=>o._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},pn(this,vAe,"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())),pn(this,Uh,"m",wAe).call(this);let{response:i,data:a}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(i);for await(let s of a)pn(this,Uh,"m",SAe).call(this,s);if(a.controller.signal?.aborted)throw new $c;pn(this,Uh,"m",xAe).call(this)}_connected(e){this.ended||(Ld(this,Ene,e,"f"),Ld(this,Tne,e?.headers.get("request-id"),"f"),pn(this,xne,"f").call(this,e),this._emit("connect"))}get ended(){return pn(this,S8,"f")}get errored(){return pn(this,One,"f")}get aborted(){return pn(this,Pne,"f")}abort(){this.controller.abort()}on(e,r){return(pn(this,hO,"f")[e]||(pn(this,hO,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=pn(this,hO,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(pn(this,hO,"f")[e]||(pn(this,hO,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Ld(this,NB,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Ld(this,NB,!0,"f"),await pn(this,v8,"f")}get currentMessage(){return pn(this,OA,"f")}async finalMessage(){return await this.done(),pn(this,Uh,"m",_Ae).call(this)}async finalText(){return await this.done(),pn(this,Uh,"m",vEt).call(this)}_emit(e,...r){if(pn(this,S8,"f"))return;e==="end"&&(Ld(this,S8,!0,"f"),pn(this,Cne,"f").call(this));let n=pn(this,hO,"f")[e];if(n&&(pn(this,hO,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!pn(this,NB,"f")&&!n?.length&&Promise.reject(o),pn(this,_8,"f").call(this,o),pn(this,w8,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!pn(this,NB,"f")&&!n?.length&&Promise.reject(o),pn(this,_8,"f").call(this,o),pn(this,w8,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",pn(this,Uh,"m",_Ae).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),pn(this,Uh,"m",wAe).call(this),this._connected(null);let o=qS.fromReadableStream(e,this.controller);for await(let i of o)pn(this,Uh,"m",SAe).call(this,i);if(o.controller.signal?.aborted)throw new $c;pn(this,Uh,"m",xAe).call(this)}[(OA=new WeakMap,b8=new WeakMap,xne=new WeakMap,_8=new WeakMap,v8=new WeakMap,Cne=new WeakMap,w8=new WeakMap,hO=new WeakMap,S8=new WeakMap,One=new WeakMap,Pne=new WeakMap,NB=new WeakMap,Ene=new WeakMap,Tne=new WeakMap,vAe=new WeakMap,Uh=new WeakSet,_Ae=function(){if(this.receivedMessages.length===0)throw new _r("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},vEt=function(){if(this.receivedMessages.length===0)throw new _r("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 _r("stream ended without producing a content block with type=text");return r.join(" ")},wAe=function(){this.ended||Ld(this,OA,void 0,"f")},SAe=function(r){if(this.ended)return;let n=pn(this,Uh,"m",wEt).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let o=n.content.at(-1);switch(r.delta.type){case"text_delta":{o.type==="text"&&this._emit("text",r.delta.text,o.text||"");break}case"citations_delta":{o.type==="text"&&this._emit("citation",r.delta.citation,o.citations??[]);break}case"input_json_delta":{o.type==="tool_use"&&o.input&&this._emit("inputJson",r.delta.partial_json,o.input);break}case"thinking_delta":{o.type==="thinking"&&this._emit("thinking",r.delta.thinking,o.thinking);break}case"signature_delta":{o.type==="thinking"&&this._emit("signature",o.signature);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{Ld(this,OA,n,"f");break}case"content_block_start":case"message_delta":break}},xAe=function(){if(this.ended)throw new _r("stream has ended, this shouldn't happen");let r=pn(this,OA,"f");if(!r)throw new _r("request ended without sending any chunks");return Ld(this,OA,void 0,"f"),r},wEt=function(r){let n=pn(this,OA,"f");if(r.type==="message_start"){if(n)throw new _r(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new _r(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,n;case"content_block_start":return n.content.push(r.content_block),n;case"content_block_delta":{let o=n.content.at(r.index);switch(r.delta.type){case"text_delta":{o?.type==="text"&&(o.text+=r.delta.text);break}case"citations_delta":{o?.type==="text"&&(o.citations??(o.citations=[]),o.citations.push(r.delta.citation));break}case"input_json_delta":{if(o?.type==="tool_use"){let i=o[SEt]||"";i+=r.delta.partial_json,Object.defineProperty(o,SEt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=Sne(i))}break}case"thinking_delta":{o?.type==="thinking"&&(o.thinking+=r.delta.thinking);break}case"signature_delta":{o?.type==="thinking"&&(o.signature=r.delta.signature);break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new qS(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var xEt={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025"},PA=class extends Gl{constructor(){super(...arguments),this.batches=new Oj(this._client)}create(e,r){let{betas:n,...o}=e;return o.model in xEt&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${xEt[o.model]}
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),this._client.post("/v1/messages?beta=true",{body:o,timeout:this._client._options.timeout??(o.stream?6e5:this._client._calculateNonstreamingTimeout(o.max_tokens)),...r,headers:{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0,...r?.headers},stream:e.stream??!1})}stream(e,r){return Ane.createMessage(this,e,r)}countTokens(e,r){let{betas:n,...o}=e;return this._client.post("/v1/messages/count_tokens?beta=true",{body:o,...r,headers:{"anthropic-beta":[...n??[],"token-counting-2024-11-01"].toString(),...r?.headers}})}};PA.Batches=Oj;PA.BetaMessageBatchesPage=jB;var zS=class extends Gl{constructor(){super(...arguments),this.models=new Cj(this._client),this.messages=new PA(this._client)}};zS.Models=Cj;zS.BetaModelInfosPage=MB;zS.Messages=PA;var Pj=class extends Gl{create(e,r){return this._client.post("/v1/complete",{body:e,timeout:this._client._options.timeout??6e5,...r,stream:e.stream??!1})}};var Ej=class extends Gl{create(e,r){return this._client.post("/v1/messages/batches",{body:e,...r})}retrieve(e,r){return this._client.get(`/v1/messages/batches/${e}`,r)}list(e={},r){return qh(e)?this.list({},e):this._client.getAPIList("/v1/messages/batches",LB,{query:e,...r})}delete(e,r){return this._client.delete(`/v1/messages/batches/${e}`,r)}cancel(e,r){return this._client.post(`/v1/messages/batches/${e}/cancel`,r)}async results(e,r){let n=await this.retrieve(e);if(!n.results_url)throw new _r(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...r,headers:{Accept:"application/binary",...r?.headers},__binaryResponse:!0})._thenUnwrap((o,i)=>RB.fromResponse(i.response,i.controller))}},LB=class extends US{};Ej.MessageBatchesPage=LB;var Fd=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},mn=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},zh,EA,x8,Ine,C8,O8,Mne,P8,gO,E8,Rne,jne,FB,Dne,Nne,CAe,CEt,OAe,PAe,EAe,TAe,OEt,PEt="__json_buf",Lne=class t{constructor(){zh.add(this),this.messages=[],this.receivedMessages=[],EA.set(this,void 0),this.controller=new AbortController,x8.set(this,void 0),Ine.set(this,()=>{}),C8.set(this,()=>{}),O8.set(this,void 0),Mne.set(this,()=>{}),P8.set(this,()=>{}),gO.set(this,{}),E8.set(this,!1),Rne.set(this,!1),jne.set(this,!1),FB.set(this,!1),Dne.set(this,void 0),Nne.set(this,void 0),OAe.set(this,e=>{if(Fd(this,Rne,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new $c),e instanceof $c)return Fd(this,jne,!0,"f"),this._emit("abort",e);if(e instanceof _r)return this._emit("error",e);if(e instanceof Error){let r=new _r(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new _r(String(e)))}),Fd(this,x8,new Promise((e,r)=>{Fd(this,Ine,e,"f"),Fd(this,C8,r,"f")}),"f"),Fd(this,O8,new Promise((e,r)=>{Fd(this,Mne,e,"f"),Fd(this,P8,r,"f")}),"f"),mn(this,x8,"f").catch(()=>{}),mn(this,O8,"f").catch(()=>{})}get response(){return mn(this,Dne,"f")}get request_id(){return mn(this,Nne,"f")}async withResponse(){let e=await mn(this,x8,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let o=new t;for(let i of r.messages)o._addMessageParam(i);return o._run(()=>o._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},mn(this,OAe,"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())),mn(this,zh,"m",PAe).call(this);let{response:i,data:a}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(i);for await(let s of a)mn(this,zh,"m",EAe).call(this,s);if(a.controller.signal?.aborted)throw new $c;mn(this,zh,"m",TAe).call(this)}_connected(e){this.ended||(Fd(this,Dne,e,"f"),Fd(this,Nne,e?.headers.get("request-id"),"f"),mn(this,Ine,"f").call(this,e),this._emit("connect"))}get ended(){return mn(this,E8,"f")}get errored(){return mn(this,Rne,"f")}get aborted(){return mn(this,jne,"f")}abort(){this.controller.abort()}on(e,r){return(mn(this,gO,"f")[e]||(mn(this,gO,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=mn(this,gO,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(mn(this,gO,"f")[e]||(mn(this,gO,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Fd(this,FB,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Fd(this,FB,!0,"f"),await mn(this,O8,"f")}get currentMessage(){return mn(this,EA,"f")}async finalMessage(){return await this.done(),mn(this,zh,"m",CAe).call(this)}async finalText(){return await this.done(),mn(this,zh,"m",CEt).call(this)}_emit(e,...r){if(mn(this,E8,"f"))return;e==="end"&&(Fd(this,E8,!0,"f"),mn(this,Mne,"f").call(this));let n=mn(this,gO,"f")[e];if(n&&(mn(this,gO,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!mn(this,FB,"f")&&!n?.length&&Promise.reject(o),mn(this,C8,"f").call(this,o),mn(this,P8,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!mn(this,FB,"f")&&!n?.length&&Promise.reject(o),mn(this,C8,"f").call(this,o),mn(this,P8,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",mn(this,zh,"m",CAe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),mn(this,zh,"m",PAe).call(this),this._connected(null);let o=qS.fromReadableStream(e,this.controller);for await(let i of o)mn(this,zh,"m",EAe).call(this,i);if(o.controller.signal?.aborted)throw new $c;mn(this,zh,"m",TAe).call(this)}[(EA=new WeakMap,x8=new WeakMap,Ine=new WeakMap,C8=new WeakMap,O8=new WeakMap,Mne=new WeakMap,P8=new WeakMap,gO=new WeakMap,E8=new WeakMap,Rne=new WeakMap,jne=new WeakMap,FB=new WeakMap,Dne=new WeakMap,Nne=new WeakMap,OAe=new WeakMap,zh=new WeakSet,CAe=function(){if(this.receivedMessages.length===0)throw new _r("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},CEt=function(){if(this.receivedMessages.length===0)throw new _r("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 _r("stream ended without producing a content block with type=text");return r.join(" ")},PAe=function(){this.ended||Fd(this,EA,void 0,"f")},EAe=function(r){if(this.ended)return;let n=mn(this,zh,"m",OEt).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let o=n.content.at(-1);switch(r.delta.type){case"text_delta":{o.type==="text"&&this._emit("text",r.delta.text,o.text||"");break}case"citations_delta":{o.type==="text"&&this._emit("citation",r.delta.citation,o.citations??[]);break}case"input_json_delta":{o.type==="tool_use"&&o.input&&this._emit("inputJson",r.delta.partial_json,o.input);break}case"thinking_delta":{o.type==="thinking"&&this._emit("thinking",r.delta.thinking,o.thinking);break}case"signature_delta":{o.type==="thinking"&&this._emit("signature",o.signature);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{Fd(this,EA,n,"f");break}case"content_block_start":case"message_delta":break}},TAe=function(){if(this.ended)throw new _r("stream has ended, this shouldn't happen");let r=mn(this,EA,"f");if(!r)throw new _r("request ended without sending any chunks");return Fd(this,EA,void 0,"f"),r},OEt=function(r){let n=mn(this,EA,"f");if(r.type==="message_start"){if(n)throw new _r(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new _r(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,n;case"content_block_start":return n.content.push(r.content_block),n;case"content_block_delta":{let o=n.content.at(r.index);switch(r.delta.type){case"text_delta":{o?.type==="text"&&(o.text+=r.delta.text);break}case"citations_delta":{o?.type==="text"&&(o.citations??(o.citations=[]),o.citations.push(r.delta.citation));break}case"input_json_delta":{if(o?.type==="tool_use"){let i=o[PEt]||"";i+=r.delta.partial_json,Object.defineProperty(o,PEt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=Sne(i))}break}case"thinking_delta":{o?.type==="thinking"&&(o.thinking+=r.delta.thinking);break}case"signature_delta":{o?.type==="thinking"&&(o.signature=r.delta.signature);break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new qS(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var yO=class extends Gl{constructor(){super(...arguments),this.batches=new Ej(this._client)}create(e,r){return e.model in EEt&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${EEt[e.model]}
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),this._client.post("/v1/messages",{body:e,timeout:this._client._options.timeout??(e.stream?6e5:this._client._calculateNonstreamingTimeout(e.max_tokens)),...r,stream:e.stream??!1})}stream(e,r){return Lne.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},EEt={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025"};yO.Batches=Ej;yO.MessageBatchesPage=LB;var TA=class extends Gl{retrieve(e,r){return this._client.get(`/v1/models/${e}`,r)}list(e={},r){return qh(e)?this.list({},e):this._client.getAPIList("/v1/models",Tj,{query:e,...r})}},Tj=class extends US{};TA.ModelInfosPage=Tj;var TEt,ri=class extends _ne{constructor({baseURL:e=wne("ANTHROPIC_BASE_URL"),apiKey:r=wne("ANTHROPIC_API_KEY")??null,authToken:n=wne("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&_Et())throw new _r(`It looks like you're running in a browser-like environment.
This is disabled by default, as it risks exposing your secret API credentials to attackers.
If you understand the risks and have appropriate mitigations in place,
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
`);super({baseURL:i.baseURL,timeout:i.timeout??6e5,httpAgent:i.httpAgent,maxRetries:i.maxRetries,fetch:i.fetch}),this.completions=new Pj(this),this.messages=new yO(this),this.models=new TA(this),this.beta=new zS(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&&!y8(r)?r:n!=null&&!y8(n)?n:{}}apiKeyAuth(e){return this.apiKey==null?{}:{"X-Api-Key":this.apiKey}}bearerAuth(e){return this.authToken==null?{}:{Authorization:`Bearer ${this.authToken}`}}};TEt=ri;ri.Anthropic=TEt;ri.HUMAN_PROMPT=`
Human:`;ri.AI_PROMPT=`
Assistant:`;ri.DEFAULT_TIMEOUT=6e5;ri.AnthropicError=_r;ri.APIError=Jl;ri.APIConnectionError=CA;ri.APIConnectionTimeoutError=AB;ri.APIUserAbortError=$c;ri.NotFoundError=c8;ri.ConflictError=d8;ri.RateLimitError=p8;ri.BadRequestError=s8;ri.AuthenticationError=u8;ri.InternalServerError=m8;ri.PermissionDeniedError=l8;ri.UnprocessableEntityError=f8;ri.toFile=dEt;ri.fileFromPath=fne;ri.Completions=Pj;ri.Messages=yO;ri.Models=TA;ri.ModelInfosPage=Tj;ri.Beta=zS;var{HUMAN_PROMPT:v$o,AI_PROMPT:w$o}=ri;Rd();ym();fc();Jp();Mg();var T8=class extends PM{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 Wp(`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 Wp(`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)?AAe(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 AAe(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 AEt(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:typeof t=="string"?{type:"tool",name:t}:t}function IEt(t){return t==null||typeof t!="object"||!("type"in t)||t.type!=="image"||!("source"in t)||typeof t.source!="object"||t.source==null||!("type"in t.source)?!1:t.source.type==="base64"?!(!("media_type"in t.source)||typeof t.source.media_type!="string"||!("data"in t.source)||typeof t.source.data!="string"):t.source.type==="url"?!(!("url"in t.source)||typeof t.source.url!="string"):!1}function MEt(t){let e=Zce({dataUrl:t});if(e)return{type:"base64",media_type:e.mime_type,data:e.data};let r;try{r=new URL(t)}catch{throw new Error([`Malformed image URL: ${JSON.stringify(t)}. Content blocks of type 'image_url' must be a valid http, https, or base64-encoded data URL.`,"Example: data:image/png;base64,/9j/4AAQSk...","Example: https://example.com/image.jpg"].join(`
`))}if(r.protocol==="http:"||r.protocol==="https:")return{type:"url",url:t};throw new Error([`Invalid image URL protocol: ${JSON.stringify(r.protocol)}. Anthropic only supports images as http, https, or base64-encoded data URLs on 'image_url' content blocks.`,"Example: data:image/png;base64,/9j/4AAQSk...","Example: https://example.com/image.jpg"].join(`
`))}function l8r(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 ps({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else e.push(new ps({content:[{type:"tool_result",content:IAe(r.content),tool_use_id:r.tool_call_id}]}));else e.push(r);return e}function REt(t){if(t.id===void 0)throw new Error('Anthropic requires all tool calls to have an "id".');return{type:"tool_use",id:t.id,name:t.name,input:t.args}}var c8r={providerName:"anthropic",fromStandardTextBlock(t){return{type:"text",text:t.text,..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}},fromStandardImageBlock(t){if(t.source_type==="url"){let e=Zce({dataUrl:t.url,asTypedArray:!1});return e?{type:"image",source:{type:"base64",data:e.data,media_type:e.mime_type},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}:{type:"image",source:{type:"url",url:t.url,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}}}else{if(t.source_type==="base64")return{type:"image",source:{type:"base64",data:t.data,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{}};throw new Error(`Unsupported image source type: ${t.source_type}`)}},fromStandardFileBlock(t){let e=(t.mime_type??"").split(";")[0];if(t.source_type==="url"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"url",url:t.url,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file url source: ${t.mime_type}`)}else if(t.source_type==="text"){if(e==="text/plain"||e==="")return{type:"document",source:{type:"text",data:t.text,media_type:t.mime_type??""},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file text source: ${t.mime_type}`)}else if(t.source_type==="base64"){if(e==="application/pdf"||e==="")return{type:"document",source:{type:"base64",data:t.data,media_type:"application/pdf"},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};if(["image/jpeg","image/png","image/gif","image/webp"].includes(e))return{type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:t.data,media_type:e}}]},..."cache_control"in(t.metadata??{})?{cache_control:t.metadata.cache_control}:{},..."citations"in(t.metadata??{})?{citations:t.metadata.citations}:{},..."context"in(t.metadata??{})?{context:t.metadata.context}:{},..."title"in(t.metadata??{})?{title:t.metadata.title}:{}};throw new Error(`Unsupported file mime type for file base64 source: ${t.mime_type}`)}else throw new Error(`Unsupported file source type: ${t.source_type}`)}};function IAe(t){let e=["tool_use","tool_result","input_json_delta"],r=["text","text_delta"];return typeof t=="string"?t:t.map(o=>{if(LP(o))return IBe(o,c8r);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=MEt(o.image_url):a=MEt(o.image_url.url),{type:"image",source:a,...i?{cache_control:i}:{}}}else{if(IEt(o))return o;if(o.type==="document")return{...o,...i?{cache_control:i}:{}};if(o.type==="thinking")return{type:"thinking",thinking:o.thinking,signature:o.signature,...i?{cache_control:i}:{}};if(o.type==="redacted_thinking")return{type:"redacted_thinking",data:o.data,...i?{cache_control:i}:{}};if(r.find(a=>a===o.type)&&"text"in o)return{type:"text",text:o.text,...i?{cache_control:i}:{}};if(e.find(a=>a===o.type)){let a={...o};if("index"in a&&delete a.index,a.type==="input_json_delta"&&(a.type="tool_use"),"input"in a&&typeof a.input=="string")try{a.input=JSON.parse(a.input)}catch{a.input={}}return{...a,...i?{cache_control:i}:{}}}else throw new Error("Unsupported message content format")}})}function Fne(t){let e=l8r(t),r;e.length>0&&e[0]._getType()==="system"&&(r=t[0].content);let o=(r!==void 0?e.slice(1):e).map(i=>{let a;if(i._getType()==="human")a="user";else if(i._getType()==="ai")a="assistant";else if(i._getType()==="tool")a="user";else throw i._getType()==="system"?new Error("System messages are only permitted as the first passed message."):new Error(`Message type "${i._getType()}" is not supported.`);if(hi(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(REt)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(REt)]};{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:IAe(i.content)}}}else return{role:a,content:IAe(i.content)}});return{messages:d8r(o),system:r}}function d8r(t){if(!t||t.length<=1)return t;let e=[],r=t[0],n=i=>typeof i=="string"?[{type:"text",text:i}]:i,o=i=>i.role!=="user"||typeof i.content=="string"?!1:Array.isArray(i.content)&&i.content.every(a=>a.type==="tool_result");for(let i=1;i<t.length;i+=1){let a=t[i];o(r)&&o(a)?r={...r,content:[...n(r.content),...n(a.content)]}:(e.push(r),r=a)}return e.push(r),e}function jEt(t,e){if(t.type==="message_start"){let{content:r,usage:n,...o}=t.message,i={};for(let[c,d]of Object.entries(o))d!=null&&(i[c]=d);let{input_tokens:a,output_tokens:s,...u}=n??{},l={input_tokens:a,output_tokens:s,total_tokens:a+s,input_token_details:{cache_creation:u.cache_creation_input_tokens,cache_read:u.cache_read_input_tokens}};return{chunk:new or({content:e.coerceContentToString?"":[],additional_kwargs:i,usage_metadata:e.streamUsage?l:void 0,response_metadata:{usage:{...u}},id:t.message.id})}}else if(t.type==="message_delta"){let r={input_tokens:0,output_tokens:t.usage.output_tokens,total_tokens:t.usage.output_tokens,input_token_details:{cache_creation:t.usage.cache_creation_input_tokens,cache_read:t.usage.cache_read_input_tokens}};return{chunk:new or({content:e.coerceContentToString?"":[],additional_kwargs:{...t.delta},usage_metadata:e.streamUsage?r:void 0})}}else if(t.type==="content_block_start"&&["tool_use","document"].includes(t.content_block.type)){let r=t.content_block,n;return r.type==="tool_use"?n=[{id:r.id,index:t.index,name:r.name,args:""}]:n=[],{chunk:new or({content:e.coerceContentToString?"":[{index:t.index,...t.content_block,input:""}],additional_kwargs:{},tool_call_chunks:n})}}else if(t.type==="content_block_delta"&&["text_delta","citations_delta","thinking_delta","signature_delta"].includes(t.delta.type)){if(e.coerceContentToString&&"text"in t.delta)return{chunk:new or({content:t.delta.text})};{let r=t.delta;return"citation"in r&&(r.citations=[r.citation],delete r.citation),r.type==="thinking_delta"||r.type==="signature_delta"?{chunk:new or({content:[{index:t.index,...r,type:"thinking"}]})}:{chunk:new or({content:[{index:t.index,...r,type:"text"}]})}}}else{if(t.type==="content_block_delta"&&t.delta.type==="input_json_delta")return{chunk:new or({content:e.coerceContentToString?"":[{index:t.index,input:t.delta.partial_json,type:t.delta.type}],additional_kwargs:{},tool_call_chunks:[{index:t.index,args:t.delta.partial_json}]})};if(t.type==="content_block_start"&&t.content_block.type==="text"){let r=t.content_block?.text;if(r!==void 0)return{chunk:new or({content:e.coerceContentToString?r:[{index:t.index,...t.content_block}],additional_kwargs:{}})}}else{if(t.type==="content_block_start"&&t.content_block.type==="redacted_thinking")return{chunk:new or({content:e.coerceContentToString?"":[{index:t.index,...t.content_block}]})};if(t.type==="content_block_start"&&t.content_block.type==="thinking"){let r=t.content_block.thinking;return{chunk:new or({content:e.coerceContentToString?r:[{index:t.index,...t.content_block}]})}}}}return null}function DEt(t,e){let r=e.usage,n=r!=null?{input_tokens:r.input_tokens??0,output_tokens:r.output_tokens??0,total_tokens:(r.input_tokens??0)+(r.output_tokens??0),input_token_details:{cache_creation:r.cache_creation_input_tokens,cache_read:r.cache_read_input_tokens}}:void 0;if(t.length===1&&t[0].type==="text")return[{text:t[0].text,message:new fn({content:t[0].text,additional_kwargs:e,usage_metadata:n,response_metadata:e,id:e.id})}];{let o=AAe(t);return[{text:"",message:new fn({content:t,additional_kwargs:e,tool_calls:o,usage_metadata:n,response_metadata:e,id:e.id})}]}}function kne(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function MAe(t){let e;return t.status===400&&t.message.includes("tool")?e=kne(t,"INVALID_TOOL_RESULTS"):t.status===401?e=kne(t,"MODEL_AUTHENTICATION"):t.status===404?e=kne(t,"MODEL_NOT_FOUND"):t.status===429?e=kne(t,"MODEL_RATE_LIMIT"):e=t,e}function f8r(t){return!!(t.tools&&t.tools.length>0)}function p8r(t){for(let e of t.messages??[])if(typeof e.content!="string"){for(let r of e.content??[])if(typeof r=="object"&&r!=null&&r.type==="document"&&typeof r.citations=="object"&&r.citations.enabled)return!0}return!1}function m8r(t){return!!(t.thinking&&t.thinking.type==="enabled")}function h8r(t){return"input_schema"in t}function g8r(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 RAe=class extends Fs{static lc_name(){return"ChatAnthropic"}get lc_secrets(){return{anthropicApiKey:"ANTHROPIC_API_KEY",apiKey:"ANTHROPIC_API_KEY"}}get lc_aliases(){return{modelName:"model"}}constructor(e){if(super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"anthropicApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"topK",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:2048}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"claude-2.1"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"claude-2.1"}),Object.defineProperty(this,"invocationKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clientOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"thinking",{enumerable:!0,configurable:!0,writable:!0,value:{type:"disabled"}}),Object.defineProperty(this,"batchClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streamingClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"createClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.anthropicApiKey=e?.apiKey??e?.anthropicApiKey??et("ANTHROPIC_API_KEY"),!this.anthropicApiKey&&!e?.createClient)throw new Error("Anthropic API key not found");this.clientOptions=e?.clientOptions??{},this.apiKey=this.anthropicApiKey,this.apiUrl=e?.anthropicApiUrl,this.modelName=e?.model??e?.modelName??this.model,this.model=this.modelName,this.invocationKwargs=e?.invocationKwargs??{},this.temperature=e?.temperature??this.temperature,this.topK=e?.topK??this.topK,this.topP=e?.topP??this.topP,this.maxTokens=e?.maxTokensToSample??e?.maxTokens??this.maxTokens,this.stopSequences=e?.stopSequences??this.stopSequences,this.streaming=e?.streaming??!1,this.streamUsage=e?.streamUsage??this.streamUsage,this.thinking=e?.thinking??this.thinking,this.createClient=e?.createClient??(r=>new 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(h8r(r))return r;if(Mc(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(Ul(r))return{name:r.name,description:r.description,input_schema:Ls(r.schema)?po(r.schema):r.schema};throw new Error(`Unknown tool type passed to ChatAnthropic: ${JSON.stringify(r,null,2)}`)})}bindTools(e,r){return this.bind({tools:this.formatStructuredToolToAnthropic(e),...r})}invocationParams(e){let r=AEt(e?.tool_choice);if(this.thinking.type==="enabled"){if(this.topK!==-1)throw new Error("topK is not supported when thinking is enabled");if(this.topP!==-1)throw new Error("topP is not supported when thinking is enabled");if(this.temperature!==1)throw new Error("temperature is not supported when thinking is enabled");return{model:this.model,stop_sequences:e?.stop??this.stopSequences,stream:this.streaming,max_tokens:this.maxTokens,tools:this.formatStructuredToolToAnthropic(e?.tools),tool_choice:r,thinking:this.thinking,...this.invocationKwargs}}return{model:this.model,temperature:this.temperature,top_k:this.topK,top_p:this.topP,stop_sequences:e?.stop??this.stopSequences,stream:this.streaming,max_tokens:this.maxTokens,tools:this.formatStructuredToolToAnthropic(e?.tools),tool_choice:r,thinking:this.thinking,...this.invocationKwargs}}_identifyingParams(){return{model_name:this.model,...this.invocationParams()}}identifyingParams(){return{model_name:this.model,...this.invocationParams()}}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=Fne(e),a={...o,...i,stream:!0},s=!f8r(a)&&!p8r(a)&&!m8r(a),u=await this.createStreamWithRetry(a,{headers:r.headers});for await(let l of u){if(r.signal?.aborted)throw u.controller.abort(),new Error("AbortError: User aborted the request.");let c=this.streamUsage??r.streamUsage,d=jEt(l,{streamUsage:c,coerceContentToString:s});if(!d)continue;let{chunk:f}=d,p=g8r(f),m=new Ln({message:new or({content:f.content,additional_kwargs:f.additional_kwargs,tool_call_chunks:f.tool_call_chunks,usage_metadata:c?f.usage_metadata:void 0,response_metadata:f.response_metadata,id:f.id}),text:p??""});yield m,await n?.handleLLMNewToken(p??"",void 0,void 0,void 0,void 0,{chunk:m})}}async _generateNonStreaming(e,r,n){let o=await this.completionWithRetry({...r,stream:!1,...Fne(e)},n),{content:i,...a}=o,s=DEt(i,a),{role:u,type:l,...c}=a;return{generations:s,llmOutput:c}}async _generate(e,r,n){if(this.stopSequences&&r.stop)throw new Error('"stopSequence" parameter found in input and default params');let o=this.invocationParams(r);if(o.stream){let i,a=this._streamResponseChunks(e,r,n);for await(let s of a)i===void 0?i=s:i=i.concat(s);if(i===void 0)throw new Error("No chunks returned from Anthropic API.");return{generations:[{text:i.text,message:i.message}]}}else return this._generateNonStreaming(e,o,{signal:r.signal,headers:r.headers})}async createStreamWithRetry(e,r){if(!this.streamingClient){let o=this.apiUrl?{baseURL:this.apiUrl}:void 0;this.streamingClient=this.createClient({dangerouslyAllowBrowser:!0,...this.clientOptions,...o,apiKey:this.apiKey,maxRetries:0})}let n=async()=>{try{return await this.streamingClient.messages.create({...e,...this.invocationKwargs,stream:!0},r)}catch(o){throw MAe(o)}};return this.caller.call(n)}async completionWithRetry(e,r){if(!this.batchClient){let o=this.apiUrl?{baseURL:this.apiUrl}:void 0;this.batchClient=this.createClient({dangerouslyAllowBrowser:!0,...this.clientOptions,...o,apiKey:this.apiKey,maxRetries:0})}let n=async()=>{try{return await this.batchClient.messages.create({...e,...this.invocationKwargs},r)}catch(o){throw MAe(o)}};return this.caller.callWithOptions({signal:r.signal??void 0},n)}_llmType(){return"anthropic"}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw;if(i==="jsonMode")throw new Error('Anthropic only supports "functionCalling" as a method.');let s=o??"extract",u,l;if(Ls(n)){let m=po(n);l=[{name:s,description:m.description??"A function available to call.",input_schema:m}],u=new T8({returnSingle:!0,keyName:s,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.description=="string"&&typeof n.input_schema=="object"&&n.input_schema!=null?(m=n,s=n.name):m={name:s,description:n.description??"",input_schema:n},l=[m],u=new T8({returnSingle:!0,keyName:s})}let c;if(this.thinking?.type==="enabled"){let m="Anthropic structured output relies on forced tool calling, which is not supported when `thinking` is enabled. This method will raise OutputParserException if tool calls are not generated. Consider disabling `thinking` or adjust your prompt to ensure the tool is called.";console.warn(m),c=this.bind({tools:l});let h=b=>{if(!b.tool_calls||b.tool_calls.length===0)throw new Error(m);return b};c=c.pipe(h)}else c=this.bind({tools:l,tool_choice:{type:"tool",name:s}});if(!a)return c.pipe(u).withConfig({runName:"ChatAnthropicStructuredOutput"});let d=so.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=so.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return si.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},$ne=class extends RAe{};Rd();ym();Jp();Mg();fc();function Aj(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}fc();function A8(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function Ij(t){let e;return t.constructor.name===Ef.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Pi.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=A8(t,"INVALID_TOOL_RESULTS"):t.status===401?e=A8(t,"MODEL_AUTHENTICATION"):t.status===429?e=A8(t,"MODEL_RATE_LIMIT"):t.status===404?e=A8(t,"MODEL_NOT_FOUND"):e=t,e}function jAe(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 y8r(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function NEt(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(LEt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function LEt(t,e){let r=[];for(let[n,o]of Object.entries(t.properties??{}))o.description&&e<2&&r.push(`// ${o.description}`),t.required?.includes(n)?r.push(`${n}: ${Bne(o,e)},`):r.push(`${n}?: ${Bne(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function Bne(t,e){if(y8r(t))return t.anyOf.map(r=>Bne(r,e)).join(" | ");switch(t.type){case"string":return t.enum?t.enum.map(r=>`"${r}"`).join(" | "):"string";case"number":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"integer":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"boolean":return"boolean";case"null":return"null";case"object":return["{",LEt(t,e+2),"}"].join(`
`);case"array":return t.items?`${Bne(t.items,e)}[]`:"any[]";default:return""}}function FEt(t,e){let r;if(Ul(t)){let n=hte({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:DT(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}function b8r(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 LAe(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(!fs.isInstance(t))throw new Error("Invalid generic chat message");return b8r(t)}default:throw new Error(`Unknown message type: ${e}`)}}function NAe(t,e){return t.flatMap(r=>{let n=LAe(r);n==="system"&&FAe(e)&&(n="developer");let o={role:n,content:r.content};if(r.name!=null&&(o.name=r.name),r.additional_kwargs.function_call!=null&&(o.function_call=r.additional_kwargs.function_call,o.content=""),hi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(NS),o.content=""):(r.additional_kwargs.tool_calls!=null&&(o.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(o.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let i={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[o,i]}return o})}var kB="__openai_function_call_ids__";function kEt(t,e){return t.flatMap(r=>{let n=LAe(r);if(n==="system"&&FAe(e)&&(n="developer"),n==="function")throw new Error("Function messages are not supported in Responses API");if(n==="tool"){let o=r;return o.additional_kwargs?.type==="computer_call_output"?{type:"computer_call_output",output:(()=>{if(typeof o.content=="string")return{type:"computer_screenshot",image_url:o.content};if(Array.isArray(o.content)){let a=o.content.find(u=>u.type==="computer_screenshot");if(a)return a;let s=o.content.find(u=>u.type==="image_url");if(s)return{type:"computer_screenshot",image_url:typeof s.image_url=="string"?s.image_url:s.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:o.tool_call_id}:{type:"function_call_output",call_id:o.tool_call_id,id:o.id,output:typeof o.content!="string"?JSON.stringify(o.content):o.content}}if(n==="assistant"){let o=[];r.additional_kwargs.reasoning!=null&&(u=>typeof u=="object"&&u!=null&&"type"in u&&u.type==="reasoning")(r.additional_kwargs.reasoning)&&o.push(r.additional_kwargs.reasoning);let{content:i}=r;r.additional_kwargs.refusal!=null&&(typeof i=="string"&&(i=[{type:"output_text",text:i,annotations:[]}]),i=[...i,{type:"refusal",refusal:r.additional_kwargs.refusal}]),o.push({type:"message",role:"assistant",content:typeof i=="string"?i:i.flatMap(s=>s.type==="text"?{type:"output_text",text:s.text,annotations:s.annotations??[]}:s.type==="output_text"||s.type==="refusal"?s:[])});let a=r.additional_kwargs[kB];if(hi(r)&&r.tool_calls?.length?o.push(...r.tool_calls.map(s=>({type:"function_call",name:s.name,arguments:JSON.stringify(s.args),call_id:s.id,id:a?.[s.id]}))):r.additional_kwargs.tool_calls!=null&&o.push(...r.additional_kwargs.tool_calls.map(s=>({type:"function_call",name:s.function.name,call_id:s.id,id:a?.[s.id],arguments:s.function.arguments}))),r.additional_kwargs.tool_outputs!=null){let u=r.additional_kwargs.tool_outputs?.filter(l=>l.type==="computer_call");u.length>0&&o.push(...u)}return o}return n==="user"?{type:"message",role:"user",content:typeof r.content=="string"?r.content:r.content.flatMap(o=>{if(o.type==="text")return{type:"input_text",text:o.text};if(o.type==="image_url"){let i=typeof o.image_url=="string"?o.image_url:o.image_url.url,a=typeof o.image_url=="string"?"auto":o.image_url.detail;return{type:"input_image",image_url:i,detail:a}}return o.type==="input_text"||o.type==="input_image"||o.type==="input_file"?o:[]})}:[]})}function BEt(t){if(t.error){let a=new Error(t.error.message);throw a.name=t.error.code,a}let e=[],r=[],n=[],o={model:t.model,created_at:t.created_at,id:t.id,incomplete_details:t.incomplete_details,metadata:t.metadata,object:t.object,status:t.status,user:t.user,model_name:t.model},i={};for(let a of t.output)if(a.type==="message")e.push(...a.content.flatMap(s=>s.type==="output_text"?("parsed"in s&&s.parsed!=null&&(i.parsed=s.parsed),{type:"text",text:s.text,annotations:s.annotations}):s.type==="refusal"?(i.refusal=s.refusal,[]):s));else if(a.type==="function_call"){let s={function:{name:a.name,arguments:a.arguments},id:a.call_id};try{r.push(xp(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Sm(s,l))}i[kB]??(i[kB]={}),i[kB][a.call_id]=a.id}else a.type==="reasoning"?i.reasoning=a:(i.tool_outputs??(i.tool_outputs=[]),i.tool_outputs.push(a));return new fn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function _8r(t){let e=[],r={},n,o=[],i={},a={},s;if(t.type==="response.output_text.delta")e.push({type:"text",text:t.delta,index:t.content_index});else if(t.type==="response.output_text.annotation.added")e.push({type:"text",text:"",annotations:[t.annotation],index:t.content_index});else if(t.type==="response.output_item.added"&&t.item.type==="message")s=t.item.id;else if(t.type==="response.output_item.added"&&t.item.type==="function_call")o.push({type:"tool_call_chunk",name:t.item.name,args:t.item.arguments,id:t.item.id,index:t.output_index}),a[kB]={[t.item.call_id]:t.item.id};else if(t.type==="response.output_item.done"&&(t.item.type==="web_search_call"||t.item.type==="file_search_call"||t.item.type==="computer_call"))a.tool_outputs=[t.item];else if(t.type==="response.created")i.id=t.response.id,i.model_name=t.response.model,i.model=t.response.model;else if(t.type==="response.completed"){let u=BEt(t.response);n=t.response.usage,t.response.text?.format?.type==="json_schema"&&(a.parsed??(a.parsed=JSON.parse(u.text)));for(let[l,c]of Object.entries(t.response))l!=="id"&&(i[l]=c)}else if(t.type==="response.function_call_arguments.delta")o.push({type:"tool_call_chunk",args:t.delta,index:t.output_index});else if(t.type==="response.web_search_call.completed"||t.type==="response.file_search_call.completed")r={tool_outputs:{id:t.item_id,type:t.type.replace("response.","").replace(".completed",""),status:"completed"}};else if(t.type==="response.refusal.done")a.refusal=t.refusal;else return null;return new Ln({text:e.map(u=>u.text).join(""),message:new or({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function DAe(t){return"type"in t&&t.type!=="function"}function v8r(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function $Et(t,e){return Mc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:FEt(t,e)}function FAe(t){return t?.startsWith("o1")||t?.startsWith("o3")}var I8=class extends Fs{static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning_effort"]}get lc_secrets(){return{openAIApiKey:"OPENAI_API_KEY",apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{modelName:"model",openAIApiKey:"openai_api_key",apiKey:"openai_api_key"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","reasoningEffort","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","modelName","model","modelKwargs","stop","stopSequences","timeout","openAIApiKey","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming"]}constructor(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"logitBias",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gpt-3.5-turbo"}),Object.defineProperty(this,"modelKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topLogprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"openAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__includeRawResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportsStrictToolCalling",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modalities",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reasoningEffort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useResponsesApi",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.openAIApiKey=e?.apiKey??e?.openAIApiKey??e?.configuration?.apiKey??et("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??et("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelName=this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoningEffort=e?.reasoningEffort,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.useResponsesApi=e?.useResponsesApi??this.useResponsesApi,this.model==="o1"&&(this.disableStreaming=!0),this.streaming=e?.streaming??!1,this.streamUsage=e?.streamUsage??this.streamUsage,this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling)}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.bind({tools:e.map(o=>DAe(o)?o:$Et(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&qne(e.json_schema.schema)?q$(e.json_schema.schema,e.json_schema.name,{description:e.json_schema.description}):e}invocationParams(e,r){let n;if(e?.strict!==void 0?n=e.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this._useResponseApi(e)){let s={model:this.model,temperature:this.temperature,top_p:this.topP,user:this.user,stream:this.streaming,previous_response_id:e?.previous_response_id,truncation:e?.truncation,include:e?.include,tools:e?.tools?.length?e.tools.map(l=>DAe(l)?l:Mc(l)?{type:"function",name:l.function.name,parameters:l.function.parameters,description:l.function.description,strict:n}:null).filter(l=>l!==null):void 0,tool_choice:v8r(e?.tool_choice)?e?.tool_choice:(()=>{let l=jAe(e?.tool_choice);if(typeof l=="object"&&"type"in l)return{type:"function",name:l.function.name}})(),text:(()=>{if(e?.text)return e.text;let l=this.createResponseFormat(e?.response_format);return l?.type==="json_schema"?l.json_schema.schema!=null?{format:{type:"json_schema",schema:l.json_schema.schema,description:l.json_schema.description,name:l.json_schema.name,strict:l.json_schema.strict}}:void 0:{format:l}})(),parallel_tool_calls:e?.parallel_tool_calls,max_output_tokens:this.maxTokens===-1?void 0:this.maxTokens,...this.modelKwargs},u=e?.reasoning_effort??this.reasoningEffort;return u!==void 0&&(s.reasoning={effort:u}),s}let o={};e?.stream_options!==void 0?o={stream_options:e.stream_options}:this.streamUsage&&(this.streaming||r?.streaming)&&(o={stream_options:{include_usage:!0}});let i={model:this.model,temperature:this.temperature,top_p:this.topP,frequency_penalty:this.frequencyPenalty,presence_penalty:this.presencePenalty,logprobs:this.logprobs,top_logprobs:this.topLogprobs,n:this.n,logit_bias:this.logitBias,stop:e?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:e?.functions,function_call:e?.function_call,tools:e?.tools?.length?e.tools.map(s=>$Et(s,{strict:n})):void 0,tool_choice:jAe(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),FAe(i.model)?i.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens:i.max_tokens=this.maxTokens===-1?void 0:this.maxTokens,i}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=e.tool_calls;switch(e.role){case"assistant":{let o=[],i=[];for(let u of n??[])try{o.push(xp(u,{returnId:!0}))}catch(l){i.push(Sm(u,l.message))}let a={function_call:e.function_call,tool_calls:n};this.__includeRawResponse!==void 0&&(a.__raw_response=r);let s={model_name:r.model,...r.system_fingerprint?{usage:{...r.usage},system_fingerprint:r.system_fingerprint}:{}};return e.audio&&(a.audio=e.audio),new fn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new fs(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 of({content:i,response_metadata:s});if(o==="assistant"){let u=[];if(Array.isArray(e.tool_calls))for(let l of e.tool_calls)u.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new or({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new fd({content:i,response_metadata:s}):o==="developer"?new fd({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new zp({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new eh({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new nf({content:i,role:o,response_metadata:s})}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}async*_streamResponseChunks(e,r,n){if(this._useResponseApi(r)){let l=await this.responseApiWithRetry({...this.invocationParams(r,{streaming:!0}),input:kEt(e,this.model),stream:!0},r);for await(let c of l){let d=_8r(c);d!=null&&(yield d)}return}let o=NAe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new Ln({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new Ln({message:new or({content:"",response_metadata:{usage:{...u}},usage_metadata:{input_tokens:u.prompt_tokens,output_tokens:u.completion_tokens,total_tokens:u.total_tokens,...Object.keys(l).length>0&&{input_token_details:l},...Object.keys(c).length>0&&{output_token_details:c}}}),text:""})}if(r.signal?.aborted)throw new Error("AbortError")}identifyingParams(){return this._identifyingParams()}async _responseApiGenerate(e,r,n){let o=this.invocationParams(r);if(o.stream){let s=this._streamResponseChunks(e,r,n),u;for await(let l of s)l.message.response_metadata={...l.generationInfo,...l.message.response_metadata},u=u?.concat(l)??l;return{generations:u?[u]:[],llmOutput:{estimatedTokenUsage:u?.message?.usage_metadata}}}let i=kEt(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:BEt(a)}],llmOutput:{id:a.id,estimatedTokenUsage:a.usage?{promptTokens:a.usage.input_tokens,completionTokens:a.usage.output_tokens,totalTokens:a.usage.total_tokens}:void 0}}}_useResponseApi(e){let r=e?.tools?.some(DAe),n=e?.previous_response_id!=null||e?.text!=null||e?.truncation!=null||e?.include!=null;return this.useResponsesApi||r||n}async _generate(e,r,n){if(this._useResponseApi(r))return this._responseApiGenerate(e,r,n);let o={},i=this.invocationParams(r),a=NAe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let b={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};b.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},hi(b.message)&&(b.message.usage_metadata=o),b.message=new fn(Object.fromEntries(Object.entries(b.message).filter(([g])=>!g.startsWith("lc_")))),p.push(b)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async getEstimatedTokenCountFromPrompt(e,r,n){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(r&&n!=="auto"){let i=NEt(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(LAe(a)),l=a.name!==void 0?o+await this.getNumTokens(a.name):0,c=s+n+u+l,d=a;if(d._getType()==="function"&&(c-=2),d.additional_kwargs?.function_call&&(c+=3),d?.additional_kwargs.function_call?.name&&(c+=await this.getNumTokens(d.additional_kwargs.function_call?.name)),d.additional_kwargs.function_call?.arguments)try{c+=await this.getNumTokens(JSON.stringify(JSON.parse(d.additional_kwargs.function_call?.arguments)))}catch(f){console.error("Error parsing function arguments",f,JSON.stringify(d.additional_kwargs.function_call)),c+=await this.getNumTokens(d.additional_kwargs.function_call?.arguments)}return r+=c,c}));return r+=3,{totalCount:r,countPerMessage:i}}async completionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.chat.completions.create(e,n)}catch(o){throw Ij(o)}})}async responseApiWithRetry(e,r){return this.caller.call(async()=>{let n=this._getClientOptions(r);try{return e.text?.format?.type==="json_schema"&&!e.stream?await this.client.responses.parse(e,n):await this.client.responses.create(e,n)}catch(o){throw Ij(o)}})}async betaParsedCompletionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.beta.chat.completions.parse(e,n)}catch(o){throw Ij(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=Aj(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Lt(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;w8r(e)?(n=e.schema,o=e.name,i=e.method,a=e.includeRaw):(n=e,o=r?.name,i=r?.method,a=r?.includeRaw);let s,u;if(r?.strict!==void 0&&i==="jsonMode")throw new Error("Argument `strict` is only supported for `method` = 'function_calling'");if(!this.model.startsWith("gpt-3")&&!this.model.startsWith("gpt-4-")&&this.model!=="gpt-4"?i===void 0&&(i="jsonSchema"):i==="jsonSchema"&&console.warn(`[WARNING]: JSON Schema is not supported for model "${this.model}". Falling back to tool calling.`),i==="jsonMode")s=this.bind({response_format:{type:"json_object"}}),qne(n)?u=pc.fromZodSchema(n):u=new mc;else if(i==="jsonSchema")if(s=this.bind({response_format:{type:"json_schema",json_schema:{name:o??"extract",description:n.description,schema:n,strict:r?.strict}}}),qne(n)){let f=pc.fromZodSchema(n);u=uf.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new mc;else{let f=o??"extract";if(qne(n)){let p=po(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 Lc({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 Lc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=so.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=so.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return si.from([{raw:s},d])}};function qne(t){return typeof t?.parse=="function"}function w8r(t){return t!==void 0&&typeof t.schema=="object"}ym();Rd();var kAe=class extends nO{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??et("OPENAI_API_KEY"),n=e?.organization??et("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new Lt(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(kAe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var Une=class extends I8{static lc_name(){return"ChatDeepSeek"}_llmType(){return"deepseek"}get lc_secrets(){return{apiKey:"DEEPSEEK_API_KEY"}}constructor(e){let r=e?.apiKey||et("DEEPSEEK_API_KEY");if(!r)throw new Error('Deepseek API key not found. Please set the DEEPSEEK_API_KEY environment variable or pass the key into "apiKey" field.');super({...e,apiKey:r,configuration:{baseURL:"https://api.deepseek.com",...e?.configuration}}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","deepseek"]})}_convertOpenAIDeltaToBaseMessageChunk(e,r,n){let o=super._convertOpenAIDeltaToBaseMessageChunk(e,r,n);return o.additional_kwargs.reasoning_content=e.reasoning_content,o}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=super._convertOpenAIChatCompletionMessageToBaseMessage(e,r);return n.additional_kwargs.reasoning_content=e.reasoning_content,n}withStructuredOutput(e,r){let n={...r};return n?.method===void 0&&(n.method="functionCalling"),super.withStructuredOutput(e,n)}};fc();Rd();var Mj="0.5.0";var qEt=!1,Rj,$Ae,S8r,x8r,C8r,BAe,O8r,zne,qAe,UAe,zAe,Hne,HAe;function UEt(t,e={auto:!1}){if(qEt)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(Rj)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${Rj}'\``);qEt=e.auto,Rj=t.kind,$Ae=t.fetch,S8r=t.Request,x8r=t.Response,C8r=t.Headers,BAe=t.FormData,O8r=t.Blob,zne=t.File,qAe=t.ReadableStream,UAe=t.getMultipartRequestOptions,zAe=t.getDefaultAgent,Hne=t.fileFromPath,HAe=t.isFsReadStream}var Vne=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function zEt({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 Vne(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}}Rj||UEt(zEt(),{auto:!0});var VAe={};$f(VAe,{APIConnectionError:()=>bO,APIConnectionTimeoutError:()=>jj,APIError:()=>Sl,APIUserAbortError:()=>AA,AuthenticationError:()=>BB,BadRequestError:()=>$B,ConflictError:()=>zB,GroqError:()=>Yl,InternalServerError:()=>WB,NotFoundError:()=>UB,PermissionDeniedError:()=>qB,RateLimitError:()=>VB,UnprocessableEntityError:()=>HB});var Yl=class extends Error{},Sl=class t extends Yl{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.error=r}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e)return new bO({cause:Wne(r)});let i=r;return e===400?new $B(e,i,n,o):e===401?new BB(e,i,n,o):e===403?new qB(e,i,n,o):e===404?new UB(e,i,n,o):e===409?new zB(e,i,n,o):e===422?new HB(e,i,n,o):e===429?new VB(e,i,n,o):e>=500?new WB(e,i,n,o):new t(e,i,n,o)}},AA=class extends Sl{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}},bO=class extends Sl{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},jj=class extends bO{constructor({message:e}={}){super({message:e??"Request timed out."})}},$B=class extends Sl{constructor(){super(...arguments),this.status=400}},BB=class extends Sl{constructor(){super(...arguments),this.status=401}},qB=class extends Sl{constructor(){super(...arguments),this.status=403}},UB=class extends Sl{constructor(){super(...arguments),this.status=404}},zB=class extends Sl{constructor(){super(...arguments),this.status=409}},HB=class extends Sl{constructor(){super(...arguments),this.status=422}},VB=class extends Sl{constructor(){super(...arguments),this.status=429}},WB=class extends Sl{};var Kne=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new WAe;async function*i(){if(!e.body)throw r.abort(),new Yl("Attempted to iterate over a response with no body");let s=new KB,u=HEt(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 Sl(void 0,l.error,void 0,void 0);yield l}}s=!0}catch(u){if(u instanceof Error&&u.name==="AbortError")return;throw u}finally{s||r.abort()}}return new t(a,r)}static fromReadableStream(e,r){let n=!1;async function*o(){let a=new KB,s=HEt(e);for await(let u of s)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let s of o())a||s&&(yield JSON.parse(s));a=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{a||r.abort()}}return new t(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller),new t(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new qAe({async start(){r=e[Symbol.asyncIterator]()},async pull(o){try{let{value:i,done:a}=await r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+`
`);o.enqueue(s)}catch(i){o.error(i)}},async cancel(){await r.return?.()}})}},WAe=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]=E8r(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},KB=class t{constructor(){this.buffer=[],this.trailingCR=!1}decode(e){let r=this.decodeText(e);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=t.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(t.NEWLINE_REGEXP);return o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new Yl(`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 Yl(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Yl("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}};KB.NEWLINE_CHARS=new Set([`
`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);KB.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;function E8r(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function HEt(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 VEt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",WEt=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Jne(t),Jne=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",T8r=t=>WEt(t)||VEt(t)||HAe(t);async function GAe(t,e,r){if(t=await t,r??(r=WEt(t)?{lastModified:t.lastModified,type:t.type}:{}),VEt(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file"),new zne([o],e,r)}let n=await A8r(t);if(e||(e=M8r(t)??"unknown_file"),!r.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new zne(n,e,r)}async function A8r(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Jne(t))e.push(await t.arrayBuffer());else if(R8r(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${I8r(t)}`);return e}function I8r(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function M8r(t){return KAe(t.name)||KAe(t.filename)||KAe(t.path)?.split(/[\\/]/).pop()}var KAe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},R8r=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",YAe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var M8=async t=>{let e=await KEt(t.body);return UAe(e,t)},KEt=async t=>{let e=new BAe;return await Promise.all(Object.entries(t||{}).map(([r,n])=>JAe(e,r,n))),e};var JAe=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(T8r(r)){let n=await GAe(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>JAe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>JAe(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 D8r=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},N8r=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)},Gne;async function QEt(t){let{response:e}=t;if(t.options.stream)return JB("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):Kne.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 JB("response",e.status,e.url,e.headers,i),i}let o=await e.text();return JB("response",e.status,e.url,e.headers,o),o}var Yne=class t extends Promise{constructor(e,r=QEt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>e(await this.parseResponse(r)))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},Zne=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=ZAe("maxRetries",r),this.timeout=ZAe("timeout",n),this.httpAgent=o,this.fetch=i??$Ae}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...$8r(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${W8r()}`}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&&Jne(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:YAe(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&&ZAe("timeout",e.timeout);let l=e.timeout??this.timeout,c=e.httpAgent??this.httpAgent??zAe(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 XEt(o,i),XEt(o,r),YAe(e.body)&&Rj!=="node"&&delete o["content-type"],this.validateHeaders(o,r),o}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(r=>[...r])):{...e}:{}}makeStatusError(e,r,n,o){return Sl.generate(e,r,n,o)}request(e,r=null){return new Yne(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}),JB("request",i,n,o.headers),n.signal?.aborted)throw new AA;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(Wne);if(u instanceof Error){if(n.signal?.aborted)throw new AA;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new jj:new bO({cause:u})}let l=L8r(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let h=`retrying, ${r} attempts remaining`;return JB(`response (error; ${h})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(h=>Wne(h).message),d=B8r(c),f=d?void 0:c;throw JB(`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 XAe(this,n,e)}buildURL(e,r){let n=U8r(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return H8r(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 Yl(`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 z8r(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 ${Mj}`}},JEt=class{constructor(e,r,n,o){Gne.set(this,void 0),D8r(this,Gne,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 Yl("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 N8r(this,Gne,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Gne=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},XAe=class extends Yne{constructor(e,r,n){super(r,async o=>new n(e,o.response,await QEt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},L8r=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}});var F8r=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Mj,"X-Stainless-OS":YEt(Deno.build.os),"X-Stainless-Arch":GEt(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":Mj,"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":Mj,"X-Stainless-OS":YEt(process.platform),"X-Stainless-Arch":GEt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=k8r();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Mj,"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":Mj,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function k8r(){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 GEt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",YEt=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"),ZEt,$8r=()=>ZEt??(ZEt=F8r()),B8r=t=>{try{return JSON.parse(t)}catch{return}},q8r=new RegExp("^(?:[a-z]+:)?//","i"),U8r=t=>q8r.test(t),z8r=t=>new Promise(e=>setTimeout(e,t)),ZAe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Yl(`${t} must be an integer`);if(e<0)throw new Yl(`${t} must be a positive integer`);return e},Wne=t=>t instanceof Error?t:new Error(t);var QAe=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function H8r(t){if(!t)return!0;for(let e in t)return!1;return!0}function V8r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function XEt(t,e){for(let r in e){if(!V8r(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 JB(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var W8r=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),eTt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";var Zl=class{constructor(e){this._client=e}};var Dj=class extends Zl{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",M8({body:e,...r}))}};Dj||(Dj={});var Nj=class extends Zl{create(e,r){return this._client.post("/openai/v1/audio/translations",M8({body:e,...r}))}};Nj||(Nj={});var IA=class extends Zl{constructor(){super(...arguments),this.transcriptions=new Dj(this._client),this.translations=new Nj(this._client)}};(function(t){t.Transcriptions=Dj,t.Translations=Nj})(IA||(IA={}));var Lj=class extends Zl{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}};Lj||(Lj={});var MA=class extends Zl{constructor(){super(...arguments),this.completions=new Lj(this._client)}};(function(t){t.Completions=Lj})(MA||(MA={}));var RA=class extends Zl{};RA||(RA={});var jA=class extends Zl{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}};jA||(jA={});var DA=class extends Zl{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)}};DA||(DA={});var tTt,as=class extends Zne{constructor({baseURL:e=QAe("GROQ_BASE_URL"),apiKey:r=QAe("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new Yl("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&&eTt())throw new Yl(`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 RA(this),this.chat=new MA(this),this.embeddings=new jA(this),this.audio=new IA(this),this.models=new DA(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}`}}};tTt=as;as.Groq=tTt;as.GroqError=Yl;as.APIError=Sl;as.APIConnectionError=bO;as.APIConnectionTimeoutError=jj;as.APIUserAbortError=AA;as.NotFoundError=UB;as.ConflictError=zB;as.RateLimitError=VB;as.BadRequestError=$B;as.AuthenticationError=BB;as.InternalServerError=WB;as.PermissionDeniedError=qB;as.UnprocessableEntityError=HB;as.toFile=GAe;as.fileFromPath=Hne;var{GroqError:AUo,APIError:IUo,APIConnectionError:MUo,APIConnectionTimeoutError:RUo,APIUserAbortError:jUo,NotFoundError:DUo,ConflictError:NUo,RateLimitError:LUo,BadRequestError:FUo,AuthenticationError:kUo,InternalServerError:$Uo,PermissionDeniedError:BUo,UnprocessableEntityError:qUo}=VAe;(function(t){t.Completions=RA,t.Chat=MA,t.Embeddings=jA,t.Audio=IA,t.Models=DA})(as||(as={}));var rTt=as;Jp();Mg();function X8r(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 nTt(t){return t.map(e=>{if(typeof e.content!="string")throw new Error("Non string message content not supported");let r={role:X8r(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 hi(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(NS):(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 Q8r(t,e){let r=t.tool_calls;switch(t.role){case"assistant":{let n=[],o=[];for(let i of r??[])try{n.push(xp(i,{returnId:!0}))}catch(a){o.push(Sm(i,a.message))}return new fn({content:t.content||"",additional_kwargs:{tool_calls:r},tool_calls:n,invalid_tool_calls:o,usage_metadata:e})}default:return new fs(t.content||"",t.role??"unknown")}}function e6r(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 t6r(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 of({content:o})};if(n==="assistant"){let u=e6r(t.tool_calls,e);return{message:new or({content:o,additional_kwargs:i,tool_call_chunks:u?u.map(l=>({type:l.type,args:l.args,index:l.index})):void 0,usage_metadata:a,id:s}),toolCallData:u?u.map(l=>({id:l.id??"",name:l.name??"",index:l.index??e,type:"tool_call_chunk"})):void 0}}else return n==="system"?{message:new fd({content:o})}:{message:new nf({content:o,role:n})}}var Xne=class extends Fs{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||et("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 rTt({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=>SS(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=nTt(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}=t6r({...d.delta,role:s},d.index,c.x_groq);if(p){let h=p.filter(b=>u.every(g=>g.id!==b.id));u.push(...h),yield new Ln({message:new or({content:"",tool_call_chunks:h}),text:""})}let m=new Ln({message:f,text:d.delta.content??"",generationInfo:{finishReason:d.finish_reason}});yield m,n?.handleLLMNewToken(m.text??"")}if(l&&("choices"in l&&delete l.choices,yield new Ln({message:new or({content:"",response_metadata:l}),text:""})),r.signal?.aborted)throw new Error("AbortError")}async _generate(e,r,n){if(this.streaming){let o={},i=this._streamResponseChunks(e,r,n),a={};for await(let u of i){let l=u.generationInfo?.completion??0;a[l]===void 0?a[l]=u:a[l]=a[l].concat(u)}return{generations:Object.entries(a).sort(([u],[l])=>parseInt(u,10)-parseInt(l,10)).map(([u,l])=>l),llmOutput:{estimatedTokenUsage:o}}}else return this._generateNonStreaming(e,r,n)}async _generateNonStreaming(e,r,n){let o={},i=this.invocationParams(r),a=nTt(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:Q8r(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"}}),Ls(n)?u=pc.fromZodSchema(n):u=new mc;else if(Ls(n)){let p=po(n);l=this.bind({tools:[{type:"function",function:{name:s,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:s}}}),u=new Lc({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 Lc({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=so.assign({parsed:(p,m)=>u.invoke(p.raw,m)}),d=so.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return si.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}};var Bc=[];for(Qne=0;Qne<256;++Qne)Bc.push((Qne+256).toString(16).slice(1));var Qne;function oTt(t,e=0){return(Bc[t[e+0]]+Bc[t[e+1]]+Bc[t[e+2]]+Bc[t[e+3]]+"-"+Bc[t[e+4]]+Bc[t[e+5]]+"-"+Bc[t[e+6]]+Bc[t[e+7]]+"-"+Bc[t[e+8]]+Bc[t[e+9]]+"-"+Bc[t[e+10]]+Bc[t[e+11]]+Bc[t[e+12]]+Bc[t[e+13]]+Bc[t[e+14]]+Bc[t[e+15]]).toLowerCase()}var eoe,r6r=new Uint8Array(16);function eIe(){if(!eoe&&(eoe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!eoe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return eoe(r6r)}var n6r=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tIe={randomUUID:n6r};function o6r(t,e,r){if(tIe.randomUUID&&!e&&!t)return tIe.randomUUID();t=t||{};var n=t.random||(t.rng||eIe)();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 oTt(n)}var toe=o6r;var mFt=$(cFt(),1),hFt=$(U8(),1);Rd();NN();Mg();Jp();fc();var idn=/^[a-zA-Z0-9]{9}$/;function adn(t){return idn.test(t)}function sdn(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 udn(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 BRe(t){if(adn(t))return t;{let e=udn(t),r=sdn(e);return r.length>=9?r.slice(0,9):r.padStart(9,"0")}}function qRe(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 dFt(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(hi(o)&&o.tool_calls?.length)return o.tool_calls.map(i=>({...i,id:BRe(i.id??"")})).map(NS)};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:BRe(o.tool_call_id)}:hi(o)?i===void 0?{role:e(o.getType()),content:a}:{role:e(o.getType()),toolCalls:i}:{role:e(o.getType()),content:a}})}function ldn(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=qRe(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=xp(s,{returnId:!0});i.push({...u,id:u.id??toe().replace(/-/g,"")})}catch(u){a.push(Sm(s,u.message))}return new fn({content:o,tool_calls:i,invalid_tool_calls:a,additional_kwargs:{},usage_metadata:e?{input_tokens:e.promptTokens,output_tokens:e.completionTokens,total_tokens:e.totalTokens}:void 0})}default:return new ps({content:o})}}function cdn(t,e){if(!t.content&&!t.toolCalls)return e?new or({content:"",usage_metadata:e?{input_tokens:e.promptTokens,output_tokens:e.completionTokens,total_tokens:e.totalTokens}:void 0}):null;let r=t.toolCalls?.length?t.toolCalls?.map((s,u)=>({...s,index:u,id:s.id??toe().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=qRe(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 of({content:o}):n==="assistant"?new or({content:o,tool_call_chunks:a,additional_kwargs:i,usage_metadata:e?{input_tokens:e.promptTokens,output_tokens:e.completionTokens,total_tokens:e.totalTokens}:void 0}):n==="tool"?new eh({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new zp({content:o,additional_kwargs:i}):new nf({content:o,role:n})}function fFt(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:po(e.schema)}}})}var sse=class extends Fs{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??et("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?fFt(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:fFt(e),...r})}async completionWithRetry(e,r){let n=new Vp({maxRetries:this.maxRetries}),o=new mFt.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=dFt(e),s={...i,messages:a},u=r.signal??!!r.timeout;if(this.streaming||u){let m=this._streamResponseChunks(e,r,n),h={};for await(let g of m){let _=g.generationInfo?.completion??0;h[_]===void 0?h[_]=g:h[_]=h[_].concat(g)}return{generations:Object.entries(h).sort(([g],[_])=>parseInt(g,10)-parseInt(_,10)).map(([g,_])=>_),llmOutput:{estimatedTokenUsage:o}}}let l=await this.completionWithRetry(s,!1),{completionTokens:c,promptTokens:d,totalTokens:f}=l?.usage??{};c&&(o.completionTokens=(o.completionTokens??0)+c),d&&(o.promptTokens=(o.promptTokens??0)+d),f&&(o.totalTokens=(o.totalTokens??0)+f);let p=[];for(let m of l?.choices??[]){if("delta"in m)throw new Error("Delta not supported in non-streaming mode.");if(!("message"in m))throw new Error("No message found in the choice.");let h=m.message?.content??"";Array.isArray(h)&&(h=h[0].type==="text"?h[0].text:"");let b={text:h,message:ldn(m,l?.usage)};m.finishReason&&(b.generationInfo={finishReason:m.finishReason}),p.push(b)}return{generations:p,llmOutput:{tokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=dFt(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=cdn(c,f?u.usage:null);if(p===null)continue;let m=c.content??"";Array.isArray(m)&&(m=m[0].type==="text"?m[0].text:"");let h=new Ln({message:p,text:m,generationInfo:d});yield h,n?.handleLLMNewToken(h.text??"",d,void 0,void 0,void 0,{chunk:h})}}addAllHooksToHttpClient(){try{if(this.removeAllHooksFromHttpClient(),[this.beforeRequestHooks,this.requestErrorHooks,this.responseHooks].some(r=>r&&r.length>0)&&!this.httpClient&&(this.httpClient=new hFt.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"}}),pFt(n)?u=pc.fromZodSchema(n):u=new mc;else{let f=o??"extract";if(pFt(n)){let p=po(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:"any"}),u=new Lc({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 Lc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=so.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=so.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return si.from([{raw:s},d])}};function pFt(t){return typeof t?.parse=="function"}Rd();Rd();ym();Jp();Mg();fc();function mD(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}fc();function _6(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function hD(t){let e;return t.constructor.name===Ef.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Pi.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=_6(t,"INVALID_TOOL_RESULTS"):t.status===401?e=_6(t,"MODEL_AUTHENTICATION"):t.status===429?e=_6(t,"MODEL_RATE_LIMIT"):t.status===404?e=_6(t,"MODEL_NOT_FOUND"):e=t,e}function URe(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 ddn(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function gFt(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(yFt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function yFt(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}: ${use(o,e)},`):r.push(`${n}?: ${use(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function use(t,e){if(ddn(t))return t.anyOf.map(r=>use(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["{",yFt(t,e+2),"}"].join(`
`);case"array":return t.items?`${use(t.items,e)}[]`:"any[]";default:return""}}function bFt(t,e){let r;if(Ul(t)){let n=hte({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:DT(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}function fdn(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 VRe(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(!fs.isInstance(t))throw new Error("Invalid generic chat message");return fdn(t)}default:throw new Error(`Unknown message type: ${e}`)}}function HRe(t,e){return t.flatMap(r=>{let n=VRe(r);n==="system"&&WRe(e)&&(n="developer");let o={role:n,content:r.content};if(r.name!=null&&(o.name=r.name),r.additional_kwargs.function_call!=null&&(o.function_call=r.additional_kwargs.function_call,o.content=""),hi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(NS),o.content=""):(r.additional_kwargs.tool_calls!=null&&(o.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(o.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let i={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[o,i]}return o})}var Sq="__openai_function_call_ids__";function _Ft(t,e){return t.flatMap(r=>{let n=VRe(r);if(n==="system"&&WRe(e)&&(n="developer"),n==="function")throw new Error("Function messages are not supported in Responses API");if(n==="tool"){let o=r;return o.additional_kwargs?.type==="computer_call_output"?{type:"computer_call_output",output:(()=>{if(typeof o.content=="string")return{type:"computer_screenshot",image_url:o.content};if(Array.isArray(o.content)){let a=o.content.find(u=>u.type==="computer_screenshot");if(a)return a;let s=o.content.find(u=>u.type==="image_url");if(s)return{type:"computer_screenshot",image_url:typeof s.image_url=="string"?s.image_url:s.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:o.tool_call_id}:{type:"function_call_output",call_id:o.tool_call_id,id:o.id,output:typeof o.content!="string"?JSON.stringify(o.content):o.content}}if(n==="assistant"){let o=[];r.additional_kwargs.reasoning!=null&&(u=>typeof u=="object"&&u!=null&&"type"in u&&u.type==="reasoning")(r.additional_kwargs.reasoning)&&o.push(r.additional_kwargs.reasoning);let{content:i}=r;r.additional_kwargs.refusal!=null&&(typeof i=="string"&&(i=[{type:"output_text",text:i,annotations:[]}]),i=[...i,{type:"refusal",refusal:r.additional_kwargs.refusal}]),o.push({type:"message",role:"assistant",content:typeof i=="string"?i:i.flatMap(s=>s.type==="text"?{type:"output_text",text:s.text,annotations:s.annotations??[]}:s.type==="output_text"||s.type==="refusal"?s:[])});let a=r.additional_kwargs[Sq];if(hi(r)&&r.tool_calls?.length?o.push(...r.tool_calls.map(s=>({type:"function_call",name:s.name,arguments:JSON.stringify(s.args),call_id:s.id,id:a?.[s.id]}))):r.additional_kwargs.tool_calls!=null&&o.push(...r.additional_kwargs.tool_calls.map(s=>({type:"function_call",name:s.function.name,call_id:s.id,id:a?.[s.id],arguments:s.function.arguments}))),r.additional_kwargs.tool_outputs!=null){let u=r.additional_kwargs.tool_outputs?.filter(l=>l.type==="computer_call");u.length>0&&o.push(...u)}return o}return n==="user"?{type:"message",role:"user",content:typeof r.content=="string"?r.content:r.content.flatMap(o=>{if(o.type==="text")return{type:"input_text",text:o.text};if(o.type==="image_url"){let i=typeof o.image_url=="string"?o.image_url:o.image_url.url,a=typeof o.image_url=="string"?"auto":o.image_url.detail;return{type:"input_image",image_url:i,detail:a}}return o.type==="input_text"||o.type==="input_image"||o.type==="input_file"?o:[]})}:[]})}function wFt(t){if(t.error){let a=new Error(t.error.message);throw a.name=t.error.code,a}let e=[],r=[],n=[],o={model:t.model,created_at:t.created_at,id:t.id,incomplete_details:t.incomplete_details,metadata:t.metadata,object:t.object,status:t.status,user:t.user,model_name:t.model},i={};for(let a of t.output)if(a.type==="message")e.push(...a.content.flatMap(s=>s.type==="output_text"?("parsed"in s&&s.parsed!=null&&(i.parsed=s.parsed),{type:"text",text:s.text,annotations:s.annotations}):s.type==="refusal"?(i.refusal=s.refusal,[]):s));else if(a.type==="function_call"){let s={function:{name:a.name,arguments:a.arguments},id:a.call_id};try{r.push(xp(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Sm(s,l))}i[Sq]??(i[Sq]={}),i[Sq][a.call_id]=a.id}else a.type==="reasoning"?i.reasoning=a:(i.tool_outputs??(i.tool_outputs=[]),i.tool_outputs.push(a));return new fn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function pdn(t){let e=[],r={},n,o=[],i={},a={},s;if(t.type==="response.output_text.delta")e.push({type:"text",text:t.delta,index:t.content_index});else if(t.type==="response.output_text.annotation.added")e.push({type:"text",text:"",annotations:[t.annotation],index:t.content_index});else if(t.type==="response.output_item.added"&&t.item.type==="message")s=t.item.id;else if(t.type==="response.output_item.added"&&t.item.type==="function_call")o.push({type:"tool_call_chunk",name:t.item.name,args:t.item.arguments,id:t.item.id,index:t.output_index}),a[Sq]={[t.item.call_id]:t.item.id};else if(t.type==="response.output_item.done"&&(t.item.type==="web_search_call"||t.item.type==="file_search_call"||t.item.type==="computer_call"))a.tool_outputs=[t.item];else if(t.type==="response.created")i.id=t.response.id,i.model_name=t.response.model,i.model=t.response.model;else if(t.type==="response.completed"){let u=wFt(t.response);n=t.response.usage,t.response.text?.format?.type==="json_schema"&&(a.parsed??(a.parsed=JSON.parse(u.text)));for(let[l,c]of Object.entries(t.response))l!=="id"&&(i[l]=c)}else if(t.type==="response.function_call_arguments.delta")o.push({type:"tool_call_chunk",args:t.delta,index:t.output_index});else if(t.type==="response.web_search_call.completed"||t.type==="response.file_search_call.completed")r={tool_outputs:{id:t.item_id,type:t.type.replace("response.","").replace(".completed",""),status:"completed"}};else if(t.type==="response.refusal.done")a.refusal=t.refusal;else return null;return new Ln({text:e.map(u=>u.text).join(""),message:new or({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function zRe(t){return"type"in t&&t.type!=="function"}function mdn(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function vFt(t,e){return Mc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:bFt(t,e)}function WRe(t){return t?.startsWith("o1")||t?.startsWith("o3")}var v6=class extends Fs{static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning_effort"]}get lc_secrets(){return{openAIApiKey:"OPENAI_API_KEY",apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{modelName:"model",openAIApiKey:"openai_api_key",apiKey:"openai_api_key"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","reasoningEffort","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","modelName","model","modelKwargs","stop","stopSequences","timeout","openAIApiKey","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming"]}constructor(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"logitBias",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gpt-3.5-turbo"}),Object.defineProperty(this,"modelKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topLogprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"openAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__includeRawResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportsStrictToolCalling",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modalities",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reasoningEffort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useResponsesApi",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.openAIApiKey=e?.apiKey??e?.openAIApiKey??e?.configuration?.apiKey??et("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??et("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelName=this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoningEffort=e?.reasoningEffort,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.useResponsesApi=e?.useResponsesApi??this.useResponsesApi,this.model==="o1"&&(this.disableStreaming=!0),this.streaming=e?.streaming??!1,this.streamUsage=e?.streamUsage??this.streamUsage,this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling)}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.bind({tools:e.map(o=>zRe(o)?o:vFt(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&lse(e.json_schema.schema)?q$(e.json_schema.schema,e.json_schema.name,{description:e.json_schema.description}):e}invocationParams(e,r){let n;if(e?.strict!==void 0?n=e.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this._useResponseApi(e)){let s={model:this.model,temperature:this.temperature,top_p:this.topP,user:this.user,stream:this.streaming,previous_response_id:e?.previous_response_id,truncation:e?.truncation,include:e?.include,tools:e?.tools?.length?e.tools.map(l=>zRe(l)?l:Mc(l)?{type:"function",name:l.function.name,parameters:l.function.parameters,description:l.function.description,strict:n}:null).filter(l=>l!==null):void 0,tool_choice:mdn(e?.tool_choice)?e?.tool_choice:(()=>{let l=URe(e?.tool_choice);if(typeof l=="object"&&"type"in l)return{type:"function",name:l.function.name}})(),text:(()=>{if(e?.text)return e.text;let l=this.createResponseFormat(e?.response_format);return l?.type==="json_schema"?l.json_schema.schema!=null?{format:{type:"json_schema",schema:l.json_schema.schema,description:l.json_schema.description,name:l.json_schema.name,strict:l.json_schema.strict}}:void 0:{format:l}})(),parallel_tool_calls:e?.parallel_tool_calls,max_output_tokens:this.maxTokens===-1?void 0:this.maxTokens,...this.modelKwargs},u=e?.reasoning_effort??this.reasoningEffort;return u!==void 0&&(s.reasoning={effort:u}),s}let o={};e?.stream_options!==void 0?o={stream_options:e.stream_options}:this.streamUsage&&(this.streaming||r?.streaming)&&(o={stream_options:{include_usage:!0}});let i={model:this.model,temperature:this.temperature,top_p:this.topP,frequency_penalty:this.frequencyPenalty,presence_penalty:this.presencePenalty,logprobs:this.logprobs,top_logprobs:this.topLogprobs,n:this.n,logit_bias:this.logitBias,stop:e?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:e?.functions,function_call:e?.function_call,tools:e?.tools?.length?e.tools.map(s=>vFt(s,{strict:n})):void 0,tool_choice:URe(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),WRe(i.model)?i.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens:i.max_tokens=this.maxTokens===-1?void 0:this.maxTokens,i}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=e.tool_calls;switch(e.role){case"assistant":{let o=[],i=[];for(let u of n??[])try{o.push(xp(u,{returnId:!0}))}catch(l){i.push(Sm(u,l.message))}let a={function_call:e.function_call,tool_calls:n};this.__includeRawResponse!==void 0&&(a.__raw_response=r);let s={model_name:r.model,...r.system_fingerprint?{usage:{...r.usage},system_fingerprint:r.system_fingerprint}:{}};return e.audio&&(a.audio=e.audio),new fn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new fs(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 of({content:i,response_metadata:s});if(o==="assistant"){let u=[];if(Array.isArray(e.tool_calls))for(let l of e.tool_calls)u.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new or({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new fd({content:i,response_metadata:s}):o==="developer"?new fd({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new zp({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new eh({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new nf({content:i,role:o,response_metadata:s})}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}async*_streamResponseChunks(e,r,n){if(this._useResponseApi(r)){let l=await this.responseApiWithRetry({...this.invocationParams(r,{streaming:!0}),input:_Ft(e,this.model),stream:!0},r);for await(let c of l){let d=pdn(c);d!=null&&(yield d)}return}let o=HRe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new Ln({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new Ln({message:new or({content:"",response_metadata:{usage:{...u}},usage_metadata:{input_tokens:u.prompt_tokens,output_tokens:u.completion_tokens,total_tokens:u.total_tokens,...Object.keys(l).length>0&&{input_token_details:l},...Object.keys(c).length>0&&{output_token_details:c}}}),text:""})}if(r.signal?.aborted)throw new Error("AbortError")}identifyingParams(){return this._identifyingParams()}async _responseApiGenerate(e,r,n){let o=this.invocationParams(r);if(o.stream){let s=this._streamResponseChunks(e,r,n),u;for await(let l of s)l.message.response_metadata={...l.generationInfo,...l.message.response_metadata},u=u?.concat(l)??l;return{generations:u?[u]:[],llmOutput:{estimatedTokenUsage:u?.message?.usage_metadata}}}let i=_Ft(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:wFt(a)}],llmOutput:{id:a.id,estimatedTokenUsage:a.usage?{promptTokens:a.usage.input_tokens,completionTokens:a.usage.output_tokens,totalTokens:a.usage.total_tokens}:void 0}}}_useResponseApi(e){let r=e?.tools?.some(zRe),n=e?.previous_response_id!=null||e?.text!=null||e?.truncation!=null||e?.include!=null;return this.useResponsesApi||r||n}async _generate(e,r,n){if(this._useResponseApi(r))return this._responseApiGenerate(e,r,n);let o={},i=this.invocationParams(r),a=HRe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let b={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};b.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},hi(b.message)&&(b.message.usage_metadata=o),b.message=new fn(Object.fromEntries(Object.entries(b.message).filter(([g])=>!g.startsWith("lc_")))),p.push(b)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async getEstimatedTokenCountFromPrompt(e,r,n){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(r&&n!=="auto"){let i=gFt(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(VRe(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 hD(o)}})}async responseApiWithRetry(e,r){return this.caller.call(async()=>{let n=this._getClientOptions(r);try{return e.text?.format?.type==="json_schema"&&!e.stream?await this.client.responses.parse(e,n):await this.client.responses.create(e,n)}catch(o){throw hD(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 hD(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=mD(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Lt(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;hdn(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"}}),lse(n)?u=pc.fromZodSchema(n):u=new mc;else if(i==="jsonSchema")if(s=this.bind({response_format:{type:"json_schema",json_schema:{name:o??"extract",description:n.description,schema:n,strict:r?.strict}}}),lse(n)){let f=pc.fromZodSchema(n);u=uf.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new mc;else{let f=o??"extract";if(lse(n)){let p=po(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 Lc({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 Lc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=so.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=so.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return si.from([{raw:s},d])}};function lse(t){return typeof t?.parse=="function"}function hdn(t){return t!==void 0&&typeof t.schema=="object"}ym();Rd();var KRe=class extends nO{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??et("OPENAI_API_KEY"),n=e?.organization??et("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new Lt(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(KRe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var cse=class extends v6{static lc_name(){return"ChatXAI"}_llmType(){return"xai"}get lc_secrets(){return{apiKey:"XAI_API_KEY"}}constructor(e){let r=e?.apiKey||et("XAI_API_KEY");if(!r)throw new Error('xAI API key not found. Please set the XAI_API_KEY environment variable or provide the key into "apiKey" field.');super({...e,model:e?.model||"grok-beta",apiKey:r,configuration:{baseURL:"https://api.x.ai/v1"}}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","xai"]})}toJSON(){let e=super.toJSON();return"kwargs"in e&&typeof e.kwargs=="object"&&e.kwargs!=null&&(delete e.kwargs.openai_api_key,delete e.kwargs.configuration),e}getLsParams(e){let r=super.getLsParams(e);return r.ls_provider="xai",r}async completionWithRetry(e,r){delete e.frequency_penalty,delete e.presence_penalty,delete e.logit_bias,delete e.functions;let n=e.messages.map(i=>i.content?i:{...i,content:""}),o={...e,messages:n};return o.stream===!0?super.completionWithRetry(o,r):super.completionWithRetry(o,r)}_convertOpenAIDeltaToBaseMessageChunk(e,r,n){let o=super._convertOpenAIDeltaToBaseMessageChunk(e,r,n);return r.choices[0]?.finish_reason?o.usage_metadata=o.response_metadata.usage:(delete o.response_metadata.usage,delete o.usage_metadata),o}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=super._convertOpenAIChatCompletionMessageToBaseMessage(e,r);return n.additional_kwargs.reasoning_content=e.reasoning_content,n}withStructuredOutput(e,r){let n={...r};return n?.method===void 0&&(n.method="functionCalling"),super.withStructuredOutput(e,n)}};var dse=require("obsidian"),gdn={openai:LS,"azure openai":LS,anthropic:$ne,cohereai:Oee,google:Mee,xai:cse,openrouterai:LS,ollama:Nee,"lm-studio":LS,groq:Xne,"3rd party (openai-format)":LS,"copilot-plus":LS,mistralai:sse,deepseek:Une},gD=class t{constructor(){this.providerApiKeyMap={openai:()=>ne().openAIApiKey,google:()=>ne().googleApiKey,"azure openai":()=>ne().azureOpenAIApiKey,anthropic:()=>ne().anthropicApiKey,cohereai:()=>ne().cohereApiKey,openrouterai:()=>ne().openRouterAiApiKey,groq:()=>ne().groqApiKey,xai:()=>ne().xaiApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>ne().plusLicenseKey,mistralai:()=>ne().mistralApiKey,deepseek:()=>ne().deepseekApiKey};this.buildModelMap(),Mi(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}async getModelConfig(e){let r=ne(),n=e.name,o=DM(n),i=n.startsWith("claude-3-7-sonnet")||n.startsWith("claude-sonnet-4"),a={modelName:n,streaming:e.stream??!0,maxRetries:3,maxConcurrency:3,enableCors:e.enableCors};i||(a.temperature=e.temperature??r.temperature);let u={openai:{modelName:n,openAIApiKey:await Wn(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?As:void 0,organization:await Wn(e.openAIOrgId||r.openAIOrgId)},...this.handleOpenAIExtraArgs(o,r.maxTokens,r.temperature)},anthropic:{anthropicApiKey:await Wn(e.apiKey||r.anthropicApiKey),model:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?As:void 0},...i&&{thinking:{type:"enabled",budget_tokens:1024}}},"azure openai":{modelName:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,openAIApiKey:await Wn(e.apiKey||r.azureOpenAIApiKey),configuration:{baseURL:e.baseUrl||`https://${e.azureOpenAIApiInstanceName||r.azureOpenAIApiInstanceName}.openai.azure.com/openai/deployments/${e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName}`,defaultQuery:{"api-version":e.azureOpenAIApiVersion||r.azureOpenAIApiVersion},defaultHeaders:{"Content-Type":"application/json","api-key":await Wn(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?As:void 0},...this.handleOpenAIExtraArgs(o,r.maxTokens,r.temperature)},cohereai:{apiKey:await Wn(e.apiKey||r.cohereApiKey),model:n},google:{apiKey:await Wn(e.apiKey||r.googleApiKey),modelName:n,safetySettings:[{category:T1.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:A1.BLOCK_NONE},{category:T1.HARM_CATEGORY_HATE_SPEECH,threshold:A1.BLOCK_NONE},{category:T1.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:A1.BLOCK_NONE},{category:T1.HARM_CATEGORY_HARASSMENT,threshold:A1.BLOCK_NONE}],baseUrl:e.baseUrl},xai:{apiKey:await Wn(e.apiKey||r.xaiApiKey),model:n},openrouterai:{modelName:n,openAIApiKey:await Wn(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?As:void 0}},groq:{apiKey:await Wn(e.apiKey||r.groqApiKey),modelName:n},ollama:{model:n,baseUrl:e.baseUrl||"http://localhost:11434",headers:new Headers({Authorization:`Bearer ${await Wn(e.apiKey||"default-key")}`})},"lm-studio":{modelName:n,openAIApiKey:e.apiKey||"default-key",configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?As:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await Wn(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?As:void 0,defaultHeaders:{"dangerously-allow-browser":"true"}},...this.handleOpenAIExtraArgs(o,r.maxTokens,r.temperature)},"copilot-plus":{modelName:n,openAIApiKey:await Wn(r.plusLicenseKey),configuration:{baseURL:GP,fetch:e.enableCors?As:void 0}},mistralai:{model:n,apiKey:await Wn(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl},deepseek:{modelName:n,apiKey:await Wn(e.apiKey||r.deepseekApiKey),configuration:{baseURL:e.baseUrl||QN.deepseek.host,fetch:e.enableCors?As:void 0}}}[e.provider]||{},l=i?{maxTokens:e.maxTokens??r.maxTokens}:this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature),c={...a,...u,...l};return i&&delete c.temperature,c}handleOpenAIExtraArgs(e,r,n){return e?{maxCompletionTokens:r,temperature:n===void 0?void 0:1}:{maxTokens:r,temperature:n}}buildModelMap(){let e=ne().activeModels;t.modelMap={};let r=t.modelMap;(e??lb).forEach(o=>{if(o.enabled){if(!Object.values(qx).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=Dr(o);r[u]={hasApiKey:!!(o.apiKey||s),AIConstructor:i,vendor:o.provider}}})}getProviderConstructor(e){let r=gdn[e.provider];if(!r)throw console.warn(`Unknown provider: ${e.provider} for model: ${e.name}`),new Error(`Unknown provider: ${e.provider} for model: ${e.name}`);return r}getChatModel(){if(!t.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return t.chatModel}async setChatModel(e){let r=Dr(e);try{let n=await this.createModelInstance(e);t.chatModel=n}catch(n){fe(n),new dse.Notice(`Error creating model: ${r}`)}}async createModelInstance(e){let r=Dr(e),n=t.modelMap[r];if(!n)throw new Error(`No model found for: ${r}`);if(!n.hasApiKey){let a=`API key is not provided for the model: ${r}.`;throw new dse.Notice(a),new Error(a)}let o=await this.getModelConfig(e);return new n.AIConstructor({...o})}validateChatModel(e){return e!=null}estimateTokens(e){return e?Math.ceil(e.length/4):0}async countTokens(e){try{return await Bx(async()=>t.chatModel?.getNumTokens(e)??0)}catch(r){if(r instanceof Error&&r.message.includes("Unknown model"))return ae("Using estimated token count due to tokenizer error"),this.estimateTokens(e);throw r}}validateCurrentModel(){if(!t.chatModel)return;let e=oK();if(!e)return;t.modelMap[e]?.hasApiKey||(t.chatModel=null,console.log("Failed to reinitialize model due to missing API key"))}async ping(e){let r=async n=>{let o={...e,enableCors:n},i=await this.getModelConfig(o),{streaming:a,maxTokens:s,maxCompletionTokens:u,...l}=i,c=DM(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 dse.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: `+En(n)+`
with CORS Error: `+En(o);throw new Error(i)}}}findModelByName(e){return ne().activeModels.find(n=>n.name===e)}};Jt();var xq=class{},SFt=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},fse=(t,e)=>{let r=SFt(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},JRe=(t,e)=>{let r=SFt(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};yM();OM();var GRe=class extends Vf{addUserMessage(e){return this.addMessage(new ps(e))}addAIChatMessage(e){return this.addMessage(new fn(e))}addAIMessage(e){return this.addMessage(new fn(e))}async addMessages(e){for(let r of e)await this.addMessage(r)}clear(){throw new Error("Not implemented.")}},Cq=class extends GRe{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 Iy=class extends xq{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 Cq,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(fse(e,this.inputKey)),await this.chatHistory.addAIChatMessage(JRe(r,this.outputKey))}async clear(){await this.chatHistory.clear()}};var w6=class extends Iy{constructor(e){super({chatHistory:e?.chatHistory,returnMessages:e?.returnMessages??!1,inputKey:e?.inputKey,outputKey:e?.outputKey}),Object.defineProperty(this,"humanPrefix",{enumerable:!0,configurable:!0,writable:!0,value:"Human"}),Object.defineProperty(this,"aiPrefix",{enumerable:!0,configurable:!0,writable:!0,value:"AI"}),Object.defineProperty(this,"memoryKey",{enumerable:!0,configurable:!0,writable:!0,value:"history"}),this.humanPrefix=e?.humanPrefix??this.humanPrefix,this.aiPrefix=e?.aiPrefix??this.aiPrefix,this.memoryKey=e?.memoryKey??this.memoryKey}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){let r=await this.chatHistory.getMessages();return this.returnMessages?{[this.memoryKey]:r}:{[this.memoryKey]:af(r,this.humanPrefix,this.aiPrefix)}}};YRe();HP();var S6=class extends Iy{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]:af(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}};Sfe();yM();YRe();var x6=class t{constructor(){this.initMemory(),Mi(()=>{let e=this.memory?.chatHistory;this.initMemory(e)})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initMemory(e){let r=ne().contextTurns;this.memory=new S6({k:r*2,memoryKey:"history",inputKey:"input",returnMessages:!0,chatHistory:e}),this.debug&&console.log("Memory initialized with context turns:",r)}getMemory(){return this.memory}async clearChatMemory(){this.debug&&console.log("Clearing chat memory"),await this.memory.clear()}async loadMemoryVariables(){let e=await this.memory.loadMemoryVariables({});return this.debug&&console.log("Loaded memory variables:",e),e}async saveContext(e,r){this.debug&&console.log("Saving to memory - Input:",e,"Output:",r),await this.memory.saveContext(e,r)}};Jt();HP();var C6=class t{constructor(){this.initChatPrompt(),this.initQAPrompt(),Mi(()=>{this.initChatPrompt(),this.initQAPrompt()}),aL(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initChatPrompt(){let e=KP(),r=hc();r&&$M()&&(e=r.systemPrompt);let n=this.escapeTemplateString(e);this.chatPrompt=Xf.fromMessages([zP.fromTemplate(n),new sb("history"),ub.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=Xf.fromMessages([zP.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 O6=class{constructor(e,r){this.retrievedDocuments=[];this.chatMessages=[];this.chatMessages=[],this.app=e,this.vectorStoreManager=r,this.memoryManager=x6.getInstance(),this.chatModelManager=gD.getInstance(),this.promptManager=C6.getInstance(),this.initialize(),Mi(async()=>{await this.createChainWithNewModel()})}getRetrievedDocuments(){return this.retrievedDocuments}async initialize(){await this.createChainWithNewModel()}getChain(){return this.chain}getRetrievalChain(){return this.retrievalChain}validateChainType(e){if(e==null)throw new Error("No chain type set")}validateChatModel(){if(!this.chatModelManager.validateChatModel(this.chatModelManager.getChatModel())){let e="Chat model is not initialized properly, check your API key in Copilot setting and make sure you have API access.";throw new pse.Notice(e),new Error(e)}}validateChainInitialization(){(!this.chain||!XUe(this.chain))&&(console.error("Chain is not initialized properly, re-initializing chain: ",hb()),this.createChainWithNewModel({},!1))}storeRetrieverDocuments(e){this.retrievedDocuments=e}async createChainWithNewModel(e={},r=!0){let n=hb(),o=hc();if(n==="project"&&!o)return;let i=n==="project"?o?.projectModelKey:oK();if(!i)throw new pse.Notice("No model key found"),new Error("No model key found");try{if(r){let a=H9(i,ne().activeModels);if(a||(console.error("Resetting default model. No model configuration found for: ",i),a=lb[0],i=a.name+"|"+a.provider),n==="project"&&!a.projectEnabled){let u=ne().activeModels.find(l=>l.enabled&&l.projectEnabled);if(u)a=u,i=u.name+"|"+u.provider,new pse.Notice(`Model ${a.name} is not available in project mode. Switching to ${u.name}.`);else throw new Error("No project-enabled models available. Please enable a model for project mode in settings.")}let s={...a,...o?.modelConfigs};await this.chatModelManager.setChatModel(s)}this.setChain(n,e),ae(`Setting model to ${i}`)}catch(a){fe(`createChainWithNewModel failed: ${a}`),ae(`modelKey: ${i}`)}}async setChain(e,r={}){if(!this.chatModelManager.validateChatModel(this.chatModelManager.getChatModel())){console.error("setChain failed: No chat model set.");return}this.validateChainType(e);let n=this.chatModelManager.getChatModel(),o=this.memoryManager.getMemory(),i=this.promptManager.getChatPrompt();switch(e){case"llm_chain":{this.chain=Mz.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),FM("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=new sA({minSimilarityScore:.01,maxK:ne().maxSourceChunks,salientTerms:[]});this.retrievalChain=Mz.createConversationalRetrievalChain({llm:n,retriever:a,systemMessage:KP()},this.storeRetrieverDocuments.bind(this),ne().debug),FM("vault_qa"),ne().debug&&(console.log("New Vault QA chain with hybrid retriever created for entire vault"),console.log("Set chain:","vault_qa"));break}case"copilot_plus":{await this.initializeQAChain(r),this.chain=Mz.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),FM("copilot_plus");break}case"project":{await this.initializeQAChain(r),this.chain=Mz.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),FM("project");break}default:this.validateChainType(e);break}}getChainRunner(){let e=hb();switch(e){case"llm_chain":return new une(this);case"vault_qa":return new lne(this);case"copilot_plus":return new a8(this);case"project":return new cne(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||DM(u)){let c=Xf.fromMessages([new sb("history"),ub.fromTemplate("{input}")]);DM(u)&&(c=Xf.fromMessages([[gi,KP()||""],c])),this.createChainWithNewModel({prompt:c},!1)}return await this.getChainRunner().run(e,r,n,o,i)}async updateMemoryWithLoadedMessages(e){await this.memoryManager.clearChatMemory();for(let r=0;r<e.length;r+=2){let n=e[r],o=e[r+1];n&&o&&n.sender===gi&&await this.memoryManager.getMemory().saveContext({input:n.message},{output:o.message})}}clearHistory(){this.chatMessages=[]}getChatMessages(){return this.chatMessages}setChatMessages(e){this.chatMessages=[...e]}addChatMessage(e){this.chatMessages.push(e)}};var Hl=class t{constructor(e,r,n){this.defaultProjectKey="defaultProjectKey";this.app=e,this.plugin=n,this.currentProjectId=null,this.chainMangerInstance=new O6(e,r),this.projectContextCache=hy.getInstance(),this.chatMessageCache=new Map,this.fileParserManager=new aA(Ei.getInstance(),this.app.vault,!0,null),kze(async()=>{await this.getCurrentChainManager().createChainWithNewModel()}),$ze(async()=>{$M()||await this.getCurrentChainManager().createChainWithNewModel({refreshIndex:ne().indexVaultToVectorStore==="ON MODE SWITCH"&&(hb()==="vault_qa"||hb()==="copilot_plus")})}),aL(async o=>{await this.switchProject(o)}),this.setupProjectListChangeMonitor()}setupProjectListChangeMonitor(){Mi(async(e,r)=>{if(!e||!r)return;let n=e.projectList||[],o=r.projectList||[];for(let i of o){let a=n.find(s=>s.id===i.id);a&&JSON.stringify(a)!==JSON.stringify(i)&&(await this.compareAndUpdateCache(a,i),this.currentProjectId===i.id&&await Promise.all([this.loadProjectContext(i),this.getCurrentChainManager().createChainWithNewModel()]))}})}static getInstance(e,r,n){return t.instance||(t.instance=new t(e,r,n)),t.instance}getCurrentChainManager(){return this.chainMangerInstance}async switchProject(e){try{if(XP(!0),ae("Project loading started..."),!e){await this.saveCurrentProjectMessage(),this.currentProjectId=null,await this.loadNextProjectMessage(),this.refreshChatView();return}let r=e.id;if(this.currentProjectId===r)return;await this.saveCurrentProjectMessage(),this.currentProjectId=r,await this.loadNextProjectMessage(),await this.getCurrentChainManager().createChainWithNewModel(),this.fileParserManager=new aA(Ei.getInstance(),this.app.vault,!0,e),await this.loadProjectContext(e),this.refreshChatView(),ae(`Switched to project: ${e.name}`)}catch(r){throw fe(`Failed to switch project: ${r}`),r}finally{XP(!1)}}async saveCurrentProjectMessage(){this.chatMessageCache.set(this.currentProjectId?this.currentProjectId:this.defaultProjectKey,this.getCurrentChainManager().getChatMessages()),await this.plugin.autosaveCurrentChat()}async loadNextProjectMessage(){let e=this.getCurrentChainManager(),r=this.chatMessageCache.get(this.currentProjectId?this.currentProjectId:this.defaultProjectKey)??[];e.setChatMessages(r),await cj(r,e.memoryManager)}async loadProjectContext(e){try{if(!e.contextSource)return kx(`[loadProjectContext] Project ${e.name}: No contextSource. Aborting.`),null;ae(`[loadProjectContext] Starting for project: ${e.name}`);let r=await this.projectContextCache.get(e),n=r||{markdownContext:"",webContexts:{},youtubeContexts:{},fileContexts:{},timestamp:Date.now(),markdownNeedsReload:!0};r?ae(`[loadProjectContext] Project ${e.name}: Existing cache found. MarkdownNeedsReload: ${n.markdownNeedsReload}`):ae(`[loadProjectContext] Project ${e.name}: No existing cache found, building fresh context.`);let[o]=await Promise.all([this.processMarkdownFiles(e,n),this.processWebUrls(e,n),this.processYoutubeUrls(e,n)]);if(o.fileContexts){let i=Object.keys(o.fileContexts).length;if(ae(`[loadProjectContext] Project ${e.name}: Checking ${i} fileContexts for non-markdown processing.`),i>0){this.fileParserManager=new aA(Ei.getInstance(),this.app.vault,!0,e);let a=0;for(let s in o.fileContexts){let u=this.app.vault.getAbstractFileByPath(s);if(u instanceof P6.TFile&&u.extension!=="md"&&this.fileParserManager.supportsExtension(u.extension))try{await this.projectContextCache.getFileContext(e,s)||(ae(`[loadProjectContext] Project ${e.name}: Parsing/caching new/updated file: ${s}`),await this.fileParserManager.parseFile(u,this.app.vault),a++)}catch(l){fe(`[loadProjectContext] Project ${e.name}: Error parsing file ${s}:`,l)}}a>0&&ae(`[loadProjectContext] Project ${e.name}: Processed and cached ${a} non-markdown files.`)}}return o.timestamp=Date.now(),await this.projectContextCache.set(e,o),ae(`[loadProjectContext] Completed for project: ${e.name}.`),o}catch(r){throw fe(`[loadProjectContext] Failed for project ${e.name}:`,r),r}}async compareAndUpdateCache(e,r){try{if(!await this.projectContextCache.get(e))return!0;let o=e.contextSource?.inclusions||"",i=r.contextSource?.inclusions||"",a=e.contextSource?.exclusions||"",s=r.contextSource?.exclusions||"";(o!==i||a!==s)&&(await this.projectContextCache.invalidateMarkdownContext(r),ae(`Markdown configuration changed for project ${r.name}, marking for reload`));let u=e.contextSource?.webUrls||"",l=r.contextSource?.webUrls||"";if(u!==l){let f=u.split(`
`).filter(m=>m.trim()),p=l.split(`
`).filter(m=>m.trim());for(let m of f)p.includes(m)||await this.projectContextCache.removeWebUrl(r,m)}let c=e.contextSource?.youtubeUrls||"",d=r.contextSource?.youtubeUrls||"";if(c!==d){let f=c.split(`
`).filter(m=>m.trim()),p=d.split(`
`).filter(m=>m.trim());for(let m of f)p.includes(m)||await this.projectContextCache.removeYoutubeUrl(r,m)}}catch(n){fe(`Error comparing project configurations: ${n}`)}}refreshChatView(){let e=this.app.workspace.getLeavesOfType(hs)[0]?.view;e&&e.updateView()}async getProjectContext(e){let r=ne().projectList.find(o=>o.id===e);if(!r)return kx(`[getProjectContext] Project not found for ID: ${e}`),null;ae(`[getProjectContext] Getting context for project: ${r.name} (ID: ${e})`);let n=this.projectContextCache.getSync(r);if(!n||n.markdownNeedsReload){n?ae(`[getProjectContext] Project ${r.name}: Markdown needs reload. Triggering full load.`):ae(`[getProjectContext] Project ${r.name}: Memory cache miss. Triggering full load.`);let o=await this.loadProjectContext(r);if(!o)return fe(`[getProjectContext] Project ${r.name}: loadProjectContext returned null.`),null;n=o}else ae(`[getProjectContext] Project ${r.name}: Memory cache hit and markdown OK. Using existing context.`);return this.formatProjectContextWithFiles(n,r)}async formatProjectContextWithFiles(e,r){let n=[];if(e.markdownContext&&n.push(`## Markdown Files
${e.markdownContext}`),Object.keys(e.webContexts).length>0&&n.push(`## Web Content
${Object.values(e.webContexts).join(`
`)}`),Object.keys(e.youtubeContexts).length>0&&n.push(`## YouTube Content
${Object.values(e.youtubeContexts).join(`
`)}`),Object.keys(e.fileContexts).length>0){let o=Object.entries(e.fileContexts).filter(([i])=>i.split(".").pop()?.toLowerCase()!=="md");if(o.length>0){let i=o.map(async([s,u])=>{let l=s.split("/"),c=l[l.length-1],d=c.split(".").pop()||"",f=await this.projectContextCache.getFileContext(r,s)||"[Content not available]";return`[[${c}]]
path: ${s}
type: ${d}
modified: ${new Date(u.timestamp).toISOString()}
${f}`}),a=await Promise.all(i);a.length>0&&n.push(`## Other Files
${a.join(`
`)}`)}}return`
# Project Context
The following information is the relevant context for this project. Use this information to inform your responses when appropriate:
<ProjectContext>
${n.join(`
`)}
</ProjectContext>
`}formatProjectContext(e){let r=[];if(e.markdownContext&&r.push(`## Markdown Files
${e.markdownContext}`),Object.keys(e.webContexts).length>0&&r.push(`## Web Content
${Object.values(e.webContexts).join(`
`)}`),Object.keys(e.youtubeContexts).length>0&&r.push(`## YouTube Content
${Object.values(e.youtubeContexts).join(`
`)}`),Object.keys(e.fileContexts).length>0){let n="";for(let[o,i]of Object.entries(e.fileContexts)){let a=o.split("/"),s=a[a.length-1],u=s.split(".").pop()||"";n+=`[[${s}]]
path: ${o}
type: ${u}
modified: ${new Date(i.timestamp).toISOString()}
`}n&&r.push(`## Other Files
${n}`)}return`
# Project Context
The following information is the relevant context for this project. Use this information to inform your responses when appropriate:
<ProjectContext>
${r.join(`
`)}
</ProjectContext>
`}async processMarkdownFiles(e,r){ae(`[processMarkdownFiles] Starting for project: ${e.name}`);let n=Object.keys(r.fileContexts||{}).length;if(e.contextSource?.inclusions||e.contextSource?.exclusions){r=await this.projectContextCache.updateProjectFilesFromPatterns(e,r);let o=Object.keys(r.fileContexts||{}).length;if(o>n&&ae(`[processMarkdownFiles] Project ${e.name}: Added ${o-n} new file references via updateProjectFilesFromPatterns.`),r.markdownNeedsReload||!r.markdownContext||!r.markdownContext.trim()){ae(`[processMarkdownFiles] Project ${e.name}: Processing markdown content.`);let i=await this.processFileContext(e.contextSource.inclusions,e.contextSource.exclusions,e);r.markdownContext=i,r.markdownNeedsReload=!1,ae(`[processMarkdownFiles] Project ${e.name}: Markdown content updated.`)}else ae(`[processMarkdownFiles] Project ${e.name}: Markdown content already up-to-date.`)}return ae(`[processMarkdownFiles] Completed for project: ${e.name}. Total fileContexts: ${Object.keys(r.fileContexts||{}).length}`),r}async processFileContext(e,r,n){if(!e&&!r||!n)return"";let{inclusions:o,exclusions:i}=Om({inclusions:e,exclusions:r,isProject:!0}),a=this.app.vault.getFiles().filter(u=>u.extension==="md"&&Cp(u,o,i));ae(`Found ${a.length} markdown files to process for project context`);let s=await Promise.all(a.map(async u=>{let l="",c="";try{let d=await this.app.vault.adapter.stat(u.path);c=`[[${u.basename}]]
path: ${u.path}
type: ${u.extension}
created: ${d?new Date(d.ctime).toISOString():"unknown"}
modified: ${d?new Date(d.mtime).toISOString():"unknown"}`,l=await this.app.vault.read(u),ae(`Completed processing markdown file: ${u.path}`)}catch(d){fe(`Error processing file ${u.path}: ${d}`),l=`[Error: ${En(d)}]`}return`${c}
${l}`}));return ae("All markdown files processed for project context"),s.join(`
`)}async processWebUrls(e,r){ae(`[processWebUrls] Starting for project: ${e.name}`);let n=e.contextSource?.webUrls?.trim()||"";if(!n)return Object.keys(r.webContexts).length>0&&(ae(`[processWebUrls] Project ${e.name}: Clearing all Web contexts as none are configured.`),r.webContexts={}),r;let o=n.split(`
`).filter(c=>c.trim());ae(`[processWebUrls] Project ${e.name}: Found ${o.length} URLs in config.`);let i=Object.keys(r.webContexts),a=o.filter(c=>!r.webContexts[c]);a.length>0&&ae(`[processWebUrls] Project ${e.name}: Fetching content for ${a.length} new/updated Web URLs.`);let s=i.filter(c=>!o.includes(c));if(s.length>0){ae(`[processWebUrls] Project ${e.name}: Removing ${s.length} obsolete Web URL contexts.`);for(let c of s)delete r.webContexts[c]}let u=a.map(async c=>{let d=await this.processWebUrlsContext(c);return d&&ae(`[processWebUrls] Project ${e.name}: Successfully fetched content for URL: ${c.substring(0,50)}...`),{url:c,context:d}});return(await Promise.all(u)).forEach(c=>{c&&c.context?r.webContexts[c.url]=c.context:c&&!c.context&&kx(`[processWebUrls] Project ${e.name}: Fetched empty content for Web URL: ${c.url}`)}),ae(`[processWebUrls] Completed for project: ${e.name}. Total Web contexts: ${Object.keys(r.webContexts).length}`),r}async processYoutubeUrls(e,r){ae(`[processYoutubeUrls] Starting for project: ${e.name}`);let n=e.contextSource?.youtubeUrls?.trim()||"";if(!n)return Object.keys(r.youtubeContexts).length>0&&(ae(`[processYoutubeUrls] Project ${e.name}: Clearing all YouTube contexts as none are configured.`),r.youtubeContexts={}),r;let o=n.split(`
`).filter(c=>c.trim());ae(`[processYoutubeUrls] Project ${e.name}: Found ${o.length} YouTube URLs in config.`);let i=Object.keys(r.youtubeContexts),a=o.filter(c=>!r.youtubeContexts[c]);a.length>0&&ae(`[processYoutubeUrls] Project ${e.name}: Fetching transcripts for ${a.length} new/updated YouTube URLs.`);let s=i.filter(c=>!o.includes(c));if(s.length>0){ae(`[processYoutubeUrls] Project ${e.name}: Removing ${s.length} obsolete YouTube URL contexts.`);for(let c of s)delete r.youtubeContexts[c]}let u=a.map(async c=>{let d=await this.processYoutubeUrlsContext(c);return d&&ae(`[processYoutubeUrls] Project ${e.name}: Successfully fetched transcript for YouTube URL: ${c.substring(0,50)}...`),{url:c,context:d}});return(await Promise.all(u)).forEach(c=>{c&&c.context?r.youtubeContexts[c.url]=c.context:c&&!c.context&&kx(`[processYoutubeUrls] Project ${e.name}: Fetched empty transcript for YouTube URL: ${c.url}`)}),ae(`[processYoutubeUrls] Completed for project: ${e.name}. Total YouTube contexts: ${Object.keys(r.youtubeContexts).length}`),r}async processWebUrlsContext(e){if(!e?.trim())return"";try{let r=oB.getInstance(),{urlContext:n}=await r.processUrls(e);return n||""}catch(r){return fe(`Failed to process web URLs: ${r}`),new P6.Notice(`Failed to process web URLs: ${En(r)}`),""}}async processYoutubeUrlsContext(e){if(!e?.trim())return"";let n=e.split(`
`).filter(i=>i.trim()).map(async i=>{try{let a=await Ei.getInstance().youtube4llm(i);return a.response.transcript?`
YouTube transcript from ${i}:
${a.response.transcript}`:""}catch(a){return fe(`Failed to process YouTube URL ${i}: ${a}`),new P6.Notice(`Failed to process YouTube URL ${i}: ${En(a)}`),""}});return(await Promise.all(n)).join("")}onunload(){this.projectContextCache.cleanup()}};Zr();mo();Jt();ZRe();Zr();mo();Jt();var ag=require("@codemirror/view"),iP=require("@codemirror/state");function EFt(t,e,r=void 0){let n={force:()=>{}},o=null;async function*i(...a){o&&clearTimeout(o);let s=null;try{await new Promise(u=>{s=o=setTimeout(()=>u(),e),n.force=()=>{o&&clearTimeout(o),u()}})}catch{if(r!==void 0)throw r}for await(let u of t(...a)){if(s!==o)break;yield u}}return{debounced:i,force:()=>n.force()}}var vdn=Object.defineProperty,wdn=(t,e,r)=>e in t?vdn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Oq=(t,e,r)=>(wdn(t,typeof e!="symbol"?e+"":e,r),r),mse=iP.StateField.define({create(){return{suggestion:null}},update(t,e){let r=e.effects.find(n=>n.is(r1e));return e.state.doc&&r&&(r.value.doc==null||e.state.doc==r.value.doc)?{suggestion:r.value.suggestion}:{suggestion:null}}}),r1e=iP.StateEffect.define();function Sdn(t,e){let r=t.state.selection.main.head,n=[],o=ag.Decoration.widget({widget:new XRe(e),side:1});return n.push(o.range(r)),ag.Decoration.set(n)}var XRe=class extends ag.WidgetType{constructor(e){super(),Oq(this,"suggestion"),this.suggestion=e}toDOM(){let e=document.createElement("span");return e.style.opacity="0.4",e.className="cm-inline-suggestion",e.textContent=this.suggestion,e}},QRe=t=>{let e=0;return ag.ViewPlugin.fromClass(class{async update(r){let n=r.state.doc;if(!r.docChanged)return;let o=++e;for await(let i of t(r.state)){if(o!=e)return;r.view.dispatch({effects:r1e.of({suggestion:i,doc:n})})}}})},e1e=class{constructor(){Oq(this,"decorations"),this.decorations=ag.Decoration.none}update(e){var r;let n=(r=e.state.field(mse))==null?void 0:r.suggestion;if(!n){this.decorations=ag.Decoration.none;return}this.decorations=Sdn(e.view,n.display_suggestion)}},TFt=ag.ViewPlugin.fromClass(e1e,{decorations:t=>t.decorations}),t1e=class{constructor(e,r){Oq(this,"suggestFn"),Oq(this,"keymap"),Oq(this,"completionId"),Oq(this,"run",n=>{var o,i;let a=(o=n.state.field(mse))==null?void 0:o.suggestion;return a?(n.dispatch({...xdn(n.state,a.complete_suggestion,n.state.selection.main.head,n.state.selection.main.head)}),(i=a.accept_hook)==null||i.call(a),(async()=>{if(this.suggestFn==null)return;let s=++this.completionId;for await(let u of this.suggestFn(n.state)){if(s!=this.completionId)return;n.dispatch({effects:r1e.of({suggestion:{complete_suggestion:u.complete_suggestion,display_suggestion:u.display_suggestion,accept_hook:u.accept_hook},doc:null})})}})(),!0):!1}),this.suggestFn=e,this.keymap=iP.Prec.highest(ag.keymap.of([{key:r,run:n=>this.run(n)}])),this.completionId=0}};function xdn(t,e,r,n){return{...t.changeByRange(o=>{if(o==t.selection.main)return{changes:{from:r,to:n,insert:e},range:iP.EditorSelection.cursor(r+e.length)};let i=n-r;return!o.empty||i&&t.sliceDoc(o.from-i,o.from)!=t.sliceDoc(r,n)?{range:o}:{changes:{from:o.from-i,to:o.from,insert:e},range:iP.EditorSelection.cursor(o.from-i+e.length)}}),userEvent:"input.complete"}}function AFt(t){return typeof t=="string"?{complete_suggestion:t,display_suggestion:t}:t}function Cdn(t){return async function*(e){let r=await t(e);if(typeof r=="string"||"complete_suggestion"in r){yield AFt(r);return}for await(let n of r)yield AFt(n)}}function hse(t){let{delay:e=500,accept_shortcut:r="Tab"}=t,n=Cdn(t.fetchFn),{debounced:o,force:i}=EFt(n,e);return{extension:r?[mse,QRe(o),TFt,new t1e(t.continue_suggesting?n:null,r).keymap]:[mse,QRe(o),TFt],force_fetch:i}}var s1e=require("obsidian");var n1e=class{process(e){let{prefix:r,suffix:n}=e,{completion:o}=e;return o=this.removeWordOverlapPrefix(r,o),o=this.removeWordOverlapSuffix(o,n),o=this.removeCharacterOverlapPrefix(r,o),o=this.removeCharacterOverlapSuffix(o,n),o.startsWith(" ")&&this.endsWithMarker(r)&&(o=o.trimStart()),o}removeWordOverlapPrefix(e,r){let n=r.trimStart(),o=this.getPotentialPrefixSegments(e);for(let i of o)if(n.startsWith(i))return n.substring(i.length);return r}removeWordOverlapSuffix(e,r){let n=r.trimStart(),o=this.getPotentialCompletionSegments(e);for(let i of o)if(n.startsWith(i)&&e.endsWith(i))return e.substring(0,e.length-i.length);return e}removeCharacterOverlapPrefix(e,r){let n=e.length-1,o=0,i=0;for(;o<r.length&&n>=0&&r[o]===e[n]&&this.isWhiteSpaceOrCommonMarker(r[o]);)i++,n--,o++;return i>0?r.substring(i):r}removeCharacterOverlapSuffix(e,r){let n=0,o=e.length-1,i=0;for(;n<r.length&&o>=0&&e[o]===r[n]&&this.isWhiteSpaceOrCommonMarker(e[o]);)i++,n++,o--;return i>0?e.substring(0,e.length-i):e}getPotentialPrefixSegments(e){let r=[],n=this.startLocationOfEachWordOrMarker(e);for(let o=n.length-1;o>=0;o--)r.push(e.substring(n[o]));return e.length>0&&(r.length===0||r[r.length-1]!==e)&&r.push(e),e.length>1&&(r.length===0||r[r.length-1]!==e.slice(-1))&&r.push(e.slice(-1)),e.length>2&&(r.length===0||r[r.length-1]!==e.slice(-2))&&r.push(e.slice(-2)),[...new Set(r)].sort((o,i)=>i.length-o.length)}getPotentialCompletionSegments(e){let r=[],n=this.startLocationOfEachWordOrMarker(e);for(let o=0;o<n.length;o++)for(let i=o;i<n.length;i++){let a=i+1<n.length?n[i+1]:e.length;r.push(e.substring(n[o],a))}return e.length>0&&(r.length===0||r[r.length-1]!==e)&&r.push(e),[...new Set(r)].sort((o,i)=>i.length-o.length)}startLocationOfEachWordOrMarker(e){let r=[];if(e.length===0)return r;this.isWhiteSpaceChar(e[0])||r.push(0);for(let n=1;n<e.length;n++){let o=this.isWhiteSpaceChar(e[n-1]),i=this.isWhiteSpaceChar(e[n]),a=this.isCommonMarker(e[n-1]),s=this.isCommonMarker(e[n]);o&&!i||a&&!s&&!i?r.push(n):(!a&&s||o&&s)&&(r.includes(n)||r.push(n))}return r}isWhiteSpaceChar(e){return e!==void 0&&/\s/.test(e)}isCommonMarker(e){return e!==void 0&&/[-*>#$]/.test(e)}isWhiteSpaceOrCommonMarker(e){return this.isWhiteSpaceChar(e)||this.isCommonMarker(e)}endsWithMarker(e){if(e.length===0)return!1;if(this.isCommonMarker(e[e.length-1]))return!0;let r=e.length>=2?e.slice(-2):"",n=e.length>=3?e.slice(-3):"";return!!(r==="##"||r.match(/^#{1,6} $/)||r==="--"||n==="-->"||e.includes("## Heading"))}},o1e=class{process(e){let{prefix:r,suffix:n,completion:o,context:i}=e,a=o;return r.endsWith(" ")&&a.startsWith(" ")&&(a=a.trimStart()),n.startsWith(" ")&&a.endsWith(" ")&&(a=a.trimEnd()),(i==="UnorderedList"||i==="NumberedList"||i==="TaskList")&&r.endsWith(`
`)&&a.startsWith(`
`)&&(a=a.substring(1)),a}},i1e=class{process(e){let{completion:r,context:n}=e;if(n==="CodeBlock"){let o=r;return o=o.replace(/```[a-zA-Z]*[ \t]*\n?/g,""),o=o.replace(/\n?```[ \t]*\n?/g,""),o.endsWith(`
`)&&(o=o.slice(0,-1)),o}return r}},gse=class{constructor(){this.processors=[];this.processors.push(new i1e),this.processors.push(new n1e),this.processors.push(new o1e)}process(e,r,n,o){let a={prefix:e,suffix:r,completion:n,context:o};for(let s of this.processors)a.completion=s.process(a);return a.completion}};Rz();var IFt=require("obsidian");function MFt(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 RFt(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 IFt.TFile&&(r.push(i),r.length>=e))break}return r}Jt();var a1e=require("obsidian"),Odn=.4,Pdn=20,jFt=.7,yse=.3;async function Edn(t,e){let r=ne().debug,n=await aO.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 Tdn(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 Adn(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 Idn({db:t,filePath:e}){let r=ne().debug,n=await Edn(e,t),o=Tdn(n);if(o.length===0)return r&&console.log("No embeddings found for note:",e),new Map;let i=await aO.getDocsByEmbedding(t,o,{limit:Pdn,similarity:Odn});return Adn(i,e)}function Mdn(t){let e=new Map,n=MFt(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=RFt(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 Rdn(t,e){let r=new Map,n=jFt+yse;for(let[o,i]of t)r.set(o,i*jFt/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=yse:(i.links||i.backlinks)&&(a=yse*.8),r.set(o,(r.get(o)??0)+a)}return r}async function _se({db:t,filePath:e}){let r=app.vault.getAbstractFileByPath(e);if(!(r instanceof a1e.TFile))return[];let n=await Idn({db:t,filePath:e}),o=Mdn(r),i=Rdn(n,o);return Array.from(i.entries()).sort((s,u)=>{let l=s[0],c=u[0],d=bse(n.get(l)??0),f=bse(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 a1e.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 bse(t){return t>.7?3:t>.55?2:1}var DFt=require("obsidian"),jdn={cjk:[[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983]],japanese:[[12352,12447],[12448,12543]],korean:[[44032,55215],[4352,4607]],other:[[3584,3711],[1536,1791],[2304,2431],[2432,2559],[2688,2815],[2944,3071]]};function Ddn(t,e){let r=t.codePointAt(0);return r?e.some(([n,o])=>r>=n&&r<=o):!1}function NFt(t){let e=t.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"");if(!e)return!1;for(let r of e)if(Object.values(jdn).some(n=>Ddn(r,n)))return!0;return!1}function LFt(t,e){let r="",n="",o=Math.max(0,e.line-5);for(let u=o;u<e.line;u++)r+=t.getLine(u)+`
`;let i=t.getLine(e.line);r+=i.slice(0,e.ch),(e.ch===0||e.ch===i.length&&i.trim()==="")&&(r+=`
`);let a=Math.max(0,e.line-50);for(let u=a;u<e.line;u++)n+=t.getLine(u)+`
`;n+=i.slice(0,e.ch)+"{{CURSOR}}"+i.slice(e.ch)+`
`;let s=Math.min(t.lineCount()-1,e.line+50);for(let u=e.line+1;u<=s;u++)n+=t.getLine(u)+`
`;return{prefix:r,noteContext:n}}var QA=class QA{constructor(){this.currentNotePath=null;this.cachedNotes=null;this.cachedNoteTitles=[]}static getInstance(){return QA.instance||(QA.instance=new QA),QA.instance}getRelevantNoteTitles(){return this.cachedNoteTitles}async getRelevantNotes(e){if(!e)return this.currentNotePath=null,this.cachedNotes=null,this.cachedNoteTitles=[],"";if(this.currentNotePath===e.path&&this.cachedNotes!==null)return this.cachedNotes;let r=await Li.getInstance().getDb(),o=(await _se({db:r,filePath:e.path})).slice(0,QA.MAX_RELEVANT_NOTES);this.cachedNoteTitles=o.map(a=>a.document.title);let i=await Promise.all(o.map(async a=>{let s=app.vault.getAbstractFileByPath(a.document.path);if(!(s instanceof DFt.TFile))return"";let u=await app.vault.cachedRead(s);if(!u)return"";let l=u.length>3e3?u.slice(0,3e3)+"...":u;return`[[${a.document.title}]]:
${l}`}));return this.currentNotePath=e.path,this.cachedNotes=i.join(`
`),this.cachedNotes}clearCache(){this.currentNotePath=null,this.cachedNotes=null,this.cachedNoteTitles=[]}};QA.MAX_RELEVANT_NOTES=3;var vse=QA;var yD=class{constructor(){this.MIN_WORD_LENGTH=4;this.STOP_WORDS=new Set(["a","ain","all","am","an","and","any","are","as","at","be","but","by","can","d","did","do","don","few","for","had","has","he","her","him","his","how","i","if","in","is","isn","it","its","ll","m","ma","me","my","no","nor","not","now","o","of","off","on","or","our","out","own","re","s","she","so","t","the","to","too","up","ve","was","we","who","why","won","y","you"])}extractWords(e){return(this.preprocessText(e).match(/\b[a-zA-Z]+(?:'[a-zA-Z]+)?\b/g)||[]).filter(o=>this.isValidWord(o))}isWordCharacter(e){return/[a-zA-Z']/.test(e)}isValidWord(e){return!(e.length<this.MIN_WORD_LENGTH||!/^[a-zA-Z]+(?:'[a-zA-Z]+)?$/.test(e)||this.STOP_WORDS.has(e.toLowerCase())||e===e.toUpperCase()&&e.length>4)}getLanguage(){return"en"}preprocessText(e){return e.replace(/```[\s\S]*?```/g," ").replace(/`[^`]+`/g," ").replace(/\[\[([^\]]+)\]\]/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/<[^>]+>/g," ").replace(/^#+\s+/gm,"").replace(/[*_]{1,2}([^*_]+)[*_]{1,2}/g,"$1").replace(/^\s*[-*+]\s+/gm,"").replace(/^\s*\d+\.\s+/gm,"").replace(/\s+/g," ").trim()}};var T6=class{constructor(e=5e4){this.wordCount=0;this.root=this.createNode(),this.maxSize=e}createNode(){return{children:new Map,isEndOfWord:!1,wordEntry:void 0}}addWord(e,r){if(!e||e.length<4||this.wordCount>=this.maxSize&&!this.hasWord(e))return;let n=this.root;for(let o of e)n.children.has(o)||n.children.set(o,this.createNode()),n=n.children.get(o);n.isEndOfWord?n.wordEntry&&(n.wordEntry.frequency++,n.wordEntry.lastSeen=Date.now(),r&&!n.wordEntry.contexts.includes(r)&&(n.wordEntry.contexts.push(r),n.wordEntry.contexts.length>10&&(n.wordEntry.contexts=n.wordEntry.contexts.slice(-10)))):(n.isEndOfWord=!0,n.wordEntry={word:e,frequency:1,contexts:r?[r]:[],lastSeen:Date.now()},this.wordCount++)}hasWord(e){let r=this.findNode(e);return r!==null&&r.isEndOfWord}getWordEntry(e){let r=this.findNode(e);return r&&r.isEndOfWord&&r.wordEntry?r.wordEntry:null}findNode(e){let r=this.root;for(let n of e){if(!r.children.has(n))return null;r=r.children.get(n)}return r}getSuggestions(e,r=10){if(!e)return[];let n=[],o=this.generatePrefixVariants(e);for(let a of o){let s=this.findNode(a);if(s&&(this.collectWords(s,a,n,r,e),n.length>=r))break}let i=this.deduplicateSuggestions(n);return i.sort((a,s)=>s.score-a.score),i.slice(0,r)}generatePrefixVariants(e){let r=new Set;return r.add(e),r.add(e.toLowerCase()),e.length>0&&r.add(e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()),r.add(e.toUpperCase()),Array.from(r)}deduplicateSuggestions(e){let r=new Map;for(let n of e){let o=n.word,i=r.get(o);(!i||n.score>i.score)&&r.set(o,n)}return Array.from(r.values())}collectWords(e,r,n,o,i){if(!(n.length>=o)){if(e.isEndOfWord&&e.wordEntry){let a=this.calculateScore(e.wordEntry)+this.getCaseMatchBonus(r,i);n.push({word:r,score:a,source:"vault"})}for(let[a,s]of e.children)this.collectWords(s,r+a,n,o,i)}}getCaseMatchBonus(e,r){if(e.length<r.length)return 0;let n=e.substring(0,r.length);return n===r?2:this.hasSameCasePattern(n,r)?1.5:1}hasSameCasePattern(e,r){if(e.length<r.length)return!1;for(let n=0;n<r.length;n++){let o=e[n],i=r[n],a=o===o.toUpperCase(),s=i===i.toUpperCase();if(a!==s)return!1}return!0}calculateScore(e){let r=Math.log(e.frequency+1)*10,n=Math.max(0,(Date.now()-e.lastSeen)/(1e3*60*60*24)),o=Math.max(0,10-n);return r+o}getStats(){let e=0,r=0,n=(o,i=0)=>{e++,r=Math.max(r,i);for(let a of o.children.values())n(a,i+1)};return n(this.root),{wordCount:this.wordCount,nodeCount:e,maxDepth:r}}clear(){this.root=this.createNode(),this.wordCount=0}getAllWords(){let e=[],r=n=>{n.isEndOfWord&&n.wordEntry&&e.push(n.wordEntry);for(let o of n.children.values())r(o)};return r(this.root),e}addWords(e,r){for(let n of e)this.addWord(n,r)}pruneByFrequency(e=2){let r=0,n=o=>{let i=[];for(let[a,s]of o.children)n(s)&&i.push(a);for(let a of i)o.children.delete(a);return o.isEndOfWord&&o.wordEntry&&o.wordEntry.frequency<e&&(o.isEndOfWord=!1,o.wordEntry=void 0,this.wordCount--,r++),o.children.size===0&&!o.isEndOfWord};return n(this.root),r}};mo();var FFt=require("obsidian");var A6=class{constructor(e,r,n,o){this.isScanning=!1;this.vault=e,this.settings=r,this.performance=n,this.tokenizer=o||new yD}async scanVault(e){let r=Date.now(),n=[],o=new Map;try{let i=this.vault.getMarkdownFiles(),a=0;for(let l of i)try{e&&e({currentFile:l.path,processedFiles:a,totalFiles:i.length,foundWords:o.size});try{let d=await this.vault.adapter.stat(l.path);if(d&&d.size>this.performance.maxFileSize){n.push(`Skipped large file: ${l.path}`);continue}}catch{}let c=await this.vault.read(l);await this.processFile(l.path,c,o),a++,a%this.performance.batchSize===0&&await new Promise(d=>setTimeout(d,1))}catch(c){let d=`Error processing file ${l.path}: ${c}`;fe(d),n.push(d)}(this.settings.includeFileNames||this.settings.includeFolderNames)&&this.processFileAndFolderNames(o);let s=Date.now()-r;return{wordCount:o.size,fileCount:a,errors:n,scanTimeMs:s,wordMap:o}}catch(i){throw fe("[Word Completion] Vault scan failed:",i),i}}async scanFile(e){if(e.stat.size>this.performance.maxFileSize)return[];if(e.extension!=="md")return[];try{let r=await this.vault.read(e);return this.extractWordsFromText(r)}catch(r){return fe(`[Word Completion] Error reading file ${e.path}:`,r),[]}}extractWordsFromText(e){return!e||e.trim().length===0?[]:this.tokenizer.extractWords(e).filter(n=>{if(n.length<this.settings.minWordLength)return!1;for(let o of this.settings.excludePatterns)try{if(new RegExp(o,"i").test(n))return!1}catch(i){fe(`[Word Completion] Invalid exclude pattern: ${o}`,i)}return!0})}extractPathWords(){let e=new Set,r=n=>{let o=n.split("/").filter(Boolean);for(let i of o)i.replace(/\.[^.]+$/,"").split(/[^a-zA-Z]+/).filter(u=>u.length>=this.settings.minWordLength).filter(u=>this.tokenizer.isValidWord(u)).forEach(u=>e.add(u.toLowerCase()))};if(this.settings.includeFileNames&&this.vault.getMarkdownFiles().forEach(n=>{r(n.path)}),this.settings.includeFolderNames){let n=o=>{r(o.path),o.children.forEach(i=>{i instanceof FFt.TFolder&&n(i)})};n(this.vault.getRoot())}return Array.from(e)}getFilesToScan(){return this.vault.getMarkdownFiles().filter(e=>!(e.stat.size>this.performance.maxFileSize))}isScanningScanVault(){return this.isScanning}getEstimatedScanTime(){let r=this.getFilesToScan().reduce((o,i)=>o+i.stat.size,0);return Math.max(1,r/(1024*1024))*1e3}setTokenizer(e){this.tokenizer=e}updateSettings(e){this.settings=e}updatePerformance(e){this.performance=e}async processFile(e,r,n){let o=this.extractWordsFromText(r);for(let i of o){n.has(i)||n.set(i,{frequency:0,contexts:new Set});let a=n.get(i);a.frequency++,a.contexts.add(e)}}processFileAndFolderNames(e){let r=this.extractPathWords();for(let n of r)e.has(n)||e.set(n,{frequency:0,contexts:new Set}),e.get(n).frequency++,e.get(n).contexts.add("filename")}};mo();var My=class My{constructor(e){this.isInitialized=!1;this.lastScanTime=0;this.vault=e,this.settings={...My.DEFAULT_SETTINGS},this.performance={...My.DEFAULT_PERFORMANCE},this.tokenizer=new yD,this.trie=new T6(this.performance.maxTrieSize),this.scanner=new A6(this.vault,this.settings,this.performance,this.tokenizer)}static getInstance(e){return My.instance||(My.instance=new My(e)),My.instance}async initialize(e){if(this.isInitialized)return{wordCount:this.trie.getStats().wordCount,fileCount:0,errors:[],scanTimeMs:0};try{await new Promise(o=>setTimeout(o,100)),this.vault.getAllLoadedFiles().length===0&&await new Promise(o=>setTimeout(o,500));let n=await this.scanner.scanVault(e);return await this.populateTrieFromScanResult(n),this.isInitialized=!0,this.lastScanTime=Date.now(),n}catch(r){throw fe("[Word Completion] Initialization failed:",r),r}}getSuggestions(e){if(!this.isInitialized||!this.settings.enabled)return[];if(!e||e.length<this.settings.minPrefixLength)return[];if(!this.tokenizer.isWordCharacter(e[e.length-1]))return[];try{let r=this.settings.caseSensitive?e:e.toLowerCase();return this.trie.getSuggestions(r,this.settings.maxSuggestions).filter(i=>i.word.toLowerCase()!==e.toLowerCase())}catch(r){return fe("[Word Completion] Error getting suggestions:",r),[]}}shouldTriggerCompletion(e,r){if(!this.isInitialized||!this.settings.enabled)return!1;let n=e.substring(0,r),o=this.getCurrentWord(n);if(!o||o.length<this.settings.minPrefixLength)return!1;if(r>0){let s=e[r-1];if(/\s/.test(s))return!1}return this.getSuggestions(o).length>0}getCurrentWord(e){let r=e.length;for(let n=e.length-1;n>=0;n--){let o=e[n];if(!this.tokenizer.isWordCharacter(o)){r=n+1;break}n===0&&(r=0)}return e.substring(r).trim()}addWord(e,r){if(!(!this.isInitialized||!e||e.length<this.settings.minWordLength)&&this.tokenizer.isValidWord(e)){let n=this.settings.caseSensitive?e:e.toLowerCase();this.trie.addWord(n,r)}}getStats(){return{isInitialized:this.isInitialized,trieStats:this.trie.getStats(),lastScanTime:this.lastScanTime,settings:{...this.settings}}}updateSettings(e){this.settings={...this.settings,...e},this.scanner.updateSettings(this.settings)}updatePerformance(e){this.performance={...this.performance,...e},this.scanner.updatePerformance(this.performance)}reset(){this.trie.clear(),this.isInitialized=!1,this.lastScanTime=0}async rescan(e){return this.reset(),await this.initialize(e)}needsRescan(){return!1}getTokenizer(){return this.tokenizer}setTokenizer(e){this.tokenizer=e,this.scanner.setTokenizer(e)}async populateTrieFromScanResult(e){let r=e.wordMap;if(r)for(let[n,o]of r){let i=this.settings.caseSensitive?n:n.toLowerCase();for(let a=0;a<o.frequency;a++)this.trie.addWord(i,Array.from(o.contexts)[0]||"vault")}}destroy(){this.reset(),My.instance=null}};My.DEFAULT_SETTINGS={enabled:!0,minPrefixLength:2,maxSuggestions:20,includeVaultWords:!0,includeFileNames:!0,includeFolderNames:!0,caseSensitive:!1,minWordLength:4,excludePatterns:[]},My.DEFAULT_PERFORMANCE={maxTrieSize:5e4,maxFileSize:1024*1024,batchSize:100};var bD=My;mo();var Ndn=require("obsidian");var wse=class t{constructor(e){this.options=e;this.isActive=!1;this.activeRequests=new Map;this.lastRequestTime=0;this.minRequestInterval=100;this.lastCursorPosition=null;this.cacheEnabled=!0;this.handleSettingsChange=(e,r)=>{if(e.autocompleteAcceptKey!==r.autocompleteAcceptKey){let n=this.validateAcceptKey(r.autocompleteAcceptKey);this.acceptKey=n,this.setupGlobalKeyHandler()}e.enableWordCompletion!==r.enableWordCompletion&&(r.enableWordCompletion&&this.initializeWordCompletion(),this.recreateExtension())};this.cache=E6.getInstance(),this.client=Ei.getInstance(),this.postProcessor=new gse,this.wordCompletionManager=bD.getInstance(app.vault);let r=ne().autocompleteAcceptKey||nh.KEYBIND;this.acceptKey=this.validateAcceptKey(r),this.recreateExtension(),this.setupGlobalKeyHandler(),this.unsubscribeFromSettings=Mi(this.handleSettingsChange),this.initializeWordCompletion()}validateAcceptKey(e){return["Tab","Space","ArrowRight"].includes(e)?e:"Tab"}async initializeWordCompletion(){if(ne().enableWordCompletion)try{await this.wordCompletionManager.initialize()}catch(r){fe("[Copilot Autocomplete] Failed to initialize word completion:",r)}}recreateExtension(){let{extension:e,force_fetch:r}=hse({fetchFn:()=>this.handleUnifiedCompletion(),delay:this.options.delay,continue_suggesting:!1,accept_shortcut:null});this.extension=e,this.forceFetch=r,this.updateActiveEditors()}setupGlobalKeyHandler(){this.globalKeyListener&&document.removeEventListener("keydown",this.globalKeyListener,!0),this.globalKeyListener=e=>{if(!this.isActive)return;let r={Tab:["Tab"],Space:[" ","Space"],ArrowRight:["ArrowRight","Right"]},n=app.workspace.getActiveViewOfType(s1e.MarkdownView);if(!n?.editor)return;let o=n.editor.cm;if(!o)return;let i=this.hasActiveCompletion(o),a;for(let[s,u]of Object.entries(r))if(u.includes(e.key)){a=s;break}if(a===this.acceptKey&&i){let u=o.dom.querySelector(".cm-inline-suggestion")?.textContent||"";if(u){e.preventDefault(),e.stopPropagation();let l=o.state.selection.main.head,c=a==="Space"?" ":"";o.dispatch({changes:[{from:l,to:l,insert:u+c}],selection:{anchor:l+u.length+c.length}}),this.forceFetch();return}}if(e.key==="Tab"&&this.acceptKey!=="Tab"&&i){e.preventDefault(),e.stopPropagation();let s=o.state.selection.main.head;o.dispatch({changes:[{from:s,to:s,insert:" "}],selection:{anchor:s+1}})}},document.addEventListener("keydown",this.globalKeyListener,!0)}updateActiveEditors(){let e=app.workspace.getLeavesOfType("markdown");for(let r of e){let n=r.view;if(!n?.editor)continue;let o=n.editor.cm;if(o)try{o.dispatch({})}catch(i){fe(`[Copilot Autocomplete] Error updating editor: ${i}`)}}}hasActiveCompletion(e){let r=[".cm-inline-suggestion",".cm-ghost-text"];for(let n of r)if(Array.from(e.dom.querySelectorAll(n)).length>0)return!0;return!1}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}setActive(e){this.isActive=e}getExtension(){return this.extension}destroy(){this.globalKeyListener&&document.removeEventListener("keydown",this.globalKeyListener,!0),this.unsubscribeFromSettings&&this.unsubscribeFromSettings(),this.wordCompletionManager&&this.wordCompletionManager.destroy(),this.activeRequests.clear(),this.cache.clear()}shouldContinueSuggesting(e,r){if(e.endsWith("[[")||/\[\[[^\]]*$/.test(e)||r&&!r.startsWith(`
`))return!1;let o=e.split(`
`),i=o[o.length-1];if(/^#{1,6}(\s*)$/.test(i))return!1;let a=e.trim().split(/\s+/).filter(u=>u.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"").length>0),s=a[a.length-1]||"";return NFt(s)?!0:e.endsWith(" ")}async*handleUnifiedCompletion(){if(!this.isActive)return;let e=app.workspace.getActiveViewOfType(s1e.MarkdownView);if(!e)return;await new Promise(c=>setTimeout(c,10));let r=e.editor,n=r.getCursor(),{prefix:o,noteContext:i}=LFt(r,n),a=r.getLine(n.line).substring(n.ch)||"";if(this.lastCursorPosition){let c=Math.abs(n.line-this.lastCursorPosition.line),d=Math.abs(n.ch-this.lastCursorPosition.ch);(c>0||d>5)&&this.clearActiveRequests()}this.lastCursorPosition={line:n.line,ch:n.ch};let s=Date.now();if(s-this.lastRequestTime<this.minRequestInterval)return;let u=ne();if(this.shouldUseWordCompletion(o,u)){let c=this.getCurrentWordFromPrefix(o);if(!c||c.length<2)return;let d=`word:${c}:${o.slice(-50)}`;if(this.activeRequests.has(d))return;let f=this.wordCompletionManager.getSuggestions(c);if(f.length===0)return;let p=f.some(b=>b.word===c),m=f.some(b=>b.word.length-c.length>=2);if(p&&!m)return;let h=p?f.filter(b=>b.word!==c):f;if(h.length===0)return;try{let b=h.map(P=>P.word),g=o.slice(-1e3),_=a.slice(0,500),w,x,C;if(this.cacheEnabled&&(x=this.cache.generateWordKey(g,_,b),C=this.cache.get(x)),C)w=C;else{let P=this.client.wordcomplete(g,_,b);this.activeRequests.set(d,P),this.lastRequestTime=s,w=await P,this.cacheEnabled&&x&&this.cache.set(x,w),this.activeRequests.delete(d)}let E=w.response.selected_word;if(E&&E!==c){let P=this.generateCaseMatchedCompletion(E,c);P&&(yield{display_suggestion:P,complete_suggestion:P})}}catch(b){this.activeRequests.delete(d),fe("[Copilot Autocomplete] Error with LLM word selection, falling back to trie:",b);let g=h[0],_=this.generateCaseMatchedCompletion(g.word,c);_&&(yield{display_suggestion:_,complete_suggestion:_})}}else{if(!u.enableAutocomplete||!this.shouldContinueSuggesting(o,a))return;let c=o.slice(-this.options.maxContextLength);if(c.length<this.options.minTriggerLength)return;let d=`sentence:${c.slice(-100)}`;if(this.activeRequests.has(d))return;try{let f=u.allowAdditionalContext,p="";f&&(p=await vse.getInstance().getRelevantNotes(e.file));let m=e.file?.basename||"",h=m?`[[${m}]]:
${c}`:c,b,g,_;if(this.cacheEnabled&&(g=this.cache.generateSentenceKey(h,i,p),_=this.cache.get(g)),_)b=_;else{let C=this.client.autocomplete(h,i,p);this.activeRequests.set(d,C),this.lastRequestTime=s,b=await C,this.cacheEnabled&&g&&this.cache.set(g,b),this.activeRequests.delete(d)}let w=b.response.completion,x=this.detectContext(o);w=this.postProcessor.process(c,a,w,x),yield{display_suggestion:w,complete_suggestion:w}}catch(f){this.activeRequests.delete(d),fe("[Copilot Autocomplete] Error fetching autocomplete suggestions:",f)}}}shouldUseWordCompletion(e,r){if(!r.enableWordCompletion)return!1;let n=e.trim(),o=n[n.length-1];if(o&&/[a-zA-Z']/.test(o)){let i=this.getCurrentWordFromPrefix(e);if(i&&i.length>=2)return!0}return!1}getCurrentWordFromPrefix(e){let r=e.length;for(let o=e.length-1;o>=0;o--){let i=e[o];if(!/[a-zA-Z']/.test(i)){r=o+1;break}o===0&&(r=0)}let n=e.substring(r);return n.length>=2?n:null}generateCaseMatchedCompletion(e,r){if(e.length<=r.length)return"";let n=e.substring(r.length),o=r===r.toUpperCase(),i=r===r.toLowerCase(),a=r.length>0&&r[0]===r[0].toUpperCase()&&r.slice(1)===r.slice(1).toLowerCase();return o?n.toUpperCase():i||a?n.toLowerCase():n}detectContext(e){let r=e.split(`
`).pop()||"";if(/^\s*[-*+]\s/.test(r))return"UnorderedList";if(/^\s*\d+\.\s/.test(r))return"NumberedList";if(/^\s*[-*+]\s\[[ x]\]\s/.test(r))return"TaskList";if(e.includes("```")&&(e.split("```").length-1)%2===1)return"CodeBlock"}triggerCompletion(){this.isActive&&(this.clearActiveRequests(),this.forceFetch())}clearActiveRequests(){this.activeRequests.size>0&&this.activeRequests.clear()}getWordCompletionManager(){return this.wordCompletionManager}setCacheEnabled(e){this.cacheEnabled=e,e||this.cache.clear()}getCacheEnabled(){return this.cacheEnabled}};var Sse=class t{constructor(e){this.plugin=e;let r=ne();this.cmIntegration=wse.getInstance({delay:nh.DELAY_MS,minTriggerLength:nh.MIN_TRIGGER_LENGTH,maxContextLength:nh.MAX_CONTEXT_LENGTH}),this.unsubscribeSettings=Mi((o,i)=>{let a=o.enableAutocomplete||o.enableWordCompletion,s=i.enableAutocomplete||i.enableWordCompletion;a!==s&&this.cmIntegration.setActive(s)});let n=r.enableAutocomplete||r.enableWordCompletion;this.cmIntegration.setActive(n),this.registerExtension()}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}registerExtension(){try{this.plugin.registerEditorExtension([this.cmIntegration.getExtension()])}catch(e){fe("[Copilot Autocomplete] Failed to register CodeMirror extension:",e)}}destroy(){this.unsubscribeSettings(),this.cmIntegration.setActive(!1),this.cmIntegration.destroy()}};Hle();Jt();Rz();var u1e=class{get usageData(){return ne().promptUsageTimestamps}recordUsage(e){Je("promptUsageTimestamps",{...this.usageData,[e]:Date.now()})}updateUsage(e,r){let n={...this.usageData};n[r]=n[e],delete n[e],Je("promptUsageTimestamps",n)}removeUnusedPrompts(e){let r={...this.usageData};for(let n of Object.keys(r))e.includes(n)||delete r[n];Je("promptUsageTimestamps",r)}compare(e,r){return(this.usageData[e]||0)-(this.usageData[r]||0)}},l1e=class{get usageData(){return ne().promptUsageTimestamps}recordUsage(e){Je("promptUsageTimestamps",{...this.usageData,[e]:Date.now()})}updateUsage(e,r){let n={...this.usageData};n[r]=n[e],delete n[e],Je("promptUsageTimestamps",n)}removeUnusedPrompts(e){let r={...this.usageData};for(let n of Object.keys(r))e.includes(n)||delete r[n];Je("promptUsageTimestamps",r)}compare(e,r){return r.localeCompare(e)}};function c1e(){switch(ne().promptSortStrategy||"timestamp"){case"alphabetical":return new l1e;case"timestamp":default:return new u1e}}Jt();yn();var eI=require("obsidian");Zr();var Ldn=/\{(?!copilot-selection\})([^}]+)\}/g;async function Fdn(t,e,r){let n=new Map,o=new Set,i;for(;(i=Ldn.exec(t))!==null;){let a=i[1].trim(),s={content:"",files:[]};if(a.toLowerCase()==="activenote")if(r){let u=await GN(r,e);u&&(s.content=`## ${z9(r)}
${u}`,s.files.push(r))}else new eI.Notice("No active note found.");else if(a.startsWith("#")){let u=a.slice(1).split(",").map(d=>d.trim()),l=await ZUe(e,u),c=[];for(let d of l){let f=await GN(d,e);f&&(c.push(`## ${z9(d)}
${f}`),s.files.push(d))}s.content=c.join(`
`)}else{let u=eze(a),l=await Ufe(e,u),c=[];for(let d of l){let f=await GN(d,e);f&&(c.push(`## ${z9(d)}
${f}`),s.files.push(d))}s.content=c.join(`
`)}s.content?(n.set(a,s.content),s.files.forEach(u=>o.add(u))):a.toLowerCase()!=="activenote"&&(a.startsWith('"')||console.warn(`No notes found for variable: ${a}`))}return{variablesMap:n,includedFiles:o}}async function d1e(t,e,r,n){let o=ne(),i=new Set;if(!o.enableCustomPromptTemplating)return t.includes("{}")&&!e&&n&&i.add(n),{processedPrompt:t+`
`,includedFiles:Array.from(i)};let{variablesMap:a,includedFiles:s}=await Fdn(t,r,n);s.forEach(f=>i.add(f));let u=t,l="",c=null;u.includes("{}")&&(u=u.replace(/\{\}/g,"{selectedText}"),e?l+=`selectedText:
${e}`:n?(c=await GN(n,r),l+=`selectedText (entire active note):
${c}`,i.add(n)):l+=`selectedText:
(No selected text or active note available)`);for(let[f,p]of a.entries())f.toLowerCase()==="activenote"&&c!==null||(l?l+=`
${f}:
${p}`:l+=`${f}:
${p}`);let d=$x(u,r);for(let f of d)if(!i.has(f)){let p=await GN(f,r);if(p){let m=`<${jz}>
Title: [[${f.basename}]]
Path: ${f.path}
${p}
</${jz}>`;l&&(l+=`
`),l+=`${m}`,i.add(f)}}return{processedPrompt:l?`${u}
${l}`:`${u}
`,includedFiles:Array.from(i)}}var aP=class t{constructor(e){this.vault=e;this.usageStrategy=c1e(),Mi(()=>{this.usageStrategy=c1e()})}get customPromptsFolder(){return ne().customPromptsFolder}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}recordPromptUsage(e){this.usageStrategy.recordUsage(e)}async getAllPrompts(){let e=this.customPromptsFolder,r=this.vault.getFiles().filter(o=>o.path.startsWith(e)&&o.extension==="md"),n=[];for(let o of r){let i=await this.vault.read(o);n.push({title:o.basename,content:i})}return this.usageStrategy.removeUnusedPrompts(n.map(o=>o.title)),n.sort((o,i)=>this.usageStrategy.compare(i.title,o.title)||0)}async getPrompt(e){let r=`${this.customPromptsFolder}/${e}.md`,n=this.vault.getAbstractFileByPath(r);if(n instanceof eI.TFile){let o=await this.vault.read(n);return{title:e,content:o}}return null}async savePrompt(e,r){let n=(0,eI.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 eI.TFile){if(e!==r){let a=`${this.customPromptsFolder}/${r}.md`;if(this.vault.getAbstractFileByPath(a))throw new Er("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 eI.TFile&&(this.usageStrategy.removeUnusedPrompts([e]),await this.vault.delete(n))}async processCustomPrompt(e,r,n){return d1e(e,r,this.vault,n)}};Jt();function Pq(t){return encodeURIComponent(t.toLowerCase())}function kFt(t,e){if(!t)throw new Error("Command name is required");if(t.length>zle)throw new Error(`Command name must be less than ${zle} characters`);if(_D().some(n=>n.name.toLowerCase()===t.toLowerCase()&&n.name.toLowerCase()!==e?.toLowerCase()))throw new Error("A command with this name already exists")}function $Ft(t){return _D().find(r=>Pq(r.name)===t)}function _D(){return ne().inlineEditCommands??hN}function BFt(){return Pn().inlineEditCommands??hN}async function f1e(t,e,r=!1){let o=(await d1e(t,e,app.vault,app.workspace.getActiveFile())).processedPrompt;if(o.includes("{selectedText}")||r)return o;let i=o.indexOf(Ule);return i===-1?o+`
`+e:o.slice(0,i)+e+o.slice(i+Ule.length)}function qFt(){return _D()!==hN}var Eq=require("obsidian"),jn=$(Y()),UFt=$(_c());yn();var xse=$(Y());var io=xse.forwardRef(({className:t,type:e,...r},n)=>xse.createElement("input",{type:e,className:Ce("!tw-h-9 !tw-min-w-[50px] !tw-rounded-md !tw-border tw-border-solid tw-border-border !tw-bg-transparent !tw-px-3 !tw-py-1 !tw-text-sm !tw-transition-colors md:!tw-text-base","focus-visible:!tw-shadow-sm focus-visible:!tw-outline-none focus-visible:!tw-ring-1 focus-visible:!tw-ring-ring","placeholder:tw-text-sm","tw-flex tw-w-full tw-shadow-sm placeholder:tw-text-muted disabled:tw-cursor-not-allowed disabled:tw-opacity-50",t),ref:n,...r}));io.displayName="Input";var sg=$(Y());var Ry=sg.forwardRef(({className:t,value:e,...r},n)=>{let o=sg.useRef(null),i=sg.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);sg.useLayoutEffect(()=>{i()},[e,i]),sg.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 sg.createElement("textarea",{className:Ce("tw-min-w-fit tw-resize-y tw-overflow-auto tw-border-solid","tw-flex tw-max-h-[300px] tw-min-h-[60px] tw-w-full tw-rounded-md tw-border tw-bg-transparent tw-px-3 tw-py-2 tw-text-base tw-shadow-sm placeholder:tw-text-muted focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring disabled:tw-cursor-not-allowed disabled:tw-opacity-50 md:tw-text-sm",t),value:e,ref:a,onChange:s=>{i(),r.onChange?.(s)},onInput:i,onCompositionEnd:i,onPaste:()=>{setTimeout(i,0)},...r})});Ry.displayName="Textarea";var rx=$(Y());function Cse(){return rx.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},rx.default.createElement("li",null,rx.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{}")," represents the selected text."),rx.default.createElement("li",null,rx.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),rx.default.createElement("li",null,rx.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),rx.default.createElement("li",null,rx.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{#tag1, #tag2}")," represents ALL notes with ANY of the specified tags in their property (an OR operation)."))}function kdn({initialTitle:t="",initialPrompt:e="",disabledTitle:r=!1,onSave:n,onCancel:o}){let[i,a]=(0,jn.useState)(t),[s,u]=(0,jn.useState)(e),[l,c]=(0,jn.useState)({title:!1,prompt:!1}),[d,f]=(0,jn.useState)(!1),m=i&&/[<>:"/\\|?*\x00-\x1F]/g.test(i),h=async()=>{if(m){new Eq.Notice("Title contains invalid characters. Please remove them before saving.");return}if(i&&s)try{f(!0),await n(i,s)}catch(w){new Eq.Notice(En(w))}finally{f(!1)}else c({title:!0,prompt:!0}),new Eq.Notice("Please fill in both fields: Title and Prompt.")},b=l.title&&!i,g=l.prompt&&!s,_=i.trim()!==""&&s.trim()!==""&&!m;return jn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},jn.default.createElement("div",{className:"tw-mb-2 tw-text-xl tw-font-bold tw-text-normal"},"User Custom Prompt"),jn.default.createElement("div",{className:"tw-flex tw-flex-col"},jn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},jn.default.createElement("div",{className:"tw-text-base tw-font-medium tw-text-normal"},"Title"),jn.default.createElement("span",{className:"tw-text-error"},"*")),jn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},jn.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"The title of the prompt, must be unique."),jn.default.createElement("div",{className:"tw-text-xs tw-text-warning"},"Note: Title will be used as filename. Avoid using: ",'< > : " / \\ | ? *')),jn.default.createElement(io,{type:"text",value:i,onChange:w=>{a(w.target.value),l.title||c(x=>({...x,title:!0}))},onBlur:()=>c(w=>({...w,title:!0})),disabled:r,className:"tw-mt-1 tw-w-full",required:!0}),b&&jn.default.createElement("div",{className:"tw-mt-1 tw-text-xs tw-text-error"},"Title is required"),m&&jn.default.createElement("div",{className:"tw-mt-1 tw-text-xs tw-text-error"},"Title contains invalid characters")),jn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},jn.default.createElement("div",{className:"tw-space-y-2"},jn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},jn.default.createElement("div",{className:"tw-text-base tw-font-medium tw-text-normal"},"Prompt"),jn.default.createElement("span",{className:"tw-text-error"},"*")),jn.default.createElement("div",{className:"tw--mt-1 tw-text-sm tw-text-muted"},"Use the following syntax in your prompt:")),jn.default.createElement(Cse,null),jn.default.createElement(Ry,{value:s,onChange:w=>{u(w.target.value),l.prompt||c(x=>({...x,prompt:!0}))},onBlur:()=>c(w=>({...w,prompt:!0})),className:"tw-mt-1 !tw-min-h-32",required:!0}),g&&jn.default.createElement("div",{className:"tw-mt-1 tw-text-xs tw-text-error"},"Prompt is required"),jn.default.createElement("div",{className:"tw-mt-2 tw-flex tw-flex-col tw-gap-2 tw-text-xs tw-text-muted"},jn.default.createElement("div",null,"Save the prompt to the local prompt library. You can then use it with the Copilot command: ",jn.default.createElement("strong",null,"Apply custom prompt to selection.")),jn.default.createElement("div",null,"Check out the"," ",jn.default.createElement("a",{href:"https://github.com/f/awesome-chatgpt-prompts",target:"_blank",className:"tw-text-accent hover:tw-text-accent-hover",rel:"noreferrer"},"awesome chatGPT prompts")," ","for inspiration."))),jn.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-gap-2"},jn.default.createElement(he,{variant:"secondary",onClick:o,disabled:d},"Cancel"),jn.default.createElement(he,{onClick:h,disabled:!_||d},d?"Saving...":"Save")))}var I6=class extends Eq.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,UFt.createRoot)(r);let n=async(i,a)=>{await this.onSave(i,a),this.close()},o=()=>{this.close()};this.root.render(jn.default.createElement(kdn,{initialTitle:this.initialTitle,initialPrompt:this.initialPrompt,disabledTitle:this.disabledTitle,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};var zFt=require("obsidian"),Ose=class extends zFt.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 tI=require("obsidian"),Pse=class extends tI.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Debug: Search OramaDB"});let r=e.createEl("p");r.innerHTML='Enter a JSON search params object. Example:<br><pre>{<br> "term": "#tag",<br> "mode": "hybrid",<br> "limit": 10,<br> "includeVectors": true<br>}</pre>',this.searchInput=e.createEl("textarea",{attr:{placeholder:"Enter search params JSON...",rows:"10",style:"width: 100%; min-height: 200px; margin: 10px 0; padding: 10px; font-family: monospace;"}}),e.createEl("div",{cls:"search-button-container"}).createEl("button",{text:"Search",cls:"mod-cta"}).addEventListener("click",async()=>{try{let i=JSON.parse(this.searchInput.value);i.vector?.value&&!Array.isArray(i.vector.value)&&(i.vector.value=Object.values(i.vector.value));let a=await this.plugin.vectorStoreManager.getDb();if(!a){new tI.Notice("Database not found");return}let s=await Fc(a,i),u=["## Search Parameters","```json",JSON.stringify(i,null,2),"```","","## Results",`Total hits: ${s.hits.length}`,"","### Hits","```json",JSON.stringify(s.hits,null,2),"```"].join(`
`),l="OramaDB-Debug-Search.md",c=this.app.vault.getAbstractFileByPath(l);c instanceof tI.TFile?await this.app.vault.modify(c,u):await this.app.vault.create(l,u);let d=this.app.vault.getAbstractFileByPath(l);d instanceof tI.TFile&&(await this.app.workspace.getLeaf().openFile(d),this.close())}catch(i){console.error("Error in debug search:",i),new tI.Notice("Error executing search. Check console for details.")}})}onClose(){let{contentEl:e}=this;e.empty()}};var nx=$(Y());yn();Zr();var p1e=({capabilities:t=[],iconSize:e=16})=>nx.default.createElement(nx.default.Fragment,null,t.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return nx.default.createElement(sC,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return nx.default.createElement(iC,{key:n,className:"tw-text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return nx.default.createElement(oR,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),m1e=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return nx.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},nx.default.createElement("span",null,r),t.capabilities&&t.capabilities.length>0&&nx.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-0.5"},nx.default.createElement(p1e,{capabilities:t.capabilities,iconSize:e})))},Ese=t=>{let e=t.displayName||t.name,r=`(${ff(t.provider)})`;return`${e} ${r}`},M6=t=>{let e=t.displayName||t.name,r=`(${ff(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}`};mo();Jt();yn();HP();Jp();var jy=require("obsidian"),_t=$(Y()),HFt=$(_c());function $dn(t){let[e]=(0,_t.useState)(new w6({returnMessages:!0,memoryKey:"history"})),[r,n]=(0,_t.useState)(null);return(0,_t.useEffect)(()=>{async function o(){let i=await gD.getInstance().createModelInstance(t),a=Xf.fromMessages([zP.fromTemplate("You are a helpful assistant. You'll help the user with their content editing needs."),new sb("history"),ub.fromTemplate("{input}")]),s=si.from([{input:u=>u.input,memory:()=>e.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},a,i]);n(s)}o()},[t,e]),{chatChain:r,chatMemory:e}}function Bdn({originalText:t,command:e,onInsert:r,onReplace:n}){let[o,i]=(0,_t.useState)(null),[a,s]=(0,_t.useState)(null),[u,l]=(0,_t.useState)(""),c=(0,_t.useRef)(null),d=(0,_t.useRef)(null),[f,p]=(0,_t.useState)(!0),[m]=iL(),h=Pn(),b=(0,_t.useMemo)(()=>H9(e.modelKey||m,h.activeModels),[e.modelKey,m,h.activeModels]),{chatChain:g,chatMemory:_}=$dn(b),w=e.name,x=(0,_t.useCallback)(async(R,j)=>{if(!g)return console.error("Chat chain not initialized"),new jy.Notice("Chat engine not ready. Please try again."),p(!1),null;try{i(null),s(null),p(!0);let D="",F=await g.bind({signal:j.signal}).stream({input:R});for await(let B of F){if(j.signal.aborted)break;let q=typeof B.content=="string"?B.content:"";D+=q,i(D)}if(!j.signal.aborted){let B=D.trim();return s(B),p(!1),await _.saveContext({input:R},{output:B}),B}return null}catch(D){return fe("Error generating response:",D),p(!1),null}},[g,_]);(0,_t.useEffect)(()=>{let R=new AbortController;C.current=R;async function j(){if(g)try{let D=await f1e(e.prompt,t);await x(D,R)}catch(D){fe("Error in initial response:",D),p(!1)}}return j(),()=>{R.abort()}},[e.prompt,t,g,x]);let C=(0,_t.useRef)(null),E=async()=>{if(!u.trim()||!g){g||new jy.Notice("Chat engine not ready. Please try again.");return}let R=new AbortController;C.current=R;let j=await f1e(u,t,!0);try{await x(j,R)&&l("")}finally{R.signal.aborted&&(p(!1),s(o??"")),C.current=null}},P=()=>{C.current&&(C.current.abort(),C.current=null,p(!1))},A=R=>{R.nativeEvent.isComposing||(!f&&a&&!I&&(R.key==="Enter"&&(jy.Platform.isMacOS?R.metaKey:R.ctrlKey)&&!R.shiftKey&&(R.preventDefault(),n(a)),R.key==="Enter"&&(jy.Platform.isMacOS?R.metaKey:R.ctrlKey)&&R.shiftKey&&(R.preventDefault(),r(a))),I&&R.key==="Enter"&&!R.shiftKey&&!R.metaKey&&!R.ctrlKey&&(R.preventDefault(),E()))};(0,_t.useEffect)(()=>{if(c.current&&o&&f){let R=c.current;R.scrollTop=R.scrollHeight}},[o,f]);let I=!f&&u.trim().length>0;return _t.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4",onKeyDown:A},_t.default.createElement("div",{className:"tw-max-h-60 tw-overflow-y-auto tw-whitespace-pre-wrap tw-text-muted"},t),_t.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},w&&_t.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-font-bold tw-text-normal"},_t.default.createElement(EE,{className:"tw-size-4"}),w)),_t.default.createElement("div",{className:"tw-group tw-relative"},_t.default.createElement("textarea",{ref:c,className:"tw-peer tw-h-60 tw-w-full tw-text-text",value:a??o??"loading...",disabled:a==null,onChange:R=>s(R.target.value)}),a&&_t.default.createElement("button",{className:"tw-absolute tw-right-2 tw-top-2 tw-opacity-0 tw-transition-opacity group-hover:tw-opacity-100 peer-focus-visible:!tw-opacity-0",onClick:()=>{navigator.clipboard.writeText(a),new jy.Notice("Copied to clipboard")}},_t.default.createElement(Cb,{className:"tw-size-4 hover:tw-text-accent"}))),!f&&a&&_t.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},_t.default.createElement("textarea",{autoFocus:!0,ref:d,className:"tw-h-20 tw-w-full tw-text-text",placeholder:"Enter follow-up instructions...",value:u,onChange:R=>l(R.target.value)})),_t.default.createElement("div",{className:"tw-flex tw-justify-between tw-gap-2"},_t.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs tw-font-bold tw-text-faint"},_t.default.createElement(tR,{className:"tw-size-4"}),Ese(b)),_t.default.createElement("div",{className:"tw-flex tw-gap-2"},f?_t.default.createElement(he,{variant:"secondary",onClick:P},"Stop"):I?_t.default.createElement(he,{onClick:E,className:"tw-flex tw-items-center tw-gap-1"},_t.default.createElement("span",null,"Submit"),_t.default.createElement(rm,{className:"tw-size-3"})):_t.default.createElement(_t.default.Fragment,null,_t.default.createElement(he,{onClick:()=>r(a??""),className:"tw-flex tw-items-center tw-gap-1"},_t.default.createElement("span",null,"Insert"),_t.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs tw-text-muted"},jy.Platform.isMacOS?_t.default.createElement(_t.default.Fragment,null,_t.default.createElement(xb,{className:"tw-size-3"}),_t.default.createElement(nC,{className:"tw-size-3"}),_t.default.createElement(rm,{className:"tw-size-3"})):_t.default.createElement(_t.default.Fragment,null,_t.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),_t.default.createElement(nC,{className:"tw-size-3"}),_t.default.createElement(rm,{className:"tw-size-3"})))),_t.default.createElement(he,{onClick:()=>n(a??""),className:"tw-flex tw-items-center tw-gap-1"},_t.default.createElement("span",null,"Replace"),_t.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs tw-text-muted"},jy.Platform.isMacOS?_t.default.createElement(_t.default.Fragment,null,_t.default.createElement(xb,{className:"tw-size-3"}),_t.default.createElement(rm,{className:"tw-size-3"})):_t.default.createElement(_t.default.Fragment,null,_t.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),_t.default.createElement(rm,{className:"tw-size-3"}))))))))}var Tse=class extends jy.Modal{constructor(r,n){super(r);this.configs=n}onOpen(){let{contentEl:r}=this;this.root=(0,HFt.createRoot)(r);let{selectedText:n,command:o}=this.configs,i=s=>{Iz(s),this.close()},a=s=>{Iz(s,!0),this.close()};this.root.render(_t.default.createElement(Bdn,{originalText:n,command:o,onInsert:i,onReplace:a}))}onClose(){this.root.unmount()}};var VFt=require("obsidian"),sP=class extends VFt.FuzzySuggestModal{constructor(e,r,n,o=[]){super(e),this.promptTitles=r,this.onChoosePromptTitle=n,this.descriptions=o}getItems(){return this.promptTitles}getItemText(e){let r=this.promptTitles.indexOf(e),n=this.descriptions[r];return n?`${e} (${n})`:e}onChooseItem(e,r){let n=this.promptTitles.findIndex(i=>e.startsWith(i+" (")||e===i),o=n>=0?this.promptTitles[n]:e;this.onChoosePromptTitle(o)}};yn();var R6=require("obsidian"),Ase=class extends R6.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Inspect Copilot Index by Note Paths"}),this.searchInput=e.createEl("textarea",{attr:{placeholder:`Enter note paths as markdown list:
- [[Note 1]]
- [[Note 2]]`,rows:"10",style:"width: 100%; min-height: 200px; margin: 10px 0; padding: 10px; font-family: monospace;"}}),e.createEl("div",{cls:"search-button-container"}).createEl("button",{text:"Show Index Data",cls:"mod-cta"}).addEventListener("click",async()=>{let o=this.searchInput.value,i=$x(o,this.app.vault).map(a=>a.path);if(i.length===0){new R6.Notice("No valid note paths found. Use format: - [[Note Name]]");return}try{let s=await(await this.plugin.vectorStoreManager.getDbOps()).getDocsJsonByPaths(i),u="CopilotDB-Search-Results.md",l=["## Searched Paths",...i.map(f=>`- [[${f}]]`),"","## Index Data","```json",JSON.stringify(s,null,2),"```"].join(`
`),c=this.app.vault.getAbstractFileByPath(u);c?await this.app.vault.modify(c,l):await this.app.vault.create(u,l);let d=this.app.vault.getAbstractFileByPath(u);d&&await this.app.workspace.getLeaf().openFile(d),this.close()}catch(a){console.error("Error searching DB:",a),new R6.Notice("Error searching database. Check console for details.")}})}onClose(){let{contentEl:e}=this;e.empty()}};var j6=require("obsidian"),Ise=class extends j6.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 j6.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 j6.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()}};mo();Jt();yn();var co=require("obsidian");Zr();function nc(t,e,r){t.addCommand({id:e,name:J9[e],callback:r})}function qdn(t,e,r){t.addCommand({id:e,name:J9[e],editorCallback:r})}function WFt(t,e,r){t.addCommand({id:e,name:J9[e],checkCallback:r})}async function Udn(t,e){let r=t.getSelection().trim();if(!r)return;let n=$Ft(e);if(!n){fe(`Command not found for id ${e}`);return}new Tse(app,{selectedText:r,command:n}).open()}function zdn(t,e,r){e.forEach(n=>{let o=Pq(n.name);o&&t.removeCommand(o)}),r.forEach(n=>{let o=Pq(n.name);t.addCommand({id:o,name:n.name,editorCallback:i=>{Udn(i,o)}})})}function h1e(t,e,r){zdn(t,e?.inlineEditCommands??[],r.inlineEditCommands??_D());let n=aP.getInstance(t.app.vault);qdn(t,ar.COUNT_WORD_AND_TOKENS_SELECTION,async o=>{let i=await o.getSelection(),a=i.split(" ").length,s=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(i);new co.Notice(`Selected text contains ${a} words and ${s} tokens.`)}),nc(t,ar.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let o=await ICt(t.app),i=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(o);new co.Notice(`Total tokens in your vault: ${i}`)}catch(o){console.error("Error counting tokens: ",o),new co.Notice("An error occurred while counting tokens.")}}),nc(t,ar.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),nc(t,ar.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),nc(t,ar.NEW_CHAT,()=>{t.newChat()}),nc(t,ar.ADD_CUSTOM_PROMPT,()=>{new I6(t.app,async(o,i)=>{try{await n.savePrompt(o,i),new co.Notice("Custom prompt saved successfully.")}catch(a){let s="An error occurred while saving the custom prompt: "+En(a);throw console.error(s),new Error(s)}}).open()}),nc(t,ar.APPLY_CUSTOM_PROMPT,async()=>{let i=(await n.getAllPrompts()).map(a=>a.title);new sP(t.app,i,async a=>{if(!a){new co.Notice("Please select a prompt title.");return}try{let s=await n.getPrompt(a);if(!s){new co.Notice(`No prompt found with the title "${a}".`);return}t.processCustomPrompt(ar.APPLY_CUSTOM_PROMPT,s.content)}catch(s){console.error(s),new co.Notice("An error occurred.")}}).open()}),nc(t,ar.APPLY_ADHOC_PROMPT,async()=>{new Ose(t.app,async i=>{try{t.processCustomPrompt(ar.APPLY_ADHOC_PROMPT,i)}catch(a){console.error(a),new co.Notice("An error occurred.")}}).open()}),WFt(t,ar.DELETE_CUSTOM_PROMPT,o=>(o||n.getAllPrompts().then(i=>{let a=i.map(s=>s.title);new sP(t.app,a,async s=>{if(!s){new co.Notice("Please select a prompt title.");return}try{await n.deletePrompt(s),new co.Notice(`Prompt "${s}" has been deleted.`)}catch(u){console.error(u),new co.Notice("An error occurred while deleting the prompt.")}}).open()}),!0)),WFt(t,ar.EDIT_CUSTOM_PROMPT,o=>(o||n.getAllPrompts().then(i=>{let a=i.map(s=>s.title);new sP(t.app,a,async s=>{if(!s){new co.Notice("Please select a prompt title.");return}try{let u=await n.getPrompt(s);u?new I6(t.app,async(l,c)=>{try{await n.updatePrompt(s,l,c),new co.Notice(`Prompt "${l}" has been updated.`)}catch(d){let f="An error occurred while updating the custom prompt: "+En(d);throw console.error(f),new Error(f)}},u.title,u.content,!1).open():new co.Notice(`No prompt found with the title "${s}".`)}catch(u){console.error(u),new co.Notice("An error occurred.")}}).open()}),!0)),nc(t,ar.CLEAR_LOCAL_COPILOT_INDEX,async()=>{await t.vectorStoreManager.clearIndex()}),nc(t,ar.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let o=await t.vectorStoreManager.garbageCollectVectorStore();new co.Notice(`${o} documents removed from Copilot index.`)}catch(o){console.error("Error garbage collecting the Copilot index:",o),new co.Notice("An error occurred while garbage collecting the Copilot index.")}}),nc(t,ar.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let o=await t.vectorStoreManager.indexVaultToVectorStore();new co.Notice(`${o} vault files indexed to Copilot index.`)}catch(o){console.error("Error indexing vault to Copilot index:",o),new co.Notice("An error occurred while indexing vault to Copilot index.")}}),nc(t,ar.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let o=await t.vectorStoreManager.indexVaultToVectorStore(!0);new co.Notice(`${o} vault files re-indexed to Copilot index.`)}catch(o){console.error("Error re-indexing vault to Copilot index:",o),new co.Notice("An error occurred while re-indexing vault to Copilot index.")}}),nc(t,ar.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),nc(t,ar.LIST_INDEXED_FILES,async()=>{try{let o=await t.vectorStoreManager.getIndexedFiles(),i=new Set(o),a=t.app.vault.getMarkdownFiles(),s=new Set,u=new Set,l=new Set,c=await t.vectorStoreManager.getDbOps();for(let b of a){let g=await t.app.vault.cachedRead(b);!g||g.trim().length===0?s.add(b.path):i.has(b.path)?await c.hasEmbeddings(b.path)||l.add(b.path):u.add(b.path)}if(o.length===0&&s.size===0&&u.size===0){new co.Notice("No files found to list.");return}let d=["# Copilot Files Status",`- Indexed files: ${o.length}`,` - Files missing embeddings: ${l.size}`,`- Unindexed files: ${u.size}`,`- Empty files: ${s.size}`,"","## Indexed Files",...o.map(b=>{let g=l.has(b);return`- [[${b}]]${g?" *(embedding missing)*":""}`}),"","## Unindexed Files",...u.size>0?Array.from(u).sort().map(b=>`- [[${b}]]`):["No unindexed files found."],"","## Empty Files",...s.size>0?Array.from(s).sort().map(b=>`- [[${b}]]`):["No empty files found."]].join(`
`),p=`${`Copilot-Indexed-Files-${new Date().toLocaleDateString().replace(/\//g,"-")}.md`}`,m=t.app.vault.getAbstractFileByPath(p);m instanceof co.TFile?await t.app.vault.modify(m,d):await t.app.vault.create(p,d);let h=t.app.vault.getAbstractFileByPath(p);h instanceof co.TFile&&(await t.app.workspace.getLeaf().openFile(h),new co.Notice(`Listed ${o.length} indexed files`))}catch(o){console.error("Error listing indexed files:",o),new co.Notice("Failed to list indexed files.")}}),r.debug&&(nc(t,ar.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS,()=>{new Ase(t.app,t).open()}),nc(t,ar.SEARCH_ORAMA_DB,()=>{new Pse(t.app,t).open()}),nc(t,ar.REMOVE_FILES_FROM_COPILOT_INDEX,async()=>{new Ise(t.app,async o=>{let i=await t.vectorStoreManager.getDbOps();try{for(let a of o)await i.removeDocs(a);await i.saveDB(),new co.Notice(`Successfully removed ${o.length} files from the index.`)}catch(a){console.error("Error removing files from index:",a),new co.Notice("An error occurred while removing files from the index.")}}).open()})),nc(t,ar.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),await hy.getInstance().clearAllCache(),await nB.getInstance().clear();let{AutocompleteCache:i}=await Promise.resolve().then(()=>(ZRe(),PFt));i.getInstance().clear(),new co.Notice("All Copilot caches cleared successfully")}catch(o){console.error("Error clearing Copilot caches:",o),new co.Notice("Failed to clear Copilot caches")}}),nc(t,ar.TOGGLE_AUTOCOMPLETE,()=>{let i=!ne().enableAutocomplete;Je("enableAutocomplete",i),new co.Notice(`Copilot autocomplete ${i?"enabled":"disabled"}`)})}pf();pf();var KFt=require("obsidian"),vD=$(Y()),JFt=$(_c());function Hdn({content:t,onConfirm:e,onCancel:r,confirmButtonText:n,cancelButtonText:o}){return vD.default.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"20px"}},vD.default.createElement("div",null,t),vD.default.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"}},vD.default.createElement("button",{onClick:r},o),vD.default.createElement("button",{style:{backgroundColor:"var(--interactive-accent)",color:"var(--text-on-accent)",cursor:"pointer"},onClick:e},n)))}var Dy=class extends KFt.Modal{constructor(r,n,o,i,a="Continue",s="Cancel"){super(r);this.onConfirm=n;this.content=o;this.confirmButtonText=a;this.cancelButtonText=s;this.setTitle(i)}onOpen(){let{contentEl:r}=this;this.root=(0,JFt.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(vD.default.createElement(Hdn,{content:this.content,onConfirm:n,onCancel:o,confirmButtonText:this.confirmButtonText,cancelButtonText:this.cancelButtonText}))}onClose(){this.root.unmount()}};var Ai=$(Y());var Ol=$(Y(),1);function D6(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Vdn=$(Y(),1);function GFt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Mse(...t){return e=>{let r=!1,n=t.map(o=>{let i=GFt(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():GFt(t[o],null)}}}}var ug=$(Y(),1),g1e=$(St(),1);function YFt(t,e){let r=ug.createContext(e),n=i=>{let{children:a,...s}=i,u=ug.useMemo(()=>s,Object.values(s));return(0,g1e.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=ug.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 ii(t,e=[]){let r=[];function n(i,a){let s=ug.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,b=ug.useMemo(()=>m,Object.values(m));return(0,g1e.jsx)(h.Provider,{value:b,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=ug.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>ug.createContext(a));return function(s){let u=s?.[t]||i;return ug.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Wdn(o,...e)]}function Wdn(...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 ug.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var rI=$(Y(),1);var Tq=$(Y(),1);function hr(t){let e=Tq.useRef(t);return Tq.useEffect(()=>{e.current=t}),Tq.useMemo(()=>(...r)=>e.current?.(...r),[])}function Cl({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=Kdn({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=hr(r),u=rI.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 Kdn({defaultProp:t,onChange:e}){let r=rI.useState(t),[n]=r,o=rI.useRef(n),i=hr(e);return rI.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var ZFt=$(Y(),1),Xdn=$(Ms(),1);var Wc=$(Y(),1);var Aq=$(St(),1),b1e=Wc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Wc.Children.toArray(r),i=o.find(Gdn);if(i){let a=i.props.children,s=o.map(u=>u===i?Wc.Children.count(a)>1?Wc.Children.only(null):Wc.isValidElement(a)?a.props.children:null:u);return(0,Aq.jsx)(y1e,{...n,ref:e,children:Wc.isValidElement(a)?Wc.cloneElement(a,void 0,s):null})}return(0,Aq.jsx)(y1e,{...n,ref:e,children:r})});b1e.displayName="Slot";var y1e=Wc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Wc.isValidElement(r)){let o=Zdn(r);return Wc.cloneElement(r,{...Ydn(n,r.props),ref:e?Mse(e,o):o})}return Wc.Children.count(r)>1?Wc.Children.only(null):null});y1e.displayName="SlotClone";var Jdn=({children:t})=>(0,Aq.jsx)(Aq.Fragment,{children:t});function Gdn(t){return Wc.isValidElement(t)&&t.type===Jdn}function Ydn(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 Zdn(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 XFt=$(St(),1),Qdn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],QFt=Qdn.reduce((t,e)=>{let r=ZFt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?b1e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,XFt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var jt=$(Y(),1);function $i(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var oI=$(Y(),1);var tkt=$(Y(),1);function ekt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function N6(...t){return e=>{let r=!1,n=t.map(o=>{let i=ekt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():ekt(t[o],null)}}}}function Kc(...t){return tkt.useCallback(N6(...t),t)}var Jc=$(Y(),1);var Iq=$(St(),1),nI=Jc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Jc.Children.toArray(r),i=o.find(tfn);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,Iq.jsx)(_1e,{...n,ref:e,children:Jc.isValidElement(a)?Jc.cloneElement(a,void 0,s):null})}return(0,Iq.jsx)(_1e,{...n,ref:e,children:r})});nI.displayName="Slot";var _1e=Jc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Jc.isValidElement(r)){let o=nfn(r);return Jc.cloneElement(r,{...rfn(n,r.props),ref:e?N6(e,o):o})}return Jc.Children.count(r)>1?Jc.Children.only(null):null});_1e.displayName="SlotClone";var efn=({children:t})=>(0,Iq.jsx)(Iq.Fragment,{children:t});function tfn(t){return Jc.isValidElement(t)&&t.type===efn}function rfn(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 nfn(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 Rse=$(St(),1);function rkt(t){let e=t+"CollectionProvider",[r,n]=ii(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=oI.default.useRef(null),g=oI.default.useRef(new Map).current;return(0,Rse.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=oI.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),_=Kc(m,g.collectionRef);return(0,Rse.jsx)(nI,{ref:_,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=oI.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,_=oI.default.useRef(null),w=Kc(m,_),x=i(l,h);return oI.default.useEffect(()=>(x.itemMap.set(_,{ref:_,...g}),()=>void x.itemMap.delete(_))),(0,Rse.jsx)(nI,{[c]:"",ref:w,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return oI.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,C)=>g.indexOf(x.ref.current)-g.indexOf(C.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var jse=$(Y(),1),ofn=$(St(),1),ifn=jse.createContext(void 0);function iI(t){let e=jse.useContext(ifn);return t||e||"ltr"}var Ha=$(Y(),1);var nkt=$(Y(),1),okt=$(Ms(),1);var ikt=$(St(),1),afn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],oc=afn.reduce((t,e)=>{let r=nkt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?nI:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,ikt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Dse(t,e){t&&okt.flushSync(()=>t.dispatchEvent(e))}var akt=$(Y(),1);function ox(t,e=globalThis?.document){let r=hr(t);akt.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 w1e=$(St(),1),sfn="DismissableLayer",v1e="dismissableLayer.update",ufn="dismissableLayer.pointerDownOutside",lfn="dismissableLayer.focusOutside",skt,lkt=Ha.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),S1e=Ha.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ha.useContext(lkt),[c,d]=Ha.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ha.useState({}),m=Kc(e,P=>d(P)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,C=ffn(P=>{let A=P.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=pfn(P=>{let A=P.target;[...l.branches].some(R=>R.contains(A))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return ox(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Ha.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(skt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),ukt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=skt)}},[c,f,r,l]),Ha.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),ukt())},[c,l]),Ha.useEffect(()=>{let P=()=>p({});return document.addEventListener(v1e,P),()=>document.removeEventListener(v1e,P)},[]),(0,w1e.jsx)(oc.div,{...u,ref:m,style:{pointerEvents:w?x?"auto":"none":void 0,...t.style},onFocusCapture:$i(t.onFocusCapture,E.onFocusCapture),onBlurCapture:$i(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:$i(t.onPointerDownCapture,C.onPointerDownCapture)})});S1e.displayName=sfn;var cfn="DismissableLayerBranch",dfn=Ha.forwardRef((t,e)=>{let r=Ha.useContext(lkt),n=Ha.useRef(null),o=Kc(e,n);return Ha.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,w1e.jsx)(oc.div,{...t,ref:o})});dfn.displayName=cfn;function ffn(t,e=globalThis?.document){let r=hr(t),n=Ha.useRef(!1),o=Ha.useRef(()=>{});return Ha.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){ckt(ufn,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 pfn(t,e=globalThis?.document){let r=hr(t),n=Ha.useRef(!1);return Ha.useEffect(()=>{let o=i=>{i.target&&!n.current&&ckt(lfn,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 ukt(){let t=new CustomEvent(v1e);document.dispatchEvent(t)}function ckt(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?Dse(o,i):o.dispatchEvent(i)}var fkt=$(Y(),1),x1e=0;function aI(){fkt.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??dkt()),document.body.insertAdjacentElement("beforeend",t[1]??dkt()),x1e++,()=>{x1e===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),x1e--}},[])}function dkt(){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 lg=$(Y(),1);var ykt=$(St(),1),C1e="focusScope.autoFocusOnMount",O1e="focusScope.autoFocusOnUnmount",pkt={bubbles:!1,cancelable:!0},mfn="FocusScope",P1e=lg.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=lg.useState(null),l=hr(o),c=hr(i),d=lg.useRef(null),f=Kc(e,h=>u(h)),p=lg.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;lg.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:sI(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||sI(d.current,{select:!0}))},x=function(E){if(document.activeElement===document.body)for(let A of E)A.removedNodes.length>0&&sI(s)};var h=_,b=w,g=x;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(x);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),lg.useEffect(()=>{if(s){hkt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(C1e,pkt);s.addEventListener(C1e,l),s.dispatchEvent(g),g.defaultPrevented||(hfn(vfn(bkt(s)),{select:!0}),document.activeElement===h&&sI(s))}return()=>{s.removeEventListener(C1e,l),setTimeout(()=>{let g=new CustomEvent(O1e,pkt);s.addEventListener(O1e,c),s.dispatchEvent(g),g.defaultPrevented||sI(h??document.body,{select:!0}),s.removeEventListener(O1e,c),hkt.remove(p)},0)}}},[s,l,c,p]);let m=lg.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let _=h.currentTarget,[w,x]=gfn(_);w&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&sI(w,{select:!0})):h.shiftKey&&g===w&&(h.preventDefault(),r&&sI(x,{select:!0})):g===_&&h.preventDefault()}},[r,n,p.paused]);return(0,ykt.jsx)(oc.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});P1e.displayName=mfn;function hfn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(sI(n,{select:e}),document.activeElement!==r)return}function gfn(t){let e=bkt(t),r=mkt(e,t),n=mkt(e.reverse(),t);return[r,n]}function bkt(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 mkt(t,e){for(let r of t)if(!yfn(r,{upTo:e}))return r}function yfn(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 bfn(t){return t instanceof HTMLInputElement&&"select"in t}function sI(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&bfn(t)&&e&&t.select()}}var hkt=_fn();function _fn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=gkt(t,e),t.unshift(e)},remove(e){t=gkt(t,e),t[0]?.resume()}}}function gkt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function vfn(t){return t.filter(e=>e.tagName!=="A")}var Nse=$(Y(),1);var _kt=$(Y(),1),dn=globalThis?.document?_kt.useLayoutEffect:()=>{};var wfn=Nse.useId||(()=>{}),Sfn=0;function us(t){let[e,r]=Nse.useState(wfn());return dn(()=>{t||r(n=>n??String(Sfn++))},[t]),t||(e?`radix-${e}`:"")}var Nm=$(Y(),1);var vkt=["top","right","bottom","left"];var ix=Math.min,Mf=Math.max,F6=Math.round,k6=Math.floor,Ny=t=>({x:t,y:t}),xfn={left:"right",right:"left",bottom:"top",top:"bottom"},Cfn={start:"end",end:"start"};function Fse(t,e,r){return Mf(t,ix(e,r))}function ax(t,e){return typeof t=="function"?t(e):t}function sx(t){return t.split("-")[0]}function wD(t){return t.split("-")[1]}function kse(t){return t==="x"?"y":"x"}function $se(t){return t==="y"?"height":"width"}function uP(t){return["top","bottom"].includes(sx(t))?"y":"x"}function Bse(t){return kse(uP(t))}function wkt(t,e,r){r===void 0&&(r=!1);let n=wD(t),o=Bse(t),i=$se(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=L6(a)),[a,L6(a)]}function Skt(t){let e=L6(t);return[Lse(t),e,Lse(e)]}function Lse(t){return t.replace(/start|end/g,e=>Cfn[e])}function Ofn(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 xkt(t,e,r,n){let o=wD(t),i=Ofn(sx(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(Lse)))),i}function L6(t){return t.replace(/left|right|bottom|top/g,e=>xfn[e])}function Pfn(t){return{top:0,right:0,bottom:0,left:0,...t}}function E1e(t){return typeof t!="number"?Pfn(t):{top:t,right:t,bottom:t,left:t}}function SD(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 Ckt(t,e,r){let{reference:n,floating:o}=t,i=uP(e),a=Bse(e),s=$se(a),u=sx(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(wD(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var Ekt=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}=Ckt(l,n,u),f=n,p={},m=0;for(let h=0;h<s.length;h++){let{name:b,fn:g}=s[h],{x:_,y:w,data:x,reset:C}=await g({x:c,y:d,initialPlacement:n,placement:f,strategy:o,middlewareData:p,rects:l,platform:a,elements:{reference:t,floating:e}});c=_??c,d=w??d,p={...p,[b]:{...p[b],...x}},C&&m<=50&&(m++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(l=C.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:o}):C.rects),{x:c,y:d}=Ckt(l,f,u)),h=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}};async function Mq(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}=ax(e,t),m=E1e(p),b=s[f?d==="floating"?"reference":"floating":d],g=SD(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(b)))==null||r?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:l,rootBoundary:c,strategy:u})),_=d==="floating"?{x:n,y:o,width:a.floating.width,height:a.floating.height}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),x=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},C=SD(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:w,strategy:u}):_);return{top:(g.top-C.top+m.top)/x.y,bottom:(C.bottom-g.bottom+m.bottom)/x.y,left:(g.left-C.left+m.left)/x.x,right:(C.right-g.right+m.right)/x.x}}var Tkt=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}=ax(t,e)||{};if(l==null)return{};let d=E1e(c),f={x:r,y:n},p=Bse(o),m=$se(p),h=await a.getDimensions(l),b=p==="y",g=b?"top":"left",_=b?"bottom":"right",w=b?"clientHeight":"clientWidth",x=i.reference[m]+i.reference[p]-f[p]-i.floating[m],C=f[p]-i.reference[p],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l)),P=E?E[w]:0;(!P||!await(a.isElement==null?void 0:a.isElement(E)))&&(P=s.floating[w]||i.floating[m]);let A=x/2-C/2,I=P/2-h[m]/2-1,R=ix(d[g],I),j=ix(d[_],I),D=R,k=P-h[m]-j,F=P/2-h[m]/2+A,B=Fse(D,F,k),q=!u.arrow&&wD(o)!=null&&F!==B&&i.reference[m]/2-(F<D?R:j)-h[m]/2<0,W=q?F<D?F-D:F-k:0;return{[p]:f[p]+W,data:{[p]:B,centerOffset:F-B-W,...q&&{alignmentOffset:W}},reset:q}}});var Akt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;let{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:u,elements:l}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...b}=ax(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};let g=sx(o),_=uP(s),w=sx(s)===s,x=await(u.isRTL==null?void 0:u.isRTL(l.floating)),C=f||(w||!h?[L6(s)]:Skt(s)),E=m!=="none";!f&&E&&C.push(...xkt(s,h,m,x));let P=[s,...C],A=await Mq(e,b),I=[],R=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&I.push(A[g]),d){let F=wkt(o,a,x);I.push(A[F[0]],A[F[1]])}if(R=[...R,{placement:o,overflows:I}],!I.every(F=>F<=0)){var j,D;let F=(((j=i.flip)==null?void 0:j.index)||0)+1,B=P[F];if(B)return{data:{index:F,overflows:R},reset:{placement:B}};let q=(D=R.filter(W=>W.overflows[0]<=0).sort((W,H)=>W.overflows[1]-H.overflows[1])[0])==null?void 0:D.placement;if(!q)switch(p){case"bestFit":{var k;let W=(k=R.filter(H=>{if(E){let L=uP(H.placement);return L===_||L==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(L=>L>0).reduce((L,z)=>L+z,0)]).sort((H,L)=>H[1]-L[1])[0])==null?void 0:k[0];W&&(q=W);break}case"initialPlacement":q=s;break}if(o!==q)return{reset:{placement:q}}}return{}}}};function Okt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Pkt(t){return vkt.some(e=>t[e]>=0)}var Ikt=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=ax(t,e);switch(n){case"referenceHidden":{let i=await Mq(e,{...o,elementContext:"reference"}),a=Okt(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Pkt(a)}}}case"escaped":{let i=await Mq(e,{...o,altBoundary:!0}),a=Okt(i,r.floating);return{data:{escapedOffsets:a,escaped:Pkt(a)}}}default:return{}}}}};async function Efn(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=sx(r),s=wD(r),u=uP(r)==="y",l=["left","top"].includes(a)?-1:1,c=i&&u?-1:1,d=ax(e,t),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m=="number"&&(p=s==="end"?m*-1:m),u?{x:p*c,y:f*l}:{x:f*l,y:p*c}}var Mkt=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 Efn(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}}}}},Rkt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:r,y:n,placement:o}=e,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:b=>{let{x:g,y:_}=b;return{x:g,y:_}}},...u}=ax(t,e),l={x:r,y:n},c=await Mq(e,u),d=uP(sx(o)),f=kse(d),p=l[f],m=l[d];if(i){let b=f==="y"?"top":"left",g=f==="y"?"bottom":"right",_=p+c[b],w=p-c[g];p=Fse(_,p,w)}if(a){let b=d==="y"?"top":"left",g=d==="y"?"bottom":"right",_=m+c[b],w=m-c[g];m=Fse(_,m,w)}let h=s.fn({...e,[f]:p,[d]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:i,[d]:a}}}}}},jkt=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}=ax(t,e),c={x:r,y:n},d=uP(o),f=kse(d),p=c[f],m=c[d],h=ax(s,e),b=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){let w=f==="y"?"height":"width",x=i.reference[f]-i.floating[w]+b.mainAxis,C=i.reference[f]+i.reference[w]-b.mainAxis;p<x?p=x:p>C&&(p=C)}if(l){var g,_;let w=f==="y"?"width":"height",x=["top","left"].includes(sx(o)),C=i.reference[d]-i.floating[w]+(x&&((g=a.offset)==null?void 0:g[d])||0)+(x?0:b.crossAxis),E=i.reference[d]+i.reference[w]+(x?0:((_=a.offset)==null?void 0:_[d])||0)-(x?b.crossAxis:0);m<C?m=C:m>E&&(m=E)}return{[f]:p,[d]:m}}}},Dkt=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}=ax(t,e),c=await Mq(e,l),d=sx(o),f=wD(o),p=uP(o)==="y",{width:m,height:h}=i.floating,b,g;d==="top"||d==="bottom"?(b=d,g=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(g=d,b=f==="end"?"top":"bottom");let _=h-c.top-c.bottom,w=m-c.left-c.right,x=ix(h-c[b],_),C=ix(m-c[g],w),E=!e.middlewareData.shift,P=x,A=C;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(A=w),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(P=_),E&&!f){let R=Mf(c.left,0),j=Mf(c.right,0),D=Mf(c.top,0),k=Mf(c.bottom,0);p?A=m-2*(R!==0||j!==0?R+j:Mf(c.left,c.right)):P=h-2*(D!==0||k!==0?D+k:Mf(c.top,c.bottom))}await u({...e,availableWidth:A,availableHeight:P});let I=await a.getDimensions(s.floating);return m!==I.width||h!==I.height?{reset:{rects:!0}}:{}}}};function qse(){return typeof window<"u"}function CD(t){return Lkt(t)?(t.nodeName||"").toLowerCase():"#document"}function Dp(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ly(t){var e;return(e=(Lkt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Lkt(t){return qse()?t instanceof Node||t instanceof Dp(t).Node:!1}function cg(t){return qse()?t instanceof Element||t instanceof Dp(t).Element:!1}function Fy(t){return qse()?t instanceof HTMLElement||t instanceof Dp(t).HTMLElement:!1}function Nkt(t){return!qse()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Dp(t).ShadowRoot}function Rq(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=dg(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(o)}function Fkt(t){return["table","td","th"].includes(CD(t))}function $6(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Use(t){let e=zse(),r=cg(t)?dg(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 kkt(t){let e=lP(t);for(;Fy(e)&&!OD(e);){if(Use(e))return e;if($6(e))return null;e=lP(e)}return null}function zse(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function OD(t){return["html","body","#document"].includes(CD(t))}function dg(t){return Dp(t).getComputedStyle(t)}function B6(t){return cg(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function lP(t){if(CD(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Nkt(t)&&t.host||Ly(t);return Nkt(e)?e.host:e}function $kt(t){let e=lP(t);return OD(e)?t.ownerDocument?t.ownerDocument.body:t.body:Fy(e)&&Rq(e)?e:$kt(e)}function xD(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=$kt(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=Dp(o);if(i){let s=Hse(a);return e.concat(a,a.visualViewport||[],Rq(o)?o:[],s&&r?xD(s):[])}return e.concat(o,xD(o,[],r))}function Hse(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Ukt(t){let e=dg(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=Fy(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=F6(r)!==i||F6(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function A1e(t){return cg(t)?t:t.contextElement}function jq(t){let e=A1e(t);if(!Fy(e))return Ny(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=Ukt(e),a=(i?F6(r.width):r.width)/n,s=(i?F6(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var Tfn=Ny(0);function zkt(t){let e=Dp(t);return!zse()||!e.visualViewport?Tfn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Afn(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Dp(t)?!1:e}function PD(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=A1e(t),a=Ny(1);e&&(n?cg(n)&&(a=jq(n)):a=jq(t));let s=Afn(i,r,n)?zkt(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=Dp(i),p=n&&cg(n)?Dp(n):n,m=f,h=Hse(m);for(;h&&n&&p!==m;){let b=jq(h),g=h.getBoundingClientRect(),_=dg(h),w=g.left+(h.clientLeft+parseFloat(_.paddingLeft))*b.x,x=g.top+(h.clientTop+parseFloat(_.paddingTop))*b.y;u*=b.x,l*=b.y,c*=b.x,d*=b.y,u+=w,l+=x,m=Dp(h),h=Hse(m)}}return SD({width:c,height:d,x:u,y:l})}function I1e(t,e){let r=B6(t).scrollLeft;return e?e.left+r:PD(Ly(t)).left+r}function Hkt(t,e,r){r===void 0&&(r=!1);let n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-(r?0:I1e(t,n)),i=n.top+e.scrollTop;return{x:o,y:i}}function Ifn(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=Ly(n),s=e?$6(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=Ny(1),c=Ny(0),d=Fy(n);if((d||!d&&!i)&&((CD(n)!=="body"||Rq(a))&&(u=B6(n)),Fy(n))){let p=PD(n);l=jq(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?Hkt(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 Mfn(t){return Array.from(t.getClientRects())}function Rfn(t){let e=Ly(t),r=B6(t),n=t.ownerDocument.body,o=Mf(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Mf(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+I1e(t),s=-r.scrollTop;return dg(n).direction==="rtl"&&(a+=Mf(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}function jfn(t,e){let r=Dp(t),n=Ly(t),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let l=zse();(!l||l&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}return{width:i,height:a,x:s,y:u}}function Dfn(t,e){let r=PD(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=Fy(t)?jq(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 Bkt(t,e,r){let n;if(e==="viewport")n=jfn(t,r);else if(e==="document")n=Rfn(Ly(t));else if(cg(e))n=Dfn(e,r);else{let o=zkt(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return SD(n)}function Vkt(t,e){let r=lP(t);return r===e||!cg(r)||OD(r)?!1:dg(r).position==="fixed"||Vkt(r,e)}function Nfn(t,e){let r=e.get(t);if(r)return r;let n=xD(t,[],!1).filter(s=>cg(s)&&CD(s)!=="body"),o=null,i=dg(t).position==="fixed",a=i?lP(t):t;for(;cg(a)&&!OD(a);){let s=dg(a),u=Use(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Rq(a)&&!u&&Vkt(t,a))?n=n.filter(c=>c!==a):o=s,a=lP(a)}return e.set(t,n),n}function Lfn(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?$6(e)?[]:Nfn(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=Bkt(e,c,o);return l.top=Mf(d.top,l.top),l.right=ix(d.right,l.right),l.bottom=ix(d.bottom,l.bottom),l.left=Mf(d.left,l.left),l},Bkt(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function Ffn(t){let{width:e,height:r}=Ukt(t);return{width:e,height:r}}function kfn(t,e,r){let n=Fy(e),o=Ly(e),i=r==="fixed",a=PD(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=Ny(0);if(n||!n&&!i)if((CD(e)!=="body"||Rq(o))&&(s=B6(e)),n){let f=PD(e,!0,i,e);u.x=f.x+e.clientLeft,u.y=f.y+e.clientTop}else o&&(u.x=I1e(o));let l=o&&!n&&!i?Hkt(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 T1e(t){return dg(t).position==="static"}function qkt(t,e){if(!Fy(t)||dg(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return Ly(t)===r&&(r=r.ownerDocument.body),r}function Wkt(t,e){let r=Dp(t);if($6(t))return r;if(!Fy(t)){let o=lP(t);for(;o&&!OD(o);){if(cg(o)&&!T1e(o))return o;o=lP(o)}return r}let n=qkt(t,e);for(;n&&Fkt(n)&&T1e(n);)n=qkt(n,e);return n&&OD(n)&&T1e(n)&&!Use(n)?r:n||kkt(t)||r}var $fn=async function(t){let e=this.getOffsetParent||Wkt,r=this.getDimensions,n=await r(t.floating);return{reference:kfn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Bfn(t){return dg(t).direction==="rtl"}var Kkt={convertOffsetParentRelativeRectToViewportRelativeRect:Ifn,getDocumentElement:Ly,getClippingRect:Lfn,getOffsetParent:Wkt,getElementRects:$fn,getClientRects:Mfn,getDimensions:Ffn,getScale:jq,isElement:cg,isRTL:Bfn};function qfn(t,e){let r=null,n,o=Ly(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=k6(c),m=k6(o.clientWidth-(l+d)),h=k6(o.clientHeight-(c+f)),b=k6(l),_={rootMargin:-p+"px "+-m+"px "+-h+"px "+-b+"px",threshold:Mf(0,ix(1,u))||1},w=!0;function x(C){let E=C[0].intersectionRatio;if(E!==u){if(!w)return a();E?a(!1,E):n=setTimeout(()=>{a(!1,1e-7)},1e3)}w=!1}try{r=new IntersectionObserver(x,{..._,root:o.ownerDocument})}catch{r=new IntersectionObserver(x,_)}r.observe(t)}return a(!0),i}function cP(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=A1e(t),c=o||i?[...l?xD(l):[],...xD(e)]:[];c.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});let d=l&&s?qfn(l,r):null,f=-1,p=null;a&&(p=new ResizeObserver(g=>{let[_]=g;_&&_.target===l&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(e)})),r()}),l&&!u&&p.observe(l),p.observe(e));let m,h=u?PD(t):null;u&&b();function b(){let g=PD(t);h&&(g.x!==h.x||g.y!==h.y||g.width!==h.width||g.height!==h.height)&&r(),h=g,m=requestAnimationFrame(b)}return r(),()=>{var g;c.forEach(_=>{o&&_.removeEventListener("scroll",r),i&&_.removeEventListener("resize",r)}),d?.(),(g=p)==null||g.disconnect(),p=null,u&&cancelAnimationFrame(m)}}var Jkt=Mkt;var Gkt=Rkt,Ykt=Akt,Zkt=Dkt,Xkt=Ikt,M1e=Tkt;var Qkt=jkt,R1e=(t,e,r)=>{let n=new Map,o={platform:Kkt,...r},i={...o.platform,_c:n};return Ekt(t,e,{...o,platform:i})};var tl=$(Y(),1),Kse=$(Y(),1),t$t=$(Ms(),1),Vse=typeof document<"u"?Kse.useLayoutEffect:Kse.useEffect;function Wse(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(!Wse(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)&&!Wse(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function r$t(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function e$t(t,e){let r=r$t(t);return Math.round(e*r)/r}function j1e(t){let e=tl.useRef(t);return Vse(()=>{e.current=t}),e}function uI(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]=tl.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=tl.useState(n);Wse(f,n)||p(n);let[m,h]=tl.useState(null),[b,g]=tl.useState(null),_=tl.useCallback(H=>{H!==E.current&&(E.current=H,h(H))},[]),w=tl.useCallback(H=>{H!==P.current&&(P.current=H,g(H))},[]),x=i||m,C=a||b,E=tl.useRef(null),P=tl.useRef(null),A=tl.useRef(c),I=u!=null,R=j1e(u),j=j1e(o),D=j1e(l),k=tl.useCallback(()=>{if(!E.current||!P.current)return;let H={placement:e,strategy:r,middleware:f};j.current&&(H.platform=j.current),R1e(E.current,P.current,H).then(L=>{let z={...L,isPositioned:D.current!==!1};F.current&&!Wse(A.current,z)&&(A.current=z,t$t.flushSync(()=>{d(z)}))})},[f,e,r,j,D]);Vse(()=>{l===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,d(H=>({...H,isPositioned:!1})))},[l]);let F=tl.useRef(!1);Vse(()=>(F.current=!0,()=>{F.current=!1}),[]),Vse(()=>{if(x&&(E.current=x),C&&(P.current=C),x&&C){if(R.current)return R.current(x,C,k);k()}},[x,C,k,R,I]);let B=tl.useMemo(()=>({reference:E,floating:P,setReference:_,setFloating:w}),[_,w]),q=tl.useMemo(()=>({reference:x,floating:C}),[x,C]),W=tl.useMemo(()=>{let H={position:r,left:0,top:0};if(!q.floating)return H;let L=e$t(q.floating,c.x),z=e$t(q.floating,c.y);return s?{...H,transform:"translate("+L+"px, "+z+"px)",...r$t(q.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:L,top:z}},[r,s,q.floating,c.x,c.y]);return tl.useMemo(()=>({...c,update:k,refs:B,elements:q,floatingStyles:W}),[c,k,B,q,W])}var Ufn=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?M1e({element:n.current,padding:o}).fn(r):{}:n?M1e({element:n,padding:o}).fn(r):{}}}},lI=(t,e)=>({...Jkt(t),options:[t,e]}),cI=(t,e)=>({...Gkt(t),options:[t,e]}),dI=(t,e)=>({...Qkt(t),options:[t,e]}),fI=(t,e)=>({...Ykt(t),options:[t,e]}),pI=(t,e)=>({...Zkt(t),options:[t,e]});var mI=(t,e)=>({...Xkt(t),options:[t,e]});var hI=(t,e)=>({...Ufn(t),options:[t,e]});var n$t=$(Y(),1);var D1e=$(St(),1),zfn="Arrow",o$t=n$t.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,D1e.jsx)(oc.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,D1e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});o$t.displayName=zfn;var i$t=o$t;var a$t=$(Y(),1);function fg(t){let[e,r]=a$t.useState(void 0);return dn(()=>{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 gI=$(St(),1);var N1e="Popper",[s$t,L1e]=ii(N1e),[Vfn,u$t]=s$t(N1e),l$t=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Nm.useState(null);return(0,gI.jsx)(Vfn,{scope:e,anchor:n,onAnchorChange:o,children:r})};l$t.displayName=N1e;var c$t="PopperAnchor",d$t=Nm.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=u$t(c$t,r),a=Nm.useRef(null),s=Kc(e,a);return Nm.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,gI.jsx)(oc.div,{...o,ref:s})});d$t.displayName=c$t;var F1e="PopperContent",[Wfn,Kfn]=s$t(F1e),f$t=Nm.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=u$t(F1e,r),[g,_]=Nm.useState(null),w=Kc(e,ie=>_(ie)),[x,C]=Nm.useState(null),E=fg(x),P=E?.width??0,A=E?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},j=Array.isArray(l)?l:[l],D=j.length>0,k={padding:R,boundary:j.filter(Gfn),altBoundary:D},{refs:F,floatingStyles:B,placement:q,isPositioned:W,middlewareData:H}=uI({strategy:"fixed",placement:I,whileElementsMounted:(...ie)=>cP(...ie,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[lI({mainAxis:o+A,alignmentAxis:a}),u&&cI({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?dI():void 0,...k}),u&&fI({...k}),pI({...k,apply:({elements:ie,rects:Ie,availableWidth:st,availableHeight:Te})=>{let{width:Qe,height:nt}=Ie.reference,Ht=ie.floating.style;Ht.setProperty("--radix-popper-available-width",`${st}px`),Ht.setProperty("--radix-popper-available-height",`${Te}px`),Ht.setProperty("--radix-popper-anchor-width",`${Qe}px`),Ht.setProperty("--radix-popper-anchor-height",`${nt}px`)}}),x&&hI({element:x,padding:s}),Yfn({arrowWidth:P,arrowHeight:A}),f&&mI({strategy:"referenceHidden",...k})]}),[L,z]=h$t(q),K=hr(m);dn(()=>{W&&K?.()},[W,K]);let J=H.arrow?.x,ee=H.arrow?.y,Pe=H.arrow?.centerOffset!==0,[G,Z]=Nm.useState();return dn(()=>{g&&Z(window.getComputedStyle(g).zIndex)},[g]),(0,gI.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:W?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,gI.jsx)(Wfn,{scope:r,placedSide:L,onArrowChange:C,arrowX:J,arrowY:ee,shouldHideArrow:Pe,children:(0,gI.jsx)(oc.div,{"data-side":L,"data-align":z,...h,ref:w,style:{...h.style,animation:W?void 0:"none"}})})})});f$t.displayName=F1e;var p$t="PopperArrow",Jfn={top:"bottom",right:"left",bottom:"top",left:"right"},m$t=Nm.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=Kfn(p$t,n),a=Jfn[i.placedSide];return(0,gI.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,gI.jsx)(i$t,{...o,ref:r,style:{...o.style,display:"block"}})})});m$t.displayName=p$t;function Gfn(t){return t!==null}var Yfn=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]=h$t(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function h$t(t){let[e,r="center"]=t.split("-");return[e,r]}var k1e=l$t,g$t=d$t,y$t=f$t,b$t=m$t;var Jse=$(Y(),1),_$t=$(Ms(),1);var v$t=$(St(),1),Xfn="Portal",$1e=Jse.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Jse.useState(!1);dn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?_$t.default.createPortal((0,v$t.jsx)(oc.div,{...n,ref:e}),a):null});$1e.displayName=Xfn;var Np=$(Y(),1);var S$t=$(Y(),1);function w$t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Qfn(...t){return e=>{let r=!1,n=t.map(o=>{let i=w$t(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():w$t(t[o],null)}}}}function x$t(...t){return S$t.useCallback(Qfn(...t),t)}var C$t=$(Y(),1);function epn(t,e){return C$t.useReducer((r,n)=>e[r][n]??r,t)}var rl=t=>{let{present:e,children:r}=t,n=tpn(e),o=typeof r=="function"?r({present:n.isPresent}):Np.Children.only(r),i=x$t(n.ref,rpn(o));return typeof r=="function"||n.isPresent?Np.cloneElement(o,{ref:i}):null};rl.displayName="Presence";function tpn(t){let[e,r]=Np.useState(),n=Np.useRef({}),o=Np.useRef(t),i=Np.useRef("none"),a=t?"mounted":"unmounted",[s,u]=epn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Np.useEffect(()=>{let l=Gse(n.current);i.current=s==="mounted"?l:"none"},[s]),dn(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Gse(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),dn(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Gse(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let b=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},f=p=>{p.target===e&&(i.current=Gse(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:Np.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function Gse(t){return t?.animationName||"none"}function rpn(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 ic=$(Y(),1);function ED(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var yI=$(Y(),1);var P$t=$(Y(),1);function O$t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function B1e(...t){return e=>{let r=!1,n=t.map(o=>{let i=O$t(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():O$t(t[o],null)}}}}function q6(...t){return P$t.useCallback(B1e(...t),t)}var Gc=$(Y(),1);var Dq=$(St(),1),Nq=Gc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Gc.Children.toArray(r),i=o.find(opn);if(i){let a=i.props.children,s=o.map(u=>u===i?Gc.Children.count(a)>1?Gc.Children.only(null):Gc.isValidElement(a)?a.props.children:null:u);return(0,Dq.jsx)(q1e,{...n,ref:e,children:Gc.isValidElement(a)?Gc.cloneElement(a,void 0,s):null})}return(0,Dq.jsx)(q1e,{...n,ref:e,children:r})});Nq.displayName="Slot";var q1e=Gc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Gc.isValidElement(r)){let o=apn(r);return Gc.cloneElement(r,{...ipn(n,r.props),ref:e?B1e(e,o):o})}return Gc.Children.count(r)>1?Gc.Children.only(null):null});q1e.displayName="SlotClone";var npn=({children:t})=>(0,Dq.jsx)(Dq.Fragment,{children:t});function opn(t){return Gc.isValidElement(t)&&t.type===npn}function ipn(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 apn(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 Yse=$(St(),1);function E$t(t){let e=t+"CollectionProvider",[r,n]=ii(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=yI.default.useRef(null),g=yI.default.useRef(new Map).current;return(0,Yse.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=yI.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),_=q6(m,g.collectionRef);return(0,Yse.jsx)(Nq,{ref:_,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=yI.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,_=yI.default.useRef(null),w=q6(m,_),x=i(l,h);return yI.default.useEffect(()=>(x.itemMap.set(_,{ref:_,...g}),()=>void x.itemMap.delete(_))),(0,Yse.jsx)(Nq,{[c]:"",ref:w,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return yI.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,C)=>g.indexOf(x.ref.current)-g.indexOf(C.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var T$t=$(Y(),1),spn=$(Ms(),1);var A$t=$(St(),1),upn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],U1e=upn.reduce((t,e)=>{let r=T$t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Nq:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,A$t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var bI=$(St(),1),z1e="rovingFocusGroup.onEntryFocus",lpn={bubbles:!1,cancelable:!0},Zse="RovingFocusGroup",[H1e,I$t,cpn]=E$t(Zse),[dpn,V1e]=ii(Zse,[cpn]),[fpn,ppn]=dpn(Zse),M$t=ic.forwardRef((t,e)=>(0,bI.jsx)(H1e.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,bI.jsx)(H1e.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,bI.jsx)(mpn,{...t,ref:e})})}));M$t.displayName=Zse;var mpn=ic.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=ic.useRef(null),p=q6(e,f),m=iI(i),[h=null,b]=Cl({prop:a,defaultProp:s,onChange:u}),[g,_]=ic.useState(!1),w=hr(l),x=I$t(r),C=ic.useRef(!1),[E,P]=ic.useState(0);return ic.useEffect(()=>{let A=f.current;if(A)return A.addEventListener(z1e,w),()=>A.removeEventListener(z1e,w)},[w]),(0,bI.jsx)(fpn,{scope:r,orientation:n,dir:m,loop:o,currentTabStopId:h,onItemFocus:ic.useCallback(A=>b(A),[b]),onItemShiftTab:ic.useCallback(()=>_(!0),[]),onFocusableItemAdd:ic.useCallback(()=>P(A=>A+1),[]),onFocusableItemRemove:ic.useCallback(()=>P(A=>A-1),[]),children:(0,bI.jsx)(U1e.div,{tabIndex:g||E===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:ED(t.onMouseDown,()=>{C.current=!0}),onFocus:ED(t.onFocus,A=>{let I=!C.current;if(A.target===A.currentTarget&&I&&!g){let R=new CustomEvent(z1e,lpn);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){let j=x().filter(q=>q.focusable),D=j.find(q=>q.active),k=j.find(q=>q.id===h),B=[D,k,...j].filter(Boolean).map(q=>q.ref.current);D$t(B,c)}}C.current=!1}),onBlur:ED(t.onBlur,()=>_(!1))})})}),R$t="RovingFocusGroupItem",j$t=ic.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...a}=t,s=us(),u=i||s,l=ppn(R$t,r),c=l.currentTabStopId===u,d=I$t(r),{onFocusableItemAdd:f,onFocusableItemRemove:p}=l;return ic.useEffect(()=>{if(n)return f(),()=>p()},[n,f,p]),(0,bI.jsx)(H1e.ItemSlot,{scope:r,id:u,focusable:n,active:o,children:(0,bI.jsx)(U1e.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...a,ref:e,onMouseDown:ED(t.onMouseDown,m=>{n?l.onItemFocus(u):m.preventDefault()}),onFocus:ED(t.onFocus,()=>l.onItemFocus(u)),onKeyDown:ED(t.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){l.onItemShiftTab();return}if(m.target!==m.currentTarget)return;let h=ypn(m,l.orientation,l.dir);if(h!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let g=d().filter(_=>_.focusable).map(_=>_.ref.current);if(h==="last")g.reverse();else if(h==="prev"||h==="next"){h==="prev"&&g.reverse();let _=g.indexOf(m.currentTarget);g=l.loop?bpn(g,_+1):g.slice(_+1)}setTimeout(()=>D$t(g))}})})})});j$t.displayName=R$t;var hpn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function gpn(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function ypn(t,e,r){let n=gpn(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return hpn[n]}function D$t(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function bpn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var N$t=M$t,L$t=j$t;var vpn=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Lq=new WeakMap,Xse=new WeakMap,Qse={},W1e=0,F$t=function(t){return t&&(t.host||F$t(t.parentNode))},wpn=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=F$t(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},Spn=function(t,e,r,n){var o=wpn(e,Array.isArray(t)?t:[t]);Qse[r]||(Qse[r]=new WeakMap);var i=Qse[r],a=[],s=new Set,u=new Set(o),l=function(d){!d||s.has(d)||(s.add(d),l(d.parentNode))};o.forEach(l);var c=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))c(f);else try{var p=f.getAttribute(n),m=p!==null&&p!=="false",h=(Lq.get(f)||0)+1,b=(i.get(f)||0)+1;Lq.set(f,h),i.set(f,b),a.push(f),h===1&&m&&Xse.set(f,!0),b===1&&f.setAttribute(r,"true"),m||f.setAttribute(n,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return c(e),s.clear(),W1e++,function(){a.forEach(function(d){var f=Lq.get(d)-1,p=i.get(d)-1;Lq.set(d,f),i.set(d,p),f||(Xse.has(d)||d.removeAttribute(n),Xse.delete(d)),p||d.removeAttribute(r)}),W1e--,W1e||(Lq=new WeakMap,Lq=new WeakMap,Xse=new WeakMap,Qse={})}},_I=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||vpn(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),Spn(n,o,r,"aria-hidden")):function(){return null}};var ai=function(){return ai=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},ai.apply(this,arguments)};function vI(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 Fq(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 oue=$(Y());var Ud=$(Y());var ky="right-scroll-bar-position",$y="width-before-scroll-bar",K1e="with-scroll-bars-hidden",J1e="--removed-body-scroll-bar-size";function eue(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var k$t=$(Y());function $$t(t,e){var r=(0,k$t.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 tue=$(Y());var xpn=typeof window<"u"?tue.useLayoutEffect:tue.useEffect,B$t=new WeakMap;function TD(t,e){var r=$$t(e||null,function(n){return t.forEach(function(o){return eue(o,n)})});return xpn(function(){var n=B$t.get(r);if(n){var o=new Set(n),i=new Set(t),a=r.current;o.forEach(function(s){i.has(s)||eue(s,null)}),i.forEach(function(s){o.has(s)||eue(s,a)})}B$t.set(r,t)},[t]),r}function Cpn(t){return t}function Opn(t,e){e===void 0&&(e=Cpn);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 AD(t){t===void 0&&(t={});var e=Opn(null);return e.options=ai({async:!0,ssr:!1},t),e}var q$t=$(Y()),U$t=function(t){var e=t.sideCar,r=vI(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 q$t.createElement(n,ai({},r))};U$t.isSideCarExport=!0;function ID(t,e){return t.useMedium(e),U$t}var rue=AD();var G1e=function(){},U6=Ud.forwardRef(function(t,e){var r=Ud.useRef(null),n=Ud.useState({onScrollCapture:G1e,onWheelCapture:G1e,onTouchMoveCapture:G1e}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,b=t.as,g=b===void 0?"div":b,_=t.gapMode,w=vI(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,C=TD([r,e]),E=ai(ai({},w),o);return Ud.createElement(Ud.Fragment,null,c&&Ud.createElement(x,{sideCar:rue,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:_}),a?Ud.cloneElement(Ud.Children.only(s),ai(ai({},E),{ref:C})):Ud.createElement(g,ai({},E,{className:u,ref:C}),s))});U6.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};U6.classNames={fullWidth:$y,zeroRight:ky};var ra=$(Y());var $q=$(Y());var V$t=$(Y());var z$t;var H$t=function(){if(z$t)return z$t;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ppn(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=H$t();return e&&t.setAttribute("nonce",e),t}function Epn(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Tpn(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Y1e=function(){var t=0,e=null;return{add:function(r){t==0&&(e=Ppn())&&(Epn(e,r),Tpn(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};var Z1e=function(){var t=Y1e();return function(e,r){V$t.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}};var dP=function(){var t=Z1e(),e=function(r){var n=r.styles,o=r.dynamic;return t(n,o),null};return e};var Apn={left:0,top:0,right:0,gap:0},X1e=function(t){return parseInt(t||"",10)||0},Ipn=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[X1e(r),X1e(n),X1e(o)]},Q1e=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Apn;var e=Ipn(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 Mpn=dP(),kq="data-scroll-locked",Rpn=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(K1e,` {
overflow: hidden `).concat(n,`;
padding-right: `).concat(s,"px ").concat(n,`;
}
body[`).concat(kq,`] {
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(ky,` {
right: `).concat(s,"px ").concat(n,`;
}
.`).concat($y,` {
margin-right: `).concat(s,"px ").concat(n,`;
}
.`).concat(ky," .").concat(ky,` {
right: 0 `).concat(n,`;
}
.`).concat($y," .").concat($y,` {
margin-right: 0 `).concat(n,`;
}
body[`).concat(kq,`] {
`).concat(J1e,": ").concat(s,`px;
}
`)},W$t=function(){var t=parseInt(document.body.getAttribute(kq)||"0",10);return isFinite(t)?t:0},jpn=function(){$q.useEffect(function(){return document.body.setAttribute(kq,(W$t()+1).toString()),function(){var t=W$t()-1;t<=0?document.body.removeAttribute(kq):document.body.setAttribute(kq,t.toString())}},[])},MD=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;jpn();var i=$q.useMemo(function(){return Q1e(o)},[o]);return $q.createElement(Mpn,{styles:Rpn(i,!e,o,r?"":"!important")})};var eje=!1;if(typeof window<"u")try{z6=Object.defineProperty({},"passive",{get:function(){return eje=!0,!0}}),window.addEventListener("test",z6,z6),window.removeEventListener("test",z6,z6)}catch{eje=!1}var z6,RD=eje?{passive:!1}:!1;var Dpn=function(t){return t.tagName==="TEXTAREA"},K$t=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!Dpn(t)&&r[e]==="visible")},Npn=function(t){return K$t(t,"overflowY")},Lpn=function(t){return K$t(t,"overflowX")},tje=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=J$t(t,n);if(o){var i=G$t(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Fpn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},kpn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},J$t=function(t,e){return t==="v"?Npn(e):Lpn(e)},G$t=function(t,e){return t==="v"?Fpn(e):kpn(e)},$pn=function(t,e){return t==="h"&&e==="rtl"?-1:1},Y$t=function(t,e,r,n,o){var i=$pn(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=G$t(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&J$t(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var nue=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Z$t=function(t){return[t.deltaX,t.deltaY]},X$t=function(t){return t&&"current"in t?t.current:t},Bpn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},qpn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},Upn=0,Bq=[];function Q$t(t){var e=ra.useRef([]),r=ra.useRef([0,0]),n=ra.useRef(),o=ra.useState(Upn++)[0],i=ra.useState(dP)[0],a=ra.useRef(t);ra.useEffect(function(){a.current=t},[t]),ra.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=Fq([t.lockRef.current],(t.shards||[]).map(X$t),!0).filter(Boolean);return h.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=ra.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=nue(h),_=r.current,w="deltaX"in h?h.deltaX:_[0]-g[0],x="deltaY"in h?h.deltaY:_[1]-g[1],C,E=h.target,P=Math.abs(w)>Math.abs(x)?"h":"v";if("touches"in h&&P==="h"&&E.type==="range")return!1;var A=tje(P,E);if(!A)return!0;if(A?C=P:(C=P==="v"?"h":"v",A=tje(P,E)),!A)return!1;if(!n.current&&"changedTouches"in h&&(w||x)&&(n.current=C),!C)return!0;var I=n.current||C;return Y$t(I,b,h,I==="h"?w:x,!0)},[]),u=ra.useCallback(function(h){var b=h;if(!(!Bq.length||Bq[Bq.length-1]!==i)){var g="deltaY"in b?Z$t(b):nue(b),_=e.current.filter(function(C){return C.name===b.type&&(C.target===b.target||b.target===C.shadowParent)&&Bpn(C.delta,g)})[0];if(_&&_.should){b.cancelable&&b.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(X$t).filter(Boolean).filter(function(C){return C.contains(b.target)}),x=w.length>0?s(b,w[0]):!a.current.noIsolation;x&&b.cancelable&&b.preventDefault()}}},[]),l=ra.useCallback(function(h,b,g,_){var w={name:h,delta:b,target:g,should:_,shadowParent:zpn(g)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(x){return x!==w})},1)},[]),c=ra.useCallback(function(h){r.current=nue(h),n.current=void 0},[]),d=ra.useCallback(function(h){l(h.type,Z$t(h),h.target,s(h,t.lockRef.current))},[]),f=ra.useCallback(function(h){l(h.type,nue(h),h.target,s(h,t.lockRef.current))},[]);ra.useEffect(function(){return Bq.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,RD),document.addEventListener("touchmove",u,RD),document.addEventListener("touchstart",c,RD),function(){Bq=Bq.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,RD),document.removeEventListener("touchmove",u,RD),document.removeEventListener("touchstart",c,RD)}},[]);var p=t.removeScrollBar,m=t.inert;return ra.createElement(ra.Fragment,null,m?ra.createElement(i,{styles:qpn(o)}):null,p?ra.createElement(MD,{gapMode:t.gapMode}):null)}function zpn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var eBt=ID(rue,Q$t);var tBt=oue.forwardRef(function(t,e){return oue.createElement(U6,ai({},t,{ref:e,sideCar:eBt}))});tBt.classNames=U6.classNames;var rje=tBt;var Or=$(St(),1),nje=["Enter"," "],Hpn=["ArrowDown","PageUp","Home"],nBt=["ArrowUp","PageDown","End"],Vpn=[...Hpn,...nBt],Wpn={ltr:[...nje,"ArrowRight"],rtl:[...nje,"ArrowLeft"]},Kpn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},K6="Menu",[V6,Jpn,Gpn]=rkt(K6),[jD,oje]=ii(K6,[Gpn,L1e,V1e]),J6=L1e(),oBt=V1e(),[iBt,wI]=jD(K6),[Ypn,G6]=jD(K6),aBt=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=J6(e),[u,l]=jt.useState(null),c=jt.useRef(!1),d=hr(i),f=iI(o);return jt.useEffect(()=>{let p=()=>{c.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),(0,Or.jsx)(k1e,{...s,children:(0,Or.jsx)(iBt,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,Or.jsx)(Ypn,{scope:e,onClose:jt.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};aBt.displayName=K6;var Zpn="MenuAnchor",ije=jt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=J6(r);return(0,Or.jsx)(g$t,{...o,...n,ref:e})});ije.displayName=Zpn;var aje="MenuPortal",[Xpn,sBt]=jD(aje,{forceMount:void 0}),uBt=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=wI(aje,e);return(0,Or.jsx)(Xpn,{scope:e,forceMount:r,children:(0,Or.jsx)(rl,{present:r||i.open,children:(0,Or.jsx)($1e,{asChild:!0,container:o,children:n})})})};uBt.displayName=aje;var pg="MenuContent",[Qpn,sje]=jD(pg),lBt=jt.forwardRef((t,e)=>{let r=sBt(pg,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=wI(pg,t.__scopeMenu),a=G6(pg,t.__scopeMenu);return(0,Or.jsx)(V6.Provider,{scope:t.__scopeMenu,children:(0,Or.jsx)(rl,{present:n||i.open,children:(0,Or.jsx)(V6.Slot,{scope:t.__scopeMenu,children:a.modal?(0,Or.jsx)(emn,{...o,ref:e}):(0,Or.jsx)(tmn,{...o,ref:e})})})})}),emn=jt.forwardRef((t,e)=>{let r=wI(pg,t.__scopeMenu),n=jt.useRef(null),o=Kc(e,n);return jt.useEffect(()=>{let i=n.current;if(i)return _I(i)},[]),(0,Or.jsx)(uje,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:$i(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),tmn=jt.forwardRef((t,e)=>{let r=wI(pg,t.__scopeMenu);return(0,Or.jsx)(uje,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),uje=jt.forwardRef((t,e)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=t,b=wI(pg,r),g=G6(pg,r),_=J6(r),w=oBt(r),x=Jpn(r),[C,E]=jt.useState(null),P=jt.useRef(null),A=Kc(e,P,b.onContentChange),I=jt.useRef(0),R=jt.useRef(""),j=jt.useRef(0),D=jt.useRef(null),k=jt.useRef("right"),F=jt.useRef(0),B=m?rje:jt.Fragment,q=m?{as:nI,allowPinchZoom:!0}:void 0,W=L=>{let z=R.current+L,K=x().filter(ie=>!ie.disabled),J=document.activeElement,ee=K.find(ie=>ie.ref.current===J)?.textValue,Pe=K.map(ie=>ie.textValue),G=mmn(Pe,z,ee),Z=K.find(ie=>ie.textValue===G)?.ref.current;(function ie(Ie){R.current=Ie,window.clearTimeout(I.current),Ie!==""&&(I.current=window.setTimeout(()=>ie(""),1e3))})(z),Z&&setTimeout(()=>Z.focus())};jt.useEffect(()=>()=>window.clearTimeout(I.current),[]),aI();let H=jt.useCallback(L=>k.current===D.current?.side&&gmn(L,D.current?.area),[]);return(0,Or.jsx)(Qpn,{scope:r,searchRef:R,onItemEnter:jt.useCallback(L=>{H(L)&&L.preventDefault()},[H]),onItemLeave:jt.useCallback(L=>{H(L)||(P.current?.focus(),E(null))},[H]),onTriggerLeave:jt.useCallback(L=>{H(L)&&L.preventDefault()},[H]),pointerGraceTimerRef:j,onPointerGraceIntentChange:jt.useCallback(L=>{D.current=L},[]),children:(0,Or.jsx)(B,{...q,children:(0,Or.jsx)(P1e,{asChild:!0,trapped:o,onMountAutoFocus:$i(i,L=>{L.preventDefault(),P.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,Or.jsx)(S1e,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Or.jsx)(N$t,{asChild:!0,...w,dir:g.dir,orientation:"vertical",loop:n,currentTabStopId:C,onCurrentTabStopIdChange:E,onEntryFocus:$i(u,L=>{g.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Or.jsx)(y$t,{role:"menu","aria-orientation":"vertical","data-state":OBt(b.open),"data-radix-menu-content":"",dir:g.dir,..._,...h,ref:A,style:{outline:"none",...h.style},onKeyDown:$i(h.onKeyDown,L=>{let K=L.target.closest("[data-radix-menu-content]")===L.currentTarget,J=L.ctrlKey||L.altKey||L.metaKey,ee=L.key.length===1;K&&(L.key==="Tab"&&L.preventDefault(),!J&&ee&&W(L.key));let Pe=P.current;if(L.target!==Pe||!Vpn.includes(L.key))return;L.preventDefault();let Z=x().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);nBt.includes(L.key)&&Z.reverse(),fmn(Z)}),onBlur:$i(t.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(I.current),R.current="")}),onPointerMove:$i(t.onPointerMove,W6(L=>{let z=L.target,K=F.current!==L.clientX;if(L.currentTarget.contains(z)&&K){let J=L.clientX>F.current?"right":"left";k.current=J,F.current=L.clientX}}))})})})})})})});lBt.displayName=pg;var rmn="MenuGroup",lje=jt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Or.jsx)(oc.div,{role:"group",...n,ref:e})});lje.displayName=rmn;var nmn="MenuLabel",cBt=jt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Or.jsx)(oc.div,{...n,ref:e})});cBt.displayName=nmn;var iue="MenuItem",rBt="menu.itemSelect",sue=jt.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=jt.useRef(null),a=G6(iue,t.__scopeMenu),s=sje(iue,t.__scopeMenu),u=Kc(e,i),l=jt.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(rBt,{bubbles:!0,cancelable:!0});d.addEventListener(rBt,p=>n?.(p),{once:!0}),Dse(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,Or.jsx)(dBt,{...o,ref:u,disabled:r,onClick:$i(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:$i(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:$i(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||nje.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});sue.displayName=iue;var dBt=jt.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=sje(iue,r),s=oBt(r),u=jt.useRef(null),l=Kc(e,u),[c,d]=jt.useState(!1),[f,p]=jt.useState("");return jt.useEffect(()=>{let m=u.current;m&&p((m.textContent??"").trim())},[i.children]),(0,Or.jsx)(V6.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,Or.jsx)(L$t,{asChild:!0,...s,focusable:!n,children:(0,Or.jsx)(oc.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:$i(t.onPointerMove,W6(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:$i(t.onPointerLeave,W6(m=>a.onItemLeave(m))),onFocus:$i(t.onFocus,()=>d(!0)),onBlur:$i(t.onBlur,()=>d(!1))})})})}),omn="MenuCheckboxItem",fBt=jt.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,Or.jsx)(yBt,{scope:t.__scopeMenu,checked:r,children:(0,Or.jsx)(sue,{role:"menuitemcheckbox","aria-checked":aue(r)?"mixed":r,...o,ref:e,"data-state":fje(r),onSelect:$i(o.onSelect,()=>n?.(aue(r)?!0:!r),{checkForDefaultPrevented:!1})})})});fBt.displayName=omn;var pBt="MenuRadioGroup",[imn,amn]=jD(pBt,{value:void 0,onValueChange:()=>{}}),mBt=jt.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=hr(n);return(0,Or.jsx)(imn,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,Or.jsx)(lje,{...o,ref:e})})});mBt.displayName=pBt;var hBt="MenuRadioItem",gBt=jt.forwardRef((t,e)=>{let{value:r,...n}=t,o=amn(hBt,t.__scopeMenu),i=r===o.value;return(0,Or.jsx)(yBt,{scope:t.__scopeMenu,checked:i,children:(0,Or.jsx)(sue,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":fje(i),onSelect:$i(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});gBt.displayName=hBt;var cje="MenuItemIndicator",[yBt,smn]=jD(cje,{checked:!1}),bBt=jt.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=smn(cje,r);return(0,Or.jsx)(rl,{present:n||aue(i.checked)||i.checked===!0,children:(0,Or.jsx)(oc.span,{...o,ref:e,"data-state":fje(i.checked)})})});bBt.displayName=cje;var umn="MenuSeparator",_Bt=jt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Or.jsx)(oc.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});_Bt.displayName=umn;var lmn="MenuArrow",vBt=jt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=J6(r);return(0,Or.jsx)(b$t,{...o,...n,ref:e})});vBt.displayName=lmn;var dje="MenuSub",[cmn,wBt]=jD(dje),dmn=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=wI(dje,e),a=J6(e),[s,u]=jt.useState(null),[l,c]=jt.useState(null),d=hr(o);return jt.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,Or.jsx)(k1e,{...a,children:(0,Or.jsx)(iBt,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,Or.jsx)(cmn,{scope:e,contentId:us(),triggerId:us(),trigger:s,onTriggerChange:u,children:r})})})};dmn.displayName=dje;var H6="MenuSubTrigger",SBt=jt.forwardRef((t,e)=>{let r=wI(H6,t.__scopeMenu),n=G6(H6,t.__scopeMenu),o=wBt(H6,t.__scopeMenu),i=sje(H6,t.__scopeMenu),a=jt.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:t.__scopeMenu},c=jt.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return jt.useEffect(()=>c,[c]),jt.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,Or.jsx)(ije,{asChild:!0,...l,children:(0,Or.jsx)(dBt,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":OBt(r.open),...t,ref:N6(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:$i(t.onPointerMove,W6(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:$i(t.onPointerLeave,W6(d=>{c();let f=r.content?.getBoundingClientRect();if(f){let p=r.content?.dataset.side,m=p==="right",h=m?-5:5,b=f[m?"left":"right"],g=f[m?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+h,y:d.clientY},{x:b,y:f.top},{x:g,y:f.top},{x:g,y:f.bottom},{x:b,y:f.bottom}],side:p}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:$i(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||Wpn[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});SBt.displayName=H6;var xBt="MenuSubContent",CBt=jt.forwardRef((t,e)=>{let r=sBt(pg,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=wI(pg,t.__scopeMenu),a=G6(pg,t.__scopeMenu),s=wBt(xBt,t.__scopeMenu),u=jt.useRef(null),l=Kc(e,u);return(0,Or.jsx)(V6.Provider,{scope:t.__scopeMenu,children:(0,Or.jsx)(rl,{present:n||i.open,children:(0,Or.jsx)(V6.Slot,{scope:t.__scopeMenu,children:(0,Or.jsx)(uje,{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:$i(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:$i(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:$i(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=Kpn[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});CBt.displayName=xBt;function OBt(t){return t?"open":"closed"}function aue(t){return t==="indeterminate"}function fje(t){return aue(t)?"indeterminate":t?"checked":"unchecked"}function fmn(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function pmn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function mmn(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=pmn(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 hmn(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 gmn(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return hmn(r,e)}function W6(t){return e=>e.pointerType==="mouse"?t(e):void 0}var PBt=aBt,EBt=ije,TBt=uBt,ABt=lBt,IBt=lje,MBt=cBt,RBt=sue,jBt=fBt,DBt=mBt,NBt=gBt,LBt=bBt,FBt=_Bt,kBt=vBt;var $Bt=SBt,BBt=CBt;var ac=$(St(),1),pje="DropdownMenu",[bmn,MYo]=ii(pje,[oje]),Rf=oje(),[_mn,qBt]=bmn(pje),Y6=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=Rf(e),l=Ol.useRef(null),[c=!1,d]=Cl({prop:o,defaultProp:i,onChange:a});return(0,ac.jsx)(_mn,{scope:e,triggerId:us(),triggerRef:l,contentId:us(),open:c,onOpenChange:d,onOpenToggle:Ol.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,ac.jsx)(PBt,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};Y6.displayName=pje;var UBt="DropdownMenuTrigger",Z6=Ol.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=qBt(UBt,r),a=Rf(r);return(0,ac.jsx)(EBt,{asChild:!0,...a,children:(0,ac.jsx)(QFt.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:Mse(e,i.triggerRef),onPointerDown:D6(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:D6(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});Z6.displayName=UBt;var vmn="DropdownMenuPortal",zBt=t=>{let{__scopeDropdownMenu:e,...r}=t,n=Rf(e);return(0,ac.jsx)(TBt,{...n,...r})};zBt.displayName=vmn;var HBt="DropdownMenuContent",VBt=Ol.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=qBt(HBt,r),i=Rf(r),a=Ol.useRef(!1);return(0,ac.jsx)(ABt,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:D6(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:D6(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)"}})});VBt.displayName=HBt;var wmn="DropdownMenuGroup",Smn=Ol.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Rf(r);return(0,ac.jsx)(IBt,{...o,...n,ref:e})});Smn.displayName=wmn;var xmn="DropdownMenuLabel",WBt=Ol.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Rf(r);return(0,ac.jsx)(MBt,{...o,...n,ref:e})});WBt.displayName=xmn;var Cmn="DropdownMenuItem",KBt=Ol.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Rf(r);return(0,ac.jsx)(RBt,{...o,...n,ref:e})});KBt.displayName=Cmn;var Omn="DropdownMenuCheckboxItem",JBt=Ol.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Rf(r);return(0,ac.jsx)(jBt,{...o,...n,ref:e})});JBt.displayName=Omn;var Pmn="DropdownMenuRadioGroup",Emn=Ol.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Rf(r);return(0,ac.jsx)(DBt,{...o,...n,ref:e})});Emn.displayName=Pmn;var Tmn="DropdownMenuRadioItem",GBt=Ol.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Rf(r);return(0,ac.jsx)(NBt,{...o,...n,ref:e})});GBt.displayName=Tmn;var Amn="DropdownMenuItemIndicator",YBt=Ol.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Rf(r);return(0,ac.jsx)(LBt,{...o,...n,ref:e})});YBt.displayName=Amn;var Imn="DropdownMenuSeparator",ZBt=Ol.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Rf(r);return(0,ac.jsx)(FBt,{...o,...n,ref:e})});ZBt.displayName=Imn;var Mmn="DropdownMenuArrow",Rmn=Ol.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Rf(r);return(0,ac.jsx)(kBt,{...o,...n,ref:e})});Rmn.displayName=Mmn;var jmn="DropdownMenuSubTrigger",XBt=Ol.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Rf(r);return(0,ac.jsx)($Bt,{...o,...n,ref:e})});XBt.displayName=jmn;var Dmn="DropdownMenuSubContent",QBt=Ol.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Rf(r);return(0,ac.jsx)(BBt,{...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)"}})});QBt.displayName=Dmn;var eqt=Y6,tqt=Z6,rqt=zBt,mje=VBt;var hje=WBt,gje=KBt,yje=JBt;var bje=GBt,_je=YBt,vje=ZBt;var wje=XBt,Sje=QBt;var SI=eqt,xI=tqt;var Lmn=Ai.forwardRef(({className:t,inset:e,children:r,...n},o)=>Ai.createElement(wje,{ref:o,className:Ce("tw-flex tw-cursor-default tw-select-none tw-items-center tw-gap-2 tw-rounded-sm tw-px-2 tw-py-1.5 tw-text-sm tw-outline-none focus:tw-bg-dropdown-hover data-[state=open]:tw-bg-dropdown-hover [&_svg]:tw-pointer-events-none [&_svg]:tw-size-4 [&_svg]:tw-shrink-0",e&&"tw-pl-8",t),...n},r,Ai.createElement(oC,{className:"tw-ml-auto"})));Lmn.displayName=wje.displayName;var Fmn=Ai.forwardRef(({className:t,...e},r)=>Ai.createElement(Sje,{ref:r,className:Ce("tw-z-[50] tw-min-w-32 tw-overflow-hidden tw-rounded-md tw-border tw-bg-primary tw-p-1 tw-text-normal tw-shadow-lg data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",t),...e}));Fmn.displayName=Sje.displayName;var mg=Ai.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>Ai.createElement(rqt,{container:r??activeDocument.body},Ai.createElement(mje,{ref:o,sideOffset:e,className:Ce("tw-z-[50] tw-min-w-32 tw-overflow-hidden tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-1 tw-text-normal tw-shadow-md","data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",t),...n})));mg.displayName=mje.displayName;var Ho=Ai.forwardRef(({className:t,inset:e,...r},n)=>Ai.createElement(gje,{ref:n,className:Ce("tw-relative tw-flex tw-cursor-default tw-select-none tw-items-center tw-gap-2 tw-rounded-sm tw-px-2 tw-py-1.5 tw-text-sm tw-outline-none tw-transition-colors focus:tw-bg-dropdown-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50 [&>svg]:tw-size-4 [&>svg]:tw-shrink-0",e&&"tw-pl-8",t),...r}));Ho.displayName=gje.displayName;var kmn=Ai.forwardRef(({className:t,children:e,checked:r,...n},o)=>Ai.createElement(yje,{ref:o,className:Ce("tw-relative tw-flex tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-py-1.5 tw-pl-8 tw-pr-2 tw-text-sm tw-outline-none tw-transition-colors focus:tw-bg-dropdown-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t),checked:r,...n},Ai.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},Ai.createElement(_je,null,Ai.createElement(Nl,{className:"tw-size-4"}))),e));kmn.displayName=yje.displayName;var $mn=Ai.forwardRef(({className:t,children:e,...r},n)=>Ai.createElement(bje,{ref:n,className:Ce("tw-relative tw-flex tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-py-1.5 tw-pl-8 tw-pr-2 tw-text-sm tw-outline-none tw-transition-colors focus:tw-bg-dropdown-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t),...r},Ai.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},Ai.createElement(_je,null,Ai.createElement(R2,{className:"tw-size-2 tw-fill-current"}))),e));$mn.displayName=bje.displayName;var Bmn=Ai.forwardRef(({className:t,inset:e,...r},n)=>Ai.createElement(hje,{ref:n,className:Ce("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",e&&"tw-pl-8",t),...r}));Bmn.displayName=hje.displayName;var qmn=Ai.forwardRef(({className:t,...e},r)=>Ai.createElement(vje,{ref:r,className:Ce("-tw-mx-1 tw-my-1 tw-h-px",t),...e}));qmn.displayName=vje.displayName;var Umn=({className:t,...e})=>Ai.createElement("span",{className:Ce("tw-ml-auto tw-text-xs tw-tracking-widest tw-opacity-60",t),...e});Umn.displayName="DropdownMenuShortcut";var X6=$(Y());var qq=X6.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 X6.createElement("div",{role:"switch","aria-checked":t,"aria-disabled":r,"data-state":t?"checked":"unchecked","data-disabled":r?"":void 0,ref:i,tabIndex:r?-1:0,className:Ce("tw-relative tw-inline-flex tw-h-5.5 tw-w-10 tw-shrink-0 tw-cursor-pointer tw-items-center tw-rounded-full tw-transition-colors","focus-visible:tw-outline-none focus-visible:tw-ring-2 focus-visible:tw-ring-ring focus-visible:tw-ring-offset-2",t?"tw-bg-interactive-accent":"tw-bg-[--background-modifier-border-hover]",r&&"tw-cursor-not-allowed tw-opacity-50",n),onClick:a,onKeyDown:s,...o},X6.createElement("div",{className:Ce("tw-pointer-events-none tw-block tw-size-4 tw-rounded-full tw-bg-toggle-thumb tw-shadow-lg tw-ring-0 tw-transition-transform",t?"tw-translate-x-5.5":"tw-translate-x-0.5")}))});qq.displayName="SettingSwitch";var e5=$(Y());var Yr=$(Y(),1);function By(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var oqt=$(Y(),1);function nqt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function xje(...t){return e=>{let r=!1,n=t.map(o=>{let i=nqt(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():nqt(t[o],null)}}}}function fP(...t){return oqt.useCallback(xje(...t),t)}var Va=$(Y(),1);var iqt=$(Y(),1),aqt=$(Ms(),1);var Yc=$(Y(),1);var Uq=$(St(),1),Oje=Yc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Yc.Children.toArray(r),i=o.find(zmn);if(i){let a=i.props.children,s=o.map(u=>u===i?Yc.Children.count(a)>1?Yc.Children.only(null):Yc.isValidElement(a)?a.props.children:null:u);return(0,Uq.jsx)(Cje,{...n,ref:e,children:Yc.isValidElement(a)?Yc.cloneElement(a,void 0,s):null})}return(0,Uq.jsx)(Cje,{...n,ref:e,children:r})});Oje.displayName="Slot";var Cje=Yc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Yc.isValidElement(r)){let o=Vmn(r);return Yc.cloneElement(r,{...Hmn(n,r.props),ref:e?xje(e,o):o})}return Yc.Children.count(r)>1?Yc.Children.only(null):null});Cje.displayName="SlotClone";var Pje=({children:t})=>(0,Uq.jsx)(Uq.Fragment,{children:t});function zmn(t){return Yc.isValidElement(t)&&t.type===Pje}function Hmn(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 Vmn(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 sqt=$(St(),1),Wmn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],hg=Wmn.reduce((t,e)=>{let r=iqt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Oje:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,sqt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function uqt(t,e){t&&aqt.flushSync(()=>t.dispatchEvent(e))}var Tje=$(St(),1),Kmn="DismissableLayer",Eje="dismissableLayer.update",Jmn="dismissableLayer.pointerDownOutside",Gmn="dismissableLayer.focusOutside",lqt,dqt=Va.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Aje=Va.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Va.useContext(dqt),[c,d]=Va.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Va.useState({}),m=fP(e,P=>d(P)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,C=Xmn(P=>{let A=P.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=Qmn(P=>{let A=P.target;[...l.branches].some(R=>R.contains(A))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return ox(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Va.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(lqt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),cqt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=lqt)}},[c,f,r,l]),Va.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),cqt())},[c,l]),Va.useEffect(()=>{let P=()=>p({});return document.addEventListener(Eje,P),()=>document.removeEventListener(Eje,P)},[]),(0,Tje.jsx)(hg.div,{...u,ref:m,style:{pointerEvents:w?x?"auto":"none":void 0,...t.style},onFocusCapture:By(t.onFocusCapture,E.onFocusCapture),onBlurCapture:By(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:By(t.onPointerDownCapture,C.onPointerDownCapture)})});Aje.displayName=Kmn;var Ymn="DismissableLayerBranch",Zmn=Va.forwardRef((t,e)=>{let r=Va.useContext(dqt),n=Va.useRef(null),o=fP(e,n);return Va.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,Tje.jsx)(hg.div,{...t,ref:o})});Zmn.displayName=Ymn;function Xmn(t,e=globalThis?.document){let r=hr(t),n=Va.useRef(!1),o=Va.useRef(()=>{});return Va.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){fqt(Jmn,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 Qmn(t,e=globalThis?.document){let r=hr(t),n=Va.useRef(!1);return Va.useEffect(()=>{let o=i=>{i.target&&!n.current&&fqt(Gmn,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 cqt(){let t=new CustomEvent(Eje);document.dispatchEvent(t)}function fqt(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?uqt(o,i):o.dispatchEvent(i)}var Lm=$(Y(),1);var pqt=$(Y(),1);var Ije=$(St(),1),ehn="Arrow",mqt=pqt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,Ije.jsx)(hg.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,Ije.jsx)("polygon",{points:"0,0 30,0 15,10"})})});mqt.displayName=ehn;var hqt=mqt;var CI=$(St(),1);var Mje="Popper",[gqt,Rje]=ii(Mje),[rhn,yqt]=gqt(Mje),bqt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Lm.useState(null);return(0,CI.jsx)(rhn,{scope:e,anchor:n,onAnchorChange:o,children:r})};bqt.displayName=Mje;var _qt="PopperAnchor",vqt=Lm.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=yqt(_qt,r),a=Lm.useRef(null),s=fP(e,a);return Lm.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,CI.jsx)(hg.div,{...o,ref:s})});vqt.displayName=_qt;var jje="PopperContent",[nhn,ohn]=gqt(jje),wqt=Lm.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=yqt(jje,r),[g,_]=Lm.useState(null),w=fP(e,ie=>_(ie)),[x,C]=Lm.useState(null),E=fg(x),P=E?.width??0,A=E?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},j=Array.isArray(l)?l:[l],D=j.length>0,k={padding:R,boundary:j.filter(ahn),altBoundary:D},{refs:F,floatingStyles:B,placement:q,isPositioned:W,middlewareData:H}=uI({strategy:"fixed",placement:I,whileElementsMounted:(...ie)=>cP(...ie,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[lI({mainAxis:o+A,alignmentAxis:a}),u&&cI({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?dI():void 0,...k}),u&&fI({...k}),pI({...k,apply:({elements:ie,rects:Ie,availableWidth:st,availableHeight:Te})=>{let{width:Qe,height:nt}=Ie.reference,Ht=ie.floating.style;Ht.setProperty("--radix-popper-available-width",`${st}px`),Ht.setProperty("--radix-popper-available-height",`${Te}px`),Ht.setProperty("--radix-popper-anchor-width",`${Qe}px`),Ht.setProperty("--radix-popper-anchor-height",`${nt}px`)}}),x&&hI({element:x,padding:s}),shn({arrowWidth:P,arrowHeight:A}),f&&mI({strategy:"referenceHidden",...k})]}),[L,z]=Cqt(q),K=hr(m);dn(()=>{W&&K?.()},[W,K]);let J=H.arrow?.x,ee=H.arrow?.y,Pe=H.arrow?.centerOffset!==0,[G,Z]=Lm.useState();return dn(()=>{g&&Z(window.getComputedStyle(g).zIndex)},[g]),(0,CI.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:W?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,CI.jsx)(nhn,{scope:r,placedSide:L,onArrowChange:C,arrowX:J,arrowY:ee,shouldHideArrow:Pe,children:(0,CI.jsx)(hg.div,{"data-side":L,"data-align":z,...h,ref:w,style:{...h.style,animation:W?void 0:"none"}})})})});wqt.displayName=jje;var Sqt="PopperArrow",ihn={top:"bottom",right:"left",bottom:"top",left:"right"},xqt=Lm.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=ohn(Sqt,n),a=ihn[i.placedSide];return(0,CI.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,CI.jsx)(hqt,{...o,ref:r,style:{...o.style,display:"block"}})})});xqt.displayName=Sqt;function ahn(t){return t!==null}var shn=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]=Cqt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function Cqt(t){let[e,r="center"]=t.split("-");return[e,r]}var Oqt=bqt,Pqt=vqt,Eqt=wqt,Tqt=xqt;var uue=$(Y(),1),Aqt=$(Ms(),1);var Iqt=$(St(),1),lhn="Portal",Dje=uue.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=uue.useState(!1);dn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Aqt.default.createPortal((0,Iqt.jsx)(hg.div,{...n,ref:e}),a):null});Dje.displayName=lhn;var Lqt=$(Y(),1);var jqt=$(Y(),1),hhn=$(Ms(),1);var Zc=$(Y(),1);var chn=$(Y(),1);function Mqt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Rqt(...t){return e=>{let r=!1,n=t.map(o=>{let i=Mqt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():Mqt(t[o],null)}}}}var zq=$(St(),1),Lje=Zc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Zc.Children.toArray(r),i=o.find(fhn);if(i){let a=i.props.children,s=o.map(u=>u===i?Zc.Children.count(a)>1?Zc.Children.only(null):Zc.isValidElement(a)?a.props.children:null:u);return(0,zq.jsx)(Nje,{...n,ref:e,children:Zc.isValidElement(a)?Zc.cloneElement(a,void 0,s):null})}return(0,zq.jsx)(Nje,{...n,ref:e,children:r})});Lje.displayName="Slot";var Nje=Zc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Zc.isValidElement(r)){let o=mhn(r);return Zc.cloneElement(r,{...phn(n,r.props),ref:e?Rqt(e,o):o})}return Zc.Children.count(r)>1?Zc.Children.only(null):null});Nje.displayName="SlotClone";var dhn=({children:t})=>(0,zq.jsx)(zq.Fragment,{children:t});function fhn(t){return Zc.isValidElement(t)&&t.type===dhn}function phn(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 mhn(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 Dqt=$(St(),1),ghn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Nqt=ghn.reduce((t,e)=>{let r=jqt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Lje:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Dqt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var Fqt=$(St(),1),yhn="VisuallyHidden",kqt=Lqt.forwardRef((t,e)=>(0,Fqt.jsx)(Nqt.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}}));kqt.displayName=yhn;var $qt=kqt;var nl=$(St(),1),[lue,PZo]=ii("Tooltip",[Rje]),cue=Rje(),Bqt="TooltipProvider",_hn=700,Fje="tooltip.open",[vhn,$je]=lue(Bqt),qqt=t=>{let{__scopeTooltip:e,delayDuration:r=_hn,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,[a,s]=Yr.useState(!0),u=Yr.useRef(!1),l=Yr.useRef(0);return Yr.useEffect(()=>{let c=l.current;return()=>window.clearTimeout(c)},[]),(0,nl.jsx)(vhn,{scope:e,isOpenDelayed:a,delayDuration:r,onOpen:Yr.useCallback(()=>{window.clearTimeout(l.current),s(!1)},[]),onClose:Yr.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>s(!0),n)},[n]),isPointerInTransitRef:u,onPointerInTransitChange:Yr.useCallback(c=>{u.current=c},[]),disableHoverableContent:o,children:i})};qqt.displayName=Bqt;var due="Tooltip",[whn,Q6]=lue(due),Uqt=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=$je(due,t.__scopeTooltip),l=cue(e),[c,d]=Yr.useState(null),f=us(),p=Yr.useRef(0),m=a??u.disableHoverableContent,h=s??u.delayDuration,b=Yr.useRef(!1),[g=!1,_]=Cl({prop:n,defaultProp:o,onChange:P=>{P?(u.onOpen(),document.dispatchEvent(new CustomEvent(Fje))):u.onClose(),i?.(P)}}),w=Yr.useMemo(()=>g?b.current?"delayed-open":"instant-open":"closed",[g]),x=Yr.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,_(!0)},[_]),C=Yr.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),E=Yr.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{b.current=!0,_(!0),p.current=0},h)},[h,_]);return Yr.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,nl.jsx)(Oqt,{...l,children:(0,nl.jsx)(whn,{scope:e,contentId:f,open:g,stateAttribute:w,trigger:c,onTriggerChange:d,onTriggerEnter:Yr.useCallback(()=>{u.isOpenDelayed?E():x()},[u.isOpenDelayed,E,x]),onTriggerLeave:Yr.useCallback(()=>{m?C():(window.clearTimeout(p.current),p.current=0)},[C,m]),onOpen:x,onClose:C,disableHoverableContent:m,children:r})})};Uqt.displayName=due;var kje="TooltipTrigger",zqt=Yr.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=Q6(kje,r),i=$je(kje,r),a=cue(r),s=Yr.useRef(null),u=fP(e,s,o.onTriggerChange),l=Yr.useRef(!1),c=Yr.useRef(!1),d=Yr.useCallback(()=>l.current=!1,[]);return Yr.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,nl.jsx)(Pqt,{asChild:!0,...a,children:(0,nl.jsx)(hg.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:By(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:By(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:By(t.onPointerDown,()=>{l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:By(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:By(t.onBlur,o.onClose),onClick:By(t.onClick,o.onClose)})})});zqt.displayName=kje;var Bje="TooltipPortal",[Shn,xhn]=lue(Bje,{forceMount:void 0}),Hqt=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=Q6(Bje,e);return(0,nl.jsx)(Shn,{scope:e,forceMount:r,children:(0,nl.jsx)(rl,{present:r||i.open,children:(0,nl.jsx)(Dje,{asChild:!0,container:o,children:n})})})};Hqt.displayName=Bje;var Hq="TooltipContent",Vqt=Yr.forwardRef((t,e)=>{let r=xhn(Hq,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=Q6(Hq,t.__scopeTooltip);return(0,nl.jsx)(rl,{present:n||a.open,children:a.disableHoverableContent?(0,nl.jsx)(Wqt,{side:o,...i,ref:e}):(0,nl.jsx)(Chn,{side:o,...i,ref:e})})}),Chn=Yr.forwardRef((t,e)=>{let r=Q6(Hq,t.__scopeTooltip),n=$je(Hq,t.__scopeTooltip),o=Yr.useRef(null),i=fP(e,o),[a,s]=Yr.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=Yr.useCallback(()=>{s(null),d(!1)},[d]),p=Yr.useCallback((m,h)=>{let b=m.currentTarget,g={x:m.clientX,y:m.clientY},_=Thn(g,b.getBoundingClientRect()),w=Ahn(g,_),x=Ihn(h.getBoundingClientRect()),C=Rhn([...w,...x]);s(C),d(!0)},[d]);return Yr.useEffect(()=>()=>f(),[f]),Yr.useEffect(()=>{if(u&&c){let m=b=>p(b,c),h=b=>p(b,u);return u.addEventListener("pointerleave",m),c.addEventListener("pointerleave",h),()=>{u.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",h)}}},[u,c,p,f]),Yr.useEffect(()=>{if(a){let m=h=>{let b=h.target,g={x:h.clientX,y:h.clientY},_=u?.contains(b)||c?.contains(b),w=!Mhn(g,a);_?f():w&&(f(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[u,c,a,l,f]),(0,nl.jsx)(Wqt,{...t,ref:i})}),[Ohn,Phn]=lue(due,{isInside:!1}),Wqt=Yr.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=Q6(Hq,r),l=cue(r),{onClose:c}=u;return Yr.useEffect(()=>(document.addEventListener(Fje,c),()=>document.removeEventListener(Fje,c)),[c]),Yr.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,nl.jsx)(Aje,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,nl.jsxs)(Eqt,{"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,nl.jsx)(Pje,{children:n}),(0,nl.jsx)(Ohn,{scope:r,isInside:!0,children:(0,nl.jsx)($qt,{id:u.contentId,role:"tooltip",children:o||n})})]})})});Vqt.displayName=Hq;var Kqt="TooltipArrow",Ehn=Yr.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=cue(r);return Phn(Kqt,r).isInside?null:(0,nl.jsx)(Tqt,{...o,...n,ref:e})});Ehn.displayName=Kqt;function Thn(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 Ahn(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 Ihn(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 Mhn(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 Rhn(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),jhn(e)}function jhn(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 fue=qqt,Jqt=Uqt,Gqt=zqt,Yqt=Hqt,qje=Vqt;var xa=fue,Yt=Jqt,Zt=Gqt,Kt=e5.forwardRef(({className:t,sideOffset:e=4,...r},n)=>e5.createElement(Yqt,{container:activeDocument.body},e5.createElement(qje,{ref:n,sideOffset:e,className:Ce("tw-z-[50] tw-overflow-hidden tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-secondary tw-px-3 tw-py-1.5 tw-text-xs tw-text-normal tw-animate-in tw-fade-in-0 tw-zoom-in-95 data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=closed]:tw-zoom-out-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",t),...r})));Kt.displayName=qje.displayName;Zr();Jt();var Fm=require("obsidian"),Pt=$(Y());async function Dhn(){try{await Li.getInstance().indexVaultToVectorStore(),new Fm.Notice("Vault index refreshed.")}catch(t){console.error("Error refreshing vault index:",t),new Fm.Notice("Failed to refresh vault index. Check console for details.")}}async function Nhn(){try{await Li.getInstance().indexVaultToVectorStore(!0),new Fm.Notice("Vault force reindexed.")}catch(t){console.error("Error force reindexing vault:",t),new Fm.Notice("Failed to force reindex vault. Check console for details.")}}async function pue(){let t=hc();if(!t){new Fm.Notice("No project is currently selected to reload.");return}try{XP(!0),await hy.getInstance().invalidateMarkdownContext(t,!0);let e=app.plugins.getPlugin("copilot");if(e&&e.projectManager)await e.projectManager.getProjectContext(t.id),new Fm.Notice(`Project context for "${t.name}" reloaded successfully.`);else throw new Error("Copilot plugin or ProjectManager not available.")}catch(e){console.error("Error reloading project context:",e),new Fm.Notice("Failed to reload project context. Check console for details.")}finally{XP(!1)}}async function Lhn(){let t=hc();if(!t){new Fm.Notice("No project is currently selected to rebuild.");return}new Dy(app,async()=>{try{XP(!0),new Fm.Notice(`Force rebuilding context for project: ${t.name}... This will take some time and re-fetch all data.`,1e4),await hy.getInstance().clearForProject(t),new Fm.Notice(`Cache for project "${t.name}" has been cleared.`);let r=app.plugins.getPlugin("copilot");if(r&&r.projectManager)await r.projectManager.getProjectContext(t.id),new Fm.Notice(`Project context for "${t.name}" rebuilt successfully from scratch.`);else throw new Error("Copilot plugin or ProjectManager not available for rebuild.")}catch(r){console.error("Error force rebuilding project context:",r),new Fm.Notice("Failed to force rebuild project context. Check console for details.")}finally{XP(!1)}},`DANGER: This will permanently delete all cached data (markdown, web URLs, YouTube transcripts, and processed file content) for the project "${t.name}" from both memory and disk. The context will then be rebuilt from scratch, re-fetching all remote data and re-processing all local files. This cannot be undone. Are you absolutely sure?`,"Force Rebuild Project Context").open()}function Xqt({onNewChat:t,onSaveAsNote:e,onLoadHistory:r,onModeChange:n,onCloseProject:o}){let i=Pn(),[a,s]=Rg(),u=rB(),l=c=>{s(c),n(c),c!=="project"&&(kM(null),o?.())};return Pt.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-p-1"},Pt.default.createElement("div",{className:"tw-flex-1"},Pt.default.createElement(Y6,null,Pt.default.createElement(Z6,{asChild:!0},Pt.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-ml-1"},a==="llm_chain"&&"chat",a==="vault_qa"&&"vault QA",a==="copilot_plus"&&Pt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Pt.default.createElement(fh,{className:"tw-size-4"}),"copilot plus (beta)"),a==="project"&&"projects (alpha)",Pt.default.createElement(Di,{className:"tw-mt-0.5 tw-size-5"}))),Pt.default.createElement(mg,{align:"start"},Pt.default.createElement(Ho,{onSelect:()=>{l("llm_chain")}},"chat"),Pt.default.createElement(Ho,{onSelect:()=>{l("vault_qa")}},"vault QA"),u?Pt.default.createElement(Ho,{onSelect:()=>{l("copilot_plus")}},Pt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Pt.default.createElement(fh,{className:"tw-size-4"}),"copilot plus (beta)")):Pt.default.createElement(Ho,{onSelect:()=>{uR(zx.CHAT_MODE_SELECT),o?.()}},"copilot plus (beta)",Pt.default.createElement(lC,{className:"tw-size-3"})),u?Pt.default.createElement(Ho,{className:"tw-flex tw-items-center tw-gap-1",onSelect:()=>{l("project")}},Pt.default.createElement(aR,{className:"tw-size-4"}),"projects (alpha)"):Pt.default.createElement(Ho,{onSelect:()=>{uR(zx.CHAT_MODE_SELECT),o?.()}},"copilot plus (beta)",Pt.default.createElement(lC,{className:"tw-size-3"}))))),Pt.default.createElement("div",null,Pt.default.createElement(Yt,null,Pt.default.createElement(Zt,{asChild:!0},Pt.default.createElement(he,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},Pt.default.createElement(H2,{className:"tw-size-4"}))),Pt.default.createElement(Kt,null,"New Chat")),!i.autosaveChat&&Pt.default.createElement(Yt,null,Pt.default.createElement(Zt,{asChild:!0},Pt.default.createElement(he,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},Pt.default.createElement(F2,{className:"tw-size-4"}))),Pt.default.createElement(Kt,null,"Save Chat as Note")),Pt.default.createElement(Yt,null,Pt.default.createElement(Zt,{asChild:!0},Pt.default.createElement(he,{variant:"ghost2",size:"icon",title:"Chat History",onClick:r},Pt.default.createElement(q2,{className:"tw-size-4"}))),Pt.default.createElement(Kt,null,"Chat History")),Pt.default.createElement(Y6,null,Pt.default.createElement(Z6,{asChild:!0},Pt.default.createElement(he,{variant:"ghost2",size:"icon",title:"Advanced Settings"},Pt.default.createElement(OE,{className:"tw-size-4"}))),Pt.default.createElement(mg,{align:"end",className:"tw-w-64"},Pt.default.createElement(Ho,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),Je("showSuggestedPrompts",!i.showSuggestedPrompts)}},Pt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pt.default.createElement(fh,{className:"tw-size-4"}),"Suggested Prompt"),Pt.default.createElement(qq,{checked:i.showSuggestedPrompts})),Pt.default.createElement(Ho,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),Je("showRelevantNotes",!i.showRelevantNotes)}},Pt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pt.default.createElement(aC,{className:"tw-size-4"}),"Relevant Note"),Pt.default.createElement(qq,{checked:i.showRelevantNotes})),a==="project"?Pt.default.createElement(Pt.default.Fragment,null,Pt.default.createElement(Ho,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>pue()},Pt.default.createElement(Ob,{className:"tw-size-4"}),"Reload Current Project"),Pt.default.createElement(Ho,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>Lhn()},Pt.default.createElement(yf,{className:"tw-size-4"}),"Force Rebuild Context")):Pt.default.createElement(Pt.default.Fragment,null,Pt.default.createElement(Ho,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>Dhn()},Pt.default.createElement(Ob,{className:"tw-size-4"}),"Refresh Vault Index"),Pt.default.createElement(Ho,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>{new Dy(app,()=>Nhn(),"This will delete and rebuild your entire vault index from scratch. This operation cannot be undone. Are you sure you want to proceed?","Force Reindex Vault").open()}},Pt.default.createElement(yf,{className:"tw-size-4"}),"Force Reindex Vault"))))))}pf();var Qqt=require("obsidian");var mue=require("obsidian"),Vq=class extends mue.FuzzySuggestModal{constructor(e){super(e),this.activeNote=e.workspace.getActiveFile()}getOrderedNotes(e=[]){let r=this.app.workspace.getLastOpenFiles().map(i=>this.app.vault.getAbstractFileByPath(i)).filter(i=>i instanceof mue.TFile&&(i.extension==="md"||i.extension==="pdf"||i.extension==="canvas")&&!e.includes(i.path)&&i.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(i=>i.extension==="md"||i.extension==="pdf"||i.extension==="canvas").filter(i=>!r.some(a=>a.path===i.path)&&!e.includes(i.path)&&i.path!==this.activeNote?.path);return[...this.activeNote?[this.activeNote]:[],...r,...o]}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n==="pdf"?o+=" (PDF)":n==="canvas"&&(o+=" (Canvas)"),o}};var OI=class extends Vq{constructor({app:e,onNoteSelect:r,excludeNotePaths:n,titleOnly:o=!1}){super(e),this.onNoteSelect=r,this.availableNotes=this.getOrderedNotes(n),this.titleOnly=o}getItems(){if(this.titleOnly){let e=new Map;return this.availableNotes.forEach(r=>{e.set(r.basename,r)}),Array.from(e.values())}return this.availableNotes}getItemText(e){let r=e.path===this.activeNote?.path;return this.formatNoteTitle(e.basename,r,e.extension)}onChooseItem(e,r){this.onNoteSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof Qqt.TFile){let o=n.createDiv(),i=e.item;o.setText(this.formatNoteTitle(i.basename,i===this.activeNote,i.extension)),this.titleOnly||n.createDiv({cls:"mt-1 text-muted text-xs"}).setText(i.path)}}};var hue=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()}};pf();var eUt=require("obsidian");Zr();var Wq=class t{constructor(){}static getInstance(){return t.instance||(t.instance=new t),t.instance}async processEmbeddedPDFs(e,r,n){let o=/!\[\[(.*?\.pdf)\]\]/g,i=[...e.matchAll(o)];for(let a of i){let s=a[1],u=r.getAbstractFileByPath(s);if(u instanceof eUt.TFile)try{let l=await n.parseFile(u,r);e=e.replace(a[0],`
Embedded PDF (${s}):
${l}
`)}catch(l){console.error(`Error processing embedded PDF ${s}:`,l),e=e.replace(a[0],`
Embedded PDF (${s}): [Error: Could not process PDF]
`)}}return e}async processContextNotes(e,r,n,o,i,a,s){let u="",l=async(d,f=jz)=>{try{if(e.has(d.path)){console.log(`Skipping note ${d.path} as it was included via custom prompt.`);return}if(console.log(`Processing note: ${d.path}, extension: ${d.extension}, chain: ${s}`),!r.supportsExtension(d.extension)){console.warn(`Unsupported file type: ${d.extension}`);return}if(s!=="copilot_plus"&&d.extension!=="md"&&d.extension!=="canvas"){console.warn(`File type ${d.extension} requires Copilot Plus mode for context processing.`);return}let p=await r.parseFile(d,n);d.extension==="md"&&s==="copilot_plus"&&(p=await this.processEmbeddedPDFs(p,n,r)),u+=`
<${f}>
Title: [[${d.basename}]]
Path: ${d.path}
${p}
</${f}>`}catch(p){console.error(`Error processing file ${d.path}:`,p),u+=`
<${f}_error>
Title: [[${d.basename}]]
Path: ${d.path}
[Error: Could not process file]
</${f}_error>`}},c=new Set;i&&a&&(await l(a,"active_note"),c.add(a.path));for(let d of o)c.has(d.path)||(await l(d),c.add(d.path));return u}async hasEmbeddedPDFs(e){return/!\[\[(.*?\.pdf)\]\]/g.test(e)}async addNoteToContext(e,r,n,o,i,a){if(n.some(l=>l.path===e.path))return;let s=await r.read(e),u=await this.hasEmbeddedPDFs(s);o&&e.path===o.path&&a(!0),i(l=>[...l,Object.assign(e,{wasAddedViaReference:!0,hasEmbeddedPDFs:u})])}};Jt();yn();var EI=require("obsidian"),tt=$(Y());var hn=$(Y()),Si=$(uUt());function PI(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 $hn=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 DD(t,e,r){let n=Bhn(t),{webkitRelativePath:o}=t,i=typeof e=="string"?e:typeof o=="string"&&o.length>0?o:`./${t.name}`;return typeof n.path!="string"&&lUt(n,"path",i),r!==void 0&&Object.defineProperty(n,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),lUt(n,"relativePath",i),n}function Bhn(t){let{name:e}=t;if(e&&e.lastIndexOf(".")!==-1&&!t.type){let n=e.split(".").pop().toLowerCase(),o=$hn.get(n);o&&Object.defineProperty(t,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return t}function lUt(t,e,r){Object.defineProperty(t,e,{value:r,writable:!1,configurable:!1,enumerable:!0})}var qhn=[".DS_Store","Thumbs.db"];function zje(t){return PI(this,void 0,void 0,function*(){return gue(t)&&Uhn(t.dataTransfer)?Whn(t.dataTransfer,t.type):zhn(t)?Hhn(t):Array.isArray(t)&&t.every(e=>"getFile"in e&&typeof e.getFile=="function")?Vhn(t):[]})}function Uhn(t){return gue(t)}function zhn(t){return gue(t)&&gue(t.target)}function gue(t){return typeof t=="object"&&t!==null}function Hhn(t){return Uje(t.target.files).map(e=>DD(e))}function Vhn(t){return PI(this,void 0,void 0,function*(){return(yield Promise.all(t.map(r=>r.getFile()))).map(r=>DD(r))})}function Whn(t,e){return PI(this,void 0,void 0,function*(){if(t.items){let r=Uje(t.items).filter(o=>o.kind==="file");if(e!=="drop")return r;let n=yield Promise.all(r.map(Khn));return cUt(fUt(n))}return cUt(Uje(t.files).map(r=>DD(r)))})}function cUt(t){return t.filter(e=>qhn.indexOf(e.name)===-1)}function Uje(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 Khn(t){if(typeof t.webkitGetAsEntry!="function")return dUt(t);let e=t.webkitGetAsEntry();return e&&e.isDirectory?pUt(e):dUt(t,e)}function fUt(t){return t.reduce((e,r)=>[...e,...Array.isArray(r)?fUt(r):[r]],[])}function dUt(t,e){return PI(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,DD(a)}}let n=t.getAsFile();if(!n)throw new Error(`${t} is not a File`);return DD(n,(r=e?.fullPath)!==null&&r!==void 0?r:void 0)})}function Jhn(t){return PI(this,void 0,void 0,function*(){return t.isDirectory?pUt(t):Ghn(t)})}function pUt(t){let e=t.createReader();return new Promise((r,n)=>{let o=[];function i(){e.readEntries(a=>PI(this,void 0,void 0,function*(){if(a.length){let s=Promise.all(a.map(Jhn));o.push(s),i()}else try{let s=yield Promise.all(o);r(s)}catch(s){n(s)}}),a=>{n(a)})}i()})}function Ghn(t){return PI(this,void 0,void 0,function*(){return new Promise((e,r)=>{t.file(n=>{let o=DD(n,t.fullPath);e(o)},n=>{r(n)})})})}var yue=$(mUt());function hUt(t){return Xhn(t)||Zhn(t)||wUt(t)||Yhn()}function Yhn(){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 Zhn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Xhn(t){if(Array.isArray(t))return Vje(t)}function gUt(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 yUt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gUt(Object(r),!0).forEach(function(n){vUt(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gUt(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function vUt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function t5(t,e){return tgn(t)||egn(t,e)||wUt(t,e)||Qhn()}function Qhn(){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 wUt(t,e){if(t){if(typeof t=="string")return Vje(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 Vje(t,e)}}function Vje(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 egn(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 tgn(t){if(Array.isArray(t))return t}var rgn=typeof yue.default=="function"?yue.default:yue.default.default,ngn="file-invalid-type",ogn="file-too-large",ign="file-too-small",agn="too-many-files";var sgn=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:ngn,message:"File type must be ".concat(n)}},bUt=function(e){return{code:ogn,message:"File is larger than ".concat(e," ").concat(e===1?"byte":"bytes")}},_Ut=function(e){return{code:ign,message:"File is smaller than ".concat(e," ").concat(e===1?"byte":"bytes")}},SUt={code:agn,message:"Too many files"};function Wje(t,e){var r=t.type==="application/x-moz-file"||rgn(t,e);return[r,r?null:sgn(e)]}function Kje(t,e,r){if(ND(t.size))if(ND(e)&&ND(r)){if(t.size>r)return[!1,bUt(r)];if(t.size<e)return[!1,_Ut(e)]}else{if(ND(e)&&t.size<e)return[!1,_Ut(e)];if(ND(r)&&t.size>r)return[!1,bUt(r)]}return[!0,null]}function ND(t){return t!=null}function xUt(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=Wje(u,r),c=t5(l,1),d=c[0],f=Kje(u,n,o),p=t5(f,1),m=p[0],h=s?s(u):null;return d&&m&&!h})}function r5(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function n5(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 Jje(t){t.preventDefault()}function ugn(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function lgn(t){return t.indexOf("Edge/")!==-1}function CUt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return ugn(t)||lgn(t)}function qy(){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!r5(n)&&s&&s.apply(void 0,[n].concat(i)),r5(n)})}}function OUt(){return"showOpenFilePicker"in window}function PUt(t){if(ND(t)){var e=Object.entries(t).filter(function(r){var n=t5(r,2),o=n[0],i=n[1],a=!0;return IUt(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(MUt))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),a=!1),a}).reduce(function(r,n){var o=t5(n,2),i=o[0],a=o[1];return yUt(yUt({},r),{},vUt({},i,a))},{});return[{description:"Files",accept:e}]}return t}function EUt(t){if(ND(t))return Object.entries(t).reduce(function(e,r){var n=t5(r,2),o=n[0],i=n[1];return[].concat(hUt(e),[o],hUt(i))},[]).filter(function(e){return IUt(e)||MUt(e)}).join(",")}function TUt(t){return t instanceof DOMException&&(t.name==="AbortError"||t.code===t.ABORT_ERR)}function AUt(t){return t instanceof DOMException&&(t.name==="SecurityError"||t.code===t.SECURITY_ERR)}function IUt(t){return t==="audio/*"||t==="video/*"||t==="image/*"||t==="text/*"||t==="application/*"||/\w+\/[-+.\w]+/g.test(t)}function MUt(t){return/^.*\.[\w]+$/.test(t)}var cgn=["children"],dgn=["open"],fgn=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],pgn=["refKey","onChange","onClick"];function mgn(t){return ygn(t)||ggn(t)||DUt(t)||hgn()}function hgn(){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 ggn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ygn(t){if(Array.isArray(t))return Yje(t)}function Gje(t,e){return vgn(t)||_gn(t,e)||DUt(t,e)||bgn()}function bgn(){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 DUt(t,e){if(t){if(typeof t=="string")return Yje(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 Yje(t,e)}}function Yje(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 _gn(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 vgn(t){if(Array.isArray(t))return t}function RUt(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 Wa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?RUt(Object(r),!0).forEach(function(n){Zje(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):RUt(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Zje(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bue(t,e){if(t==null)return{};var r=wgn(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 wgn(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 Qje=(0,hn.forwardRef)(function(t,e){var r=t.children,n=bue(t,cgn),o=eDe(n),i=o.open,a=bue(o,dgn);return(0,hn.useImperativeHandle)(e,function(){return{open:i}},[i]),hn.default.createElement(hn.Fragment,null,r(Wa(Wa({},a),{},{open:i})))});Qje.displayName="Dropzone";var NUt={disabled:!1,getFilesFromEvent:zje,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};Qje.defaultProps=NUt;Qje.propTypes={children:Si.default.func,accept:Si.default.objectOf(Si.default.arrayOf(Si.default.string)),multiple:Si.default.bool,preventDropOnDocument:Si.default.bool,noClick:Si.default.bool,noKeyboard:Si.default.bool,noDrag:Si.default.bool,noDragEventsBubbling:Si.default.bool,minSize:Si.default.number,maxSize:Si.default.number,maxFiles:Si.default.number,disabled:Si.default.bool,getFilesFromEvent:Si.default.func,onFileDialogCancel:Si.default.func,onFileDialogOpen:Si.default.func,useFsAccessApi:Si.default.bool,autoFocus:Si.default.bool,onDragEnter:Si.default.func,onDragLeave:Si.default.func,onDragOver:Si.default.func,onDrop:Si.default.func,onDropAccepted:Si.default.func,onDropRejected:Si.default.func,onError:Si.default.func,validator:Si.default.func};var Xje={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function eDe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=Wa(Wa({},NUt),t),r=e.accept,n=e.disabled,o=e.getFilesFromEvent,i=e.maxSize,a=e.minSize,s=e.multiple,u=e.maxFiles,l=e.onDragEnter,c=e.onDragLeave,d=e.onDragOver,f=e.onDrop,p=e.onDropAccepted,m=e.onDropRejected,h=e.onFileDialogCancel,b=e.onFileDialogOpen,g=e.useFsAccessApi,_=e.autoFocus,w=e.preventDropOnDocument,x=e.noClick,C=e.noKeyboard,E=e.noDrag,P=e.noDragEventsBubbling,A=e.onError,I=e.validator,R=(0,hn.useMemo)(function(){return EUt(r)},[r]),j=(0,hn.useMemo)(function(){return PUt(r)},[r]),D=(0,hn.useMemo)(function(){return typeof b=="function"?b:jUt},[b]),k=(0,hn.useMemo)(function(){return typeof h=="function"?h:jUt},[h]),F=(0,hn.useRef)(null),B=(0,hn.useRef)(null),q=(0,hn.useReducer)(Sgn,Xje),W=Gje(q,2),H=W[0],L=W[1],z=H.isFocused,K=H.isFileDialogActive,J=(0,hn.useRef)(typeof window<"u"&&window.isSecureContext&&g&&OUt()),ee=function(){!J.current&&K&&setTimeout(function(){if(B.current){var oe=B.current.files;oe.length||(L({type:"closeDialog"}),k())}},300)};(0,hn.useEffect)(function(){return window.addEventListener("focus",ee,!1),function(){window.removeEventListener("focus",ee,!1)}},[B,K,k,J]);var Pe=(0,hn.useRef)([]),G=function(oe){F.current&&F.current.contains(oe.target)||(oe.preventDefault(),Pe.current=[])};(0,hn.useEffect)(function(){return w&&(document.addEventListener("dragover",Jje,!1),document.addEventListener("drop",G,!1)),function(){w&&(document.removeEventListener("dragover",Jje),document.removeEventListener("drop",G))}},[F,w]),(0,hn.useEffect)(function(){return!n&&_&&F.current&&F.current.focus(),function(){}},[F,_,n]);var Z=(0,hn.useCallback)(function(re){A?A(re):console.error(re)},[A]),ie=(0,hn.useCallback)(function(re){re.preventDefault(),re.persist(),te(re),Pe.current=[].concat(mgn(Pe.current),[re.target]),n5(re)&&Promise.resolve(o(re)).then(function(oe){if(!(r5(re)&&!P)){var Se=oe.length,ve=Se>0&&xUt({files:oe,accept:R,minSize:a,maxSize:i,multiple:s,maxFiles:u,validator:I}),qe=Se>0&&!ve;L({isDragAccept:ve,isDragReject:qe,isDragActive:!0,type:"setDraggedFiles"}),l&&l(re)}}).catch(function(oe){return Z(oe)})},[o,l,Z,P,R,a,i,s,u,I]),Ie=(0,hn.useCallback)(function(re){re.preventDefault(),re.persist(),te(re);var oe=n5(re);if(oe&&re.dataTransfer)try{re.dataTransfer.dropEffect="copy"}catch{}return oe&&d&&d(re),!1},[d,P]),st=(0,hn.useCallback)(function(re){re.preventDefault(),re.persist(),te(re);var oe=Pe.current.filter(function(ve){return F.current&&F.current.contains(ve)}),Se=oe.indexOf(re.target);Se!==-1&&oe.splice(Se,1),Pe.current=oe,!(oe.length>0)&&(L({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),n5(re)&&c&&c(re))},[F,c,P]),Te=(0,hn.useCallback)(function(re,oe){var Se=[],ve=[];re.forEach(function(qe){var kr=Wje(qe,R),pi=Gje(kr,2),sa=pi[0],uc=pi[1],Wd=Kje(qe,a,i),ua=Gje(Wd,2),Ff=ua[0],od=ua[1],Kd=I?I(qe):null;if(sa&&Ff&&!Kd)Se.push(qe);else{var $r=[uc,od];Kd&&($r=$r.concat(Kd)),ve.push({file:qe,errors:$r.filter(function(Zy){return Zy})})}}),(!s&&Se.length>1||s&&u>=1&&Se.length>u)&&(Se.forEach(function(qe){ve.push({file:qe,errors:[SUt]})}),Se.splice(0)),L({acceptedFiles:Se,fileRejections:ve,isDragReject:ve.length>0,type:"setFiles"}),f&&f(Se,ve,oe),ve.length>0&&m&&m(ve,oe),Se.length>0&&p&&p(Se,oe)},[L,s,R,a,i,u,f,p,m,I]),Qe=(0,hn.useCallback)(function(re){re.preventDefault(),re.persist(),te(re),Pe.current=[],n5(re)&&Promise.resolve(o(re)).then(function(oe){r5(re)&&!P||Te(oe,re)}).catch(function(oe){return Z(oe)}),L({type:"reset"})},[o,Te,Z,P]),nt=(0,hn.useCallback)(function(){if(J.current){L({type:"openDialog"}),D();var re={multiple:s,types:j};window.showOpenFilePicker(re).then(function(oe){return o(oe)}).then(function(oe){Te(oe,null),L({type:"closeDialog"})}).catch(function(oe){TUt(oe)?(k(oe),L({type:"closeDialog"})):AUt(oe)?(J.current=!1,B.current?(B.current.value=null,B.current.click()):Z(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."))):Z(oe)});return}B.current&&(L({type:"openDialog"}),D(),B.current.value=null,B.current.click())},[L,D,k,g,Te,Z,j,s]),Ht=(0,hn.useCallback)(function(re){!F.current||!F.current.isEqualNode(re.target)||(re.key===" "||re.key==="Enter"||re.keyCode===32||re.keyCode===13)&&(re.preventDefault(),nt())},[F,nt]),Me=(0,hn.useCallback)(function(){L({type:"focus"})},[]),ht=(0,hn.useCallback)(function(){L({type:"blur"})},[]),Xt=(0,hn.useCallback)(function(){x||(CUt()?setTimeout(nt,0):nt())},[x,nt]),nr=function(oe){return n?null:oe},Fr=function(oe){return C?null:nr(oe)},xe=function(oe){return E?null:nr(oe)},te=function(oe){P&&oe.stopPropagation()},ur=(0,hn.useMemo)(function(){return function(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},oe=re.refKey,Se=oe===void 0?"ref":oe,ve=re.role,qe=re.onKeyDown,kr=re.onFocus,pi=re.onBlur,sa=re.onClick,uc=re.onDragEnter,Wd=re.onDragOver,ua=re.onDragLeave,Ff=re.onDrop,od=bue(re,fgn);return Wa(Wa(Zje({onKeyDown:Fr(qy(qe,Ht)),onFocus:Fr(qy(kr,Me)),onBlur:Fr(qy(pi,ht)),onClick:nr(qy(sa,Xt)),onDragEnter:xe(qy(uc,ie)),onDragOver:xe(qy(Wd,Ie)),onDragLeave:xe(qy(ua,st)),onDrop:xe(qy(Ff,Qe)),role:typeof ve=="string"&&ve!==""?ve:"presentation"},Se,F),!n&&!C?{tabIndex:0}:{}),od)}},[F,Ht,Me,ht,Xt,ie,Ie,st,Qe,C,E,n]),je=(0,hn.useCallback)(function(re){re.stopPropagation()},[]),Ee=(0,hn.useMemo)(function(){return function(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},oe=re.refKey,Se=oe===void 0?"ref":oe,ve=re.onChange,qe=re.onClick,kr=bue(re,pgn),pi=Zje({accept:R,multiple:s,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:nr(qy(ve,Qe)),onClick:nr(qy(qe,je)),tabIndex:-1},Se,B);return Wa(Wa({},pi),kr)}},[B,r,s,Qe,n]);return Wa(Wa({},H),{},{isFocused:z&&!n,getRootProps:ur,getInputProps:Ee,rootRef:F,inputRef:B,open:nr(nt)})}function Sgn(t,e){switch(e.type){case"focus":return Wa(Wa({},t),{},{isFocused:!0});case"blur":return Wa(Wa({},t),{},{isFocused:!1});case"openDialog":return Wa(Wa({},Xje),{},{isFileDialogActive:!0});case"closeDialog":return Wa(Wa({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return Wa(Wa({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return Wa(Wa({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return Wa({},Xje);default:return t}}function jUt(){}var kUt=$(Y());pf();var na=$(Y());var _ue=$(Y());var xgn=FL("tw-inline-flex tw-items-center tw-rounded-md tw-px-2.5 tw-py-0.5 tw-text-ui-smaller tw-text-normal tw-transition-colors focus:tw-outline-none",{variants:{variant:{default:"tw-bg-primary-alt tw-shadow",secondary:"tw-bg-secondary-alt",destructive:"tw-bg-modifier-error tw-shadow",outline:"tw-border tw-border-solid tw-border-border"}},defaultVariants:{variant:"default"}}),km=_ue.forwardRef(({className:t,variant:e,...r},n)=>_ue.createElement("div",{ref:n,className:Ce(xgn({variant:e}),t),...r}));km.displayName="Badge";function LUt({note:t,isActive:e=!1,onRemoveContext:r}){return na.default.createElement(km,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},na.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},na.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.basename),e&&na.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),t.extension==="pdf"&&na.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")),na.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>r(t.path),"aria-label":"Remove from context"},na.default.createElement(Ia,{className:"tw-size-4"})))}function Cgn({url:t,onRemoveUrl:e}){return na.default.createElement(km,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},na.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},na.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t),na.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Link")),na.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>e(t),"aria-label":"Remove from context"},na.default.createElement(Ia,{className:"tw-size-4"})))}var FUt=({activeNote:t,contextNotes:e,contextUrls:r,onAddContext:n,onRemoveContext:o,onRemoveUrl:i})=>{let a=na.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=na.default.useMemo(()=>Array.from(new Set(r)),[r]),u=a.length>0||s.length>0||!!t;return na.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-gap-1"},na.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},na.default.createElement(he,{onClick:n,variant:"ghost2",size:"fit",className:"tw-ml-1 tw-rounded-sm tw-border tw-border-solid tw-border-border"},na.default.createElement(Hg,{className:"tw-size-4"}),!u&&na.default.createElement("span",{className:"tw-pr-1 tw-text-xs tw-leading-4"},"Add context"))),na.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-wrap tw-gap-1"},t&&na.default.createElement(LUt,{key:t.path,note:t,isActive:!0,onRemoveContext:o}),a.map(l=>na.default.createElement(LUt,{key:l.path,note:l,isActive:!1,onRemoveContext:o})),s.map(l=>na.default.createElement(Cgn,{key:l,url:l,onRemoveUrl:i}))))};var Ogn=({app:t,excludeNotePaths:e,contextNotes:r,setContextNotes:n,includeActiveNote:o,setIncludeActiveNote:i,activeNote:a,contextUrls:s,onRemoveUrl:u})=>{let[l]=Rg(),c=()=>{new OI({app:t,onNoteSelect:f=>{a&&f.path===a.path?(i(!0),n(p=>p.filter(m=>m.path!==f.path))):n(p=>[...p,Object.assign(f,{wasAddedManually:!0})])},excludeNotePaths:e}).open()},d=f=>{let p=r.find(h=>h.path===f);p&&p.wasAddedManually?n(h=>h.filter(b=>b.path!==f)):(i(!1),n(h=>h.filter(b=>b.path!==f)))};return l!=="copilot_plus"?null:kUt.default.createElement(FUt,{activeNote:o?a:null,contextNotes:r,onAddContext:c,onRemoveContext:d,contextUrls:s,onRemoveUrl:u})},$Ut=Ogn;var BUt=(0,tt.forwardRef)(({inputMessage:t,setInputMessage:e,handleSendMessage:r,isGenerating:n,onStopGenerating:o,app:i,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,mention:c,selectedImages:d,onAddImage:f,setSelectedImages:p,disableModelSwitch:m},h)=>{let[b,g]=(0,tt.useState)(!1),[_,w]=(0,tt.useState)([]),x=(0,tt.useRef)(null),C=(0,tt.useRef)(null),[E,P]=iL(),[A,I]=(0,tt.useState)(null),[R]=Rg(),[j]=Bze(),[D,k]=(0,tt.useState)(i.workspace.getActiveFile()),[F,B]=(0,tt.useState)(null),q=Pn(),W=R==="copilot_plus"||R==="project",[H,L]=(0,tt.useState)(0),z=["Loading the project context...","Processing context files...","If you have many files in context, this can take a while..."];(0,tt.useImperativeHandle)(h,()=>({focus:()=>{x.current?.focus()}})),(0,tt.useEffect)(()=>{if(R==="project"){B(hc());let Me=aL(ht=>{B(ht)});return()=>{Me()}}else B(null)},[R]),(0,tt.useEffect)(()=>{if(!j)return;let Me=setInterval(()=>{L(ht=>(ht+1)%z.length)},3e3);return()=>clearInterval(Me)},[j,z.length]);let K=()=>F&&R==="project"&&F.projectModelKey?F.projectModelKey:E,J=Me=>{if(!W){r();return}r({toolCalls:Me?["@vault"]:[],contextNotes:a,urls:_})},ee=async Me=>{let ht=Me.target.value,Xt=Me.target.selectionStart;e(ht),Pe();let Fr=c.extractAllUrls(ht).filter(xe=>!_.includes(xe));Fr.length>0&&w(xe=>Array.from(new Set([...xe,...Fr]))),Xt>=2&&ht.slice(Xt-2,Xt)==="[["?G(Xt):ht==="/"?Z():ht.slice(-1)==="@"&&W&&ie()},Pe=()=>{x.current&&(x.current.style.height="auto",x.current.style.height=`${x.current.scrollHeight}px`)};(0,tt.useEffect)(()=>{Pe()},[t]);let G=Me=>{(async()=>{let Xt=Wq.getInstance();new OI({app:i,onNoteSelect:async nr=>{let Fr=t.slice(0,Me-2),xe=t.slice(Me-1),ur=Hfe(nr.basename,i.vault)?nr.basename:nr.path,je=`${Fr}[[${ur}]]${xe}`;e(je);let Ee=i.workspace.getActiveFile();nr&&await Xt.addNoteToContext(nr,i.vault,a,Ee,s,l),setTimeout(()=>{if(x.current){let re=Me+ur.length+2;x.current.setSelectionRange(re,re)}},0)},excludeNotePaths:Ht}).open()})()},Z=async()=>{let Me=aP.getInstance(i.vault),ht=await Me.getAllPrompts(),Xt=ht.map(nr=>nr.title);new sP(i,Xt,async nr=>{let Fr=ht.find(xe=>xe.title===nr);Fr&&(Me.recordPromptUsage(Fr.title),e(Fr.content))}).open()},ie=()=>{let Me=o8.map(ht=>({title:ht,description:VCt(ht)}));new sP(i,Me.map(ht=>ht.title),ht=>{e(t+ht+" ")},Me.map(ht=>ht.description)).open()},Ie=Me=>{if(!Me.nativeEvent.isComposing){if(Me.key==="Enter"&&Me.shiftKey&&(EI.Platform.isMacOS?Me.metaKey:Me.ctrlKey)){Me.preventDefault(),Me.stopPropagation(),J(!0);return}if(Me.key==="Enter"){if(!(!Me.shiftKey&&!EI.Platform.isMobile||Me.shiftKey&&EI.Platform.isMobile))return;Me.preventDefault(),J(!1)}}},st=(0,tt.useCallback)(async Me=>{let ht=Me.clipboardData?.items;if(!ht||!W)return;let Xt=Array.from(ht).filter(nr=>nr.type.indexOf("image")!==-1);if(Xt.length>0){Me.preventDefault();let Fr=(await Promise.all(Xt.map(xe=>{let te=xe.getAsFile();return te||null}))).filter(xe=>xe!==null);Fr.length>0&&f(Fr)}},[f,W]);(0,tt.useEffect)(()=>{let Me=new Set($x(t,i.vault)),ht=c.extractAllUrls(t);s(Xt=>Xt.filter(nr=>{if(nr.wasAddedManually===!0)return!0;let xe=nr.wasAddedViaReference===!0;return nr.path===D?.path?xe?Me.has(nr):u:xe?Me.has(nr):!0})),w(Xt=>Xt.filter(nr=>ht.includes(nr)))},[t,u,D,c,s,i.vault]),(0,tt.useEffect)(()=>{let Me,ht=()=>{clearTimeout(Me),Me=setTimeout(()=>{let nr=i.workspace.getActiveFile();k(nr)},100)},Xt=i.workspace.on("active-leaf-change",ht);return()=>{clearTimeout(Me),i.workspace.offref(Xt)}},[i.workspace]);let{getRootProps:Te,getInputProps:Qe,isDragActive:nt}=eDe({accept:{"image/*":[".png",".gif",".jpeg",".jpg",".webp"]},onDrop:Me=>{f(Me)},noClick:!0,noDragEventsBubbling:!0}),Ht=(0,tt.useMemo)(()=>[...a.map(Me=>Me.path),...u&&D?[D.path]:[]].filter(Me=>Me!=null),[a,u,D]);return tt.default.createElement("div",{className:"tw-flex tw-w-full tw-flex-col tw-gap-0.5 tw-rounded-md tw-border tw-border-solid tw-border-border tw-px-1 tw-pb-1 tw-pt-2 tw-@container/chat-input",ref:C},tt.default.createElement($Ut,{app:i,excludeNotePaths:Ht,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,activeNote:D,contextUrls:_,onRemoveUrl:Me=>w(ht=>ht.filter(Xt=>Xt!==Me))}),d.length>0&&tt.default.createElement("div",{className:"selected-images"},d.map((Me,ht)=>tt.default.createElement("div",{key:ht,className:"image-preview-container"},tt.default.createElement("img",{src:URL.createObjectURL(Me),alt:Me.name,className:"selected-image-preview"}),tt.default.createElement("button",{className:"remove-image-button",onClick:()=>p(Xt=>Xt.filter((nr,Fr)=>Fr!==ht)),title:"Remove image"},tt.default.createElement(Ia,{className:"tw-size-4"}))))),tt.default.createElement("div",{className:"tw-relative",...W?Te():{}},j&&tt.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-bg-primary tw-opacity-80 tw-backdrop-blur-sm"},tt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},tt.default.createElement(Ll,{className:"tw-size-4 tw-animate-spin"}),tt.default.createElement("span",{className:"tw-text-sm"},z[H]))),tt.default.createElement("textarea",{ref:x,className:"tw-max-h-40 tw-min-h-[60px] tw-w-full tw-resize-none tw-overflow-y-auto tw-rounded-md tw-border-none tw-bg-transparent tw-px-2 tw-text-sm tw-text-normal focus-visible:tw-ring-0",placeholder:"Ask anything. [[ for notes. / for custom prompts. "+(W?"@ for tools.":""),value:t,onChange:ee,onKeyDown:Ie,onPaste:st,disabled:j}),W&&tt.default.createElement(tt.default.Fragment,null,tt.default.createElement("input",{...Qe()}),nt&&tt.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-flex tw-items-center tw-justify-center tw-rounded-md tw-border tw-border-dashed tw-bg-primary"},tt.default.createElement("span",null,"Drop images here...")))),tt.default.createElement("div",{className:"tw-flex tw-h-6 tw-justify-between tw-gap-1 tw-px-1"},n?tt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-px-1 tw-text-sm tw-text-faint"},tt.default.createElement(Ll,{className:"tw-size-3 tw-animate-spin"}),tt.default.createElement("span",null,"Generating...")):tt.default.createElement(SI,{open:b,onOpenChange:g},tt.default.createElement(xI,{asChild:!0},tt.default.createElement(he,{variant:"ghost2",size:"fit",disabled:m},A?tt.default.createElement("span",{className:"tw-text-error"},"Model Load Failed"):q.activeModels.find(Me=>Me.enabled&&Dr(Me)===K())?tt.default.createElement(m1e,{model:q.activeModels.find(Me=>Me.enabled&&Dr(Me)===K()),iconSize:8}):"Select Model",!m&&tt.default.createElement(Di,{className:"tw-mt-0.5 tw-size-5"}))),tt.default.createElement(mg,{align:"start"},!m&&q.activeModels.filter(Me=>Me.enabled).map(Me=>{let{hasApiKey:ht,errorNotice:Xt}=ZN(Me,q);return tt.default.createElement(Ho,{key:Dr(Me),onSelect:async nr=>{if(!ht&&Xt){nr.preventDefault(),new EI.Notice(Xt);return}try{I(null),P(Dr(Me))}catch(Fr){let xe="Model switch failed: "+En(Fr);I(xe),new EI.Notice(xe);let te=q.activeModels.find(ur=>ur.enabled&&Dr(ur)===E);te&&P(Dr(te))}},className:ht?"":"tw-cursor-not-allowed tw-opacity-50"},tt.default.createElement(m1e,{model:Me,iconSize:12}))}))),tt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},n?tt.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>o()},tt.default.createElement(SE,{className:"tw-size-4"}),"Stop"):tt.default.createElement(tt.default.Fragment,null,W&&tt.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>{new hue(i,f).open()}},tt.default.createElement(U2,{className:"tw-size-4"})),tt.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>J(!1)},tt.default.createElement(rm,{className:"!tw-size-3"}),tt.default.createElement("span",null,"chat")),R==="copilot_plus"&&tt.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-hidden tw-text-muted @xs/chat-input:tw-inline-flex",onClick:()=>J(!0)},tt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},EI.Platform.isMacOS?tt.default.createElement("div",{className:"tw-flex tw-items-center"},tt.default.createElement(xb,{className:"!tw-size-3"}),tt.default.createElement(nC,{className:"!tw-size-3"}),tt.default.createElement(rm,{className:"!tw-size-3"})):tt.default.createElement("div",{className:"tw-flex tw-items-center"},tt.default.createElement("span",null,"Ctrl"),tt.default.createElement(nC,{className:"tw-size-4"}),tt.default.createElement(rm,{className:"!tw-size-3"})),tt.default.createElement("span",null,"vault")))))))});BUt.displayName="ChatInput";var qUt=BUt;Zr();var UUt=require("obsidian"),gr=$(Y()),zUt=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>gr.default.createElement("div",{className:Ce("tw-flex tw-gap-1",{"group-hover:opacity-100 opacity-0":!UUt.Platform.isMobile})},t.sender===gi?gr.default.createElement(gr.default.Fragment,null,gr.default.createElement(Yt,null,gr.default.createElement(Zt,{asChild:!0},gr.default.createElement(he,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?gr.default.createElement(Nl,{className:"tw-size-4"}):gr.default.createElement(Cb,{className:"tw-size-4"}))),gr.default.createElement(Kt,null,"Copy")),gr.default.createElement(Yt,null,gr.default.createElement(Zt,{asChild:!0},gr.default.createElement(he,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},gr.default.createElement(sp,{className:"tw-size-4"}))),gr.default.createElement(Kt,null,"Edit")),gr.default.createElement(Yt,null,gr.default.createElement(Zt,{asChild:!0},gr.default.createElement(he,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},gr.default.createElement(nm,{className:"tw-size-4"}))),gr.default.createElement(Kt,null,"Delete"))):gr.default.createElement(gr.default.Fragment,null,u&&gr.default.createElement(Yt,null,gr.default.createElement(Zt,{asChild:!0},gr.default.createElement(he,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},gr.default.createElement(aR,{className:"tw-size-4"}))),gr.default.createElement(Kt,null,"Show Sources")),gr.default.createElement(Yt,null,gr.default.createElement(Zt,{asChild:!0},gr.default.createElement(he,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},gr.default.createElement(K2,{className:"tw-size-4"}))),gr.default.createElement(Kt,null,"Insert / Replace at cursor")),gr.default.createElement(Yt,null,gr.default.createElement(Zt,{asChild:!0},gr.default.createElement(he,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?gr.default.createElement(Nl,{className:"tw-size-4"}):gr.default.createElement(Cb,{className:"tw-size-4"}))),gr.default.createElement(Kt,null,"Copy")),gr.default.createElement(Yt,null,gr.default.createElement(Zt,{asChild:!0},gr.default.createElement(he,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},gr.default.createElement(W2,{className:"tw-size-4"}))),gr.default.createElement(Kt,null,"Regenerate")),gr.default.createElement(Yt,null,gr.default.createElement(Zt,{asChild:!0},gr.default.createElement(he,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},gr.default.createElement(nm,{className:"tw-size-4"}))),gr.default.createElement(Kt,null,"Delete"))));Zr();var HUt=require("obsidian"),vue=class extends HUt.Modal{constructor(e,r){super(e),this.sources=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Sources"});let r=this.sources.filter(o=>o.score>=Jfe),n=this.sources.filter(o=>o.score<Jfe);r.length>0&&(e.createEl("h3",{text:"High Relevance Sources"}),this.createSourceList(e,r)),n.length>0&&(e.createEl("h3",{text:"Lower Relevance Sources"}),this.createSourceList(e,n))}createSourceList(e,r){let n=e.createEl("ul");n.style.listStyleType="none",n.style.padding="0",r.forEach(o=>{let i=n.createEl("li");i.style.marginBottom="1em",i.createEl("a",{href:`obsidian://open?vault=${encodeURIComponent(this.app.vault.getName())}&file=${encodeURIComponent(o.title)}`,text:o.title}).addEventListener("click",s=>{s.preventDefault(),this.app.workspace.openLinkText(o.title,"")}),o.score&&o.score<=1&&i.appendChild(document.createTextNode(` - Relevance score: ${o.score.toFixed(3)}`))})}onClose(){let{contentEl:e}=this;e.empty()}};Zr();yn();var hP=require("obsidian");function Uy(){}Uy.prototype={diff:function(e,r){var n,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.callback;typeof o=="function"&&(i=o,o={});var a=this;function s(x){return x=a.postProcess(x,o),i?(setTimeout(function(){i(x)},0),!0):x}e=this.castInput(e,o),r=this.castInput(r,o),e=this.removeEmpty(this.tokenize(e,o)),r=this.removeEmpty(this.tokenize(r,o));var u=r.length,l=e.length,c=1,d=u+l;o.maxEditLength!=null&&(d=Math.min(d,o.maxEditLength));var f=(n=o.timeout)!==null&&n!==void 0?n:1/0,p=Date.now()+f,m=[{oldPos:-1,lastComponent:void 0}],h=this.extractCommon(m[0],r,e,0,o);if(m[0].oldPos+1>=l&&h+1>=u)return s(VUt(a,m[0].lastComponent,r,e,a.useLongestToken));var b=-1/0,g=1/0;function _(){for(var x=Math.max(b,-c);x<=Math.min(g,c);x+=2){var C=void 0,E=m[x-1],P=m[x+1];E&&(m[x-1]=void 0);var A=!1;if(P){var I=P.oldPos-x;A=P&&0<=I&&I<u}var R=E&&E.oldPos+1<l;if(!A&&!R){m[x]=void 0;continue}if(!R||A&&E.oldPos<P.oldPos?C=a.addToPath(P,!0,!1,0,o):C=a.addToPath(E,!1,!0,1,o),h=a.extractCommon(C,r,e,x,o),C.oldPos+1>=l&&h+1>=u)return s(VUt(a,C.lastComponent,r,e,a.useLongestToken));m[x]=C,C.oldPos+1>=l&&(g=Math.min(g,x-1)),h+1>=u&&(b=Math.max(b,x+1))}c++}if(i)(function x(){setTimeout(function(){if(c>d||Date.now()>p)return i();_()||x()},0)})();else for(;c<=d&&Date.now()<=p;){var w=_();if(w)return w}},addToPath:function(e,r,n,o,i){var a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===r&&a.removed===n?{oldPos:e.oldPos+o,lastComponent:{count:a.count+1,added:r,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:r,removed:n,previousComponent:a}}},extractCommon:function(e,r,n,o,i){for(var a=r.length,s=n.length,u=e.oldPos,l=u-o,c=0;l+1<a&&u+1<s&&this.equals(n[u+1],r[l+1],i);)l++,u++,c++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!i.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=u,l},equals:function(e,r,n){return n.comparator?n.comparator(e,r):e===r||n.ignoreCase&&e.toLowerCase()===r.toLowerCase()},removeEmpty:function(e){for(var r=[],n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r},castInput:function(e){return e},tokenize:function(e){return Array.from(e)},join:function(e){return e.join("")},postProcess:function(e){return e}};function VUt(t,e,r,n,o){for(var i=[],a;e;)i.push(e),a=e.previousComponent,delete e.previousComponent,e=a;i.reverse();for(var s=0,u=i.length,l=0,c=0;s<u;s++){var d=i[s];if(d.removed)d.value=t.join(n.slice(c,c+d.count)),c+=d.count;else{if(!d.added&&o){var f=r.slice(l,l+d.count);f=f.map(function(p,m){var h=n[c+m];return h.length>p.length?h:p}),d.value=t.join(f)}else d.value=t.join(r.slice(l,l+d.count));l+=d.count,d.added||(c+=d.count)}}return i}var aQo=new Uy;function WUt(t,e){var r;for(r=0;r<t.length&&r<e.length;r++)if(t[r]!=e[r])return t.slice(0,r);return t.slice(0,r)}function KUt(t,e){var r;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(r=0;r<t.length&&r<e.length;r++)if(t[t.length-(r+1)]!=e[e.length-(r+1)])return t.slice(-r);return t.slice(-r)}function tDe(t,e,r){if(t.slice(0,e.length)!=e)throw Error("string ".concat(JSON.stringify(t)," doesn't start with prefix ").concat(JSON.stringify(e),"; this is a bug"));return r+t.slice(e.length)}function rDe(t,e,r){if(!e)return t+r;if(t.slice(-e.length)!=e)throw Error("string ".concat(JSON.stringify(t)," doesn't end with suffix ").concat(JSON.stringify(e),"; this is a bug"));return t.slice(0,-e.length)+r}function o5(t,e){return tDe(t,e,"")}function wue(t,e){return rDe(t,e,"")}function JUt(t,e){return e.slice(0,Pgn(t,e))}function Pgn(t,e){var r=0;t.length>e.length&&(r=t.length-e.length);var n=e.length;t.length<e.length&&(n=t.length);var o=Array(n),i=0;o[0]=0;for(var a=1;a<n;a++){for(e[a]==e[i]?o[a]=o[i]:o[a]=i;i>0&&e[a]!=e[i];)i=o[i];e[a]==e[i]&&i++}i=0;for(var s=r;s<t.length;s++){for(;i>0&&t[s]!=e[i];)i=o[i];t[s]==e[i]&&i++}return i}var Sue="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Egn=new RegExp("[".concat(Sue,"]+|\\s+|[^").concat(Sue,"]"),"ug"),xue=new Uy;xue.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};xue.tokenize=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r;if(e.intlSegmenter){if(e.intlSegmenter.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(e.intlSegmenter.segment(t),function(i){return i.segment})}else r=t.match(Egn)||[];var n=[],o=null;return r.forEach(function(i){/\s/.test(i)?o==null?n.push(i):n.push(n.pop()+i):/\s/.test(o)?n[n.length-1]==o?n.push(n.pop()+i):n.push(o+i):n.push(i),o=i}),n};xue.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};xue.postProcess=function(t,e){if(!t||e.oneChangePerToken)return t;var r=null,n=null,o=null;return t.forEach(function(i){i.added?n=i:i.removed?o=i:((n||o)&&GUt(r,o,n,i),r=i,n=null,o=null)}),(n||o)&&GUt(r,o,n,null),t};function GUt(t,e,r,n){if(e&&r){var o=e.value.match(/^\s*/)[0],i=e.value.match(/\s*$/)[0],a=r.value.match(/^\s*/)[0],s=r.value.match(/\s*$/)[0];if(t){var u=WUt(o,a);t.value=rDe(t.value,a,u),e.value=o5(e.value,u),r.value=o5(r.value,u)}if(n){var l=KUt(i,s);n.value=tDe(n.value,s,l),e.value=wue(e.value,l),r.value=wue(r.value,l)}}else if(r)t&&(r.value=r.value.replace(/^\s*/,"")),n&&(n.value=n.value.replace(/^\s*/,""));else if(t&&n){var c=n.value.match(/^\s*/)[0],d=e.value.match(/^\s*/)[0],f=e.value.match(/\s*$/)[0],p=WUt(c,d);e.value=o5(e.value,p);var m=KUt(o5(c,p),f);e.value=wue(e.value,m),n.value=tDe(n.value,c,m),t.value=rDe(t.value,c,c.slice(0,c.length-m.length))}else if(n){var h=n.value.match(/^\s*/)[0],b=e.value.match(/\s*$/)[0],g=JUt(b,h);e.value=wue(e.value,g)}else if(t){var _=t.value.match(/\s*$/)[0],w=e.value.match(/^\s*/)[0],x=JUt(_,w);e.value=o5(e.value,x)}}var Tgn=new Uy;Tgn.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(Sue,"]+|[^\\S\\n\\r]+|[^").concat(Sue,"]"),"ug");return t.match(e)||[]};function Agn(t,e){if(typeof t=="function")e.callback=t;else if(t)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}var Cue=new Uy;Cue.tokenize=function(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
`));var r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var o=0;o<n.length;o++){var i=n[o];o%2&&!e.newlineIsToken?r[r.length-1]+=i:r.push(i)}return r};Cue.equals=function(t,e,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
`))&&(t=t.trim()),(!r.newlineIsToken||!e.includes(`
`))&&(e=e.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
`)&&(t=t.slice(0,-1)),e.endsWith(`
`)&&(e=e.slice(0,-1))),Uy.prototype.equals.call(this,t,e,r)};function YUt(t,e,r){var n=Agn(r,{ignoreWhitespace:!0});return Cue.diff(t,e,n)}var Ign=new Uy;Ign.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};var Mgn=new Uy;Mgn.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};function nDe(t){"@babel/helpers - typeof";return nDe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nDe(t)}var i5=new Uy;i5.useLongestToken=!0;i5.tokenize=Cue.tokenize;i5.castInput=function(t,e){var r=e.undefinedReplacement,n=e.stringifyReplacer,o=n===void 0?function(i,a){return typeof a>"u"?r:a}:n;return typeof t=="string"?t:JSON.stringify(oDe(t,null,null,o),o," ")};i5.equals=function(t,e,r){return Uy.prototype.equals.call(i5,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};function oDe(t,e,r,n,o){e=e||[],r=r||[],n&&(t=n(o,t));var i;for(i=0;i<e.length;i+=1)if(e[i]===t)return r[i];var a;if(Object.prototype.toString.call(t)==="[object Array]"){for(e.push(t),a=new Array(t.length),r.push(a),i=0;i<t.length;i+=1)a[i]=oDe(t[i],e,r,n,o);return e.pop(),r.pop(),a}if(t&&t.toJSON&&(t=t.toJSON()),nDe(t)==="object"&&t!==null){e.push(t),a={},r.push(a);var s=[],u;for(u in t)Object.prototype.hasOwnProperty.call(t,u)&&s.push(u);for(s.sort(),i=0;i<s.length;i+=1)u=s[i],a[u]=oDe(t[u],e,r,n,u);e.pop(),r.pop()}else a=t;return a}var iDe=new Uy;iDe.tokenize=function(t){return t.slice()};iDe.join=iDe.removeEmpty=function(t){return t};var yr=$(Y()),tzt=$(_c());var zy=$(Y());mo();var pP=require("obsidian"),_n=$(Y()),ZUt=$(_c());var XUt=$(Y());function Rgn(t){return t.trim().split(`
`).map(r=>"- "+r).join(`
`)}function aDe(t){return t.map(r=>{let n=r.some(a=>a.added),o=r.some(a=>a.removed),i="";return n?i=r.map(a=>a.added?a.value:"").join(`
`):o?i=r.map(a=>a.removed?Rgn(a.value):"").join(`
`):r.map(s=>s.value).join(`
`).trim().length>0&&(i="..."),i}).join(`
`)}function a5(t){let e=[],r=[];return t.forEach(n=>{n.added||n.removed?r.push(n):(r.length>0&&(e.push(r),r=[]),e.push([n]))}),r.length>0&&e.push(r),e}var s5="obsidian-copilot-apply-view",Oue=class extends pP.ItemView{constructor(r){super(r);this.root=null;this.state=null}getViewType(){return s5}getDisplayText(){return"Preview Changes"}async setState(r){this.state=r,this.render()}async onOpen(){this.render()}async onClose(){this.root&&(this.root.unmount(),this.root=null)}render(){if(!this.state)return;let r=this.containerEl.children[1];r.empty();let n=r.createDiv();this.root||(this.root=(0,ZUt.createRoot)(n)),this.root.render(_n.default.createElement(jgn,{app:this.app,state:this.state,close:()=>this.leaf.detach()}))}},jgn=({app:t,state:e,close:r})=>{let[n,o]=(0,XUt.useState)(()=>e.changes.map(p=>({...p,accepted:null}))),i=a5(n),a=(0,_n.useRef)([]);if(!e||!e.changes)return fe("Invalid state:",e),_n.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col tw-items-center tw-justify-center"},_n.default.createElement("div",{className:"tw-text-error"},"Error: Invalid state - missing changes"),_n.default.createElement(he,{onClick:r,className:"tw-mt-4"},"Close"));let s=async()=>{try{let p=n.map(m=>m.accepted===null?{...m,accepted:!0}:m);await l(p)}catch(p){fe("Error applying changes:",p),new pP.Notice(`Error applying changes: ${p.message}`)}},u=async()=>{try{let p=n.map(m=>m.accepted===null?{...m,accepted:!1}:m);await l(p)}catch(p){fe("Error applying changes:",p),new pP.Notice(`Error applying changes: ${p.message}`)}},l=async p=>{let m=p.filter(b=>b.added?b.accepted===!0:b.removed?b.accepted===!1:!0).map(b=>b.value).join(""),h=t.vault.getAbstractFileByPath(e.path);if(!h||!(h instanceof pP.TFile)){new pP.Notice("File not found:"+e.path),r();return}await t.vault.modify(h,m),new pP.Notice("Changes applied successfully"),r()},c=p=>{if(!i)return;let m=-1;for(let h=p+1;h<i.length;h++){let b=i[h],g=b.some(w=>w.added||w.removed),_=b.some(w=>(w.added||w.removed)&&w.accepted===null);if(g&&_){m=h;break}}m!==-1&&a.current[m]&&a.current[m]?.scrollIntoView({behavior:"smooth",block:"center"})},d=p=>{o(m=>{let h=[...m],b=i?.[p];return b&&b.forEach(g=>{let _=h.findIndex(w=>w===g);_!==-1&&(h[_]={...h[_],accepted:!0})}),h}),setTimeout(()=>c(p),0)},f=p=>{o(m=>{let h=[...m],b=i?.[p];return b&&b.forEach(g=>{let _=h.findIndex(w=>w===g);_!==-1&&(h[_]={...h[_],accepted:!1})}),h}),setTimeout(()=>c(p),0)};return _n.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},_n.default.createElement("div",{className:"tw-fixed tw-bottom-2 tw-left-1/2 tw-z-[1] tw-flex tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-secondary tw-p-2"},_n.default.createElement(he,{variant:"destructive",size:"sm",onClick:u},_n.default.createElement(Ia,{className:"tw-size-4"}),"Reject"),_n.default.createElement(he,{variant:"success",size:"sm",onClick:s},_n.default.createElement(Nl,{className:"tw-size-4"}),"Accept")),_n.default.createElement("div",{className:"tw-flex tw-items-center tw-border-b tw-border-solid tw-border-border tw-p-2 tw-text-sm tw-font-medium"},e.path),_n.default.createElement("div",{className:"tw-flex-1 tw-overflow-auto tw-p-2"},i?.map((p,m)=>{let h=p.some(g=>g.added||g.removed),b=h?p.every(g=>!g.added&&!g.removed||g.accepted===!0)?"accepted":p.every(g=>!g.added&&!g.removed||g.accepted===!1)?"rejected":"undecided":"unchanged";return _n.default.createElement("div",{key:m,ref:g=>a.current[m]=g,className:Ce("tw-mb-4 tw-overflow-hidden tw-rounded-md tw-border tw-border-solid tw-border-border",{"tw-border-solid":b!=="unchanged"})},b==="accepted"?_n.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm tw-text-normal"},p.filter(g=>!g.removed).map((g,_)=>_n.default.createElement("div",{key:_},g.value))):b==="rejected"?_n.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm tw-text-normal"},p.filter(g=>!g.added).map((g,_)=>_n.default.createElement("div",{key:_},g.value))):p.map((g,_)=>_n.default.createElement("div",{key:`${m}-${_}`,className:Ce("tw-relative",{"tw-bg-success tw-border-l-green":g.added,"tw-bg-error tw-border-l-red":g.removed})},_n.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm tw-text-normal"},g.value))),h&&b==="undecided"&&_n.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-p-2"},_n.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},_n.default.createElement(he,{variant:"destructive",size:"sm",onClick:()=>f(m)},_n.default.createElement(Ia,{className:"tw-size-4"}),"Reject"),_n.default.createElement(he,{variant:"success",size:"sm",onClick:()=>d(m)},_n.default.createElement(Nl,{className:"tw-size-4"}),"Accept"))),h&&(b==="accepted"||b==="rejected")&&_n.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-p-2"},_n.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},_n.default.createElement("div",{className:"tw-mr-2 tw-text-sm tw-font-medium"},b==="accepted"?_n.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-success"},_n.default.createElement(Nl,{className:"tw-size-4"}),_n.default.createElement("div",null,"Accepted")):_n.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-error"},_n.default.createElement(Ia,{className:"tw-size-4"}),_n.default.createElement("div",null,"Rejected"))),_n.default.createElement(he,{variant:"secondary",size:"sm",onClick:()=>{o(g=>{let _=[...g],w=i?.[m];return w&&w.forEach(x=>{let C=_.findIndex(E=>E===x);C!==-1&&(_[C]={..._[C],accepted:null})}),_})}},"Revert"))))})))};mo();var mP=require("obsidian"),QUt=require("obsidian");var ezt=({note_path:t,note_content:e,note_changes:r})=>zy.default.createElement("div",{className:"tw-my-2 tw-flex tw-flex-col tw-overflow-hidden tw-rounded-md tw-border tw-border-solid tw-border-border"},t&&zy.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-overflow-hidden tw-border-[0px] tw-border-b tw-border-solid tw-border-border tw-p-2"},zy.default.createElement("div",{className:"tw-flex-1 tw-truncate tw-p-1 tw-text-xs tw-text-muted"},t),zy.default.createElement("div",{className:"tw-flex tw-gap-2"},zy.default.createElement(he,{className:"tw-text-muted",variant:"ghost2",size:"fit",onClick:()=>{try{let i=r.length>0?aDe(a5(r)):e;navigator.clipboard.writeText(i),new mP.Notice("Content copied to clipboard")}catch(i){fe("Error copying to clipboard:",i),new mP.Notice(`Failed to copy: ${i.message}`)}}},zy.default.createElement(j2,{className:"tw-size-4"}),"Copy"),zy.default.createElement(he,{className:"tw-text-muted",variant:"ghost2",size:"fit",onClick:async()=>{if(t)try{let i=app.vault.getAbstractFileByPath(t),a=!1;if(!i)try{if(t.includes("/")){let l=t.split("/").slice(0,-1).join("/");app.vault.getAbstractFileByPath(l)||await app.vault.createFolder(l)}if(i=await app.vault.create(t,e),i)new mP.Notice(`Created new file: ${t}`),a=!0;else{new mP.Notice(`Failed to create file: ${t}`);return}a=!0}catch(l){fe("Error creating file:",l),new mP.Notice(`Failed to create file: ${l.message}`);return}if(!(i instanceof QUt.TFile)){new mP.Notice(`Path is not a file: ${t}`);return}let s=app.workspace.getActiveFile();if((!s||s.path!==t)&&(await app.workspace.getLeaf().openFile(i),new mP.Notice(`Switched to ${i.name}`)),a)return;await app.workspace.getLeaf(!0).setViewState({type:s5,active:!0,state:{changes:r,path:t}})}catch(i){fe("Error calling composer apply:",i),new mP.Notice(`Error processing code: ${i.message}`)}}},zy.default.createElement(Nl,{className:"tw-size-4"}),app.vault.getAbstractFileByPath(t)?"Preview":"Apply"))),zy.default.createElement("pre",{className:"tw-m-0 tw-border-none"},zy.default.createElement("code",null,r.length>0?aDe(a5(r)):e)));function Dgn({context:t}){return!t||t.notes.length===0&&t.urls.length===0?null:yr.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-2"},t.notes.map(e=>yr.default.createElement(Yt,{key:e.path},yr.default.createElement(Zt,{asChild:!0},yr.default.createElement(km,{variant:"secondary"},yr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e.basename))),yr.default.createElement(Kt,null,e.path))),t.urls.map(e=>yr.default.createElement(Yt,{key:e},yr.default.createElement(Zt,{asChild:!0},yr.default.createElement(km,{variant:"secondary"},yr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e))),yr.default.createElement(Kt,null,e))))}var Ngn=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i,chatHistory:a=[]})=>{let[s,u]=(0,yr.useState)(!1),[l,c]=(0,yr.useState)(!1),[d,f]=(0,yr.useState)(t.message),p=(0,yr.useRef)(null),m=(0,yr.useRef)(null),h=(0,yr.useRef)(null),b=()=>{!navigator.clipboard||!navigator.clipboard.writeText||navigator.clipboard.writeText(t.message).then(()=>{u(!0),setTimeout(()=>{u(!1)},2e3)})},g=(0,yr.useCallback)(j=>{let D=e.workspace.getActiveFile(),k=D?D.path:"",F=ee=>{let Pe="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",G="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",Z="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)";if(r&&ee.includes("<think>"))return ee=ee.replace(/<think>([\s\S]*?)<\/think>/g,(Ie,st)=>`<details style="${Pe}">
<summary style="${G}">Thought for a second</summary>
<div class="tw-text-muted" style="${Z}">${st.trim()}</div>
</details>
`),ee=ee.replace(/<think>([\s\S]*)$/,(Ie,st)=>`<div style="${Pe}">
<div style="${G}">Thinking...</div>
<div class="tw-text-muted" style="${Z}">${st.trim()}</div>
</div>`),ee;let ie=/<think>([\s\S]*?)<\/think>/g;return ee.replace(ie,(Ie,st)=>`<details style="${Pe}">
<summary style="${G}">Thought for a second</summary>
<div class="tw-text-muted" style="${Z}">${st.trim()}</div>
</details>
`)},B=ee=>{let Pe=G=>`\u23F3 Generating changes for ${G}...`;if(r){let G=/(\{[\s\S]*?"type"\s*:\s*"composer"[\s\S]*?)(?=\}|$)/g,Z;for(;(Z=G.exec(ee))!==null;){let ie=Z[1],Ie=Z.index,st=ie.match(/"path"\s*:\s*"([^"]+)"/),Te=st?st[1].trim():"...";ee=ee.substring(0,Ie)+Pe(Te);break}}return ee},q=(ee,Pe,G)=>ee.split(/(```[\s\S]*?```|`[^`]*`)/g).map((ie,Ie)=>Ie%2===0?ie.replace(Pe,(st,Te)=>{let Qe=e.metadataCache.getFirstLinkpathDest(Te,k);return Qe?G(Qe):st}):ie).join(""),W=j.replace(/\\\[\s*/g,"$$").replace(/\s*\\\]/g,"$$").replace(/\\\(\s*/g,"$").replace(/\s*\\\)/g,"$"),H=B(W),L=q(H,/!\[\[(.*?)]]/g,ee=>`![](${e.vault.getResourcePath(ee)})`),z=F(L),K=_(z);return q(K,/(?<!!)\[\[([^\]]+)]]/g,ee=>`<a href="obsidian://open?file=${encodeURIComponent(ee.path)}">${ee.basename}</a>`)},[e,r]),_=j=>{let D=j.split(`
#### Sources:
`);if(D.length!==2)return j;let[k,F]=D,B=F.split(`
`).map(q=>{let W=q.match(/- \[\[(.*?)\]\]/);return W?`<li>[[${W[1]}]]</li>`:q}).join(`
`);return k+`
<br/>
<details><summary>Sources</summary>
<ul>
`+B+`
</ul>
</details>`};(0,yr.useEffect)(()=>{let j=[],D=!1;if(p.current&&t.sender!==gi){p.current.innerHTML="",m.current||(m.current=new hP.Component);let k=g(t.message);if(!D&&(hP.MarkdownRenderer.renderMarkdown(k,p.current,"",m.current),!r)){let F=p.current.querySelectorAll("pre");F.length>0&&F.forEach(B=>{if(D)return;let q=B.querySelector("code");if(!q)return;let W=q.textContent||"";try{if(W.trim().startsWith("{")&&W.trim().endsWith("}")){let H=JSON.parse(W);if(H.type==="composer"&&H.path&&(H.content||H.canvas_json)){let L=H.content||JSON.stringify(H.canvas_json),z=H.path.trim();z.startsWith("/")&&(z=z.slice(1));let K=document.createElement("div");B.parentNode?.replaceChild(K,B);let J=(0,tzt.createRoot)(K);j.push(J);let ee=e.vault.getAbstractFileByPath(z),Pe=[];(async()=>{if(ee instanceof hP.TFile){let G=await e.vault.read(ee);Pe=YUt(G,L,{newlineIsToken:!0})}else{let G=z.split("/").pop()?.split(".")[0],Z=L.split(`
`);(Z[0]===`# ${G}
`||Z[0]===`## ${G}`)&&Z.shift(),L=Z.join(`
`)}D||J.render(yr.default.createElement(ezt,{note_path:z,note_content:L,note_changes:Pe}))})()}}}catch(H){console.error("Failed to parse composer JSON:",H)}})}}return()=>{D=!0,setTimeout(()=>{m.current&&(m.current.unload(),m.current=null),j.forEach(k=>{try{k.unmount()}catch{}})},0)}},[t,e,m,r,g]),(0,yr.useEffect)(()=>{l&&h.current&&w(h.current)},[l]),(0,yr.useEffect)(()=>{f(t.message)},[t.message]);let w=j=>{j.style.height="auto",j.style.height=`${j.scrollHeight}px`},x=j=>{f(j.target.value),w(j.target)},C=j=>{j.nativeEvent.isComposing||j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),P())},E=()=>{c(!0)},P=()=>{c(!1),o&&o(d)},A=()=>{t.sources&&t.sources.length>0&&new vue(e,t.sources).open()},I=()=>{let j=e.workspace.getMostRecentLeaf();if((!j||!(j.view instanceof hP.MarkdownView))&&(j=e.workspace.getLeaf(!1),!j||!(j.view instanceof hP.MarkdownView)))return;let k=j.view.editor.getSelection().length>0;Iz(t.message,k)},R=()=>t.content?yr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3"},t.content.map((j,D)=>j.type==="text"?yr.default.createElement("div",{key:D},t.sender===gi&&l?yr.default.createElement("textarea",{ref:h,value:d,onChange:x,onKeyDown:C,onBlur:P,autoFocus:!0,className:"edit-textarea"}):t.sender===gi?yr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):yr.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""})):j.type==="image_url"?yr.default.createElement("div",{key:D,className:"message-image-content"},yr.default.createElement("img",{src:j.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===gi&&l?yr.default.createElement("textarea",{ref:h,value:d,onChange:x,onKeyDown:C,onBlur:P,autoFocus:!0,className:"edit-textarea"}):t.sender===gi?yr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):yr.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""});return yr.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},yr.default.createElement("div",{className:Ce("tw-group tw-mx-2 tw-flex tw-gap-2 tw-rounded-md tw-p-2",t.sender===gi&&"tw-border tw-border-solid tw-border-border")},yr.default.createElement("div",{className:"tw-w-6 tw-shrink-0"},t.sender===gi?yr.default.createElement(J2,null):yr.default.createElement(tR,null)),yr.default.createElement("div",{className:"tw-flex tw-max-w-full tw-grow tw-flex-col tw-gap-2 tw-overflow-hidden"},!l&&yr.default.createElement(Dgn,{context:t.context}),yr.default.createElement("div",{className:"message-content"},R()),!r&&yr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},yr.default.createElement("div",{className:"tw-text-xs tw-text-faint"},t.timestamp?.display),yr.default.createElement(zUt,{message:t,onCopy:b,isCopied:s,onInsertIntoEditor:I,onRegenerate:n,onEdit:E,onDelete:i,onShowSources:A,hasSources:!!(t.sources&&t.sources.length>0)})))))},sDe=Ngn;var Qc=$(Y(),1);function rzt(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var ozt=$(Y(),1);function nzt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function uDe(...t){return e=>{let r=!1,n=t.map(o=>{let i=nzt(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():nzt(t[o],null)}}}}function izt(...t){return ozt.useCallback(uDe(...t),t)}var azt=$(Y(),1),Bgn=$(Ms(),1);var Xc=$(Y(),1);var Kq=$(St(),1),cDe=Xc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Xc.Children.toArray(r),i=o.find(Fgn);if(i){let a=i.props.children,s=o.map(u=>u===i?Xc.Children.count(a)>1?Xc.Children.only(null):Xc.isValidElement(a)?a.props.children:null:u);return(0,Kq.jsx)(lDe,{...n,ref:e,children:Xc.isValidElement(a)?Xc.cloneElement(a,void 0,s):null})}return(0,Kq.jsx)(lDe,{...n,ref:e,children:r})});cDe.displayName="Slot";var lDe=Xc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Xc.isValidElement(r)){let o=$gn(r);return Xc.cloneElement(r,{...kgn(n,r.props),ref:e?uDe(e,o):o})}return Xc.Children.count(r)>1?Xc.Children.only(null):null});lDe.displayName="SlotClone";var Lgn=({children:t})=>(0,Kq.jsx)(Kq.Fragment,{children:t});function Fgn(t){return Xc.isValidElement(t)&&t.type===Lgn}function kgn(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 $gn(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 szt=$(St(),1),qgn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Pue=qgn.reduce((t,e)=>{let r=azt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?cDe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,szt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var LD=$(St(),1),dDe="Collapsible",[Ugn,ZQo]=ii(dDe),[zgn,fDe]=Ugn(dDe),uzt=Qc.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=Cl({prop:n,defaultProp:o,onChange:a});return(0,LD.jsx)(zgn,{scope:r,disabled:i,contentId:us(),open:u,onOpenToggle:Qc.useCallback(()=>l(c=>!c),[l]),children:(0,LD.jsx)(Pue.div,{"data-state":gDe(u),"data-disabled":i?"":void 0,...s,ref:e})})});uzt.displayName=dDe;var lzt="CollapsibleTrigger",pDe=Qc.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=fDe(lzt,r);return(0,LD.jsx)(Pue.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":gDe(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:rzt(t.onClick,o.onOpenToggle)})});pDe.displayName=lzt;var mDe="CollapsibleContent",hDe=Qc.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=fDe(mDe,t.__scopeCollapsible);return(0,LD.jsx)(rl,{present:r||o.open,children:({present:i})=>(0,LD.jsx)(Hgn,{...n,ref:e,present:i})})});hDe.displayName=mDe;var Hgn=Qc.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=fDe(mDe,r),[s,u]=Qc.useState(n),l=Qc.useRef(null),c=izt(e,l),d=Qc.useRef(0),f=d.current,p=Qc.useRef(0),m=p.current,h=a.open||s,b=Qc.useRef(h),g=Qc.useRef(void 0);return Qc.useEffect(()=>{let _=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(_)},[]),dn(()=>{let _=l.current;if(_){g.current=g.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";let w=_.getBoundingClientRect();d.current=w.height,p.current=w.width,b.current||(_.style.transitionDuration=g.current.transitionDuration,_.style.animationName=g.current.animationName),u(n)}},[a.open,n]),(0,LD.jsx)(Pue.div,{"data-state":gDe(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!h,...i,ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...t.style},children:h&&o})});function gDe(t){return t?"open":"closed"}var czt=uzt;var gP=czt,FD=pDe,yP=hDe;var f5=$(Y());var Ca=$(Y(),1);function ux(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var fzt=$(Y(),1);function dzt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function yDe(...t){return e=>{let r=!1,n=t.map(o=>{let i=dzt(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():dzt(t[o],null)}}}}function Hy(...t){return fzt.useCallback(yDe(...t),t)}var Ka=$(Y(),1);var pzt=$(Y(),1),mzt=$(Ms(),1);var ed=$(Y(),1);var Jq=$(St(),1),u5=ed.forwardRef((t,e)=>{let{children:r,...n}=t,o=ed.Children.toArray(r),i=o.find(Kgn);if(i){let a=i.props.children,s=o.map(u=>u===i?ed.Children.count(a)>1?ed.Children.only(null):ed.isValidElement(a)?a.props.children:null:u);return(0,Jq.jsx)(bDe,{...n,ref:e,children:ed.isValidElement(a)?ed.cloneElement(a,void 0,s):null})}return(0,Jq.jsx)(bDe,{...n,ref:e,children:r})});u5.displayName="Slot";var bDe=ed.forwardRef((t,e)=>{let{children:r,...n}=t;if(ed.isValidElement(r)){let o=Ggn(r);return ed.cloneElement(r,{...Jgn(n,r.props),ref:e?yDe(e,o):o})}return ed.Children.count(r)>1?ed.Children.only(null):null});bDe.displayName="SlotClone";var Wgn=({children:t})=>(0,Jq.jsx)(Jq.Fragment,{children:t});function Kgn(t){return ed.isValidElement(t)&&t.type===Wgn}function Jgn(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 Ggn(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 hzt=$(St(),1),Ygn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],jf=Ygn.reduce((t,e)=>{let r=pzt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?u5:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,hzt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function gzt(t,e){t&&mzt.flushSync(()=>t.dispatchEvent(e))}var vDe=$(St(),1),Zgn="DismissableLayer",_De="dismissableLayer.update",Xgn="dismissableLayer.pointerDownOutside",Qgn="dismissableLayer.focusOutside",yzt,_zt=Ka.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),wDe=Ka.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ka.useContext(_zt),[c,d]=Ka.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ka.useState({}),m=Hy(e,P=>d(P)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,C=ryn(P=>{let A=P.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=nyn(P=>{let A=P.target;[...l.branches].some(R=>R.contains(A))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return ox(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Ka.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(yzt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),bzt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=yzt)}},[c,f,r,l]),Ka.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),bzt())},[c,l]),Ka.useEffect(()=>{let P=()=>p({});return document.addEventListener(_De,P),()=>document.removeEventListener(_De,P)},[]),(0,vDe.jsx)(jf.div,{...u,ref:m,style:{pointerEvents:w?x?"auto":"none":void 0,...t.style},onFocusCapture:ux(t.onFocusCapture,E.onFocusCapture),onBlurCapture:ux(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ux(t.onPointerDownCapture,C.onPointerDownCapture)})});wDe.displayName=Zgn;var eyn="DismissableLayerBranch",tyn=Ka.forwardRef((t,e)=>{let r=Ka.useContext(_zt),n=Ka.useRef(null),o=Hy(e,n);return Ka.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,vDe.jsx)(jf.div,{...t,ref:o})});tyn.displayName=eyn;function ryn(t,e=globalThis?.document){let r=hr(t),n=Ka.useRef(!1),o=Ka.useRef(()=>{});return Ka.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){vzt(Xgn,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 nyn(t,e=globalThis?.document){let r=hr(t),n=Ka.useRef(!1);return Ka.useEffect(()=>{let o=i=>{i.target&&!n.current&&vzt(Qgn,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 bzt(){let t=new CustomEvent(_De);document.dispatchEvent(t)}function vzt(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?gzt(o,i):o.dispatchEvent(i)}var gg=$(Y(),1);var Ozt=$(St(),1),SDe="focusScope.autoFocusOnMount",xDe="focusScope.autoFocusOnUnmount",wzt={bubbles:!1,cancelable:!0},oyn="FocusScope",CDe=gg.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=gg.useState(null),l=hr(o),c=hr(i),d=gg.useRef(null),f=Hy(e,h=>u(h)),p=gg.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;gg.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:TI(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||TI(d.current,{select:!0}))},x=function(E){if(document.activeElement===document.body)for(let A of E)A.removedNodes.length>0&&TI(s)};var h=_,b=w,g=x;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(x);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),gg.useEffect(()=>{if(s){xzt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(SDe,wzt);s.addEventListener(SDe,l),s.dispatchEvent(g),g.defaultPrevented||(iyn(cyn(Pzt(s)),{select:!0}),document.activeElement===h&&TI(s))}return()=>{s.removeEventListener(SDe,l),setTimeout(()=>{let g=new CustomEvent(xDe,wzt);s.addEventListener(xDe,c),s.dispatchEvent(g),g.defaultPrevented||TI(h??document.body,{select:!0}),s.removeEventListener(xDe,c),xzt.remove(p)},0)}}},[s,l,c,p]);let m=gg.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let _=h.currentTarget,[w,x]=ayn(_);w&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&TI(w,{select:!0})):h.shiftKey&&g===w&&(h.preventDefault(),r&&TI(x,{select:!0})):g===_&&h.preventDefault()}},[r,n,p.paused]);return(0,Ozt.jsx)(jf.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});CDe.displayName=oyn;function iyn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(TI(n,{select:e}),document.activeElement!==r)return}function ayn(t){let e=Pzt(t),r=Szt(e,t),n=Szt(e.reverse(),t);return[r,n]}function Pzt(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 Szt(t,e){for(let r of t)if(!syn(r,{upTo:e}))return r}function syn(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 uyn(t){return t instanceof HTMLInputElement&&"select"in t}function TI(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&uyn(t)&&e&&t.select()}}var xzt=lyn();function lyn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=Czt(t,e),t.unshift(e)},remove(e){t=Czt(t,e),t[0]?.resume()}}}function Czt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function cyn(t){return t.filter(e=>e.tagName!=="A")}var $m=$(Y(),1);var Ezt=$(Y(),1);var ODe=$(St(),1),dyn="Arrow",Tzt=Ezt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,ODe.jsx)(jf.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,ODe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});Tzt.displayName=dyn;var Azt=Tzt;var AI=$(St(),1);var PDe="Popper",[Izt,EDe]=ii(PDe),[pyn,Mzt]=Izt(PDe),Rzt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=$m.useState(null);return(0,AI.jsx)(pyn,{scope:e,anchor:n,onAnchorChange:o,children:r})};Rzt.displayName=PDe;var jzt="PopperAnchor",Dzt=$m.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=Mzt(jzt,r),a=$m.useRef(null),s=Hy(e,a);return $m.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,AI.jsx)(jf.div,{...o,ref:s})});Dzt.displayName=jzt;var TDe="PopperContent",[myn,hyn]=Izt(TDe),Nzt=$m.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=Mzt(TDe,r),[g,_]=$m.useState(null),w=Hy(e,ie=>_(ie)),[x,C]=$m.useState(null),E=fg(x),P=E?.width??0,A=E?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},j=Array.isArray(l)?l:[l],D=j.length>0,k={padding:R,boundary:j.filter(yyn),altBoundary:D},{refs:F,floatingStyles:B,placement:q,isPositioned:W,middlewareData:H}=uI({strategy:"fixed",placement:I,whileElementsMounted:(...ie)=>cP(...ie,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[lI({mainAxis:o+A,alignmentAxis:a}),u&&cI({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?dI():void 0,...k}),u&&fI({...k}),pI({...k,apply:({elements:ie,rects:Ie,availableWidth:st,availableHeight:Te})=>{let{width:Qe,height:nt}=Ie.reference,Ht=ie.floating.style;Ht.setProperty("--radix-popper-available-width",`${st}px`),Ht.setProperty("--radix-popper-available-height",`${Te}px`),Ht.setProperty("--radix-popper-anchor-width",`${Qe}px`),Ht.setProperty("--radix-popper-anchor-height",`${nt}px`)}}),x&&hI({element:x,padding:s}),byn({arrowWidth:P,arrowHeight:A}),f&&mI({strategy:"referenceHidden",...k})]}),[L,z]=kzt(q),K=hr(m);dn(()=>{W&&K?.()},[W,K]);let J=H.arrow?.x,ee=H.arrow?.y,Pe=H.arrow?.centerOffset!==0,[G,Z]=$m.useState();return dn(()=>{g&&Z(window.getComputedStyle(g).zIndex)},[g]),(0,AI.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:W?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,AI.jsx)(myn,{scope:r,placedSide:L,onArrowChange:C,arrowX:J,arrowY:ee,shouldHideArrow:Pe,children:(0,AI.jsx)(jf.div,{"data-side":L,"data-align":z,...h,ref:w,style:{...h.style,animation:W?void 0:"none"}})})})});Nzt.displayName=TDe;var Lzt="PopperArrow",gyn={top:"bottom",right:"left",bottom:"top",left:"right"},Fzt=$m.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=hyn(Lzt,n),a=gyn[i.placedSide];return(0,AI.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,AI.jsx)(Azt,{...o,ref:r,style:{...o.style,display:"block"}})})});Fzt.displayName=Lzt;function yyn(t){return t!==null}var byn=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]=kzt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function kzt(t){let[e,r="center"]=t.split("-");return[e,r]}var $zt=Rzt,ADe=Dzt,Bzt=Nzt,qzt=Fzt;var Eue=$(Y(),1),Uzt=$(Ms(),1);var zzt=$(St(),1),vyn="Portal",IDe=Eue.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Eue.useState(!1);dn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Uzt.default.createPortal((0,zzt.jsx)(jf.div,{...n,ref:e}),a):null});IDe.displayName=vyn;var Iue=$(Y());var zd=$(Y());var Tue=AD();var MDe=function(){},l5=zd.forwardRef(function(t,e){var r=zd.useRef(null),n=zd.useState({onScrollCapture:MDe,onWheelCapture:MDe,onTouchMoveCapture:MDe}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,b=t.as,g=b===void 0?"div":b,_=t.gapMode,w=vI(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,C=TD([r,e]),E=ai(ai({},w),o);return zd.createElement(zd.Fragment,null,c&&zd.createElement(x,{sideCar:Tue,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:_}),a?zd.cloneElement(zd.Children.only(s),ai(ai({},E),{ref:C})):zd.createElement(g,ai({},E,{className:u,ref:C}),s))});l5.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};l5.classNames={fullWidth:$y,zeroRight:ky};var oa=$(Y());var RDe=!1;if(typeof window<"u")try{c5=Object.defineProperty({},"passive",{get:function(){return RDe=!0,!0}}),window.addEventListener("test",c5,c5),window.removeEventListener("test",c5,c5)}catch{RDe=!1}var c5,kD=RDe?{passive:!1}:!1;var wyn=function(t){return t.tagName==="TEXTAREA"},Hzt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!wyn(t)&&r[e]==="visible")},Syn=function(t){return Hzt(t,"overflowY")},xyn=function(t){return Hzt(t,"overflowX")},jDe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=Vzt(t,n);if(o){var i=Wzt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Cyn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},Oyn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},Vzt=function(t,e){return t==="v"?Syn(e):xyn(e)},Wzt=function(t,e){return t==="v"?Cyn(e):Oyn(e)},Pyn=function(t,e){return t==="h"&&e==="rtl"?-1:1},Kzt=function(t,e,r,n,o){var i=Pyn(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=Wzt(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&Vzt(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var Aue=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Jzt=function(t){return[t.deltaX,t.deltaY]},Gzt=function(t){return t&&"current"in t?t.current:t},Eyn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Tyn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},Ayn=0,Gq=[];function Yzt(t){var e=oa.useRef([]),r=oa.useRef([0,0]),n=oa.useRef(),o=oa.useState(Ayn++)[0],i=oa.useState(dP)[0],a=oa.useRef(t);oa.useEffect(function(){a.current=t},[t]),oa.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=Fq([t.lockRef.current],(t.shards||[]).map(Gzt),!0).filter(Boolean);return h.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=oa.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=Aue(h),_=r.current,w="deltaX"in h?h.deltaX:_[0]-g[0],x="deltaY"in h?h.deltaY:_[1]-g[1],C,E=h.target,P=Math.abs(w)>Math.abs(x)?"h":"v";if("touches"in h&&P==="h"&&E.type==="range")return!1;var A=jDe(P,E);if(!A)return!0;if(A?C=P:(C=P==="v"?"h":"v",A=jDe(P,E)),!A)return!1;if(!n.current&&"changedTouches"in h&&(w||x)&&(n.current=C),!C)return!0;var I=n.current||C;return Kzt(I,b,h,I==="h"?w:x,!0)},[]),u=oa.useCallback(function(h){var b=h;if(!(!Gq.length||Gq[Gq.length-1]!==i)){var g="deltaY"in b?Jzt(b):Aue(b),_=e.current.filter(function(C){return C.name===b.type&&(C.target===b.target||b.target===C.shadowParent)&&Eyn(C.delta,g)})[0];if(_&&_.should){b.cancelable&&b.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(Gzt).filter(Boolean).filter(function(C){return C.contains(b.target)}),x=w.length>0?s(b,w[0]):!a.current.noIsolation;x&&b.cancelable&&b.preventDefault()}}},[]),l=oa.useCallback(function(h,b,g,_){var w={name:h,delta:b,target:g,should:_,shadowParent:Iyn(g)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(x){return x!==w})},1)},[]),c=oa.useCallback(function(h){r.current=Aue(h),n.current=void 0},[]),d=oa.useCallback(function(h){l(h.type,Jzt(h),h.target,s(h,t.lockRef.current))},[]),f=oa.useCallback(function(h){l(h.type,Aue(h),h.target,s(h,t.lockRef.current))},[]);oa.useEffect(function(){return Gq.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,kD),document.addEventListener("touchmove",u,kD),document.addEventListener("touchstart",c,kD),function(){Gq=Gq.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,kD),document.removeEventListener("touchmove",u,kD),document.removeEventListener("touchstart",c,kD)}},[]);var p=t.removeScrollBar,m=t.inert;return oa.createElement(oa.Fragment,null,m?oa.createElement(i,{styles:Tyn(o)}):null,p?oa.createElement(MD,{gapMode:t.gapMode}):null)}function Iyn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var Zzt=ID(Tue,Yzt);var Xzt=Iue.forwardRef(function(t,e){return Iue.createElement(l5,ai({},t,{ref:e,sideCar:Zzt}))});Xzt.classNames=l5.classNames;var DDe=Xzt;var ol=$(St(),1),NDe="Popover",[Qzt,fti]=ii(NDe,[EDe]),d5=EDe(),[Myn,II]=Qzt(NDe),e2t=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=d5(e),u=Ca.useRef(null),[l,c]=Ca.useState(!1),[d=!1,f]=Cl({prop:n,defaultProp:o,onChange:i});return(0,ol.jsx)($zt,{...s,children:(0,ol.jsx)(Myn,{scope:e,contentId:us(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:Ca.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:Ca.useCallback(()=>c(!0),[]),onCustomAnchorRemove:Ca.useCallback(()=>c(!1),[]),modal:a,children:r})})};e2t.displayName=NDe;var t2t="PopoverAnchor",Ryn=Ca.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=II(t2t,r),i=d5(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return Ca.useEffect(()=>(a(),()=>s()),[a,s]),(0,ol.jsx)(ADe,{...i,...n,ref:e})});Ryn.displayName=t2t;var r2t="PopoverTrigger",n2t=Ca.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=II(r2t,r),i=d5(r),a=Hy(e,o.triggerRef),s=(0,ol.jsx)(jf.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":u2t(o.open),...n,ref:a,onClick:ux(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,ol.jsx)(ADe,{asChild:!0,...i,children:s})});n2t.displayName=r2t;var LDe="PopoverPortal",[jyn,Dyn]=Qzt(LDe,{forceMount:void 0}),o2t=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=II(LDe,e);return(0,ol.jsx)(jyn,{scope:e,forceMount:r,children:(0,ol.jsx)(rl,{present:r||i.open,children:(0,ol.jsx)(IDe,{asChild:!0,container:o,children:n})})})};o2t.displayName=LDe;var Yq="PopoverContent",i2t=Ca.forwardRef((t,e)=>{let r=Dyn(Yq,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=II(Yq,t.__scopePopover);return(0,ol.jsx)(rl,{present:n||i.open,children:i.modal?(0,ol.jsx)(Nyn,{...o,ref:e}):(0,ol.jsx)(Lyn,{...o,ref:e})})});i2t.displayName=Yq;var Nyn=Ca.forwardRef((t,e)=>{let r=II(Yq,t.__scopePopover),n=Ca.useRef(null),o=Hy(e,n),i=Ca.useRef(!1);return Ca.useEffect(()=>{let a=n.current;if(a)return _I(a)},[]),(0,ol.jsx)(DDe,{as:u5,allowPinchZoom:!0,children:(0,ol.jsx)(a2t,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ux(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:ux(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:ux(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Lyn=Ca.forwardRef((t,e)=>{let r=II(Yq,t.__scopePopover),n=Ca.useRef(!1),o=Ca.useRef(!1);return(0,ol.jsx)(a2t,{...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()}})}),a2t=Ca.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=II(Yq,r),p=d5(r);return aI(),(0,ol.jsx)(CDe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,ol.jsx)(wDe,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,ol.jsx)(Bzt,{"data-state":u2t(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)"}})})})}),s2t="PopoverClose",Fyn=Ca.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=II(s2t,r);return(0,ol.jsx)(jf.button,{type:"button",...n,ref:e,onClick:ux(t.onClick,()=>o.onOpenChange(!1))})});Fyn.displayName=s2t;var kyn="PopoverArrow",$yn=Ca.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=d5(r);return(0,ol.jsx)(qzt,{...o,...n,ref:e})});$yn.displayName=kyn;function u2t(t){return t?"open":"closed"}var l2t=e2t;var c2t=n2t,d2t=o2t,FDe=i2t;var f2t=l2t,p2t=c2t;var kDe=f5.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>f5.createElement(d2t,{container:n??activeDocument.body},f5.createElement(FDe,{ref:i,align:e,sideOffset:r,className:Ce("tw-z-popover tw-w-72 tw-rounded-md tw-border tw-border-border tw-bg-primary tw-p-4 tw-text-normal tw-shadow-md tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",t),...o})));kDe.displayName=FDe.displayName;Zr();var $De=$(Y()),Mue=$De.createContext(void 0),Zq=$De.createContext(void 0);var Xq=$(Y());function BDe(){let[t,e]=(0,Xq.useState)(null),r=(0,Xq.useContext)(Zq);return(0,Xq.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(Hx.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(Hx.ACTIVE_LEAF_CHANGE,n)}},[r]),t}var p5=require("obsidian"),He=$(Y());function qyn(t){let[e,r]=(0,He.useState)([]),n=BDe();return(0,He.useEffect)(()=>{async function o(){if(!n?.path)return;let i=await Li.getInstance().getDb(),a=await _se({db:i,filePath:n.path});r(a)}o()},[n?.path,t]),e}function Uyn(t,e){let[r,n]=(0,He.useState)(!0);return(0,He.useEffect)(()=>{if(!t)return;async function o(){let i=await Li.getInstance().hasIndex(t);n(i)}o()},[t,e]),r}function zyn({score:t}){let e=bse(t),r="\u{1F534}";return e===2&&(r="\u{1F7E0}"),e===3&&(r="\u{1F7E2}"),He.default.createElement("span",{className:"tw-text-sm"},r)}function Hyn({note:t,onAddToChat:e,onNavigateToNote:r}){let[n,o]=(0,He.useState)(!1),[i,a]=(0,He.useState)(null),s=(0,He.useCallback)(async()=>{if(i)return;let u=app.vault.getAbstractFileByPath(t.document.path);if(u instanceof p5.TFile){let l=await app.vault.cachedRead(u),c=l;if(l.startsWith("---")){let d=l.indexOf("---",3);d!==-1&&(c=l.slice(d+3).trim())}a(c.slice(0,1e3)+(c.length>1e3?"...":""))}},[i,t.document.path]);return(0,He.useEffect)(()=>{n&&s()},[n,s]),He.default.createElement(gP,{open:n,onOpenChange:o,className:"tw-rounded-md tw-border tw-border-solid tw-border-border"},He.default.createElement("div",{className:Ce("tw-flex tw-items-center tw-justify-between tw-gap-2 tw-p-2")},He.default.createElement(he,{variant:"ghost2",size:"icon",className:"tw-shrink-0",asChild:!0},He.default.createElement(FD,null,He.default.createElement(oC,{className:Ce("tw-size-4 tw-transition-transform tw-duration-200",{"rotate-90":n})}))),He.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-2"},He.default.createElement(zyn,{score:t.metadata.similarityScore??0})),He.default.createElement("div",{className:"tw-flex-1 tw-overflow-hidden"},He.default.createElement("a",{onClick:u=>{u.preventDefault();let l=u.metaKey||u.ctrlKey;r(l)},onAuxClick:u=>{u.button===1&&(u.preventDefault(),r(!0))},className:"tw-block tw-w-full tw-truncate tw-text-sm tw-font-bold tw-text-normal"},t.document.title)),He.default.createElement(Yt,null,He.default.createElement(Zt,{asChild:!0},He.default.createElement(he,{variant:"ghost2",size:"icon",onClick:e,className:"tw-shrink-0"},He.default.createElement(Ug,{className:"tw-size-4"}))),He.default.createElement(Kt,null,"Add to Chat"))),He.default.createElement(yP,null,He.default.createElement("div",{className:"tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2"},He.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-wrap tw-break-all tw-text-xs tw-text-muted tw-opacity-75"},t.document.path),i&&He.default.createElement("div",{className:"tw-overflow-hidden tw-whitespace-pre-wrap tw-border-t tw-border-border tw-pb-4 tw-pt-2 tw-text-xs tw-text-normal"},i)),He.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4 tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2 tw-text-xs tw-text-muted"},t.metadata.similarityScore!=null&&He.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},He.default.createElement("span",null,"Similarity: ",(t.metadata.similarityScore*100).toFixed(1),"%")),t.metadata.hasOutgoingLinks&&He.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},He.default.createElement(B2,{className:"tw-size-4"}),He.default.createElement("span",null,"Outgoing links")),t.metadata.hasBacklinks&&He.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},He.default.createElement($2,{className:"tw-size-4"}),He.default.createElement("span",null,"Backlinks")))))}function Vyn({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return He.default.createElement(f2t,{key:t.document.path},He.default.createElement(p2t,{asChild:!0},n),He.default.createElement(kDe,{className:"tw-flex tw-w-fit tw-min-w-72 tw-max-w-96 tw-flex-col tw-gap-2 tw-overflow-hidden"},He.default.createElement("span",{className:"tw-text-sm tw-text-normal"},t.document.title),He.default.createElement("span",{className:"tw-text-xs tw-text-muted"},t.document.path),He.default.createElement("div",{className:"tw-flex tw-gap-2"},He.default.createElement("button",{onClick:e,className:"tw-inline-flex tw-items-center tw-gap-2 tw-border tw-border-solid tw-border-border !tw-bg-transparent !tw-shadow-none hover:!tw-bg-interactive-hover"},"Add to Chat ",He.default.createElement(Ug,{className:"tw-size-4"})),He.default.createElement("button",{onClick:o=>{let i=o.metaKey||o.ctrlKey;r(i)},className:"tw-inline-flex tw-items-center tw-gap-2 tw-border tw-border-solid tw-border-border !tw-bg-transparent !tw-shadow-none hover:!tw-bg-interactive-hover"},"Navigate to Note ",He.default.createElement(M2,{className:"tw-size-4"})))))}var Rue=(0,He.memo)(({className:t,onInsertToChat:e,defaultOpen:r=!1})=>{let[n,o]=(0,He.useState)(0),[i,a]=(0,He.useState)(r),s=qyn(n),u=BDe(),l=Uyn(u?.path??"",n),c=(p,m=!1)=>{let h=app.vault.getAbstractFileByPath(p);h instanceof p5.TFile&&app.workspace.getLeaf(m).openFile(h)},d=p=>{e(`[[${p}]]`)},f=async()=>{u&&(await Li.getInstance().reindexFile(u),new p5.Notice(`Reindexed ${u.name}`),o(n+1))};return He.default.createElement("div",{className:Ce("tw-w-full tw-border tw-border-solid tw-border-transparent tw-border-b-border tw-pb-2",t)},He.default.createElement(gP,{open:i,onOpenChange:a},He.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-pb-2 tw-pl-1"},He.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},He.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Relevant Notes"),He.default.createElement(Yt,null,He.default.createElement(Zt,{asChild:!0},He.default.createElement(iR,{className:"tw-size-4 tw-text-muted"})),He.default.createElement(Kt,{side:"bottom",className:"tw-w-64"},"Relevance is a combination of semantic similarity and links.")),!l&&He.default.createElement(Yt,null,He.default.createElement(Zt,{asChild:!0},He.default.createElement(yf,{className:"tw-size-4 tw-text-warning"})),He.default.createElement(Kt,{side:"bottom"},"Note has not been indexed"))),He.default.createElement("div",{className:"tw-flex tw-items-center"},He.default.createElement(Yt,null,He.default.createElement(Zt,{asChild:!0},He.default.createElement(he,{variant:"ghost2",size:"icon",onClick:f},He.default.createElement(V2,{className:"tw-size-4"}))),He.default.createElement(Kt,{side:"bottom"},"Reindex Current Note")),s.length>0&&He.default.createElement(FD,{asChild:!0},He.default.createElement(he,{variant:"ghost2",size:"icon"},i?He.default.createElement(qg,{className:"tw-size-5"}):He.default.createElement(Di,{className:"tw-size-5"}))))),s.length===0&&He.default.createElement("div",{className:"tw-flex tw-max-h-12 tw-flex-wrap tw-gap-x-2 tw-gap-y-1 tw-overflow-y-hidden tw-px-1"},He.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"No relevant notes found")),!i&&s.length>0&&He.default.createElement("div",{className:"tw-flex tw-max-h-6 tw-flex-wrap tw-gap-x-2 tw-gap-y-1 tw-overflow-y-hidden tw-px-1"},s.map(p=>He.default.createElement(Vyn,{key:p.document.path,note:p,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)},He.default.createElement(km,{variant:"outline",key:p.document.path,className:"tw-max-w-40 tw-text-xs tw-text-muted hover:tw-cursor-pointer hover:tw-bg-interactive-hover"},He.default.createElement("span",{className:"tw-truncate"},p.document.title))))),He.default.createElement(yP,null,He.default.createElement("div",{className:"tw-flex tw-max-h-screen tw-flex-col tw-gap-2 tw-overflow-y-auto tw-px-1 tw-py-2"},s.map(p=>He.default.createElement(Hyn,{note:p,key:p.document.path,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)}))))))});Rue.displayName="RelevantNotes";pf();var Lp=$(Y());var m5=Lp.forwardRef(({className:t,...e},r)=>Lp.createElement("div",{ref:r,className:Ce("tw-rounded-xl tw-border tw-border-border tw-bg-primary tw-text-normal tw-shadow",t),...e}));m5.displayName="Card";var h5=Lp.forwardRef(({className:t,...e},r)=>Lp.createElement("div",{ref:r,className:Ce("tw-flex tw-flex-col tw-space-y-1.5 tw-p-6",t),...e}));h5.displayName="CardHeader";var qDe=Lp.forwardRef(({className:t,...e},r)=>Lp.createElement("div",{ref:r,className:Ce("tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));qDe.displayName="CardTitle";var Wyn=Lp.forwardRef(({className:t,...e},r)=>Lp.createElement("div",{ref:r,className:Ce("tw-text-sm tw-text-muted",t),...e}));Wyn.displayName="CardDescription";var g5=Lp.forwardRef(({className:t,...e},r)=>Lp.createElement("div",{ref:r,className:Ce("tw-p-6 tw-pt-0",t),...e}));g5.displayName="CardContent";var Kyn=Lp.forwardRef(({className:t,...e},r)=>Lp.createElement("div",{ref:r,className:Ce("tw-flex tw-items-center tw-p-6 tw-pt-0",t),...e}));Kyn.displayName="CardFooter";Zr();Jt();var Bi=$(Y()),UDe={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>]]"]}},m2t={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"],project:["copilotPlus","copilotPlus","copilotPlus"]};function Jyn(t="llm_chain"){let e=m2t[t]||m2t.llm_chain,r={};return e.map(n=>(r[n]||(r[n]=[...UDe[n].prompts].sort(()=>Math.random()-.5)),{title:UDe[n].title,text:r[n].pop()||UDe[n].prompts[0]}))}var h2t=({onClick:t})=>{let[e]=Rg(),r=(0,Bi.useMemo)(()=>Jyn(e),[e]),o=Pn().indexVaultToVectorStore;return Bi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Bi.default.createElement(m5,{className:"tw-w-full tw-bg-transparent"},Bi.default.createElement(h5,{className:"tw-px-2"},Bi.default.createElement(qDe,null,"Suggested Prompts")),Bi.default.createElement(g5,{className:"tw-p-2 tw-pt-0"},Bi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},r.map((i,a)=>Bi.default.createElement("div",{key:a,className:"tw-flex tw-justify-between tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},Bi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},Bi.default.createElement("div",{className:"tw-text-muted"},i.title),Bi.default.createElement("div",null,i.text)),Bi.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},Bi.default.createElement(Yt,null,Bi.default.createElement(Zt,{asChild:!0},Bi.default.createElement(he,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>t(i.text)},Bi.default.createElement(Ug,{className:"tw-size-4"}))),Bi.default.createElement(Kt,null,"Add to Chat")))))))),e==="vault_qa"&&Bi.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},"Please note that this is a retrieval-based QA. Questions should contain keywords and concepts that exist literally in your vault"),e==="vault_qa"&&o==="NEVER"&&Bi.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},Bi.default.createElement("div",null,Bi.default.createElement(yf,{className:"tw-size-4"})," Your auto-index strategy is set to"," ",Bi.default.createElement("b",null,"NEVER"),". Before proceeding, click the"," ",Bi.default.createElement("span",{className:"tw-text-accent"},"Refresh Index")," button below or run the"," ",Bi.default.createElement("span",{className:"tw-text-accent"},"Copilot command: Index (refresh) vault for QA")," ","to update the index.")))};Jt();var Hd=$(Y()),g2t=(0,Hd.memo)(({chatHistory:t,currentAiMessage:e,loading:r,loadingMessage:n,app:o,onRegenerate:i,onEdit:a,onDelete:s,onInsertToChat:u,onReplaceChat:l,showHelperComponents:c=!0})=>{let[d,f]=(0,Hd.useState)(""),p=Pn(),m=()=>{let b=document.querySelector("[data-testid='chat-messages']");b&&(b.scrollTop=b.scrollHeight)};if((0,Hd.useEffect)(()=>{r||m()},[r]),(0,Hd.useEffect)(()=>{let b;return r?b=setInterval(()=>{f(g=>g.length<6?g+".":"")},200):f(""),()=>clearInterval(b)},[r]),!t.filter(b=>b.isVisible).length&&!e)return Hd.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-gap-2 tw-overflow-y-auto"},c&&p.showRelevantNotes&&Hd.default.createElement(Rue,{onInsertToChat:u,defaultOpen:!0,key:"relevant-notes-before-chat"}),c&&p.showSuggestedPrompts&&Hd.default.createElement(h2t,{onClick:l}));let h=()=>n?`${n} ${d}`:d;return Hd.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-1 tw-flex-col tw-overflow-hidden"},c&&p.showRelevantNotes&&Hd.default.createElement(Rue,{className:"tw-mb-4",onInsertToChat:u,defaultOpen:!1,key:"relevant-notes-in-chat"}),Hd.default.createElement("div",{"data-testid":"chat-messages",className:"tw-mt-auto tw-box-border tw-flex tw-w-full tw-flex-1 tw-select-text tw-flex-col tw-items-start tw-justify-start tw-overflow-y-auto tw-scroll-smooth tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)]"},t.map((b,g)=>b.isVisible&&Hd.default.createElement(sDe,{key:g,message:b,app:o,isStreaming:!1,onRegenerate:()=>i(g),onEdit:_=>a(g,_),onDelete:()=>s(g),chatHistory:t})),(e||r)&&Hd.default.createElement(sDe,{key:`ai_message_${e}`,message:{sender:"AI",message:e||h(),isVisible:!0,timestamp:null},app:o,isStreaming:!0,onDelete:()=>{},chatHistory:t})))});g2t.displayName="ChatMessages";var y2t=g2t;yn();var jue=$(Y());function Due(t){let[e,r]=(0,jue.useState)(null);(0,jue.useEffect)(()=>{(async()=>{let i=await oze();i.version&&r(i.version)})()},[]);let n=e!==null&&W9(e,t);return{latestVersion:e,hasUpdate:n}}Jt();yn();var yg=$(Y());function b2t({currentVersion:t}){let{latestVersion:e,hasUpdate:r}=Due(t),n=Pn().lastDismissedVersion,[o,i]=(0,yg.useState)(!0),a=r&&e&&W9(e,t)&&n!==e,s=()=>{e&&(i(!1),setTimeout(()=>{Je("lastDismissedVersion",e)},300))};return a?yg.default.createElement("div",{className:Ce("tw-min-h-14 tw-overflow-hidden",o?"tw-duration-300 tw-animate-in tw-slide-in-from-top":"tw-duration-300 tw-animate-out tw-slide-out-to-top")},yg.default.createElement("div",{className:"tw-mb-1 tw-flex tw-items-center tw-justify-between tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-pl-3 tw-text-xs"},yg.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},yg.default.createElement("span",{className:"tw-font-medium"},"Update available:"),"(",yg.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"tw-text-normal"},"v",e)),yg.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},yg.default.createElement(he,{size:"fit",variant:"ghost2",className:"tw-text-accent hover:tw-text-accent-hover",onClick:()=>{window.open("obsidian://show-plugin?id=copilot","_blank"),s()}},"Update"),yg.default.createElement(he,{variant:"ghost2",size:"icon",onClick:s},yg.default.createElement(Ia,{className:"tw-size-4"}))))):null}var Qq=$(Y());var Nue=$(Y()),Gyn=2;function Yyn(t,e){return e&&e>1?t.current?t.current.offsetHeight<t.current.scrollHeight:!1:(t.current&&t.current?.offsetWidth+Gyn<t.current?.scrollWidth)??!1}function Zyn(t){switch(t){case 2:return"tw-line-clamp-2";case 3:return"tw-line-clamp-3";default:return""}}var Lue=({children:t,className:e,lineClamp:r,tooltipContent:n,...o})=>{let i=(0,Nue.useRef)(null),[a,s]=(0,Nue.useState)(!1);return Qq.default.createElement(xa,{delayDuration:0},Qq.default.createElement(Yt,{open:a,onOpenChange:l=>{s(l&&Yyn(i,r))}},Qq.default.createElement(Zt,{asChild:!0},Qq.default.createElement("div",{...o,ref:i,className:Ce("tw-max-w-full tw-text-normal",(!r||r<=1)&&"tw-truncate",r&&Zyn(r),e),"data-testid":"truncatedText"},t)),Qq.default.createElement(Kt,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},n??t)))};var O2t=require("obsidian"),vn=$(Y()),P2t=$(_c());var _2t=require("obsidian"),Vy=$(Y()),v2t=$(_c());function Xyn({onConfirm:t,onCancel:e}){let[r,n]=(0,Vy.useState)("");return Vy.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Vy.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Vy.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"),Vy.default.createElement(io,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),Vy.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Vy.default.createElement(he,{variant:"secondary",onClick:e},"Cancel"),Vy.default.createElement(he,{variant:"default",onClick:()=>t(r)},"Confirm")))}var eU=class extends _2t.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,v2t.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(Vy.default.createElement(Xyn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var w2t=require("obsidian"),bg=$(Y()),S2t=$(_c());function Qyn({onConfirm:t,onCancel:e}){let[r,n]=(0,bg.useState)(""),[o,i]=(0,bg.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return bg.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},bg.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},bg.default.createElement(io,{placeholder:"Enter the extension (e.g. txt, excalidraw.md)",value:r,onChange:u=>{n(u.target.value),i(null)},onKeyDown:u=>{u.key==="Enter"&&a(r)}}),o&&bg.default.createElement("p",{className:"tw-text-sm tw-text-error"},o)),bg.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},bg.default.createElement(he,{variant:"secondary",onClick:e},"Cancel"),bg.default.createElement(he,{variant:"default",onClick:()=>a(r)},"Confirm")))}var tU=class extends w2t.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,S2t.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(bg.default.createElement(Qyn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var x2t=require("obsidian");var rU=class extends x2t.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=wre(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 zDe=require("obsidian");var Fue=class extends Vq{constructor({app:e,onFileSelect:r,excludeFilePaths:n,titleOnly:o=!1}){super(e),this.onFileSelect=r,this.availableNotes=this.getOrderedProjectFiles(n),this.titleOnly=o,this.setTitle("Select File")}getOrderedProjectFiles(e=[]){let r=["mp3","mp4","m4a","wav","webm"],n=this.app.workspace.getLastOpenFiles().map(a=>this.app.vault.getAbstractFileByPath(a)).filter(a=>a instanceof zDe.TFile&&!e.includes(a.path)&&a.path!==this.activeNote?.path&&!r.includes(a.extension.toLowerCase())),i=this.app.vault.getFiles().filter(a=>!r.includes(a.extension.toLowerCase())).filter(a=>!n.some(s=>s.path===a.path)&&!e.includes(a.path)&&a.path!==this.activeNote?.path);return[...this.activeNote?[this.activeNote]:[],...n,...i]}getItems(){if(this.titleOnly){let e=new Map;return this.availableNotes.forEach(r=>{e.set(r.basename,r)}),Array.from(e.values())}return this.availableNotes}getItemText(e){let r=e.path===this.activeNote?.path;return this.formatNoteTitle(e.basename,r,e.extension)}onChooseItem(e,r){this.onFileSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof zDe.TFile){let o=n.createDiv(),i=e.item;o.setText(this.formatNoteTitle(i.basename,i===this.activeNote,i.extension)),this.titleOnly||n.createDiv({cls:"mt-1 text-muted text-xs"}).setText(i.path)}}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n&&(o+=` (${n.toUpperCase()})`),o}};yn();var C2t=require("obsidian"),nU=class extends C2t.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)Tz(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};function kue({title:t,patterns:e,onRemove:r}){return vn.default.createElement("div",{className:"tw-grid tw-grid-cols-4 tw-gap-2"},vn.default.createElement("div",{className:"tw-font-bold"},t),vn.default.createElement("ul",{className:"tw-col-span-3 tw-m-0 tw-flex tw-list-inside tw-list-disc tw-flex-col tw-gap-1 tw-pl-0"},e.map(n=>vn.default.createElement("li",{key:n,className:"tw-flex tw-gap-2 tw-rounded-md tw-pl-2 tw-pr-1 hover:tw-bg-dropdown-hover"},vn.default.createElement(Lue,{className:"tw-flex-1"},n),vn.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>r(n)},vn.default.createElement(Ia,{className:"tw-size-4"}))))))}function ebn({value:t,onUpdate:e,container:r}){let[n,o]=(0,vn.useState)(t),i=Cm(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=iA(i),c=f=>{let p=vre({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 vn.default.createElement("div",{className:"tw-mt-2 tw-flex tw-flex-col tw-gap-4"},vn.default.createElement("div",{className:"tw-flex tw-max-h-[400px] tw-flex-col tw-gap-2 tw-overflow-y-auto tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-4"},!d&&vn.default.createElement("div",{className:"tw-text-center tw-text-sm"},"No patterns specified"),a.length>0&&vn.default.createElement(kue,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(m=>m!==f);c({tagPatterns:p})}}),s.length>0&&vn.default.createElement(kue,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(m=>m!==f);c({extensionPatterns:p})}}),u.length>0&&vn.default.createElement(kue,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(m=>m!==f);c({folderPatterns:p})}}),l.length>0&&vn.default.createElement(kue,{title:"Files",patterns:l,onRemove:f=>{let p=l.filter(m=>m!==f);c({notePatterns:p})}})),vn.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},vn.default.createElement(SI,null,vn.default.createElement(xI,{asChild:!0},vn.default.createElement(he,{variant:"secondary"},"Add...")),vn.default.createElement(mg,{align:"start",container:r},vn.default.createElement(Ho,{onSelect:()=>{new nU(app,f=>{let p=`#${f}`;a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},vn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},vn.default.createElement(sR,{className:"tw-size-4"}),"Tag")),vn.default.createElement(Ho,{onSelect:()=>{new rU(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},vn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},vn.default.createElement(zg,{className:"tw-size-4"}),"Folder")),vn.default.createElement(Ho,{onSelect:()=>{new Fue({app,onFileSelect:f=>{let p=`[[${f.basename}]]`;l.includes(p)||c({notePatterns:[...l,p]})},excludeFilePaths:[],titleOnly:!0}).open()}},vn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},vn.default.createElement(aC,{className:"tw-size-4"}),"Files")),vn.default.createElement(Ho,{onSelect:()=>{new tU(app,f=>{let p=`*.${f}`;s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},vn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},vn.default.createElement(nR,{className:"tw-size-4"}),"Extension")),vn.default.createElement(Ho,{onSelect:()=>{new eU(app,f=>{let p=Cm(f),{tagPatterns:m,extensionPatterns:h,folderPatterns:b,notePatterns:g}=iA(p);c({tagPatterns:[...a,...m],extensionPatterns:[...s,...h],folderPatterns:[...u,...b],notePatterns:[...l,...g]})}).open()}},vn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},vn.default.createElement(cC,{className:"tw-size-4"}),"Custom"))))))}var y5=class extends O2t.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,P2t.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(vn.default.createElement(ebn,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};var oU=$(Y());var $ue=$(Y());var M2t=$(Y(),1);var E2t=$(Y(),1),T2t=$(Ms(),1);var A2t=$(St(),1),tbn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ao=tbn.reduce((t,e)=>{let r=E2t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Sb:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,A2t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function I2t(t,e){t&&T2t.flushSync(()=>t.dispatchEvent(e))}var R2t=$(St(),1),rbn="Label",j2t=M2t.forwardRef((t,e)=>(0,R2t.jsx)(ao.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));j2t.displayName=rbn;var HDe=j2t;var obn=FL("tw-text-sm tw-font-medium tw-leading-none peer-disabled:tw-cursor-not-allowed peer-disabled:tw-opacity-70"),Fp=$ue.forwardRef(({className:t,...e},r)=>$ue.createElement(HDe,{ref:r,className:Ce(obn(),t),...e}));Fp.displayName=HDe.displayName;var Vo=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>oU.default.createElement("div",{className:"tw-space-y-2"},oU.default.createElement(Fp,{className:r?"tw-text-error":""},t," ",e&&oU.default.createElement("span",{className:"tw-text-error"},"*")),i,r&&oU.default.createElement("p",{className:"tw-text-xs tw-text-error"},o),n&&oU.default.createElement("p",{className:"tw-text-sm tw-text-muted"},n));var $D=$(Y());function Bue({options:t,placeholder:e,containerClassName:r,className:n,...o}){return $D.default.createElement("div",{className:Ce("tw-group tw-relative tw-w-full",r)},$D.default.createElement("select",{className:Ce("tw-w-full tw-appearance-none","tw-flex tw-h-9 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-dropdown tw-px-3 tw-py-1 tw-pr-8","tw-text-sm tw-shadow tw-transition-colors","focus:tw-outline-none focus:tw-ring-1 focus:tw-ring-ring","disabled:tw-cursor-not-allowed disabled:tw-opacity-50","hover:tw-bg-interactive-hover hover:tw-text-normal",n),...o},e&&$D.default.createElement("option",{value:"",disabled:!0},e),t.map(i=>$D.default.createElement("option",{key:i.value,value:i.value},i.label))),$D.default.createElement("div",{className:Ce("tw-pointer-events-none tw-absolute tw-inset-y-0 tw-right-0 tw-flex tw-items-center tw-pr-2","tw-transition-colors group-hover:[&>svg]:tw-text-normal",o.disabled&&"tw-opacity-50")},$D.default.createElement(Di,{className:"tw-size-4"})))}var RI=$(Y());var BD=$(Y());var Ii=$(Y(),1);function iU(t,[e,r]){return Math.min(r,Math.max(e,t))}function di(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var que=$(Y(),1);function aU(t){let e=que.useRef({value:t,previous:t});return que.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var MI=$(Y(),1);var bP=$(Y(),1),D2t=$(St(),1);function N2t(t,e=[]){let r=[];function n(i,a){let s=bP.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,b=bP.useMemo(()=>m,Object.values(m));return(0,D2t.jsx)(h.Provider,{value:b,children:p})}function c(d,f){let p=f?.[t][u]||s,m=bP.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>bP.createContext(a));return function(s){let u=s?.[t]||i;return bP.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,ibn(o,...e)]}function ibn(...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 bP.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Uue=$(St(),1);function zue(t){let e=t+"CollectionProvider",[r,n]=N2t(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=MI.default.useRef(null),g=MI.default.useRef(new Map).current;return(0,Uue.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=MI.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),_=yi(m,g.collectionRef);return(0,Uue.jsx)(Sb,{ref:_,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=MI.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,_=MI.default.useRef(null),w=yi(m,_),x=i(l,h);return MI.default.useEffect(()=>(x.itemMap.set(_,{ref:_,...g}),()=>void x.itemMap.delete(_))),(0,Uue.jsx)(Sb,{[c]:"",ref:w,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return MI.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,C)=>g.indexOf(x.ref.current)-g.indexOf(C.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var Pl=$(St(),1),L2t=["PageUp","PageDown"],F2t=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],k2t={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},sU="Slider",[VDe,abn,sbn]=zue(sU),[$2t,gni]=ii(sU,[sbn]),[ubn,Hue]=$2t(sU),B2t=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:m,...h}=t,b=Ii.useRef(new Set),g=Ii.useRef(0),w=a==="horizontal"?lbn:cbn,[x=[],C]=Cl({prop:c,defaultProp:l,onChange:j=>{[...b.current][g.current]?.focus(),d(j)}}),E=Ii.useRef(x);function P(j){let D=hbn(x,j);R(j,D)}function A(j){R(j,g.current)}function I(){let j=E.current[g.current];x[g.current]!==j&&f(x)}function R(j,D,{commit:k}={commit:!1}){let F=_bn(i),B=vbn(Math.round((j-n)/i)*i+n,F),q=iU(B,[n,o]);C((W=[])=>{let H=pbn(W,q,D);if(bbn(H,u*i)){g.current=H.indexOf(q);let L=String(H)!==String(W);return L&&k&&f(H),L?H:W}else return W})}return(0,Pl.jsx)(ubn,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:b.current,values:x,orientation:a,form:m,children:(0,Pl.jsx)(VDe.Provider,{scope:t.__scopeSlider,children:(0,Pl.jsx)(VDe.Slot,{scope:t.__scopeSlider,children:(0,Pl.jsx)(w,{"aria-disabled":s,"data-disabled":s?"":void 0,...h,ref:e,onPointerDown:di(h.onPointerDown,()=>{s||(E.current=x)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:P,onSlideMove:s?void 0:A,onSlideEnd:s?void 0:I,onHomeKeyDown:()=>!s&&R(n,0,{commit:!0}),onEndKeyDown:()=>!s&&R(o,x.length-1,{commit:!0}),onStepKeyDown:({event:j,direction:D})=>{if(!s){let B=L2t.includes(j.key)||j.shiftKey&&F2t.includes(j.key)?10:1,q=g.current,W=x[q],H=i*B*D;R(W+H,q,{commit:!0})}}})})})})});B2t.displayName=sU;var[q2t,U2t]=$2t(sU,{startEdge:"left",endEdge:"right",size:"width",direction:1}),lbn=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=yi(e,w=>f(w)),m=Ii.useRef(),h=iI(o),b=h==="ltr",g=b&&!i||!b&&i;function _(w){let x=m.current||d.getBoundingClientRect(),C=[0,x.width],P=JDe(C,g?[r,n]:[n,r]);return m.current=x,P(w-x.left)}return(0,Pl.jsx)(q2t,{scope:t.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:(0,Pl.jsx)(z2t,{dir:h,"data-orientation":"horizontal",...c,ref:p,style:{...c.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{let x=_(w.clientX);a?.(x)},onSlideMove:w=>{let x=_(w.clientX);s?.(x)},onSlideEnd:()=>{m.current=void 0,u?.()},onStepKeyDown:w=>{let C=k2t[g?"from-left":"from-right"].includes(w.key);l?.({event:w,direction:C?-1:1})}})})}),cbn=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=yi(e,c),f=Ii.useRef(),p=!o;function m(h){let b=f.current||c.current.getBoundingClientRect(),g=[0,b.height],w=JDe(g,p?[n,r]:[r,n]);return f.current=b,w(h-b.top)}return(0,Pl.jsx)(q2t,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,Pl.jsx)(z2t,{"data-orientation":"vertical",...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{let b=m(h.clientY);i?.(b)},onSlideMove:h=>{let b=m(h.clientY);a?.(b)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:h=>{let g=k2t[p?"from-bottom":"from-top"].includes(h.key);u?.({event:h,direction:g?-1:1})}})})}),z2t=Ii.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=Hue(sU,r);return(0,Pl.jsx)(ao.span,{...l,ref:e,onKeyDown:di(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):L2t.concat(F2t).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:di(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:di(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:di(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),H2t="SliderTrack",V2t=Ii.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=Hue(H2t,r);return(0,Pl.jsx)(ao.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});V2t.displayName=H2t;var WDe="SliderRange",W2t=Ii.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=Hue(WDe,r),i=U2t(WDe,r),a=Ii.useRef(null),s=yi(e,a),u=o.values.length,l=o.values.map(f=>J2t(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,Pl.jsx)(ao.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});W2t.displayName=WDe;var KDe="SliderThumb",K2t=Ii.forwardRef((t,e)=>{let r=abn(t.__scopeSlider),[n,o]=Ii.useState(null),i=yi(e,s=>o(s)),a=Ii.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,Pl.jsx)(dbn,{...t,ref:i,index:a})}),dbn=Ii.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=Hue(KDe,r),s=U2t(KDe,r),[u,l]=Ii.useState(null),c=yi(e,_=>l(_)),d=u?a.form||!!u.closest("form"):!0,f=fg(u),p=a.values[n],m=p===void 0?0:J2t(p,a.min,a.max),h=mbn(n,a.values.length),b=f?.[s.size],g=b?gbn(b,m,s.direction):0;return Ii.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,Pl.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${m}% + ${g}px)`},children:[(0,Pl.jsx)(VDe.ItemSlot,{scope:t.__scopeSlider,children:(0,Pl.jsx)(ao.span,{role:"slider","aria-label":t["aria-label"]||h,"aria-valuemin":a.min,"aria-valuenow":p,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:c,style:p===void 0?{display:"none"}:t.style,onFocus:di(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,Pl.jsx)(fbn,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});K2t.displayName=KDe;var fbn=t=>{let{value:e,...r}=t,n=Ii.useRef(null),o=aU(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,Pl.jsx)("input",{style:{display:"none"},...r,ref:n,defaultValue:e})};function pbn(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function J2t(t,e,r){let i=100/(r-e)*(t-e);return iU(i,[0,100])}function mbn(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function hbn(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 gbn(t,e,r){let n=t/2,i=JDe([0,50],[0,n]);return(n-i(e)*r)*r}function ybn(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function bbn(t,e){if(e>0){let r=ybn(t);return Math.min(...r)>=e}return!0}function JDe(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 _bn(t){return(String(t).split(".")[1]||"").length}function vbn(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var GDe=B2t,G2t=V2t,Y2t=W2t,Z2t=K2t;var YDe=BD.forwardRef(({className:t,...e},r)=>BD.createElement(GDe,{ref:r,className:Ce("tw-relative tw-flex tw-w-full tw-touch-none tw-select-none tw-items-center",t),...e},BD.createElement(G2t,{className:"tw-relative tw-h-1.5 tw-w-full tw-grow tw-overflow-hidden tw-rounded-full tw-border tw-border-solid tw-bg-interactive-accent/20 tw-border-interactive-accent/30"},BD.createElement(Y2t,{className:"tw-absolute tw-h-full tw-bg-interactive-accent"})),BD.createElement(Z2t,{className:"tw-block tw-size-4 tw-rounded-full tw-border tw-bg-toggle-thumb tw-shadow tw-transition-colors focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring disabled:tw-pointer-events-none disabled:tw-opacity-50"})));YDe.displayName=GDe.displayName;function b5({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a}){let[s,u]=(0,RI.useState)(t);return(0,RI.useEffect)(()=>{u(t)},[t]),RI.default.createElement("div",{className:Ce("tw-flex tw-items-center tw-gap-4",a)},RI.default.createElement(YDe,{value:[s],onValueChange:([l])=>u(l),onValueCommit:([l])=>e?.(l),min:r,max:n,step:o,disabled:i,className:"tw-flex-1"}),RI.default.createElement("div",{className:"tw-min-w-[40px] tw-text-right tw-text-sm"},s))}Jt();yn();var uU=require("obsidian"),zt=$(Y()),X2t=$(_c());function Sbn({initialProject:t,onSave:e,onCancel:r}){let n=Pn(),[o,i]=(0,zt.useState)(!1),[a,s]=(0,zt.useState)({name:!1,systemPrompt:!1,projectModelKey:!1,inclusions:!1}),[u,l]=(0,zt.useState)(t||{id:aze(),name:"",description:"",systemPrompt:"",projectModelKey:"",modelConfigs:{temperature:1,maxTokens:1e3},contextSource:{inclusions:"",exclusions:"",webUrls:"",youtubeUrls:""},created:Date.now(),UsageTimestamps:Date.now()}),c=()=>u.name&&u.projectModelKey,d=(p,m)=>{l(h=>{if(typeof m=="string"&&p==="projectModelKey"&&(m=m.trim()),Array.isArray(m)&&m.every(b=>typeof b=="string")&&(m=m.map(b=>b.trim()).filter(Boolean)),p.includes(".")){let[b,g]=p.split("."),w=h[b];if(typeof w=="object"&&w!==null)return{...h,[b]:{...w,[g]:m}}}return{...h,[p]:m}})},f=async()=>{u.name&&(u.name=u.name.trim());let m=["name","projectModelKey"].filter(h=>!u[h]);if(m.length>0){s(h=>({...h,...Object.fromEntries(m.map(b=>[b,!0]))})),new uU.Notice("Please fill in all required fields");return}try{i(!0),await e(u)}catch(h){new uU.Notice(En(h)),s(b=>({...b,name:!0}))}finally{i(!1)}};return zt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-p-4"},zt.default.createElement("div",{className:"tw-mb-2 tw-text-xl tw-font-bold tw-text-normal"},"Add New Project"),zt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},zt.default.createElement(Vo,{label:"Project Name",required:!0,error:a.name&&!u.name,errorMessage:"Project name is required"},zt.default.createElement(io,{type:"text",value:u.name,onChange:p=>d("name",p.target.value),onBlur:()=>s(p=>({...p,name:!0})),className:"tw-w-full"})),zt.default.createElement(Vo,{label:"Description",description:"Briefly describe the purpose and goals of the project"},zt.default.createElement(io,{type:"text",value:u.description,onChange:p=>d("description",p.target.value),className:"tw-w-full"})),zt.default.createElement(Vo,{label:"Project System Prompt",description:"Custom instructions for how the AI should behave in this project context"},zt.default.createElement(Ry,{value:u.systemPrompt,onChange:p=>d("systemPrompt",p.target.value),onBlur:()=>s(p=>({...p,systemPrompt:!0})),className:"tw-min-h-32"})),zt.default.createElement(Vo,{label:"Default Model",required:!0,error:a.projectModelKey&&!u.projectModelKey,errorMessage:"Default model is required"},zt.default.createElement(Bue,{value:u.projectModelKey,onChange:p=>{let m=p.target.value,h=n.activeModels.find(_=>_.enabled&&Dr(_)===m);if(!h)return;let{hasApiKey:b,errorNotice:g}=ZN(h,n);if(!b&&g){new uU.Notice(g);return}d("projectModelKey",m)},onBlur:()=>s(p=>({...p,projectModelKey:!0})),placeholder:"Select a model",options:n.activeModels.filter(p=>p.enabled&&p.projectEnabled).map(p=>({label:M6(p),value:Dr(p)}))})),zt.default.createElement("div",{className:"tw-space-y-4"},zt.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Model Configuration"),zt.default.createElement("div",{className:"tw-grid tw-grid-cols-1 tw-gap-4"},zt.default.createElement(Vo,{label:"Temperature"},zt.default.createElement(b5,{value:u.modelConfigs?.temperature??1,onChange:p=>d("modelConfigs.temperature",p),min:0,max:2,step:.01,className:"tw-w-full"})),zt.default.createElement(Vo,{label:"Token Limit"},zt.default.createElement(b5,{value:u.modelConfigs?.maxTokens??1e3,onChange:p=>d("modelConfigs.maxTokens",p),min:1,max:65e3,step:1,className:"tw-w-full"})))),zt.default.createElement("div",{className:"tw-space-y-4"},zt.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Context Sources"),zt.default.createElement(Vo,{label:zt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},zt.default.createElement("span",null,"Inclusions"),zt.default.createElement(xa,{delayDuration:0},zt.default.createElement(Yt,null,zt.default.createElement(Zt,{asChild:!0},zt.default.createElement(fa,{className:"tw-size-4 tw-text-muted"})),zt.default.createElement(Kt,null,zt.default.createElement("div",{className:"tw-max-w-80"},zt.default.createElement("strong",null,"Supported File Types:"),zt.default.createElement("br",null),zt.default.createElement("strong",null,"\u2022 Documents:")," pdf, doc, docx, ppt, pptx, epub, txt, rtf and many more",zt.default.createElement("br",null),zt.default.createElement("strong",null,"\u2022 Images:")," jpg, png, svg, gif, bmp, webp, tiff",zt.default.createElement("br",null),zt.default.createElement("strong",null,"\u2022 Spreadsheets:")," xlsx, xls, csv, numbers"))))),description:"Define patterns to include specific files or folders in the project context"},zt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},zt.default.createElement("div",{className:"tw-flex-1 tw-text-xs tw-text-muted"},u.contextSource?.inclusions?.trim()?"Patterns configured":"No patterns configured"),zt.default.createElement(he,{variant:"secondary",onClick:()=>new y5(app,p=>{d("contextSource.inclusions",p)},u.contextSource?.inclusions||"","Manage Inclusions").open()},"Manage Patterns"))),zt.default.createElement(Vo,{label:"Exclusions",description:"Exclude specific files or patterns from the included folders above"},zt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},zt.default.createElement("div",{className:"tw-flex-1 tw-text-xs tw-text-muted"},u.contextSource?.exclusions?.trim()?"Patterns configured":"No patterns configured"),zt.default.createElement(he,{variant:"secondary",onClick:()=>new y5(app,p=>{d("contextSource.exclusions",p)},u.contextSource?.exclusions||"","Manage Exclusions").open()},"Manage Patterns"))),zt.default.createElement(Vo,{label:"Web URLs"},zt.default.createElement(Ry,{value:u.contextSource?.webUrls,onChange:p=>{let h=p.target.value.split(`
`).map(b=>{if(!b.trim())return b;try{return new URL(b.trim()),b}catch{return b}});d("contextSource.webUrls",h.join(`
`))},placeholder:"Enter web URLs, one per line",className:"tw-min-h-20 tw-w-full"})),zt.default.createElement(Vo,{label:"YouTube URLs"},zt.default.createElement(Ry,{value:u.contextSource?.youtubeUrls,onChange:p=>{let h=p.target.value.split(`
`).map(b=>{if(!b.trim())return b;try{let g=new URL(b.trim());return g.hostname.includes("youtube.com")||g.hostname.includes("youtu.be"),b}catch{return b}});d("contextSource.youtubeUrls",h.join(`
`))},placeholder:"Enter YouTube URLs, one per line",className:"tw-min-h-20 tw-w-full"})))),zt.default.createElement("div",{className:"tw-mt-4 tw-flex tw-items-center tw-justify-end tw-gap-2"},zt.default.createElement(he,{variant:"ghost",onClick:r,disabled:o},"Cancel"),zt.default.createElement(he,{onClick:f,disabled:o||!c()},o?"Saving...":"Save")))}var _5=class extends uU.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r}=this;this.root=(0,X2t.createRoot)(r);let n=async i=>{await this.onSave(i),this.close()},o=()=>{this.close()};this.root.render(zt.default.createElement(Sbn,{initialProject:this.initialProject,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};var xi=$(Y());var at=$(Y(),1),yNe=$(Ms(),1);var Ja=$(Y(),1);var XDe=$(St(),1),xbn="DismissableLayer",ZDe="dismissableLayer.update",Cbn="dismissableLayer.pointerDownOutside",Obn="dismissableLayer.focusOutside",Q2t,t4t=Ja.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),QDe=Ja.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ja.useContext(t4t),[c,d]=Ja.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ja.useState({}),m=yi(e,P=>d(P)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,C=Tbn(P=>{let A=P.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=Abn(P=>{let A=P.target;[...l.branches].some(R=>R.contains(A))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return ox(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Ja.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Q2t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),e4t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Q2t)}},[c,f,r,l]),Ja.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),e4t())},[c,l]),Ja.useEffect(()=>{let P=()=>p({});return document.addEventListener(ZDe,P),()=>document.removeEventListener(ZDe,P)},[]),(0,XDe.jsx)(ao.div,{...u,ref:m,style:{pointerEvents:w?x?"auto":"none":void 0,...t.style},onFocusCapture:di(t.onFocusCapture,E.onFocusCapture),onBlurCapture:di(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:di(t.onPointerDownCapture,C.onPointerDownCapture)})});QDe.displayName=xbn;var Pbn="DismissableLayerBranch",Ebn=Ja.forwardRef((t,e)=>{let r=Ja.useContext(t4t),n=Ja.useRef(null),o=yi(e,n);return Ja.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,XDe.jsx)(ao.div,{...t,ref:o})});Ebn.displayName=Pbn;function Tbn(t,e=globalThis?.document){let r=hr(t),n=Ja.useRef(!1),o=Ja.useRef(()=>{});return Ja.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){r4t(Cbn,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 Abn(t,e=globalThis?.document){let r=hr(t),n=Ja.useRef(!1);return Ja.useEffect(()=>{let o=i=>{i.target&&!n.current&&r4t(Obn,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 e4t(){let t=new CustomEvent(ZDe);document.dispatchEvent(t)}function r4t(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?I2t(o,i):o.dispatchEvent(i)}var _g=$(Y(),1);var s4t=$(St(),1),eNe="focusScope.autoFocusOnMount",tNe="focusScope.autoFocusOnUnmount",n4t={bubbles:!1,cancelable:!0},Ibn="FocusScope",rNe=_g.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=_g.useState(null),l=hr(o),c=hr(i),d=_g.useRef(null),f=yi(e,h=>u(h)),p=_g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_g.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:jI(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||jI(d.current,{select:!0}))},x=function(E){if(document.activeElement===document.body)for(let A of E)A.removedNodes.length>0&&jI(s)};var h=_,b=w,g=x;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(x);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),_g.useEffect(()=>{if(s){i4t.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(eNe,n4t);s.addEventListener(eNe,l),s.dispatchEvent(g),g.defaultPrevented||(Mbn(Lbn(u4t(s)),{select:!0}),document.activeElement===h&&jI(s))}return()=>{s.removeEventListener(eNe,l),setTimeout(()=>{let g=new CustomEvent(tNe,n4t);s.addEventListener(tNe,c),s.dispatchEvent(g),g.defaultPrevented||jI(h??document.body,{select:!0}),s.removeEventListener(tNe,c),i4t.remove(p)},0)}}},[s,l,c,p]);let m=_g.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let _=h.currentTarget,[w,x]=Rbn(_);w&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&jI(w,{select:!0})):h.shiftKey&&g===w&&(h.preventDefault(),r&&jI(x,{select:!0})):g===_&&h.preventDefault()}},[r,n,p.paused]);return(0,s4t.jsx)(ao.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});rNe.displayName=Ibn;function Mbn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(jI(n,{select:e}),document.activeElement!==r)return}function Rbn(t){let e=u4t(t),r=o4t(e,t),n=o4t(e.reverse(),t);return[r,n]}function u4t(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 o4t(t,e){for(let r of t)if(!jbn(r,{upTo:e}))return r}function jbn(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 Dbn(t){return t instanceof HTMLInputElement&&"select"in t}function jI(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Dbn(t)&&e&&t.select()}}var i4t=Nbn();function Nbn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=a4t(t,e),t.unshift(e)},remove(e){t=a4t(t,e),t[0]?.resume()}}}function a4t(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function Lbn(t){return t.filter(e=>e.tagName!=="A")}var Bm=$(Y(),1);var l4t=$(Y(),1);var nNe=$(St(),1),Fbn="Arrow",c4t=l4t.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,nNe.jsx)(ao.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,nNe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});c4t.displayName=Fbn;var d4t=c4t;var _P=$(Y(),1),f4t=$(St(),1);function p4t(t,e=[]){let r=[];function n(i,a){let s=_P.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,b=_P.useMemo(()=>m,Object.values(m));return(0,f4t.jsx)(h.Provider,{value:b,children:p})}function c(d,f){let p=f?.[t][u]||s,m=_P.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>_P.createContext(a));return function(s){let u=s?.[t]||i;return _P.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,$bn(o,...e)]}function $bn(...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 _P.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var DI=$(St(),1);var oNe="Popper",[m4t,iNe]=p4t(oNe),[Bbn,h4t]=m4t(oNe),g4t=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Bm.useState(null);return(0,DI.jsx)(Bbn,{scope:e,anchor:n,onAnchorChange:o,children:r})};g4t.displayName=oNe;var y4t="PopperAnchor",b4t=Bm.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=h4t(y4t,r),a=Bm.useRef(null),s=yi(e,a);return Bm.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,DI.jsx)(ao.div,{...o,ref:s})});b4t.displayName=y4t;var aNe="PopperContent",[qbn,Ubn]=m4t(aNe),_4t=Bm.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,b=h4t(aNe,r),[g,_]=Bm.useState(null),w=yi(e,ie=>_(ie)),[x,C]=Bm.useState(null),E=fg(x),P=E?.width??0,A=E?.height??0,I=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},j=Array.isArray(l)?l:[l],D=j.length>0,k={padding:R,boundary:j.filter(Hbn),altBoundary:D},{refs:F,floatingStyles:B,placement:q,isPositioned:W,middlewareData:H}=uI({strategy:"fixed",placement:I,whileElementsMounted:(...ie)=>cP(...ie,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[lI({mainAxis:o+A,alignmentAxis:a}),u&&cI({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?dI():void 0,...k}),u&&fI({...k}),pI({...k,apply:({elements:ie,rects:Ie,availableWidth:st,availableHeight:Te})=>{let{width:Qe,height:nt}=Ie.reference,Ht=ie.floating.style;Ht.setProperty("--radix-popper-available-width",`${st}px`),Ht.setProperty("--radix-popper-available-height",`${Te}px`),Ht.setProperty("--radix-popper-anchor-width",`${Qe}px`),Ht.setProperty("--radix-popper-anchor-height",`${nt}px`)}}),x&&hI({element:x,padding:s}),Vbn({arrowWidth:P,arrowHeight:A}),f&&mI({strategy:"referenceHidden",...k})]}),[L,z]=S4t(q),K=hr(m);dn(()=>{W&&K?.()},[W,K]);let J=H.arrow?.x,ee=H.arrow?.y,Pe=H.arrow?.centerOffset!==0,[G,Z]=Bm.useState();return dn(()=>{g&&Z(window.getComputedStyle(g).zIndex)},[g]),(0,DI.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:W?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,DI.jsx)(qbn,{scope:r,placedSide:L,onArrowChange:C,arrowX:J,arrowY:ee,shouldHideArrow:Pe,children:(0,DI.jsx)(ao.div,{"data-side":L,"data-align":z,...h,ref:w,style:{...h.style,animation:W?void 0:"none"}})})})});_4t.displayName=aNe;var v4t="PopperArrow",zbn={top:"bottom",right:"left",bottom:"top",left:"right"},w4t=Bm.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=Ubn(v4t,n),a=zbn[i.placedSide];return(0,DI.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,DI.jsx)(d4t,{...o,ref:r,style:{...o.style,display:"block"}})})});w4t.displayName=v4t;function Hbn(t){return t!==null}var Vbn=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]=S4t(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function S4t(t){let[e,r="center"]=t.split("-");return[e,r]}var x4t=g4t,C4t=b4t,O4t=_4t,P4t=w4t;var Vue=$(Y(),1),E4t=$(Ms(),1);var T4t=$(St(),1),Kbn="Portal",sNe=Vue.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Vue.useState(!1);dn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?E4t.default.createPortal((0,T4t.jsx)(ao.div,{...n,ref:e}),a):null});sNe.displayName=Kbn;var A4t=$(Y(),1);var I4t=$(St(),1),Jbn="VisuallyHidden",uNe=A4t.forwardRef((t,e)=>(0,I4t.jsx)(ao.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}}));uNe.displayName=Jbn;var Jue=$(Y());var Vd=$(Y());var Wue=AD();var lNe=function(){},v5=Vd.forwardRef(function(t,e){var r=Vd.useRef(null),n=Vd.useState({onScrollCapture:lNe,onWheelCapture:lNe,onTouchMoveCapture:lNe}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,b=t.as,g=b===void 0?"div":b,_=t.gapMode,w=vI(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,C=TD([r,e]),E=ai(ai({},w),o);return Vd.createElement(Vd.Fragment,null,c&&Vd.createElement(x,{sideCar:Wue,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:_}),a?Vd.cloneElement(Vd.Children.only(s),ai(ai({},E),{ref:C})):Vd.createElement(g,ai({},E,{className:u,ref:C}),s))});v5.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};v5.classNames={fullWidth:$y,zeroRight:ky};var ia=$(Y());var cNe=!1;if(typeof window<"u")try{w5=Object.defineProperty({},"passive",{get:function(){return cNe=!0,!0}}),window.addEventListener("test",w5,w5),window.removeEventListener("test",w5,w5)}catch{cNe=!1}var w5,qD=cNe?{passive:!1}:!1;var Gbn=function(t){return t.tagName==="TEXTAREA"},M4t=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!Gbn(t)&&r[e]==="visible")},Ybn=function(t){return M4t(t,"overflowY")},Zbn=function(t){return M4t(t,"overflowX")},dNe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=R4t(t,n);if(o){var i=j4t(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Xbn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},Qbn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},R4t=function(t,e){return t==="v"?Ybn(e):Zbn(e)},j4t=function(t,e){return t==="v"?Xbn(e):Qbn(e)},e_n=function(t,e){return t==="h"&&e==="rtl"?-1:1},D4t=function(t,e,r,n,o){var i=e_n(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=j4t(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&R4t(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var Kue=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},N4t=function(t){return[t.deltaX,t.deltaY]},L4t=function(t){return t&&"current"in t?t.current:t},t_n=function(t,e){return t[0]===e[0]&&t[1]===e[1]},r_n=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},n_n=0,lU=[];function F4t(t){var e=ia.useRef([]),r=ia.useRef([0,0]),n=ia.useRef(),o=ia.useState(n_n++)[0],i=ia.useState(dP)[0],a=ia.useRef(t);ia.useEffect(function(){a.current=t},[t]),ia.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=Fq([t.lockRef.current],(t.shards||[]).map(L4t),!0).filter(Boolean);return h.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=ia.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=Kue(h),_=r.current,w="deltaX"in h?h.deltaX:_[0]-g[0],x="deltaY"in h?h.deltaY:_[1]-g[1],C,E=h.target,P=Math.abs(w)>Math.abs(x)?"h":"v";if("touches"in h&&P==="h"&&E.type==="range")return!1;var A=dNe(P,E);if(!A)return!0;if(A?C=P:(C=P==="v"?"h":"v",A=dNe(P,E)),!A)return!1;if(!n.current&&"changedTouches"in h&&(w||x)&&(n.current=C),!C)return!0;var I=n.current||C;return D4t(I,b,h,I==="h"?w:x,!0)},[]),u=ia.useCallback(function(h){var b=h;if(!(!lU.length||lU[lU.length-1]!==i)){var g="deltaY"in b?N4t(b):Kue(b),_=e.current.filter(function(C){return C.name===b.type&&(C.target===b.target||b.target===C.shadowParent)&&t_n(C.delta,g)})[0];if(_&&_.should){b.cancelable&&b.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(L4t).filter(Boolean).filter(function(C){return C.contains(b.target)}),x=w.length>0?s(b,w[0]):!a.current.noIsolation;x&&b.cancelable&&b.preventDefault()}}},[]),l=ia.useCallback(function(h,b,g,_){var w={name:h,delta:b,target:g,should:_,shadowParent:o_n(g)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(x){return x!==w})},1)},[]),c=ia.useCallback(function(h){r.current=Kue(h),n.current=void 0},[]),d=ia.useCallback(function(h){l(h.type,N4t(h),h.target,s(h,t.lockRef.current))},[]),f=ia.useCallback(function(h){l(h.type,Kue(h),h.target,s(h,t.lockRef.current))},[]);ia.useEffect(function(){return lU.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,qD),document.addEventListener("touchmove",u,qD),document.addEventListener("touchstart",c,qD),function(){lU=lU.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,qD),document.removeEventListener("touchmove",u,qD),document.removeEventListener("touchstart",c,qD)}},[]);var p=t.removeScrollBar,m=t.inert;return ia.createElement(ia.Fragment,null,m?ia.createElement(i,{styles:r_n(o)}):null,p?ia.createElement(MD,{gapMode:t.gapMode}):null)}function o_n(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var k4t=ID(Wue,F4t);var $4t=Jue.forwardRef(function(t,e){return Jue.createElement(v5,ai({},t,{ref:e,sideCar:k4t}))});$4t.classNames=v5.classNames;var S5=$4t;var rr=$(St(),1),i_n=[" ","Enter","ArrowUp","ArrowDown"],a_n=[" ","Enter"],C5="Select",[Yue,Zue,s_n]=zue(C5),[cU,Qoi]=ii(C5,[s_n,iNe]),Xue=iNe(),[u_n,NI]=cU(C5),[l_n,c_n]=cU(C5),B4t=t=>{let{__scopeSelect:e,children:r,open:n,defaultOpen:o,onOpenChange:i,value:a,defaultValue:s,onValueChange:u,dir:l,name:c,autoComplete:d,disabled:f,required:p,form:m}=t,h=Xue(e),[b,g]=at.useState(null),[_,w]=at.useState(null),[x,C]=at.useState(!1),E=iI(l),[P=!1,A]=Cl({prop:n,defaultProp:o,onChange:i}),[I,R]=Cl({prop:a,defaultProp:s,onChange:u}),j=at.useRef(null),D=b?m||!!b.closest("form"):!0,[k,F]=at.useState(new Set),B=Array.from(k).map(q=>q.props.value).join(";");return(0,rr.jsx)(x4t,{...h,children:(0,rr.jsxs)(u_n,{required:p,scope:e,trigger:b,onTriggerChange:g,valueNode:_,onValueNodeChange:w,valueNodeHasChildren:x,onValueNodeHasChildrenChange:C,contentId:us(),value:I,onValueChange:R,open:P,onOpenChange:A,dir:E,triggerPointerDownPosRef:j,disabled:f,children:[(0,rr.jsx)(Yue.Provider,{scope:e,children:(0,rr.jsx)(l_n,{scope:t.__scopeSelect,onNativeOptionAdd:at.useCallback(q=>{F(W=>new Set(W).add(q))},[]),onNativeOptionRemove:at.useCallback(q=>{F(W=>{let H=new Set(W);return H.delete(q),H})},[]),children:r})}),D?(0,rr.jsxs)(d3t,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:I,onChange:q=>R(q.target.value),disabled:f,form:m,children:[I===void 0?(0,rr.jsx)("option",{value:""}):null,Array.from(k)]},B):null]})})};B4t.displayName=C5;var q4t="SelectTrigger",U4t=at.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=Xue(r),a=NI(q4t,r),s=a.disabled||n,u=yi(e,a.onTriggerChange),l=Zue(r),c=at.useRef("touch"),[d,f,p]=f3t(h=>{let b=l().filter(w=>!w.disabled),g=b.find(w=>w.value===a.value),_=p3t(b,h,g);_!==void 0&&a.onValueChange(_.value)}),m=h=>{s||(a.onOpenChange(!0),p()),h&&(a.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return(0,rr.jsx)(C4t,{asChild:!0,...i,children:(0,rr.jsx)(ao.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":c3t(a.value)?"":void 0,...o,ref:u,onClick:di(o.onClick,h=>{h.currentTarget.focus(),c.current!=="mouse"&&m(h)}),onPointerDown:di(o.onPointerDown,h=>{c.current=h.pointerType;let b=h.target;b.hasPointerCapture(h.pointerId)&&b.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(m(h),h.preventDefault())}),onKeyDown:di(o.onKeyDown,h=>{let b=d.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(b&&h.key===" ")&&i_n.includes(h.key)&&(m(),h.preventDefault())})})})});U4t.displayName=q4t;var z4t="SelectValue",H4t=at.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=NI(z4t,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=yi(e,u.onValueNodeChange);return dn(()=>{l(c)},[l,c]),(0,rr.jsx)(ao.span,{...s,ref:d,style:{pointerEvents:"none"},children:c3t(u.value)?(0,rr.jsx)(rr.Fragment,{children:a}):i})});H4t.displayName=z4t;var d_n="SelectIcon",V4t=at.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,rr.jsx)(ao.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});V4t.displayName=d_n;var f_n="SelectPortal",W4t=t=>(0,rr.jsx)(sNe,{asChild:!0,...t});W4t.displayName=f_n;var UD="SelectContent",K4t=at.forwardRef((t,e)=>{let r=NI(UD,t.__scopeSelect),[n,o]=at.useState();if(dn(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?yNe.createPortal((0,rr.jsx)(J4t,{scope:t.__scopeSelect,children:(0,rr.jsx)(Yue.Slot,{scope:t.__scopeSelect,children:(0,rr.jsx)("div",{children:t.children})})}),i):null}return(0,rr.jsx)(G4t,{...t,ref:e})});K4t.displayName=UD;var Wy=10,[J4t,LI]=cU(UD),p_n="SelectContentImpl",G4t=at.forwardRef((t,e)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:b,...g}=t,_=NI(UD,r),[w,x]=at.useState(null),[C,E]=at.useState(null),P=yi(e,ie=>x(ie)),[A,I]=at.useState(null),[R,j]=at.useState(null),D=Zue(r),[k,F]=at.useState(!1),B=at.useRef(!1);at.useEffect(()=>{if(w)return _I(w)},[w]),aI();let q=at.useCallback(ie=>{let[Ie,...st]=D().map(nt=>nt.ref.current),[Te]=st.slice(-1),Qe=document.activeElement;for(let nt of ie)if(nt===Qe||(nt?.scrollIntoView({block:"nearest"}),nt===Ie&&C&&(C.scrollTop=0),nt===Te&&C&&(C.scrollTop=C.scrollHeight),nt?.focus(),document.activeElement!==Qe))return},[D,C]),W=at.useCallback(()=>q([A,w]),[q,A,w]);at.useEffect(()=>{k&&W()},[k,W]);let{onOpenChange:H,triggerPointerDownPosRef:L}=_;at.useEffect(()=>{if(w){let ie={x:0,y:0},Ie=Te=>{ie={x:Math.abs(Math.round(Te.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(Te.pageY)-(L.current?.y??0))}},st=Te=>{ie.x<=10&&ie.y<=10?Te.preventDefault():w.contains(Te.target)||H(!1),document.removeEventListener("pointermove",Ie),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",Ie),document.addEventListener("pointerup",st,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ie),document.removeEventListener("pointerup",st,{capture:!0})}}},[w,H,L]),at.useEffect(()=>{let ie=()=>H(!1);return window.addEventListener("blur",ie),window.addEventListener("resize",ie),()=>{window.removeEventListener("blur",ie),window.removeEventListener("resize",ie)}},[H]);let[z,K]=f3t(ie=>{let Ie=D().filter(Qe=>!Qe.disabled),st=Ie.find(Qe=>Qe.ref.current===document.activeElement),Te=p3t(Ie,ie,st);Te&&setTimeout(()=>Te.ref.current.focus())}),J=at.useCallback((ie,Ie,st)=>{let Te=!B.current&&!st;(_.value!==void 0&&_.value===Ie||Te)&&(I(ie),Te&&(B.current=!0))},[_.value]),ee=at.useCallback(()=>w?.focus(),[w]),Pe=at.useCallback((ie,Ie,st)=>{let Te=!B.current&&!st;(_.value!==void 0&&_.value===Ie||Te)&&j(ie)},[_.value]),G=n==="popper"?fNe:Y4t,Z=G===fNe?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:b}:{};return(0,rr.jsx)(J4t,{scope:r,content:w,viewport:C,onViewportChange:E,itemRefCallback:J,selectedItem:A,onItemLeave:ee,itemTextRefCallback:Pe,focusSelectedItem:W,selectedItemText:R,position:n,isPositioned:k,searchRef:z,children:(0,rr.jsx)(S5,{as:Sb,allowPinchZoom:!0,children:(0,rr.jsx)(rNe,{asChild:!0,trapped:_.open,onMountAutoFocus:ie=>{ie.preventDefault()},onUnmountAutoFocus:di(o,ie=>{_.trigger?.focus({preventScroll:!0}),ie.preventDefault()}),children:(0,rr.jsx)(QDe,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:ie=>ie.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:(0,rr.jsx)(G,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:ie=>ie.preventDefault(),...g,...Z,onPlaced:()=>F(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:di(g.onKeyDown,ie=>{let Ie=ie.ctrlKey||ie.altKey||ie.metaKey;if(ie.key==="Tab"&&ie.preventDefault(),!Ie&&ie.key.length===1&&K(ie.key),["ArrowUp","ArrowDown","Home","End"].includes(ie.key)){let Te=D().filter(Qe=>!Qe.disabled).map(Qe=>Qe.ref.current);if(["ArrowUp","End"].includes(ie.key)&&(Te=Te.slice().reverse()),["ArrowUp","ArrowDown"].includes(ie.key)){let Qe=ie.target,nt=Te.indexOf(Qe);Te=Te.slice(nt+1)}setTimeout(()=>q(Te)),ie.preventDefault()}})})})})})})});G4t.displayName=p_n;var m_n="SelectItemAlignedPosition",Y4t=at.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=NI(UD,r),a=LI(UD,r),[s,u]=at.useState(null),[l,c]=at.useState(null),d=yi(e,P=>c(P)),f=Zue(r),p=at.useRef(!1),m=at.useRef(!0),{viewport:h,selectedItem:b,selectedItemText:g,focusSelectedItem:_}=a,w=at.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&h&&b&&g){let P=i.trigger.getBoundingClientRect(),A=l.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),R=g.getBoundingClientRect();if(i.dir!=="rtl"){let Qe=R.left-A.left,nt=I.left-Qe,Ht=P.left-nt,Me=P.width+Ht,ht=Math.max(Me,A.width),Xt=window.innerWidth-Wy,nr=iU(nt,[Wy,Math.max(Wy,Xt-ht)]);s.style.minWidth=Me+"px",s.style.left=nr+"px"}else{let Qe=A.right-R.right,nt=window.innerWidth-I.right-Qe,Ht=window.innerWidth-P.right-nt,Me=P.width+Ht,ht=Math.max(Me,A.width),Xt=window.innerWidth-Wy,nr=iU(nt,[Wy,Math.max(Wy,Xt-ht)]);s.style.minWidth=Me+"px",s.style.right=nr+"px"}let j=f(),D=window.innerHeight-Wy*2,k=h.scrollHeight,F=window.getComputedStyle(l),B=parseInt(F.borderTopWidth,10),q=parseInt(F.paddingTop,10),W=parseInt(F.borderBottomWidth,10),H=parseInt(F.paddingBottom,10),L=B+q+k+H+W,z=Math.min(b.offsetHeight*5,L),K=window.getComputedStyle(h),J=parseInt(K.paddingTop,10),ee=parseInt(K.paddingBottom,10),Pe=P.top+P.height/2-Wy,G=D-Pe,Z=b.offsetHeight/2,ie=b.offsetTop+Z,Ie=B+q+ie,st=L-Ie;if(Ie<=Pe){let Qe=j.length>0&&b===j[j.length-1].ref.current;s.style.bottom="0px";let nt=l.clientHeight-h.offsetTop-h.offsetHeight,Ht=Math.max(G,Z+(Qe?ee:0)+nt+W),Me=Ie+Ht;s.style.height=Me+"px"}else{let Qe=j.length>0&&b===j[0].ref.current;s.style.top="0px";let Ht=Math.max(Pe,B+h.offsetTop+(Qe?J:0)+Z)+st;s.style.height=Ht+"px",h.scrollTop=Ie-Pe+h.offsetTop}s.style.margin=`${Wy}px 0`,s.style.minHeight=z+"px",s.style.maxHeight=D+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,h,b,g,i.dir,n]);dn(()=>w(),[w]);let[x,C]=at.useState();dn(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]);let E=at.useCallback(P=>{P&&m.current===!0&&(w(),_?.(),m.current=!1)},[w,_]);return(0,rr.jsx)(g_n,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:E,children:(0,rr.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:(0,rr.jsx)(ao.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Y4t.displayName=m_n;var h_n="SelectPopperPosition",fNe=at.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=Wy,...i}=t,a=Xue(r);return(0,rr.jsx)(O4t,{...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)"}})});fNe.displayName=h_n;var[g_n,bNe]=cU(UD,{}),pNe="SelectViewport",Z4t=at.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=LI(pNe,r),a=bNe(pNe,r),s=yi(e,i.onViewportChange),u=at.useRef(0);return(0,rr.jsxs)(rr.Fragment,{children:[(0,rr.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,rr.jsx)(Yue.Slot,{scope:r,children:(0,rr.jsx)(ao.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:di(o.onScroll,l=>{let c=l.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=a;if(f?.current&&d){let p=Math.abs(u.current-c.scrollTop);if(p>0){let m=window.innerHeight-Wy*2,h=parseFloat(d.style.minHeight),b=parseFloat(d.style.height),g=Math.max(h,b);if(g<m){let _=g+p,w=Math.min(m,_),x=_-w;d.style.height=w+"px",d.style.bottom==="0px"&&(c.scrollTop=x>0?x:0,d.style.justifyContent="flex-end")}}}u.current=c.scrollTop})})})]})});Z4t.displayName=pNe;var X4t="SelectGroup",[y_n,b_n]=cU(X4t),__n=at.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=us();return(0,rr.jsx)(y_n,{scope:r,id:o,children:(0,rr.jsx)(ao.div,{role:"group","aria-labelledby":o,...n,ref:e})})});__n.displayName=X4t;var Q4t="SelectLabel",e3t=at.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=b_n(Q4t,r);return(0,rr.jsx)(ao.div,{id:o.id,...n,ref:e})});e3t.displayName=Q4t;var Gue="SelectItem",[v_n,t3t]=cU(Gue),r3t=at.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=NI(Gue,r),u=LI(Gue,r),l=s.value===n,[c,d]=at.useState(i??""),[f,p]=at.useState(!1),m=yi(e,_=>u.itemRefCallback?.(_,n,o)),h=us(),b=at.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,rr.jsx)(v_n,{scope:r,value:n,disabled:o,textId:h,isSelected:l,onItemTextChange:at.useCallback(_=>{d(w=>w||(_?.textContent??"").trim())},[]),children:(0,rr.jsx)(Yue.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,rr.jsx)(ao.div,{role:"option","aria-labelledby":h,"data-highlighted":f?"":void 0,"aria-selected":l&&f,"data-state":l?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:m,onFocus:di(a.onFocus,()=>p(!0)),onBlur:di(a.onBlur,()=>p(!1)),onClick:di(a.onClick,()=>{b.current!=="mouse"&&g()}),onPointerUp:di(a.onPointerUp,()=>{b.current==="mouse"&&g()}),onPointerDown:di(a.onPointerDown,_=>{b.current=_.pointerType}),onPointerMove:di(a.onPointerMove,_=>{b.current=_.pointerType,o?u.onItemLeave?.():b.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:di(a.onPointerLeave,_=>{_.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:di(a.onKeyDown,_=>{u.searchRef?.current!==""&&_.key===" "||(a_n.includes(_.key)&&g(),_.key===" "&&_.preventDefault())})})})})});r3t.displayName=Gue;var x5="SelectItemText",n3t=at.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=NI(x5,r),s=LI(x5,r),u=t3t(x5,r),l=c_n(x5,r),[c,d]=at.useState(null),f=yi(e,g=>d(g),u.onItemTextChange,g=>s.itemTextRefCallback?.(g,u.value,u.disabled)),p=c?.textContent,m=at.useMemo(()=>(0,rr.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:b}=l;return dn(()=>(h(m),()=>b(m)),[h,b,m]),(0,rr.jsxs)(rr.Fragment,{children:[(0,rr.jsx)(ao.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?yNe.createPortal(i.children,a.valueNode):null]})});n3t.displayName=x5;var o3t="SelectItemIndicator",i3t=at.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return t3t(o3t,r).isSelected?(0,rr.jsx)(ao.span,{"aria-hidden":!0,...n,ref:e}):null});i3t.displayName=o3t;var mNe="SelectScrollUpButton",a3t=at.forwardRef((t,e)=>{let r=LI(mNe,t.__scopeSelect),n=bNe(mNe,t.__scopeSelect),[o,i]=at.useState(!1),a=yi(e,n.onScrollButtonChange);return dn(()=>{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,rr.jsx)(u3t,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});a3t.displayName=mNe;var hNe="SelectScrollDownButton",s3t=at.forwardRef((t,e)=>{let r=LI(hNe,t.__scopeSelect),n=bNe(hNe,t.__scopeSelect),[o,i]=at.useState(!1),a=yi(e,n.onScrollButtonChange);return dn(()=>{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,rr.jsx)(u3t,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});s3t.displayName=hNe;var u3t=at.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=LI("SelectScrollButton",r),a=at.useRef(null),s=Zue(r),u=at.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return at.useEffect(()=>()=>u(),[u]),dn(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,rr.jsx)(ao.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:di(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:di(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:di(o.onPointerLeave,()=>{u()})})}),w_n="SelectSeparator",l3t=at.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,rr.jsx)(ao.div,{"aria-hidden":!0,...n,ref:e})});l3t.displayName=w_n;var gNe="SelectArrow",S_n=at.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=Xue(r),i=NI(gNe,r),a=LI(gNe,r);return i.open&&a.position==="popper"?(0,rr.jsx)(P4t,{...o,...n,ref:e}):null});S_n.displayName=gNe;function c3t(t){return t===""||t===void 0}var d3t=at.forwardRef((t,e)=>{let{value:r,...n}=t,o=at.useRef(null),i=yi(e,o),a=aU(r);return at.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,rr.jsx)(uNe,{asChild:!0,children:(0,rr.jsx)("select",{...n,ref:i,defaultValue:r})})});d3t.displayName="BubbleSelect";function f3t(t){let e=hr(t),r=at.useRef(""),n=at.useRef(0),o=at.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=at.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return at.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function p3t(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=x_n(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 x_n(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var m3t=B4t,_Ne=U4t,h3t=H4t,g3t=V4t,y3t=W4t,vNe=K4t,b3t=Z4t;var wNe=e3t,SNe=r3t,_3t=n3t,v3t=i3t,xNe=a3t,CNe=s3t,ONe=l3t;var dU=m3t;var fU=h3t,zD=xi.forwardRef(({className:t,children:e,...r},n)=>xi.createElement(_Ne,{ref:n,className:Ce("tw-border-solid !tw-bg-dropdown !tw-shadow-sm tw-transition-colors","focus-visible:tw-shadow-sm focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring","hover:data-[state=closed]:!tw-bg-interactive-accent hover:data-[state=closed]:!tw-text-on-accent","tw-flex tw-h-9 tw-w-full tw-items-center tw-justify-between tw-whitespace-nowrap tw-rounded-md tw-border tw-border-border tw-px-3 tw-py-1 tw-text-sm tw-ring-offset-ring placeholder:tw-text-muted focus:tw-outline-none focus:tw-ring-1 focus:tw-ring-ring disabled:tw-cursor-not-allowed disabled:tw-opacity-50 [&>span]:tw-line-clamp-1",t),...r},e,xi.createElement(g3t,{asChild:!0},xi.createElement(Di,{className:"tw-size-4"}))));zD.displayName=_Ne.displayName;var w3t=xi.forwardRef(({className:t,...e},r)=>xi.createElement(xNe,{ref:r,className:Ce("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},xi.createElement(qg,{className:"tw-size-4"})));w3t.displayName=xNe.displayName;var S3t=xi.forwardRef(({className:t,...e},r)=>xi.createElement(CNe,{ref:r,className:Ce("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},xi.createElement(Di,{className:"tw-size-4"})));S3t.displayName=CNe.displayName;var HD=xi.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>xi.createElement(y3t,{container:n},xi.createElement(vNe,{ref:i,className:Ce("tw-relative tw-z-modal tw-max-h-96 tw-min-w-32 tw-overflow-hidden tw-rounded-md tw-border tw-bg-primary tw-text-normal tw-shadow-md data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:tw-translate-y-1 data-[side=left]:-tw-translate-x-1 data-[side=right]:tw-translate-x-1 data-[side=top]:-tw-translate-y-1",t),position:r,...o},xi.createElement(w3t,null),xi.createElement(b3t,{className:Ce("tw-p-1",r==="popper"&&"tw-h-[var(--radix-select-trigger-height)] tw-w-full tw-min-w-[var(--radix-select-trigger-width)]")},e),xi.createElement(S3t,null))));HD.displayName=vNe.displayName;var O_n=xi.forwardRef(({className:t,...e},r)=>xi.createElement(wNe,{ref:r,className:Ce("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",t),...e}));O_n.displayName=wNe.displayName;var VD=xi.forwardRef(({className:t,children:e,...r},n)=>xi.createElement(SNe,{ref:n,className:Ce("tw-relative tw-flex tw-w-full tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-py-1.5 tw-pl-2 tw-pr-8 tw-text-sm tw-outline-none focus:tw-bg-interactive-accent focus:tw-text-on-accent data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t),...r},xi.createElement("span",{className:"tw-absolute tw-right-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},xi.createElement(v3t,null,xi.createElement(Nl,{className:"tw-size-4"}))),xi.createElement(_3t,null,e)));VD.displayName=SNe.displayName;var P_n=xi.forwardRef(({className:t,...e},r)=>xi.createElement(ONe,{ref:r,className:Ce("-tw-mx-1 tw-my-1 tw-h-px tw-bg-primary-alt",t),...e}));P_n.displayName=ONe.displayName;mo();Jt();var C3t=require("obsidian"),Ae=$(Y());function E_n(t,e,r={}){let{caseSensitive:n=!1,searchInName:o=!0,searchInDescription:i=!0}=r;if(!e.trim())return!0;let a=n?e:e.toLowerCase();return!!(o&&(n?t.name:t.name.toLowerCase()).includes(a)||i&&t.description&&(n?t.description:t.description.toLowerCase()).includes(a))}function x3t(t,e,r={}){return!t||t.length===0?[]:e.trim()?t.filter(n=>E_n(n,e,r)):t}function T_n({project:t,loadContext:e,onEdit:r,onDelete:n}){return Ae.default.createElement("div",{className:"tw-group tw-flex tw-cursor-pointer tw-items-center tw-justify-between tw-gap-2 tw-rounded-lg tw-border tw-border-solid tw-border-border tw-p-3 tw-transition-all tw-duration-200 tw-bg-secondary/40 hover:tw-border-interactive-accent hover:tw-text-accent hover:tw-shadow-[0_2px_12px_rgba(0,0,0,0.1)] active:tw-scale-[0.98]",onClick:()=>e(t)},Ae.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2 tw-overflow-hidden"},Ae.default.createElement("div",{className:"tw-text-accent"},Ae.default.createElement(zg,{className:"tw-size-4"})),Ae.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-col tw-gap-1.5 tw-overflow-hidden"},Ae.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[13px] tw-font-medium tw-text-normal"},t.name),t.description&&Ae.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[12px] tw-text-muted/80"},t.description))),Ae.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-1 tw-opacity-100 tw-transition-opacity tw-duration-200"},Ae.default.createElement(Yt,null,Ae.default.createElement(Zt,{asChild:!0},Ae.default.createElement(he,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),r(t)}},Ae.default.createElement(uC,{className:"tw-size-4"}))),Ae.default.createElement(Kt,{side:"bottom"},"Edit Project")),Ae.default.createElement(Yt,null,Ae.default.createElement(Zt,{asChild:!0},Ae.default.createElement(he,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),e(t)}},Ae.default.createElement(BL,{className:"tw-size-4"}))),Ae.default.createElement(Kt,{side:"bottom"},"Start Chat")),Ae.default.createElement(Yt,null,Ae.default.createElement(Zt,{asChild:!0},Ae.default.createElement(he,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),new Dy(app,()=>n(t),`Are you sure you want to delete project "${t.name}"?`,"Delete Project").open()}},Ae.default.createElement(nm,{className:"tw-size-4"}))),Ae.default.createElement(Kt,{side:"bottom"},"Delete Project"))))}var PNe=(0,Ae.memo)(({className:t,projects:e,defaultOpen:r=!1,app:n,onProjectAdded:o,onEditProject:i,hasMessages:a=!1,showChatUI:s,onClose:u,inputRef:l})=>{let[c,d]=(0,Ae.useState)(r),[f,p]=(0,Ae.useState)(!1),[m,h]=(0,Ae.useState)(null),[b,g]=(0,Ae.useState)("");(0,Ae.useEffect)(()=>{a&&d(!1)},[a]);let _=(0,Ae.useMemo)(()=>x3t(e,b),[e,b]),w=()=>{new _5(n,async I=>{o(I)}).open()},x=A=>{new _5(n,async R=>{i(A,R),m&&m.name===A.name&&h(R)},A).open()},C=A=>{let R=(e||[]).filter(j=>j.name!==A.name);m?.name===A.name&&E(!1),Je("projectList",R),new C3t.Notice(`Project "${A.name}" deleted successfully`)},E=(A,I)=>{if(A){if(!I){fe("Must be exist one project.");return}h(I),p(!0),d(!1)}else{h(null),p(!1),d(!0),s(!1),kM(null);return}},P=A=>{h(A),p(!0),d(!1),s(!0),kM(A),setTimeout(()=>{l.current&&l.current.focus()},0)};return Ae.default.createElement("div",{className:Ce("tw-flex tw-flex-col",t)},Ae.default.createElement("div",{className:"tw-overflow-y-auto"},Ae.default.createElement("div",{className:"tw-flex tw-flex-col"},f&&m?Ae.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-2 tw-py-3"},Ae.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ae.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),Ae.default.createElement(dU,{value:m.name,onValueChange:A=>{let I=e.find(R=>R.name===A);I&&P(I)}},Ae.default.createElement(zD,{className:"tw-w-[200px]"},Ae.default.createElement(fU,null,Ae.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ae.default.createElement(zg,{className:"tw-size-4 tw-text-accent/70"}),Ae.default.createElement("span",null,m.name)))),Ae.default.createElement(HD,null,e.map(A=>Ae.default.createElement(VD,{key:A.name,value:A.name,className:"tw-flex tw-items-center tw-gap-2"},Ae.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ae.default.createElement(zg,{className:"tw-size-4"}),A.name)))))),Ae.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ae.default.createElement(he,{variant:"secondary",onClick:()=>x(m),className:"hover:tw-text-on-accent hover:tw-bg-accent/50"},Ae.default.createElement(uC,{className:"tw-mr-1 tw-size-4"}),"Edit"),Ae.default.createElement(Yt,null,Ae.default.createElement(Zt,{asChild:!0},Ae.default.createElement(he,{variant:"ghost2",size:"icon",onClick:()=>{E(!1)},"aria-label":"Close Current Project"},Ae.default.createElement(Ia,{className:"tw-size-4"}))),Ae.default.createElement(Kt,{side:"bottom"},"Close Current Project")))):Ae.default.createElement(gP,{open:c,onOpenChange:d,className:"tw-transition-all tw-duration-200 tw-ease-in-out"},Ae.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-4 tw-py-3"},Ae.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},Ae.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),Ae.default.createElement(Yt,null,Ae.default.createElement(Zt,{asChild:!0},Ae.default.createElement(iR,{className:"tw-size-4 tw-text-muted"})),Ae.default.createElement(Kt,{side:"bottom",className:"tw-w-64"},"Manage your projects with different contexts and configurations."))),Ae.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ae.default.createElement(he,{className:"tw-px-2",variant:"secondary",onClick:w},"Create",Ae.default.createElement(Hg,{className:"tw-size-3"})),e.length>0&&Ae.default.createElement(FD,{asChild:!0},Ae.default.createElement(he,{variant:"ghost2",size:"icon"},c?Ae.default.createElement(qg,{className:"tw-size-5"}):Ae.default.createElement(Di,{className:"tw-size-5"}))),Ae.default.createElement(Yt,null,Ae.default.createElement(Zt,{asChild:!0},Ae.default.createElement(he,{variant:"ghost2",size:"icon",onClick:()=>u(),"aria-label":"close project mode"},Ae.default.createElement(Ia,{className:"tw-size-4"}))),Ae.default.createElement(Kt,{side:"bottom"},"Close Project Mode")))),e.length===0&&Ae.default.createElement("div",{className:"tw-px-4 tw-py-2 tw-text-xs tw-text-muted tw-bg-secondary/30"},"No projects available"),Ae.default.createElement(yP,{className:"tw-transition-all tw-duration-200 tw-ease-in-out"},Ae.default.createElement("div",{className:"tw-relative tw-bg-secondary/30"},e.length>0&&Ae.default.createElement("div",{className:"tw-px-4 tw-pb-2 tw-pt-3"},Ae.default.createElement("div",{className:"tw-relative"},Ae.default.createElement(io,{type:"text",placeholder:"Search projects...",value:b,onChange:A=>g(A.target.value)}),b&&Ae.default.createElement(he,{variant:"secondary",onClick:()=>g(""),className:"tw-absolute tw-right-8 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-rounded-full tw-p-0 tw-transition-colors","aria-label":"Clear search"},Ae.default.createElement(xE,{className:"tw-size-4 tw-text-muted/60 hover:tw-text-accent-hover"})),Ae.default.createElement(zL,{className:"tw-absolute tw-right-3 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-text-muted"}))),Ae.default.createElement("div",{className:"tw-max-h-[calc(3*5.7rem)] tw-overflow-y-auto tw-px-4 tw-pb-6 tw-pt-3"},Ae.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 @2xl:tw-grid @2xl:tw-grid-cols-2 @4xl:tw-grid-cols-3"},_.map(A=>Ae.default.createElement(T_n,{key:A.name,project:A,loadContext:P,onEdit:x,onDelete:C}))),b.trim()&&_.length===0&&Ae.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-py-8 tw-text-muted"},Ae.default.createElement(zL,{className:"tw-mb-3 tw-size-12 tw-text-muted/50"}),Ae.default.createElement("p",{className:"tw-text-base tw-font-medium"},"No matching projects found"),Ae.default.createElement("p",{className:"tw-mt-1 tw-text-sm"},"Try searching with different keywords"))),e.length>0&&Ae.default.createElement("div",{className:"tw-pointer-events-none tw-absolute tw-inset-x-0 tw-bottom-0 tw-h-8 tw-bg-[linear-gradient(to_top,var(--background-primary)_0%,var(--background-primary)_30%,transparent_100%)]"}))))),!f&&Ae.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-4 tw-p-8 tw-text-muted tw-bg-secondary/30"},Ae.default.createElement("div",{className:"tw-max-w-[600px] tw-space-y-4"},Ae.default.createElement("p",{className:"tw-text-center tw-text-base"},"Create your project-based AI assistants with custom instructions, context, and model configurations."),Ae.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 tw-text-sm"},Ae.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ae.default.createElement(BL,{className:"tw-size-4"}),Ae.default.createElement("span",null,"Click a project card to start chatting")))))))});PNe.displayName="ProjectList";Zr();Zr();yn();mo();var ENe=async(t,e,r,n,o,i={})=>{let a=new AbortController;o(a);try{await e.runChain(t,a,n,r,i)}catch(s){fe("Model request failed:",s);let u="Model request failed: "+En(s);r({sender:fb,isErrorMessage:!0,message:`Error: ${u}`,isVisible:!0,timestamp:Ml(new Date)})}};Jt();var WD=$(Y()),TNe=class{constructor(e){this.plugin=e;this.chatHistory=[];this.plugin=e}addMessage(e){this.chatHistory.push(e),this.plugin.projectManager.getCurrentChainManager().addChatMessage(e)}getMessages(){return this.chatHistory}clearChatHistory(){this.chatHistory=[],this.plugin.projectManager.getCurrentChainManager().clearHistory()}replaceMessages(e){this.chatHistory=[...e]}};function O3t(t){let[e,r]=(0,WD.useState)(t.getMessages());(0,WD.useEffect)(()=>{r([...t.getMessages()])},[t,t.chatHistory]);let n=(0,WD.useCallback)(i=>{t.addMessage(i),r([...t.getMessages()])},[t]),o=(0,WD.useCallback)(()=>{t.clearChatHistory(),r([])},[t]);return[e,n,o]}var P3t=TNe;yn();var E3t=$(tp()),Df=require("obsidian"),Pr=$(Y()),A_n=({sharedState:t,chainManager:e,onSaveChat:r,updateUserMessageHistory:n,fileParserManager:o,plugin:i})=>{let a=Pn(),s=(0,Pr.useContext)(Zq),[u,l,c]=O3t(t),[d]=iL(),[f]=Rg(),[p,m]=(0,Pr.useState)(""),[h,b]=(0,Pr.useState)(""),[g,_]=(0,Pr.useState)(null),[w,x]=(0,Pr.useState)(!1),[C,E]=(0,Pr.useState)(Ux.DEFAULT),[P,A]=(0,Pr.useState)([]),[I,R]=(0,Pr.useState)(!1),[j,D]=(0,Pr.useState)([]),[k,F]=(0,Pr.useState)(!1),[B,q]=(0,Pr.useState)(null),[W,H]=Rg(),L=rB(),z=oB.getInstance(),K=Wq.getInstance(),J=(0,Pr.useRef)(null);(0,Pr.useEffect)(()=>{let xe=()=>{J.current&&J.current.focus()};return s?.addEventListener(Hx.CHAT_IS_VISIBLE,xe),()=>{s?.removeEventListener(Hx.CHAT_IS_VISIBLE,xe)}},[s]);let ee=(0,Pr.useContext)(Mue),Pe=i.app||ee,G=async({toolCalls:xe,urls:te,contextNotes:ur}={})=>{if(!h&&j.length===0)return;let je=Ml(new Date),Ee=[];h&&Ee.push({type:"text",text:h});for(let $r of j){let Zy=await $r.arrayBuffer(),dx=E3t.Buffer.from(Zy).toString("base64");Ee.push({type:"image_url",image_url:{url:`data:${$r.type};base64,${dx}`}})}let re=[...ur||[]],oe=Pe.workspace.getActiveFile();I&&W!=="project"&&oe&&!re.some($r=>$r.path===oe.path)&&re.push(oe);let Se={message:h||"Image message",originalMessage:h,sender:gi,isVisible:!0,timestamp:je,content:Ee,context:{notes:re,urls:te||[]}};b(""),D([]),l(Se),x(!0),E(Ux.DEFAULT);let ve=h,qe=await VUe();h.includes("@composer")&&qe!==""&&(ve=h+`
<output_format>
`+qe+`
</output_format>`);let kr=aP.getInstance(Pe.vault),{processedPrompt:pi,includedFiles:sa}=await kr.processCustomPrompt(ve||"","",Pe.workspace.getActiveFile()),uc=f==="copilot_plus"?await z.processUrls(h||""):{urlContext:"",imageUrls:[]},Wd=new Set(sa.map($r=>$r.path)),ua=await K.processContextNotes(Wd,o,Pe.vault,re,I,oe,f),Ff=pi+uc.urlContext+ua,od=h;xe&&(od+=" "+xe.join(`
`));let Kd={message:Ff,originalMessage:od,sender:gi,isVisible:!1,timestamp:je,content:Ee,context:{notes:re,urls:f==="copilot_plus"?[...te||[],...uc.imageUrls]:te||[]}};l(Kd),h&&n(h),await ENe(Kd,e,l,m,_,{debug:a.debug,updateLoadingMessage:E}),x(!1),E(Ux.DEFAULT)},Z=(0,Pr.useCallback)(async()=>{if(!Pe){console.error("App instance is not available.");return}let xe=u.filter(je=>je.isVisible);if(xe.length===0){new Df.Notice("No messages to save.");return}let te=xe[0].timestamp?.epoch||Date.now(),ur=xe.map(je=>`**${je.sender}**: ${je.message}
[Timestamp: ${je.timestamp?.display}]`).join(`
`);try{Pe.vault.getAbstractFileByPath(a.defaultSaveFolder)||await Pe.vault.createFolder(a.defaultSaveFolder);let{fileName:Ee}=Ml(new Date(te)),re=xe.find(Wd=>Wd.sender===gi),oe=re?re.message.split(/\s+/).slice(0,10).join(" ").replace(/[\\/:*?"<>|]/g,"").trim():"Untitled Chat",Se=a.defaultConversationNoteName||"{$date}_{$time}__{$topic}";Se=Se.replace("{$topic}",oe.slice(0,100).replace(/\s+/g,"_")).replace("{$date}",Ee.split("_")[0]).replace("{$time}",Ee.split("_")[1]);let ve=Se.replace(/[\\/:*?"<>|]/g,"_"),qe=hc(),kr=qe?`${qe.id}__`:"",pi=`${a.defaultSaveFolder}/${kr}${ve}.md`,sa=`---
epoch: ${te}
modelKey: ${d}
${qe?`projectId: ${qe.id}`:""}
${qe?`projectName: ${qe.name}`:""}
tags:
- ${a.defaultConversationTag}
${qe?` - project-${qe.name}`:""}
---
${ur}`,uc=Pe.vault.getAbstractFileByPath(pi);uc instanceof Df.TFile?(await Pe.vault.modify(uc,sa),new Df.Notice(`Chat updated in existing note: ${pi}`)):(await Pe.vault.create(pi,sa),new Df.Notice(`Chat saved as note: ${pi}`))}catch(je){console.error("Error saving chat as note:",En(je)),new Df.Notice("Failed to save chat as note. Check console for details.")}},[Pe,u,d,a.defaultConversationTag,a.defaultSaveFolder,a.defaultConversationNoteName]),ie=(0,Pr.useCallback)(xe=>{g&&(a.debug&&console.log(`stopping generation..., reason: ${xe}`),g.abort(xe),x(!1))},[g,a.debug]),Ie=(0,Pr.useCallback)(async xe=>{let te=xe-1;if(te<0||u[te].sender!==gi){new Df.Notice("Cannot regenerate the first message or a user message.");return}let ur=u[te],je=u.slice(0,xe);c(),je.forEach(l),e.memoryManager.clearChatMemory();for(let Ee=0;Ee<je.length;Ee+=2){let re=je[Ee],oe=je[Ee+1];re&&oe&&await e.memoryManager.getMemory().saveContext({input:re.message},{output:oe.message})}x(!0);try{await e.runChain(ur,new AbortController,m,l,{debug:a.debug})&&a.debug&&console.log("Message regenerated successfully")}catch(Ee){console.error("Error regenerating message:",Ee),new Df.Notice("Failed to regenerate message. Please try again.")}finally{x(!1)}},[l,e,u,c,a.debug]),st=(0,Pr.useCallback)(async(xe,te)=>{let ur=u[xe].message;if(ur===te)return;let je=[...u];for(let Ee=xe;Ee<je.length;Ee++)je[Ee].originalMessage===ur&&(je[Ee].message=te,je[Ee].originalMessage=te,je[Ee].context={notes:[],urls:[]});c(),je.forEach(l),await cj(je,e.memoryManager),je[xe].sender===gi&&xe<je.length-1&&Ie(xe+1)},[l,e.memoryManager,u,c,Ie]),Te=(xe,te)=>()=>{let ur=ne().debug,je=async Ee=>{let oe={message:await te(Ee.detail.selectedText,Ee.detail.eventSubtype),sender:gi,isVisible:ur,timestamp:Ml(new Date)};ur&&l(oe),x(!0),await ENe(oe,e,l,m,_,{debug:ur,ignoreSystemMessage:!0}),x(!1)};return s?.addEventListener(xe,je),()=>{s?.removeEventListener(xe,je)}},Qe=aP.getInstance(Pe.vault);(0,Pr.useEffect)(Te(ar.APPLY_CUSTOM_PROMPT,async(xe,te)=>te?(await Qe.processCustomPrompt(te,xe,Pe.workspace.getActiveFile()??void 0)).processedPrompt:xe),[]),(0,Pr.useEffect)(Te(ar.APPLY_ADHOC_PROMPT,async(xe,te)=>te?(await Qe.processCustomPrompt(te,xe,Pe.workspace.getActiveFile())).processedPrompt:xe),[]),(0,Pr.useEffect)(()=>{r&&r(Z)},[r,Z]);let nt=(0,Pr.useCallback)(async xe=>{let te=[...u];te.splice(xe,1),c(),te.forEach(l),await cj(te,e.memoryManager)},[l,e.memoryManager,u,c]),Ht=(0,Pr.useCallback)(xe=>{let te=a.projectList||[];if(te.findIndex(re=>re.name===xe.name)>=0)throw new Error(`Project "${xe.name}" already exists, please use a different name`);let je=[...te,xe];return Je("projectList",je),hc()?.id===xe.id?pue().then(()=>{new Df.Notice(`${xe.name} added and context loaded`)}).catch(re=>{console.error("Error loading project context:",re),new Df.Notice(`${xe.name} added but context loading failed`)}):new Df.Notice(`${xe.name} added successfully`),!0},[a.projectList]),Me=(0,Pr.useCallback)((xe,te)=>{let ur=a.projectList||[];if(!ur.find(oe=>oe.name===xe.name))throw new Error(`Project "${xe.name}" does not exist`);let Ee=ur.map(oe=>oe.name===xe.name?te:oe);return Je("projectList",Ee),hc()?.id===xe.id?(kM(te),pue().then(()=>{new Df.Notice(`${xe.name} updated and context reloaded`)}).catch(oe=>{console.error("Error reloading project context:",oe),new Df.Notice(`${xe.name} updated but context reload failed`)})):new Df.Notice(`${xe.name} updated successfully`),!0},[a.projectList]),ht=(0,Pr.useCallback)(xe=>{b(te=>`${te} ${xe} `)},[]),Xt=(0,Pr.useCallback)(async()=>{ie("new-chat"),await i.handleNewChat(),m(""),A([]),W!=="copilot_plus"?R(!1):R(a.includeActiveNoteAsContext)},[ie,i,a.includeActiveNoteAsContext,W]),nr=(0,Pr.useCallback)(()=>{i.loadCopilotChatHistory()},[i]);(0,Pr.useEffect)(()=>{a.includeActiveNoteAsContext!==void 0&&(W==="copilot_plus"?R(a.includeActiveNoteAsContext):R(!1))},[a.includeActiveNoteAsContext,W]);let Fr=()=>Pr.default.createElement(Pr.default.Fragment,null,Pr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},Pr.default.createElement(b2t,{currentVersion:i.manifest.version}),Pr.default.createElement(y2t,{chatHistory:u,currentAiMessage:p,loading:w,loadingMessage:C,app:Pe,onRegenerate:Ie,onEdit:st,onDelete:nt,onInsertToChat:ht,onReplaceChat:b,showHelperComponents:W!=="project"}),Pr.default.createElement(Xqt,{onNewChat:Xt,onSaveAsNote:()=>Z(),onLoadHistory:nr,onModeChange:xe=>{q(W),xe==="project"&&F(!1)}}),Pr.default.createElement(qUt,{ref:J,inputMessage:h,setInputMessage:b,handleSendMessage:G,isGenerating:w,onStopGenerating:()=>ie("user-stopped"),app:Pe,contextNotes:P,setContextNotes:A,includeActiveNote:I,setIncludeActiveNote:R,mention:z,selectedImages:j,onAddImage:xe=>D(te=>[...te,...xe]),setSelectedImages:D,disableModelSwitch:W==="project"})));return Pr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},Pr.default.createElement("div",{className:"tw-h-full"},Pr.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},W==="project"&&Pr.default.createElement("div",{className:`${W==="project"?"tw-z-modal":""}`},Pr.default.createElement(PNe,{projects:a.projectList||[],defaultOpen:!0,app:Pe,hasMessages:!1,onProjectAdded:Ht,onEditProject:Me,inputRef:J,onClose:()=>{B?(H(B),q(null)):H(L?"copilot_plus":"llm_chain")},showChatUI:xe=>F(xe)})),(W!=="project"||W==="project"&&k)&&Fr())))},T3t=A_n;Zr();var A3t=require("obsidian"),FI=$(Y()),I3t=$(_c()),kI=class extends A3t.ItemView{constructor(r,n){super(r);this.plugin=n;this.root=null;this.handleSaveAsNote=null;this.sharedState=n.sharedState,this.app=n.app,this.fileParserManager=n.fileParserManager,this.eventTarget=new EventTarget,this.plugin=n}get chainManager(){return this.plugin.projectManager.getCurrentChainManager()}getViewType(){return hs}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){this.root=(0,I3t.createRoot)(this.containerEl.children[1]);let r=o=>{this.handleSaveAsNote=o},n=o=>{this.plugin.updateUserMessageHistory(o)};this.renderView(r,n)}renderView(r,n){this.root&&this.root.render(FI.createElement(Mue.Provider,{value:this.app},FI.createElement(Zq.Provider,{value:this.eventTarget},FI.createElement(FI.StrictMode,null,FI.createElement(fue,{delayDuration:0},FI.createElement(T3t,{sharedState:this.sharedState,chainManager:this.chainManager,updateUserMessageHistory:n,fileParserManager:this.fileParserManager,plugin:this.plugin,onSaveChat:r}))))))}async saveChat(){this.handleSaveAsNote&&await this.handleSaveAsNote()}updateView(){this.sharedState.replaceMessages(this.plugin.projectManager.getCurrentChainManager().getChatMessages());let r=o=>{this.handleSaveAsNote=o},n=o=>{this.plugin.updateUserMessageHistory(o)};this.renderView(r,n)}async onClose(){this.root&&(this.root.unmount(),this.root=null)}};yn();var M3t=require("obsidian"),Que=class extends M3t.FuzzySuggestModal{constructor(r,n,o){super(r);this.chatFiles=n;this.onChooseFile=o}getItems(){return this.chatFiles.sort((r,n)=>{let o=s=>{let u=this.app.metadataCache.getFileCache(s)?.frontmatter;return u&&u.epoch?u.epoch:s.stat.ctime},i=o(r);return o(n)-i})}getItemText(r){let o=r.basename.replace(/^[a-zA-Z0-9-]+__/,"").replace(/\{\$date}|\d{8}/g,"").replace(/\{\$time}|\d{6}/g,"").replace(/[@_]/g," ").replace(/\s+/g," ").trim(),i,a=this.app.metadataCache.getFileCache(r)?.frontmatter;return a&&a.epoch?i=Ml(new Date(a.epoch)):i=Ml(new Date(r.stat.ctime)),`${o} - ${i.display}`}onChooseItem(r,n){this.onChooseFile(r)}};Zr();function R3t(t,e,r){_D().filter(o=>o.showInContextMenu).forEach(o=>{t.addItem(i=>{i.setTitle(`Copilot: ${o.name}`).onClick(async a=>{r.app.commands.executeCommandById(`copilot:${Pq(o.name)}`)})})})}mo();Zr();Jt();var V5=require("obsidian"),pLe=$(Y()),zVt=$(_c());var ele=class extends Dy{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 O5=$(Y());var j3t=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>O5.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:Ce("tw-flex tw-flex-row tw-items-center","tw-h-8","tw-px-2 tw-py-1","tw-gap-1.5","tw-cursor-pointer","tw-overflow-hidden","tw-whitespace-nowrap","tw-text-sm","tw-border tw-border-solid tw-border-border","tw-rounded-b-[2px] tw-rounded-t-md","tw-bg-primary","tw-transition-all tw-duration-300 tw-ease-in-out","hover:tw-border-interactive-accent",e&&["!tw-bg-interactive-accent","tw-text-on-accent","!tw-px-3","!tw-max-w-full","tw-transition-all tw-duration-300 tw-ease-in-out","tw-delay-200"],"lg:tw-max-w-32","md:tw-max-w-32")},O5.default.createElement("div",{className:Ce("tw-flex tw-items-center tw-justify-center","tw-size-4","tw-transition-transform tw-duration-200 tw-ease-in-out",e?"tw-max-w-[16px] tw-translate-x-0 tw-opacity-100":"tw-max-w-0 tw--translate-x-4 tw-opacity-0")},t.icon),O5.default.createElement("span",{className:Ce("tw-text-sm","tw-font-medium","tw-transition-all tw-duration-200 tw-ease-in-out","tw-overflow-hidden tw-whitespace-nowrap","tw-max-w-[100px] tw-translate-x-0 tw-opacity-100")},t.label)),D3t=({id:t,children:e,isSelected:r})=>r?O5.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:Ce("tw-pt-4","tw-transition-all tw-duration-200 tw-ease-in-out",r?"tw-translate-y-0 tw-opacity-100":"tw-translate-y-2 tw-opacity-0")},e):null;var qm=$(Y()),N3t=(0,qm.createContext)(void 0),L3t=({children:t})=>{let[e,r]=(0,qm.useState)("basic"),[n,o]=(0,qm.useState)(null),i=(0,qm.useRef)(!1);return(0,qm.useEffect)(()=>{if(!i.current){let a=document.querySelector(".modal-container");o(a),i.current=!0}},[]),qm.default.createElement(N3t.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},$I=()=>{let t=(0,qm.useContext)(N3t);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};Jt();var Ir=$(Y());Jt();var K3t=require("obsidian");var mU=$(Y());var Um=$(Y(),1);var k3t=$(Y(),1);function F3t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function ANe(...t){return e=>{let r=!1,n=t.map(o=>{let i=F3t(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():F3t(t[o],null)}}}}function $3t(...t){return k3t.useCallback(ANe(...t),t)}function INe(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var B3t=$(Y(),1),D_n=$(Ms(),1);var td=$(Y(),1);var pU=$(St(),1),RNe=td.forwardRef((t,e)=>{let{children:r,...n}=t,o=td.Children.toArray(r),i=o.find(M_n);if(i){let a=i.props.children,s=o.map(u=>u===i?td.Children.count(a)>1?td.Children.only(null):td.isValidElement(a)?a.props.children:null:u);return(0,pU.jsx)(MNe,{...n,ref:e,children:td.isValidElement(a)?td.cloneElement(a,void 0,s):null})}return(0,pU.jsx)(MNe,{...n,ref:e,children:r})});RNe.displayName="Slot";var MNe=td.forwardRef((t,e)=>{let{children:r,...n}=t;if(td.isValidElement(r)){let o=j_n(r);return td.cloneElement(r,{...R_n(n,r.props),ref:e?ANe(e,o):o})}return td.Children.count(r)>1?td.Children.only(null):null});MNe.displayName="SlotClone";var I_n=({children:t})=>(0,pU.jsx)(pU.Fragment,{children:t});function M_n(t){return td.isValidElement(t)&&t.type===I_n}function R_n(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 j_n(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 q3t=$(St(),1),N_n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],jNe=N_n.reduce((t,e)=>{let r=B3t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?RNe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,q3t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var qI=$(St(),1),DNe="Checkbox",[L_n,Pai]=ii(DNe),[F_n,k_n]=L_n(DNe),U3t=Um.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]=Um.useState(null),m=$3t(e,x=>p(x)),h=Um.useRef(!1),b=f?c||!!f.closest("form"):!0,[g=!1,_]=Cl({prop:o,defaultProp:i,onChange:l}),w=Um.useRef(g);return Um.useEffect(()=>{let x=f?.form;if(x){let C=()=>_(w.current);return x.addEventListener("reset",C),()=>x.removeEventListener("reset",C)}},[f,_]),(0,qI.jsxs)(F_n,{scope:r,state:g,disabled:s,children:[(0,qI.jsx)(jNe.button,{type:"button",role:"checkbox","aria-checked":BI(g)?"mixed":g,"aria-required":a,"data-state":V3t(g),"data-disabled":s?"":void 0,disabled:s,value:u,...d,ref:m,onKeyDown:INe(t.onKeyDown,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:INe(t.onClick,x=>{_(C=>BI(C)?!0:!C),b&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})}),b&&(0,qI.jsx)($_n,{control:f,bubbles:!h.current,name:n,value:u,checked:g,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"},defaultChecked:BI(i)?!1:i})]})});U3t.displayName=DNe;var z3t="CheckboxIndicator",H3t=Um.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=k_n(z3t,r);return(0,qI.jsx)(rl,{present:n||BI(i.state)||i.state===!0,children:(0,qI.jsx)(jNe.span,{"data-state":V3t(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});H3t.displayName=z3t;var $_n=t=>{let{control:e,checked:r,bubbles:n=!0,defaultChecked:o,...i}=t,a=Um.useRef(null),s=aU(r),u=fg(e);Um.useEffect(()=>{let c=a.current,d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(s!==r&&p){let m=new Event("click",{bubbles:n});c.indeterminate=BI(r),p.call(c,BI(r)?!1:r),c.dispatchEvent(m)}},[s,r,n]);let l=Um.useRef(BI(r)?!1:r);return(0,qI.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 BI(t){return t==="indeterminate"}function V3t(t){return BI(t)?"indeterminate":t?"checked":"unchecked"}var NNe=U3t,W3t=H3t;var Nf=mU.forwardRef(({className:t,...e},r)=>mU.createElement(NNe,{ref:r,className:Ce("tw-border-solid !tw-bg-transparent tw-p-0 !tw-shadow tw-transition-colors","hover:!tw-bg-interactive-accent hover:!tw-text-on-accent data-[state=checked]:!tw-bg-interactive-accent data-[state=checked]:!tw-text-on-accent","tw-peer tw-size-4 tw-shrink-0 tw-rounded-sm tw-border tw-border-interactive-accent focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring disabled:tw-cursor-not-allowed disabled:tw-opacity-50",t),...e},mU.createElement(W3t,{className:Ce("tw-flex tw-items-center tw-justify-center tw-text-current")},mU.createElement(Nl,{className:"tw-size-4"}))));Nf.displayName=NNe.displayName;var fi=$(Y()),J3t=$(_c());Jt();mo();function q_n({command:t,onConfirm:e,onCancel:r,onRemove:n}){let i=Pn().activeModels.filter(f=>f.enabled).map(f=>({label:Ese(f),value:Dr(f)})),[a,s]=(0,fi.useState)(t),[u,l]=(0,fi.useState)({}),c=(f,p)=>{s(m=>({...m,[f]:p})),l(m=>({...m,[f]:void 0}))},d=()=>{let f={};try{kFt(a.name,t.name)}catch(p){f.name=p.message}if(a.prompt.trim()||(f.prompt="Prompt is required"),Object.keys(f).length>0){l(f);return}e(a)};return fi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},fi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},fi.default.createElement(Fp,{htmlFor:"name"},"Name"),fi.default.createElement(io,{id:"name",value:a.name,onChange:f=>c("name",f.target.value),placeholder:"Enter command name"}),u.name&&fi.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.name)),fi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},fi.default.createElement(Fp,{htmlFor:"prompt"},"Prompt"),fi.default.createElement(Cse,null),fi.default.createElement(Ry,{id:"prompt",value:a.prompt,onChange:f=>c("prompt",f.target.value),placeholder:"Enter command prompt",className:"tw-min-h-[200px]"}),u.prompt&&fi.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.prompt)),fi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},fi.default.createElement(Fp,{htmlFor:"modelKey"},"Model (Optional)"),fi.default.createElement("div",{className:"tw-group tw-relative tw-w-full"},fi.default.createElement("select",{value:a.modelKey,onChange:f=>{let p=f.target.value;if(!p){c("modelKey","");return}if(!i.find(h=>h.value===p)){fe(`Model ${p} not found`),c("modelKey","");return}c("modelKey",f.target.value)},className:Ce("tw-w-full tw-appearance-none","tw-flex tw-h-9 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-dropdown tw-px-3 tw-py-1 tw-pr-8","tw-text-sm !tw-shadow tw-transition-colors","focus:tw-outline-none focus:tw-ring-1 focus:tw-ring-ring","disabled:tw-cursor-not-allowed disabled:tw-opacity-50","hover:tw-bg-interactive-hover hover:tw-text-normal")},fi.default.createElement("option",{value:""},"Inherit from chat model"),i.map(f=>fi.default.createElement("option",{key:f.value,value:f.value.toString()},f.label))),fi.default.createElement("div",{className:Ce("tw-pointer-events-none tw-absolute tw-inset-y-0 tw-right-0 tw-flex tw-items-center tw-pr-2","tw-transition-colors group-hover:[&>svg]:tw-text-normal")},fi.default.createElement(Di,{className:"tw-size-4"})))),fi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},fi.default.createElement(Nf,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),fi.default.createElement(Fp,{htmlFor:"showInContextMenu"},"Show in context menu")),fi.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},fi.default.createElement(he,{variant:"secondary",onClick:r},"Cancel"),fi.default.createElement(he,{variant:"default",onClick:d},"Save")))}var hU=class extends K3t.Modal{constructor(r,n,o,i){super(r);this.command=n;this.onUpdate=o;this.onRemove=i;this.setTitle("Edit Command")}onOpen(){let{contentEl:r}=this;this.root=(0,J3t.createRoot)(r);let n=i=>{this.onUpdate(i),this.close()},o=()=>{this.onRemove?.(),this.close()};this.root.render(fi.default.createElement(q_n,{command:this.command,onConfirm:n,onCancel:()=>this.close(),onRemove:this.onRemove?o:void 0}))}onClose(){this.root.unmount()}};var El=$(Y());var P5=El.forwardRef(({className:t,...e},r)=>El.createElement("div",{className:"tw-relative tw-w-full tw-overflow-auto"},El.createElement("table",{ref:r,className:Ce("tw-w-full tw-caption-bottom tw-border-collapse tw-text-sm",t),...e})));P5.displayName="Table";var E5=El.forwardRef(({className:t,...e},r)=>El.createElement("thead",{ref:r,className:Ce("[&_tr]:tw-border-b",t),...e}));E5.displayName="TableHeader";var T5=El.forwardRef(({className:t,...e},r)=>El.createElement("tbody",{ref:r,className:t,...e}));T5.displayName="TableBody";var U_n=El.forwardRef(({className:t,...e},r)=>El.createElement("tfoot",{ref:r,className:Ce("tw-border-t tw-font-medium tw-bg-primary-alt/50",t),...e}));U_n.displayName="TableFooter";var KD=El.forwardRef(({className:t,...e},r)=>El.createElement("tr",{ref:r,className:Ce("tw-border-b tw-transition-colors hover:tw-bg-primary-alt/50 data-[state=selected]:tw-bg-primary-alt",t),...e}));KD.displayName="TableRow";var kp=El.forwardRef(({className:t,...e},r)=>El.createElement("th",{ref:r,className:Ce("tw-h-10 tw-px-2 tw-text-left tw-align-middle tw-font-medium tw-text-muted [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));kp.displayName="TableHead";var $p=El.forwardRef(({className:t,...e},r)=>El.createElement("td",{ref:r,className:Ce("tw-p-2 tw-align-middle [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));$p.displayName="TableCell";var z_n=El.forwardRef(({className:t,...e},r)=>El.createElement("caption",{ref:r,className:Ce("tw-mt-4 tw-text-sm tw-text-muted",t),...e}));z_n.displayName="TableCaption";var Oe=$(Y()),eN=$(Ms());var xs=$(Y());function Y3t(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,xs.useMemo)(()=>n=>{e.forEach(o=>o(n))},e)}var A5=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 tle(t){return"nodeType"in t}function Lf(t){var e,r;return t?JD(t)?t:tle(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function rle(t){let{Document:e}=Lf(t);return t instanceof e}function gU(t){return JD(t)?!1:t instanceof Lf(t).HTMLElement}function FNe(t){return t instanceof Lf(t).SVGElement}function GD(t){return t?JD(t)?t.document:tle(t)?rle(t)?t:gU(t)||FNe(t)?t.ownerDocument:document:document:document}var vg=A5?xs.useLayoutEffect:xs.useEffect;function nle(t){let e=(0,xs.useRef)(t);return vg(()=>{e.current=t}),(0,xs.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 Z3t(){let t=(0,xs.useRef)(null),e=(0,xs.useCallback)((n,o)=>{t.current=setInterval(n,o)},[]),r=(0,xs.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function yU(t,e){e===void 0&&(e=[t]);let r=(0,xs.useRef)(t);return vg(()=>{r.current!==t&&(r.current=t)},e),r}function bU(t,e){let r=(0,xs.useRef)();return(0,xs.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function I5(t){let e=nle(t),r=(0,xs.useRef)(null),n=(0,xs.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function ole(t){let e=(0,xs.useRef)();return(0,xs.useEffect)(()=>{e.current=t},[t]),e.current}var LNe={};function YD(t,e){return(0,xs.useMemo)(()=>{if(e)return e;let r=LNe[t]==null?0:LNe[t]+1;return LNe[t]=r,t+"-"+r},[t,e])}function X3t(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 ZD=X3t(1),XD=X3t(-1);function H_n(t){return"clientX"in t&&"clientY"in t}function M5(t){if(!t)return!1;let{KeyboardEvent:e}=Lf(t.target);return e&&t instanceof e}function V_n(t){if(!t)return!1;let{TouchEvent:e}=Lf(t.target);return e&&t instanceof e}function ile(t){if(V_n(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 H_n(t)?{x:t.clientX,y:t.clientY}:null}var Ky=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[Ky.Translate.toString(t),Ky.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),G3t="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Q3t(t){return t.matches(G3t)?t:t.querySelector(G3t)}var QD=$(Y()),W_n={display:"none"};function eHt(t){let{id:e,value:r}=t;return QD.default.createElement("div",{id:e,style:W_n},r)}function tHt(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 QD.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function rHt(){let[t,e]=(0,QD.useState)("");return{announce:(0,QD.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var hHt=(0,Oe.createContext)(null);function K_n(t){let e=(0,Oe.useContext)(hHt);(0,Oe.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function J_n(){let[t]=(0,Oe.useState)(()=>new Set),e=(0,Oe.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,Oe.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 G_n={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.
`},Y_n={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 Z_n(t){let{announcements:e=Y_n,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=G_n}=t,{announce:i,announcement:a}=rHt(),s=YD("DndLiveRegion"),[u,l]=(0,Oe.useState)(!1);if((0,Oe.useEffect)(()=>{l(!0)},[]),K_n((0,Oe.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=Oe.default.createElement(Oe.default.Fragment,null,Oe.default.createElement(eHt,{id:n,value:o.draggable}),Oe.default.createElement(tHt,{id:s,announcement:a}));return r?(0,eN.createPortal)(c,r):c}var Tl;(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"})(Tl||(Tl={}));function sle(){}function _U(t,e){return(0,Oe.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function lle(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,Oe.useMemo)(()=>[...e].filter(n=>n!=null),[...e])}var Jy=Object.freeze({x:0,y:0});function gHt(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function yHt(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function X_n(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function nHt(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 WNe(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function oHt(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 L5=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=oHt(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=gHt(oHt(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(yHt)},bHt=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=nHt(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=nHt(u),c=o.reduce((f,p,m)=>f+gHt(l[m],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(yHt)};function Q_n(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 evn=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=Q_n(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(X_n)};function tvn(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function _Ht(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Jy}function rvn(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 nvn=rvn(1);function ovn(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 ivn(t,e,r){let n=ovn(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 avn={ignoreTransform:!1};function nN(t,e){e===void 0&&(e=avn);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=Lf(t).getComputedStyle(t);l&&(r=ivn(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 iHt(t){return nN(t,{ignoreTransform:!0})}function svn(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function uvn(t,e){return e===void 0&&(e=Lf(t).getComputedStyle(t)),e.position==="fixed"}function lvn(t,e){e===void 0&&(e=Lf(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 F5(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(rle(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!gU(o)||FNe(o)||r.includes(o))return r;let i=Lf(t).getComputedStyle(o);return o!==t&&lvn(o,i)&&r.push(o),uvn(o,i)?r:n(o.parentNode)}return t?n(t):r}function vHt(t){let[e]=F5(t,1);return e??null}function kNe(t){return!A5||!t?null:JD(t)?t:tle(t)?rle(t)||t===GD(t).scrollingElement?window:gU(t)?t:null:null}function wHt(t){return JD(t)?t.scrollX:t.scrollLeft}function SHt(t){return JD(t)?t.scrollY:t.scrollTop}function qNe(t){return{x:wHt(t),y:SHt(t)}}var sc;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(sc||(sc={}));function xHt(t){return!A5||!t?!1:t===document.scrollingElement}function CHt(t){let e={x:0,y:0},r=xHt(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 cvn={x:.2,y:.2};function dvn(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=cvn);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=CHt(t),p={x:0,y:0},m={x:0,y:0},h={height:e.height*o.y,width:e.width*o.x};return!l&&i<=e.top+h.height?(p.y=sc.Backward,m.y=n*Math.abs((e.top+h.height-i)/h.height)):!c&&u>=e.bottom-h.height&&(p.y=sc.Forward,m.y=n*Math.abs((e.bottom-h.height-u)/h.height)),!f&&s>=e.right-h.width?(p.x=sc.Forward,m.x=n*Math.abs((e.right-h.width-s)/h.width)):!d&&a<=e.left+h.width&&(p.x=sc.Backward,m.x=n*Math.abs((e.left+h.width-a)/h.width)),{direction:p,speed:m}}function fvn(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 OHt(t){return t.reduce((e,r)=>ZD(e,qNe(r)),Jy)}function pvn(t){return t.reduce((e,r)=>e+wHt(r),0)}function mvn(t){return t.reduce((e,r)=>e+SHt(r),0)}function hvn(t,e){if(e===void 0&&(e=nN),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);vHt(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var gvn=[["x",["left","right"],pvn],["y",["top","bottom"],mvn]],j5=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=F5(r),o=OHt(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of gvn)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})}},tN=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 yvn(t){let{EventTarget:e}=Lf(t);return t instanceof e?t:GD(t)}function $Ne(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 wg;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(wg||(wg={}));function aHt(t){t.preventDefault()}function bvn(t){t.stopPropagation()}var Dn;(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"})(Dn||(Dn={}));var PHt={start:[Dn.Space,Dn.Enter],cancel:[Dn.Esc],end:[Dn.Space,Dn.Enter,Dn.Tab]},_vn=(t,e)=>{let{currentCoordinates:r}=e;switch(t.code){case Dn.Right:return{...r,x:r.x+25};case Dn.Left:return{...r,x:r.x-25};case Dn.Down:return{...r,y:r.y+25};case Dn.Up:return{...r,y:r.y-25}}},zI=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 tN(GD(r)),this.windowListeners=new tN(Lf(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(wg.Resize,this.handleCancel),this.windowListeners.add(wg.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(wg.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,n=e.node.current;n&&hvn(n),r(Jy)}handleKeyDown(e){if(M5(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=PHt,coordinateGetter:a=_vn,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}:Jy;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:m}=n.current;for(let h of m){let b=e.code,{isTop:g,isRight:_,isLeft:w,isBottom:x,maxScroll:C,minScroll:E}=CHt(h),P=fvn(h),A={x:Math.min(b===Dn.Right?P.right-P.width/2:P.right,Math.max(b===Dn.Right?P.left:P.left+P.width/2,d.x)),y:Math.min(b===Dn.Down?P.bottom-P.height/2:P.bottom,Math.max(b===Dn.Down?P.top:P.top+P.height/2,d.y))},I=b===Dn.Right&&!_||b===Dn.Left&&!w,R=b===Dn.Down&&!x||b===Dn.Up&&!g;if(I&&A.x!==d.x){let j=h.scrollLeft+f.x,D=b===Dn.Right&&j<=C.x||b===Dn.Left&&j>=E.x;if(D&&!f.y){h.scrollTo({left:j,behavior:s});return}D?p.x=h.scrollLeft-j:p.x=b===Dn.Right?h.scrollLeft-C.x:h.scrollLeft-E.x,p.x&&h.scrollBy({left:-p.x,behavior:s});break}else if(R&&A.y!==d.y){let j=h.scrollTop+f.y,D=b===Dn.Down&&j<=C.y||b===Dn.Up&&j>=E.y;if(D&&!f.x){h.scrollTo({top:j,behavior:s});return}D?p.y=h.scrollTop-j:p.y=b===Dn.Down?h.scrollTop-C.y:h.scrollTop-E.y,p.y&&h.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,ZD(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()}};zI.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=PHt,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 sHt(t){return!!(t&&"distance"in t)}function uHt(t){return!!(t&&"delay"in t)}var D5=class{constructor(e,r,n){var o;n===void 0&&(n=yvn(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 tN(this.document),this.listeners=new tN(n),this.windowListeners=new tN(Lf(a)),this.initialCoordinates=(o=ile(i))!=null?o:Jy,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(wg.Resize,this.handleCancel),this.windowListeners.add(wg.DragStart,aHt),this.windowListeners.add(wg.VisibilityChange,this.handleCancel),this.windowListeners.add(wg.ContextMenu,aHt),this.documentListeners.add(wg.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(uHt(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(sHt(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(wg.Click,bvn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(wg.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=ile(e))!=null?r:Jy,l=XD(o,u);if(!n&&s){if(sHt(s)){if(s.tolerance!=null&&$Ne(l,s.tolerance))return this.handleCancel();if($Ne(l,s.distance))return this.handleStart()}if(uHt(s)&&$Ne(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===Dn.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},vvn={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},HI=class extends D5{constructor(e){let{event:r}=e,n=GD(r.target);super(e,vvn,n)}};HI.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 wvn={move:{name:"mousemove"},end:{name:"mouseup"}},UNe;(function(t){t[t.RightClick=2]="RightClick"})(UNe||(UNe={}));var zNe=class extends D5{constructor(e){super(e,wvn,GD(e.event.target))}};zNe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===UNe.RightClick?!1:(n?.({event:r}),!0)}}];var BNe={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},HNe=class extends D5{constructor(e){super(e,BNe)}static setup(){return window.addEventListener(BNe.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(BNe.move.name,e)};function e(){}}};HNe.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 R5;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(R5||(R5={}));var ule;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(ule||(ule={}));function Svn(t){let{acceleration:e,activator:r=R5.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=ule.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=Cvn({delta:d,disabled:!i}),[m,h]=Z3t(),b=(0,Oe.useRef)({x:0,y:0}),g=(0,Oe.useRef)({x:0,y:0}),_=(0,Oe.useMemo)(()=>{switch(r){case R5.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case R5.DraggableRect:return o}},[r,o,u]),w=(0,Oe.useRef)(null),x=(0,Oe.useCallback)(()=>{let E=w.current;if(!E)return;let P=b.current.x*g.current.x,A=b.current.y*g.current.y;E.scrollBy(P,A)},[]),C=(0,Oe.useMemo)(()=>s===ule.TreeOrder?[...l].reverse():l,[s,l]);(0,Oe.useEffect)(()=>{if(!i||!l.length||!_){h();return}for(let E of C){if(n?.(E)===!1)continue;let P=l.indexOf(E),A=c[P];if(!A)continue;let{direction:I,speed:R}=dvn(E,A,_,e,f);for(let j of["x","y"])p[j][I[j]]||(R[j]=0,I[j]=0);if(R.x>0||R.y>0){h(),w.current=E,m(x,a),b.current=R,g.current=I;return}}b.current={x:0,y:0},g.current={x:0,y:0},h()},[e,x,n,h,i,a,JSON.stringify(_),JSON.stringify(p),m,l,C,c,JSON.stringify(f)])}var xvn={x:{[sc.Backward]:!1,[sc.Forward]:!1},y:{[sc.Backward]:!1,[sc.Forward]:!1}};function Cvn(t){let{delta:e,disabled:r}=t,n=ole(e);return bU(o=>{if(r||!n||!o)return xvn;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[sc.Backward]:o.x[sc.Backward]||i.x===-1,[sc.Forward]:o.x[sc.Forward]||i.x===1},y:{[sc.Backward]:o.y[sc.Backward]||i.y===-1,[sc.Forward]:o.y[sc.Forward]||i.y===1}}},[r,e,n])}function Ovn(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return bU(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function Pvn(t,e){return(0,Oe.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 N5;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(N5||(N5={}));var VNe;(function(t){t.Optimized="optimized"})(VNe||(VNe={}));var lHt=new Map;function Evn(t,e){let{dragging:r,dependencies:n,config:o}=e,[i,a]=(0,Oe.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,Oe.useRef)(t),d=b(),f=yU(d),p=(0,Oe.useCallback)(function(g){g===void 0&&(g=[]),!f.current&&a(_=>_===null?g:_.concat(g.filter(w=>!_.includes(w))))},[f]),m=(0,Oe.useRef)(null),h=bU(g=>{if(d&&!r)return lHt;if(!g||g===lHt||c.current!==t||i!=null){let _=new Map;for(let w of t){if(!w)continue;if(i&&i.length>0&&!i.includes(w.id)&&w.rect.current){_.set(w.id,w.rect.current);continue}let x=w.node.current,C=x?new j5(u(x),x):null;w.rect.current=C,C&&_.set(w.id,C)}return _}return g},[t,i,r,d,u]);return(0,Oe.useEffect)(()=>{c.current=t},[t]),(0,Oe.useEffect)(()=>{d||p()},[r,d]),(0,Oe.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,Oe.useEffect)(()=>{d||typeof s!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...n]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(l){case N5.Always:return!1;case N5.BeforeDragging:return r;default:return!r}}}function EHt(t,e){return bU(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function Tvn(t,e){return EHt(t,e)}function Avn(t){let{callback:e,disabled:r}=t,n=nle(e),o=(0,Oe.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,Oe.useEffect)(()=>()=>o?.disconnect(),[o]),o}function cle(t){let{callback:e,disabled:r}=t,n=nle(e),o=(0,Oe.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,Oe.useEffect)(()=>()=>o?.disconnect(),[o]),o}function Ivn(t){return new j5(nN(t),t)}function cHt(t,e,r){e===void 0&&(e=Ivn);let[n,o]=(0,Oe.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=Avn({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=cle({callback:i});return vg(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function Mvn(t){let e=EHt(t);return _Ht(t,e)}var dHt=[];function Rvn(t){let e=(0,Oe.useRef)(t),r=bU(n=>t?n&&n!==dHt&&t&&e.current&&t.parentNode===e.current.parentNode?n:F5(t):dHt,[t]);return(0,Oe.useEffect)(()=>{e.current=t},[t]),r}function jvn(t){let[e,r]=(0,Oe.useState)(null),n=(0,Oe.useRef)(t),o=(0,Oe.useCallback)(i=>{let a=kNe(i.target);a&&r(s=>s?(s.set(a,qNe(a)),new Map(s)):null)},[]);return(0,Oe.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(u=>{let l=kNe(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,qNe(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=kNe(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,Oe.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>ZD(i,a),Jy):OHt(t):Jy,[t,e])}function fHt(t,e){e===void 0&&(e=[]);let r=(0,Oe.useRef)(null);return(0,Oe.useEffect)(()=>{r.current=null},e),(0,Oe.useEffect)(()=>{let n=t!==Jy;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?XD(t,r.current):Jy}function Dvn(t){(0,Oe.useEffect)(()=>{if(!A5)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 Nvn(t,e){return(0,Oe.useMemo)(()=>t.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,e)},r},{}),[t,e])}function THt(t){return(0,Oe.useMemo)(()=>t?svn(t):null,[t])}var pHt=[];function Lvn(t,e){e===void 0&&(e=nN);let[r]=t,n=THt(r?Lf(r):null),[o,i]=(0,Oe.useState)(pHt);function a(){i(()=>t.length?t.map(u=>xHt(u)?n:new j5(e(u),u)):pHt)}let s=cle({callback:a});return vg(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function Fvn(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return gU(e)?e:t}function kvn(t){let{measure:e}=t,[r,n]=(0,Oe.useState)(null),o=(0,Oe.useCallback)(l=>{for(let{target:c}of l)if(gU(c)){n(d=>{let f=e(c);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=cle({callback:o}),a=(0,Oe.useCallback)(l=>{let c=Fvn(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=I5(a);return(0,Oe.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var $vn=[{sensor:HI,options:{}},{sensor:zI,options:{}}],Bvn={current:{}},ale={draggable:{measure:iHt},droppable:{measure:iHt,strategy:N5.WhileDragging,frequency:VNe.Optimized},dragOverlay:{measure:nN}},rN=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}},qvn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new rN,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:sle},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ale,measureDroppableContainers:sle,windowRect:null,measuringScheduled:!1},Uvn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:sle,draggableNodes:new Map,over:null,measureDroppableContainers:sle},dle=(0,Oe.createContext)(Uvn),AHt=(0,Oe.createContext)(qvn);function zvn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new rN}}}function Hvn(t,e){switch(e.type){case Tl.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Tl.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 Tl.DragEnd:case Tl.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Tl.RegisterDroppable:{let{element:r}=e,{id:n}=r,o=new rN(t.droppable.containers);return o.set(n,r),{...t,droppable:{...t.droppable,containers:o}}}case Tl.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 rN(t.droppable.containers);return a.set(r,{...i,disabled:o}),{...t,droppable:{...t.droppable,containers:a}}}case Tl.UnregisterDroppable:{let{id:r,key:n}=e,o=t.droppable.containers.get(r);if(!o||n!==o.key)return t;let i=new rN(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function Vvn(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,Oe.useContext)(dle),i=ole(n),a=ole(r?.id);return(0,Oe.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!M5(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=Q3t(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function Wvn(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function Kvn(t){return(0,Oe.useMemo)(()=>({draggable:{...ale.draggable,...t?.draggable},droppable:{...ale.droppable,...t?.droppable},dragOverlay:{...ale.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function Jvn(t){let{activeNode:e,measure:r,initialRect:n,config:o=!0}=t,i=(0,Oe.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;vg(()=>{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=_Ht(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=vHt(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var IHt=(0,Oe.createContext)({...Jy,scaleX:1,scaleY:1}),UI;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(UI||(UI={}));var k5=(0,Oe.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=$vn,collisionDetection:d=evn,measuring:f,modifiers:p,...m}=e,h=(0,Oe.useReducer)(Hvn,void 0,zvn),[b,g]=h,[_,w]=J_n(),[x,C]=(0,Oe.useState)(UI.Uninitialized),E=x===UI.Initialized,{draggable:{active:P,nodes:A,translate:I},droppable:{containers:R}}=b,j=P!=null?A.get(P):null,D=(0,Oe.useRef)({initial:null,translated:null}),k=(0,Oe.useMemo)(()=>{var Ya;return P!=null?{id:P,data:(Ya=j?.data)!=null?Ya:Bvn,rect:D}:null},[P,j]),F=(0,Oe.useRef)(null),[B,q]=(0,Oe.useState)(null),[W,H]=(0,Oe.useState)(null),L=yU(m,Object.values(m)),z=YD("DndDescribedBy",a),K=(0,Oe.useMemo)(()=>R.getEnabled(),[R]),J=Kvn(f),{droppableRects:ee,measureDroppableContainers:Pe,measuringScheduled:G}=Evn(K,{dragging:E,dependencies:[I.x,I.y],config:J.droppable}),Z=Ovn(A,P),ie=(0,Oe.useMemo)(()=>W?ile(W):null,[W]),Ie=xP(),st=Tvn(Z,J.draggable.measure);Jvn({activeNode:P!=null?A.get(P):null,config:Ie.layoutShiftCompensation,initialRect:st,measure:J.draggable.measure});let Te=cHt(Z,J.draggable.measure,st),Qe=cHt(Z?Z.parentElement:null),nt=(0,Oe.useRef)({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ht=R.getNodeFor((r=nt.current.over)==null?void 0:r.id),Me=kvn({measure:J.dragOverlay.measure}),ht=(n=Me.nodeRef.current)!=null?n:Z,Xt=E?(o=Me.rect)!=null?o:Te:null,nr=!!(Me.nodeRef.current&&Me.rect),Fr=Mvn(nr?null:Te),xe=THt(ht?Lf(ht):null),te=Rvn(E?Ht??Z:null),ur=Lvn(te),je=Wvn(p,{transform:{x:I.x-Fr.x,y:I.y-Fr.y,scaleX:1,scaleY:1},activatorEvent:W,active:k,activeNodeRect:Te,containerNodeRect:Qe,draggingNodeRect:Xt,over:nt.current.over,overlayNodeRect:Me.rect,scrollableAncestors:te,scrollableAncestorRects:ur,windowRect:xe}),Ee=ie?ZD(ie,I):null,re=jvn(te),oe=fHt(re),Se=fHt(re,[Te]),ve=ZD(je,oe),qe=Xt?nvn(Xt,je):null,kr=k&&qe?d({active:k,collisionRect:qe,droppableRects:ee,droppableContainers:K,pointerCoordinates:Ee}):null,pi=WNe(kr,"id"),[sa,uc]=(0,Oe.useState)(null),Wd=nr?je:ZD(je,Se),ua=tvn(Wd,(i=sa?.rect)!=null?i:null,Te),Ff=(0,Oe.useRef)(null),od=(0,Oe.useCallback)((Ya,Ps)=>{let{sensor:Pa,options:Jd}=Ps;if(F.current==null)return;let id=A.get(F.current);if(!id)return;let ls=Ya.nativeEvent,kf=new Pa({active:F.current,activeNode:id,event:ls,options:Jd,context:nt,onAbort(Cn){if(!A.get(Cn))return;let{onDragAbort:Yd}=L.current,Bp={id:Cn};Yd?.(Bp),_({type:"onDragAbort",event:Bp})},onPending(Cn,We,Yd,Bp){if(!A.get(Cn))return;let{onDragPending:fx}=L.current,Sn={id:Cn,constraint:We,initialCoordinates:Yd,offset:Bp};fx?.(Sn),_({type:"onDragPending",event:Sn})},onStart(Cn){let We=F.current;if(We==null)return;let Yd=A.get(We);if(!Yd)return;let{onDragStart:Bp}=L.current,al={activatorEvent:ls,active:{id:We,data:Yd.data,rect:D}};(0,eN.unstable_batchedUpdates)(()=>{Bp?.(al),C(UI.Initializing),g({type:Tl.DragStart,initialCoordinates:Cn,active:We}),_({type:"onDragStart",event:al}),q(Ff.current),H(ls)})},onMove(Cn){g({type:Tl.DragMove,coordinates:Cn})},onEnd:Gd(Tl.DragEnd),onCancel:Gd(Tl.DragCancel)});Ff.current=kf;function Gd(Cn){return async function(){let{active:Yd,collisions:Bp,over:al,scrollAdjustedTranslate:fx}=nt.current,Sn=null;if(Yd&&fx){let{cancelDrop:xg}=L.current;Sn={activatorEvent:ls,active:Yd,collisions:Bp,delta:fx,over:al},Cn===Tl.DragEnd&&typeof xg=="function"&&await Promise.resolve(xg(Sn))&&(Cn=Tl.DragCancel)}F.current=null,(0,eN.unstable_batchedUpdates)(()=>{g({type:Cn}),C(UI.Uninitialized),uc(null),q(null),H(null),Ff.current=null;let xg=Cn===Tl.DragEnd?"onDragEnd":"onDragCancel";if(Sn){let OU=L.current[xg];OU?.(Sn),_({type:xg,event:Sn})}})}}},[A]),Kd=(0,Oe.useCallback)((Ya,Ps)=>(Pa,Jd)=>{let id=Pa.nativeEvent,ls=A.get(Jd);if(F.current!==null||!ls||id.dndKit||id.defaultPrevented)return;let kf={active:ls};Ya(Pa,Ps.options,kf)===!0&&(id.dndKit={capturedBy:Ps.sensor},F.current=Jd,od(Pa,Ps))},[A,od]),$r=Pvn(c,Kd);Dvn(c),vg(()=>{Te&&x===UI.Initializing&&C(UI.Initialized)},[Te,x]),(0,Oe.useEffect)(()=>{let{onDragMove:Ya}=L.current,{active:Ps,activatorEvent:Pa,collisions:Jd,over:id}=nt.current;if(!Ps||!Pa)return;let ls={active:Ps,activatorEvent:Pa,collisions:Jd,delta:{x:ve.x,y:ve.y},over:id};(0,eN.unstable_batchedUpdates)(()=>{Ya?.(ls),_({type:"onDragMove",event:ls})})},[ve.x,ve.y]),(0,Oe.useEffect)(()=>{let{active:Ya,activatorEvent:Ps,collisions:Pa,droppableContainers:Jd,scrollAdjustedTranslate:id}=nt.current;if(!Ya||F.current==null||!Ps||!id)return;let{onDragOver:ls}=L.current,kf=Jd.get(pi),Gd=kf&&kf.rect.current?{id:kf.id,rect:kf.rect.current,data:kf.data,disabled:kf.disabled}:null,Cn={active:Ya,activatorEvent:Ps,collisions:Pa,delta:{x:id.x,y:id.y},over:Gd};(0,eN.unstable_batchedUpdates)(()=>{uc(Gd),ls?.(Cn),_({type:"onDragOver",event:Cn})})},[pi]),vg(()=>{nt.current={activatorEvent:W,active:k,activeNode:Z,collisionRect:qe,collisions:kr,droppableRects:ee,draggableNodes:A,draggingNode:ht,draggingNodeRect:Xt,droppableContainers:R,over:sa,scrollableAncestors:te,scrollAdjustedTranslate:ve},D.current={initial:Xt,translated:qe}},[k,Z,kr,qe,A,ht,Xt,ee,R,sa,te,ve]),Svn({...Ie,delta:I,draggingRect:qe,pointerCoordinates:Ee,scrollableAncestors:te,scrollableAncestorRects:ur});let Zy=(0,Oe.useMemo)(()=>({active:k,activeNode:Z,activeNodeRect:Te,activatorEvent:W,collisions:kr,containerNodeRect:Qe,dragOverlay:Me,draggableNodes:A,droppableContainers:R,droppableRects:ee,over:sa,measureDroppableContainers:Pe,scrollableAncestors:te,scrollableAncestorRects:ur,measuringConfiguration:J,measuringScheduled:G,windowRect:xe}),[k,Z,Te,W,kr,Qe,Me,A,R,ee,sa,Pe,te,ur,J,G,xe]),dx=(0,Oe.useMemo)(()=>({activatorEvent:W,activators:$r,active:k,activeNodeRect:Te,ariaDescribedById:{draggable:z},dispatch:g,draggableNodes:A,over:sa,measureDroppableContainers:Pe}),[W,$r,k,Te,g,z,A,sa,Pe]);return Oe.default.createElement(hHt.Provider,{value:w},Oe.default.createElement(dle.Provider,{value:dx},Oe.default.createElement(AHt.Provider,{value:Zy},Oe.default.createElement(IHt.Provider,{value:ua},l)),Oe.default.createElement(Vvn,{disabled:s?.restoreFocus===!1})),Oe.default.createElement(Z_n,{...s,hiddenTextDescribedById:z}));function xP(){let Ya=B?.autoScrollEnabled===!1,Ps=typeof u=="object"?u.enabled===!1:u===!1,Pa=E&&!Ya&&!Ps;return typeof u=="object"?{...u,enabled:Pa}:{enabled:Pa}}}),Gvn=(0,Oe.createContext)(null),mHt="button",Yvn="Draggable";function MHt(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=YD(Yvn),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,Oe.useContext)(dle),{role:p=mHt,roleDescription:m="draggable",tabIndex:h=0}=o??{},b=u?.id===e,g=(0,Oe.useContext)(b?IHt:Gvn),[_,w]=I5(),[x,C]=I5(),E=Nvn(a,e),P=yU(r);vg(()=>(d.set(e,{id:e,key:i,node:_,activatorNode:x,data:P}),()=>{let I=d.get(e);I&&I.key===i&&d.delete(e)}),[d,e]);let A=(0,Oe.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":n,"aria-pressed":b&&p===mHt?!0:void 0,"aria-roledescription":m,"aria-describedby":c.draggable}),[n,p,h,b,m,c.draggable]);return{active:u,activatorEvent:s,activeNodeRect:l,attributes:A,isDragging:b,listeners:n?void 0:E,node:_,over:f,setNodeRef:w,setActivatorNodeRef:C,transform:g}}function RHt(){return(0,Oe.useContext)(AHt)}var Zvn="Droppable",Xvn={timeout:25};function jHt(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=YD(Zvn),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,Oe.useContext)(dle),c=(0,Oe.useRef)({disabled:r}),d=(0,Oe.useRef)(!1),f=(0,Oe.useRef)(null),p=(0,Oe.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:b}={...Xvn,...o},g=yU(h??n),_=(0,Oe.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(g.current)?g.current:[g.current]),p.current=null},b)},[b]),w=cle({callback:_,disabled:m||!a}),x=(0,Oe.useCallback)((A,I)=>{w&&(I&&(w.unobserve(I),d.current=!1),A&&w.observe(A))},[w]),[C,E]=I5(x),P=yU(e);return(0,Oe.useEffect)(()=>{!w||!C.current||(w.disconnect(),d.current=!1,w.observe(C.current))},[C,w]),(0,Oe.useEffect)(()=>(s({type:Tl.RegisterDroppable,element:{id:n,key:i,disabled:r,node:C,rect:f,data:P}}),()=>s({type:Tl.UnregisterDroppable,key:i,id:n})),[n]),(0,Oe.useEffect)(()=>{r!==c.current.disabled&&(s({type:Tl.SetDroppableDisabled,id:n,key:i,disabled:r}),c.current.disabled=r)},[n,i,r,s]),{active:a,rect:f,isOver:u?.id===n,node:C,over:u,setNodeRef:E}}var Cs=$(Y());function vU(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function Qvn(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function fle(t){return t!==null&&t>=0}function ewn(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 twn(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}var DHt=t=>{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=vU(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 ple={scaleX:1,scaleY:1},$5=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,...ple}:null}let u=rwn(i,o,r);return o>r&&o<=a?{x:0,y:-s.height-u,...ple}:o<r&&o>=a?{x:0,y:s.height+u,...ple}:{x:0,y:0,...ple}};function rwn(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 NHt="Sortable",LHt=Cs.default.createContext({activeIndex:-1,containerId:NHt,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:DHt,disabled:{draggable:!1,droppable:!1}});function B5(t){let{children:e,id:r,items:n,strategy:o=DHt,disabled:i=!1}=t,{active:a,dragOverlay:s,droppableRects:u,over:l,measureDroppableContainers:c}=RHt(),d=YD(NHt,r),f=s.rect!==null,p=(0,Cs.useMemo)(()=>n.map(E=>typeof E=="object"&&"id"in E?E.id:E),[n]),m=a!=null,h=a?p.indexOf(a.id):-1,b=l?p.indexOf(l.id):-1,g=(0,Cs.useRef)(p),_=!ewn(p,g.current),w=b!==-1&&h===-1||_,x=twn(i);vg(()=>{_&&m&&c(p)},[_,p,m,c]),(0,Cs.useEffect)(()=>{g.current=p},[p]);let C=(0,Cs.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:w,items:p,overIndex:b,useDragOverlay:f,sortedRects:Qvn(p,u),strategy:o}),[h,d,x.draggable,x.droppable,w,p,b,u,f,o]);return Cs.default.createElement(LHt.Provider,{value:C},e)}var nwn=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return vU(r,n,o).indexOf(e)},own=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},iwn={duration:200,easing:"ease"},FHt="transform",awn=Ky.Transition.toString({property:FHt,duration:0,easing:"linear"}),swn={roleDescription:"sortable"};function uwn(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,Cs.useState)(null),s=(0,Cs.useRef)(r);return vg(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=nN(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,Cs.useEffect)(()=>{i&&a(null)},[i]),i}function q5(t){let{animateLayoutChanges:e=own,attributes:r,disabled:n,data:o,getNewIndex:i=nwn,id:a,strategy:s,resizeObserverConfig:u,transition:l=iwn}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:b,useDragOverlay:g,strategy:_}=(0,Cs.useContext)(LHt),w=lwn(n,p),x=c.indexOf(a),C=(0,Cs.useMemo)(()=>({sortable:{containerId:d,index:x,items:c},...o}),[d,o,x,c]),E=(0,Cs.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:P,node:A,isOver:I,setNodeRef:R}=jHt({id:a,data:C,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...u}}),{active:j,activatorEvent:D,activeNodeRect:k,attributes:F,setNodeRef:B,listeners:q,isDragging:W,over:H,setActivatorNodeRef:L,transform:z}=MHt({id:a,data:C,attributes:{...swn,...r},disabled:w.draggable}),K=Y3t(R,B),J=!!j,ee=J&&!m&&fle(f)&&fle(b),Pe=!g&&W,G=Pe&&ee?z:null,ie=ee?G??(s??_)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:b,index:x}):null,Ie=fle(f)&&fle(b)?i({id:a,items:c,activeIndex:f,overIndex:b}):x,st=j?.id,Te=(0,Cs.useRef)({activeId:st,items:c,newIndex:Ie,containerId:d}),Qe=c!==Te.current.items,nt=e({active:j,containerId:d,isDragging:W,isSorting:J,id:a,index:x,items:c,newIndex:Te.current.newIndex,previousItems:Te.current.items,previousContainerId:Te.current.containerId,transition:l,wasDragging:Te.current.activeId!=null}),Ht=uwn({disabled:!nt,index:x,node:A,rect:P});return(0,Cs.useEffect)(()=>{J&&Te.current.newIndex!==Ie&&(Te.current.newIndex=Ie),d!==Te.current.containerId&&(Te.current.containerId=d),c!==Te.current.items&&(Te.current.items=c)},[J,Ie,d,c]),(0,Cs.useEffect)(()=>{if(st===Te.current.activeId)return;if(st!=null&&Te.current.activeId==null){Te.current.activeId=st;return}let ht=setTimeout(()=>{Te.current.activeId=st},50);return()=>clearTimeout(ht)},[st]),{active:j,activeIndex:f,attributes:F,data:C,rect:P,index:x,newIndex:Ie,items:c,isOver:I,isSorting:J,isDragging:W,listeners:q,node:A,overIndex:b,over:H,setNodeRef:K,setActivatorNodeRef:L,setDroppableNodeRef:R,setDraggableNodeRef:B,transform:Ht??ie,transition:Me()};function Me(){if(Ht||Qe&&Te.current.newIndex===x)return awn;if(!(Pe&&!M5(D)||!l)&&(J||nt))return Ky.Transition.toString({...l,property:FHt})}}function lwn(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 mle(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 cwn=[Dn.Down,Dn.Right,Dn.Up,Dn.Left],hle=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(cwn.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 Dn.Down:n.top<f.top&&u.push(d);break;case Dn.Up:n.top>f.top&&u.push(d);break;case Dn.Left:n.left>f.left&&u.push(d);break;case Dn.Right:n.left<f.left&&u.push(d);break}});let l=bHt({active:r,collisionRect:n,droppableRects:o,droppableContainers:u,pointerCoordinates:null}),c=WNe(l,"id");if(c===a?.id&&l.length>1&&(c=l[1].id),c!=null){let d=i.get(r.id),f=i.get(c),p=f?o.get(f.id):null,m=f?.node.current;if(m&&p&&d&&f){let b=F5(m).some((E,P)=>s[P]!==E),g=kHt(d,f),_=dwn(d,f),w=b||!g?{x:0,y:0}:{x:_?n.width-p.width:0,y:_?n.height-p.height:0},x={x:p.left,y:p.top};return w.x&&w.y?x:XD(x,w)}}}};function kHt(t,e){return!mle(t)||!mle(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function dwn(t,e){return!mle(t)||!mle(e)||!kHt(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}var gle=$(Y()),KNe=(0,gle.createContext)(null),$Ht=()=>(0,gle.useContext)(KNe);var fwn=({command:t,onUpdate:e,onRemove:r,onDuplicate:n})=>{let{attributes:o,listeners:i,setNodeRef:a,transform:s,transition:u,isDragging:l}=q5({id:t.name}),c={transform:Ky.Transform.toString(s),transition:u},d=$Ht();return Ir.default.createElement(KD,{ref:a,style:c,className:Ce("tw-transition-colors",l&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50")},Ir.default.createElement($p,{className:"tw-w-10"},Ir.default.createElement("div",{...o,...i,className:"tw-flex tw-cursor-grab tw-items-center tw-justify-center"},Ir.default.createElement(PE,{className:"tw-size-4"}))),Ir.default.createElement($p,null,t.name),Ir.default.createElement($p,{className:"tw-text-center"},Ir.default.createElement(Nf,{checked:t.showInContextMenu,onCheckedChange:f=>e(t,{...t,showInContextMenu:f===!0}),className:"tw-mx-auto"})),Ir.default.createElement($p,{className:"tw-text-center"},Ir.default.createElement("div",{className:"tw-flex tw-justify-center tw-space-x-1"},Ir.default.createElement(he,{variant:"ghost",size:"icon",onClick:()=>new hU(app,t,f=>e(t,f),()=>r(t)).open()},Ir.default.createElement(qL,{className:"tw-size-4"})),Ir.default.createElement(SI,null,Ir.default.createElement(xI,{asChild:!0},Ir.default.createElement(he,{variant:"ghost",size:"icon"},Ir.default.createElement(CE,{className:"tw-size-4"}))),Ir.default.createElement(mg,{align:"end",container:d},Ir.default.createElement(Ho,{onClick:()=>new hU(app,t,f=>e(t,f),()=>r(t)).open()},Ir.default.createElement(qL,{className:"tw-mr-2 tw-size-4"}),"Edit"),Ir.default.createElement(Ho,{onClick:()=>n(t)},Ir.default.createElement(Cb,{className:"tw-mr-2 tw-size-4"}),"Copy"),Ir.default.createElement(Ho,{onClick:()=>r(t),className:"tw-text-error"},Ir.default.createElement(nm,{className:"tw-mr-2 tw-size-4"}),"Delete"))))))},BHt=()=>{let t=BFt(),e=lle(_U(HI,{activationConstraint:{distance:8}}),_U(zI,{coordinateGetter:hle})),r=(a,s)=>{let u=t.findIndex(l=>l===a);u===-1?Je("inlineEditCommands",[...t,s]):Je("inlineEditCommands",[...t.slice(0,u),s,...t.slice(u+1)])},n=a=>{let s={...a,name:`${a.name} (copy)`},u=t.findIndex(l=>l===a);u!==-1&&Je("inlineEditCommands",[...t.slice(0,u+1),s,...t.slice(u+1)])},o=a=>{Je("inlineEditCommands",t.filter(s=>s!==a))},i=a=>{let{active:s,over:u}=a;if(u&&s.id!==u.id){let l=t.findIndex(d=>d.name===s.id),c=t.findIndex(d=>d.name===u.id);if(l!==-1&&c!==-1){let d=vU(t,l,c);Je("inlineEditCommands",d)}}};return Ir.default.createElement("div",{className:"tw-space-y-4"},Ir.default.createElement("section",null,Ir.default.createElement("div",{className:"tw-mb-4 tw-flex tw-flex-col tw-gap-2"},Ir.default.createElement("div",{className:"tw-text-xl tw-font-bold"},"Custom Commands"),Ir.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"To trigger a custom command, highlight text in the editor and select it from the command palette, or right-click and choose it from the context menu if configured.")),!qFt()&&Ir.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-4 tw-text-muted"},Ir.default.createElement(sC,{className:"tw-size-5"})," Take control of your inline edit commands! You can now create your own or edit built-in ones to tailor functionality to your needs."),Ir.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Ir.default.createElement(k5,{sensors:e,collisionDetection:L5,onDragEnd:i},Ir.default.createElement(P5,null,Ir.default.createElement(E5,null,Ir.default.createElement(KD,null,Ir.default.createElement(kp,{className:"tw-w-10"}),Ir.default.createElement(kp,null,"Name"),Ir.default.createElement(kp,{className:"tw-w-20 tw-text-center"},"In Menu"),Ir.default.createElement(kp,{className:"tw-w-10"}))),Ir.default.createElement(B5,{items:t.map(a=>a.name),strategy:$5},Ir.default.createElement(T5,null,t.map(a=>Ir.default.createElement(fwn,{key:a.name,command:a,onUpdate:r,onRemove:o,onDuplicate:n})))))),Ir.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end"},Ir.default.createElement(he,{variant:"secondary",onClick:()=>new hU(app,{name:"",prompt:"",showInContextMenu:!1},a=>r(a,a)).open()},Ir.default.createElement(Hg,{className:"tw-size-4"})," Add Command")))))};var Nn=$(Y());var aa=$(Y());var zm=$(Y());mo();yn();function lx({value:t,onChange:e,placeholder:r,disabled:n,className:o}){let[i,a]=(0,zm.useState)(!1),s=(0,zm.useRef)(null),u=(0,zm.useRef)(!0);return(0,zm.useEffect)(()=>{(async()=>{if(u.current&&t&&s.current){try{s.current.value=await Wn(t)}catch(c){fe("Failed to decrypt value:"+En(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),zm.default.createElement("div",{className:Ce("tw-relative",o)},zm.default.createElement(io,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:Ce("tw-w-full !tw-pr-7")}),zm.default.createElement("div",{onClick:()=>!n&&a(!i),className:Ce("tw-absolute tw-inset-y-0 tw-right-2 tw-flex tw-items-center tw-justify-center","tw-cursor-pointer",n&&"tw-cursor-not-allowed tw-opacity-50"),role:"button","aria-label":i?"Hide password":"Show password"},i?zm.default.createElement(k2,{className:Ce("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")}):zm.default.createElement(iC,{className:Ce("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")})))}var nd=$(Y());var qi=$(Y(),1);function cx(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var UHt=$(Y(),1);function qHt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function JNe(...t){return e=>{let r=!1,n=t.map(o=>{let i=qHt(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():qHt(t[o],null)}}}}function vP(...t){return UHt.useCallback(JNe(...t),t)}var Ga=$(Y(),1);var zHt=$(Y(),1),HHt=$(Ms(),1);var rd=$(Y(),1);var wU=$(St(),1),U5=rd.forwardRef((t,e)=>{let{children:r,...n}=t,o=rd.Children.toArray(r),i=o.find(mwn);if(i){let a=i.props.children,s=o.map(u=>u===i?rd.Children.count(a)>1?rd.Children.only(null):rd.isValidElement(a)?a.props.children:null:u);return(0,wU.jsx)(GNe,{...n,ref:e,children:rd.isValidElement(a)?rd.cloneElement(a,void 0,s):null})}return(0,wU.jsx)(GNe,{...n,ref:e,children:r})});U5.displayName="Slot";var GNe=rd.forwardRef((t,e)=>{let{children:r,...n}=t;if(rd.isValidElement(r)){let o=gwn(r);return rd.cloneElement(r,{...hwn(n,r.props),ref:e?JNe(e,o):o})}return rd.Children.count(r)>1?rd.Children.only(null):null});GNe.displayName="SlotClone";var pwn=({children:t})=>(0,wU.jsx)(wU.Fragment,{children:t});function mwn(t){return rd.isValidElement(t)&&t.type===pwn}function hwn(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 gwn(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 VHt=$(St(),1),ywn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Hm=ywn.reduce((t,e)=>{let r=zHt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?U5:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,VHt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function WHt(t,e){t&&HHt.flushSync(()=>t.dispatchEvent(e))}var ZNe=$(St(),1),bwn="DismissableLayer",YNe="dismissableLayer.update",_wn="dismissableLayer.pointerDownOutside",vwn="dismissableLayer.focusOutside",KHt,GHt=Ga.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),XNe=Ga.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ga.useContext(GHt),[c,d]=Ga.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ga.useState({}),m=vP(e,P=>d(P)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,C=xwn(P=>{let A=P.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),E=Cwn(P=>{let A=P.target;[...l.branches].some(R=>R.contains(A))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return ox(P=>{_===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),Ga.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(KHt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),JHt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=KHt)}},[c,f,r,l]),Ga.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),JHt())},[c,l]),Ga.useEffect(()=>{let P=()=>p({});return document.addEventListener(YNe,P),()=>document.removeEventListener(YNe,P)},[]),(0,ZNe.jsx)(Hm.div,{...u,ref:m,style:{pointerEvents:w?x?"auto":"none":void 0,...t.style},onFocusCapture:cx(t.onFocusCapture,E.onFocusCapture),onBlurCapture:cx(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:cx(t.onPointerDownCapture,C.onPointerDownCapture)})});XNe.displayName=bwn;var wwn="DismissableLayerBranch",Swn=Ga.forwardRef((t,e)=>{let r=Ga.useContext(GHt),n=Ga.useRef(null),o=vP(e,n);return Ga.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,ZNe.jsx)(Hm.div,{...t,ref:o})});Swn.displayName=wwn;function xwn(t,e=globalThis?.document){let r=hr(t),n=Ga.useRef(!1),o=Ga.useRef(()=>{});return Ga.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){YHt(_wn,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 Cwn(t,e=globalThis?.document){let r=hr(t),n=Ga.useRef(!1);return Ga.useEffect(()=>{let o=i=>{i.target&&!n.current&&YHt(vwn,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 JHt(){let t=new CustomEvent(YNe);document.dispatchEvent(t)}function YHt(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?WHt(o,i):o.dispatchEvent(i)}var Sg=$(Y(),1);var tVt=$(St(),1),QNe="focusScope.autoFocusOnMount",eLe="focusScope.autoFocusOnUnmount",ZHt={bubbles:!1,cancelable:!0},Own="FocusScope",tLe=Sg.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Sg.useState(null),l=hr(o),c=hr(i),d=Sg.useRef(null),f=vP(e,h=>u(h)),p=Sg.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Sg.useEffect(()=>{if(n){let _=function(E){if(p.paused||!s)return;let P=E.target;s.contains(P)?d.current=P:VI(d.current,{select:!0})},w=function(E){if(p.paused||!s)return;let P=E.relatedTarget;P!==null&&(s.contains(P)||VI(d.current,{select:!0}))},x=function(E){if(document.activeElement===document.body)for(let A of E)A.removedNodes.length>0&&VI(s)};var h=_,b=w,g=x;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(x);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),Sg.useEffect(()=>{if(s){QHt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(QNe,ZHt);s.addEventListener(QNe,l),s.dispatchEvent(g),g.defaultPrevented||(Pwn(Mwn(rVt(s)),{select:!0}),document.activeElement===h&&VI(s))}return()=>{s.removeEventListener(QNe,l),setTimeout(()=>{let g=new CustomEvent(eLe,ZHt);s.addEventListener(eLe,c),s.dispatchEvent(g),g.defaultPrevented||VI(h??document.body,{select:!0}),s.removeEventListener(eLe,c),QHt.remove(p)},0)}}},[s,l,c,p]);let m=Sg.useCallback(h=>{if(!r&&!n||p.paused)return;let b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(b&&g){let _=h.currentTarget,[w,x]=Ewn(_);w&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&VI(w,{select:!0})):h.shiftKey&&g===w&&(h.preventDefault(),r&&VI(x,{select:!0})):g===_&&h.preventDefault()}},[r,n,p.paused]);return(0,tVt.jsx)(Hm.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});tLe.displayName=Own;function Pwn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(VI(n,{select:e}),document.activeElement!==r)return}function Ewn(t){let e=rVt(t),r=XHt(e,t),n=XHt(e.reverse(),t);return[r,n]}function rVt(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 XHt(t,e){for(let r of t)if(!Twn(r,{upTo:e}))return r}function Twn(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Awn(t){return t instanceof HTMLInputElement&&"select"in t}function VI(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Awn(t)&&e&&t.select()}}var QHt=Iwn();function Iwn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=eVt(t,e),t.unshift(e)},remove(e){t=eVt(t,e),t[0]?.resume()}}}function eVt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function Mwn(t){return t.filter(e=>e.tagName!=="A")}var yle=$(Y(),1),nVt=$(Ms(),1);var oVt=$(St(),1),Rwn="Portal",rLe=yle.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=yle.useState(!1);dn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?nVt.default.createPortal((0,oVt.jsx)(Hm.div,{...n,ref:e}),a):null});rLe.displayName=Rwn;var Ci=$(St(),1),nLe="Dialog",[iVt,iui]=ii(nLe),[jwn,Gy]=iVt(nLe),aVt=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=qi.useRef(null),u=qi.useRef(null),[l=!1,c]=Cl({prop:n,defaultProp:o,onChange:i});return(0,Ci.jsx)(jwn,{scope:e,triggerRef:s,contentRef:u,contentId:us(),titleId:us(),descriptionId:us(),open:l,onOpenChange:c,onOpenToggle:qi.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};aVt.displayName=nLe;var sVt="DialogTrigger",uVt=qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Gy(sVt,r),i=vP(e,o.triggerRef);return(0,Ci.jsx)(Hm.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":aLe(o.open),...n,ref:i,onClick:cx(t.onClick,o.onOpenToggle)})});uVt.displayName=sVt;var oLe="DialogPortal",[Dwn,lVt]=iVt(oLe,{forceMount:void 0}),cVt=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=Gy(oLe,e);return(0,Ci.jsx)(Dwn,{scope:e,forceMount:r,children:qi.Children.map(n,a=>(0,Ci.jsx)(rl,{present:r||i.open,children:(0,Ci.jsx)(rLe,{asChild:!0,container:o,children:a})}))})};cVt.displayName=oLe;var ble="DialogOverlay",dVt=qi.forwardRef((t,e)=>{let r=lVt(ble,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=Gy(ble,t.__scopeDialog);return i.modal?(0,Ci.jsx)(rl,{present:n||i.open,children:(0,Ci.jsx)(Nwn,{...o,ref:e})}):null});dVt.displayName=ble;var Nwn=qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Gy(ble,r);return(0,Ci.jsx)(S5,{as:U5,allowPinchZoom:!0,shards:[o.contentRef],children:(0,Ci.jsx)(Hm.div,{"data-state":aLe(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),oN="DialogContent",fVt=qi.forwardRef((t,e)=>{let r=lVt(oN,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=Gy(oN,t.__scopeDialog);return(0,Ci.jsx)(rl,{present:n||i.open,children:i.modal?(0,Ci.jsx)(Lwn,{...o,ref:e}):(0,Ci.jsx)(Fwn,{...o,ref:e})})});fVt.displayName=oN;var Lwn=qi.forwardRef((t,e)=>{let r=Gy(oN,t.__scopeDialog),n=qi.useRef(null),o=vP(e,r.contentRef,n);return qi.useEffect(()=>{let i=n.current;if(i)return _I(i)},[]),(0,Ci.jsx)(pVt,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:cx(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:cx(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:cx(t.onFocusOutside,i=>i.preventDefault())})}),Fwn=qi.forwardRef((t,e)=>{let r=Gy(oN,t.__scopeDialog),n=qi.useRef(!1),o=qi.useRef(!1);return(0,Ci.jsx)(pVt,{...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()}})}),pVt=qi.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=Gy(oN,r),u=qi.useRef(null),l=vP(e,u);return aI(),(0,Ci.jsxs)(Ci.Fragment,{children:[(0,Ci.jsx)(tLe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Ci.jsx)(XNe,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":aLe(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,Ci.jsxs)(Ci.Fragment,{children:[(0,Ci.jsx)(kwn,{titleId:s.titleId}),(0,Ci.jsx)(Bwn,{contentRef:u,descriptionId:s.descriptionId})]})]})}),iLe="DialogTitle",mVt=qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Gy(iLe,r);return(0,Ci.jsx)(Hm.h2,{id:o.titleId,...n,ref:e})});mVt.displayName=iLe;var hVt="DialogDescription",gVt=qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Gy(hVt,r);return(0,Ci.jsx)(Hm.p,{id:o.descriptionId,...n,ref:e})});gVt.displayName=hVt;var yVt="DialogClose",bVt=qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Gy(yVt,r);return(0,Ci.jsx)(Hm.button,{type:"button",...n,ref:e,onClick:cx(t.onClick,()=>o.onOpenChange(!1))})});bVt.displayName=yVt;function aLe(t){return t?"open":"closed"}var _Vt="DialogTitleWarning",[aui,vVt]=YFt(_Vt,{contentName:oN,titleName:iLe,docsSlug:"dialog"}),kwn=({titleId:t})=>{let e=vVt(_Vt),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return qi.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},$wn="DialogDescriptionWarning",Bwn=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${vVt($wn).contentName}}.`;return qi.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},wVt=aVt,SVt=uVt,xVt=cVt,sLe=dVt,uLe=fVt,lLe=mVt,cLe=gVt,CVt=bVt;var SU=wVt,OVt=SVt,Uwn=xVt;var PVt=nd.forwardRef(({className:t,...e},r)=>nd.createElement(sLe,{ref:r,className:Ce("tw-fixed tw-inset-0 tw-z-modal data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0","tw-bg-overlay/50",t),...e}));PVt.displayName=sLe.displayName;var iN=nd.forwardRef(({className:t,children:e,container:r,...n},o)=>nd.createElement(Uwn,{container:r},nd.createElement(PVt,null),nd.createElement(uLe,{ref:o,className:Ce("tw-fixed tw-left-1/2 tw-top-1/2 tw-z-modal tw-grid tw-w-full tw-max-w-lg -tw-translate-x-1/2 -tw-translate-y-1/2 tw-gap-4 tw-border tw-bg-primary tw-p-6 tw-shadow-lg tw-duration-200 data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[state=closed]:tw-slide-out-to-left-1/2 data-[state=closed]:tw-slide-out-to-top-[48%] data-[state=open]:tw-slide-in-from-left-1/2 data-[state=open]:tw-slide-in-from-top-[48%] sm:tw-rounded-lg",t),...n},e,nd.createElement(CVt,{className:"clickable-icon tw-absolute tw-right-4 tw-top-4 tw-border-none tw-bg-transparent tw-text-faint tw-outline-none hover:tw-bg-transparent hover:tw-bg-opacity-100 hover:tw-text-normal focus-visible:tw-text-normal focus-visible:tw-outline-none focus-visible:tw-ring-0"},nd.createElement(Ia,{className:"tw-size-4"}),nd.createElement("span",{className:"tw-sr-only"},"Close")))));iN.displayName=uLe.displayName;var aN=({className:t,...e})=>nd.createElement("div",{className:Ce("tw-flex tw-flex-col tw-space-y-0.5 tw-text-center sm:tw-text-left",t),...e});aN.displayName="DialogHeader";var zwn=({className:t,...e})=>nd.createElement("div",{className:Ce("tw-flex tw-flex-col-reverse sm:tw-flex-row sm:tw-justify-end sm:tw-space-x-2",t),...e});zwn.displayName="DialogFooter";var sN=nd.forwardRef(({className:t,...e},r)=>nd.createElement(lLe,{ref:r,className:Ce("tw-mt-0 tw-text-lg tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));sN.displayName=lLe.displayName;var uN=nd.forwardRef(({className:t,...e},r)=>nd.createElement(cLe,{ref:r,className:Ce("tw-text-sm tw-text-muted",t),...e}));uN.displayName=cLe.displayName;yn();function tn(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=$I(),a="onChange"in t?t.onChange:void 0,s=(0,aa.useMemo)(()=>{if(a)return V9(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return aa.default.createElement(io,{type:t.type,defaultValue:t.value,onChange:l=>{s?.(l.target.value)},placeholder:t.placeholder,disabled:o,className:"tw-w-full sm:tw-w-[200px]"});case"password":return aa.default.createElement(lx,{value:t.value!==void 0?String(t.value):void 0,onChange:l=>{s?.(l)},placeholder:t.placeholder,disabled:o,className:"tw-w-full sm:tw-w-[200px]"});case"textarea":return aa.default.createElement(Ry,{defaultValue:t.value,onChange:l=>{s?.(l.target.value)},placeholder:t.placeholder,rows:t.rows||3,disabled:o,className:"tw-min-h-[80px] tw-w-full sm:tw-w-[300px]"});case"switch":return aa.default.createElement(qq,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return aa.default.createElement("div",{className:"tw-group tw-relative tw-w-full sm:tw-w-[200px]"},aa.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:Ce("tw-w-full tw-appearance-none","tw-flex tw-h-9 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-dropdown tw-px-3 tw-py-1 tw-pr-8","tw-text-sm !tw-shadow tw-transition-colors","focus:tw-outline-none focus:tw-ring-1 focus:tw-ring-ring","disabled:tw-cursor-not-allowed disabled:tw-opacity-50","hover:tw-bg-interactive-hover hover:tw-text-normal")},t.placeholder&&aa.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>aa.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),aa.default.createElement("div",{className:Ce("tw-pointer-events-none tw-absolute tw-inset-y-0 tw-right-0 tw-flex tw-items-center tw-pr-2","tw-transition-colors group-hover:[&>svg]:tw-text-normal",o&&"tw-opacity-50")},aa.default.createElement(Di,{className:"tw-size-4"})));case"slider":return aa.default.createElement(b5,{value:t.value||0,onChange:t.onChange,min:t.min,max:t.max,step:t.step,disabled:o,className:"tw-w-full sm:tw-w-[300px]"});case"dialog":return aa.default.createElement(SU,null,aa.default.createElement(OVt,{asChild:!0},t.trigger),aa.default.createElement(iN,{container:i},(t.dialogTitle||t.dialogDescription)&&aa.default.createElement(aN,null,t.dialogTitle&&aa.default.createElement(sN,null,t.dialogTitle),t.dialogDescription&&aa.default.createElement(uN,null,t.dialogDescription)),t.children));case"custom":return t.children}};return aa.default.createElement("div",{className:Ce("tw-flex tw-flex-col tw-items-start tw-justify-between tw-gap-4 tw-py-4 sm:tw-flex-row sm:tw-items-center","tw-w-full",n)},aa.default.createElement("div",{className:"tw-w-full tw-space-y-1.5 sm:tw-w-[300px]"},aa.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-leading-none"},e),r&&aa.default.createElement("div",{className:"tw-text-xs tw-text-muted"},r)),aa.default.createElement("div",{className:"tw-w-full tw-flex-1 sm:tw-flex sm:tw-justify-end"},u()))}Jt();Rz();var wP=$(Y()),EVt=()=>{let t=Pn();return wP.default.createElement("div",{className:"tw-space-y-4"},wP.default.createElement("section",null,wP.default.createElement(tn,{type:"textarea",title:"User System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!",value:t.userSystemPrompt,onChange:e=>Je("userSystemPrompt",e),placeholder:"Enter your system prompt here..."}),wP.default.createElement("div",{className:"tw-space-y-4"},wP.default.createElement(tn,{type:"switch",title:"Custom Prompt Templating",description:"Enable templating to process variables like {activenote}, {foldername} or {#tag} in prompts. Disable to use raw prompts without any processing.",checked:t.enableCustomPromptTemplating,onCheckedChange:e=>{Je("enableCustomPromptTemplating",e)}}),wP.default.createElement(tn,{type:"select",title:"Custom Prompts Sort Strategy",description:"Choose how to sort custom prompts (by recent usage or alphabetically)",value:t.promptSortStrategy,onChange:e=>Je("promptSortStrategy",e),options:[{label:"Recency",value:"timestamp"},{label:"Alphabetical",value:"alphabetical"}]}),wP.default.createElement(tn,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:e=>{Je("enableEncryption",e)}}),wP.default.createElement(tn,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:e=>{Je("debug",e)}}))))};pf();var xU=class extends Dy{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")}};Zr();Jt();var il=$(Y()),TVt=require("obsidian"),AVt=$(_c());Jt();function Hwn({onConfirm:t,onCancel:e}){let r=ne();return il.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},il.default.createElement("div",null,il.default.createElement("p",null,"Thanks for purchasing ",il.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!"),il.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),il.default.createElement("ul",{className:"tw-pl-4"},il.default.createElement("li",null,"Default mode: ",il.default.createElement("b",{className:"tw-text-accent"},"Copilot Plus")),il.default.createElement("li",null,"Chat model: ",il.default.createElement("b",{className:"tw-text-accent"},YEe)),il.default.createElement("li",null,il.default.createElement("div",null,"Embedding model:"," ",il.default.createElement("b",{className:"tw-text-accent"},ZEe)),r.embeddingModelKey!==XEe&&il.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-warning"},il.default.createElement(yf,{className:"tw-size-4"})," It will rebuild your embeddings for the entire vault")))),il.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},il.default.createElement(he,{variant:"ghost",onClick:e},"Apply Later"),il.default.createElement(he,{variant:"default",onClick:t},"Apply Now")))}var _le=class extends TVt.Modal{constructor(e){super(e),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:e}=this;this.root=(0,AVt.createRoot)(e);let r=()=>{DCt(),this.close()},n=()=>{this.close()};this.root.render(il.default.createElement(Hwn,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};Zr();Jt();var Os=$(Y());function IVt(){let t=Pn(),[e,r]=(0,Os.useState)(null),[n,o]=(0,Os.useState)(!1),i=rB(),[a,s]=(0,Os.useState)(t.plusLicenseKey);return(0,Os.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),Os.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4 tw-rounded-lg tw-bg-secondary tw-p-4"},Os.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-text-xl tw-font-bold"},Os.default.createElement("span",null,"Copilot Plus (beta)"),i&&Os.default.createElement(km,{variant:"outline",className:"tw-text-success"},"Active")),Os.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-text-sm tw-text-muted"},Os.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."),Os.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!")),Os.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Os.default.createElement(lx,{className:"tw-w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),Os.default.createElement(he,{disabled:n,onClick:async()=>{Je("plusLicenseKey",a),o(!0);let u=await Pre();o(!1),u?(r(null),new _le(app).open()):r("Invalid license key")},className:"tw-min-w-20"},n?Os.default.createElement(Ll,{className:"tw-size-4 tw-animate-spin"}):"Apply"),Os.default.createElement(he,{variant:"secondary",onClick:()=>uR(zx.SETTINGS)},"Join Now ",Os.default.createElement(rR,{className:"tw-size-4"}))),Os.default.createElement("div",{className:"tw-text-error"},e))}yn();var CU=require("obsidian"),Ue=$(Y());Zr();mo();Jt();Zr();var Vwn={openai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"openai"}))||[],google:t=>t.models?.map(e=>{let r=e.name.split("models/")?.[1];return{id:r,name:r,provider:"google"}})||[],anthropic:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"anthropic"}))||[],mistralai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"mistralai"}))||[],cohereai:t=>t.models?.map(e=>({id:e.name,name:e.name,provider:"cohereai"}))||[],deepseek:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"deepseek"}))||[],groq:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"groq"}))||[],xai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"xai"}))||[],openrouterai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"openrouterai"}))||[]},Wwn=t=>e=>e.data&&Array.isArray(e.data)?e.data.map(r=>({id:r.id||r.name||String(Math.random()),name:r.name||r.id||r.display_name||"Unknown Model",provider:t})):e.models&&Array.isArray(e.models)?e.models.map(r=>({id:r.id||r.name||String(Math.random()),name:r.name||r.displayName||r.id||"Unknown Model",provider:t})):Array.isArray(e)?e.map(r=>({id:r.id||r.name||String(Math.random()),name:r.name||r.id||"Unknown Model",provider:t})):[],Kwn=t=>Vwn[t]||Wwn(t),MVt=(t,e)=>{let r=Kwn(t);try{return r(e)}catch(n){return console.error(`Error parsing ${t} model data:`,n),[]}};yn();var Yy=require("obsidian"),Dt=$(Y()),RVt=$(_c());function Jwn({onClose:t}){let e=Pn(),[r,n]=(0,Dt.useState)(new Set),[o,i]=(0,Dt.useState)(new Set),[a,s]=(0,Dt.useState)(null),[u,l]=(0,Dt.useState)({}),[c,d]=(0,Dt.useState)(null),[f,p]=(0,Dt.useState)(null),[m,h]=(0,Dt.useState)(null),[b,g]=(0,Dt.useState)(!1),_=(0,Dt.useRef)(o);(0,Dt.useEffect)(()=>{_.current=o},[o]),(0,Dt.useEffect)(()=>(i(new Set),s(null),h(null),()=>{_.current.forEach(I=>{let R=db[I];Je(R,"")})}),[]);let w=I=>{let R=db[I];return e[R]??""},x=Wfe().map(I=>{let R=I,j=w(R);return{provider:R,apiKey:j,isVerified:!!j&&!o.has(R)}}),C=(I,R)=>{w(I)!==R&&(Je(db[I],R),i(D=>new Set(D).add(I)),l(D=>({...D,[I]:void 0})),p(D=>D===I?null:D))},E=async(I,R)=>{n(j=>new Set(j).add(I));try{ae(`Verifying ${I} API key`);let j=cb(I).testModel;if(!j){new Yy.Notice("API key verification failed: No default test model found for the selected provider.",1e4);return}let D={name:j,provider:I,apiKey:R,enabled:!0};await Hl.instance.getCurrentChainManager().chatModelManager.ping(D),new Yy.Notice("API key verified successfully!"),i(k=>{let F=new Set(k);return F.delete(I),F})}catch(j){console.error("API key verification failed:",j),new Yy.Notice("API key verification failed: "+En(j),1e4)}finally{n(j=>{let D=new Set(j);return D.delete(I),D})}},P=async(I,R)=>{d(I),p(null);try{R=await Wn(R);let j=cb(I).listModelURL,D={Authorization:`Bearer ${R}`};I==="google"?(j+=`?key=${R}`,D={}):I==="anthropic"&&(D={"x-api-key":R,"anthropic-version":"2023-06-01"});let k=async W=>{let H=new AbortController,L=setTimeout(()=>H.abort(),3e3);try{let z=await(W?As:fetch)(j,{headers:D,signal:H.signal,method:"GET"});if(!z.ok){let K=En(await z.json());throw fe(K),new Error(`Failed to fetch models: ${z.statusText}
detail: `+K)}return z}finally{clearTimeout(L)}},F;try{F=await k(!1)}catch(W){console.log("First fetch attempt failed, trying with safeFetch...");try{F=await k(!0)}catch(H){let L=`
without CORS Error: `+En(W)+`
with CORS Error: `+En(H);throw new Error(L)}}let B=await F.json(),q=MVt(I,B);l(W=>({...W,[I]:q})),d(null)}catch(j){console.error(`Error fetching models for ${I}:`,j),p(I),d(null),new Yy.Notice(`Failed to load models for ${ff(I)}: ${En(j)}`,5e3)}},A=async()=>{if(!m){new Yy.Notice("Please select a model first");return}g(!0);try{let I=w(m.provider),R={name:m.name,provider:m.provider,apiKey:I,enabled:!0};if(await Hl.instance.getCurrentChainManager().chatModelManager.ping(R),e.activeModels.find(D=>D.name===m.name&&D.provider===m.provider))new Yy.Notice(`Model ${m.name} verified successfully! It already exists in your models list.`);else{let D=[...e.activeModels,R];Je("activeModels",D),new Yy.Notice(`Model ${m.name} verified successfully and added to your models list!`)}}catch(I){console.error("Model verification failed:",I),new Yy.Notice("Model verification failed: "+En(I),1e4)}finally{g(!1)}};return Dt.default.createElement("div",{className:"tw-max-h-[600px] tw-overflow-y-auto tw-p-4 sm:tw-max-w-[500px]"},Dt.default.createElement("div",{className:"tw-mb-4"},Dt.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"AI Provider Settings"),Dt.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Configure your AI providers by adding their API keys.")),Dt.default.createElement("div",{className:"tw-space-y-6 tw-py-4"},Dt.default.createElement("div",{className:"tw-space-y-4"},x.map(I=>Dt.default.createElement(Dt.default.Fragment,{key:I.provider},Dt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Dt.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},Dt.default.createElement("div",{className:"tw-truncate"},ff(I.provider))),Dt.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},Dt.default.createElement("div",{className:"tw-flex-1"},Dt.default.createElement(lx,{className:"tw-max-w-full",value:I.apiKey,onChange:R=>C(I.provider,R),disabled:r.has(I.provider)})),Dt.default.createElement("div",{className:"tw-w-[72px]"},I.isVerified?Dt.default.createElement("span",{className:"tw-flex tw-h-9 tw-items-center tw-justify-center tw-text-sm tw-text-success"},"Verified"):Dt.default.createElement(he,{onClick:()=>E(I.provider,I.apiKey),disabled:!I.apiKey||r.size>0,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},r.has(I.provider)?Dt.default.createElement(Ll,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Verify")),Dt.default.createElement("div",{className:""},Dt.default.createElement(he,{onClick:()=>{let R=a===I.provider?null:I.provider;s(R),R&&I.apiKey&&u[I.provider]===void 0&&c!==I.provider&&f!==I.provider&&P(I.provider,I.apiKey)},disabled:!I.apiKey||r.size>0,variant:"secondary",size:"sm",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-1 tw-whitespace-nowrap tw-p-0.5"},"Add Model",a===I.provider?Dt.default.createElement(qg,{className:"tw-ml-1 tw-size-4"}):Dt.default.createElement(Di,{className:"tw-ml-1 tw-size-4"})))),Dt.default.createElement("div",null,cb(I.provider).keyManagementURL&&Dt.default.createElement("a",{href:cb(I.provider).keyManagementURL,target:"_blank",rel:"noopener noreferrer",className:"tw-text-[10px] tw-text-accent hover:tw-text-accent-hover sm:tw-text-xs"},"Get ",ff(I.provider)," Key"))),Dt.default.createElement(gP,{open:a===I.provider,className:"tw-mt-2"},Dt.default.createElement(yP,{className:"tw-rounded-md tw-p-3"},Dt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Dt.default.createElement(Vo,{label:"Model",description:"Add the currently selected model to model List. After adding, please check the Model Tab."},Dt.default.createElement("div",null,Dt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Dt.default.createElement("div",{className:"tw-flex-1"},Dt.default.createElement(Bue,{options:u[I.provider]?.sort((R,j)=>R.name.localeCompare(j.name)).map(R=>({label:R.name,value:R.id}))||[],onChange:R=>{let j=R.target.value,D=u[I.provider]?.find(k=>k.id===j);D&&h({id:D.id,name:D.name,provider:I.provider})},onClick:()=>{I.apiKey&&u[I.provider]===void 0&&c!==I.provider&&f!==I.provider&&P(I.provider,I.apiKey)},value:m?.provider===I.provider?m.id:"",placeholder:"Select Model",disabled:!I.apiKey||c===I.provider||f===I.provider&&u[I.provider]!==null})),Dt.default.createElement("div",{className:"tw-w-[72px]"},Dt.default.createElement(he,{onClick:A,disabled:!m||m.provider!==I.provider||b,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},b?Dt.default.createElement(Ll,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Add"))),Dt.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},c===I.provider&&Dt.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),f===I.provider&&Dt.default.createElement("div",{className:"tw-p-1 tw-text-error"},"Failed to load models.",u[I.provider]===null&&" Check API Key or network."),u[I.provider]&&u[I.provider].length===0&&Dt.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"No models available for this provider."),u[I.provider]===void 0&&f!==I.provider&&c!==I.provider&&Dt.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Click to load models or expand to try again if API key was changed."))))))))))),Dt.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end"},Dt.default.createElement(he,{onClick:t},"Close")))}var vle=class extends Yy.Modal{constructor(e){super(e)}onOpen(){let{contentEl:e}=this;this.root=(0,RVt.createRoot)(e),this.root.render(Dt.default.createElement(Jwn,{onClose:()=>this.close()}))}onClose(){this.root.unmount()}};var Ywn={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus (beta)",project:"Projects (alpha)"},jVt=()=>{let t=Pn(),[e,r]=(0,Ue.useState)(!1),[n,o]=(0,Ue.useState)(t.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),i=async l=>{l!==t.embeddingModelKey&&new xU(app,async()=>{Je("embeddingModelKey",l),await Li.getInstance().indexVaultToVectorStore(!0)}).open()},a=()=>{r(!0);try{let l=n||"{$date}_{$time}__{$topic}",d=["{$date}","{$time}","{$topic}"].filter(g=>!l.includes(g));if(d.length>0){new CU.Notice(`Error: Missing required variables: ${d.join(", ")}`,4e3);return}let f=/[\\/:*?"<>|]/,p=l.replace(/\{\$date}/g,"").replace(/\{\$time}/g,"").replace(/\{\$topic}/g,"");if(f.test(p)){new CU.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:m}=Ml(new Date),b=l.replace("{$topic}","test topic name".slice(0,100).replace(/\s+/g,"_")).replace("{$date}",m.split("_")[0]).replace("{$time}",m.split("_")[1]);Je("defaultConversationNoteName",l),o(l),new CU.Notice(`Format applied successfully! Example: ${b}`,4e3)}catch(l){new CU.Notice(`Error applying format: ${l.message}`,4e3)}finally{r(!1)}},s=!!t.activeModels.find(l=>l.enabled&&Dr(l)===t.defaultModelKey),u=t.activeModels.filter(l=>l.enabled).map(l=>({label:M6(l),value:Dr(l)}));return Ue.default.createElement("div",{className:"tw-space-y-4"},Ue.default.createElement(IVt,null),Ue.default.createElement("section",null,Ue.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"General"),Ue.default.createElement("div",{className:"tw-space-y-4"},Ue.default.createElement("div",{className:"tw-space-y-4"},Ue.default.createElement(tn,{type:"custom",title:"API Keys",description:Ue.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ue.default.createElement("span",{className:"tw-leading-none"},"Configure API keys for different AI providers"),Ue.default.createElement(xa,{delayDuration:0},Ue.default.createElement(Yt,null,Ue.default.createElement(Zt,{asChild:!0},Ue.default.createElement(fa,{className:"tw-size-4"})),Ue.default.createElement(Kt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},Ue.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"API key required for chat and QA features"),Ue.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"To enable chat and QA functionality, please provide an API key from your selected provider.")))))},Ue.default.createElement(he,{onClick:()=>{new vle(app).open()},variant:"secondary",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-2 sm:tw-w-auto sm:tw-justify-start"},"Set Keys",Ue.default.createElement(z2,{className:"tw-size-4"})))),Ue.default.createElement(tn,{type:"select",title:"Default Chat Model",description:"Select the Chat model to use",value:s?t.defaultModelKey:"Select Model",onChange:l=>{let c=t.activeModels.find(p=>p.enabled&&Dr(p)===l);if(!c)return;let{hasApiKey:d,errorNotice:f}=ZN(c,t);if(!d&&f){new CU.Notice(f);return}Je("defaultModelKey",l)},options:s?u:[{label:"Select Model",value:"Select Model"},...u],placeholder:"Model"}),Ue.default.createElement(tn,{type:"select",title:"Embedding Model",description:Ue.default.createElement("div",{className:"tw-space-y-2"},Ue.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ue.default.createElement("span",{className:"tw-font-medium tw-leading-none tw-text-accent"},"Core Feature: Powers Semantic Search & QA"),Ue.default.createElement(xa,{delayDuration:0},Ue.default.createElement(Yt,null,Ue.default.createElement(Zt,{asChild:!0},Ue.default.createElement(fa,{className:"tw-size-4"})),Ue.default.createElement(Kt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Ue.default.createElement("div",{className:"tw-pt-2 tw-text-sm tw-text-muted"},"This model converts text into vector representations, essential for semantic search and QA functionality. Changing the embedding model will:"),Ue.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Ue.default.createElement("li",null,"Require rebuilding your vault's vector index"),Ue.default.createElement("li",null,"Affect semantic search quality"),Ue.default.createElement("li",null,"Impact QA feature performance"))))))),value:t.embeddingModelKey,onChange:i,options:t.activeEmbeddingModels.map(l=>({label:M6(l),value:Dr(l)})),placeholder:"Model"}),Ue.default.createElement(tn,{type:"select",title:"Default Mode",description:Ue.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ue.default.createElement("span",{className:"tw-leading-none"},"Select the default chat mode"),Ue.default.createElement(xa,{delayDuration:0},Ue.default.createElement(Yt,null,Ue.default.createElement(Zt,{asChild:!0},Ue.default.createElement(fa,{className:"tw-size-4"})),Ue.default.createElement(Kt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Ue.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Ue.default.createElement("li",null,Ue.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",Ue.default.createElement("i",null,"Free to use with your own API key.")),Ue.default.createElement("li",null,Ue.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",Ue.default.createElement("i",null,"Free to use with your own API key.")),Ue.default.createElement("li",null,Ue.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"," ",Ue.default.createElement("a",{href:QEe(zx.MODE_SELECT_TOOLTIP),target:"_blank",rel:"noopener noreferrer",className:"tw-text-accent hover:tw-text-accent-hover"},"obsidiancopilot.com")," ","for more details.")))))),value:t.defaultChainType,onChange:l=>Je("defaultChainType",l),options:Object.entries(Ywn).map(([l,c])=>({label:c,value:l}))}),Ue.default.createElement(tn,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:t.defaultOpenArea,onChange:l=>Je("defaultOpenArea",l),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),Ue.default.createElement(tn,{type:"text",title:"Default Conversation Folder Name",description:"The default folder name where chat conversations will be saved. Default is 'copilot-conversations'",value:t.defaultSaveFolder,onChange:l=>Je("defaultSaveFolder",l),placeholder:"copilot-conversations"}),Ue.default.createElement(tn,{type:"text",title:"Custom Prompts Folder Name",description:"The default folder name where custom prompts will be saved. Default is 'copilot-custom-prompts'",value:t.customPromptsFolder,onChange:l=>Je("customPromptsFolder",l),placeholder:"copilot-custom-prompts"}),Ue.default.createElement(tn,{type:"text",title:"Default Conversation Tag",description:"The default tag to be used when saving a conversation. Default is 'ai-conversations'",value:t.defaultConversationTag,onChange:l=>Je("defaultConversationTag",l),placeholder:"ai-conversations"}),Ue.default.createElement(tn,{type:"custom",title:"Conversation Filename Template",description:Ue.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-1.5 "},Ue.default.createElement("span",{className:"tw-leading-none"},"Customize the format of saved conversation note names."),Ue.default.createElement(xa,{delayDuration:0},Ue.default.createElement(Yt,null,Ue.default.createElement(Zt,{asChild:!0},Ue.default.createElement(fa,{className:"tw-size-4"})),Ue.default.createElement(Kt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},Ue.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Note: All the following variables must be included in the template."),Ue.default.createElement("div",null,Ue.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-muted"},"Available variables:"),Ue.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Ue.default.createElement("li",null,Ue.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),Ue.default.createElement("li",null,Ue.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),Ue.default.createElement("li",null,Ue.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),Ue.default.createElement("i",{className:"tw-mt-2 tw-text-sm tw-text-muted"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]"))))))},Ue.default.createElement("div",{className:"tw-flex tw-w-[320px] tw-items-center tw-gap-1.5"},Ue.default.createElement(io,{type:"text",className:Ce("tw-min-w-[80px] tw-grow tw-transition-all tw-duration-200",e?"tw-w-[80px]":"tw-w-[120px]"),placeholder:"{$date}_{$time}__{$topic}",value:n,onChange:l=>o(l.target.value),disabled:e}),Ue.default.createElement(he,{onClick:()=>a(),disabled:e,variant:"secondary"},e?Ue.default.createElement(Ue.default.Fragment,null,Ue.default.createElement(Ll,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Apply"):"Apply"))),Ue.default.createElement(tn,{type:"switch",title:"Autosave Chat",description:"Automatically save the chat when starting a new one or when the plugin reloads",checked:t.autosaveChat,onCheckedChange:l=>Je("autosaveChat",l)}),Ue.default.createElement(tn,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:t.showSuggestedPrompts,onCheckedChange:l=>Je("showSuggestedPrompts",l)}),Ue.default.createElement(tn,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:t.showRelevantNotes,onCheckedChange:l=>Je("showRelevantNotes",l)}))))};Zr();Jt();var lN=require("obsidian"),zn=$(Y()),DVt=()=>{let t=Pn(),e=t.autocompleteAcceptKey||nh.KEYBIND,[r,n]=(0,zn.useState)(!1),o=[{value:"Tab",label:"Tab"},{value:"Space",label:"Space"},{value:"ArrowRight",label:"Right Arrow"}],i=u=>{Je("autocompleteAcceptKey",u),new lN.Notice(`Autocomplete accept key set to: ${u}`)},a=()=>{Je("autocompleteAcceptKey",nh.KEYBIND),new lN.Notice(`Autocomplete accept key reset to: ${nh.KEYBIND}`)},s=async()=>{if(!r){n(!0),new lN.Notice("Rebuilding word index...");try{let l=await bD.getInstance(app.vault).rescan(c=>{c.processedFiles===c.totalFiles&&new lN.Notice(`Word index complete! Found ${c.foundWords} words from ${c.processedFiles} files.`)});new lN.Notice(`Word index rebuilt successfully! ${l.wordCount} unique words indexed.`)}catch(u){console.error("Failed to refresh word index:",u),new lN.Notice("Failed to refresh word index. Check console for details.")}finally{n(!1)}}};return zn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},zn.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4"},zn.default.createElement("div",{className:"tw-flex tw-items-center tw-py-4"},zn.default.createElement(km,{variant:"secondary",className:"tw-text-accent"},"Plus Required")),zn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},zn.default.createElement(tn,{type:"switch",title:"Include Current Note in Context Menu",description:"Automatically include the current note in the chat context menu by default when sending messages to the AI.",checked:t.includeActiveNoteAsContext,onCheckedChange:u=>{Je("includeActiveNoteAsContext",u)}}),zn.default.createElement(tn,{type:"switch",title:"Images in Markdown",description:"Pass embedded images in markdown to the AI along with the text. Only works with multimodal models.",checked:t.passMarkdownImages,onCheckedChange:u=>{Je("passMarkdownImages",u)}}),zn.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autocomplete"),zn.default.createElement(tn,{type:"switch",title:"Sentence Autocomplete",description:zn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},zn.default.createElement("span",{className:"tw-leading-none"},"Enable AI-powered sentence autocomplete suggestions while typing")),checked:t.enableAutocomplete,onCheckedChange:u=>Je("enableAutocomplete",u)}),zn.default.createElement(tn,{type:"switch",title:"Word Completion",description:"Suggest completions for partially typed words based on your vault's content. Requires at least 3 characters to trigger.",checked:t.enableWordCompletion,onCheckedChange:u=>{Je("enableWordCompletion",u)}}),zn.default.createElement(tn,{type:"custom",title:"Word Index Management",description:"Rebuild the word index to include new words from your vault. The index is automatically built when the plugin loads."},zn.default.createElement(he,{onClick:s,disabled:r,className:"tw-flex tw-items-center tw-gap-2"},zn.default.createElement(Ob,{className:Ce("tw-size-4",r&&"tw-animate-spin")}),r?"Rebuilding...":"Refresh Word Index")),zn.default.createElement(tn,{type:"custom",title:"Autocomplete Accept Suggestion Key",description:zn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},zn.default.createElement("span",{className:"tw-leading-none"},"The key used to accept autocomplete suggestions"),zn.default.createElement(xa,{delayDuration:0},zn.default.createElement(Yt,null,zn.default.createElement(Zt,{asChild:!0},zn.default.createElement(fa,{className:"tw-size-4"})),zn.default.createElement(Kt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},zn.default.createElement("div",{className:"tw-text-sm tw-text-muted"},'Select the key you want to use for accepting suggestions. Default is "Tab".')))))},zn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},zn.default.createElement(dU,{value:e,onValueChange:i},zn.default.createElement(zD,{className:"tw-w-[180px]"},zn.default.createElement(fU,{placeholder:"Select key"})),zn.default.createElement(HD,null,o.map(u=>zn.default.createElement(VD,{key:u.value,value:u.value},u.label)))),e&&e!==nh.KEYBIND&&zn.default.createElement(he,{variant:"ghost",onClick:a,className:"tw-h-8 tw-text-xs"},"Reset to Default"))),zn.default.createElement(tn,{type:"switch",title:"Allow Additional Context",description:"Allow the AI to access relevant notes to provide more relevant suggestions. When off, the AI can only see the current note context.",checked:t.allowAdditionalContext,onCheckedChange:u=>{Je("allowAdditionalContext",u)}}))))};Zr();mo();Jt();var Re=$(Y());Jt();Zr();yn();var z5=require("obsidian");var dLe=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=$I(),a=ne(),s=o?"openai":"openai",[u,l]=(0,Re.useState)(null),[c,d]=(0,Re.useState)(!1),[f,p]=(0,Re.useState)(!1),[m,h]=(0,Re.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1}),b=(L,z)=>{h(K=>({...K,[L]:z}))},g=()=>{h({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1})},_=()=>{let L=!0,z={...m};return z.name=!C.name,C.name||(L=!1),C.provider==="azure openai"&&(z.instanceName=!C.azureOpenAIApiInstanceName,z.apiVersion=!C.azureOpenAIApiVersion,o?(z.embeddingDeploymentName=!C.azureOpenAIApiEmbeddingDeploymentName,C.azureOpenAIApiEmbeddingDeploymentName||(L=!1)):(z.deploymentName=!C.azureOpenAIApiDeploymentName,C.azureOpenAIApiDeploymentName||(L=!1)),(!C.azureOpenAIApiInstanceName||!C.azureOpenAIApiVersion)&&(L=!1)),h(z),L},w=L=>a[db[L]]||"",x=(L=s)=>{let z={name:"",provider:L,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:w(L),isEmbeddingModel:o,capabilities:[]};return o?z:{...z,stream:!0}},[C,E]=(0,Re.useState)(x()),P=L=>({...L,name:L.name?.trim(),baseUrl:L.baseUrl?.trim(),apiKey:L.apiKey?.trim(),openAIOrgId:L.openAIOrgId?.trim(),azureOpenAIApiInstanceName:L.azureOpenAIApiInstanceName?.trim(),azureOpenAIApiDeploymentName:L.azureOpenAIApiDeploymentName?.trim(),azureOpenAIApiEmbeddingDeploymentName:L.azureOpenAIApiEmbeddingDeploymentName?.trim(),azureOpenAIApiVersion:L.azureOpenAIApiVersion?.trim()}),[A,I]=(0,Re.useState)(cb(s)),R=()=>!!(C.name&&C.provider),j=()=>f||!R(),D=()=>{if(!_()){new z5.Notice("Please fill in all required fields");return}let L=P(C);r(L),e(!1),E(x()),g()},k=L=>{I(cb(L)),E({...C,provider:L,apiKey:w(L),...L==="openai"?{openAIOrgId:a.openAIOrgId}:{},...L==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{}})},F=L=>{L||(E(x()),g(),d(!1)),e(L)},B=async()=>{if(!_()){new z5.Notice("Please fill in all required fields");return}p(!0);try{let L=P(C);await n(L),new z5.Notice("Model verification successful!")}catch(L){console.error(L);let z=En(L);new z5.Notice("Model verification failed: "+z)}finally{p(!1)}},q=()=>{let z=(()=>{switch(C.provider){case"openai":return Re.default.createElement(Vo,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},Re.default.createElement(io,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:C.openAIOrgId||"",onChange:K=>E({...C,openAIOrgId:K.target.value})}));case"azure openai":return Re.default.createElement(Re.default.Fragment,null,Re.default.createElement(Vo,{label:"Instance Name",required:!0,error:m.instanceName,errorMessage:"Instance name is required"},Re.default.createElement(io,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:C.azureOpenAIApiInstanceName||"",onChange:K=>{E({...C,azureOpenAIApiInstanceName:K.target.value}),b("instanceName",!1)}})),o?Re.default.createElement(Vo,{label:"Embedding Deployment Name",required:!0,error:m.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},Re.default.createElement(io,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:C.azureOpenAIApiEmbeddingDeploymentName||"",onChange:K=>{E({...C,azureOpenAIApiEmbeddingDeploymentName:K.target.value}),b("embeddingDeploymentName",!1)}})):Re.default.createElement(Vo,{label:"Deployment Name",required:!0,error:m.deploymentName,errorMessage:"Deployment name is required",description:"This is your actual model, no need to pass a model name separately."},Re.default.createElement(io,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:C.azureOpenAIApiDeploymentName||"",onChange:K=>{E({...C,azureOpenAIApiDeploymentName:K.target.value}),b("deploymentName",!1)}})),Re.default.createElement(Vo,{label:"API Version",required:!0,error:m.apiVersion,errorMessage:"API version is required"},Re.default.createElement(io,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:C.azureOpenAIApiVersion||"",onChange:K=>{E({...C,azureOpenAIApiVersion:K.target.value}),b("apiVersion",!1)}})));default:return null}})();return z?Re.default.createElement(gP,{open:c,onOpenChange:d,className:"tw-space-y-2 tw-rounded-lg tw-border tw-pt-4"},Re.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},Re.default.createElement(Fp,null,"Additional ",ff(C.provider)," Settings"),Re.default.createElement(FD,{asChild:!0},Re.default.createElement(he,{variant:"ghost",size:"sm",className:"tw-w-9 tw-p-0"},Re.default.createElement(Di,{className:"tw-size-4"}),Re.default.createElement("span",{className:"tw-sr-only"},"Toggle")))),Re.default.createElement(yP,{className:"tw-max-h-[200px] tw-space-y-4 tw-overflow-y-auto tw-pb-0.5 tw-pl-0.5 tw-pr-2"},z)):null},W=()=>{if(C.provider!=="azure openai")return A.host;let L=C.azureOpenAIApiInstanceName||"[instance]",z=o?C.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":C.azureOpenAIApiDeploymentName||"[deployment]",K=C.azureOpenAIApiVersion||"[api-version]";return`https://${L}.openai.azure.com/openai/deployments/${z}/${o?"embeddings":"chat/completions"}?api-version=${K}`},H=Object.entries(YP).map(([L,z])=>({id:L,label:L.charAt(0).toUpperCase()+L.slice(1),description:z}));return Re.default.createElement(SU,{open:t,onOpenChange:F},Re.default.createElement(iN,{className:"sm:tw-max-w-[425px]",container:i,ref:L=>l(L)},Re.default.createElement(aN,null,Re.default.createElement(sN,null,"Add Custom ",o?"Embedding":"Chat"," Model"),Re.default.createElement(uN,null,"Add a new model to your collection.")),Re.default.createElement("div",{className:"tw-space-y-3"},Re.default.createElement(Vo,{label:"Model Name",required:!0,error:m.name,errorMessage:"Model name is required"},Re.default.createElement(io,{type:"text",placeholder:`Enter model name (e.g. ${o?"text-embedding-3-small":"gpt-4"})`,value:C.name,onChange:L=>{E({...C,name:L.target.value}),b("name",!1)}})),Re.default.createElement(Vo,{label:Re.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Re.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Re.default.createElement(xa,{delayDuration:0},Re.default.createElement(Yt,null,Re.default.createElement(Zt,{asChild:!0},Re.default.createElement(fa,{className:"tw-size-4"})),Re.default.createElement(Kt,{align:"start",className:"tw-max-w-96",side:"bottom"},Re.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Re.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Re.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Re.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Re.default.createElement("li",null,"Direct-Paid:Ds-r1"),Re.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Re.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Re.default.createElement(io,{type:"text",placeholder:"Custom display name (optional)",value:C.displayName||"",onChange:L=>{E({...C,displayName:L.target.value})}})),Re.default.createElement(Vo,{label:"Provider"},Re.default.createElement(dU,{value:C.provider,onValueChange:k},Re.default.createElement(zD,null,Re.default.createElement(fU,{placeholder:"Select provider"})),Re.default.createElement(HD,{container:u},Object.values(o?Vfe(JP,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):Vfe(qx,["COPILOT_PLUS"])).map(L=>Re.default.createElement(VD,{key:L,value:L},ff(L)))))),Re.default.createElement(Vo,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Re.default.createElement(io,{type:"text",placeholder:W()||"https://api.example.com/v1",value:C.baseUrl||"",onChange:L=>E({...C,baseUrl:L.target.value})})),Re.default.createElement(Vo,{label:"API Key"},Re.default.createElement(lx,{placeholder:`Enter ${A.label} API Key`,value:C.apiKey||"",onChange:L=>E({...C,apiKey:L})}),A.keyManagementURL&&Re.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Re.default.createElement("a",{href:A.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",A.label," API Key"))),Re.default.createElement(Vo,{label:Re.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Re.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Re.default.createElement(xa,{delayDuration:0},Re.default.createElement(Yt,null,Re.default.createElement(Zt,{asChild:!0},Re.default.createElement(fa,{className:"tw-size-4"})),Re.default.createElement(Kt,{align:"start",className:"tw-max-w-96",side:"bottom"},Re.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},Re.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},H.map(({id:L,label:z,description:K})=>Re.default.createElement("div",{key:L,className:"tw-flex tw-items-center tw-gap-2"},Re.default.createElement(Nf,{id:L,checked:C.capabilities?.includes(L),onCheckedChange:J=>{let ee=C.capabilities||[];E({...C,capabilities:J?[...ee,L]:ee.filter(Pe=>Pe!==L)})}}),Re.default.createElement(Fp,{htmlFor:L,className:"tw-text-sm"},Re.default.createElement(xa,{delayDuration:0},Re.default.createElement(Yt,null,Re.default.createElement(Zt,{asChild:!0},Re.default.createElement("span",null,z)),Re.default.createElement(Kt,{side:"bottom"},K)))))))),q()),Re.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-gap-4"},Re.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Re.default.createElement(Nf,{id:"enable-cors",checked:C.enableCors||!1,onCheckedChange:L=>E({...C,enableCors:L})}),Re.default.createElement(Fp,{htmlFor:"enable-cors",className:"tw-text-sm"},Re.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Re.default.createElement("span",null,"Enable CORS"),Re.default.createElement(xa,{delayDuration:0},Re.default.createElement(Yt,null,Re.default.createElement(Zt,{asChild:!0},Re.default.createElement(fa,{className:"tw-size-4"})),Re.default.createElement(Kt,{align:"start",className:"tw-max-w-96",side:"bottom"},Re.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only check this option when prompted that CORS is needed"))))))),Re.default.createElement("div",{className:"tw-flex tw-gap-2"},Re.default.createElement(he,{variant:"secondary",onClick:D,disabled:j()},"Add Model"),Re.default.createElement(he,{variant:"secondary",onClick:B,disabled:j()},f?Re.default.createElement(Re.default.Fragment,null,Re.default.createElement(Ll,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Verify"):"Verify")))))};Zr();Jt();yn();var Et=$(Y()),NVt=({open:t,onOpenChange:e,model:r,onUpdate:n})=>{let{modalContainer:o}=$I(),[i,a]=(0,Et.useState)(r),[s,u]=(0,Et.useState)(r),[l,c]=(0,Et.useState)({}),d=ne(),f=_=>d[db[_]]||"";(0,Et.useEffect)(()=>{a(r),u(r),r?.provider&&c(cb(r.provider))},[r]);let p=(0,Et.useMemo)(()=>V9((_,w)=>{_&&n(_,w)},500),[n]),m=(0,Et.useCallback)((_,w)=>{a(x=>{if(!x)return null;let C={...x,[_]:w};return p(s,C),C})},[s,p]);if(!i)return null;let h=()=>{if(!i||!i.provider||i.provider!=="azure-openai")return l.host||"https://api.example.com/v1";let _=i.azureOpenAIApiInstanceName||"[instance]",w=i.isEmbeddingModel?i.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":i.azureOpenAIApiDeploymentName||"[deployment]",x=i.azureOpenAIApiVersion||"[api-version]",C=i.isEmbeddingModel?"embeddings":"chat/completions";return`https://${_}.openai.azure.com/openai/deployments/${w}/${C}?api-version=${x}`},b=Object.entries(YP).map(([_,w])=>({id:_,label:_.charAt(0).toUpperCase()+_.slice(1),description:w})),g=i.apiKey||f(i.provider);return Et.default.createElement(SU,{open:t,onOpenChange:e},Et.default.createElement(iN,{className:"sm:tw-max-w-[425px]",container:o},Et.default.createElement(aN,null,Et.default.createElement(sN,null,"Model Settings - ",i.name),Et.default.createElement(uN,null,"Customize model parameters.")),Et.default.createElement("div",{className:"tw-space-y-3"},Et.default.createElement(Vo,{label:"Model Name",required:!0},Et.default.createElement(io,{type:"text",disabled:i.core,value:i.name,onChange:_=>m("name",_.target.value),placeholder:"Enter model name"})),Et.default.createElement(Vo,{label:Et.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Et.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Et.default.createElement(xa,{delayDuration:0},Et.default.createElement(Yt,null,Et.default.createElement(Zt,{asChild:!0},Et.default.createElement(fa,{className:"tw-size-4"})),Et.default.createElement(Kt,{align:"start",className:"tw-max-w-96",side:"bottom"},Et.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Et.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Et.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Et.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Et.default.createElement("li",null,"Direct-Paid:Ds-r1"),Et.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Et.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Et.default.createElement(io,{type:"text",placeholder:"Custom display name (optional)",value:i.displayName||"",onChange:_=>m("displayName",_.target.value)})),Et.default.createElement(Vo,{label:"Provider"},Et.default.createElement(io,{type:"text",value:ff(i.provider),disabled:!0})),Et.default.createElement(Vo,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Et.default.createElement(io,{type:"text",placeholder:h(),value:i.baseUrl||"",onChange:_=>m("baseUrl",_.target.value)})),Et.default.createElement(Vo,{label:"API Key"},Et.default.createElement(lx,{placeholder:`Enter ${l.label||"Provider"} API Key`,value:g,onChange:_=>m("apiKey",_)}),l.keyManagementURL&&Et.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Et.default.createElement("a",{href:l.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",l.label," API Key"))),Et.default.createElement(Vo,{label:Et.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Et.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Et.default.createElement(xa,{delayDuration:0},Et.default.createElement(Yt,null,Et.default.createElement(Zt,{asChild:!0},Et.default.createElement(fa,{className:"tw-size-4"})),Et.default.createElement(Kt,{align:"start",className:"tw-max-w-96",side:"bottom"},Et.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},Et.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},b.map(({id:_,label:w,description:x})=>Et.default.createElement("div",{key:_,className:"tw-flex tw-items-center tw-gap-2"},Et.default.createElement(Nf,{id:_,checked:i.capabilities?.includes(_),onCheckedChange:C=>{let E=i.capabilities||[],P=C?[...E,_]:E.filter(A=>A!==_);m("capabilities",P)}}),Et.default.createElement(Fp,{htmlFor:_,className:"tw-text-sm"},Et.default.createElement(xa,{delayDuration:0},Et.default.createElement(Yt,null,Et.default.createElement(Zt,{asChild:!0},Et.default.createElement("span",null,w)),Et.default.createElement(Kt,{side:"bottom"},x)))))))))))};Zr();Jt();yn();var Ve=$(Y()),Zwn={reasoning:{icon:sC,color:"tw-text-model-capabilities-blue",tooltip:YP.reasoning},vision:{icon:iC,color:"tw-text-model-capabilities-green",tooltip:YP.vision},websearch:{icon:oR,color:"tw-text-model-capabilities-blue",tooltip:YP.websearch}},Xwn=["reasoning","vision","websearch"],Qwn=t=>Ve.default.createElement(xa,{delayDuration:0},Ve.default.createElement("div",{className:"tw-mx-auto tw-grid tw-w-16 tw-grid-cols-3 tw-gap-1"},Xwn.map(e=>{let r=Zwn[e];if(!r)return Ve.default.createElement("div",{key:e,className:"tw-w-4"});let n=r.icon;return t.capabilities?.includes(e)?Ve.default.createElement(Yt,{key:e},Ve.default.createElement(Zt,{asChild:!0},Ve.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},Ve.default.createElement(n,{className:Ce("tw-size-4",r.color)}))),Ve.default.createElement(Kt,{side:"bottom"},r.tooltip)):Ve.default.createElement("div",{key:e,className:"tw-flex tw-items-center tw-justify-center"},Ve.default.createElement("div",{className:"tw-size-4"}))}))),e0n=({model:t,onEdit:e,onDelete:r,onUpdateModel:n,id:o})=>{let[i,a]=Ve.default.useState(!1),{attributes:s,listeners:u,setNodeRef:l,transform:c,transition:d,isDragging:f}=q5({id:o,disabled:t.core}),p={transform:Ky.Transform.toString(c),transition:d};return Ve.default.createElement(m5,{ref:l,style:p,className:Ce("tw-mb-2",f&&["tw-opacity-90","tw-shadow-lg","tw-border-accent/50","tw-relative","tw-z-[9999]","tw-bg-primary","tw-rounded-lg","tw-transform-gpu"],!t.core&&"tw-touch-none")},Ve.default.createElement(h5,{className:"tw-p-3"},Ve.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},!t.core&&Ve.default.createElement("div",{className:"tw-mr-2 tw-cursor-grab tw-touch-none active:tw-cursor-grabbing",...s,...u},Ve.default.createElement(PE,{className:"tw-size-4"})),Ve.default.createElement("div",{className:"tw-flex-1 tw-cursor-pointer",onClick:()=>a(!i)},Ve.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ve.default.createElement("div",{className:"tw-flex tw-size-3 tw-items-center tw-justify-center"},i?Ve.default.createElement(Di,{className:"tw-size-3 tw-stroke-[7]"}):Ve.default.createElement(oC,{className:"tw-size-3 tw-stroke-[7]"})),Ve.default.createElement("div",null,Ve.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ve.default.createElement("span",{className:"tw-font-medium"},t.displayName||t.name),t.capabilities&&t.capabilities.length>0&&Ve.default.createElement(p1e,{capabilities:t.capabilities,iconSize:14})),Ve.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ve.default.createElement("span",{className:"tw-bg-secondary tw-text-sm tw-text-muted"},ff(t.provider,t)))))),Ve.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},e&&Ve.default.createElement(he,{variant:"ghost",size:"icon",onClick:m=>{m.stopPropagation(),e()}},Ve.default.createElement(UL,{className:"tw-size-4"})),r&&!t.core&&Ve.default.createElement(he,{variant:"ghost",size:"icon",onClick:m=>{m.stopPropagation(),r()}},Ve.default.createElement(nm,{className:"tw-size-4"}))))),Ve.default.createElement("div",{className:Ce("tw-transition-all tw-duration-300 tw-ease-in-out",i?"tw-max-h-20 tw-opacity-100":"tw-max-h-0 tw-overflow-hidden tw-opacity-0")},Ve.default.createElement(g5,{className:"tw-p-3 tw-pt-0"},Ve.default.createElement("div",{className:"tw-flex tw-justify-around"},!t.isEmbeddingModel&&Ve.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ve.default.createElement("span",{className:"tw-text-sm"},"Enabled"),Ve.default.createElement(Nf,{checked:t.enabled,onCheckedChange:m=>n({...t,enabled:m})})),Ve.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ve.default.createElement("span",{className:"tw-text-sm"},"CORS"),Ve.default.createElement(Nf,{checked:t.enableCors,onCheckedChange:m=>n({...t,enableCors:m})}))))))},t0n=({model:t,onEdit:e,onDelete:r,onUpdateModel:n,isEmbeddingModel:o})=>{let{attributes:i,listeners:a,setNodeRef:s,transform:u,transition:l,isDragging:c}=q5({id:Dr(t),disabled:t.core}),d={transform:Ky.Transform.toString(u),transition:l};return Ve.default.createElement(KD,{ref:s,style:d,className:Ce("tw-transition-colors tw-duration-200 hover:tw-bg-interactive-accent/10",c&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50 tw-bg-primary/90")},Ve.default.createElement($p,{className:"tw-w-6 tw-px-2"},!t.core&&Ve.default.createElement(he,{variant:"ghost",size:"icon",className:"tw-size-6 tw-cursor-grab tw-touch-none tw-p-0 hover:tw-cursor-grab active:tw-cursor-grabbing",...i,...a},Ve.default.createElement(PE,{className:"tw-size-4 tw-transition-colors"}))),Ve.default.createElement($p,{className:"tw-pl-0"},t.displayName||t.name),Ve.default.createElement($p,null,ff(t.provider,t)),Ve.default.createElement($p,null,Qwn(t)),!o&&Ve.default.createElement($p,{className:"tw-text-center"},Ve.default.createElement(Nf,{id:`${Dr(t)}-enabled`,checked:t.enabled,onCheckedChange:f=>n({...t,enabled:f}),className:"tw-mx-auto"})),Ve.default.createElement($p,{className:"tw-text-center"},Ve.default.createElement(Nf,{id:`${Dr(t)}-enableCors`,checked:t.enableCors,onCheckedChange:f=>n({...t,enableCors:f}),className:"tw-mx-auto"})),Ve.default.createElement($p,{className:"tw-text-center"},Ve.default.createElement("div",{className:"tw-flex tw-justify-center tw-gap-2"},e&&Ve.default.createElement(he,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"tw-shadow-sm tw-transition-shadow hover:tw-shadow-md"},Ve.default.createElement(UL,{className:"tw-size-4"})),!t.core&&Ve.default.createElement(he,{variant:"ghost",size:"icon",onClick:()=>r(Dr(t)),className:"tw-shadow-sm tw-transition-shadow hover:tw-shadow-md"},Ve.default.createElement(nm,{className:"tw-size-4"})))))},fLe=({models:t,onEdit:e,onDelete:r,onAdd:n,onUpdateModel:o,onReorderModels:i,onRefresh:a,title:s})=>{let u=!!(t.length>0&&t[0].isEmbeddingModel),l=lle(_U(HI),_U(zI,{coordinateGetter:hle})),c=t.findIndex(m=>!m.core),d=m=>h=>{let{transform:b,active:g,activeNodeRect:_,over:w}=h;if(!g||!_)return b;let x=t.findIndex(I=>Dr(I)===g.id),C=t.filter(I=>!I.core).length,E=_.height,P=(c-x)*E,A=(c+C-1-x)*E;if(m&&w){let I=t.findIndex(j=>Dr(j)===w.id);if(t[I].core||I<c)return{...b,x:0,y:x*E}}return{...b,x:0,y:Math.min(Math.max(P,b.y),A)}},f=m=>{let{active:h,over:b}=m;if(b&&h.id!==b.id){let g=t.findIndex(C=>Dr(C)===h.id),_=t.findIndex(C=>Dr(C)===b.id),w=t[_];if(_<c||w.core)return;let x=vU(t,g,_);i?.(x)}},p=()=>Ve.default.createElement("div",{className:"tw-relative md:tw-hidden"},Ve.default.createElement(k5,{sensors:l,collisionDetection:L5,onDragEnd:f,modifiers:[d(!0)]},Ve.default.createElement(B5,{items:t.map(m=>Dr(m)),strategy:$5},Ve.default.createElement("div",{className:"tw-relative tw-space-y-2"},t.map(m=>Ve.default.createElement(e0n,{key:Dr(m),id:Dr(m),model:m,onEdit:e?()=>e(m):void 0,onDelete:()=>r(Dr(m)),onUpdateModel:o}))))));return Ve.default.createElement("div",{className:"tw-mb-4"},Ve.default.createElement("div",{className:"tw-hidden md:tw-block"},Ve.default.createElement(k5,{sensors:l,collisionDetection:L5,onDragEnd:f,modifiers:[d(!1)]},Ve.default.createElement("div",{className:"tw-relative tw-overflow-hidden"},Ve.default.createElement(P5,null,Ve.default.createElement(E5,null,Ve.default.createElement(KD,null,Ve.default.createElement(kp,{className:"tw-w-6 tw-px-2"}),Ve.default.createElement(kp,{className:"tw-pl-0"},"Model"),Ve.default.createElement(kp,null,"Provider"),Ve.default.createElement(kp,{className:"tw-text-center"},"Capabilities"),!u&&Ve.default.createElement(kp,{className:"tw-text-center"},"Enable"),Ve.default.createElement(kp,{className:"tw-text-center"},"CORS"),Ve.default.createElement(kp,{className:"tw-w-[100px] tw-text-center"},"Actions"))),Ve.default.createElement(T5,{className:"tw-relative"},Ve.default.createElement(B5,{items:t.map(m=>Dr(m)),strategy:$5},t.map(m=>Ve.default.createElement(t0n,{key:Dr(m),model:m,onEdit:e?()=>e(m):void 0,onDelete:r,onUpdateModel:o,isEmbeddingModel:u})))))))),p(),Ve.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end tw-gap-2"},a&&Ve.default.createElement(he,{onClick:a,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Ve.default.createElement(Ob,{className:"tw-size-4"}),"Refresh Built-in Models"),Ve.default.createElement(he,{onClick:n,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Ve.default.createElement(Hg,{className:"tw-size-4"}),"Add Custom Model")))};var wle=require("obsidian"),Oa=$(Y()),LVt=()=>{let t=Pn(),[e,r]=(0,Oa.useState)(null),[n,o]=(0,Oa.useState)(!1),[i,a]=(0,Oa.useState)(!1),s=b=>{let[g,_]=b.split("|"),w=t.activeModels.filter(C=>!(C.name===g&&C.provider===_)),x=t.defaultModelKey;if(b===t.defaultModelKey){let C=w.find(E=>E.enabled);x=C?`${C.name}|${C.provider}`:""}WP({activeModels:w,defaultModelKey:x})},u=(b,g)=>{let _=t.activeModels.findIndex(w=>w.name===b.name&&w.provider===b.provider);if(_!==-1){let w=[...t.activeModels];w[_]=g,Je("activeModels",w)}else new wle.Notice("Could not find model to update"),fe("Could not find model to update:",b)},l=b=>{let g=t.activeModels.map(_=>_.name===b.name&&_.provider===b.provider?b:_);Je("activeModels",g)},c=b=>{Je("activeModels",b)},d=b=>{let[g,_]=b.split("|"),w=t.activeEmbeddingModels.filter(x=>!(x.name===g&&x.provider===_));Je("activeEmbeddingModels",w)},f=b=>{let g=t.activeEmbeddingModels.map(_=>_.name===b.name&&_.provider===b.provider?b:_);Je("activeEmbeddingModels",g)},p=b=>{Je("activeEmbeddingModels",b)},m=()=>{let b=t.activeModels.filter(_=>!_.isBuiltIn),g=[...lb,...b];Je("activeModels",g),new wle.Notice("Chat models refreshed successfully")},h=()=>{let b=t.activeEmbeddingModels.filter(_=>!_.isBuiltIn),g=[...jM,...b];Je("activeEmbeddingModels",g),new wle.Notice("Embedding models refreshed successfully")};return Oa.default.createElement("div",{className:"tw-space-y-4"},Oa.default.createElement("section",null,Oa.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Chat Models"),Oa.default.createElement(fLe,{models:t.activeModels,onEdit:r,onDelete:s,onAdd:()=>o(!0),onUpdateModel:l,onReorderModels:c,onRefresh:m,title:"Chat Model"}),Oa.default.createElement(NVt,{open:!!e,onOpenChange:b=>!b&&r(null),model:e,onUpdate:u}),Oa.default.createElement(dLe,{open:n,onOpenChange:o,onAdd:b=>{let g=[...t.activeModels,b];Je("activeModels",g)},ping:b=>Hl.instance.getCurrentChainManager().chatModelManager.ping(b)}),Oa.default.createElement("div",{className:"tw-space-y-4"},Oa.default.createElement(tn,{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:b=>Je("temperature",b),min:0,max:2,step:.05}),Oa.default.createElement(tn,{type:"slider",title:"Token limit",description:Oa.default.createElement(Oa.default.Fragment,null,Oa.default.createElement("p",null,"The maximum number of ",Oa.default.createElement("em",null,"output tokens")," to generate. Default is 1000."),Oa.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model.")),value:t.maxTokens,onChange:b=>Je("maxTokens",b),min:0,max:65e3,step:100}),Oa.default.createElement(tn,{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:b=>Je("contextTurns",b),min:1,max:50,step:1}))),Oa.default.createElement("section",null,Oa.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Embedding Models"),Oa.default.createElement(fLe,{models:t.activeEmbeddingModels,onDelete:d,onAdd:()=>a(!0),onUpdateModel:f,onReorderModels:p,onRefresh:h,title:"Embedding Model"}),Oa.default.createElement(dLe,{open:i,onOpenChange:a,onAdd:b=>{let g=[...t.activeEmbeddingModels,b];Je("activeEmbeddingModels",g)},isEmbeddingModel:!0,ping:b=>$s.getInstance().ping(b)})))};var FVt=require("obsidian");var wn=$(Y()),kVt=$(_c());function Sle({title:t,patterns:e,onRemove:r}){return wn.default.createElement("div",{className:"tw-grid tw-grid-cols-4 tw-gap-2"},wn.default.createElement("div",{className:"tw-font-bold"},t),wn.default.createElement("ul",{className:"tw-col-span-3 tw-m-0 tw-flex tw-list-inside tw-list-disc tw-flex-col tw-gap-1 tw-pl-0"},e.map(n=>wn.default.createElement("li",{key:n,className:"tw-flex tw-gap-2 tw-rounded-md tw-pl-2 tw-pr-1 hover:tw-bg-dropdown-hover"},wn.default.createElement(Lue,{className:"tw-flex-1"},n),wn.default.createElement(he,{variant:"ghost2",size:"fit",onClick:()=>r(n)},wn.default.createElement(Ia,{className:"tw-size-4"}))))))}function r0n({value:t,onUpdate:e,container:r}){let[n,o]=(0,wn.useState)(t),i=Cm(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=iA(i),c=f=>{let p=vre({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 wn.default.createElement("div",{className:"tw-mt-2 tw-flex tw-flex-col tw-gap-4"},wn.default.createElement("div",{className:"tw-flex tw-max-h-[400px] tw-flex-col tw-gap-2 tw-overflow-y-auto tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-4"},!d&&wn.default.createElement("div",{className:"tw-text-center tw-text-sm"},"No patterns specified"),a.length>0&&wn.default.createElement(Sle,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(m=>m!==f);c({tagPatterns:p})}}),s.length>0&&wn.default.createElement(Sle,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(m=>m!==f);c({extensionPatterns:p})}}),u.length>0&&wn.default.createElement(Sle,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(m=>m!==f);c({folderPatterns:p})}}),l.length>0&&wn.default.createElement(Sle,{title:"Notes",patterns:l,onRemove:f=>{let p=l.filter(m=>m!==f);c({notePatterns:p})}})),wn.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},wn.default.createElement(SI,null,wn.default.createElement(xI,{asChild:!0},wn.default.createElement(he,{variant:"secondary"},"Add...")),wn.default.createElement(mg,{align:"start",container:r},wn.default.createElement(Ho,{onSelect:()=>{new nU(app,f=>{let p=`#${f}`;a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},wn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},wn.default.createElement(sR,{className:"tw-size-4"}),"Tag")),wn.default.createElement(Ho,{onSelect:()=>{new rU(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},wn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},wn.default.createElement(zg,{className:"tw-size-4"}),"Folder")),wn.default.createElement(Ho,{onSelect:()=>{new OI({app,onNoteSelect:f=>{let p=`[[${f.basename}]]`;l.includes(p)||c({notePatterns:[...l,p]})},excludeNotePaths:[],titleOnly:!0}).open()}},wn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},wn.default.createElement(aC,{className:"tw-size-4"}),"Note")),wn.default.createElement(Ho,{onSelect:()=>{new tU(app,f=>{let p=`*.${f}`;s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},wn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},wn.default.createElement(nR,{className:"tw-size-4"}),"Extension")),wn.default.createElement(Ho,{onSelect:()=>{new eU(app,f=>{let p=Cm(f),{tagPatterns:m,extensionPatterns:h,folderPatterns:b,notePatterns:g}=iA(p);c({tagPatterns:[...a,...m],extensionPatterns:[...s,...h],folderPatterns:[...u,...b],notePatterns:[...l,...g]})}).open()}},wn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},wn.default.createElement(cC,{className:"tw-size-4"}),"Custom"))))))}var H5=class extends FVt.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,kVt.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(wn.default.createElement(r0n,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};Zr();Jt();var Lr=$(Y()),$Vt=()=>{let t=Pn(),e=r=>{let n=parseInt(r);n!==t.numPartitions&&new xU(app,async()=>{Je("numPartitions",n),await Li.getInstance().indexVaultToVectorStore(!0)}).open()};return Lr.default.createElement("div",{className:"tw-space-y-4"},Lr.default.createElement("section",null,Lr.default.createElement("div",{className:"tw-space-y-4"},Lr.default.createElement(tn,{type:"select",title:"Auto-Index Strategy",description:Lr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Lr.default.createElement("span",{className:"tw-leading-none"},"Decide when you want the vault to be indexed."),Lr.default.createElement(xa,{delayDuration:0},Lr.default.createElement(Yt,null,Lr.default.createElement(Zt,{asChild:!0},Lr.default.createElement(fa,{className:"tw-size-4"})),Lr.default.createElement(Kt,null,Lr.default.createElement("div",{className:"tw-space-y-2 tw-py-2"},Lr.default.createElement("div",{className:"tw-space-y-1"},Lr.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Choose when to index your vault:"),Lr.default.createElement("ul",{className:"tw-list-disc tw-space-y-1 tw-pl-2 tw-text-sm"},Lr.default.createElement("li",null,Lr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Lr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"NEVER:"),Lr.default.createElement("span",null,"Manual indexing via command or refresh only"))),Lr.default.createElement("li",null,Lr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Lr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON STARTUP:"),Lr.default.createElement("span",null,"Index updates when plugin loads or reloads"))),Lr.default.createElement("li",null,Lr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Lr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON MODE SWITCH:"),Lr.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),Lr.default.createElement("p",{className:"tw-text-sm tw-text-callout-warning"},"Warning: Cost implications for large vaults with paid models")))))),value:t.indexVaultToVectorStore,onChange:r=>{Je("indexVaultToVectorStore",r)},options:cze.map(r=>({label:r,value:r})),placeholder:"Strategy"}),Lr.default.createElement(tn,{type:"slider",title:"Max Sources",description:"Copilot goes through your vault to find relevant blocks and passes the top N blocks to the LLM. Default for N is 3. Increase if you want more sources included in the answer generation step.",min:1,max:128,step:1,value:t.maxSourceChunks,onChange:r=>Je("maxSourceChunks",r)}),Lr.default.createElement(tn,{type:"slider",title:"Requests per Minute",description:"Default is 90. Decrease if you are rate limited by your embedding provider.",min:10,max:300,step:10,value:t.embeddingRequestsPerMin,onChange:r=>Je("embeddingRequestsPerMin",r)}),Lr.default.createElement(tn,{type:"slider",title:"Embedding Batch Size",description:"Default is 16. Increase if you are rate limited by your embedding provider.",min:1,max:128,step:1,value:t.embeddingBatchSize,onChange:r=>Je("embeddingBatchSize",r)}),Lr.default.createElement(tn,{type:"select",title:"Number of Partitions",description:"Number of partitions for Copilot index. Default is 1. Increase if you have issues indexing large vaults. Warning: Changes require clearing and rebuilding the index!",value:t.numPartitions.toString(),onChange:e,options:["1","2","3","4","5","6","7","8","12","16","20","24","28","32","36","40"].map(r=>({label:r,value:r}))}),Lr.default.createElement(tn,{type:"custom",title:"Exclusions",description:Lr.default.createElement(Lr.default.Fragment,null,Lr.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."))},Lr.default.createElement(he,{variant:"secondary",onClick:()=>new H5(app,r=>Je("qaExclusions",r),t.qaExclusions,"Manage Exclusions").open()},"Manage")),Lr.default.createElement(tn,{type:"custom",title:"Inclusions",description:Lr.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.")},Lr.default.createElement(he,{variant:"secondary",onClick:()=>new H5(app,r=>Je("qaInclusions",r),t.qaInclusions,"Manage Inclusions").open()},"Manage")),Lr.default.createElement(tn,{type:"switch",title:"Enable Obsidian Sync for Copilot index",description:"If enabled, the index will be stored in the .obsidian folder and synced with Obsidian Sync by default. If disabled, it will be stored in .copilot-index folder at vault root.",checked:t.enableIndexSync,onCheckedChange:r=>Je("enableIndexSync",r)}),Lr.default.createElement(tn,{type:"switch",title:"Disable index loading on mobile",description:"When enabled, Copilot index won't be loaded on mobile devices to save resources. Only chat mode will be available. Any existing index from desktop sync will be preserved. Uncheck to enable QA modes on mobile.",checked:t.disableIndexOnMobile,onCheckedChange:r=>Je("disableIndexOnMobile",r)}))))};var qVt=["basic","model","QA","command","plus","advanced"],n0n={basic:Nn.default.createElement(D2,{className:"tw-size-5"}),model:Nn.default.createElement(N2,{className:"tw-size-5"}),QA:Nn.default.createElement(L2,{className:"tw-size-5"}),command:Nn.default.createElement(xb,{className:"tw-size-5"}),plus:Nn.default.createElement(fh,{className:"tw-size-5"}),advanced:Nn.default.createElement(cC,{className:"tw-size-5"})},o0n={basic:()=>Nn.default.createElement(jVt,null),model:()=>Nn.default.createElement(LVt,null),QA:()=>Nn.default.createElement($Vt,null),command:()=>Nn.default.createElement(BHt,null),plus:()=>Nn.default.createElement(DVt,null),advanced:()=>Nn.default.createElement(EVt,null)},BVt=qVt.map(t=>({id:t,icon:n0n[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),i0n=({plugin:t})=>{let{selectedTab:e,setSelectedTab:r}=$I();return Nn.default.createElement("div",{className:"tw-flex tw-flex-col"},Nn.default.createElement("div",{className:"tw-inline-flex tw-rounded-lg"},BVt.map((n,o)=>Nn.default.createElement(j3t,{key:n.id,tab:n,isSelected:e===n.id,onClick:()=>r(n.id),isFirst:o===0,isLast:o===BVt.length-1}))),Nn.default.createElement("div",{className:"tw-w-full tw-border tw-border-solid"}),Nn.default.createElement("div",null,qVt.map(n=>{let o=o0n[n];return Nn.default.createElement(D3t,{key:n,id:n,isSelected:e===n},Nn.default.createElement(o,null))})))},a0n=({plugin:t})=>{let[e,r]=Nn.default.useState(0),{latestVersion:n,hasUpdate:o}=Due(t.manifest.version),i=async()=>{new ele(app,async()=>{zUe(),r(s=>s+1)}).open()};return Nn.default.createElement(L3t,null,Nn.default.createElement("div",null,Nn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Nn.default.createElement("h1",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},Nn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Nn.default.createElement("span",null,"Copilot Settings"),Nn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Nn.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"v",t.manifest.version),n&&Nn.default.createElement(Nn.default.Fragment,null,o?Nn.default.createElement("a",{href:"obsidian://show-plugin?id=copilot",target:"_blank",rel:"noopener noreferrer",className:"tw-text-xs tw-text-accent hover:tw-underline"},"(Update to v",n,")"):Nn.default.createElement("span",{className:"tw-text-xs tw-text-normal"}," (up to date)")))),Nn.default.createElement("div",{className:"tw-self-end sm:tw-self-auto"},Nn.default.createElement(he,{variant:"secondary",size:"sm",onClick:i},"Reset Settings")))),Nn.default.createElement(i0n,{key:e,plugin:t})))},UVt=a0n;var xle=class extends V5.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}async reloadPlugin(){try{this.app.workspace.getLeavesOfType(hs)[0]?.view&&ne().autosaveChat&&await this.plugin.autosaveCurrentChat();let r=this.plugin.app;await r.plugins.disablePlugin("copilot"),await r.plugins.enablePlugin("copilot"),r.setting.openTabById("copilot").display(),new V5.Notice("Plugin reloaded successfully.")}catch(e){new V5.Notice("Failed to reload the plugin. Please reload manually."),console.error("Error reloading plugin:",e)}}display(){let{containerEl:e}=this;e.empty(),e.style.userSelect="text";let r=e.createDiv("div");(0,zVt.createRoot)(r).render(pLe.default.createElement(KNe.Provider,{value:e},pLe.default.createElement(UVt,{plugin:this.plugin})))}};Jt();var SP=require("obsidian");var Cle=class extends SP.Plugin{constructor(){super(...arguments);this.userMessageHistory=[];this.handleContextMenu=(r,n)=>{R3t(r,n,this)}}async onload(){await this.loadSettings(),this.settingsUnsubscriber=Mi(async(r,n)=>{n.enableEncryption?await this.saveData(await Rze(n)):await this.saveData(n),h1e(this,r,n)}),this.addSettingTab(new xle(this.app,this)),this.sharedState=new P3t(this),this.vectorStoreManager=Li.getInstance(),this.brevilabsClient=Ei.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),Pre(),this.projectManager=Hl.getInstance(this.app,this.vectorStoreManager,this),this.fileParserManager=new aA(this.brevilabsClient,this.app.vault),this.registerView(hs,r=>new kI(r,this)),this.registerView(s5,r=>new Oue(r)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",r=>{this.activateView()}),h1e(this,void 0,ne()),vj.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 SP.MarkdownView&&r.view.file){let o=this.app.workspace.getLeavesOfType(hs).find(i=>i.view instanceof kI)?.view;if(o){let i=new CustomEvent(Hx.ACTIVE_LEAF_CHANGE);o.eventTarget.dispatchEvent(i)}}})),this.autocompleteService=Sse.getInstance(this)}async onunload(){this.vectorStoreManager&&this.vectorStoreManager.onunload(),this.projectManager&&this.projectManager.onunload(),this.settingsUnsubscriber?.(),this.autocompleteService?.destroy(),ae("Copilot plugin unloaded")}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(ne().autosaveChat){let r=this.app.workspace.getLeavesOfType(hs)[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(hs).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(hs).find(l=>l.view instanceof kI)?.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(hs).find(n=>n.view instanceof kI)?.view;if(r){let n=new CustomEvent(Hx.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===hs&&this.emitChatIsVisible()}))}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(SP.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(hs).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(hs);r.length===0?ne().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:hs,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:hs,active:!0}):this.app.workspace.revealLeaf(r[0]),this.emitChatIsVisible()}async deactivateView(){this.app.workspace.detachLeavesOfType(hs)}async loadSettings(){let r=await this.loadData(),n=HUe(r);WP(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=Dr(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 SP.Notice("No chat history found.");return}new Que(this.app,r,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=this.app.vault.getAbstractFileByPath(ne().defaultSaveFolder);if(!(r instanceof SP.TFolder))return[];let o=(await this.app.vault.getMarkdownFiles()).filter(s=>s.path.startsWith(r.path)),a=hc()?.id;if(a){let s=`${a}__`;return o.filter(u=>u.basename.startsWith(s))}else return o.filter(s=>!s.basename.match(/^[a-zA-Z0-9-]+__/))}async loadChatHistory(r){await this.autosaveCurrentChat();let n=await this.app.vault.read(r),o=qCt(n);this.sharedState.clearChatHistory(),o.forEach(a=>this.sharedState.addMessage(a)),await cj(o,this.projectManager.getCurrentChainManager().memoryManager);let i=this.app.workspace.getLeavesOfType(hs)[0];i?i.view.updateView():this.activateView()}async handleNewChat(){await this.autosaveCurrentChat(),this.sharedState.clearChatHistory(),this.projectManager.getCurrentChainManager().memoryManager.clearChatMemory();let r=this.app.workspace.getLeavesOfType(hs)[0];r?r.view.updateView():await this.activateView()}async newChat(){await this.handleNewChat()}async customSearchDB(r,n,o){return(await new sA({minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o}).getOramaChunks(r,n)).map(s=>({content:s.pageContent,metadata:s.metadata}))}};
/*! Bundled license information:
@langchain/core/dist/utils/fast-json-patch/src/helpers.js:
(*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017-2022 Joachim Wester
* MIT licensed
*)
@langchain/core/dist/utils/fast-json-patch/src/duplex.js:
(*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2013-2021 Joachim Wester
* MIT license
*)
mustache/mustache.mjs:
(*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*)
react/cjs/react.production.min.js:
(**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
moment/moment.js:
(*! moment.js *)
(*! version : 2.29.4 *)
(*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
(*! license : MIT *)
(*! momentjs.com *)
ieee754/index.js:
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
buffer/index.js:
(*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*)
scheduler/cjs/scheduler.production.min.js:
(**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react-dom/cjs/react-dom.production.min.js:
(**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react/cjs/react-jsx-runtime.production.min.js:
(**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
tslib/tslib.es6.js:
(*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** *)
safe-buffer/index.js:
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
@langchain/core/dist/utils/js-sha1/hash.js:
(*
* [js-sha1]{@link https://github.com/emn178/js-sha1}
*
* @version 0.6.0
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*)
crypto-js/ripemd160.js:
(** @preserve
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*)
crypto-js/mode-ctr-gladman.js:
(** @preserve
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*)
lucide-react/dist/esm/shared/src/utils.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/defaultAttributes.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/Icon.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/createLucideIcon.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/arrow-big-up.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/arrow-right.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/bot.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/check.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/chevron-down.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/chevron-right.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/chevron-up.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-help.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-plus.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-stop.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-x.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/clipboard.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/cog.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/command.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/copy.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/corner-down-left.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/cpu.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/database.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/download.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/ellipsis-vertical.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/ellipsis.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/external-link.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/eye-off.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/eye.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-input.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-output.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-text.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/folder.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/globe.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/grip-vertical.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/history.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/image.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/info.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/key.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/library-big.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/lightbulb.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/loader-circle.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/message-circle-plus.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/message-square.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pen-line.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pen.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pencil-line.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pencil.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/plus.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/refresh-ccw.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/refresh-cw.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/rotate-cw.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/search.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/sparkles.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/square-arrow-out-up-right.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/square-pen.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/tag.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/text-cursor-input.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/trash-2.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/triangle-alert.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/user.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/wrench.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/x.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/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 */