/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/

// Polyfill for import.meta in CommonJS context
if (typeof import_meta === 'undefined') {
  var import_meta = {
    url: typeof __filename !== 'undefined' ? 'file://' + __filename : 'file:///obsidian-plugin'
  };
}

var Yln=Object.create;var SQ=Object.defineProperty;var Qln=Object.getOwnPropertyDescriptor;var ecn=Object.getOwnPropertyNames;var tcn=Object.getPrototypeOf,rcn=Object.prototype.hasOwnProperty;var B0t=t=>{throw TypeError(t)};var ncn=(t,e,r)=>e in t?SQ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var v=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),En=(t,e)=>{for(var r in e)SQ(t,r,{get:e[r],enumerable:!0})},U0t=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ecn(e))!rcn.call(t,o)&&o!==r&&SQ(t,o,{get:()=>e[o],enumerable:!(n=Qln(e,o))||n.enumerable});return t};var $=(t,e,r)=>(r=t!=null?Yln(tcn(t)):{},U0t(e||!t||!t.__esModule?SQ(r,"default",{value:t,enumerable:!0}):r,t)),wpe=t=>U0t(SQ({},"__esModule",{value:!0}),t);var x=(t,e,r)=>ncn(t,typeof e!="symbol"?e+"":e,r),ocn=(t,e,r)=>e.has(t)||B0t("Cannot "+r);var PBe=(t,e,r)=>e.has(t)?B0t("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var z0t=(t,e,r)=>(ocn(t,e,"access private method"),r);var V0t,H0t=v(()=>{V0t=/^(?:[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 icn(t){return typeof t=="string"&&V0t.test(t)}var j6,W0t=v(()=>{H0t();j6=icn});function Spe(t,e=0){return(hg[t[e+0]]+hg[t[e+1]]+hg[t[e+2]]+hg[t[e+3]]+"-"+hg[t[e+4]]+hg[t[e+5]]+"-"+hg[t[e+6]]+hg[t[e+7]]+"-"+hg[t[e+8]]+hg[t[e+9]]+"-"+hg[t[e+10]]+hg[t[e+11]]+hg[t[e+12]]+hg[t[e+13]]+hg[t[e+14]]+hg[t[e+15]]).toLowerCase()}var hg,MBe=v(()=>{hg=[];for(let t=0;t<256;++t)hg.push((t+256).toString(16).slice(1))});function $6(){if(!RBe){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");RBe=crypto.getRandomValues.bind(crypto)}return RBe(acn)}var RBe,acn,IBe=v(()=>{acn=new Uint8Array(16)});var scn,ABe,J0t=v(()=>{scn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ABe={randomUUID:scn}});function ucn(t,e,r){if(ABe.randomUUID&&!e&&!t)return ABe.randomUUID();t=t||{};let n=t.random??t.rng?.()??$6();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)e[r+o]=n[o];return e}return Spe(n)}var gu,K0t=v(()=>{J0t();IBe();MBe();gu=ucn});function lcn(t,e,r){let n;if(t)n=G0t(t.random??t.rng?.()??$6(),t.msecs,t.seq,e,r);else{let o=Date.now(),i=$6();ccn(NBe,o,i),n=G0t(i,NBe.msecs,NBe.seq,e,r)}return e??Spe(n)}function ccn(t,e,r){return t.msecs??(t.msecs=-1/0),t.seq??(t.seq=0),e>t.msecs?(t.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],t.msecs=e):(t.seq=t.seq+1|0,t.seq===0&&t.msecs++),t}function G0t(t,e,r,n,o=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),o=0;else if(o<0||o+16>n.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);return e??(e=Date.now()),r??(r=t[6]*127<<24|t[7]<<16|t[8]<<8|t[9]),n[o++]=e/1099511627776&255,n[o++]=e/4294967296&255,n[o++]=e/16777216&255,n[o++]=e/65536&255,n[o++]=e/256&255,n[o++]=e&255,n[o++]=112|r>>>28&15,n[o++]=r>>>20&255,n[o++]=128|r>>>14&63,n[o++]=r>>>6&255,n[o++]=r<<2&255|t[10]&3,n[o++]=t[11],n[o++]=t[12],n[o++]=t[13],n[o++]=t[14],n[o++]=t[15],n}var NBe,FT,X0t=v(()=>{IBe();MBe();NBe={};FT=lcn});var y_=v(()=>{K0t();X0t();W0t()});var Z0t,Uo,zo=v(()=>{Z0t=Object.defineProperty,Uo=(t,e)=>{let r={};for(var n in t)Z0t(r,n,{get:t[n],enumerable:!0});return e||Z0t(r,Symbol.toStringTag,{value:"Module"}),r}});function Cpe(t,e=L6){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 fcn(t){try{return JSON.parse(t)}catch{}let e=t.trim();if(e.length===0)throw new Error("Unexpected end of JSON input");let r=0;function n(){for(;r<e.length&&/\s/.test(e[r]);)r+=1}function o(){if(e[r]!=='"')throw new Error(`Expected '"' at position ${r}, got '${e[r]}'`);r+=1;let c="",d=!1;for(;r<e.length;){let f=e[r];if(d){if(f==="n")c+=`
`;else if(f==="t")c+="	";else if(f==="r")c+="\r";else if(f==="\\")c+="\\";else if(f==='"')c+='"';else if(f==="b")c+="\b";else if(f==="f")c+="\f";else if(f==="/")c+="/";else if(f==="u"){let p=e.substring(r+1,r+5);if(/^[0-9A-Fa-f]{0,4}$/.test(p))p.length===4?c+=String.fromCharCode(Number.parseInt(p,16)):c+=`u${p}`,r+=p.length;else throw new Error(`Invalid unicode escape sequence '\\u${p}' at position ${r}`)}else throw new Error(`Invalid escape sequence '\\${f}' at position ${r}`);d=!1}else if(f==="\\")d=!0;else{if(f==='"')return r+=1,c;c+=f}r+=1}return d&&(c+="\\"),c}function i(){let c=r,d="";if(e[r]==="-"&&(d+="-",r+=1),r<e.length&&e[r]==="0"&&(d+="0",r+=1,e[r]>="0"&&e[r]<="9"))throw new Error(`Invalid number at position ${c}`);if(r<e.length&&e[r]>="1"&&e[r]<="9")for(;r<e.length&&e[r]>="0"&&e[r]<="9";)d+=e[r],r+=1;if(r<e.length&&e[r]===".")for(d+=".",r+=1;r<e.length&&e[r]>="0"&&e[r]<="9";)d+=e[r],r+=1;if(r<e.length&&(e[r]==="e"||e[r]==="E"))for(d+=e[r],r+=1,r<e.length&&(e[r]==="+"||e[r]==="-")&&(d+=e[r],r+=1);r<e.length&&e[r]>="0"&&e[r]<="9";)d+=e[r],r+=1;if(d==="-")return-0;let f=Number.parseFloat(d);if(Number.isNaN(f))throw r=c,new Error(`Invalid number '${d}' at position ${c}`);return f}function a(){if(n(),r>=e.length)throw new Error(`Unexpected end of input at position ${r}`);let c=e[r];if(c==="{")return u();if(c==="[")return s();if(c==='"')return o();if("null".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),null;if("true".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),!0;if("false".startsWith(e.substring(r,r+5)))return r+=Math.min(5,e.length-r),!1;if(c==="-"||c>="0"&&c<="9")return i();throw new Error(`Unexpected character '${c}' at position ${r}`)}function s(){if(e[r]!=="[")throw new Error(`Expected '[' at position ${r}, got '${e[r]}'`);let c=[];if(r+=1,n(),r>=e.length)return c;if(e[r]==="]")return r+=1,c;for(;r<e.length;){if(n(),r>=e.length||(c.push(a()),n(),r>=e.length))return c;if(e[r]==="]")return r+=1,c;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or ']' at position ${r}, got '${e[r]}'`)}return c}function u(){if(e[r]!=="{")throw new Error(`Expected '{' at position ${r}, got '${e[r]}'`);let c={};if(r+=1,n(),r>=e.length)return c;if(e[r]==="}")return r+=1,c;for(;r<e.length;){if(n(),r>=e.length)return c;let d=o();if(n(),r>=e.length)return c;if(e[r]!==":")throw new Error(`Expected ':' at position ${r}, got '${e[r]}'`);if(r+=1,n(),r>=e.length||(c[d]=a(),n(),r>=e.length))return c;if(e[r]==="}")return r+=1,c;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or '}' at position ${r}, got '${e[r]}'`)}return c}let l=a();if(n(),r<e.length)throw new Error(`Unexpected character '${e[r]}' at position ${r}`);return l}function L6(t){try{return typeof t>"u"?null:fcn(t)}catch{return null}}var CQ=v(()=>{});function Y0t(t){let e=Symbol.for(t);return{brand(r,n){var a,s;let o=n?Symbol.for(`${t}.${n}`):e;class i extends(s=r,a=o,s){constructor(...c){super(...c);x(this,a,!0)}static isInstance(c){return typeof c=="object"&&c!==null&&o in c&&c[o]===!0}}return Object.defineProperty(i,"name",{value:r.name}),i},sub(r){return Y0t(`${t}.${r}`)},isInstance(r){return typeof r=="object"&&r!==null&&e in r&&r[e]===!0}}}var Q0t,eCt=v(()=>{Q0t=Y0t("langchain")});function AL(t,e){return t.lc_error_code=e,t.message=`${t.message}

Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/
`,t}var DBe,tCt,jBe,aCi,F6=v(()=>{zo();eCt();DBe=Q0t.sub("error"),tCt=class extends DBe.brand(Error){constructor(e){super(e);x(this,"name","LangChainError");Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},jBe=class extends DBe.brand(tCt,"model-abort"){constructor(e,r){super(e);x(this,"name","ModelAbortError");x(this,"partialOutput");this.partialOutput=r}},aCi=class rCt extends DBe.brand(tCt,"context-overflow"){constructor(r){super(r??"Input exceeded the model's context window.");x(this,"name","ContextOverflowError");x(this,"cause")}static fromError(r){let n=new rCt(r.message);return n.cause=r,n}}});function NL(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function nCt(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 xQ,xpe=v(()=>{xQ=class extends Error{constructor(e,r){super(e);x(this,"output");this.output=r}}});var iCt=S((mCi,oCt)=>{"use strict";oCt.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 fCt=S((hCi,$Be)=>{"use strict";var pcn=/[\p{Lu}]/u,mcn=/[\p{Ll}]/u,aCt=/^[\p{Lu}](?![\p{Lu}])/gu,lCt=/([\p{Alpha}\p{N}_]|$)/u,cCt=/[_.\- ]+/,hcn=new RegExp("^"+cCt.source),sCt=new RegExp(cCt.source+lCt.source,"gu"),uCt=new RegExp("\\d+"+lCt.source,"gu"),gcn=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a<t.length;a++){let s=t[a];n&&pcn.test(s)?(t=t.slice(0,a)+"-"+t.slice(a),n=!1,i=o,o=!0,a++):o&&i&&mcn.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},ycn=(t,e)=>(aCt.lastIndex=0,t.replace(aCt,r=>e(r))),bcn=(t,e)=>(sCt.lastIndex=0,uCt.lastIndex=0,t.replace(sCt,(r,n)=>e(n)).replace(uCt,r=>e(r))),dCt=(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=gcn(t,r,n)),t=t.replace(hcn,""),e.preserveConsecutiveUppercase?t=ycn(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),bcn(t,n))};$Be.exports=dCt;$Be.exports.default=dCt});function mCt(t,e){return e?.[t]||(0,pCt.default)(t)}function hCt(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var pCt,_cn,gCt=v(()=>{pCt=$(iCt(),1),_cn=$(fCt(),1)});function vcn(t){return"lc"in t||Object.keys(t).length===1&&yCt in t}function wcn(t){return{[yCt]:t}}function Scn(t){return t!==null&&typeof t=="object"&&"lc_serializable"in t&&typeof t.toJSON=="function"}function Ccn(t){let e;return t!==null&&typeof t=="object"?"lc_id"in t&&Array.isArray(t.lc_id)?e=t.lc_id:e=[t.constructor?.name??"Object"]:e=[typeof t],{lc:1,type:"not_implemented",id:e}}function Tpe(t,e=new WeakSet){if(t!==null&&typeof t=="object"&&!Array.isArray(t)){if(e.has(t))return Ccn(t);if(Scn(t))return t;e.add(t);let r=t;if(vcn(r))return e.delete(t),wcn(r);let n={};for(let[o,i]of Object.entries(r))n[o]=Tpe(i,e);return e.delete(t),n}return Array.isArray(t)?t.map(r=>Tpe(r,e)):t}var yCt,bCt=v(()=>{yCt="__lc_escaped__"});function _Ct(t){return Array.isArray(t)?[...t]:{...t}}function xcn(t,e){let r=_Ct(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]=_Ct(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function LBe(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 b_,DL=v(()=>{zo();gCt();bCt();b_=class vCt{constructor(e,...r){x(this,"lc_serializable",!1);x(this,"lc_kwargs");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??{}}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,LBe(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof vCt||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((s,u)=>(s[u]=u in this?this[u]:this.lc_kwargs[u],s),{});for(let s=Object.getPrototypeOf(this);s;s=Object.getPrototypeOf(s))Object.assign(e,Reflect.get(s,"lc_aliases",this)),Object.assign(r,Reflect.get(s,"lc_secrets",this)),Object.assign(n,Reflect.get(s,"lc_attributes",this));Object.keys(r).forEach(s=>{let u=this,l=n,[c,...d]=s.split(".").reverse();for(let f of d.reverse()){if(!(f in u)||u[f]===void 0)return;(!(f in l)||l[f]===void 0)&&(typeof u[f]=="object"&&u[f]!=null?l[f]={}:Array.isArray(u[f])&&(l[f]=[])),u=u[f],l=l[f]}c in u&&u[c]!==void 0&&(l[c]=l[c]||u[c])});let o={},i=new WeakSet;i.add(this);for(let[s,u]of Object.entries(n))o[s]=Tpe(u,i);let a=hCt(Object.keys(r).length?xcn(o,r):o,mCt,e);return{lc:1,type:"constructor",id:this.lc_id,kwargs:a}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});var wCt,bz,SCt,jL,TQ=v(()=>{wCt=Symbol.for("ls:tracing_async_local_storage"),bz=Symbol.for("lc:context_variables"),SCt=t=>{globalThis[wCt]=t},jL=()=>globalThis[wCt]});function py(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 OQ(t){return py(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function EQ(t){return py(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function FBe(t){return py(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function kBe(t){if(py(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 Ope(t){let e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);let r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);let o={};for(let i of t.split(";").slice(1)){let a=i.split("=");if(a.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);let s=a[0].trim(),u=a[1].trim();if(s==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);o[s]=u}return{type:r,subtype:n,parameters:o}}function bb({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 AN(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 PQ=v(()=>{});function cr(t,e){return Ur(t)&&t.type===e}function Ur(t){return typeof t=="object"&&t!==null}function Ch(t){return Array.isArray(t)}function ot(t){return typeof t=="string"}function Wv(t){return typeof t=="number"}function Epe(t){return t instanceof Uint8Array}function qBe(t){try{return JSON.parse(t)}catch{return}}var Jv,fS=v(()=>{Jv=t=>t()});function Tcn(t){if(t.type==="char_location"&&ot(t.document_title)&&Wv(t.start_char_index)&&Wv(t.end_char_index)&&ot(t.cited_text)){let{document_title:e,start_char_index:r,end_char_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"char",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="page_location"&&ot(t.document_title)&&Wv(t.start_page_number)&&Wv(t.end_page_number)&&ot(t.cited_text)){let{document_title:e,start_page_number:r,end_page_number:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"page",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="content_block_location"&&ot(t.document_title)&&Wv(t.start_block_index)&&Wv(t.end_block_index)&&ot(t.cited_text)){let{document_title:e,start_block_index:r,end_block_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"block",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="web_search_result_location"&&ot(t.url)&&ot(t.title)&&ot(t.encrypted_index)&&ot(t.cited_text)){let{url:e,title:r,encrypted_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"url",url:e,title:r,startIndex:Number(n),endIndex:Number(n),citedText:o}}if(t.type==="search_result_location"&&ot(t.source)&&ot(t.title)&&Wv(t.start_block_index)&&Wv(t.end_block_index)&&ot(t.cited_text)){let{source:e,title:r,start_block_index:n,end_block_index:o,cited_text:i,...a}=t;return{...a,type:"citation",source:"search",url:e,title:r??void 0,startIndex:n,endIndex:o,citedText:i}}}function xCt(t){if(cr(t,"document")&&Ur(t.source)&&"type"in t.source){if(t.source.type==="base64"&&ot(t.source.media_type)&&ot(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&ot(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&ot(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&ot(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(cr(t,"image")&&Ur(t.source)&&"type"in t.source){if(t.source.type==="base64"&&ot(t.source.media_type)&&ot(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&ot(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&ot(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function TCt(t){function*e(){for(let r of t){let n=xCt(r);n?yield n:yield r}}return Array.from(e())}function CCt(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(cr(n,"text")&&ot(n.text)){let{text:o,citations:i,...a}=n;if(Ch(i)&&i.length){let s=i.reduce((u,l)=>{let c=Tcn(l);return c?[...u,c]:u},[]);yield{...a,type:"text",text:o,annotations:s};continue}else{yield{...a,type:"text",text:o};continue}}else if(cr(n,"thinking")&&ot(n.thinking)){let{thinking:o,signature:i,...a}=n;yield{...a,type:"reasoning",reasoning:o,signature:i};continue}else if(cr(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(cr(n,"tool_use")&&ot(n.name)&&ot(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(cr(n,"input_json_delta")){if(Ocn(t)&&t.tool_call_chunks?.length){let o=t.tool_call_chunks[0];yield{type:"tool_call_chunk",id:o.id,name:o.name,args:o.args,index:o.index};continue}}else if(cr(n,"server_tool_use")&&ot(n.name)&&ot(n.id)){let{name:o,id:i}=n;if(o==="web_search"){yield{id:i,type:"server_tool_call",name:"web_search",args:{query:Jv(()=>{if(typeof n.input=="string")return n.input;if(Ur(n.input)&&ot(n.input.query))return n.input.query;if(ot(n.partial_json)){let a=qBe(n.partial_json);if(a?.query)return a.query}return""})}};continue}else if(n.name==="code_execution"){yield{id:i,type:"server_tool_call",name:"code_execution",args:{code:Jv(()=>{if(typeof n.input=="string")return n.input;if(Ur(n.input)&&ot(n.input.code))return n.input.code;if(ot(n.partial_json)){let a=qBe(n.partial_json);if(a?.code)return a.code}return""})}};continue}}else if(cr(n,"web_search_tool_result")&&ot(n.tool_use_id)&&Ch(n.content)){let{content:o,tool_use_id:i}=n;yield{type:"server_tool_call_result",name:"web_search",toolCallId:i,status:"success",output:{urls:o.reduce((a,s)=>cr(s,"web_search_result")?[...a,s.url]:a,[])}};continue}else if(cr(n,"code_execution_tool_result")&&ot(n.tool_use_id)&&Ur(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(cr(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(cr(n,"mcp_tool_result")&&ot(n.tool_use_id)&&Ur(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(cr(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(cr(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(cr(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let o=xCt(n);if(o){yield o;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}function Ocn(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}var OCt,BBe=v(()=>{fS();OCt={translateContent:CCt,translateContentChunk:CCt}});function Ecn(t){return OQ(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:EQ(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:FBe(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function ECt(t){return t.map(Ecn)}function PCt(t){return!!(cr(t,"image_url")&&Ur(t.image_url)||cr(t,"input_audio")&&Ur(t.input_audio)||cr(t,"file")&&Ur(t.file))}function MCt(t){if(cr(t,"image_url")&&Ur(t.image_url)&&ot(t.image_url.url)){let e=bb({dataUrl:t.image_url.url});return e?{type:"image",mimeType:e.mime_type,data:e.data}:{type:"image",url:t.image_url.url}}else{if(cr(t,"input_audio")&&Ur(t.input_audio)&&ot(t.input_audio.data)&&ot(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(cr(t,"file")&&Ur(t.file)&&ot(t.file.data)){let e=bb({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(ot(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}var UBe=v(()=>{PQ();fS()});function Pcn(t){let e=[];typeof t.content=="string"?t.content.length>0&&e.push({type:"text",text:t.content}):e.push(...Ppe(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function Mcn(t){let e=[];typeof t.content=="string"?t.content.length>0&&e.push({type:"text",text:t.content}):e.push(...Ppe(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function Ppe(t){let e=[];for(let r of t)PCt(r)?e.push(MCt(r)):e.push(r);return e}function Rcn(t){if(t.type==="url_citation"){let{url:e,title:r,start_index:n,end_index:o}=t;return{type:"citation",url:e,title:r,startIndex:n,endIndex:o}}if(t.type==="file_citation"){let{file_id:e,filename:r,index:n}=t;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:e}}return t}function RCt(t){function*e(){Ur(t.additional_kwargs?.reasoning)&&Ch(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((n,o)=>Ur(o)&&ot(o.text)?`${n}${o.text}`:n,"")});let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r)if(cr(n,"text")){let{text:o,annotations:i,...a}=n;Array.isArray(i)?yield{...a,type:"text",text:String(o),annotations:i.map(Rcn)}:yield{...a,type:"text",text:String(o)}}for(let n of t.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(Ur(t.additional_kwargs)&&Ch(t.additional_kwargs.tool_outputs))for(let n of t.additional_kwargs.tool_outputs){if(cr(n,"web_search_call")){let o={};if(Ur(n.action)&&ot(n.action.query)&&(o.query=n.action.query),yield{id:n.id,type:"server_tool_call",name:"web_search",args:o},n.status==="completed"||n.status==="failed"){let i={};Ur(n.action)&&(i.action=n.action),yield{type:"server_tool_call_result",toolCallId:ot(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:i}}continue}else if(cr(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{queries:Ch(n.queries)?n.queries:[]}},(n.status==="completed"||n.status==="failed")&&(yield{type:"server_tool_call_result",toolCallId:ot(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:Ch(n.results)?{results:n.results}:{}});continue}else if(cr(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(cr(n,"code_interpreter_call")){if(ot(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),Ch(n.outputs)){let o=Jv(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(let i of n.outputs)if(cr(i,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:o??0,stderr:[0,void 0].includes(o)?void 0:String(i.logs),stdout:[0,void 0].includes(o)?String(i.logs):void 0}};continue}}continue}else if(cr(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(cr(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(cr(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(cr(n,"image_generation_call")){ot(n.result)&&(yield{type:"image",mimeType:"image/png",data:n.result,id:ot(n.id)?n.id:void 0,metadata:{status:ot(n.status)?n.status:void 0}}),yield{type:"non_standard",value:n};continue}Ur(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function Icn(t){function*e(){yield*RCt(t);for(let r of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(e())}var ICt,zBe=v(()=>{fS();UBe();ICt={translateContent:t=>typeof t.content=="string"?Pcn(t):RCt(t),translateContentChunk:t=>typeof t.content=="string"?Mcn(t):Icn(t)}});function VBe(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var HBe=v(()=>{});function ACt(t,e="pretty"){return e==="pretty"?Acn(t):JSON.stringify(t)}function Acn(t){let e=[],r=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),o="=".repeat(n),i=r.length%2===0?o:`${o}=`;if(e.push(`${o}${r}${i}`),t.type==="ai"){let a=t;if(a.tool_calls&&a.tool_calls.length>0){e.push("Tool Calls:");for(let s of a.tool_calls){e.push(`  ${s.name} (${s.id})`),e.push(` Call ID: ${s.id}`),e.push("  Args:");for(let[u,l]of Object.entries(s.args))e.push(`    ${u}: ${typeof l=="object"?JSON.stringify(l):l}`)}}}if(t.type==="tool"){let a=t;a.name&&e.push(`Name: ${a.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(`
`)}var NCt=v(()=>{});function _b(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.length===0?t:Array.isArray(e)&&e.some(r=>py(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?_z(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>py(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function JBe(t,e){return t==="error"||e==="error"?"error":"success"}function Ncn(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 pc(t,e,r){let n=r?.ignoreKeys??$Ct;if(t==null&&e==null)return;if(t==null||e==null)return t??e;let o={...t};for(let[i,a]of Object.entries(e))if(o[i]==null)o[i]=a;else{if(a==null)continue;if(typeof o[i]!=typeof a||Array.isArray(o[i])!==Array.isArray(a))throw new Error(`field[${i}] already exists in the message chunk, but with a different type.`);if(typeof o[i]=="string"){if(i==="type")continue;if(["id","name","output_version","model_provider"].includes(i))a&&(o[i]=a);else{if(n.includes(i))continue;o[i]+=a}}else if(typeof o[i]=="number"){if(n.includes(i))continue;o[i]=o[i]+a}else if(typeof o[i]=="object"&&!Array.isArray(o[i]))o[i]=pc(o[i],a,r);else if(Array.isArray(o[i]))o[i]=_z(o[i],a,r);else{if(o[i]===a)continue;console.warn(`field[${i}] already exists in this message chunk and value has unsupported type.`)}}return o}function Dcn(t){return typeof t=="number"||typeof t=="string"}function DCt(t){return typeof t!="object"||t===null||!("index"in t)?!1:Dcn(t.index)}function _z(t,e,r){if(!(t==null&&e==null)){if(t==null||e==null)return t||e;{let n=[...t];for(let o of e)if(DCt(o)){let i=n.findIndex(a=>{if(!DCt(a))return!1;let s=a.index===o.index,u=a.id!=null&&o.id!=null&&a.id===o.id,l=a.id==null||o.id==null;return s&&(u||l)});i!==-1&&typeof n[i]=="object"&&n[i]!==null?n[i]=pc(n[i],o,r):n.push(o)}else{if(typeof o=="object"&&o!==null&&"text"in o&&o.text==="")continue;n.push(o)}return n}}}function KBe(t,e,r){if(!(t==null&&e==null)){if(t==null||e==null)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 _z(t,e,r);if(typeof t=="object"&&typeof e=="object")return pc(t,e,r);if(t===e)return t;throw new Error(`Can not merge objects of different types.
Left ${t}
Right ${e}`)}}function GBe(t){return typeof t.role=="string"}function pS(t){return typeof t?._getType=="function"}function Mpe(t){return __.isInstance(t)}var WBe,jCt,Sm,$Ct,__,my=v(()=>{DL();PQ();BBe();UBe();zBe();HBe();NCt();WBe=Symbol.for("langchain.message");Sm=class extends b_{constructor(e){let r=typeof e=="string"||Array.isArray(e)?{content:e}:e;r.additional_kwargs||(r.additional_kwargs={}),r.response_metadata||(r.response_metadata={});super(r);x(this,"lc_namespace",["langchain_core","messages"]);x(this,"lc_serializable",!0);x(this,jCt,!0);x(this,"id");x(this,"name");x(this,"content");x(this,"additional_kwargs");x(this,"response_metadata");this.name=r.name,r.content===void 0&&r.contentBlocks!==void 0?(this.content=r.contentBlocks,this.response_metadata={output_version:"v1",...r.response_metadata}):r.content!==void 0?(this.content=r.content??[],this.response_metadata=r.response_metadata):(this.content=[],this.response_metadata=r.response_metadata),this.additional_kwargs=r.additional_kwargs,this.id=r.id}get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}_getType(){return this.type}getType(){return this._getType()}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(""):""}get contentBlocks(){let e=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[ECt,Ppe,TCt].reduce((r,n)=>n(r),e)}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}}static isInstance(e){return typeof e=="object"&&e!==null&&WBe in e&&e[WBe]===!0&&VBe(e)}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[(jCt=WBe,Symbol.toStringTag)](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(e===null)return this;let r=Ncn(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}toFormattedString(e="pretty"){return ACt(this,e)}},$Ct=["index","created","timestamp"];__=class LCt extends Sm{static isInstance(e){if(!super.isInstance(e))return!1;let r=Object.getPrototypeOf(e);for(;r!==null;){if(r===LCt.prototype)return!0;r=Object.getPrototypeOf(r)}return!1}}});function XBe(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function ZBe(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);e.push({name:o||"",args:i||{},id:n.id})}catch{r.push({name:o,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[e,r]}function YBe(t){return typeof t=="object"&&t!==null&&"getType"in t&&typeof t.getType=="function"&&t.getType()==="tool"}var Kv,$L,k6=v(()=>{zo();my();Kv=class extends Sm{constructor(e,r,n){let o=typeof e=="string"||Array.isArray(e)?{content:e,name:n,tool_call_id:r}:e;super(o);x(this,"lc_direct_tool_output",!0);x(this,"type","tool");x(this,"status");x(this,"tool_call_id");x(this,"metadata");x(this,"artifact");this.tool_call_id=o.tool_call_id,this.artifact=o.artifact,this.status=o.status,this.metadata=o.metadata}static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}static isInstance(e){return super.isInstance(e)&&e.type==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},$L=class extends __{constructor(e){super(e);x(this,"type","tool");x(this,"tool_call_id");x(this,"status");x(this,"artifact");this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}static lc_name(){return"ToolMessageChunk"}concat(e){let r=this.constructor;return new r({content:_b(this.content,e.content),additional_kwargs:pc(this.additional_kwargs,e.additional_kwargs),response_metadata:pc(this.response_metadata,e.response_metadata),artifact:KBe(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:JBe(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function QBe(t){switch(t){case"csv":return"text/csv";case"doc":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"html":return"text/html";case"md":return"text/markdown";case"pdf":return"application/pdf";case"txt":return"text/plain";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"gif":return"image/gif";case"jpeg":return"image/jpeg";case"jpg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"flv":return"video/flv";case"mkv":return"video/mkv";case"mov":return"video/mov";case"mp4":return"video/mp4";case"mpeg":return"video/mpeg";case"mpg":return"video/mpg";case"three_gp":return"video/three_gp";case"webm":return"video/webm";case"wmv":return"video/wmv";default:return"application/octet-stream"}}function jcn(t){if(Ur(t.document)&&Ur(t.document.source)){let e=QBe(Ur(t.document)&&ot(t.document.format)?t.document.format:"");if(Ur(t.document.source)){if(Ur(t.document.source.s3Location)&&ot(t.document.source.s3Location.uri))return{type:"file",mimeType:e,fileId:t.document.source.s3Location.uri};if(Epe(t.document.source.bytes))return{type:"file",mimeType:e,data:t.document.source.bytes};if(ot(t.document.source.text))return{type:"file",mimeType:e,data:Buffer.from(t.document.source.text).toString("base64")};if(Ch(t.document.source.content))return{type:"file",mimeType:e,data:t.document.source.content.reduce((r,n)=>Ur(n)&&ot(n.text)?r+n.text:r,"")}}}return{type:"non_standard",value:t}}function $cn(t){if(cr(t,"image")&&Ur(t.image)){let e=QBe(Ur(t.image)&&ot(t.image.format)?t.image.format:"");if(Ur(t.image.source)){if(Ur(t.image.source.s3Location)&&ot(t.image.source.s3Location.uri))return{type:"image",mimeType:e,fileId:t.image.source.s3Location.uri};if(Epe(t.image.source.bytes))return{type:"image",mimeType:e,data:t.image.source.bytes}}}return{type:"non_standard",value:t}}function Lcn(t){if(cr(t,"video")&&Ur(t.video)){let e=QBe(Ur(t.video)&&ot(t.video.format)?t.video.format:"");if(Ur(t.video.source)){if(Ur(t.video.source.s3Location)&&ot(t.video.source.s3Location.uri))return{type:"video",mimeType:e,fileId:t.video.source.s3Location.uri};if(Epe(t.video.source.bytes))return{type:"video",mimeType:e,data:t.video.source.bytes}}}return{type:"non_standard",value:t}}function FCt(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(cr(n,"cache_point")){yield{type:"non_standard",value:n};continue}else if(cr(n,"citations_content")&&Ur(n.citationsContent)){yield{type:"text",text:Ch(n.citationsContent.content)?n.citationsContent.content.reduce((o,i)=>Ur(i)&&ot(i.text)?o+i.text:o,""):"",annotations:Ch(n.citationsContent.citations)?n.citationsContent.citations.reduce((o,i)=>{if(Ur(i)){let a=Ch(i.sourceContent)?i.sourceContent.reduce((u,l)=>Ur(l)&&ot(l.text)?u+l.text:u,""):"",s=Jv(()=>{if(Ur(i.location)){let u=i.location.documentChar||i.location.documentPage||i.location.documentChunk;if(Ur(u))return{source:Wv(u.documentIndex)?u.documentIndex.toString():void 0,startIndex:Wv(u.start)?u.start:void 0,endIndex:Wv(u.end)?u.end:void 0}}return{}});o.push({type:"citation",citedText:a,...s})}return o},[]):[]};continue}else if(cr(n,"document")&&Ur(n.document)){yield jcn(n);continue}else if(cr(n,"guard_content")){yield{type:"non_standard",value:n};continue}else if(cr(n,"image")&&Ur(n.image)){yield $cn(n);continue}else if(cr(n,"reasoning_content")&&ot(n.reasoningText)){yield{type:"reasoning",reasoning:n.reasoningText};continue}else if(cr(n,"text")&&ot(n.text)){yield{type:"text",text:n.text};continue}else if(cr(n,"tool_result")){yield{type:"non_standard",value:n};continue}else{if(cr(n,"tool_call"))continue;if(cr(n,"video")&&Ur(n.video)){yield Lcn(n);continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var kCt,qCt=v(()=>{fS();kCt={translateContent:FCt,translateContentChunk:FCt}});function BCt(t){let e=[],r=t.additional_kwargs?.reasoning_content;if(ot(r)&&r.length>0&&e.push({type:"reasoning",reasoning:r}),typeof t.content=="string")t.content.length>0&&e.push({type:"text",text:t.content});else for(let n of t.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&ot(n.text)&&e.push({type:"text",text:n.text});for(let n of t.tool_calls??[])e.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return e}var UCt,zCt=v(()=>{fS();UCt={translateContent:BCt,translateContentChunk:BCt}});function VCt(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(cr(n,"text")&&ot(n.text)){yield{type:"text",text:n.text};continue}else if(cr(n,"thinking")&&ot(n.thinking)){yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};continue}else if(cr(n,"inlineData")&&Ur(n.inlineData)&&ot(n.inlineData.mimeType)&&ot(n.inlineData.data)){yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data};continue}else if(cr(n,"functionCall")&&Ur(n.functionCall)&&ot(n.functionCall.name)&&Ur(n.functionCall.args)){yield{type:"tool_call",id:t.id,name:n.functionCall.name,args:n.functionCall.args};continue}else if(cr(n,"functionResponse")){yield{type:"non_standard",value:n};continue}else if(cr(n,"fileData")&&Ur(n.fileData)&&ot(n.fileData.mimeType)&&ot(n.fileData.fileUri)){yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri};continue}else if(cr(n,"executableCode")){yield{type:"non_standard",value:n};continue}else if(cr(n,"codeExecutionResult")){yield{type:"non_standard",value:n};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var HCt,WCt=v(()=>{fS();HCt={translateContent:VCt,translateContentChunk:VCt}});function JCt(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(cr(n,"reasoning")&&ot(n.reasoning)){let o=Jv(()=>{let i=r.indexOf(n);if(Ch(t.additional_kwargs?.signatures)&&i>=0)return t.additional_kwargs.signatures.at(i)});ot(o)?yield{type:"reasoning",reasoning:n.reasoning,signature:o}:yield{type:"reasoning",reasoning:n.reasoning};continue}else if(cr(n,"thinking")&&ot(n.thinking)){yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};continue}else if(cr(n,"text")&&ot(n.text)){yield{type:"text",text:n.text};continue}else if(cr(n,"image_url")){if(ot(n.image_url))if(n.image_url.startsWith("data:")){let o=n.image_url.match(/^data:([^;]+);base64,(.+)$/);o?yield{type:"image",data:o[2],mimeType:o[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url};continue}else if(cr(n,"media")&&ot(n.mimeType)&&ot(n.data)){yield{type:"file",mimeType:n.mimeType,data:n.data};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var KCt,GCt=v(()=>{fS();KCt={translateContent:JCt,translateContentChunk:JCt}});function XCt(t){let e=[],r=t.additional_kwargs?.reasoning;if(ot(r)&&r.length>0&&e.push({type:"reasoning",reasoning:r}),typeof t.content=="string"){let n=t.content,o=n.match(/<think>([\s\S]*?)<\/think>/);if(o){let i=o[1].trim();i.length>0&&e.push({type:"reasoning",reasoning:i}),n=n.replace(/<think>[\s\S]*?<\/think>/,"").trim()}n.length>0&&e.push({type:"text",text:n})}else for(let n of t.content)if(typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&ot(n.text)){let o=n.text,i=o.match(/<think>([\s\S]*?)<\/think>/);if(i){let a=i[1].trim();a.length>0&&e.push({type:"reasoning",reasoning:a}),o=o.replace(/<think>[\s\S]*?<\/think>/,"").trim()}o.length>0&&e.push({type:"text",text:o})}for(let n of t.tool_calls??[])e.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return e}var ZCt,YCt=v(()=>{fS();ZCt={translateContent:XCt,translateContentChunk:XCt}});function QCt(t){let e=[],r=t.additional_kwargs?.reasoning_content;if(ot(r)&&r.length>0&&e.push({type:"reasoning",reasoning:r}),typeof t.content=="string")t.content.length>0&&e.push({type:"text",text:t.content});else for(let n of t.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&ot(n.text)&&e.push({type:"text",text:n.text});for(let n of t.tool_calls??[])e.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return e}var ext,txt=v(()=>{fS();ext={translateContent:QCt,translateContentChunk:QCt}});function rxt(t){let e=[];if(Ur(t.additional_kwargs?.reasoning)){let n=t.additional_kwargs.reasoning;if(Ch(n.summary)){let o=n.summary.reduce((i,a)=>Ur(a)&&ot(a.text)?`${i}${a.text}`:i,"");o.length>0&&e.push({type:"reasoning",reasoning:o})}}let r=t.additional_kwargs?.reasoning_content;if(ot(r)&&r.length>0&&e.push({type:"reasoning",reasoning:r}),typeof t.content=="string")t.content.length>0&&e.push({type:"text",text:t.content});else for(let n of t.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&ot(n.text)&&e.push({type:"text",text:n.text});for(let n of t.tool_calls??[])e.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return e}var nxt,oxt=v(()=>{fS();nxt={translateContent:rxt,translateContentChunk:rxt}});function ixt(t){function*e(){let r=Jv(()=>typeof t.content=="string"?t.additional_kwargs.originalTextContentBlock?[{...t.additional_kwargs.originalTextContentBlock,type:"text"}]:[{type:"text",text:t.content}]:t.content);for(let n of r){let o=Jv(()=>cr(n,"text")&&ot(n.text)?{type:"text",text:n.text}:cr(n,"inlineData")&&Ur(n.inlineData)&&ot(n.inlineData.mimeType)&&ot(n.inlineData.data)?{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data}:cr(n,"functionCall")&&Ur(n.functionCall)&&ot(n.functionCall.name)&&Ur(n.functionCall.args)?{type:"tool_call",id:t.id,name:n.functionCall.name,args:n.functionCall.args}:cr(n,"functionResponse")?{type:"non_standard",value:n}:cr(n,"fileData")&&Ur(n.fileData)&&ot(n.fileData.mimeType)&&ot(n.fileData.fileUri)?{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri}:cr(n,"executableCode")?{type:"non_standard",value:n}:cr(n,"codeExecutionResult")?{type:"non_standard",value:n}:{type:"non_standard",value:n}),i=Jv(()=>"thought"in n&&n.thought?{type:"reasoning",reasoning:o.type==="text"?o.text:"",reasoningContentBlock:o}:o),a={thought:n.thought,thoughtSignature:n.thoughtSignature,partMetadata:n.partMetadata,...i};for(let s in a)a[s]===void 0&&delete a[s];yield a}}return Array.from(e())}var axt,sxt=v(()=>{fS();axt={translateContent:ixt,translateContentChunk:ixt}});function eUe(t){return globalThis.lc_block_translators_registry.get(t)}var uxt=v(()=>{BBe();zBe();qCt();zCt();WCt();GCt();YCt();txt();oxt();sxt();globalThis.lc_block_translators_registry??(globalThis.lc_block_translators_registry=new Map([["anthropic",OCt],["bedrock-converse",kCt],["deepseek",UCt],["google",axt],["google-genai",HCt],["google-vertexai",KCt],["groq",ZCt],["ollama",ext],["openai",ICt],["xai",nxt]]))});function tUe(t,e){return pc(t,e)??{}}function lxt(t,e){let r={};return(t?.audio!==void 0||e?.audio!==void 0)&&(r.audio=(t?.audio??0)+(e?.audio??0)),(t?.image!==void 0||e?.image!==void 0)&&(r.image=(t?.image??0)+(e?.image??0)),(t?.video!==void 0||e?.video!==void 0)&&(r.video=(t?.video??0)+(e?.video??0)),(t?.document!==void 0||e?.document!==void 0)&&(r.document=(t?.document??0)+(e?.document??0)),(t?.text!==void 0||e?.text!==void 0)&&(r.text=(t?.text??0)+(e?.text??0)),r}function Fcn(t,e){let r={...lxt(t,e)};return(t?.cache_read!==void 0||e?.cache_read!==void 0)&&(r.cache_read=(t?.cache_read??0)+(e?.cache_read??0)),(t?.cache_creation!==void 0||e?.cache_creation!==void 0)&&(r.cache_creation=(t?.cache_creation??0)+(e?.cache_creation??0)),r}function kcn(t,e){let r={...lxt(t,e)};return(t?.reasoning!==void 0||e?.reasoning!==void 0)&&(r.reasoning=(t?.reasoning??0)+(e?.reasoning??0)),r}function MQ(t,e){return{input_tokens:(t?.input_tokens??0)+(e?.input_tokens??0),output_tokens:(t?.output_tokens??0)+(e?.output_tokens??0),total_tokens:(t?.total_tokens??0)+(e?.total_tokens??0),input_token_details:Fcn(t?.input_token_details,e?.input_token_details),output_token_details:kcn(t?.output_token_details,e?.output_token_details)}}var Rpe=v(()=>{my()});function mc(t){return t._getType()==="ai"}function Ipe(t){return t._getType()==="ai"}var uo,Hr,mS=v(()=>{my();uxt();Rpe();k6();TC();uo=class extends Sm{constructor(e){let r;if(typeof e=="string"||Array.isArray(e))r={content:e,tool_calls:[],invalid_tool_calls:[],additional_kwargs:{}};else{r=e;let n=r.additional_kwargs?.tool_calls,o=r.tool_calls;n!=null&&n.length>0&&(o===void 0||o.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., `pnpm install @langchain/anthropic`,","pnpm install @langchain/openai`, etc."].join(" "));try{if(n!=null&&o===void 0){let[i,a]=ZBe(n);r.tool_calls=i??[],r.invalid_tool_calls=a??[]}else r.tool_calls=r.tool_calls??[],r.invalid_tool_calls=r.invalid_tool_calls??[]}catch{r.tool_calls=[],r.invalid_tool_calls=[]}if(r.response_metadata!==void 0&&"output_version"in r.response_metadata&&r.response_metadata.output_version==="v1"&&(r.contentBlocks=r.content,r.content=void 0),r.contentBlocks!==void 0){r.tool_calls&&r.contentBlocks.push(...r.tool_calls.map(a=>({type:"tool_call",id:a.id,name:a.name,args:a.args})));let i=r.contentBlocks.filter(a=>a.type==="tool_call").filter(a=>!r.tool_calls?.some(s=>s.id===a.id&&s.name===a.name));i.length>0&&(r.tool_calls=i.map(a=>({type:"tool_call",id:a.id,name:a.name,args:a.args})))}}super(r);x(this,"type","ai");x(this,"tool_calls",[]);x(this,"invalid_tool_calls",[]);x(this,"usage_metadata");typeof r!="string"&&(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",usage_metadata:"usage_metadata"}}static lc_name(){return"AIMessage"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let r=eUe(this.response_metadata.model_provider);if(r)return r.translateContent(this)}let e=super.contentBlocks;if(this.tool_calls){let r=this.tool_calls.filter(n=>!e.some(o=>o.id===n.id&&o.name===n.name));e.push(...r.map(n=>({type:"tool_call",id:n.id,name:n.name,args:n.args})))}return e}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}static isInstance(e){return super.isInstance(e)&&e.type==="ai"}};Hr=class extends __{constructor(e){let r;if(typeof e=="string"||Array.isArray(e))r={content:e,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]};else if(e.tool_call_chunks===void 0||e.tool_call_chunks.length===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=rUe(e.tool_call_chunks??[]);r={...e,tool_call_chunks:n.tool_call_chunks,tool_calls:n.tool_calls,invalid_tool_calls:n.invalid_tool_calls,usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0}}super(r);x(this,"type","ai");x(this,"tool_calls",[]);x(this,"invalid_tool_calls",[]);x(this,"tool_call_chunks",[]);x(this,"usage_metadata");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",usage_metadata:"usage_metadata"}}static lc_name(){return"AIMessageChunk"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let r=eUe(this.response_metadata.model_provider);if(r)return r.translateContent(this)}let e=super.contentBlocks;if(this.tool_calls&&typeof this.content!="string"){let r=this.content.filter(n=>n.type==="tool_call").map(n=>n.id);for(let n of this.tool_calls)n.id&&!r.includes(n.id)&&e.push({...n,type:"tool_call",id:n.id,name:n.name,args:n.args})}return e}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:_b(this.content,e.content),additional_kwargs:pc(this.additional_kwargs,e.additional_kwargs),response_metadata:tUe(this.response_metadata,e.response_metadata),tool_call_chunks:[],tool_calls:[],id:this.id??e.id};if(this.tool_call_chunks!==void 0||e.tool_call_chunks!==void 0){let o=_z(this.tool_call_chunks,e.tool_call_chunks);o!==void 0&&o.length>0&&(r.tool_call_chunks=o)}if(this.tool_calls!==void 0||e.tool_calls!==void 0){let o=_z(this.tool_calls,e.tool_calls);o!==void 0&&o.length>0&&(r.tool_calls=o)}(this.usage_metadata!==void 0||e.usage_metadata!==void 0)&&(r.usage_metadata=MQ(this.usage_metadata,e.usage_metadata));let n=this.constructor;return new n(r)}static isInstance(e){return super.isInstance(e)&&e.type==="ai"}}});var hy,kT,RQ=v(()=>{my();hy=class cxt extends Sm{constructor(r,n){(typeof r=="string"||Array.isArray(r))&&(r={content:r,role:n});super(r);x(this,"type","generic");x(this,"role");this.role=r.role}static lc_name(){return"ChatMessage"}static _chatMessageClass(){return cxt}static isInstance(r){return super.isInstance(r)&&r.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},kT=class extends __{constructor(e,r){(typeof e=="string"||Array.isArray(e))&&(e={content:e,role:r});super(e);x(this,"type","generic");x(this,"role");this.role=e.role}static lc_name(){return"ChatMessageChunk"}concat(e){let r=this.constructor;return new r({content:_b(this.content,e.content),additional_kwargs:pc(this.additional_kwargs,e.additional_kwargs),response_metadata:pc(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}}});var qT,Ape=v(()=>{my();qT=class extends __{constructor(){super(...arguments);x(this,"type","function")}static lc_name(){return"FunctionMessageChunk"}concat(e){let r=this.constructor;return new r({content:_b(this.content,e.content),additional_kwargs:pc(this.additional_kwargs,e.additional_kwargs),response_metadata:pc(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});var Au,BT,LL=v(()=>{my();Au=class extends Sm{constructor(e){super(e);x(this,"type","human")}static lc_name(){return"HumanMessage"}static isInstance(e){return super.isInstance(e)&&e.type==="human"}},BT=class extends __{constructor(e){super(e);x(this,"type","human")}static lc_name(){return"HumanMessageChunk"}concat(e){let r=this.constructor;return new r({content:_b(this.content,e.content),additional_kwargs:pc(this.additional_kwargs,e.additional_kwargs),response_metadata:pc(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="human"}}});var Npe,Dpe=v(()=>{my();Npe=class extends Sm{constructor(e){super({...e,content:[]});x(this,"type","remove");x(this,"id");this.id=e.id}get _printableFields(){return{...super._printableFields,id:this.id}}static isInstance(e){return super.isInstance(e)&&e.type==="remove"}}});var v_,UT,IQ=v(()=>{my();v_=class jpe extends Sm{constructor(r){super(r);x(this,"type","system")}static lc_name(){return"SystemMessage"}concat(r){if(typeof r=="string")return new jpe({...this,content:_b(this.content,r)});if(jpe.isInstance(r))return new jpe({...this,additional_kwargs:{...this.additional_kwargs,...r.additional_kwargs},response_metadata:{...this.response_metadata,...r.response_metadata},content:_b(this.content,r.content)});throw new Error("Unexpected chunk type for system message")}static isInstance(r){return super.isInstance(r)&&r.type==="system"}},UT=class extends __{constructor(e){super(e);x(this,"type","system")}static lc_name(){return"SystemMessageChunk"}concat(e){let r=this.constructor;return new r({content:_b(this.content,e.content),additional_kwargs:pc(this.additional_kwargs,e.additional_kwargs),response_metadata:pc(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="system"}}});function qcn(t){return NL(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 Bcn(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function nUe(t){let e,r;if(Bcn(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 Au(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new uo(r);let i=n.map(qcn);return new uo({...o,tool_calls:i})}else{if(e==="system")return new v_(r);if(e==="developer")return new v_({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new Kv({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});if(e==="remove"&&"id"in r&&typeof r.id=="string")return new Npe({...r,id:r.id});throw AL(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 OC(t){if(typeof t=="string")return new Au(t);if(pS(t))return t;if(Array.isArray(t)){let[e,r]=t;return nUe({type:e,content:r})}else if(GBe(t)){let{role:e,...r}=t;return nUe({...r,type:e})}else return nUe(t)}function Ll(t,e="Human",r="AI"){let n=[];for(let o of t){let i;if(o.type==="human")i=e;else if(o.type==="ai")i=r;else if(o.type==="system")i="System";else if(o.type==="tool")i="Tool";else if(o.type==="generic")i=o.role;else throw new Error(`Got unsupported message type: ${o.type}`);let a=o.name?`${o.name}, `:"",s=o.text,u=`${i}: ${a}${s}`;if(o.type==="ai"){let l=o;l.tool_calls&&l.tool_calls.length>0?u+=JSON.stringify(l.tool_calls):l.additional_kwargs&&"function_call"in l.additional_kwargs&&(u+=JSON.stringify(l.additional_kwargs.function_call))}n.push(u)}return n.join(`
`)}function $pe(t){let e=t._getType();if(e==="human")return new BT({...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 Hr({...r})}else{if(e==="system")return new UT({...t});if(e==="function")return new qT({...t});if(hy.isInstance(t))return new kT({...t});throw new Error("Unknown message type.")}}function rUe(t){let e=t.reduce((o,i)=>{let a=o.findIndex(([s])=>"id"in i&&i.id&&"index"in i&&i.index!==void 0?i.id===s.id&&i.index===s.index:"id"in i&&i.id?i.id===s.id:"index"in i&&i.index!==void 0?i.index===s.index:!1);return a!==-1?o[a].push(i):o.push([i]),o},[]),r=[],n=[];for(let o of e){let i=null,a=o[0]?.name??"",s=o.map(c=>c.args||"").join("").trim(),u=s.length?s:"{}",l=o[0]?.id;try{if(i=L6(u),!l||i===null||typeof i!="object"||Array.isArray(i))throw new Error("Malformed tool call chunk args.");r.push({name:a,args:i,id:l,type:"tool_call"})}catch{n.push({name:a,args:u,id:l,error:"Malformed args.",type:"invalid_tool_call"})}}return{tool_call_chunks:t,tool_calls:r,invalid_tool_calls:n}}var oUe,TC=v(()=>{F6();xpe();CQ();my();k6();mS();RQ();Ape();LL();Dpe();IQ();oUe=t=>t()});function fxt(){return iUe===void 0&&(iUe={library:"langchain-js",runtime:sUe()}),iUe}function un(t){try{return typeof process<"u"?process.env?.[t]:aUe()?Deno?.env.get(t):void 0}catch{return}}var Ucn,zcn,Vcn,aUe,Hcn,sUe,iUe,su=v(()=>{zo();Ucn=()=>typeof window<"u"&&typeof window.document<"u",zcn=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",Vcn=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),aUe=()=>typeof Deno<"u",Hcn=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!aUe(),sUe=()=>{let t;return Ucn()?t="browser":Hcn()?t="node":zcn()?t="webworker":Vcn()?t="jsdom":aUe()?t="deno":t="other",t}});function uUe(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var Wcn,q6,pxt,AQ=v(()=>{zo();DL();su();y_();Wcn=class{};q6=class extends Wcn{constructor(e){super();x(this,"lc_serializable",!1);x(this,"lc_kwargs");x(this,"ignoreLLM",!1);x(this,"ignoreChain",!1);x(this,"ignoreAgent",!1);x(this,"ignoreRetriever",!1);x(this,"ignoreCustomEvent",!1);x(this,"raiseError",!1);x(this,"awaitHandlers",un("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))}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,LBe(this.constructor)]}copy(){return new this.constructor(this)}toJSON(){return b_.prototype.toJSON.call(this)}toJSONNotImplemented(){return b_.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class r extends q6{constructor(){super();x(this,"name",FT());Object.assign(this,e)}}return new r}},pxt=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});var mxt,hxt=v(()=>{mxt=/^(?:[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 Jcn(t){return typeof t=="string"&&mxt.test(t)}var gxt,yxt=v(()=>{hxt();gxt=Jcn});function Kcn(t){if(!gxt(t))throw TypeError("Invalid UUID");var e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var bxt,_xt=v(()=>{yxt();bxt=Kcn});function B6(t,e=0){return(gg[t[e+0]]+gg[t[e+1]]+gg[t[e+2]]+gg[t[e+3]]+"-"+gg[t[e+4]]+gg[t[e+5]]+"-"+gg[t[e+6]]+gg[t[e+7]]+"-"+gg[t[e+8]]+gg[t[e+9]]+"-"+gg[t[e+10]]+gg[t[e+11]]+gg[t[e+12]]+gg[t[e+13]]+gg[t[e+14]]+gg[t[e+15]]).toLowerCase()}var gg,Lpe,Fpe=v(()=>{gg=[];for(Lpe=0;Lpe<256;++Lpe)gg.push((Lpe+256).toString(16).slice(1))});function NQ(){if(!kpe&&(kpe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!kpe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return kpe(Gcn)}var kpe,Gcn,lUe=v(()=>{Gcn=new Uint8Array(16)});function Xcn(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}function cUe(t,e,r){function n(o,i,a,s){var u;if(typeof o=="string"&&(o=Xcn(o)),typeof i=="string"&&(i=bxt(i)),((u=i)===null||u===void 0?void 0:u.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var l=new Uint8Array(16+o.length);if(l.set(i),l.set(o,i.length),l=r(l),l[6]=l[6]&15|e,l[8]=l[8]&63|128,a){s=s||0;for(var c=0;c<16;++c)a[s+c]=l[c];return a}return B6(l)}try{n.name=t}catch{}return n.DNS=Zcn,n.URL=Ycn,n}var Zcn,Ycn,vxt=v(()=>{Fpe();_xt();Zcn="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Ycn="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var Qcn,dUe,wxt=v(()=>{Qcn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),dUe={randomUUID:Qcn}});function edn(t,e,r){if(dUe.randomUUID&&!e&&!t)return dUe.randomUUID();t=t||{};var n=t.random||(t.rng||NQ)();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 B6(n)}var vz,Sxt=v(()=>{wxt();lUe();Fpe();vz=edn});function tdn(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function fUe(t,e){return t<<e|t>>>32-e}function rdn(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var n=unescape(encodeURIComponent(t));t=[];for(var o=0;o<n.length;++o)t.push(n.charCodeAt(o))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var i=t.length/4+2,a=Math.ceil(i/16),s=new Array(a),u=0;u<a;++u){for(var l=new Uint32Array(16),c=0;c<16;++c)l[c]=t[u*64+c*4]<<24|t[u*64+c*4+1]<<16|t[u*64+c*4+2]<<8|t[u*64+c*4+3];s[u]=l}s[a-1][14]=(t.length-1)*8/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=(t.length-1)*8&4294967295;for(var d=0;d<a;++d){for(var f=new Uint32Array(80),p=0;p<16;++p)f[p]=s[d][p];for(var m=16;m<80;++m)f[m]=fUe(f[m-3]^f[m-8]^f[m-14]^f[m-16],1);for(var h=r[0],y=r[1],g=r[2],b=r[3],_=r[4],w=0;w<80;++w){var T=Math.floor(w/20),O=fUe(h,5)+tdn(T,y,g,b)+_+e[T]+f[w]>>>0;_=b,b=g,g=fUe(y,30)>>>0,y=h,h=O}r[0]=r[0]+h>>>0,r[1]=r[1]+y>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+b>>>0,r[4]=r[4]+_>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var Cxt,xxt=v(()=>{Cxt=rdn});var ndn,pUe,Txt=v(()=>{vxt();xxt();ndn=cUe("v5",80,Cxt),pUe=ndn});function odn(t,e,r){t=t||{};var n=e&&r||0,o=e||new Uint8Array(16),i=t.random||(t.rng||NQ)(),a=t.msecs!==void 0?t.msecs:Date.now(),s=t.seq!==void 0?t.seq:null,u=Ext,l=Oxt;return a>EC&&t.msecs===void 0&&(EC=a,s!==null&&(u=null,l=null)),s!==null&&(s>2147483647&&(s=2147483647),u=s>>>19&4095,l=s&524287),(u===null||l===null)&&(u=i[6]&127,u=u<<8|i[7],l=i[8]&63,l=l<<8|i[9],l=l<<5|i[10]>>>3),a+1e4>EC&&s===null?++l>524287&&(l=0,++u>4095&&(u=0,EC++)):EC=a,Ext=u,Oxt=l,o[n++]=EC/1099511627776&255,o[n++]=EC/4294967296&255,o[n++]=EC/16777216&255,o[n++]=EC/65536&255,o[n++]=EC/256&255,o[n++]=EC&255,o[n++]=u>>>4&15|112,o[n++]=u&255,o[n++]=l>>>13&63|128,o[n++]=l>>>5&255,o[n++]=l<<3&255|i[10]&7,o[n++]=i[11],o[n++]=i[12],o[n++]=i[13],o[n++]=i[14],o[n++]=i[15],e||B6(o)}var Oxt,Ext,EC,mUe,Pxt=v(()=>{lUe();Fpe();Oxt=null,Ext=null,EC=0;mUe=odn});var qpe=v(()=>{Sxt();Txt();Pxt()});var Mxt,Rxt,hUe,Ixt,gUe,yUe,bUe,Axt,Nxt,Dxt,jxt,$xt,Lxt,Fxt,kxt,qxt,Bxt,Uxt,zxt,Vxt,Hxt,Wxt,Jxt,Kxt,Gxt,Xxt,Zxt,Yxt,Qxt,eTt,_Ue,tTt,rTt,nTt=v(()=>{Mxt="gen_ai.operation.name",Rxt="gen_ai.system",hUe="gen_ai.request.model",Ixt="gen_ai.response.model",gUe="gen_ai.usage.input_tokens",yUe="gen_ai.usage.output_tokens",bUe="gen_ai.usage.total_tokens",Axt="gen_ai.request.max_tokens",Nxt="gen_ai.request.temperature",Dxt="gen_ai.request.top_p",jxt="gen_ai.request.frequency_penalty",$xt="gen_ai.request.presence_penalty",Lxt="gen_ai.response.finish_reasons",Fxt="gen_ai.prompt",kxt="gen_ai.completion",qxt="gen_ai.request.extra_query",Bxt="gen_ai.request.extra_body",Uxt="gen_ai.serialized.name",zxt="gen_ai.serialized.signature",Vxt="gen_ai.serialized.doc",Hxt="gen_ai.response.id",Wxt="gen_ai.response.service_tier",Jxt="gen_ai.response.system_fingerprint",Kxt="gen_ai.usage.input_token_details",Gxt="gen_ai.usage.output_token_details",Xxt="langsmith.trace.session_id",Zxt="langsmith.trace.session_name",Yxt="langsmith.span.kind",Qxt="langsmith.trace.name",eTt="langsmith.metadata",_Ue="langsmith.span.tags",tTt="langsmith.request.streaming",rTt="langsmith.request.headers"});var sdn,udn,oTt,iTt,aTt,vUe=v(()=>{NN();sdn=(...t)=>fetch(...t),oTt=Symbol.for("ls:fetch_implementation"),iTt=()=>globalThis[oTt]===void 0?!0:udn??!1,aTt=t=>async(...e)=>{if(t||td("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[oTt]??sdn)(...e);return(t||td("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r}});var DQ,wUe=v(()=>{NN();DQ=()=>td("PROJECT")??Gv("LANGCHAIN_SESSION")??"default"});function wz(t){sTt[t]||(console.warn(t),sTt[t]=!0)}var sTt,Bpe=v(()=>{sTt={}});function pdn(t){let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)e[r/2]=parseInt(t.substring(r,r+2),16);return e}function Ju(t,e=0){return new Uint8Array(t.buffer,t.byteOffset+e,t.length-e)}function cl(t,e=0){return new DataView(t.buffer,t.byteOffset+e).getBigUint64(0,!0)}function U6(t,e=0){return new DataView(t.buffer,t.byteOffset+e).getUint32(0,!0)}function SUe(t,e=0){return t[e]}function bdn(t,e){return(t<<e|t>>et(32)-e)&Hpe}function hTt(t,e,r){for(let n=0;n<mTt;n++){let o=cl(e,n*8),i=o^cl(r,n*8);t[n^1]+=o,t[n]+=ydn(i,i>>et(32))}return t}function uTt(t,e,r,n){for(let o=0;o<n;o++)hTt(t,Ju(e,o*DN),Ju(r,o*8));return t}function _dn(t,e){for(let r=0;r<mTt;r++){let n=cl(e,r*8),o=t[r];o=CUe(o,et(47)),o^=n,o*=dTt,t[r]=o&ii}return t}function zpe(t,e){return gTt(t[0]^cl(e,0),t[1]^cl(e,mdn))}function lTt(t,e,r){let n=r;return n+=zpe(t.slice(0),Ju(e,0*Upe)),n+=zpe(t.slice(2),Ju(e,4*Upe)),n+=zpe(t.slice(4),Ju(e,8*Upe)),n+=zpe(t.slice(6),Ju(e,12*Upe)),VT(n&ii)}function vdn(t,e,r,n,o){let i=Math.floor((r.byteLength-DN)/8),a=DN*i,s=Math.floor((e.byteLength-1)/a);for(let u=0;u<s;u++)t=uTt(t,Ju(e,u*a),r,i),t=o(t,Ju(r,r.byteLength-DN));{let u=Math.floor((e.byteLength-1-a*s)/DN);t=uTt(t,Ju(e,s*a),r,u),t=n(t,Ju(e,e.byteLength-DN),Ju(r,r.byteLength-DN-7))}return t}function wdn(t,e,r){let n=new BigUint64Array([ldn,FL,Sz,pTt,TUe,fTt,cdn,dTt]);V6(t.length>128),n=vdn(n,t,e,hTt,_dn),V6(n.length*8==64);{let o=lTt(n,Ju(e,11),et(t.byteLength)*FL&ii);return lTt(n,Ju(e,e.byteLength-DN-11),~(et(t.byteLength)*Sz)&ii)<<et(64)|o}}function gTt(t,e){let r=t*e&z6;return r&ii^r>>et(64)}function cTt(t,e,r){return gTt((cl(t,0)^cl(e,0)+r)&ii,(cl(t,8)^cl(e,8)-r)&ii)}function Vpe(t,e,r,n,o){let i=t&ii,a=t>>et(64)&ii;return i+=cTt(e,n,o),i^=cl(r,0)+cl(r,8),i&=ii,a+=cTt(r,Ju(n,16),o),a^=cl(e,0)+cl(e,8),a&=ii,a<<et(64)|i}function VT(t){return t^=t>>et(37),t*=ddn,t&=ii,t^=t>>et(32),t}function Wpe(t){return t^=t>>et(33),t*=Sz,t&=ii,t^=t>>et(29),t*=pTt,t&=ii,t^=t>>et(32),t}function Sdn(t,e,r){let n=t.byteLength;V6(n>0&&n<=3);let o=et(SUe(t,n-1))|et(n<<8)|et(SUe(t,0)<<16)|et(SUe(t,n>>1)<<24),i=(et(U6(e,0))^et(U6(e,4)))+r,a=(o^i)&ii,s=(et(U6(e,8))^et(U6(e,12)))-r,u=(bdn(gdn(o),et(13))^s)&ii;return(Wpe(u)&ii)<<et(64)|Wpe(a)}function CUe(t,e){return t^t>>e}function Cdn(t,e,r){let n=t.byteLength;V6(n>=4&&n<=8);{let o=U6(t,0),i=U6(t,n-4),a=et(o)|et(i)<<et(32),s=(cl(e,16)^cl(e,24))+r&ii,l=(a^s)*(FL+(et(n)<<et(2)))&z6;return l+=(l&ii)<<et(65),l&=z6,l^=l>>et(67),CUe(CUe(l&ii,et(35))*fdn&ii,et(28))|VT(l>>et(64))<<et(64)}}function xdn(t,e,r){let n=t.byteLength;V6(n>=9&&n<=16);{let o=(cl(e,32)^cl(e,40))+r&ii,i=(cl(e,48)^cl(e,56))-r&ii,a=cl(t),s=cl(t,n-8),u=(a^s^o)*FL,l=(u&ii)+(et(n-1)<<et(54));u=u&(z6^ii)|l,s^=i,u+=s+(s&Hpe)*(fTt-et(1))<<et(64),u&=z6,u^=hdn(u>>et(64));let c=(u&ii)*Sz;return c+=(u>>et(64))*Sz<<et(64),c&=z6,VT(c&ii)|VT(c>>et(64))<<et(64)}}function Tdn(t,e){let r=t.byteLength;return V6(r<=16),r>8?xdn(t,zT,e):r>=4?Cdn(t,zT,e):r>0?Sdn(t,zT,e):Wpe(e^cl(zT,64)^cl(zT,72))|Wpe(e^cl(zT,80)^cl(zT,88))<<et(64)}function xUe(t){return~t+et(1)&ii}function Odn(t,e,r){let n=et(t.byteLength)*FL&ii,o=et(t.byteLength-1)/et(32);for(;o>=0;){let s=Number(o);n=Vpe(n,Ju(t,16*s),Ju(t,t.byteLength-16*(s+1)),Ju(e,32*s),r),o--}let i=n+(n>>et(64))&ii;i=VT(i);let a=(n&ii)*FL+(n>>et(64))*TUe+(et(t.byteLength)-r&ii)*Sz;return a&=ii,a=xUe(VT(a)),i|a<<et(64)}function Edn(t,e,r){let n=et(t.byteLength)*FL&ii;for(let a=32;a<160;a+=32)n=Vpe(n,Ju(t,a-32),Ju(t,a-16),Ju(e,a-32),r);n=VT(n&ii)|VT(n>>et(64))<<et(64);for(let a=160;a<=t.byteLength;a+=32)n=Vpe(n,Ju(t,a-32),Ju(t,a-16),Ju(e,3+a-160),r);n=Vpe(n,Ju(t,t.byteLength-16),Ju(t,t.byteLength-32),Ju(e,103),xUe(r));let o=n+(n>>et(64))&ii;o=VT(o);let i=(n&ii)*FL+(n>>et(64))*TUe+(et(t.byteLength)-r&ii)*Sz;return i&=ii,i=xUe(VT(i)),o|i<<et(64)}function yTt(t,e=et(0)){let r=t.byteLength;return r<=16?Tdn(t,e):r<=128?Odn(t,zT,e):r<=240?Edn(t,zT,e):wdn(t,zT,e)}function bTt(t){let e=new Uint8Array(16),r=new DataView(e.buffer),n=t&ii,o=t>>et(64);return r.setBigUint64(0,o,!1),r.setBigUint64(8,n,!1),e}var et,dTt,fTt,ldn,FL,Sz,pTt,TUe,cdn,ddn,fdn,zT,z6,ii,Hpe,DN,mTt,mdn,Upe,hdn,gdn,ydn,V6,_Tt=v(()=>{et=t=>BigInt(t),dTt=et("0x9E3779B1"),fTt=et("0x85EBCA77"),ldn=et("0xC2B2AE3D"),FL=et("0x9E3779B185EBCA87"),Sz=et("0xC2B2AE3D27D4EB4F"),pTt=et("0x165667B19E3779F9"),TUe=et("0x85EBCA77C2B2AE63"),cdn=et("0x27D4EB2F165667C5"),ddn=et("0x165667919E3779F9"),fdn=et("0x9FB21C651E98DF25");zT=pdn("b8fe6c3923a44bbe7c01812cf721ad1cded46de9839097db7240a4a4b7b3671fcb79e64eccc0e578825ad07dccff7221b8084674f743248ee03590e6813a264c3c2852bb91c300cb88d0658b1b532ea371644897a20df94e3819ef46a9deacd8a8fa763fe39c343ff9dcbbc7c70b4f1d8a51e04bcdb45931c89f7ec9d9787364eac5ac8334d3ebc3c581a0fffa1363eb170ddd51b7f0da49d316552629d4689e2b16be587d47a1fc8ff8b8d17ad031ce45cb3a8f95160428afd7fbcabb4b407e"),z6=(et(1)<<et(128))-et(1),ii=(et(1)<<et(64))-et(1),Hpe=(et(1)<<et(32))-et(1),DN=64,mTt=DN/8,mdn=8,Upe=4;hdn=t=>(t&et(255))<<et(56)|(t&et(65280))<<et(40)|(t&et(16711680))<<et(24)|(t&et(4278190080))<<et(8)|(t&et(0xff00000000))>>et(8)|(t&et(0xff0000000000))>>et(24)|(t&et(0xff000000000000))>>et(40)|(t&et(0xff00000000000000))>>et(56),gdn=t=>(t=(t&et(65535))<<et(16)|(t&et(4294901760))>>et(16),t=(t&et(16711935))<<et(8)|(t&et(4278255360))>>et(8),t),ydn=(t,e)=>(t&Hpe)*(e&Hpe)&ii,V6=t=>{if(!t)throw new Error("Assert failed")}});function No(t,e){if(!vTt.test(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}function Jpe(t){let e=typeof t=="string"?Date.parse(t):t;return mUe({msecs:e,seq:0})}function Pdn(t){if(!vTt.test(t))return null;let e=t[14];return parseInt(e,16)}function Mdn(t){let e=t.replace(/-/g,""),r=new Uint8Array(16);for(let n=0;n<16;n++)r[n]=parseInt(e.slice(n*2,n*2+2),16);return r}function Rdn(t){let e=Array.from(t).map(r=>r.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}function Adn(t){let e=Idn.encode(t),r=yTt(e);return bTt(r)}function jQ(t,e){let r=`${t}:${e}`,n=Adn(r),o=new Uint8Array(16);if(Pdn(t)===7){let a=Mdn(t);o.set(a.slice(0,6),0)}else{let a=Date.now();o[0]=a/1099511627776&255,o[1]=a/4294967296&255,o[2]=a/16777216&255,o[3]=a/65536&255,o[4]=a/256&255,o[5]=a&255}return o[6]=112|n[0]&15,o[7]=n[1],o[8]=128|n[2]&63,o.set(n.slice(3,10),9),Rdn(o)}var vTt,Idn,Kpe=v(()=>{qpe();Bpe();_Tt();vTt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;Idn=new TextEncoder});var wTt=v(()=>{Kpe()});function STt(t,e){throw new Error("dump() is not supported in browser environments.")}function CTt(t){throw new Error("load() is not supported in browser environments.")}var xTt=v(()=>{});function Ndn(t,e){return e===null?!1:Date.now()-t.createdAt>e*1e3}var Gpe,Xpe,OUe=v(()=>{xTt();Gpe=class{constructor(e={}){Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ttlSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"refreshIntervalSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"refreshTimer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_metrics",{enumerable:!0,configurable:!0,writable:!0,value:{hits:0,misses:0,refreshes:0,refreshErrors:0}}),this.configure(e)}get metrics(){return{...this._metrics}}get totalRequests(){return this._metrics.hits+this._metrics.misses}get hitRate(){let e=this.totalRequests;return e>0?this._metrics.hits/e:0}resetMetrics(){this._metrics={hits:0,misses:0,refreshes:0,refreshErrors:0}}get(e,r){if(this.maxSize===0)return;let n=this.cache.get(e);if(!n){this._metrics.misses+=1;return}return this.cache.delete(e),this.cache.set(e,{...n,refreshFunc:r}),this._metrics.hits+=1,n.value}set(e,r,n){if(this.maxSize===0)return;if(this.refreshTimer===void 0&&this.startRefreshLoop(),!this.cache.has(e)&&this.cache.size>=this.maxSize){let i=this.cache.keys().next().value;i!==void 0&&this.cache.delete(i)}let o={value:r,createdAt:Date.now(),refreshFunc:n};this.cache.delete(e),this.cache.set(e,o)}invalidate(e){this.cache.delete(e)}clear(){this.cache.clear()}get size(){return this.cache.size}stop(){this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=void 0)}dump(e){let r={};for(let[n,o]of this.cache.entries())r[n]=o.value;STt(e,r)}load(e){let r=CTt(e);if(!r)return 0;let n=0,o=Date.now();for(let[i,a]of Object.entries(r)){if(this.cache.size>=this.maxSize)break;let s={value:a,createdAt:o};this.cache.set(i,s),n+=1}return n}startRefreshLoop(){this.stop(),this.ttlSeconds!==null&&(this.refreshTimer=setInterval(()=>{this.refreshStaleEntries().catch(e=>{console.warn("Unexpected error in cache refresh loop:",e)})},this.refreshIntervalSeconds*1e3),this.refreshTimer.unref&&this.refreshTimer.unref())}getStaleEntries(){let e=[];for(let[r,n]of this.cache.entries())Ndn(n,this.ttlSeconds)&&e.push([r,n]);return e}async refreshStaleEntries(){let e=this.getStaleEntries();if(e.length!==0){for(let[r,n]of e)if(n.refreshFunc!==void 0)try{let o=await n.refreshFunc();this.set(r,o,n.refreshFunc),this._metrics.refreshes+=1}catch(o){this._metrics.refreshErrors+=1,console.warn(`Failed to refresh cache entry ${r}:`,o)}}}configure(e){this.stop(),this.refreshIntervalSeconds=e.refreshIntervalSeconds??60,this.maxSize=e.maxSize??100,this.ttlSeconds=e.ttlSeconds??5*60}},Xpe=new Gpe});var Zpe,Ype=v(()=>{EUe();PUe();vUe();wUe();wTt();OUe();Zpe="0.5.4"});function Qpe(){if(MUe===void 0){let t=IUe(),e=kdn();MUe={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:Zpe,...e}}return MUe}function AUe(){let t=Fdn(),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))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 Fdn(){let t={};try{if(typeof process<"u"&&process.env)for(let[e,r]of Object.entries(process.env))(e.startsWith("LANGCHAIN_")||e.startsWith("LANGSMITH_"))&&r!=null&&((e.toLowerCase().includes("key")||e.toLowerCase().includes("secret")||e.toLowerCase().includes("token"))&&typeof r=="string"?t[e]=r.slice(0,2)+"*".repeat(r.length-4)+r.slice(-2):t[e]=r)}catch{}return t}function Gv(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function td(t){return Gv(`LANGSMITH_${t}`)||Gv(`LANGCHAIN_${t}`)}function kdn(){if(RUe!==void 0)return RUe;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=Gv(r);n!==void 0&&(e[r]=n)}return RUe=e,e}function eme(){return Gv("OTEL_ENABLED")==="true"||td("OTEL_ENABLED")==="true"}var HT,Ddn,jdn,$dn,TTt,Ldn,IUe,MUe,RUe,NN=v(()=>{Ype();Ddn=()=>typeof window<"u"&&typeof window.document<"u",jdn=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",$dn=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),TTt=()=>typeof Deno<"u",Ldn=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!TTt(),IUe=()=>HT||(typeof Bun<"u"?HT="bun":Ddn()?HT="browser":Ldn()?HT="node":jdn()?HT="webworker":$dn()?HT="jsdom":TTt()?HT="deno":HT="other",HT)});function tme(){return kUe.getTraceInstance()}function ETt(){return kUe.getContextInstance()}function PTt(){return kUe.getDefaultOTLPTracerComponents()}var jUe,$Ue,LUe,NUe,DUe,OTt,qdn,Bdn,FUe,kUe,qUe=v(()=>{NN();jUe=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&eme()&&(console.warn('You have enabled OTEL export via the `OTEL_ENABLED` or `LANGSMITH_OTEL_ENABLED` environment variable, but have not initialized the required OTEL instances. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0);let n;if(r.length===1&&typeof r[0]=="function"?n=r[0]:r.length===2&&typeof r[1]=="function"?n=r[1]:r.length===3&&typeof r[2]=="function"&&(n=r[2]),typeof n=="function")return n()}},$Ue=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new jUe})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},LUe=class{active(){return{}}with(e,r){return r()}},NUe=Symbol.for("ls:otel_trace"),DUe=Symbol.for("ls:otel_context"),OTt=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),qdn=new $Ue,Bdn=new LUe,FUe=class{getTraceInstance(){return globalThis[NUe]??qdn}getContextInstance(){return globalThis[DUe]??Bdn}initializeGlobalInstances(e){globalThis[NUe]===void 0&&(globalThis[NUe]=e.trace),globalThis[DUe]===void 0&&(globalThis[DUe]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[OTt]=e}getDefaultOTLPTracerComponents(){return globalThis[OTt]??void 0}},kUe=new FUe});function zdn(t){return Udn[t]||t}var Udn,rme,MTt=v(()=>{nTt();qUe();Udn={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};rme=class{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(e,r){for(let n of e)try{if(!n.run)continue;if(n.operation==="post"){let o=this.createSpanForRun(n,n.run,r.get(n.id));o&&!n.run.end_time&&this.spans.set(n.id,o)}else this.updateSpanForRun(n,n.run)}catch(o){console.error(`Error processing operation ${n.id}:`,o)}}createSpanForRun(e,r,n){let o=n&&tme().getSpan(n);if(o)try{return this.finishSpanSetup(o,r,e)}catch(i){console.error(`Failed to create span for run ${e.id}:`,i);return}}finishSpanSetup(e,r,n){return this.setSpanAttributes(e,r,n),r.error?(e.setStatus({code:2}),e.recordException(new Error(r.error))):e.setStatus({code:1}),r.end_time&&e.end(new Date(r.end_time)),e}updateSpanForRun(e,r){try{let n=this.spans.get(e.id);if(!n){console.debug(`No span found for run ${e.id} during update`);return}this.setSpanAttributes(n,r,e),r.error?(n.setStatus({code:2}),n.recordException(new Error(r.error))):n.setStatus({code:1});let o=r.end_time;o&&(n.end(new Date(o)),this.spans.delete(e.id))}catch(n){console.error(`Failed to update span for run ${e.id}:`,n)}}extractModelName(e){if(e.extra?.metadata){let r=e.extra.metadata;if(r.ls_model_name)return r.ls_model_name;if(r.invocation_params){let n=r.invocation_params;if(n.model)return n.model;if(n.model_name)return n.model_name}}}setSpanAttributes(e,r,n){if("run_type"in r&&r.run_type){e.setAttribute(Yxt,r.run_type);let s=zdn(r.run_type||"chain");e.setAttribute(Mxt,s)}"name"in r&&r.name&&e.setAttribute(Qxt,r.name),"session_id"in r&&r.session_id&&e.setAttribute(Xxt,r.session_id),"session_name"in r&&r.session_name&&e.setAttribute(Zxt,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute(hUe,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute(gUe,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(yUe,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(bUe,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[s,u]of Object.entries(i))u!=null&&e.setAttribute(`${eTt}.${s}`,String(u));let a=r.tags;if(a&&Array.isArray(a)?e.setAttribute(_Ue,a.join(", ")):a&&e.setAttribute(_Ue,String(a)),"serialized"in r&&typeof r.serialized=="object"){let s=r.serialized;s.name&&e.setAttribute(Uxt,String(s.name)),s.signature&&e.setAttribute(zxt,String(s.signature)),s.doc&&e.setAttribute(Vxt,String(s.doc))}this.setIOAttributes(e,n)}setGenAiSystem(e,r){let n="langchain",o=this.extractModelName(r);if(o){let i=o.toLowerCase();i.includes("anthropic")||i.startsWith("claude")?n="anthropic":i.includes("bedrock")?n="aws.bedrock":i.includes("azure")&&i.includes("openai")?n="az.ai.openai":i.includes("azure")&&i.includes("inference")?n="az.ai.inference":i.includes("cohere")?n="cohere":i.includes("deepseek")?n="deepseek":i.includes("gemini")?n="gemini":i.includes("groq")?n="groq":i.includes("watson")||i.includes("ibm")?n="ibm.watsonx.ai":i.includes("mistral")?n="mistral_ai":i.includes("gpt")||i.includes("openai")?n="openai":i.includes("perplexity")||i.includes("sonar")?n="perplexity":i.includes("vertex")?n="vertex_ai":(i.includes("xai")||i.includes("grok"))&&(n="xai")}e.setAttribute(Rxt,n)}setInvocationParameters(e,r){if(!r.extra?.metadata?.invocation_params)return;let n=r.extra.metadata.invocation_params;n.max_tokens!==void 0&&e.setAttribute(Axt,n.max_tokens),n.temperature!==void 0&&e.setAttribute(Nxt,n.temperature),n.top_p!==void 0&&e.setAttribute(Dxt,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(jxt,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute($xt,n.presence_penalty)}setIOAttributes(e,r){if(r.run.inputs)try{let n=r.run.inputs;typeof n=="object"&&n!==null&&(n.model&&Array.isArray(n.messages)&&e.setAttribute(hUe,n.model),n.stream!==void 0&&e.setAttribute(tTt,n.stream),n.extra_headers&&e.setAttribute(rTt,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute(qxt,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(Bxt,JSON.stringify(n.extra_body))),e.setAttribute(Fxt,JSON.stringify(n))}catch(n){console.debug(`Failed to process inputs for run ${r.id}`,n)}if(r.run.outputs)try{let n=r.run.outputs,o=this.getUnifiedRunTokens(n);if(o&&(e.setAttribute(gUe,o[0]),e.setAttribute(yUe,o[1]),e.setAttribute(bUe,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(Ixt,String(n.model)),n.id&&e.setAttribute(Hxt,n.id),n.choices&&Array.isArray(n.choices)){let i=n.choices.map(a=>a.finish_reason).filter(a=>a).map(String);i.length>0&&e.setAttribute(Lxt,i.join(", "))}if(n.service_tier&&e.setAttribute(Wxt,n.service_tier),n.system_fingerprint&&e.setAttribute(Jxt,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let i=n.usage_metadata;i.input_token_details&&e.setAttribute(Kxt,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(Gxt,JSON.stringify(i.output_token_details))}}e.setAttribute(kxt,JSON.stringify(n))}catch(n){console.debug(`Failed to process outputs for run ${r.id}`,n)}}getUnifiedRunTokens(e){if(!e)return null;let r=this.extractUnifiedRunTokens(e.usage_metadata);if(r)return r;let n=Object.keys(e);for(let a of n){let s=e[a];if(!(!s||typeof s!="object")&&(r=this.extractUnifiedRunTokens(s.usage_metadata),r||s.lc===1&&s.kwargs&&typeof s.kwargs=="object"&&(r=this.extractUnifiedRunTokens(s.kwargs.usage_metadata),r)))return r}let o=e.generations||[];if(!Array.isArray(o))return null;let i=Array.isArray(o[0])?o.flat():o;for(let a of i)if(typeof a=="object"&&a.message&&typeof a.message=="object"&&a.message.kwargs&&typeof a.message.kwargs=="object"&&(r=this.extractUnifiedRunTokens(a.message.kwargs.usage_metadata),r))return r;return null}extractUnifiedRunTokens(e){return!e||typeof e!="object"||typeof e.input_tokens!="number"||typeof e.output_tokens!="number"?null:[e.input_tokens,e.output_tokens]}}});function BUe(t){if(!(t&&Hdn(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:Wdn.has(r)}var Vdn,Hdn,Wdn,RTt=v(()=>{Vdn=Object.prototype.toString,Hdn=t=>Vdn.call(t)==="[object Error]",Wdn=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"])});function Jdn(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function nme(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e<r)throw new TypeError(`Expected \`${t}\` to be \u2265 ${r}.`)}}function Kdn(t,e){let r=Math.max(1,t+1),n=e.randomize?Math.random()+1:1,o=Math.round(n*e.minTimeout*e.factor**(r-1));return o=Math.min(o,e.maxTimeout),o}function ITt(t,e){return Number.isFinite(e)?e-(performance.now()-t):e}async function Gdn({error:t,attemptNumber:e,retriesConsumed:r,startTime:n,options:o}){let i=t instanceof Error?t:new TypeError(`Non-error was thrown: "${t}". You should only throw errors.`);if(i instanceof UUe)throw i.originalError;let a=Number.isFinite(o.retries)?Math.max(0,o.retries-r):o.retries,s=o.maxRetryTime??Number.POSITIVE_INFINITY,u=Object.freeze({error:i,attemptNumber:e,retriesLeft:a,retriesConsumed:r});if(await o.onFailedAttempt(u),ITt(n,s)<=0)throw i;let l=await o.shouldConsumeRetry(u),c=ITt(n,s);if(c<=0||a<=0)throw i;if(i instanceof TypeError&&!BUe(i)){if(l)throw i;return o.signal?.throwIfAborted(),!1}if(!await o.shouldRetry(u))throw i;if(!l)return o.signal?.throwIfAborted(),!1;let d=Kdn(r,o),f=Math.min(d,c);return f>0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(y),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},y=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&y.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function zUe(t,e={}){if(e={...e},Jdn(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??(e.retries=10),e.factor??(e.factor=2),e.minTimeout??(e.minTimeout=1e3),e.maxTimeout??(e.maxTimeout=Number.POSITIVE_INFINITY),e.maxRetryTime??(e.maxRetryTime=Number.POSITIVE_INFINITY),e.randomize??(e.randomize=!1),e.onFailedAttempt??(e.onFailedAttempt=()=>{}),e.shouldRetry??(e.shouldRetry=()=>!0),e.shouldConsumeRetry??(e.shouldConsumeRetry=()=>!0),nme("factor",e.factor,{min:0,allowInfinity:!1}),nme("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),nme("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),nme("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await Gdn({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var UUe,ATt=v(()=>{RTt();UUe=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}}});var HUe=S((ROi,VUe)=>{"use strict";var Xdn=Object.prototype.hasOwnProperty,vb="~";function $Q(){}Object.create&&($Q.prototype=Object.create(null),new $Q().__proto__||(vb=!1));function Zdn(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function NTt(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new Zdn(r,n||t,o),a=vb?vb+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 ome(t,e){--t._eventsCount===0?t._events=new $Q:delete t._events[e]}function gy(){this._events=new $Q,this._eventsCount=0}gy.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)Xdn.call(r,n)&&e.push(vb?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};gy.prototype.listeners=function(e){var r=vb?vb+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};gy.prototype.listenerCount=function(e){var r=vb?vb+e:e,n=this._events[r];return n?n.fn?1:n.length:0};gy.prototype.emit=function(e,r,n,o,i,a){var s=vb?vb+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};gy.prototype.on=function(e,r,n){return NTt(this,e,r,n,!1)};gy.prototype.once=function(e,r,n){return NTt(this,e,r,n,!0)};gy.prototype.removeListener=function(e,r,n,o){var i=vb?vb+e:e;if(!this._events[i])return this;if(!r)return ome(this,i),this;var a=this._events[i];if(a.fn)a.fn===r&&(!o||a.once)&&(!n||a.context===n)&&ome(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:ome(this,i)}return this};gy.prototype.removeAllListeners=function(e){var r;return e?(r=vb?vb+e:e,this._events[r]&&ome(this,r)):(this._events=new $Q,this._eventsCount=0),this};gy.prototype.off=gy.prototype.removeListener;gy.prototype.addListener=gy.prototype.on;gy.prefixed=vb;gy.EventEmitter=gy;typeof VUe<"u"&&(VUe.exports=gy)});var WUe=S((IOi,DTt)=>{"use strict";DTt.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 $Tt=S((AOi,ame)=>{"use strict";var Ydn=WUe(),ime=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},jTt=(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 ime(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);Ydn(t.then(n,o),()=>{clearTimeout(i)})});ame.exports=jTt;ame.exports.default=jTt;ame.exports.TimeoutError=ime});var LTt=S(JUe=>{"use strict";Object.defineProperty(JUe,"__esModule",{value:!0});function Qdn(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}JUe.default=Qdn});var FTt=S(GUe=>{"use strict";Object.defineProperty(GUe,"__esModule",{value:!0});var efn=LTt(),KUe=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=efn.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}};GUe.default=KUe});var qTt=S(ZUe=>{"use strict";Object.defineProperty(ZUe,"__esModule",{value:!0});var tfn=HUe(),kTt=$Tt(),rfn=FTt(),sme=()=>{},nfn=new kTt.TimeoutError,XUe=class extends tfn{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=sme,this._resolveIdle=sme,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:rfn.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=sme,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=sme,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():kTt.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(nfn)});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}};ZUe.default=XUe});var ume,BTt,UTt=v(()=>{ume=$(qTt(),1),BTt="default"in ume.default?ume.default.default:ume.default});var ofn,LQ,zTt=v(()=>{ATt();UTt();ofn=[408,425,429,500,502,503,504],LQ=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,"maxQueueSizeBytes",{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,"queueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.maxQueueSizeBytes=e.maxQueueSizeBytes,this.queue=new BTt({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){return this.callWithOptions({},e,...r)}callWithOptions(e,r,...n){let o=e.sizeBytes??0;if(this.maxQueueSizeBytes!==void 0&&o>0&&this.queueSizeBytes+o>this.maxQueueSizeBytes)return Promise.reject(new Error(`Queue size limit (${this.maxQueueSizeBytes} bytes) exceeded. Current queue size: ${this.queueSizeBytes} bytes, attempted addition: ${o} bytes.`));o>0&&(this.queueSizeBytes+=o);let i=this.onFailedResponseHook,a=this.queue.add(()=>zUe(()=>r(...n).catch(s=>{throw s instanceof Error?s:new Error(s)}),{async onFailedAttempt({error:s}){if(typeof s!="object"||s==null)throw s;let u="message"in s&&typeof s.message=="string"?s.message:void 0;if(u?.startsWith("Cancel")||u?.startsWith("TimeoutError")||u?.startsWith("AbortError")||"name"in s&&s.name==="TimeoutError"||"code"in s&&s.code==="ECONNABORTED")throw s;let l="response"in s?s.response:void 0;if(i&&await i(l))return;let c=l?.status??("status"in s?s.status:void 0);if(c!=null&&(typeof c=="number"||typeof c=="string")&&!ofn.includes(+c))throw s},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0});return o>0&&(a=a.finally(()=>{this.queueSizeBytes-=o})),e.signal?Promise.race([a,new Promise((s,u)=>{e.signal?.addEventListener("abort",()=>{u(new Error("AbortError"))})})]):a}}});function YUe(t){return typeof t?._getType=="function"}function QUe(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 VTt=v(()=>{});var FQ=S((BOi,HTt)=>{"use strict";var ifn="2.0.0",afn=Number.MAX_SAFE_INTEGER||9007199254740991,sfn=16,ufn=250,lfn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];HTt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:sfn,MAX_SAFE_BUILD_LENGTH:ufn,MAX_SAFE_INTEGER:afn,RELEASE_TYPES:lfn,SEMVER_SPEC_VERSION:ifn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var kQ=S((UOi,WTt)=>{"use strict";var cfn=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};WTt.exports=cfn});var H6=S((WT,JTt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:eze,MAX_SAFE_BUILD_LENGTH:dfn,MAX_LENGTH:ffn}=FQ(),pfn=kQ();WT=JTt.exports={};var mfn=WT.re=[],hfn=WT.safeRe=[],Cr=WT.src=[],gfn=WT.safeSrc=[],xr=WT.t={},yfn=0,tze="[a-zA-Z0-9-]",bfn=[["\\s",1],["\\d",ffn],[tze,dfn]],_fn=t=>{for(let[e,r]of bfn)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Vo=(t,e,r)=>{let n=_fn(e),o=yfn++;pfn(t,o,e),xr[t]=o,Cr[o]=e,gfn[o]=n,mfn[o]=new RegExp(e,r?"g":void 0),hfn[o]=new RegExp(n,r?"g":void 0)};Vo("NUMERICIDENTIFIER","0|[1-9]\\d*");Vo("NUMERICIDENTIFIERLOOSE","\\d+");Vo("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${tze}*`);Vo("MAINVERSION",`(${Cr[xr.NUMERICIDENTIFIER]})\\.(${Cr[xr.NUMERICIDENTIFIER]})\\.(${Cr[xr.NUMERICIDENTIFIER]})`);Vo("MAINVERSIONLOOSE",`(${Cr[xr.NUMERICIDENTIFIERLOOSE]})\\.(${Cr[xr.NUMERICIDENTIFIERLOOSE]})\\.(${Cr[xr.NUMERICIDENTIFIERLOOSE]})`);Vo("PRERELEASEIDENTIFIER",`(?:${Cr[xr.NONNUMERICIDENTIFIER]}|${Cr[xr.NUMERICIDENTIFIER]})`);Vo("PRERELEASEIDENTIFIERLOOSE",`(?:${Cr[xr.NONNUMERICIDENTIFIER]}|${Cr[xr.NUMERICIDENTIFIERLOOSE]})`);Vo("PRERELEASE",`(?:-(${Cr[xr.PRERELEASEIDENTIFIER]}(?:\\.${Cr[xr.PRERELEASEIDENTIFIER]})*))`);Vo("PRERELEASELOOSE",`(?:-?(${Cr[xr.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Cr[xr.PRERELEASEIDENTIFIERLOOSE]})*))`);Vo("BUILDIDENTIFIER",`${tze}+`);Vo("BUILD",`(?:\\+(${Cr[xr.BUILDIDENTIFIER]}(?:\\.${Cr[xr.BUILDIDENTIFIER]})*))`);Vo("FULLPLAIN",`v?${Cr[xr.MAINVERSION]}${Cr[xr.PRERELEASE]}?${Cr[xr.BUILD]}?`);Vo("FULL",`^${Cr[xr.FULLPLAIN]}$`);Vo("LOOSEPLAIN",`[v=\\s]*${Cr[xr.MAINVERSIONLOOSE]}${Cr[xr.PRERELEASELOOSE]}?${Cr[xr.BUILD]}?`);Vo("LOOSE",`^${Cr[xr.LOOSEPLAIN]}$`);Vo("GTLT","((?:<|>)?=?)");Vo("XRANGEIDENTIFIERLOOSE",`${Cr[xr.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Vo("XRANGEIDENTIFIER",`${Cr[xr.NUMERICIDENTIFIER]}|x|X|\\*`);Vo("XRANGEPLAIN",`[v=\\s]*(${Cr[xr.XRANGEIDENTIFIER]})(?:\\.(${Cr[xr.XRANGEIDENTIFIER]})(?:\\.(${Cr[xr.XRANGEIDENTIFIER]})(?:${Cr[xr.PRERELEASE]})?${Cr[xr.BUILD]}?)?)?`);Vo("XRANGEPLAINLOOSE",`[v=\\s]*(${Cr[xr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Cr[xr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Cr[xr.XRANGEIDENTIFIERLOOSE]})(?:${Cr[xr.PRERELEASELOOSE]})?${Cr[xr.BUILD]}?)?)?`);Vo("XRANGE",`^${Cr[xr.GTLT]}\\s*${Cr[xr.XRANGEPLAIN]}$`);Vo("XRANGELOOSE",`^${Cr[xr.GTLT]}\\s*${Cr[xr.XRANGEPLAINLOOSE]}$`);Vo("COERCEPLAIN",`(^|[^\\d])(\\d{1,${eze}})(?:\\.(\\d{1,${eze}}))?(?:\\.(\\d{1,${eze}}))?`);Vo("COERCE",`${Cr[xr.COERCEPLAIN]}(?:$|[^\\d])`);Vo("COERCEFULL",Cr[xr.COERCEPLAIN]+`(?:${Cr[xr.PRERELEASE]})?(?:${Cr[xr.BUILD]})?(?:$|[^\\d])`);Vo("COERCERTL",Cr[xr.COERCE],!0);Vo("COERCERTLFULL",Cr[xr.COERCEFULL],!0);Vo("LONETILDE","(?:~>?)");Vo("TILDETRIM",`(\\s*)${Cr[xr.LONETILDE]}\\s+`,!0);WT.tildeTrimReplace="$1~";Vo("TILDE",`^${Cr[xr.LONETILDE]}${Cr[xr.XRANGEPLAIN]}$`);Vo("TILDELOOSE",`^${Cr[xr.LONETILDE]}${Cr[xr.XRANGEPLAINLOOSE]}$`);Vo("LONECARET","(?:\\^)");Vo("CARETTRIM",`(\\s*)${Cr[xr.LONECARET]}\\s+`,!0);WT.caretTrimReplace="$1^";Vo("CARET",`^${Cr[xr.LONECARET]}${Cr[xr.XRANGEPLAIN]}$`);Vo("CARETLOOSE",`^${Cr[xr.LONECARET]}${Cr[xr.XRANGEPLAINLOOSE]}$`);Vo("COMPARATORLOOSE",`^${Cr[xr.GTLT]}\\s*(${Cr[xr.LOOSEPLAIN]})$|^$`);Vo("COMPARATOR",`^${Cr[xr.GTLT]}\\s*(${Cr[xr.FULLPLAIN]})$|^$`);Vo("COMPARATORTRIM",`(\\s*)${Cr[xr.GTLT]}\\s*(${Cr[xr.LOOSEPLAIN]}|${Cr[xr.XRANGEPLAIN]})`,!0);WT.comparatorTrimReplace="$1$2$3";Vo("HYPHENRANGE",`^\\s*(${Cr[xr.XRANGEPLAIN]})\\s+-\\s+(${Cr[xr.XRANGEPLAIN]})\\s*$`);Vo("HYPHENRANGELOOSE",`^\\s*(${Cr[xr.XRANGEPLAINLOOSE]})\\s+-\\s+(${Cr[xr.XRANGEPLAINLOOSE]})\\s*$`);Vo("STAR","(<|>)?=?\\s*\\*");Vo("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Vo("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var lme=S((zOi,KTt)=>{"use strict";var vfn=Object.freeze({loose:!0}),wfn=Object.freeze({}),Sfn=t=>t?typeof t!="object"?vfn:t:wfn;KTt.exports=Sfn});var rze=S((VOi,ZTt)=>{"use strict";var GTt=/^[0-9]+$/,XTt=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=GTt.test(t),n=GTt.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Cfn=(t,e)=>XTt(e,t);ZTt.exports={compareIdentifiers:XTt,rcompareIdentifiers:Cfn}});var yy=S((HOi,QTt)=>{"use strict";var cme=kQ(),{MAX_LENGTH:YTt,MAX_SAFE_INTEGER:dme}=FQ(),{safeRe:fme,t:pme}=H6(),xfn=lme(),{compareIdentifiers:nze}=rze(),oze=class t{constructor(e,r){if(r=xfn(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>YTt)throw new TypeError(`version is longer than ${YTt} characters`);cme("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?fme[pme.LOOSE]:fme[pme.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>dme||this.major<0)throw new TypeError("Invalid major version");if(this.minor>dme||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>dme||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<dme)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(cme("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)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}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(cme("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 nze(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(cme("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 nze(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?fme[pme.PRERELEASELOOSE]:fme[pme.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}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"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;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(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]),nze(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}};QTt.exports=oze});var xz=S((WOi,tOt)=>{"use strict";var eOt=yy(),Tfn=(t,e,r=!1)=>{if(t instanceof eOt)return t;try{return new eOt(t,e)}catch(n){if(!r)return null;throw n}};tOt.exports=Tfn});var nOt=S((JOi,rOt)=>{"use strict";var Ofn=xz(),Efn=(t,e)=>{let r=Ofn(t,e);return r?r.version:null};rOt.exports=Efn});var iOt=S((KOi,oOt)=>{"use strict";var Pfn=xz(),Mfn=(t,e)=>{let r=Pfn(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};oOt.exports=Mfn});var uOt=S((GOi,sOt)=>{"use strict";var aOt=yy(),Rfn=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new aOt(t instanceof aOt?t.version:t,r).inc(e,n,o).version}catch{return null}};sOt.exports=Rfn});var dOt=S((XOi,cOt)=>{"use strict";var lOt=xz(),Ifn=(t,e)=>{let r=lOt(t,null,!0),n=lOt(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){if(!s.patch&&!s.minor)return"major";if(s.compareMain(a)===0)return s.minor&&!s.patch?"minor":"patch"}let c=u?"pre":"";return r.major!==n.major?c+"major":r.minor!==n.minor?c+"minor":r.patch!==n.patch?c+"patch":"prerelease"};cOt.exports=Ifn});var pOt=S((ZOi,fOt)=>{"use strict";var Afn=yy(),Nfn=(t,e)=>new Afn(t,e).major;fOt.exports=Nfn});var hOt=S((YOi,mOt)=>{"use strict";var Dfn=yy(),jfn=(t,e)=>new Dfn(t,e).minor;mOt.exports=jfn});var yOt=S((QOi,gOt)=>{"use strict";var $fn=yy(),Lfn=(t,e)=>new $fn(t,e).patch;gOt.exports=Lfn});var _Ot=S((eEi,bOt)=>{"use strict";var Ffn=xz(),kfn=(t,e)=>{let r=Ffn(t,e);return r&&r.prerelease.length?r.prerelease:null};bOt.exports=kfn});var hS=S((tEi,wOt)=>{"use strict";var vOt=yy(),qfn=(t,e,r)=>new vOt(t,r).compare(new vOt(e,r));wOt.exports=qfn});var COt=S((rEi,SOt)=>{"use strict";var Bfn=hS(),Ufn=(t,e,r)=>Bfn(e,t,r);SOt.exports=Ufn});var TOt=S((nEi,xOt)=>{"use strict";var zfn=hS(),Vfn=(t,e)=>zfn(t,e,!0);xOt.exports=Vfn});var mme=S((oEi,EOt)=>{"use strict";var OOt=yy(),Hfn=(t,e,r)=>{let n=new OOt(t,r),o=new OOt(e,r);return n.compare(o)||n.compareBuild(o)};EOt.exports=Hfn});var MOt=S((iEi,POt)=>{"use strict";var Wfn=mme(),Jfn=(t,e)=>t.sort((r,n)=>Wfn(r,n,e));POt.exports=Jfn});var IOt=S((aEi,ROt)=>{"use strict";var Kfn=mme(),Gfn=(t,e)=>t.sort((r,n)=>Kfn(n,r,e));ROt.exports=Gfn});var qQ=S((sEi,AOt)=>{"use strict";var Xfn=hS(),Zfn=(t,e,r)=>Xfn(t,e,r)>0;AOt.exports=Zfn});var hme=S((uEi,NOt)=>{"use strict";var Yfn=hS(),Qfn=(t,e,r)=>Yfn(t,e,r)<0;NOt.exports=Qfn});var ize=S((lEi,DOt)=>{"use strict";var epn=hS(),tpn=(t,e,r)=>epn(t,e,r)===0;DOt.exports=tpn});var aze=S((cEi,jOt)=>{"use strict";var rpn=hS(),npn=(t,e,r)=>rpn(t,e,r)!==0;jOt.exports=npn});var gme=S((dEi,$Ot)=>{"use strict";var opn=hS(),ipn=(t,e,r)=>opn(t,e,r)>=0;$Ot.exports=ipn});var yme=S((fEi,LOt)=>{"use strict";var apn=hS(),spn=(t,e,r)=>apn(t,e,r)<=0;LOt.exports=spn});var sze=S((pEi,FOt)=>{"use strict";var upn=ize(),lpn=aze(),cpn=qQ(),dpn=gme(),fpn=hme(),ppn=yme(),mpn=(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 upn(t,r,n);case"!=":return lpn(t,r,n);case">":return cpn(t,r,n);case">=":return dpn(t,r,n);case"<":return fpn(t,r,n);case"<=":return ppn(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};FOt.exports=mpn});var qOt=S((mEi,kOt)=>{"use strict";var hpn=yy(),gpn=xz(),{safeRe:bme,t:_me}=H6(),ypn=(t,e)=>{if(t instanceof hpn)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?bme[_me.COERCEFULL]:bme[_me.COERCE]);else{let u=e.includePrerelease?bme[_me.COERCERTLFULL]:bme[_me.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 gpn(`${n}.${o}.${i}${a}${s}`,e)};kOt.exports=ypn});var UOt=S((hEi,BOt)=>{"use strict";var uze=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}};BOt.exports=uze});var gS=S((gEi,WOt)=>{"use strict";var bpn=/\s+/g,lze=class t{constructor(e,r){if(r=vpn(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof cze)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(bpn," "),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=>!VOt(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&&Epn(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&&Tpn)|(this.options.loose&&Opn))+":"+e,o=zOt.get(n);if(o)return o;let i=this.options.loose,a=i?wb[by.HYPHENRANGELOOSE]:wb[by.HYPHENRANGE];e=e.replace(a,Lpn(this.options.includePrerelease)),dl("hyphen replace",e),e=e.replace(wb[by.COMPARATORTRIM],Spn),dl("comparator trim",e),e=e.replace(wb[by.TILDETRIM],Cpn),dl("tilde trim",e),e=e.replace(wb[by.CARETTRIM],xpn),dl("caret trim",e);let s=e.split(" ").map(d=>Ppn(d,this.options)).join(" ").split(/\s+/).map(d=>$pn(d,this.options));i&&(s=s.filter(d=>(dl("loose invalid filter",d,this.options),!!d.match(wb[by.COMPARATORLOOSE])))),dl("range list",s);let u=new Map,l=s.map(d=>new cze(d,this.options));for(let d of l){if(VOt(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return zOt.set(n,c),c}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>HOt(n,r)&&e.set.some(o=>HOt(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 wpn(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Fpn(this.set[r],e,this.options))return!0;return!1}};WOt.exports=lze;var _pn=UOt(),zOt=new _pn,vpn=lme(),cze=BQ(),dl=kQ(),wpn=yy(),{safeRe:wb,t:by,comparatorTrimReplace:Spn,tildeTrimReplace:Cpn,caretTrimReplace:xpn}=H6(),{FLAG_INCLUDE_PRERELEASE:Tpn,FLAG_LOOSE:Opn}=FQ(),VOt=t=>t.value==="<0.0.0-0",Epn=t=>t.value==="",HOt=(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},Ppn=(t,e)=>(t=t.replace(wb[by.BUILD],""),dl("comp",t,e),t=Ipn(t,e),dl("caret",t),t=Mpn(t,e),dl("tildes",t),t=Npn(t,e),dl("xrange",t),t=jpn(t,e),dl("stars",t),t),Sb=t=>!t||t.toLowerCase()==="x"||t==="*",Mpn=(t,e)=>t.trim().split(/\s+/).map(r=>Rpn(r,e)).join(" "),Rpn=(t,e)=>{let r=e.loose?wb[by.TILDELOOSE]:wb[by.TILDE];return t.replace(r,(n,o,i,a,s)=>{dl("tilde",t,n,o,i,a,s);let u;return Sb(o)?u="":Sb(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:Sb(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(dl("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,dl("tilde return",u),u})},Ipn=(t,e)=>t.trim().split(/\s+/).map(r=>Apn(r,e)).join(" "),Apn=(t,e)=>{dl("caret",t,e);let r=e.loose?wb[by.CARETLOOSE]:wb[by.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{dl("caret",t,o,i,a,s,u);let l;return Sb(i)?l="":Sb(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:Sb(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(dl("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`):(dl("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`),dl("caret return",l),l})},Npn=(t,e)=>(dl("replaceXRanges",t,e),t.split(/\s+/).map(r=>Dpn(r,e)).join(" ")),Dpn=(t,e)=>{t=t.trim();let r=e.loose?wb[by.XRANGELOOSE]:wb[by.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{dl("xRange",t,n,o,i,a,s,u);let l=Sb(i),c=l||Sb(a),d=c||Sb(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`),dl("xRange return",n),n})},jpn=(t,e)=>(dl("replaceStars",t,e),t.trim().replace(wb[by.STAR],"")),$pn=(t,e)=>(dl("replaceGTE0",t,e),t.trim().replace(wb[e.includePrerelease?by.GTE0PRE:by.GTE0],"")),Lpn=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(Sb(n)?r="":Sb(o)?r=`>=${n}.0.0${t?"-0":""}`:Sb(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Sb(l)?u="":Sb(c)?u=`<${+l+1}.0.0-0`:Sb(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()),Fpn=(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(dl(t[n].semver),t[n].semver!==cze.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 BQ=S((yEi,YOt)=>{"use strict";var UQ=Symbol("SemVer ANY"),pze=class t{static get ANY(){return UQ}constructor(e,r){if(r=JOt(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),fze("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===UQ?this.value="":this.value=this.operator+this.semver.version,fze("comp",this)}parse(e){let r=this.options.loose?KOt[GOt.COMPARATORLOOSE]:KOt[GOt.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 XOt(n[2],this.options.loose):this.semver=UQ}toString(){return this.value}test(e){if(fze("Comparator.test",e,this.options.loose),this.semver===UQ||e===UQ)return!0;if(typeof e=="string")try{e=new XOt(e,this.options)}catch{return!1}return dze(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 ZOt(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new ZOt(this.value,r).test(e.semver):(r=JOt(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("=")||dze(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||dze(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};YOt.exports=pze;var JOt=lme(),{safeRe:KOt,t:GOt}=H6(),dze=sze(),fze=kQ(),XOt=yy(),ZOt=gS()});var zQ=S((bEi,QOt)=>{"use strict";var kpn=gS(),qpn=(t,e,r)=>{try{e=new kpn(e,r)}catch{return!1}return e.test(t)};QOt.exports=qpn});var tEt=S((_Ei,eEt)=>{"use strict";var Bpn=gS(),Upn=(t,e)=>new Bpn(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));eEt.exports=Upn});var nEt=S((vEi,rEt)=>{"use strict";var zpn=yy(),Vpn=gS(),Hpn=(t,e,r)=>{let n=null,o=null,i=null;try{i=new Vpn(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new zpn(n,r))}),n};rEt.exports=Hpn});var iEt=S((wEi,oEt)=>{"use strict";var Wpn=yy(),Jpn=gS(),Kpn=(t,e,r)=>{let n=null,o=null,i=null;try{i=new Jpn(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new Wpn(n,r))}),n};oEt.exports=Kpn});var uEt=S((SEi,sEt)=>{"use strict";var mze=yy(),Gpn=gS(),aEt=qQ(),Xpn=(t,e)=>{t=new Gpn(t,e);let r=new mze("0.0.0");if(t.test(r)||(r=new mze("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 mze(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||aEt(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||aEt(r,i))&&(r=i)}return r&&t.test(r)?r:null};sEt.exports=Xpn});var cEt=S((CEi,lEt)=>{"use strict";var Zpn=gS(),Ypn=(t,e)=>{try{return new Zpn(t,e).range||"*"}catch{return null}};lEt.exports=Ypn});var vme=S((xEi,mEt)=>{"use strict";var Qpn=yy(),pEt=BQ(),{ANY:emn}=pEt,tmn=gS(),rmn=zQ(),dEt=qQ(),fEt=hme(),nmn=yme(),omn=gme(),imn=(t,e,r,n)=>{t=new Qpn(t,n),e=new tmn(e,n);let o,i,a,s,u;switch(r){case">":o=dEt,i=nmn,a=fEt,s=">",u=">=";break;case"<":o=fEt,i=omn,a=dEt,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(rmn(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===emn&&(p=new pEt(">=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};mEt.exports=imn});var gEt=S((TEi,hEt)=>{"use strict";var amn=vme(),smn=(t,e,r)=>amn(t,e,">",r);hEt.exports=smn});var bEt=S((OEi,yEt)=>{"use strict";var umn=vme(),lmn=(t,e,r)=>umn(t,e,"<",r);yEt.exports=lmn});var wEt=S((EEi,vEt)=>{"use strict";var _Et=gS(),cmn=(t,e,r)=>(t=new _Et(t,r),e=new _Et(e,r),t.intersects(e,r));vEt.exports=cmn});var CEt=S((PEi,SEt)=>{"use strict";var dmn=zQ(),fmn=hS();SEt.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>fmn(c,d,r));for(let c of a)dmn(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 MEt=S((MEi,PEt)=>{"use strict";var xEt=gS(),gze=BQ(),{ANY:hze}=gze,VQ=zQ(),yze=hS(),pmn=(t,e,r={})=>{if(t===e)return!0;t=new xEt(t,r),e=new xEt(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=hmn(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},mmn=[new gze(">=0.0.0-0")],TEt=[new gze(">=0.0.0")],hmn=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===hze){if(e.length===1&&e[0].semver===hze)return!0;r.includePrerelease?t=mmn:t=TEt}if(e.length===1&&e[0].semver===hze){if(r.includePrerelease)return!0;e=TEt}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=OEt(o,p,r):p.operator==="<"||p.operator==="<="?i=EEt(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=yze(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&&!VQ(p,String(o),r)||i&&!VQ(p,String(i),r))return null;for(let m of e)if(!VQ(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=OEt(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!VQ(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=EEt(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!VQ(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)},OEt=(t,e,r)=>{if(!t)return e;let n=yze(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},EEt=(t,e,r)=>{if(!t)return e;let n=yze(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};PEt.exports=pmn});var NEt=S((REi,AEt)=>{"use strict";var bze=H6(),REt=FQ(),gmn=yy(),IEt=rze(),ymn=xz(),bmn=nOt(),_mn=iOt(),vmn=uOt(),wmn=dOt(),Smn=pOt(),Cmn=hOt(),xmn=yOt(),Tmn=_Ot(),Omn=hS(),Emn=COt(),Pmn=TOt(),Mmn=mme(),Rmn=MOt(),Imn=IOt(),Amn=qQ(),Nmn=hme(),Dmn=ize(),jmn=aze(),$mn=gme(),Lmn=yme(),Fmn=sze(),kmn=qOt(),qmn=BQ(),Bmn=gS(),Umn=zQ(),zmn=tEt(),Vmn=nEt(),Hmn=iEt(),Wmn=uEt(),Jmn=cEt(),Kmn=vme(),Gmn=gEt(),Xmn=bEt(),Zmn=wEt(),Ymn=CEt(),Qmn=MEt();AEt.exports={parse:ymn,valid:bmn,clean:_mn,inc:vmn,diff:wmn,major:Smn,minor:Cmn,patch:xmn,prerelease:Tmn,compare:Omn,rcompare:Emn,compareLoose:Pmn,compareBuild:Mmn,sort:Rmn,rsort:Imn,gt:Amn,lt:Nmn,eq:Dmn,neq:jmn,gte:$mn,lte:Lmn,cmp:Fmn,coerce:kmn,Comparator:qmn,Range:Bmn,satisfies:Umn,toComparators:zmn,maxSatisfying:Vmn,minSatisfying:Hmn,minVersion:Wmn,validRange:Jmn,outside:Kmn,gtr:Gmn,ltr:Xmn,intersects:Zmn,simplifyRange:Ymn,subset:Qmn,SemVer:gmn,re:bze.re,src:bze.src,tokens:bze.t,SEMVER_SPEC_VERSION:REt.SEMVER_SPEC_VERSION,RELEASE_TYPES:REt.RELEASE_TYPES,compareIdentifiers:IEt.compareIdentifiers,rcompareIdentifiers:IEt.rcompareIdentifiers}});function jN(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 ehn,DEt=v(()=>{ehn=$(NEt(),1)});function wze(t){return t!=null&&typeof t=="object"&&"name"in t&&t?.name==="LangSmithNotFoundError"}async function Dr(t,e,r){let n;if(t.ok){r&&(n=await t.text());return}if(t.status===403)try{(await t.json())?.error==="org_scoped_key_requires_workspace"&&(n="This API key is org-scoped and requires workspace specification. Please provide 'workspaceId' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.")}catch{let s=new Error(`${t.status} ${t.statusText}`);throw s.status=t?.status,s}if(n===void 0)try{n=await t.text()}catch{n=""}let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Message: ${n}`;if(t.status===404)throw new vze(o);if(t.status===409)throw new _ze(o);let i=new Error(o);throw i.status=t.status,i}function $Et(t){return typeof t=="object"&&t!==null&&t.code===jEt}var _ze,vze,jEt,wme,Sze=v(()=>{_ze=class extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}},vze=class extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithNotFoundError",this.status=404}};jEt="ERR_CONFLICTING_ENDPOINTS",wme=class extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:jEt}),this.name="ConflictingEndpointsError"}}});function nhn(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Sme(t){return rhn.encode(t)}function FEt(t){if(t&&typeof t=="object"&&t!==null){if(t instanceof Map)return Object.fromEntries(t);if(t instanceof Set)return Array.from(t);if(t instanceof Date)return t.toISOString();if(t instanceof RegExp)return t.toString();if(t instanceof Error)return{name:t.name,message:t.message}}else if(typeof t=="bigint")return t.toString();return t}function ohn(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return FEt(r)}}function w_(t,e,r,n,o){try{let i=JSON.stringify(t,ohn(r),n);return Sme(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?`
Context: ${e}`:""}`),Sme("[Unserializable]");td("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?`
Context: ${e}`:""}`),typeof o>"u"&&(o=nhn()),xze(t,"",0,[],void 0,0,o);let a;try{W6.length===0?a=JSON.stringify(t,r,n):a=JSON.stringify(t,ihn(r),n)}catch{return Sme("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Cme.length!==0;){let s=Cme.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return Sme(a)}}function Cze(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),Cme.push([n,r,e,o])):W6.push([e,r,t]):(n[r]=t,Cme.push([n,r,e]))}function xze(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){Cze(thn,t,e,o);return}if(typeof a.depthLimit<"u"&&i>a.depthLimit){Cze(LEt,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Cze(LEt,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s<t.length;s++)xze(t[s],s,s,n,t,i,a);else{t=FEt(t);var u=Object.keys(t);for(s=0;s<u.length;s++){var l=u[s];xze(t[l],l,s,n,t,i,a)}}n.pop()}}function ihn(t){return t=typeof t<"u"?t:function(e,r){return r},function(e,r){if(W6.length>0)for(var n=0;n<W6.length;n++){var o=W6[n];if(o[1]===e&&o[0]===r){r=o[2],W6.splice(n,1);break}}return t.call(this,e,r)}}var LEt,thn,Cme,W6,rhn,kEt=v(()=>{NN();LEt="[...]",thn={result:"[Circular]"},Cme=[],W6=[],rhn=new TextEncoder});function qEt(t,e,r){if(r)return t;let n=Qpe(),o=e??AUe(),i=t.extra??{},a=i.metadata;return t.extra={...i,runtime:{...n,...i?.runtime},metadata:{...o,...o.revision_id||"revision_id"in t&&t.revision_id?{revision_id:("revision_id"in t?t.revision_id:void 0)??o.revision_id}:{},...a}},t}async function uhn(t){let e=[];for await(let r of t)e.push(r);return e}function xme(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function BEt(t){return typeof t=="number"?Number(t.toFixed(4)):t}function zEt(t){return"dataset_id"in t||"dataset_name"in t}var ahn,shn,lhn,chn,VEt,dhn,fhn,UEt,Tze,Cz,EUe=v(()=>{qpe();MTt();qUe();zTt();VTt();NN();Ype();Kpe();Bpe();DEt();Sze();OUe();vUe();kEt();ahn=t=>{let e=t?.toString()??td("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},shn=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};lhn=async t=>{if(t?.status===429){let e=parseInt(t.headers.get("retry-after")??"10",10)*1e3;if(e>0)return await new Promise(r=>setTimeout(r,e)),!0}return!1};chn=24*1024*1024,VEt=1024*1024*1024,dhn=1e4,fhn=100,UEt="https://api.smith.langchain.com",Tze=class{constructor(e){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSizeBytes=e??VEt}peek(){return this.items[0]}push(e){let r,n=new Promise(i=>{r=i}),o=w_(e.item,`Serializing run with id: ${e.item.id}`).length;return this.sizeBytes+o>this.maxSizeBytes&&this.items.length>0?(console.warn(`AutoBatchQueue size limit (${this.maxSizeBytes} bytes) exceeded. Dropping run with id: ${e.item.id}. Current queue size: ${this.sizeBytes} bytes, attempted addition: ${o} bytes.`),r(),n):(this.items.push({action:e.action,payload:e.item,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n)}pop({upToSizeBytes:e,upToSize:r}){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let n=[],o=0;for(;o+(this.peek()?.size??0)<e&&this.items.length>0&&n.length<r;){let i=this.items.shift();i&&(n.push(i),o+=i.size,this.sizeBytes-=i.size)}if(n.length===0&&this.items.length>0){let i=this.items.shift();n.push(i),o+=i.size,this.sizeBytes-=i.size}return[n.map(i=>({action:i.action,item:i.payload,otelContext:i.otelContext,apiKey:i.apiKey,apiUrl:i.apiUrl,size:i.size})),()=>n.forEach(i=>i.itemPromiseResolve())]}},Cz=class t{get _fetch(){return this.fetchImplementation||aTt(this.debug)}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,"workspaceId",{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,"omitTracedRuntimeInfo",{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:void 0}),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,"batchSizeLimit",{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:Gv("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"langSmithToOTELTranslator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchImplementation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cachedLSEnvVarsForMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_promptCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_multipartDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_runCompressionDisabled",{enumerable:!0,configurable:!0,writable:!0,value:td("DISABLE_RUN_COMPRESSION")==="true"}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Gv("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=ahn(e.tracingSamplingRate),this.apiUrl=xme(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=xme(e.apiKey??r.apiKey),this.webUrl=xme(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=xme(e.workspaceId??td("WORKSPACE_ID")),this.timeout_ms=e.timeout_ms??9e4,this.caller=new LQ({...e.callerOptions??{},maxRetries:4,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.fetchImplementation=e.fetchImplementation;let n=e.maxIngestMemoryBytes??VEt;this.batchIngestCaller=new LQ({maxRetries:4,maxConcurrency:this.traceBatchConcurrency,maxQueueSizeBytes:n,...e.callerOptions??{},onFailedResponseHook:lhn,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.omitTracedRuntimeInfo=e.omitTracedRuntimeInfo??!1,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.autoBatchQueue=new Tze(n),this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.batchSizeLimit=e.batchSizeLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode,eme()&&(this.langSmithToOTELTranslator=new rme),this.cachedLSEnvVarsForMetadata=AUe(),e.cache!==void 0&&e.disablePromptCache&&wz("Both 'cache' and 'disablePromptCache' were provided. The 'cache' parameter is deprecated and will be removed in a future version. Using 'cache' parameter value."),e.cache!==void 0?(wz("The 'cache' parameter is deprecated and will be removed in a future version. Use 'configureGlobalPromptCache()' to configure the global cache, or 'disablePromptCache: true' to disable caching for this client."),e.cache===!1?this._promptCache=void 0:e.cache===!0?this._promptCache=Xpe:this._promptCache=e.cache):e.disablePromptCache||(this._promptCache=Xpe)}static getDefaultClientConfig(){let e=td("API_KEY"),r=td("ENDPOINT")??UEt,n=td("HIDE_INPUTS")==="true",o=td("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:shn(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/${Zpe}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),this.workspaceId&&(e["x-tenant-id"]=this.workspaceId),e}_getPlatformEndpointPath(e){return this.apiUrl.slice(-3)!=="/v1"&&this.apiUrl.slice(-4)!=="/v1/"?`/v1/platform/${e}`:`/platform/${e}`}async processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}async processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}async prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`;return await this.caller.call(async()=>{let a=await this._fetch(o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(a,`fetch ${e}`),a})}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(async()=>{let l=await this._fetch(a,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(l,`fetch ${e}`),l}),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 a=JSON.stringify(i),u=await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}${e}`,{method:n,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Dr(c,`fetch ${e}`),c})).json();if(!u||!u[o])break;yield u[o];let l=u.cursors;if(!l||!l.next)break;i.cursor=l.next}}_shouldSample(){return this.tracingSampleRate===void 0?!0:Math.random()<this.tracingSampleRate}_filterForSampling(e,r=!1){if(this.tracingSampleRate===void 0)return e;if(r){let n=[];for(let o of e)this.filteredPostUuids.has(o.trace_id)?o.id===o.trace_id&&this.filteredPostUuids.delete(o.trace_id):n.push(o);return n}else{let n=[];for(let o of e){let i=o.trace_id??o.id;this.filteredPostUuids.has(i)||(o.id===i?this._shouldSample()?n.push(o):this.filteredPostUuids.add(i):n.push(o))}return n}}async _getBatchSizeLimitBytes(){let e=await this._ensureServerInfo();return this.batchSizeBytesLimit??e?.batch_ingest_config?.size_limit_bytes??chn}async _getBatchSizeLimit(){let e=await this._ensureServerInfo();return this.batchSizeLimit??e?.batch_ingest_config?.size_limit??fhn}async _getDatasetExamplesMultiPartSupport(){return(await this._ensureServerInfo()).instance_flags?.dataset_examples_multipart_enabled??!1}drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:r}){let n=[];for(;this.autoBatchQueue.items.length>0;){let[o,i]=this.autoBatchQueue.pop({upToSizeBytes:e,upToSize:r});if(!o.length){i();break}let a=o.reduce((l,c)=>{let d=c.apiUrl??this.apiUrl,f=c.apiKey??this.apiKey,m=c.apiKey===this.apiKey&&c.apiUrl===this.apiUrl?"default":`${d}|${f}`;return l[m]||(l[m]=[]),l[m].push(c),l},{}),s=[];for(let[l,c]of Object.entries(a)){let d=this._processBatch(c,{apiUrl:l==="default"?void 0:l.split("|")[0],apiKey:l==="default"?void 0:l.split("|")[1]});s.push(d)}let u=Promise.all(s).finally(i);n.push(u)}return Promise.all(n)}async _processBatch(e,r){if(!e.length)return;let n=e.reduce((o,i)=>o+(i.size??0),0);try{if(this.langSmithToOTELTranslator!==void 0)this._sendBatchToOTELTranslator(e);else{let o={runCreates:e.filter(s=>s.action==="create").map(s=>s.item),runUpdates:e.filter(s=>s.action==="update").map(s=>s.item)},i=await this._ensureServerInfo();if(!this._multipartDisabled&&(i?.batch_ingest_config?.use_multipart_endpoint??!0)){let s=!this._runCompressionDisabled&&i?.instance_flags?.gzip_body_enabled;try{await this.multipartIngestRuns(o,{...r,useGzip:s,sizeBytes:n})}catch(u){if(wze(u))this._multipartDisabled=!0,await this.batchIngestRuns(o,{...r,sizeBytes:n});else throw u}}else await this.batchIngestRuns(o,{...r,sizeBytes:n})}}catch(o){console.error("Error exporting batch:",o)}}_sendBatchToOTELTranslator(e){if(this.langSmithToOTELTranslator!==void 0){let r=new Map,n=[];for(let o of e)o.item.id&&o.otelContext&&(r.set(o.item.id,o.otelContext),o.action==="create"?n.push({operation:"post",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}):n.push({operation:"patch",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}));this.langSmithToOTELTranslator.exportBatch(n,r)}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.item=qEt(e.item,this.cachedLSEnvVarsForMetadata,this.omitTracedRuntimeInfo);let r=this.autoBatchQueue.push(e);if(this.manualFlushMode)return r;let n=await this._getBatchSizeLimitBytes(),o=await this._getBatchSizeLimit();return(this.autoBatchQueue.sizeBytes>n||this.autoBatchQueue.items.length>o)&&this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o}),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o})},this.autoBatchAggregationDelayMs)),r}async _getServerInfo(){let r=await(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(dhn),...this.fetchOptions});return await Dr(n,"get server info"),n})).json();return this.debug&&console.log(`
=== LangSmith Server Configuration ===
`+JSON.stringify(r,null,2)+`
`),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch(e){console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${e.status??"Unspecified status code"} ${e.message}`)}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(),r=await this._getBatchSizeLimit();await this.drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:r})}_cloneCurrentOTELContext(){let e=tme(),r=ETt();if(this.langSmithToOTELTranslator!==void 0){let n=e.getActiveSpan();if(n)return e.setSpan(r.active(),n)}}async createRun(e,r){if(!this._filterForSampling([e]).length)return;let n={...this.headers,"Content-Type":"application/json"},o=e.project_name;delete e.project_name;let i=await this.prepareRunCreateOrUpdateInputs({session_name:o,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&i.trace_id!==void 0&&i.dotted_order!==void 0){let u=this._cloneCurrentOTELContext();this.processRunOperation({action:"create",item:i,otelContext:u,apiKey:r?.apiKey,apiUrl:r?.apiUrl}).catch(console.error);return}let a=qEt(i,this.cachedLSEnvVarsForMetadata,this.omitTracedRuntimeInfo);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),r?.workspaceId!==void 0&&(n["x-tenant-id"]=r.workspaceId);let s=w_(a,`Creating run with id: ${a.id}`);await this.caller.call(async()=>{let u=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await Dr(u,"create run",!0),u})}async batchIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o=await Promise.all(e?.map(u=>this.prepareRunCreateOrUpdateInputs(u))??[]),i=await Promise.all(r?.map(u=>this.prepareRunCreateOrUpdateInputs(u))??[]);if(o.length>0&&i.length>0){let u=o.reduce((c,d)=>(d.id&&(c[d.id]=d),c),{}),l=[];for(let c of i)c.id!==void 0&&u[c.id]?u[c.id]={...u[c.id],...c}:l.push(c);o=Object.values(u),i=l}let a={post:o,patch:i};if(!a.post.length&&!a.patch.length)return;let s={post:[],patch:[]};for(let u of["post","patch"]){let l=u,c=a[l].reverse(),d=c.pop();for(;d!==void 0;)s[l].push(d),d=c.pop()}if(s.post.length>0||s.patch.length>0){let u=s.post.map(l=>l.id).concat(s.patch.map(l=>l.id)).join(",");await this._postBatchIngestRuns(w_(s,`Ingesting runs with ids: ${u}`),n)}}async _postBatchIngestRuns(e,r){let n={...this.headers,"Content-Type":"application/json",Accept:"application/json"};r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),await this.batchIngestCaller.callWithOptions({sizeBytes:r?.sizeBytes},async()=>{let o=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:e});return await Dr(o,"batch create run",!0),o})}async multipartIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o={},i=[];for(let d of e??[]){let f=await this.prepareRunCreateOrUpdateInputs(d);f.id!==void 0&&f.attachments!==void 0&&(o[f.id]=f.attachments),delete f.attachments,i.push(f)}let a=[];for(let d of r??[])a.push(await this.prepareRunCreateOrUpdateInputs(d));if(i.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(a.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(i.length>0&&a.length>0){let d=i.reduce((p,m)=>(m.id&&(p[m.id]=m),p),{}),f=[];for(let p of a)p.id!==void 0&&d[p.id]?d[p.id]={...d[p.id],...p}:f.push(p);i=Object.values(d),a=f}if(i.length===0&&a.length===0)return;let l=[],c=[];for(let[d,f]of[["post",i],["patch",a]])for(let p of f){let{inputs:m,outputs:h,events:y,extra:g,error:b,serialized:_,attachments:w,...T}=p,O={inputs:m,outputs:h,events:y,extra:g,error:b,serialized:_},E=w_(T,`Serializing for multipart ingestion of run with id: ${T.id}`);c.push({name:`${d}.${T.id}`,payload:new Blob([E],{type:`application/json; length=${E.length}`})});for(let[P,R]of Object.entries(O)){if(R===void 0)continue;let I=w_(R,`Serializing ${P} for multipart ingestion of run with id: ${T.id}`);c.push({name:`${d}.${T.id}.${P}`,payload:new Blob([I],{type:`application/json; length=${I.length}`})})}if(T.id!==void 0){let P=o[T.id];if(P){delete o[T.id];for(let[R,I]of Object.entries(P)){let A,B;if(Array.isArray(I)?[A,B]=I:(A=I.mimeType,B=I.data),R.includes(".")){console.warn(`Skipping attachment '${R}' for run ${T.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}c.push({name:`attachment.${T.id}.${R}`,payload:new Blob([B],{type:`${A}; length=${B.byteLength}`})})}}}l.push(`trace=${T.trace_id},id=${T.id}`)}await this._sendMultipartRequest(c,l.join("; "),n)}async _createNodeFetchBody(e,r){let n=[];for(let a of e)n.push(new Blob([`--${r}\r
`])),n.push(new Blob([`Content-Disposition: form-data; name="${a.name}"\r
`,`Content-Type: ${a.payload.type}\r
\r
`])),n.push(a.payload),n.push(new Blob([`\r
`]));return n.push(new Blob([`--${r}--\r
`])),await new Blob(n).arrayBuffer()}async _createMultipartStream(e,r){let n=new TextEncoder;return new ReadableStream({async start(i){let a=async s=>{typeof s=="string"?i.enqueue(n.encode(s)):i.enqueue(s)};for(let s of e){await a(`--${r}\r
`),await a(`Content-Disposition: form-data; name="${s.name}"\r
`),await a(`Content-Type: ${s.payload.type}\r
\r
`);let l=s.payload.stream().getReader();try{let c;for(;!(c=await l.read()).done;)i.enqueue(c.value)}finally{l.releaseLock()}await a(`\r
`)}await a(`--${r}--\r
`),i.close()}})}async _sendMultipartRequest(e,r,n){let o="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),i=()=>this._createNodeFetchBody(e,o),a=()=>this._createMultipartStream(e,o),s=async u=>this.batchIngestCaller.callWithOptions({sizeBytes:n?.sizeBytes},async()=>{let l=await u(),c={...this.headers,"Content-Type":`multipart/form-data; boundary=${o}`};n?.apiKey!==void 0&&(c["x-api-key"]=n.apiKey);let d=l;n?.useGzip&&typeof l=="object"&&"pipeThrough"in l&&(d=l.pipeThrough(new CompressionStream("gzip")),c["Content-Encoding"]="gzip");let f=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:c,body:d,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(f,"Failed to send multipart request",!0),f});try{let u,l=!1;iTt()&&!this.multipartStreamingDisabled&&IUe()!=="bun"?(l=!0,u=await s(a)):u=await s(i),(!this.multipartStreamingDisabled||l)&&u.status===422&&(n?.apiUrl??this.apiUrl)!==UEt&&(console.warn(`Streaming multipart upload to ${n?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${r}".`),this.multipartStreamingDisabled=!0,u=await s(i))}catch(u){if(wze(u))throw u;console.warn(`${u.message.trim()}

Context: ${r}`)}}async updateRun(e,r,n){No(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let o={...r,id:e};if(!this._filterForSampling([o],!0).length)return;if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){let s=this._cloneCurrentOTELContext();if(r.end_time!==void 0&&o.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:o,otelContext:s,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}else this.processRunOperation({action:"update",item:o,otelContext:s,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}let i={...this.headers,"Content-Type":"application/json"};n?.apiKey!==void 0&&(i["x-api-key"]=n.apiKey),n?.workspaceId!==void 0&&(i["x-tenant-id"]=n.workspaceId);let a=w_(r,`Serializing payload to update run with id: ${e}`);await this.caller.call(async()=>{let s=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Dr(s,"update run",!0),s})}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){No(e);let n=await this._get(`/runs/${e}`);return r&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:r,projectOpts:n}){if(r!==void 0){let o;r.session_id?o=r.session_id:n?.projectName?o=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?o=n?.projectId:o=(await this.readProject({projectName:td("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 uhn(this.listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),n={},o={};r.sort((i,a)=>(i?.dotted_order??"").localeCompare(a?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.dotted_order?.startsWith(e.dotted_order??"")&&i.id!==e.id&&(i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i)}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:a,startTime:s,executionOrder:u,isRoot:l,runType:c,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:y,limit:g,select:b,order:_}=e,w=[];if(r&&(w=Array.isArray(r)?r:[r]),n){let P=Array.isArray(n)?n:[n],R=await Promise.all(P.map(I=>this.readProject({projectName:I}).then(A=>A.id)));w.push(...R)}let T=["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],O={session:w.length?w:null,run_type:c,reference_example:a,query:p,filter:m,trace_filter:h,tree_filter:y,execution_order:u,parent_run:o,start_time:s?s.toISOString():null,error:d,id:f,limit:g,trace:i,select:b||T,is_root:l,order:_};O.select.includes("child_run_ids")&&wz("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let E=0;for await(let P of this._getCursorPaginatedList("/runs/query",O))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*listGroupRuns(e){let{projectId:r,projectName:n,groupBy:o,filter:i,startTime:a,endTime:s,limit:u,offset:l}=e,d={session_id:r||(await this.readProject({projectName:n})).id,group_by:o,filter:i,start_time:a?a.toISOString():null,end_time:s?s.toISOString():null,limit:Number(u)||100},f=Number(l)||0,p="/runs/group",m=`${this.apiUrl}${p}`;for(;;){let h={...d,offset:f},y=Object.fromEntries(Object.entries(h).filter(([O,E])=>E!==void 0)),g=JSON.stringify(y),_=await(await this.caller.call(async()=>{let O=await this._fetch(m,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:g});return await Dr(O,`Failed to fetch ${p}`),O})).json(),{groups:w,total:T}=_;if(w.length===0)break;for(let O of w)yield O;if(f+=w.length,f>=T)break}}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:a,referenceExampleIds:s,startTime:u,endTime:l,error:c,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:y}){let g=a||[];i&&(g=[...a||[],...await Promise.all(i.map(E=>this.readProject({projectName:E}).then(P=>P.id)))]);let _=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:y}).filter(([E,P])=>P!==void 0)),w=JSON.stringify(_);return await(await this.caller.call(async()=>{let E=await this._fetch(`${this.apiUrl}/runs/stats`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:w});return await Dr(E,"get run stats"),E})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||vz()};No(e);let o=JSON.stringify(n),a=await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await Dr(s,"share run"),s})).json();if(a===null||!("share_token"in a))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${a.share_token}/r`}async unshareRun(e){No(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(r,"unshare run",!0),r})}async readRunSharedLink(e){No(e);let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(o,"read run shared link"),o})).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 No(e),await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(a,"list shared runs"),a})).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),No(e);let o=await(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(i,"read dataset shared schema"),i})).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};No(e);let o=JSON.stringify(n),a=await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await Dr(s,"share dataset"),s})).json();return a.url=`${this.getHostUrl()}/public/${a.share_token}/d`,a}async unshareDataset(e){No(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(r,"unshare dataset",!0),r})}async readSharedDataset(e){return No(e),await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(o,"read shared dataset"),o})).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(async()=>{let s=await this._fetch(`${this.apiUrl}/public/${e}/examples?${o.toString()}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(s,"list shared examples"),s}),a=await i.json();if(!i.ok)throw"detail"in a?new Error(`Failed to list shared examples.
Status: ${i.status}
Message: ${Array.isArray(a.detail)?a.detail.join(`
`):"Unspecified error"}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return a.map(s=>({...s,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:r=null,metadata:n=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:a=null}){let s=o?"?upsert=true":"",u=`${this.apiUrl}/sessions${s}`,l=i||{};n&&(l.metadata=n);let c={name:e,extra:l,description:r};a!==null&&(c.reference_dataset_id=a);let d=JSON.stringify(c);return await(await this.caller.call(async()=>{let m=await this._fetch(u,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:d});return await Dr(m,"create project"),m})).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=JSON.stringify({name:r,extra:u,description:n,end_time:a?new Date(a).toISOString():null});return await(await this.caller.call(async()=>{let f=await this._fetch(s,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await Dr(f,"update project"),f})).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)No(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(async()=>{let a=await this._fetch(`${this.apiUrl}${n}?${o}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(a,"has project"),a});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)No(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,includeStats:a,datasetVersion:s,referenceFree:u,metadata:l}={}){let c=new URLSearchParams;if(e!==void 0)for(let d of e)c.append("id",d);if(r!==void 0&&c.append("name",r),n!==void 0&&c.append("name_contains",n),o!==void 0)c.append("reference_dataset",o);else if(i!==void 0){let d=await this.readDataset({datasetName:i});c.append("reference_dataset",d.id)}a!==void 0&&c.append("include_stats",a.toString()),s!==void 0&&c.append("dataset_version",s),u!==void 0&&c.append("reference_free",u.toString()),l!==void 0&&c.append("metadata",JSON.stringify(l));for await(let d of this._getPaginated("/sessions",c))yield*d}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,No(n),await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(o,`delete session ${n} (${r})`,!0),o})}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,c=new Blob([e],{type:"text/csv"});return l.append("file",c,r),n.forEach(p=>{l.append("input_keys",p)}),o.forEach(p=>{l.append("output_keys",p)}),i&&l.append("description",i),a&&l.append("data_type",a),s&&l.append("name",s),await(await this.caller.call(async()=>{let p=await this._fetch(u,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await Dr(p,"upload CSV"),p})).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=JSON.stringify(s);return await(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await Dr(d,"create dataset"),d})).json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e&&r)throw new Error("Must provide either datasetName or datasetId, not both");if(e)No(e),n+=`/${e}`;else if(r)o.append("name",r);else throw new Error("Must provide datasetName or datasetId");let i=await this._get(n,o),a;if(Array.isArray(i)){if(i.length===0)throw new Error(`Dataset[id=${e}, name=${r}] not found`);a=i[0]}else a=i;return a}async hasDataset({datasetId:e,datasetName:r}){try{return await this.readDataset({datasetId:e,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:r,fromVersion:n,toVersion:o}){let i=e;if(i===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:r})).id);let a=new URLSearchParams({from_version:typeof n=="string"?n:n.toISOString(),to_version:typeof o=="string"?o:o.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,a)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:r}){let n="/datasets";if(e===void 0)if(r!==void 0)e=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide either datasetName or datasetId");return(await(await this._getResponse(`${n}/${e}/openai_ft`)).text()).trim().split(`
`).map(s=>JSON.parse(s))}async*listDatasets({limit:e=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:a}={}){let s="/datasets",u=new URLSearchParams({limit:e.toString(),offset:r.toString()});if(n!==void 0)for(let l of n)u.append("id",l);o!==void 0&&u.append("name",o),i!==void 0&&u.append("name_contains",i),a!==void 0&&u.append("metadata",JSON.stringify(a));for await(let l of this._getPaginated(s,u))yield*l}async updateDataset(e){let{datasetId:r,datasetName:n,...o}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;No(i);let a=JSON.stringify(o);return await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${i}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Dr(u,"update dataset"),u})).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;No(a);let s=JSON.stringify({as_of:typeof o=="string"?o:o.toISOString(),tag:i});await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${a}/tags`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await Dr(u,"update dataset tags",!0),u})}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)No(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");await this.caller.call(async()=>{let i=await this._fetch(this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(i,`delete ${n}`,!0),i})}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),No(o);let a=JSON.stringify({tag:n});await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${o}/index`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Dr(u,"index dataset"),u})).json()}async similarExamples(e,r,n,{filter:o}={}){let i={limit:n,inputs:e};o!==void 0&&(i.filter=o),No(r);let a=JSON.stringify(i);return(await(await this.caller.call(async()=>{let l=await this._fetch(`${this.apiUrl}/datasets/${r}/search`,{headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,method:"POST",body:a});return await Dr(l,"fetch similar examples"),l})).json()).examples}async createExample(e,r,n){if(zEt(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;zEt(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]??vz())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let b=e,_=b[0].dataset_id,w=b[0].dataset_name;if(_===void 0&&w===void 0)throw new Error("Must provide either datasetName or datasetId");if(_!==void 0&&w!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");_===void 0&&(_=(await this.readDataset({datasetName:w})).id);let T=await this._uploadExamplesMultipart(_,b);return await Promise.all(T.example_ids.map(E=>this.readExample(E)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:a,useSourceRunIOs:s,useSourceRunAttachments:u,attachments:l,exampleIds:c,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((b,_)=>({dataset_id:p,inputs:b,outputs:n?.[_],metadata:o?.[_],split:i?.[_],id:c?.[_],attachments:l?.[_],source_run_id:a?.[_],use_source_run_io:s?.[_],use_source_run_attachments:u?.[_]})),y=await this._uploadExamplesMultipart(p,h);return await Promise.all(y.example_ids.map(b=>this.readExample(b)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(a=>YUe(a)?QUe(a):a),i=YUe(r)?QUe(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){No(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 y=0;for await(let g of this._getPaginated("/examples",p)){for(let b of g){let{attachment_urls:_,...w}=b,T=w;_&&(T.attachments=Object.entries(_).reduce((O,[E,P])=>(O[E.slice(11)]={presigned_url:P.presigned_url,mime_type:P.mime_type||void 0},O),{})),yield T,y++}if(u!==void 0&&y>=u)break}}async deleteExample(e){No(e);let r=`/examples/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(n,`delete ${r}`,!0),n})}async deleteExamples(e,r){if(e.forEach(n=>No(n)),r?.hardDelete){let n=this._getPlatformEndpointPath("datasets/examples/delete");await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}${n}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify({example_ids:e,hard_delete:!0}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(o,"hard delete examples",!0),o})}else{let n=new URLSearchParams;e.forEach(o=>n.append("example_ids",o)),await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/examples?${n.toString()}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(o,"delete examples",!0),o})}}async updateExample(e,r){let n;r?n=e:n=e.id,No(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,No(i),n&&o||!n&&!o)throw new Error("Exactly one of asOf and tag must be specified.");let a=new URLSearchParams;return n!==void 0&&a.append("as_of",typeof n=="string"?n:n.toISOString()),o!==void 0&&a.append("tag",o),await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${i}/version?${a.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(u,"read dataset version"),u})).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,No(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,No(a);let s={split_name:n,examples:o.map(l=>(No(l),l)),remove:i},u=JSON.stringify(s);await this.caller.call(async()=>{let l=await this._fetch(`${this.apiUrl}/datasets/${a}/splits`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await Dr(l,"update dataset splits",!0),l})}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,sessionId:m,startTime:h}){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 y={type:u??"api",metadata:s??{}};l!==void 0&&y?.metadata!==void 0&&!y.metadata.__run&&(y.metadata.__run={run_id:l}),y?.metadata!==void 0&&y.metadata.__run?.run_id!==void 0&&No(y.metadata.__run.run_id);let g={id:c??vz(),run_id:e,key:r,score:BEt(n),value:o,correction:i,comment:a,feedback_source:y,comparative_experiment_id:p,feedbackConfig:d,session_id:m??f,start_time:h},b=JSON.stringify(g),_=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{let w=await this._fetch(_,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:b});return await Dr(w,"create feedback",!0),w}),g}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let a={};r!=null&&(a.score=BEt(r)),n!=null&&(a.value=n),o!=null&&(a.correction=o),i!=null&&(a.comment=i),No(e);let s=JSON.stringify(a);await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await Dr(u,"update feedback",!0),u})}async readFeedback(e){No(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){No(e);let r=`/feedback/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(n,`delete ${r}`,!0),n})}async*listFeedback({runIds:e,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(e)for(let i of e)No(i),o.append("run",i);if(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};n?typeof n=="string"?i.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(i.expires_in=n):i.expires_in={hours:3};let a=JSON.stringify(i);return await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Dr(u,"create presigned feedback token"),u})).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:{}};a&&(u.extra.metadata=a);let l=JSON.stringify(u);return(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await Dr(d,"create comparative experiment"),d})).json()}async*listPresignedFeedbackTokens(e){No(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",sessionId:r?.session_id,startTime:r?.start_time}))}return[o,i]}async logEvaluationFeedback(e,r,n){let[o]=await this._logEvaluationFeedback(e,r,n);return o}async createFeedbackConfig(e){let{feedbackKey:r,feedbackConfig:n,isLowerScoreBetter:o=!1}=e,i={feedback_key:r,feedback_config:n,is_lower_score_better:o};return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/feedback-configs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)});return await Dr(s,"create feedback config"),s})).json()}async*listFeedbackConfigs(e={}){let{feedbackKeys:r,nameContains:n,limit:o}=e,i=new URLSearchParams;r&&r.forEach(s=>{i.append("key",s)}),n&&i.append("name_contains",n),i.append("limit",(o!==void 0?Math.min(o,100):100).toString());let a=0;for await(let s of this._getPaginated("/feedback-configs",i))if(yield*s,a+=s.length,o!==void 0&&a>=o)break}async updateFeedbackConfig(e,r={}){let{feedbackConfig:n,isLowerScoreBetter:o}=r,i={feedback_key:e};return n!==void 0&&(i.feedback_config=n),o!==void 0&&(i.is_lower_score_better=o),(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/feedback-configs`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)});return await Dr(s,"update feedback config"),s})).json()}async deleteFeedbackConfig(e){let r=new URLSearchParams({feedback_key:e});await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/feedback-configs?${r}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(n,"delete feedback config",!0),n})}async*listAnnotationQueues(e={}){let{queueIds:r,name:n,nameContains:o,limit:i}=e,a=new URLSearchParams;r&&r.forEach((u,l)=>{No(u,`queueIds[${l}]`),a.append("ids",u)}),n&&a.append("name",n),o&&a.append("name_contains",o),a.append("limit",(i!==void 0?Math.min(i,100):100).toString());let s=0;for await(let u of this._getPaginated("/annotation-queues",a))if(yield*u,s++,i!==void 0&&s>=i)break}async createAnnotationQueue(e){let{name:r,description:n,queueId:o,rubricInstructions:i,rubricItems:a}=e,s={name:r,description:n,id:o||vz(),rubric_instructions:i,rubric_items:a},u=JSON.stringify(Object.fromEntries(Object.entries(s).filter(([c,d])=>d!==void 0)));return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await Dr(c,"create annotation queue"),c})).json()}async readAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${No(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(n,"read annotation queue"),n})).json()}async updateAnnotationQueue(e,r){let{name:n,description:o,rubricInstructions:i,rubricItems:a}=r,s={};n!==void 0&&(s.name=n),o!==void 0&&(s.description=o),i!==void 0&&(s.rubric_instructions=i),a!==void 0&&(s.rubric_items=a);let u=JSON.stringify(s);await this.caller.call(async()=>{let l=await this._fetch(`${this.apiUrl}/annotation-queues/${No(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await Dr(l,"update annotation queue",!0),l})}async deleteAnnotationQueue(e){await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${No(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(r,"delete annotation queue",!0),r})}async addRunsToAnnotationQueue(e,r){let n=JSON.stringify(r.map((o,i)=>No(o,`runIds[${i}]`).toString()));await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/annotation-queues/${No(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await Dr(o,"add runs to annotation queue",!0),o})}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${No(e,"queueId")}/run`;return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(i,"get run from annotation queue"),i})).json()}async deleteRunFromAnnotationQueue(e,r){await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${No(e,"queueId")}/runs/${No(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(n,"delete run from annotation queue",!0),n})}async getSizeFromAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${No(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(n,"get size from annotation queue"),n})).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 n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/commits/${e}/?limit=1&offset=0`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(o,"get latest commit hash"),o})).json();if(n.commits.length!==0)return n.commits[0].commit_hash}async _likeOrUnlikePrompt(e,r){let[n,o,i]=jN(e),a=JSON.stringify({like:r});return(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/likes/${n}/${o}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Dr(u,`${r?"like":"unlike"} prompt`),u})).json()}async _getPromptUrl(e){let[r,n,o]=jN(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]=jN(e),a=await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return s?.status===404?null:(await Dr(s,"get prompt"),s)}))?.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]=jN(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=JSON.stringify(s),l=await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await Dr(d,"create prompt"),d}),{repo:c}=await l.json();return c}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]=jN(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=JSON.stringify(u),d=await(await this.caller.call(async()=>{let f=await this._fetch(`${this.apiUrl}/commits/${o}/${i}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await Dr(f,"create commit"),f})).json();return this._getPromptUrl(`${o}/${i}${d.commit_hash?`:${d.commit_hash}`:""}`)}async updateExamplesMultipart(e,r=[]){return this._updateExamplesMultipart(e,r)}async _updateExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())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,u={...a.metadata&&{metadata:a.metadata},...a.split&&{split:a.split}},l=w_(u,`Serializing body for example with id: ${s}`),c=new Blob([l],{type:"application/json"});if(n.append(s,c),a.inputs){let d=w_(a.inputs,`Serializing inputs for example with id: ${s}`),f=new Blob([d],{type:"application/json"});n.append(`${s}.inputs`,f)}if(a.outputs){let d=w_(a.outputs,`Serializing outputs whle updating example with id: ${s}`),f=new Blob([d],{type:"application/json"});n.append(`${s}.outputs`,f)}if(a.attachments)for(let[d,f]of Object.entries(a.attachments)){let p,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)}if(a.attachments_operations){let d=w_(a.attachments_operations,`Serializing attachments while updating example with id: ${s}`),f=new Blob([d],{type:"application/json"});n.append(`${s}.attachments_operations`,f)}}let o=e??r[0]?.dataset_id;return(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${o}/examples`)}`,{method:"PATCH",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await Dr(a,"update examples"),a})).json()}async uploadExamplesMultipart(e,r=[]){return this._uploadExamplesMultipart(e,r)}async _uploadExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())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 i of r){let a=(i.id??vz()).toString(),s={created_at:i.created_at,...i.metadata&&{metadata:i.metadata},...i.split&&{split:i.split},...i.source_run_id&&{source_run_id:i.source_run_id},...i.use_source_run_io&&{use_source_run_io:i.use_source_run_io},...i.use_source_run_attachments&&{use_source_run_attachments:i.use_source_run_attachments}},u=w_(s,`Serializing body for uploaded example with id: ${a}`),l=new Blob([u],{type:"application/json"});if(n.append(a,l),i.inputs){let c=w_(i.inputs,`Serializing inputs for uploaded example with id: ${a}`),d=new Blob([c],{type:"application/json"});n.append(`${a}.inputs`,d)}if(i.outputs){let c=w_(i.outputs,`Serializing outputs for uploaded example with id: ${a}`),d=new Blob([c],{type:"application/json"});n.append(`${a}.outputs`,d)}if(i.attachments)for(let[c,d]of Object.entries(i.attachments)){let f,p;Array.isArray(d)?[f,p]=d:(f=d.mimeType,p=d.data);let m=new Blob([p],{type:`${f}; length=${p.byteLength}`});n.append(`${a}.attachment.${c}`,m)}}return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await Dr(i,"upload examples"),i})).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]=jN(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=JSON.stringify(i);return(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/repos/${n}/${o}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Dr(u,"update prompt"),u})).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]=jN(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(a,"delete prompt"),a})).json()}_getPromptCacheKey(e,r){return`${e}${r?":with_model":""}`}async _fetchPromptFromApi(e,r){let[n,o,i]=jN(e),s=await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/commits/${n}/${o}/${i}${r?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Dr(u,"pull prompt commit"),u})).json();return{owner:n,repo:o,commit_hash:s.commit_hash,manifest:s.manifest,examples:s.examples}}async pullPromptCommit(e,r){let n=this._fetchPromptFromApi.bind(this,e,r);if(!r?.skipCache&&this._promptCache){let o=this._getPromptCacheKey(e,r?.includeModel),i=this._promptCache.get(o,n);if(i)return i;let a=await n();return this._promptCache.set(o,a,n),a}return this._fetchPromptFromApi(e,r)}async _pullPrompt(e,r){let n=await this.pullPromptCommit(e,{includeModel:r?.includeModel,skipCache:r?.skipCache});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 No(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}`)}}cleanup(){this._promptCache&&this._promptCache.stop()}async awaitPendingTraceBatches(){if(this.manualFlushMode)return console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve();await new Promise(e=>setTimeout(e,1)),await Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()]),this.langSmithToOTELTranslator!==void 0&&await PTt()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}}});var HEt,WEt=v(()=>{NN();HEt=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>td(r)==="true")});var JT,ZEi,Tme,Oze=v(()=>{JT=Symbol.for("lc:context_variables"),ZEi=Symbol.for("lc:child_run_end_promises"),Tme=Symbol.for("langsmith:replica_trace_roots")});function Eze(t,e){if(JT in t)return t[JT][e]}function JEt(t,e,r){let n=JT in t?t[JT]:{};n[e]=r,t[JT]=n}var KEt=v(()=>{Oze()});function GEt(t){let r=Object.keys(t).sort().map(n=>`${n}:${t[n]??""}`).join("|");return pUe(r,phn)}function mhn(t){return t.replace(/[-:.]/g,"")}function ZEt(t,e=1){let r=e.toFixed(0).slice(0,3).padStart(3,"0");return`${new Date(t).toISOString().slice(0,-1)}${r}Z`}function Pze(t,e,r=1){let n=ZEt(t,r);return{dottedOrder:mhn(n)+e,microsecondPrecisionDatestring:n}}function ghn(t){let e={};for(let r of Object.keys(t))hhn.has(r)&&(e[r]=t[r]);return e}function YEt(t){return t!=null&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function QEt(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function XEt(t){return Array.isArray(t)&&t.some(e=>QEt(e))}function yhn(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function bhn(t){let e=t?.callbacks;return t!=null&&typeof e=="object"&&(XEt(e?.handlers)||XEt(e))}function _hn(){let t=Gv("LANGSMITH_RUNS_ENDPOINTS");if(!t)return[];try{let e=JSON.parse(t);if(Array.isArray(e)){let r=[];for(let n of e){if(typeof n!="object"||n===null){console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got ${typeof n}`);continue}if(typeof n.api_url!="string"){console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_url}`);continue}if(typeof n.api_key!="string"){console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_key}`);continue}r.push({apiUrl:n.api_url.replace(/\/$/,""),apiKey:n.api_key})}return r}else if(typeof e=="object"&&e!==null){whn(e);let r=[];for(let[n,o]of Object.entries(e)){let i=n.replace(/\/$/,"");if(typeof o=="string")r.push({apiUrl:i,apiKey:o});else{console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${n}: expected string, got ${typeof o}`);continue}}return r}else return console.warn(`Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey, got ${typeof e}`),[]}catch(e){if($Et(e))throw e;return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey"),[]}}function vhn(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):_hn()}function whn(t){if(Object.keys(t).length>0&&td("ENDPOINT"))throw new wme}var HQ,phn,hhn,Ome,PC,PUe=v(()=>{EUe();WEt();Sze();Oze();KEt();NN();wUe();NN();Bpe();Kpe();qpe();HQ=36,phn="6ba7b810-9dad-11d1-80b4-00c04fd430c8";hhn=new Set(["projectName","updates","reroot"]);Ome=class t{constructor(e,r,n,o){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n,this.replicas=o}static fromHeader(e){let r=e.split(","),n={},o=[],i,a;for(let s of r){let[u,l]=s.split("="),c=decodeURIComponent(l);u==="langsmith-metadata"?n=JSON.parse(c):u==="langsmith-tags"?o=c.split(","):u==="langsmith-project"?i=c:u==="langsmith-replicas"&&(a=JSON.parse(c).map(f=>Array.isArray(f)?f:ghn(f)))}return new t(n,o,i,a)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}},PC=class t{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"distributedParentId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_awaitInputsOnPost",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),YEt(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},"id"in o&&o.id==null&&delete o.id,Object.assign(this,{...r,...o,client:i}),this.execution_order??(this.execution_order=1),this.child_execution_order??(this.child_execution_order=1),this.dotted_order||(this._serialized_start_time=ZEt(this.start_time,this.execution_order)),this.id||(this.id=Jpe(this._serialized_start_time??this.start_time)),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.replicas=vhn(this.replicas),!this.dotted_order){let{dottedOrder:s}=Pze(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+s:this.dotted_order=s}}set metadata(e){this.extra={...this.extra,metadata:{...this.extra?.metadata,...e}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){let e=Date.now();return{run_type:"chain",project_name:DQ(),child_runs:[],api_url:Gv("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Gv("LANGCHAIN_API_KEY"),caller_options:{},start_time:e,serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new Cz),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=this.replicas?.map(c=>{let{reroot:d,...f}=c;return f}),o=e.replicas??n,i=new t({...e,parent_run:this,project_name:this.project_name,replicas:o,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});JT in this&&(i[JT]=this[JT]);let a=Symbol.for("lc:child_config"),s=e.extra?.[a]??this.extra[a];if(bhn(s)){let c={...s},d=yhn(c.callbacks)?c.callbacks.copy?.():void 0;d&&(Object.assign(d,{_parentRunId:i.id}),d.handlers?.find(QEt)?.updateFromRunTree?.(i),c.callbacks=d),i.extra[a]=c}let u=new Set,l=this;for(;l!=null&&!u.has(l.id);)u.add(l.id),l.child_execution_order=Math.max(l.child_execution_order,r),l=l.parent_run;return this.child_runs.push(i),i}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o?.runtime?.library===void 0&&(o.runtime||(o.runtime={}),r))for(let[s,u]of Object.entries(r))o.runtime[s]||(o.runtime[s]=u);let i,a;return n?(a=e.parent_run?.id??e.parent_run_id,i=[]):(i=e.child_runs.map(s=>this._convertToCreate(s,r,n)),a=void 0),{id:e.id,name:e.name,start_time:e._serialized_start_time??e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:o,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:i,parent_run_id:a,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments,events:e.events}}_sliceParentId(e,r){if(r.dotted_order){let n=r.dotted_order.split("."),o=null;for(let i=0;i<n.length;i++)if(n[i].slice(-HQ)===e){o=i;break}if(o!==null){let i=n.slice(o+1);r.dotted_order=i.join("."),i.length>0?r.trace_id=i[0].slice(-HQ):r.trace_id=r.id}}r.parent_run_id===e&&(r.parent_run_id=void 0)}_setReplicaTraceRoot(e,r){let n=Eze(this,Tme)??{};n[e]=r,JEt(this,Tme,n);for(let o of this.child_runs)o._setReplicaTraceRoot(e,r)}_remapForProject(e){let{projectName:r,runtimeEnv:n,excludeChildRuns:o=!0,reroot:i=!1,distributedParentId:a,apiUrl:s,apiKey:u,workspaceId:l}=e,c=this._convertToCreate(this,n,o);if(r===this.project_name)return{...c,session_name:r};if(i){if(a)this._sliceParentId(a,c);else if(c.parent_run_id=void 0,c.dotted_order){let b=c.dotted_order.split(".");b.length>0&&(c.dotted_order=b[b.length-1],c.trace_id=c.id)}let g=GEt({projectName:r,apiUrl:s,apiKey:u,workspaceId:l});this._setReplicaTraceRoot(g,c.id)}let d;if(!i){let g=Eze(this,Tme)??{},b=GEt({projectName:r,apiUrl:s,apiKey:u,workspaceId:l});if(d=g[b],d&&(c.trace_id=d,c.dotted_order)){let _=c.dotted_order.split("."),w=null;for(let T=0;T<_.length;T++)if(_[T].slice(-HQ)===d){w=T;break}if(w!==null){let T=_.slice(w);c.dotted_order=T.join(".")}}}let f=c.id,p=jQ(f,r),m;c.trace_id?m=jQ(c.trace_id,r):m=p;let h;c.parent_run_id&&(h=jQ(c.parent_run_id,r));let y;return c.dotted_order&&(y=c.dotted_order.split(".").map(_=>{let w=_.slice(-HQ),T=jQ(w,r);return _.slice(0,-HQ)+T}).join(".")),{...c,id:p,trace_id:m,parent_run_id:h,dotted_order:y,session_name:r}}async postRun(e=!0){this._awaitInputsOnPost&&(this.inputs=await this.inputs);try{let r=Qpe();if(this.replicas&&this.replicas.length>0)for(let{projectName:n,apiKey:o,apiUrl:i,workspaceId:a,reroot:s}of this.replicas){let u=this._remapForProject({projectName:n??this.project_name,runtimeEnv:r,excludeChildRuns:!0,reroot:s,distributedParentId:this.distributedParentId,apiUrl:i,apiKey:o,workspaceId:a});await this.client.createRun(u,{apiKey:o,apiUrl:i,workspaceId:a})}else{let n=this._convertToCreate(this,r,e);await this.client.createRun(n)}if(!e){wz("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let n of this.child_runs)await n.postRun(!1)}this.child_runs=[]}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(e){if(this.replicas&&this.replicas.length>0)for(let{projectName:r,apiKey:n,apiUrl:o,workspaceId:i,updates:a,reroot:s}of this.replicas){let u=this._remapForProject({projectName:r??this.project_name,runtimeEnv:void 0,excludeChildRuns:!0,reroot:s,distributedParentId:this.distributedParentId,apiUrl:o,apiKey:n,workspaceId:i}),l={id:u.id,name:u.name,run_type:u.run_type,start_time:u.start_time,outputs:u.outputs,error:u.error,parent_run_id:u.parent_run_id,session_name:u.session_name,reference_example_id:u.reference_example_id,end_time:u.end_time,dotted_order:u.dotted_order,trace_id:u.trace_id,events:u.events,tags:u.tags,extra:u.extra,attachments:this.attachments,...a};e?.excludeInputs||(l.inputs=u.inputs),await this.client.updateRun(u.id,l,{apiKey:n,apiUrl:o,workspaceId:i})}else try{let r={name:this.name,run_type:this.run_type,start_time:this._serialized_start_time??this.start_time,end_time:this.end_time,error:this.error,outputs:this.outputs,parent_run_id:this.parent_run?.id??this.parent_run_id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};e?.excludeInputs||(r.inputs=this.inputs),await this.client.updateRun(this.id,r)}catch(r){console.error(`Error in patchRun for run ${this.id}`,r)}this.child_runs=[]}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=HEt();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(c=>{let[d,f]=c.split("Z");return{strTime:d,time:Date.parse(d+"Z"),uuid:f}}),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 c=Ome.fromHeader(n.baggage);u.metadata=c.metadata,u.tags=c.tags,u.project_name=c.project_name,u.replicas=c.replicas}let l=new t(u);return l.distributedParentId=l.id,l}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new Ome(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(PC,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});var Eme=v(()=>{PUe()});function Rze(t,e){if(t)return new PC({...t,start_time:t._serialized_start_time??t.start_time,parent_run:Rze(e),child_runs:t.child_runs.map(r=>Rze(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:fxt()},tracingEnabled:!1})}function Mze(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function J6(t){return typeof t._addRunToRunMap=="function"}var Shn,KT,Tz=v(()=>{zo();su();AQ();Eme();Shn=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};KT=class extends q6{constructor(e){super(...arguments);x(this,"runMap",new Map);x(this,"runTreeMap",new Map);x(this,"usesRunTreeMap",!1)}copy(){return this}getRunById(e){if(e!==void 0)return this.usesRunTreeMap?Shn(this.runTreeMap.get(e)):this.runMap.get(e)}stringifyError(e){return e instanceof Error?e.message+(e?.stack?`

${e.stack}`:""):typeof e=="string"?e:`${e}`}_addChildRun(e,r){e.child_runs.push(r)}_addRunToRunMap(e){let{dottedOrder:r,microsecondPrecisionDatestring:n}=Pze(new Date(e.start_time).getTime(),e.id,e.execution_order),o={...e},i=this.getRunById(o.parent_run_id);if(o.parent_run_id!==void 0?i?(this._addChildRun(i,o),i.child_execution_order=Math.max(i.child_execution_order,o.child_execution_order),o.trace_id=i.trace_id,i.dotted_order!==void 0&&(o.dotted_order=[i.dotted_order,r].join("."),o._serialized_start_time=n)):o.parent_run_id=void 0:(o.trace_id=o.id,o.dotted_order=r,o._serialized_start_time=n),this.usesRunTreeMap){let a=Rze(o,i);a!==void 0&&this.runTreeMap.set(o.id,a)}else this.runMap.set(o.id,o);return o}async _endTrace(e){let r=e.parent_run_id!==void 0&&this.getRunById(e.parent_run_id);r?r.child_execution_order=Math.max(r.child_execution_order,e.child_execution_order):await this.persistRun(e),await this.onRunUpdate?.(e),this.usesRunTreeMap?this.runTreeMap.delete(e.id):this.runMap.delete(e.id)}_getExecutionOrder(e){let r=e!==void 0&&this.getRunById(e);return r?r.child_execution_order+1:1}_createRunForLLMStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{prompts:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleLLMStart(e,r,n,o,i,a,s,u){let l=this.getRunById(n)??this._createRunForLLMStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}_createRunForChatModelStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{messages:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleChatModelStart(e,r,n,o,i,a,s,u){let l=this.getRunById(n)??this._createRunForChatModelStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}async handleLLMEnd(e,r,n,o,i){let a=this.getRunById(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.outputs=e,a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMEnd?.(a),await this._endTrace(a),a}async handleLLMError(e,r,n,o,i){let a=this.getRunById(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMError?.(a),await this._endTrace(a),a}_createRunForChainStart(e,r,n,o,i,a,s,u,l){let c=this._getExecutionOrder(o),d=Date.now(),f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:d,serialized:e,events:[{name:"start",time:new Date(d).toISOString()}],inputs:r,execution_order:c,child_execution_order:c,run_type:s??"chain",child_runs:[],extra:a?{...l,metadata:a}:{...l},tags:i||[]};return this._addRunToRunMap(f)}async handleChainStart(e,r,n,o,i,a,s,u){let l=this.getRunById(n)??this._createRunForChainStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onChainStart?.(l),l}async handleChainEnd(e,r,n,o,i){let a=this.getRunById(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.outputs=Mze(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=Mze(i.inputs,"input")),await this.onChainEnd?.(a),await this._endTrace(a),a}async handleChainError(e,r,n,o,i){let a=this.getRunById(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=Mze(i.inputs,"input")),await this.onChainError?.(a),await this._endTrace(a),a}_createRunForToolStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{input:r},execution_order:u,child_execution_order:u,run_type:"tool",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleToolStart(e,r,n,o,i,a,s){let u=this.getRunById(n)??this._createRunForToolStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onToolStart?.(u),u}async handleToolEnd(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.outputs={output:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onToolEnd?.(n),await this._endTrace(n),n}async handleToolError(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onToolError?.(n),await this._endTrace(n),n}async handleAgentAction(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="chain")return;let o=n;o.actions=o.actions||[],o.actions.push(e),o.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentAction?.(n)}async handleAgentEnd(e,r){let n=this.getRunById(r);!n||n?.run_type!=="chain"||(n.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentEnd?.(n))}_createRunForRetrieverStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{query:r},execution_order:u,child_execution_order:u,run_type:"retriever",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleRetrieverStart(e,r,n,o,i,a,s){let u=this.getRunById(n)??this._createRunForRetrieverStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onRetrieverStart?.(u),u}async handleRetrieverEnd(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.outputs={documents:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onRetrieverEnd?.(n),await this._endTrace(n),n}async handleRetrieverError(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onRetrieverError?.(n),await this._endTrace(n),n}async handleText(e,r){let n=this.getRunById(r);!n||n?.run_type!=="chain"||(n.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:e}}),await this.onText?.(n))}async handleLLMNewToken(e,r,n,o,i,a){let s=this.getRunById(n);if(!s||s?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return s.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:e,idx:r,chunk:a?.chunk}}),await this.onLLMNewToken?.(s,e,{chunk:a?.chunk}),s}}});var nPt=S((SPi,rPt)=>{"use strict";var ePt=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,tPt=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function Chn(){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=ePt(),e.color.ansi16m=tPt(),e.bgColor.ansi256=ePt(10),e.bgColor.ansi16m=tPt(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(rPt,"exports",{enumerable:!0,get:Chn})});function Cb(t,e){return`${t.open}${e}${t.close}`}function yS(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function oPt(t){return typeof t=="string"?t.trim():t==null?t:yS(t,t.toString())}function kL(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 Ize,S_,Aze,iPt=v(()=>{zo();Tz();Ize=$(nPt(),1);({color:S_}=Ize.default),Aze=class extends KT{constructor(){super(...arguments);x(this,"name","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 r=[...this.getParents(e).reverse(),e].map((n,o,i)=>{let a=`${n.execution_order}:${n.run_type}:${n.name}`;return o===i.length-1?Cb(Ize.default.bold,a):a}).join(" > ");return Cb(S_.grey,r)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${Cb(S_.green,"[chain/start]")} [${r}] Entering Chain run with input: ${yS(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Cb(S_.cyan,"[chain/end]")} [${r}] [${kL(e)}] Exiting Chain run with output: ${yS(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${Cb(S_.red,"[chain/error]")} [${r}] [${kL(e)}] Chain run errored with error: ${yS(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(`${Cb(S_.green,"[llm/start]")} [${r}] Entering LLM run with input: ${yS(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Cb(S_.cyan,"[llm/end]")} [${r}] [${kL(e)}] Exiting LLM run with output: ${yS(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${Cb(S_.red,"[llm/error]")} [${r}] [${kL(e)}] LLM run errored with error: ${yS(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${Cb(S_.green,"[tool/start]")} [${r}] Entering Tool run with input: "${oPt(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Cb(S_.cyan,"[tool/end]")} [${r}] [${kL(e)}] Exiting Tool run with output: "${oPt(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${Cb(S_.red,"[tool/error]")} [${r}] [${kL(e)}] Tool run errored with error: ${yS(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${Cb(S_.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${yS(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Cb(S_.cyan,"[retriever/end]")} [${r}] [${kL(e)}] Exiting Retriever run with output: ${yS(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${Cb(S_.red,"[retriever/error]")} [${r}] [${kL(e)}] Retriever run errored with error: ${yS(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${Cb(S_.blue,"[agent/action]")} [${n}] Agent selected action: ${yS(r.actions[r.actions.length-1],"[action]")}`)}}});var Pme=v(()=>{Ype()});var Nze,Dze,jze=v(()=>{su();Pme();Dze=()=>(Nze===void 0&&(Nze=new Cz(un("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{})),Nze)});function aPt(t=!1){let e=Thn.getInstance().getStore();if(!t&&e===void 0)throw new Error(`Could not get the current run tree.

Please make sure you are calling this method within a traceable function and that tracing is enabled.`);return e}function Mme(t){return typeof t=="function"&&"langsmith:traceable"in t}var Lze,$ze,xhn,Fze,Thn,NPi,sPt=v(()=>{Lze=class{getStore(){}run(e,r){return r()}},$ze=Symbol.for("ls:tracing_async_local_storage"),xhn=new Lze,Fze=class{getInstance(){return globalThis[$ze]??xhn}initializeGlobalInstance(e){globalThis[$ze]===void 0&&(globalThis[$ze]=e)}},Thn=new Fze;NPi=Symbol.for("langsmith:traceable:root")});var kze=v(()=>{sPt()});function Ohn(t){let e;for(let r of t)for(let n of r)uo.isInstance(n.message)&&n.message.usage_metadata!==void 0&&(e=MQ(e,n.message.usage_metadata));return e}var qze,lPt=v(()=>{zo();Rpe();mS();Tz();jze();Eme();Pme();kze();qze=class uPt extends KT{constructor(r={}){super(r);x(this,"name","langchain_tracer");x(this,"projectName");x(this,"exampleId");x(this,"client");x(this,"replicas");x(this,"usesRunTreeMap",!0);let{exampleId:n,projectName:o,client:i,replicas:a}=r;this.projectName=o??DQ(),this.replicas=a,this.exampleId=n,this.client=i??Dze();let s=uPt.getTraceableRunTree();s&&this.updateFromRunTree(s)}async persistRun(r){}async onRunCreate(r){r.extra?.lc_defers_inputs||await this.getRunTreeWithTracingConfig(r.id)?.postRun()}async onRunUpdate(r){let n=this.getRunTreeWithTracingConfig(r.id);r.extra?.lc_defers_inputs?await n?.postRun():await n?.patchRun()}onLLMEnd(r){let n=r.outputs;if(n?.generations){let o=Ohn(n.generations);if(o!==void 0){r.extra=r.extra??{};let i=r.extra.metadata??{};i.usage_metadata=o,r.extra.metadata=i}}}getRun(r){return this.runTreeMap.get(r)}updateFromRunTree(r){this.runTreeMap.set(r.id,r);let n=r,o=new Set;for(;n.parent_run&&!(o.has(n.id)||(o.add(n.id),!n.parent_run));)n=n.parent_run;o.clear();let i=[n];for(;i.length>0;){let a=i.shift();!a||o.has(a.id)||(o.add(a.id),this.runTreeMap.set(a.id,a),a.child_runs&&i.push(...a.child_runs))}this.client=r.client??this.client,this.replicas=r.replicas??this.replicas,this.projectName=r.project_name??this.projectName,this.exampleId=r.reference_example_id??this.exampleId}getRunTreeWithTracingConfig(r){let n=this.runTreeMap.get(r);if(n)return new PC({...n,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return aPt(!0)}catch{return}}}});var dPt=S((JPi,Ime)=>{"use strict";var Ehn=WUe(),Rme=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},cPt=(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 Rme(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);Ehn(t.then(n,o),()=>{clearTimeout(i)})});Ime.exports=cPt;Ime.exports.default=cPt;Ime.exports.TimeoutError=Rme});var fPt=S(Bze=>{"use strict";Object.defineProperty(Bze,"__esModule",{value:!0});function Phn(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}Bze.default=Phn});var pPt=S(zze=>{"use strict";Object.defineProperty(zze,"__esModule",{value:!0});var Mhn=fPt(),Uze=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=Mhn.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}};zze.default=Uze});var Wze=S(Hze=>{"use strict";Object.defineProperty(Hze,"__esModule",{value:!0});var Rhn=HUe(),mPt=dPt(),Ihn=pPt(),Ame=()=>{},Ahn=new mPt.TimeoutError,Vze=class extends Rhn{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Ame,this._resolveIdle=Ame,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:Ihn.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=Ame,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=Ame,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():mPt.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(Ahn)});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}};Hze.default=Vze});function Nhn(){return new("default"in Nme.default?Nme.default.default:Nme.default)({autoStart:!0,concurrency:1})}function Dhn(){return typeof WQ>"u"&&(WQ=Nhn()),WQ}async function Ac(t,e){if(e===!0){let r=jL();r!==void 0?await r.run(void 0,async()=>t()):await t()}else WQ=Dhn(),WQ.add(async()=>{let r=jL();r!==void 0?await r.run(void 0,async()=>t()):await t()})}var Nme,WQ,Jze=v(()=>{jze();TQ();Nme=$(Wze(),1)});var hPt=v(()=>{zo();Jze()});var gPt,yPt=v(()=>{su();gPt=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(e=>un(e)==="true")});function Kze(t){let e=jL();if(e!==void 0)return e.getStore()?.[bz]?.[t]}var jhn,bPt,_Pt=v(()=>{TQ();Eme();jhn=Symbol("lc:configure_hooks"),bPt=()=>Kze(jhn)||[]});function qL(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function KQ(t){return"name"in t?t:q6.fromMethods(t)}var $hn,Dme,Lhn,vPt,Fhn,khn,Cm,BL=v(()=>{zo();TC();su();AQ();Tz();iPt();lPt();Jze();hPt();yPt();_Pt();y_();$hn=class{setHandler(t){return this.setHandlers([t])}},Dme=class{constructor(t,e,r,n,o,i,a,s){this.runId=t,this.handlers=e,this.inheritableHandlers=r,this.tags=n,this.inheritableTags=o,this.metadata=i,this.inheritableMetadata=a,this._parentRunId=s}get parentRunId(){return this._parentRunId}async handleText(t){await Promise.all(this.handlers.map(e=>Ac(async()=>{try{await e.handleText?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleText: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleCustomEvent(t,e,r,n,o){await Promise.all(this.handlers.map(i=>Ac(async()=>{try{await i.handleCustomEvent?.(t,e,this.runId,this.tags,this.metadata)}catch(a){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleCustomEvent: ${a}`),i.raiseError)throw a}},i.awaitHandlers)))}},Lhn=class extends Dme{getChild(t){let e=new Cm(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleRetrieverEnd(t){await Promise.all(this.handlers.map(e=>Ac(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetriever`),e.raiseError)throw r}},e.awaitHandlers)))}async handleRetrieverError(t){await Promise.all(this.handlers.map(e=>Ac(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetrieverError: ${r}`),e.raiseError)throw t}},e.awaitHandlers)))}},vPt=class extends Dme{async handleLLMNewToken(t,e,r,n,o,i){await Promise.all(this.handlers.map(a=>Ac(async()=>{if(!a.ignoreLLM)try{await a.handleLLMNewToken?.(t,e??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleLLMNewToken: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}async handleLLMError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>Ac(async()=>{if(!i.ignoreLLM)try{await i.handleLLMError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(a){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMError: ${a}`),i.raiseError)throw a}},i.awaitHandlers)))}async handleLLMEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>Ac(async()=>{if(!i.ignoreLLM)try{await i.handleLLMEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(a){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMEnd: ${a}`),i.raiseError)throw a}},i.awaitHandlers)))}},Fhn=class extends Dme{getChild(t){let e=new Cm(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleChainError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>Ac(async()=>{if(!i.ignoreChain)try{await i.handleChainError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(a){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainError: ${a}`),i.raiseError)throw a}},i.awaitHandlers)))}async handleChainEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>Ac(async()=>{if(!i.ignoreChain)try{await i.handleChainEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(a){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainEnd: ${a}`),i.raiseError)throw a}},i.awaitHandlers)))}async handleAgentAction(t){await Promise.all(this.handlers.map(e=>Ac(async()=>{if(!e.ignoreAgent)try{await e.handleAgentAction?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentAction: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleAgentEnd(t){await Promise.all(this.handlers.map(e=>Ac(async()=>{if(!e.ignoreAgent)try{await e.handleAgentEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},khn=class extends Dme{getChild(t){let e=new Cm(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleToolError(t){await Promise.all(this.handlers.map(e=>Ac(async()=>{if(!e.ignoreAgent)try{await e.handleToolError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolError: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleToolEvent(t){await Promise.all(this.handlers.map(e=>Ac(async()=>{if(!e.ignoreAgent)try{await e.handleToolEvent?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if(e.raiseError)throw r}},e.awaitHandlers)))}async handleToolEnd(t){await Promise.all(this.handlers.map(e=>Ac(async()=>{if(!e.ignoreAgent)try{await e.handleToolEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},Cm=class JQ extends $hn{constructor(r,n){super();x(this,"handlers",[]);x(this,"inheritableHandlers",[]);x(this,"tags",[]);x(this,"inheritableTags",[]);x(this,"metadata",{});x(this,"inheritableMetadata",{});x(this,"name","callback_manager");x(this,"_parentRunId");this.handlers=n?.handlers??this.handlers,this.inheritableHandlers=n?.inheritableHandlers??this.inheritableHandlers,this.tags=n?.tags??this.tags,this.inheritableTags=n?.inheritableTags??this.inheritableTags,this.metadata=n?.metadata??this.metadata,this.inheritableMetadata=n?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=r}getParentRunId(){return this._parentRunId}async handleLLMStart(r,n,o=void 0,i=void 0,a=void 0,s=void 0,u=void 0,l=void 0){return Promise.all(n.map(async(c,d)=>{let f=d===0&&o?o:FT();return await Promise.all(this.handlers.map(p=>{if(!p.ignoreLLM)return J6(p)&&p._createRunForLLMStart(r,[c],f,this._parentRunId,a,this.tags,this.metadata,l),Ac(async()=>{try{await p.handleLLMStart?.(r,[c],f,this._parentRunId,a,this.tags,this.metadata,l)}catch(m){if((p.raiseError?console.error:console.warn)(`Error in handler ${p.constructor.name}, handleLLMStart: ${m}`),p.raiseError)throw m}},p.awaitHandlers)})),new vPt(f,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(r,n,o=void 0,i=void 0,a=void 0,s=void 0,u=void 0,l=void 0){return Promise.all(n.map(async(c,d)=>{let f=d===0&&o?o:FT();return await Promise.all(this.handlers.map(p=>{if(!p.ignoreLLM)return J6(p)&&p._createRunForChatModelStart(r,[c],f,this._parentRunId,a,this.tags,this.metadata,l),Ac(async()=>{try{if(p.handleChatModelStart)await p.handleChatModelStart?.(r,[c],f,this._parentRunId,a,this.tags,this.metadata,l);else if(p.handleLLMStart){let m=Ll(c);await p.handleLLMStart?.(r,[m],f,this._parentRunId,a,this.tags,this.metadata,l)}}catch(m){if((p.raiseError?console.error:console.warn)(`Error in handler ${p.constructor.name}, handleLLMStart: ${m}`),p.raiseError)throw m}},p.awaitHandlers)})),new vPt(f,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(r,n,o=FT(),i=void 0,a=void 0,s=void 0,u=void 0,l=void 0,c=void 0){return await Promise.all(this.handlers.map(d=>{if(!d.ignoreChain)return J6(d)&&d._createRunForChainStart(r,n,o,this._parentRunId,this.tags,this.metadata,i,u,c),Ac(async()=>{try{await d.handleChainStart?.(r,n,o,this._parentRunId,this.tags,this.metadata,i,u,c)}catch(f){if((d.raiseError?console.error:console.warn)(`Error in handler ${d.constructor.name}, handleChainStart: ${f}`),d.raiseError)throw f}},d.awaitHandlers)})),new Fhn(o,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(r,n,o=FT(),i=void 0,a=void 0,s=void 0,u=void 0,l=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreAgent)return J6(c)&&c._createRunForToolStart(r,n,o,this._parentRunId,this.tags,this.metadata,u),Ac(async()=>{try{await c.handleToolStart?.(r,n,o,this._parentRunId,this.tags,this.metadata,u,l)}catch(d){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleToolStart: ${d}`),c.raiseError)throw d}},c.awaitHandlers)})),new khn(o,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(r,n,o=FT(),i=void 0,a=void 0,s=void 0,u=void 0){return await Promise.all(this.handlers.map(l=>{if(!l.ignoreRetriever)return J6(l)&&l._createRunForRetrieverStart(r,n,o,this._parentRunId,this.tags,this.metadata,u),Ac(async()=>{try{await l.handleRetrieverStart?.(r,n,o,this._parentRunId,this.tags,this.metadata,u)}catch(c){if((l.raiseError?console.error:console.warn)(`Error in handler ${l.constructor.name}, handleRetrieverStart: ${c}`),l.raiseError)throw c}},l.awaitHandlers)})),new Lhn(o,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(r,n,o,i,a){await Promise.all(this.handlers.map(s=>Ac(async()=>{if(!s.ignoreCustomEvent)try{await s.handleCustomEvent?.(r,n,o,this.tags,this.metadata)}catch(u){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleCustomEvent: ${u}`),s.raiseError)throw u}},s.awaitHandlers)))}addHandler(r,n=!0){this.handlers.push(r),n&&this.inheritableHandlers.push(r)}removeHandler(r){this.handlers=this.handlers.filter(n=>n!==r),this.inheritableHandlers=this.inheritableHandlers.filter(n=>n!==r)}setHandlers(r,n=!0){this.handlers=[],this.inheritableHandlers=[];for(let o of r)this.addHandler(o,n)}addTags(r,n=!0){this.removeTags(r),this.tags.push(...r),n&&this.inheritableTags.push(...r)}removeTags(r){this.tags=this.tags.filter(n=>!r.includes(n)),this.inheritableTags=this.inheritableTags.filter(n=>!r.includes(n))}addMetadata(r,n=!0){this.metadata={...this.metadata,...r},n&&(this.inheritableMetadata={...this.inheritableMetadata,...r})}removeMetadata(r){for(let n of Object.keys(r))delete this.metadata[n],delete this.inheritableMetadata[n]}copy(r=[],n=!0){let o=new JQ(this._parentRunId);for(let i of this.handlers){let a=this.inheritableHandlers.includes(i);o.addHandler(i,a)}for(let i of this.tags){let a=this.inheritableTags.includes(i);o.addTags([i],a)}for(let i of Object.keys(this.metadata)){let a=Object.keys(this.inheritableMetadata).includes(i);o.addMetadata({[i]:this.metadata[i]},a)}for(let i of r)o.handlers.filter(a=>a.name==="console_callback_handler").some(a=>a.name===i.name)||o.addHandler(i,n);return o}static fromHandlers(r){class n extends q6{constructor(){super();x(this,"name",FT());Object.assign(this,r)}}let o=new this;return o.addHandler(new n),o}static configure(r,n,o,i,a,s,u){return this._configureSync(r,n,o,i,a,s,u)}static _configureSync(r,n,o,i,a,s,u){let l;(r||n)&&(Array.isArray(r)||!r?(l=new JQ,l.setHandlers(r?.map(KQ)??[],!0)):l=r,l=l.copy(Array.isArray(n)?n.map(KQ):n?.handlers,!1));let c=un("LANGCHAIN_VERBOSE")==="true"||u?.verbose,d=qze.getTraceableRunTree(),f=d?.tracingEnabled??gPt();if(d?.tracingEnabled===!1&&l){let m=l.handlers.filter(h=>h.name==="langchain_tracer");for(let h of m)l.removeHandler(h)}let p=f||(un("LANGCHAIN_TRACING")??!1);if(c||p){if(l||(l=new JQ),c&&!l.handlers.some(m=>m.name===Aze.prototype.name)){let m=new Aze;l.addHandler(m,!0)}if(p&&!l.handlers.some(m=>m.name==="langchain_tracer")&&f){let m=new qze;l.addHandler(m,!0)}f&&d&&l._parentRunId===void 0&&(l._parentRunId=d.id,l.handlers.find(m=>m.name==="langchain_tracer")?.updateFromRunTree(d))}for(let{contextVar:m,inheritable:h=!0,handlerClass:y,envVar:g}of bPt()){let b=g&&un(g)==="true"&&y,_,w=m!==void 0?Kze(m):void 0;w&&pxt(w)?_=w:b&&(_=new y({})),_!==void 0&&(l||(l=new JQ),l.handlers.some(T=>T.name===_.name)||l.addHandler(_,h))}return(o||i)&&l&&(l.addTags(o??[]),l.addTags(i??[],!1)),(a||s)&&l&&(l.addMetadata(a??{}),l.addMetadata(s??{},!1)),l}}});var SPt,qhn,wPt,Bhn,yg,Oz=v(()=>{TQ();BL();Pme();SPt=class{getStore(){}run(t,e){return e()}enterWith(t){}},qhn=new SPt,wPt=Symbol.for("lc:child_config"),Bhn=class{getInstance(){return jL()??qhn}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[wPt]}runWithConfig(t,e,r){let n=Cm._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata),o=this.getInstance(),i=o.getStore(),a=n?.getParentRunId(),s=n?.handlers?.find(l=>l?.name==="langchain_tracer"),u;return s&&a?u=s.getRunTreeWithTracingConfig(a):r||(u=new PC({name:"<runnable_lambda>",tracingEnabled:!1})),u&&(u.extra={...u.extra,[wPt]:t}),i!==void 0&&i[bz]!==void 0&&(u===void 0&&(u={}),u[bz]=i[bz]),o.run(u,e)}initializeGlobalInstance(t){jL()===void 0&&SCt(t)}},yg=new Bhn});var Ez=v(()=>{zo();TQ();Oz()});async function C_(t){return Cm._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function K6(...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(KQ(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(KQ(s),!0);e.callbacks=a}else e.callbacks=new Cm(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 vi(t){let e=yg.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))Uhn.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=r.timeout,o=AbortSignal.timeout(n);r.metadata||(r.metadata={}),r.metadata.timeoutMs===void 0&&(r.metadata.timeoutMs=n),r.signal!==void 0?"any"in AbortSignal&&(r.signal=AbortSignal.any([r.signal,o])):r.signal=o,delete r.timeout}return r}function Nc(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=vi(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 x_(t){if(t)return{configurable:t.configurable,recursionLimit:t.recursionLimit,callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,maxConcurrency:t.maxConcurrency,timeout:t.timeout,signal:t.signal,store:t.store}}var jme,Uhn,GT=v(()=>{BL();Oz();Ez();jme=25;Uhn=new Set(["string","number","boolean"])});async function MC(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(UL(e))},e.addEventListener("abort",r,{once:!0}),e.aborted&&o(UL(e))})]).finally(()=>e.removeEventListener("abort",r))}function UL(t){return t?.reason instanceof Error?t.reason:typeof t?.reason=="string"?new Error(t.reason):new Error("Aborted")}var G6=v(()=>{});function Xze(t,e=2){let r=Array.from({length:e},()=>[]);return r.map(async function*(o){for(;;)if(o.length===0){let i=await t.next();for(let a of r)a.push(i)}else{if(o[0].done)return;yield o.shift().value}})}function RC(t,e){if(Array.isArray(t)&&Array.isArray(e))return t.concat(e);if(typeof t=="string"&&typeof e=="string")return t+e;if(typeof t=="number"&&typeof e=="number")return t+e;if("concat"in t&&typeof t.concat=="function")return t.concat(e);if(typeof t=="object"&&typeof e=="object"){let r={...t};for(let[n,o]of Object.entries(e))n in r&&!Array.isArray(r[n])?r[n]=RC(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function CPt(t,e,r,n,...o){let i=new Pz({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var T_,Pz,XT=v(()=>{zo();Oz();Ez();GT();G6();T_=class Gze extends ReadableStream{constructor(){super(...arguments);x(this,"reader")}ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let r=await this.reader.read();return r.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:r.value}}catch(r){throw this.reader.releaseLock(),r}}async return(){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}return{done:!0,value:void 0}}async throw(r){if(this.ensureReader(),this.locked){let n=this.reader.cancel();this.reader.releaseLock(),await n}throw r}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(r){let n=r.getReader();return new Gze({start(o){return i();function i(){return n.read().then(({done:a,value:s})=>{if(a){o.close();return}return o.enqueue(s),i()})}},cancel(){n.releaseLock()}})}static fromAsyncGenerator(r){return new Gze({async pull(n){let{value:o,done:i}=await r.next();i&&n.close(),n.enqueue(o)},async cancel(n){await r.return(n)}})}};Pz=class{constructor(t){x(this,"generator");x(this,"setup");x(this,"config");x(this,"signal");x(this,"firstResult");x(this,"firstResultUsed",!1);this.generator=t.generator,this.config=t.config,this.signal=t.signal??this.config?.signal,this.setup=new Promise((e,r)=>{yg.runWithConfig(x_(t.config),async()=>{this.firstResult=t.generator.next(),t.startSetup?this.firstResult.then(t.startSetup).then(e,r):this.firstResult.then(n=>e(void 0),r)},!0)})}async next(...t){return this.signal?.throwIfAborted(),this.firstResultUsed?yg.runWithConfig(x_(this.config),this.signal?async()=>MC(this.generator.next(...t),this.signal):async()=>this.generator.next(...t),!0):(this.firstResultUsed=!0,this.firstResult)}async return(t){return this.generator.return(t)}async throw(t){return this.generator.throw(t)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}}});function Lme(t,e){return zhn.call(t,e)}function Fme(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)Lme(t,r)&&e.push(r);return e}function xb(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function kme(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 $N(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function qme(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function $me(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if($me(t[r]))return!0}else if(typeof t=="object"){let r=Fme(t),n=r.length;for(var e=0;e<n;e++)if($me(t[r[e]]))return!0}}return!1}function xPt(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 zhn,Bme,Ume=v(()=>{zhn=Object.prototype.hasOwnProperty;Bme=class extends Error{constructor(t,e,r,n,o){super(xPt(t,{name:e,index:r,operation:n,tree:o})),this.name=e,this.index=r,this.operation=n,this.tree=o,Object.setPrototypeOf(this,new.target.prototype),this.message=xPt(t,{name:e,index:r,operation:n,tree:o})}}});function zme(t,e){if(e=="")return t;var r={op:"_get",path:e};return Mz(t,r),r.value}function Mz(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):Vme(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=zme(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=GQ(t,e.value),a.test===!1)throw new Dc("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 Dc("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=xb(t));let a=(e.path||"").split("/"),s=t,u=1,l=a.length,c,d,f;for(typeof r=="function"?f=r:f=Vme;;){if(d=a[u],d&&d.indexOf("~")!=-1&&(d=qme(d)),o&&(d=="__proto__"||d=="prototype"&&u>0&&a[u-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&&c===void 0&&(s[d]===void 0?c=a.slice(0,u).join("/"):u==l-1&&(c=e.path),c!==void 0&&f(e,0,t,c)),u++,Array.isArray(s)){if(d==="-")d=s.length;else{if(r&&!kme(d))throw new Dc("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);kme(d)&&(d=~~d)}if(u>=l){if(r&&e.op==="add"&&d>s.length)throw new Dc("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let p=Hhn[e.op].call(e,s,d,t);if(p.test===!1)throw new Dc("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return p}}else if(u>=l){let p=X6[e.op].call(e,s,d,t);if(p.test===!1)throw new Dc("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return p}if(s=s[d],r&&u<l&&(!s||typeof s!="object"))throw new Dc("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,t)}}}function Rz(t,e,r,n=!0,o=!0){if(r&&!Array.isArray(e))throw new Dc("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=xb(t));let i=new Array(e.length);for(let a=0,s=e.length;a<s;a++)i[a]=Mz(t,e[a],r,!0,o,a),t=i[a].newDocument;return i.newDocument=t,i}function Whn(t,e,r){let n=Mz(t,e);if(n.test===!1)throw new Dc("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function Vme(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new Dc("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(X6[t.op]){if(typeof t.path!="string")throw new Dc("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new Dc('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 Dc("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 Dc("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")&&$me(t.value))throw new Dc("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 Dc("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 Dc("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=OPt([{op:"_get",path:t.from,value:void 0}],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new Dc("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new Dc("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function OPt(t,e,r){try{if(!Array.isArray(t))throw new Dc("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)Rz(xb(e),xb(t),r||!0);else{r=r||Vme;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(o){if(o instanceof Dc)return o;throw o}}function GQ(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(!GQ(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],!GQ(t[a],e[a]))return!1;return!0}return t!==t&&e!==e}var TPt,Dc,Vhn,X6,Hhn,XQ=v(()=>{zo();Ume();TPt=Uo({JsonPatchError:()=>Dc,_areEquals:()=>GQ,applyOperation:()=>Mz,applyPatch:()=>Rz,applyReducer:()=>Whn,deepClone:()=>Vhn,getValueByPointer:()=>zme,validate:()=>OPt,validator:()=>Vme}),Dc=Bme,Vhn=xb,X6={add:function(t,e,r){if(e==="__proto__"||e==="constructor")throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){if(e==="__proto__"||e==="constructor")throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){if(e==="__proto__"||e==="constructor")throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){let n=zme(r,this.path);n&&(n=xb(n));let o=Mz(r,{op:"remove",path:this.from}).removed;return Mz(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=zme(r,this.from);return Mz(r,{op:"add",path:this.path,value:xb(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:GQ(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},Hhn={add:function(t,e,r){return kme(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){return{newDocument:r,removed:t.splice(e,1)[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:X6.move,copy:X6.copy,test:X6.test,_get:X6._get}});function EPt(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=Fme(e),a=Fme(t),s=!1,u=a.length-1;u>=0;u--){var l=a[u],c=t[l];if(Lme(e,l)&&!(e[l]===void 0&&c!==void 0&&Array.isArray(e)===!1)){var d=e[l];typeof c=="object"&&c!=null&&typeof d=="object"&&d!=null&&Array.isArray(c)===Array.isArray(d)?EPt(c,d,r,n+"/"+$N(l),o):c!==d&&(o&&r.push({op:"test",path:n+"/"+$N(l),value:xb(c)}),r.push({op:"replace",path:n+"/"+$N(l),value:xb(d)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+$N(l),value:xb(c)}),r.push({op:"remove",path:n+"/"+$N(l)}),s=!0):(o&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}))}if(!(!s&&i.length==a.length))for(var u=0;u<i.length;u++){var l=i[u];!Lme(t,l)&&e[l]!==void 0&&r.push({op:"add",path:n+"/"+$N(l),value:xb(e[l])})}}}function Hme(t,e,r=!1){var n=[];return EPt(t,e,n,"",r),n}var ZQ=v(()=>{Ume();XQ();});var yRi,Zze=v(()=>{Ume();XQ();ZQ();yRi={...TPt,JsonPatchError:Bme,deepClone:xb,escapePathComponent:$N,unescapePathComponent:qme}});async function PPt(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 MPt(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 Jhn(t){return t!==void 0&&t.message!==void 0}var LN,Qze,RPt,e4e,IPt=v(()=>{zo();mS();Tz();XQ();Zze();XT();LN=class{constructor(t){x(this,"ops");this.ops=t.ops??[]}concat(t){let e=this.ops.concat(t.ops),r=Rz({},e);return new Qze({ops:e,state:r[r.length-1].newDocument})}},Qze=class Yze extends LN{constructor(r){super(r);x(this,"state");this.state=r.state}concat(r){let n=this.ops.concat(r.ops),o=Rz(this.state,r.ops);return new Yze({ops:n,state:o[o.length-1].newDocument})}static fromRunLogPatch(r){let n=Rz({},r.ops);return new Yze({ops:r.ops,state:n[n.length-1].newDocument})}},RPt=t=>t.name==="log_stream_tracer";e4e=class extends KT{constructor(e){super({_awaitHandler:!0,...e});x(this,"autoClose",!0);x(this,"includeNames");x(this,"includeTypes");x(this,"includeTags");x(this,"excludeNames");x(this,"excludeTypes");x(this,"excludeTags");x(this,"_schemaFormat","original");x(this,"rootId");x(this,"keyMapByRunId",{});x(this,"counterMapByRunName",{});x(this,"transformStream");x(this,"writer");x(this,"receiveStream");x(this,"name","log_stream_tracer");x(this,"lc_prefer_streaming",!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=T_.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 LN({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 LN({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 PPt(e,this._schemaFormat)),await this.writer.write(new LN({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 PPt(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await MPt(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 LN({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new LN({ops:[{op:"replace",path:"/final_output",value:await MPt(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?Jhn(n?.chunk)?a=n?.chunk:a=new Hr({id:`run-${e.id}`,content:r}):a=r;let s=new LN({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 Z6,ZT,Mi,xm=v(()=>{zo();Z6="__run",ZT=class APt{constructor(e){x(this,"text");x(this,"generationInfo");this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new APt({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},Mi=class NPt extends ZT{constructor(r){super(r);x(this,"message");this.message=r.message}concat(r){return new NPt({text:this.text+r.text,generationInfo:{...this.generationInfo,...r.generationInfo},message:this.message.concat(r.message)})}}});function Wme({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 DPt,jPt,$Pt=v(()=>{mS();Tz();XT();xm();DPt=t=>t.name==="event_stream_tracer",jPt=class extends KT{constructor(e){super({_awaitHandler:!0,...e});x(this,"autoClose",!0);x(this,"includeNames");x(this,"includeTypes");x(this,"includeTags");x(this,"excludeNames");x(this,"excludeTypes");x(this,"excludeTags");x(this,"runInfoMap",new Map);x(this,"tappedPromises",new Map);x(this,"transformStream");x(this,"writer");x(this,"receiveStream");x(this,"readableStreamClosed",!1);x(this,"name","event_stream_tracer");x(this,"lc_prefer_streaming",!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({flush:()=>{this.readableStreamClosed=!0}}),this.writer=this.transformStream.writable.getWriter(),this.receiveStream=T_.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 ZT({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.readableStreamClosed||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=Wme(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 Hr({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 ZT({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=Wme(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??{},i={output:e.outputs?.output??e.outputs,input:o};o.input&&Object.keys(o).length===1&&(i.input=o.input,r.inputs=o.input),await this.sendEndEvent({event:n,data:i,run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata??{}},r)}async onToolStart(e){let r=Wme(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 onToolError(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.`);await this.sendEndEvent({event:"on_tool_error",data:{input:r.inputs,error:e.error},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async onRetrieverStart(e){let r=Wme(e),n={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:"retriever",inputs:{query:e.inputs.query}};this.runInfoMap.set(e.id,n),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??{}},n)}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()})}}});function LPt(t){if(!(t&&Ghn(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:e,stack:r}=t;return e==="Load failed"?r===void 0||"__sentry_captured__"in t:e.startsWith("error sending request for url")?!0:Xhn.has(e)}var Khn,Ghn,Xhn,FPt=v(()=>{Khn=Object.prototype.toString,Ghn=t=>Khn.call(t)==="[object Error]",Xhn=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"])});function Zhn(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function Jme(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e<r)throw new TypeError(`Expected \`${t}\` to be \u2265 ${r}.`)}}function Qhn(t,e){let r=Math.max(1,t+1),n=e.randomize?Math.random()+1:1,o=Math.round(n*e.minTimeout*e.factor**(r-1));return o=Math.min(o,e.maxTimeout),o}function kPt(t,e){return Number.isFinite(e)?e-(performance.now()-t):e}async function egn({error:t,attemptNumber:e,retriesConsumed:r,startTime:n,options:o}){let i=t instanceof Error?t:new TypeError(`Non-error was thrown: "${t}". You should only throw errors.`);if(i instanceof Yhn)throw i.originalError;let a=Number.isFinite(o.retries)?Math.max(0,o.retries-r):o.retries,s=o.maxRetryTime??Number.POSITIVE_INFINITY,u=Object.freeze({error:i,attemptNumber:e,retriesLeft:a,retriesConsumed:r});if(await o.onFailedAttempt(u),kPt(n,s)<=0)throw i;let l=await o.shouldConsumeRetry(u),c=kPt(n,s);if(c<=0||a<=0)throw i;if(i instanceof TypeError&&!LPt(i)){if(l)throw i;return o.signal?.throwIfAborted(),!1}if(!await o.shouldRetry(u))throw i;if(!l)return o.signal?.throwIfAborted(),!1;let d=Qhn(r,o),f=Math.min(d,c);return f>0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(y),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},y=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&y.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function YQ(t,e={}){if(e={...e},Zhn(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??(e.retries=10),e.factor??(e.factor=2),e.minTimeout??(e.minTimeout=1e3),e.maxTimeout??(e.maxTimeout=Number.POSITIVE_INFINITY),e.maxRetryTime??(e.maxRetryTime=Number.POSITIVE_INFINITY),e.randomize??(e.randomize=!1),e.onFailedAttempt??(e.onFailedAttempt=()=>{}),e.shouldRetry??(e.shouldRetry=()=>!0),e.shouldConsumeRetry??(e.shouldConsumeRetry=()=>!0),Jme("factor",e.factor,{min:0,allowInfinity:!1}),Jme("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),Jme("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),Jme("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await egn({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var Yhn,t4e=v(()=>{FPt();Yhn=class extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,{message:t}=t):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}});var Kme,tgn,rgn,IC,Iz=v(()=>{zo();G6();t4e();Kme=$(Wze(),1),tgn=[400,401,402,403,404,405,406,407,409],rgn=t=>{if(typeof t!="object"||t===null)return;if("message"in t&&typeof t.message=="string"&&(t.message.startsWith("Cancel")||t.message.startsWith("AbortError"))||"name"in t&&typeof t.name=="string"&&t.name==="AbortError"||"code"in t&&typeof t.code=="string"&&t.code==="ECONNABORTED")throw t;let e="response"in t&&typeof t.response=="object"&&t.response!==null&&"status"in t.response&&typeof t.response.status=="number"?t.response.status:void 0,r="status"in t&&typeof t.status=="number"?t.status:void 0,n=e??r;if(n&&tgn.includes(+n))throw t;if(("error"in t&&typeof t.error=="object"&&t.error!==null&&"code"in t.error&&typeof t.error.code=="string"?t.error.code:void 0)==="insufficient_quota"){let o=new Error("message"in t&&typeof t.message=="string"?t.message:"Insufficient quota");throw o.name="InsufficientQuotaError",o}},IC=class{constructor(t){x(this,"maxConcurrency");x(this,"maxRetries");x(this,"onFailedAttempt");x(this,"queue");this.maxConcurrency=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??6,this.onFailedAttempt=t.onFailedAttempt??rgn,this.queue=new("default"in Kme.default?Kme.default.default:Kme.default)({concurrency:this.maxConcurrency})}async call(t,...e){return this.queue.add(()=>YQ(()=>t(...e).catch(r=>{throw r instanceof Error?r:new Error(r)}),{onFailedAttempt:({error:r})=>this.onFailedAttempt?.(r),retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(t,e,...r){if(t.signal){let n;return Promise.race([this.call(e,...r),new Promise((o,i)=>{n=()=>{i(UL(t.signal))},t.signal?.addEventListener("abort",n,{once:!0})})]).finally(()=>{t.signal&&n&&t.signal.removeEventListener("abort",n)})}return this.call(e,...r)}fetch(...t){return this.call(()=>fetch(...t).then(e=>e.ok?e:Promise.reject(e)))}}});var r4e,qPt=v(()=>{Tz();r4e=class extends KT{constructor({config:e,onStart:r,onEnd:n,onError:o}){super({_awaitHandler:!0});x(this,"name","RootListenersTracer");x(this,"rootId");x(this,"config");x(this,"argOnStart");x(this,"argOnEnd");x(this,"argOnError");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 QQ(t){return t?t.lc_runnable:!1}var BPt,UPt,Gme=v(()=>{BPt=class{constructor(t){x(this,"includeNames");x(this,"includeTypes");x(this,"includeTags");x(this,"excludeNames");x(this,"excludeTypes");x(this,"excludeTags");this.includeNames=t.includeNames,this.includeTypes=t.includeTypes,this.includeTags=t.includeTags,this.excludeNames=t.excludeNames,this.excludeTypes=t.excludeTypes,this.excludeTags=t.excludeTags}includeEvent(t,e){let r=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,n=t.tags??[];return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(e)),this.includeTags!==void 0&&(r=r||n.some(o=>this.includeTags?.includes(o))),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(e)),this.excludeTags!==void 0&&(r=r&&n.every(o=>!this.excludeTags?.includes(o))),r}},UPt=t=>btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")});function Te(t,e,r){function n(s,u){var l;Object.defineProperty(s,"_zod",{value:s._zod??{},enumerable:!1}),(l=s._zod).traits??(l.traits=new Set),s._zod.traits.add(t),e(s,u);for(let c in a.prototype)c in s||Object.defineProperty(s,c,{value:a.prototype[c].bind(s)});s._zod.constr=a,s._zod.def=u}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:t});function a(s){var u;let l=r?.Parent?new i:this;n(l,s),(u=l._zod).deferred??(u.deferred=[]);for(let c of l._zod.deferred)c();return l}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function vd(t){return t&&Object.assign(eee,t),eee}var n4e,o4e,YT,eee,Y6=v(()=>{n4e=Object.freeze({status:"aborted"});o4e=Symbol("zod_brand"),YT=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},eee={}});var Ft={};En(Ft,{BIGINT_FORMAT_RANGES:()=>m4e,Class:()=>a4e,NUMBER_FORMAT_RANGES:()=>p4e,aborted:()=>Nz,allowsEval:()=>c4e,assert:()=>sgn,assertEqual:()=>ngn,assertIs:()=>ign,assertNever:()=>agn,assertNotEqual:()=>ogn,assignProp:()=>l4e,cached:()=>nee,captureStackTrace:()=>Xme,cleanEnum:()=>vgn,cleanRegex:()=>oee,clone:()=>wd,createTransparentProxy:()=>pgn,defineLazy:()=>Bs,esc:()=>Az,escapeRegex:()=>FN,extend:()=>ggn,finalizeIssue:()=>Xv,floatSafeRemainder:()=>u4e,getElementAtPath:()=>ugn,getEnumValues:()=>ree,getLengthableOrigin:()=>see,getParsedType:()=>fgn,getSizableOrigin:()=>aee,isObject:()=>Q6,isPlainObject:()=>eJ,issue:()=>h4e,joinValues:()=>Je,jsonStringifyReplacer:()=>s4e,merge:()=>ygn,normalizeParams:()=>vt,nullish:()=>zL,numKeys:()=>dgn,omit:()=>hgn,optionalKeys:()=>f4e,partial:()=>bgn,pick:()=>mgn,prefixIssues:()=>O_,primitiveTypes:()=>d4e,promiseAllObject:()=>lgn,propertyKeyTypes:()=>iee,randomString:()=>cgn,required:()=>_gn,stringifyPrimitive:()=>Ut,unwrapMessage:()=>tee});function ngn(t){return t}function ogn(t){return t}function ign(t){}function agn(t){throw new Error}function sgn(t){}function ree(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function Je(t,e="|"){return t.map(r=>Ut(r)).join(e)}function s4e(t,e){return typeof e=="bigint"?e.toString():e}function nee(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function zL(t){return t==null}function oee(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function u4e(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}function Bs(t,e,r){Object.defineProperty(t,e,{get(){{let o=r();return t[e]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function l4e(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ugn(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function lgn(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<e.length;i++)o[e[i]]=n[i];return o})}function cgn(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Az(t){return JSON.stringify(t)}function Q6(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function eJ(t){if(Q6(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(Q6(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function dgn(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function FN(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function wd(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function vt(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function pgn(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function Ut(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function f4e(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function mgn(t,e){let r={},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(r[o]=n.shape[o])}return wd(t,{...t._zod.def,shape:r,checks:[]})}function hgn(t,e){let r={...t._zod.def.shape},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete r[o]}return wd(t,{...t._zod.def,shape:r,checks:[]})}function ggn(t,e){if(!eJ(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return l4e(this,"shape",n),n},checks:[]};return wd(t,r)}function ygn(t,e){return wd(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return l4e(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function bgn(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let i in r){if(!(i in n))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(o[i]=t?new t({type:"optional",innerType:n[i]}):n[i])}else for(let i in n)o[i]=t?new t({type:"optional",innerType:n[i]}):n[i];return wd(e,{...e._zod.def,shape:o,checks:[]})}function _gn(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(o[i]=new t({type:"nonoptional",innerType:n[i]}))}else for(let i in n)o[i]=new t({type:"nonoptional",innerType:n[i]});return wd(e,{...e._zod.def,shape:o,checks:[]})}function Nz(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function O_(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function tee(t){return typeof t=="string"?t:t?.message}function Xv(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=tee(t.inst?._zod.def?.error?.(t))??tee(e?.error?.(t))??tee(r.customError?.(t))??tee(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function aee(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function see(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function h4e(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function vgn(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var Xme,c4e,fgn,iee,d4e,p4e,m4e,a4e,zn=v(()=>{Xme=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};c4e=nee(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});fgn=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},iee=new Set(["string","number","symbol"]),d4e=new Set(["string","number","bigint","boolean","symbol","undefined"]);p4e={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},m4e={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};a4e=class{constructor(...e){}}});function lee(t,e=r=>r.message){let r={},n=[];for(let o of t.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}}function cee(t,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.errors.length)a.errors.map(s=>o({issues:s}));else if(a.code==="invalid_key")o({issues:a.issues});else if(a.code==="invalid_element")o({issues:a.issues});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(t),n}function g4e(t,e){let r=e||function(i){return i.message},n={errors:[]},o=(i,a=[])=>{var s,u;for(let l of i.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(c=>o({issues:c},l.path));else if(l.code==="invalid_key")o({issues:l.issues},l.path);else if(l.code==="invalid_element")o({issues:l.issues},l.path);else{let c=[...a,...l.path];if(c.length===0){n.errors.push(r(l));continue}let d=n,f=0;for(;f<c.length;){let p=c[f],m=f===c.length-1;typeof p=="string"?(d.properties??(d.properties={}),(s=d.properties)[p]??(s[p]={errors:[]}),d=d.properties[p]):(d.items??(d.items=[]),(u=d.items)[p]??(u[p]={errors:[]}),d=d.items[p]),m&&d.errors.push(r(l)),f++}}};return o(t),n}function VPt(t){let e=[];for(let r of t)typeof r=="number"?e.push(`[${r}]`):typeof r=="symbol"?e.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?e.push(`[${JSON.stringify(r)}]`):(e.length&&e.push("."),e.push(r));return e.join("")}function y4e(t){let e=[],r=[...t.issues].sort((n,o)=>n.path.length-o.path.length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(`  \u2192 at ${VPt(n.path)}`);return e.join(`
`)}var zPt,uee,tJ,b4e=v(()=>{Y6();zn();zPt=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,s4e,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},uee=Te("$ZodError",zPt),tJ=Te("$ZodError",zPt,{Parent:Error})});var Zme,Dz,Yme,jz,Qme,_4e,ehe,v4e,the=v(()=>{Y6();b4e();zn();Zme=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new YT;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>Xv(u,i,vd())));throw Xme(s,o?.callee),s}return a.value},Dz=Zme(tJ),Yme=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>Xv(u,i,vd())));throw Xme(s,o?.callee),s}return a.value},jz=Yme(tJ),Qme=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new YT;return i.issues.length?{success:!1,error:new(t??uee)(i.issues.map(a=>Xv(a,o,vd())))}:{success:!0,data:i.value}},_4e=Qme(tJ),ehe=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>Xv(a,o,vd())))}:{success:!0,data:i.value}},v4e=ehe(tJ)});var Lz={};En(Lz,{_emoji:()=>HPt,base64:()=>j4e,base64url:()=>rhe,bigint:()=>U4e,boolean:()=>H4e,browserEmail:()=>Mgn,cidrv4:()=>N4e,cidrv6:()=>D4e,cuid:()=>w4e,cuid2:()=>S4e,date:()=>F4e,datetime:()=>q4e,domain:()=>Rgn,duration:()=>E4e,e164:()=>L4e,email:()=>M4e,emoji:()=>R4e,extendedDuration:()=>Sgn,guid:()=>P4e,hostname:()=>$4e,html5Email:()=>Ogn,integer:()=>z4e,ipv4:()=>I4e,ipv6:()=>A4e,ksuid:()=>T4e,lowercase:()=>K4e,nanoid:()=>O4e,null:()=>W4e,number:()=>V4e,rfc5322Email:()=>Egn,string:()=>B4e,time:()=>k4e,ulid:()=>C4e,undefined:()=>J4e,unicodeEmail:()=>Pgn,uppercase:()=>G4e,uuid:()=>$z,uuid4:()=>Cgn,uuid6:()=>xgn,uuid7:()=>Tgn,xid:()=>x4e});function R4e(){return new RegExp(HPt,"u")}function JPt(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function k4e(t){return new RegExp(`^${JPt(t)}$`)}function q4e(t){let e=JPt({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${WPt}T(?:${n})$`)}var w4e,S4e,C4e,x4e,T4e,O4e,E4e,Sgn,P4e,$z,Cgn,xgn,Tgn,M4e,Ogn,Egn,Pgn,Mgn,HPt,I4e,A4e,N4e,D4e,j4e,rhe,$4e,Rgn,L4e,WPt,F4e,B4e,U4e,z4e,V4e,H4e,W4e,J4e,K4e,G4e,nhe=v(()=>{w4e=/^[cC][^\s-]{8,}$/,S4e=/^[0-9a-z]+$/,C4e=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,x4e=/^[0-9a-vA-V]{20}$/,T4e=/^[A-Za-z0-9]{27}$/,O4e=/^[a-zA-Z0-9_-]{21}$/,E4e=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Sgn=/^[-+]?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)?)??$/,P4e=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$z=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,Cgn=$z(4),xgn=$z(6),Tgn=$z(7),M4e=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ogn=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Egn=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Pgn=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Mgn=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,HPt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";I4e=/^(?:(?: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])$/,A4e=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,N4e=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,D4e=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,j4e=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rhe=/^[A-Za-z0-9_-]*$/,$4e=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Rgn=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,L4e=/^\+(?:[0-9]){6,14}[0-9]$/,WPt="(?:(?:\\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])))",F4e=new RegExp(`^${WPt}$`);B4e=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},U4e=/^\d+n?$/,z4e=/^\d+$/,V4e=/^-?\d+(?:\.\d+)?/i,H4e=/true|false/i,W4e=/null/i,J4e=/undefined/i,K4e=/^[^A-Z]*$/,G4e=/^[^a-z]*$/});function KPt(t,e,r){t.issues.length&&e.issues.push(...O_(r,t.issues))}var hc,GPt,ohe,ihe,X4e,Z4e,Y4e,Q4e,e2e,t2e,r2e,n2e,o2e,rJ,i2e,a2e,s2e,u2e,l2e,c2e,d2e,f2e,p2e,ahe=v(()=>{Y6();nhe();zn();hc=Te("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),GPt={number:"number",bigint:"bigint",object:"date"},ohe=Te("$ZodCheckLessThan",(t,e)=>{hc.init(t,e);let r=GPt[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),ihe=Te("$ZodCheckGreaterThan",(t,e)=>{hc.init(t,e);let r=GPt[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),X4e=Te("$ZodCheckMultipleOf",(t,e)=>{hc.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):u4e(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Z4e=Te("$ZodCheckNumberFormat",(t,e)=>{hc.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=p4e[e.format];t._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=o,s.maximum=i,r&&(s.pattern=z4e)}),t._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:e.format,code:"invalid_type",input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inst:t})}}),Y4e=Te("$ZodCheckBigIntFormat",(t,e)=>{hc.init(t,e);let[r,n]=m4e[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inst:t})}}),Q4e=Te("$ZodCheckMaxSize",(t,e)=>{var r;hc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!zL(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;o.size<=e.maximum||n.issues.push({origin:aee(o),code:"too_big",maximum:e.maximum,input:o,inst:t,continue:!e.abort})}}),e2e=Te("$ZodCheckMinSize",(t,e)=>{var r;hc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!zL(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:aee(o),code:"too_small",minimum:e.minimum,input:o,inst:t,continue:!e.abort})}}),t2e=Te("$ZodCheckSizeEquals",(t,e)=>{var r;hc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!zL(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let a=i>e.size;n.issues.push({origin:aee(o),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),r2e=Te("$ZodCheckMaxLength",(t,e)=>{var r;hc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!zL(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let a=see(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),n2e=Te("$ZodCheckMinLength",(t,e)=>{var r;hc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!zL(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let a=see(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),o2e=Te("$ZodCheckLengthEquals",(t,e)=>{var r;hc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!zL(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let a=see(o),s=i>e.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),rJ=Te("$ZodCheckStringFormat",(t,e)=>{var r,n;hc.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),i2e=Te("$ZodCheckRegex",(t,e)=>{rJ.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),a2e=Te("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=K4e),rJ.init(t,e)}),s2e=Te("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=G4e),rJ.init(t,e)}),u2e=Te("$ZodCheckIncludes",(t,e)=>{hc.init(t,e);let r=FN(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),l2e=Te("$ZodCheckStartsWith",(t,e)=>{hc.init(t,e);let r=new RegExp(`^${FN(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),c2e=Te("$ZodCheckEndsWith",(t,e)=>{hc.init(t,e);let r=new RegExp(`.*${FN(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});d2e=Te("$ZodCheckProperty",(t,e)=>{hc.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>KPt(o,r,e.property));KPt(n,r,e.property)}}),f2e=Te("$ZodCheckMimeType",(t,e)=>{hc.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t})}}),p2e=Te("$ZodCheckOverwrite",(t,e)=>{hc.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var dee,m2e=v(()=>{dee=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>`  ${i}`)];return new e(...r,o.join(`
`))}}});var h2e,g2e=v(()=>{h2e={major:4,minor:0,patch:0}});function L2e(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function uMt(t){if(!rhe.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return L2e(r)}function lMt(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}function ZPt(t,e,r){t.issues.length&&e.issues.push(...O_(r,t.issues)),e.value[r]=t.value}function she(t,e,r){t.issues.length&&e.issues.push(...O_(r,t.issues)),e.value[r]=t.value}function YPt(t,e,r,n){t.issues.length?n[r]===void 0?r in n?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...O_(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function QPt(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(i=>Xv(i,n,vd())))}),e}function y2e(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(eJ(t)&&eJ(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let a=y2e(t[i],e[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],a=y2e(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function eMt(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),Nz(t))return t;let n=y2e(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}function uhe(t,e,r){t.issues.length&&e.issues.push(...O_(r,t.issues)),e.value[r]=t.value}function tMt(t,e,r,n,o,i,a){t.issues.length&&(iee.has(typeof n)?r.issues.push(...O_(n,t.issues)):r.issues.push({origin:"map",code:"invalid_key",input:o,inst:i,issues:t.issues.map(s=>Xv(s,a,vd()))})),e.issues.length&&(iee.has(typeof n)?r.issues.push(...O_(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(s=>Xv(s,a,vd()))})),r.value.set(t.value,e.value)}function rMt(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}function nMt(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function oMt(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function iMt(t,e,r){return Nz(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}function aMt(t){return t.value=Object.freeze(t.value),t}function sMt(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(h4e(o))}}var lo,Fz,Nu,b2e,_2e,v2e,w2e,S2e,C2e,x2e,T2e,O2e,E2e,P2e,M2e,R2e,I2e,A2e,N2e,D2e,j2e,$2e,F2e,k2e,q2e,B2e,U2e,lhe,z2e,fee,che,V2e,H2e,W2e,J2e,K2e,kz,pee,G2e,X2e,mee,Z2e,dhe,Y2e,Q2e,qz,eVe,tVe,rVe,nVe,oVe,iVe,hee,fhe,aVe,sVe,uVe,lVe,cVe,dVe,fVe,gee,pVe,mVe,hVe,gVe,yVe,yee=v(()=>{ahe();Y6();m2e();the();nhe();zn();g2e();zn();lo=Te("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=h2e;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(i,a,s)=>{let u=Nz(i),l;for(let c of a){if(c._zod.def.when){if(!c._zod.def.when(i))continue}else if(u)continue;let d=i.issues.length,f=c._zod.check(i);if(f instanceof Promise&&s?.async===!1)throw new YT;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==d&&(u||(u=Nz(i,d)))});else{if(i.issues.length===d)continue;u||(u=Nz(i,d))}}return l?l.then(()=>i):i};t._zod.run=(i,a)=>{let s=t._zod.parse(i,a);if(s instanceof Promise){if(a.async===!1)throw new YT;return s.then(u=>o(u,n,a))}return o(s,n,a)}}t["~standard"]={validate:o=>{try{let i=_4e(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return v4e(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),Fz=Te("$ZodString",(t,e)=>{lo.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??B4e(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Nu=Te("$ZodStringFormat",(t,e)=>{rJ.init(t,e),Fz.init(t,e)}),b2e=Te("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=P4e),Nu.init(t,e)}),_2e=Te("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=$z(n))}else e.pattern??(e.pattern=$z());Nu.init(t,e)}),v2e=Te("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=M4e),Nu.init(t,e)}),w2e=Te("$ZodURL",(t,e)=>{Nu.init(t,e),t._zod.check=r=>{try{let n=r.value,o=new URL(n),i=o.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:$4e.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!n.endsWith("/")&&i.endsWith("/")?r.value=i.slice(0,-1):r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),S2e=Te("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=R4e()),Nu.init(t,e)}),C2e=Te("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=O4e),Nu.init(t,e)}),x2e=Te("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=w4e),Nu.init(t,e)}),T2e=Te("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=S4e),Nu.init(t,e)}),O2e=Te("$ZodULID",(t,e)=>{e.pattern??(e.pattern=C4e),Nu.init(t,e)}),E2e=Te("$ZodXID",(t,e)=>{e.pattern??(e.pattern=x4e),Nu.init(t,e)}),P2e=Te("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=T4e),Nu.init(t,e)}),M2e=Te("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=q4e(e)),Nu.init(t,e)}),R2e=Te("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=F4e),Nu.init(t,e)}),I2e=Te("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=k4e(e)),Nu.init(t,e)}),A2e=Te("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=E4e),Nu.init(t,e)}),N2e=Te("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=I4e),Nu.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),D2e=Te("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=A4e),Nu.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),j2e=Te("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=N4e),Nu.init(t,e)}),$2e=Te("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=D4e),Nu.init(t,e),t._zod.check=r=>{let[n,o]=r.value.split("/");try{if(!o)throw new Error;let i=Number(o);if(`${i}`!==o)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});F2e=Te("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=j4e),Nu.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{L2e(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});k2e=Te("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=rhe),Nu.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{uMt(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),q2e=Te("$ZodE164",(t,e)=>{e.pattern??(e.pattern=L4e),Nu.init(t,e)});B2e=Te("$ZodJWT",(t,e)=>{Nu.init(t,e),t._zod.check=r=>{lMt(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),U2e=Te("$ZodCustomStringFormat",(t,e)=>{Nu.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),lhe=Te("$ZodNumber",(t,e)=>{lo.init(t,e),t._zod.pattern=t._zod.bag.pattern??V4e,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),z2e=Te("$ZodNumber",(t,e)=>{Z4e.init(t,e),lhe.init(t,e)}),fee=Te("$ZodBoolean",(t,e)=>{lo.init(t,e),t._zod.pattern=H4e,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),che=Te("$ZodBigInt",(t,e)=>{lo.init(t,e),t._zod.pattern=U4e,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),V2e=Te("$ZodBigInt",(t,e)=>{Y4e.init(t,e),che.init(t,e)}),H2e=Te("$ZodSymbol",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),W2e=Te("$ZodUndefined",(t,e)=>{lo.init(t,e),t._zod.pattern=J4e,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),J2e=Te("$ZodNull",(t,e)=>{lo.init(t,e),t._zod.pattern=W4e,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),K2e=Te("$ZodAny",(t,e)=>{lo.init(t,e),t._zod.parse=r=>r}),kz=Te("$ZodUnknown",(t,e)=>{lo.init(t,e),t._zod.parse=r=>r}),pee=Te("$ZodNever",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),G2e=Te("$ZodVoid",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),X2e=Te("$ZodDate",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});mee=Te("$ZodArray",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],u=e.element._zod.run({value:s,issues:[]},n);u instanceof Promise?i.push(u.then(l=>ZPt(l,r,a))):ZPt(u,r,a)}return i.length?Promise.all(i).then(()=>r):r}});Z2e=Te("$ZodObject",(t,e)=>{lo.init(t,e);let r=nee(()=>{let d=Object.keys(e.shape);for(let p of d)if(!(e.shape[p]instanceof lo))throw new Error(`Invalid element at key "${p}": expected a Zod schema`);let f=f4e(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(f)}});Bs(t._zod,"propValues",()=>{let d=e.shape,f={};for(let p in d){let m=d[p]._zod;if(m.values){f[p]??(f[p]=new Set);for(let h of m.values)f[p].add(h)}}return f});let n=d=>{let f=new dee(["shape","payload","ctx"]),p=r.value,m=b=>{let _=Az(b);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};f.write("const input = payload.value;");let h=Object.create(null),y=0;for(let b of p.keys)h[b]=`key_${y++}`;f.write("const newResult = {}");for(let b of p.keys)if(p.optionalKeys.has(b)){let _=h[b];f.write(`const ${_} = ${m(b)};`);let w=Az(b);f.write(`
        if (${_}.issues.length) {
          if (input[${w}] === undefined) {
            if (${w} in input) {
              newResult[${w}] = undefined;
            }
          } else {
            payload.issues = payload.issues.concat(
              ${_}.issues.map((iss) => ({
                ...iss,
                path: iss.path ? [${w}, ...iss.path] : [${w}],
              }))
            );
          }
        } else if (${_}.value === undefined) {
          if (${w} in input) newResult[${w}] = undefined;
        } else {
          newResult[${w}] = ${_}.value;
        }
        `)}else{let _=h[b];f.write(`const ${_} = ${m(b)};`),f.write(`
          if (${_}.issues.length) payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
            ...iss,
            path: iss.path ? [${Az(b)}, ...iss.path] : [${Az(b)}]
          })));`),f.write(`newResult[${Az(b)}] = ${_}.value`)}f.write("payload.value = newResult;"),f.write("return payload;");let g=f.compile();return(b,_)=>g(d,b,_)},o,i=Q6,a=!eee.jitless,u=a&&c4e.value,l=e.catchall,c;t._zod.parse=(d,f)=>{c??(c=r.value);let p=d.value;if(!i(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:t}),d;let m=[];if(a&&u&&f?.async===!1&&f.jitless!==!0)o||(o=n(e.shape)),d=o(d,f);else{d.value={};let _=c.shape;for(let w of c.keys){let T=_[w],O=T._zod.run({value:p[w],issues:[]},f),E=T._zod.optin==="optional"&&T._zod.optout==="optional";O instanceof Promise?m.push(O.then(P=>E?YPt(P,d,w,p):she(P,d,w))):E?YPt(O,d,w,p):she(O,d,w)}}if(!l)return m.length?Promise.all(m).then(()=>d):d;let h=[],y=c.keySet,g=l._zod,b=g.def.type;for(let _ of Object.keys(p)){if(y.has(_))continue;if(b==="never"){h.push(_);continue}let w=g.run({value:p[_],issues:[]},f);w instanceof Promise?m.push(w.then(T=>she(T,d,_))):she(w,d,_)}return h.length&&d.issues.push({code:"unrecognized_keys",keys:h,input:p,inst:t}),m.length?Promise.all(m).then(()=>d):d}});dhe=Te("$ZodUnion",(t,e)=>{lo.init(t,e),Bs(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),Bs(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),Bs(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),Bs(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>oee(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let o=!1,i=[];for(let a of e.options){let s=a._zod.run({value:r.value,issues:[]},n);if(s instanceof Promise)i.push(s),o=!0;else{if(s.issues.length===0)return s;i.push(s)}}return o?Promise.all(i).then(a=>QPt(a,r,t,n)):QPt(i,r,t,n)}}),Y2e=Te("$ZodDiscriminatedUnion",(t,e)=>{dhe.init(t,e);let r=t._zod.parse;Bs(t._zod,"propValues",()=>{let o={};for(let i of e.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[s,u]of Object.entries(a)){o[s]||(o[s]=new Set);for(let l of u)o[s].add(l)}}return o});let n=nee(()=>{let o=e.options,i=new Map;for(let a of o){let s=a._zod.propValues[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let u of s){if(i.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);i.set(u,a)}}return i});t._zod.parse=(o,i)=>{let a=o.value;if(!Q6(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),o;let s=n.value.get(a?.[e.discriminator]);return s?s._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,path:[e.discriminator],inst:t}),o)}}),Q2e=Te("$ZodIntersection",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),a=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,l])=>eMt(r,u,l)):eMt(r,i,a)}});qz=Te("$ZodTuple",(t,e)=>{lo.init(t,e);let r=e.items,n=r.length-[...r].reverse().findIndex(o=>o._zod.optin!=="optional");t._zod.parse=(o,i)=>{let a=o.value;if(!Array.isArray(a))return o.issues.push({input:a,inst:t,expected:"tuple",code:"invalid_type"}),o;o.value=[];let s=[];if(!e.rest){let l=a.length>r.length,c=a.length<n-1;if(l||c)return o.issues.push({input:a,inst:t,origin:"array",...l?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length}}),o}let u=-1;for(let l of r){if(u++,u>=a.length&&u>=n)continue;let c=l._zod.run({value:a[u],issues:[]},i);c instanceof Promise?s.push(c.then(d=>uhe(d,o,u))):uhe(c,o,u)}if(e.rest){let l=a.slice(r.length);for(let c of l){u++;let d=e.rest._zod.run({value:c,issues:[]},i);d instanceof Promise?s.push(d.then(f=>uhe(f,o,u))):uhe(d,o,u)}}return s.length?Promise.all(s).then(()=>o):o}});eVe=Te("$ZodRecord",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!eJ(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[];if(e.keyType._zod.values){let a=e.keyType._zod.values;r.value={};for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(c=>{c.issues.length&&r.issues.push(...O_(u,c.issues)),r.value[u]=c.value})):(l.issues.length&&r.issues.push(...O_(u,l.issues)),r.value[u]=l.value)}let s;for(let u in o)a.has(u)||(s=s??[],s.push(u));s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:s})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let s=e.keyType._zod.run({value:a,issues:[]},n);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:s.issues.map(l=>Xv(l,n,vd())),input:a,path:[a],inst:t}),r.value[s.value]=s.value;continue}let u=e.valueType._zod.run({value:o[a],issues:[]},n);u instanceof Promise?i.push(u.then(l=>{l.issues.length&&r.issues.push(...O_(a,l.issues)),r.value[s.value]=l.value})):(u.issues.length&&r.issues.push(...O_(a,u.issues)),r.value[s.value]=u.value)}}return i.length?Promise.all(i).then(()=>r):r}}),tVe=Te("$ZodMap",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[a,s]of o){let u=e.keyType._zod.run({value:a,issues:[]},n),l=e.valueType._zod.run({value:s,issues:[]},n);u instanceof Promise||l instanceof Promise?i.push(Promise.all([u,l]).then(([c,d])=>{tMt(c,d,r,a,o,t,n)})):tMt(u,l,r,a,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});rVe=Te("$ZodSet",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=e.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(u=>rMt(u,r))):rMt(s,r)}return i.length?Promise.all(i).then(()=>r):r}});nVe=Te("$ZodEnum",(t,e)=>{lo.init(t,e);let r=ree(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>iee.has(typeof n)).map(n=>typeof n=="string"?FN(n):n.toString()).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return t._zod.values.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:t}),n}}),oVe=Te("$ZodLiteral",(t,e)=>{lo.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?FN(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{let o=r.value;return t._zod.values.has(o)||r.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),r}}),iVe=Te("$ZodFile",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),hee=Te("$ZodTransform",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>{let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new YT;return r.value=o,r}}),fhe=Te("$ZodOptional",(t,e)=>{lo.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Bs(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Bs(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${oee(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n)}),aVe=Te("$ZodNullable",(t,e)=>{lo.init(t,e),Bs(t._zod,"optin",()=>e.innerType._zod.optin),Bs(t._zod,"optout",()=>e.innerType._zod.optout),Bs(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${oee(r.source)}|null)$`):void 0}),Bs(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),sVe=Te("$ZodDefault",(t,e)=>{lo.init(t,e),t._zod.optin="optional",Bs(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>nMt(i,e)):nMt(o,e)}});uVe=Te("$ZodPrefault",(t,e)=>{lo.init(t,e),t._zod.optin="optional",Bs(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),lVe=Te("$ZodNonOptional",(t,e)=>{lo.init(t,e),Bs(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>oMt(i,t)):oMt(o,t)}});cVe=Te("$ZodSuccess",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),dVe=Te("$ZodCatch",(t,e)=>{lo.init(t,e),t._zod.optin="optional",Bs(t._zod,"optout",()=>e.innerType._zod.optout),Bs(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>Xv(a,n,vd()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>Xv(i,n,vd()))},input:r.value}),r.issues=[]),r)}}),fVe=Te("$ZodNaN",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),gee=Te("$ZodPipe",(t,e)=>{lo.init(t,e),Bs(t._zod,"values",()=>e.in._zod.values),Bs(t._zod,"optin",()=>e.in._zod.optin),Bs(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>iMt(i,e,n)):iMt(o,e,n)}});pVe=Te("$ZodReadonly",(t,e)=>{lo.init(t,e),Bs(t._zod,"propValues",()=>e.innerType._zod.propValues),Bs(t._zod,"values",()=>e.innerType._zod.values),Bs(t._zod,"optin",()=>e.innerType._zod.optin),Bs(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(aMt):aMt(o)}});mVe=Te("$ZodTemplateLiteral",(t,e)=>{lo.init(t,e);let r=[];for(let n of e.parts)if(n instanceof lo){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||d4e.has(typeof n))r.push(FN(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"template_literal",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:"template_literal",pattern:t._zod.pattern.source}),n)}),hVe=Te("$ZodPromise",(t,e)=>{lo.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),gVe=Te("$ZodLazy",(t,e)=>{lo.init(t,e),Bs(t._zod,"innerType",()=>e.getter()),Bs(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),Bs(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),Bs(t._zod,"optin",()=>t._zod.innerType._zod.optin),Bs(t._zod,"optout",()=>t._zod.innerType._zod.optout),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),yVe=Te("$ZodCustom",(t,e)=>{hc.init(t,e),lo.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>sMt(i,r,n,t));sMt(o,r,n,t)}})});function dMt(){return{localeError:Ign()}}var Ign,fMt=v(()=>{zn();Ign=()=>{let t={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return o=>{switch(o.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${Ut(o.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()} ${a.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${o.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${n[i.format]??o.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${o.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${o.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${o.keys.length>1?"\u0629":""}: ${Je(o.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}}});function pMt(){return{localeError:Agn()}}var Agn,mMt=v(()=>{zn();Agn=()=>{let t={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o.expected}, daxil olan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${Ut(o.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()} ${a.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()} ${a.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${n[i.format]??o.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${o.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${o.keys.length>1?"lar":""}: ${Je(o.keys,", ")}`;case"invalid_key":return`${o.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${o.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}}});function hMt(t,e,r,n){let o=Math.abs(t),i=o%10,a=o%100;return a>=11&&a<=19?n:i===1?e:i>=2&&i<=4?r:n}function gMt(){return{localeError:Ngn()}}var Ngn,yMt=v(()=>{zn();Ngn=()=>{let t={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0456\u045E";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${Ut(o.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);if(a){let s=Number(o.maximum),u=hMt(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${i}${o.maximum.toString()} ${u}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);if(a){let s=Number(o.minimum),u=hMt(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${i}${o.minimum.toString()} ${u}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${o.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${Je(o.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${o.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}}});function bMt(){return{localeError:Dgn()}}var Dgn,_Mt=v(()=>{zn();Dgn=()=>{let t={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${o.expected}, s'ha rebut ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Valor inv\xE0lid: s'esperava ${Ut(o.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${Je(o.values," o ")}`;case"too_big":{let i=o.inclusive?"com a m\xE0xim":"menys de",a=e(o.origin);return a?`Massa gran: s'esperava que ${o.origin??"el valor"} contingu\xE9s ${i} ${o.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${o.origin??"el valor"} fos ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"com a m\xEDnim":"m\xE9s de",a=e(o.origin);return a?`Massa petit: s'esperava que ${o.origin} contingu\xE9s ${i} ${o.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${o.origin} fos ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${n[i.format]??o.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${o.divisor}`;case"unrecognized_keys":return`Clau${o.keys.length>1?"s":""} no reconeguda${o.keys.length>1?"s":""}: ${Je(o.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${o.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${o.origin}`;default:return"Entrada inv\xE0lida"}}}});function vMt(){return{localeError:jgn()}}var jgn,wMt=v(()=>{zn();jgn=()=>{let t={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(o))return"pole";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return o=>{switch(o.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o.expected}, obdr\u017Eeno ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${Ut(o.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.maximum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.minimum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${n[i.format]??o.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${o.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${Je(o.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${o.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${o.origin}`;default:return"Neplatn\xFD vstup"}}}});function SMt(){return{localeError:$gn()}}var $gn,CMt=v(()=>{zn();$gn=()=>{let t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"Zahl";case"object":{if(Array.isArray(o))return"Array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return o=>{switch(o.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${o.expected}, erhalten ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ung\xFCltige Eingabe: erwartet ${Ut(o.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ist`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ist`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${o.divisor} sein`;case"unrecognized_keys":return`${o.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${Je(o.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${o.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${o.origin}`;default:return"Ung\xFCltige Eingabe"}}}});function phe(){return{localeError:Fgn()}}var Lgn,Fgn,bVe=v(()=>{zn();Lgn=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},Fgn=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${Lgn(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${Ut(n.values[0])}`:`Invalid option: expected one of ${Je(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Je(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}}});function xMt(){return{localeError:qgn()}}var kgn,qgn,TMt=v(()=>{zn();kgn=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"nombro";case"object":{if(Array.isArray(t))return"tabelo";if(t===null)return"senvalora";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},qgn=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(n){return t[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return n=>{switch(n.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${n.expected}, ricevi\u011Dis ${kgn(n.input)}`;case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${Ut(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${Je(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()} ${i.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${o}${n.minimum.toString()} ${i.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${r[o.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${Je(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}}});function OMt(){return{localeError:Bgn()}}var Bgn,EMt=v(()=>{zn();Bgn=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(o))return"arreglo";if(o===null)return"nulo";if(Object.getPrototypeOf(o)!==Object.prototype)return o.constructor.name}}return i},n={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${o.expected}, recibido ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: se esperaba ${Ut(o.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Demasiado grande: se esperaba que ${o.origin??"valor"} tuviera ${i}${o.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${o.origin??"valor"} fuera ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Demasiado peque\xF1o: se esperaba que ${o.origin} tuviera ${i}${o.minimum.toString()} ${a.unit}`:`Demasiado peque\xF1o: se esperaba que ${o.origin} fuera ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${i.prefix}"`:i.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${i.suffix}"`:i.format==="includes"?`Cadena inv\xE1lida: debe incluir "${i.includes}"`:i.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${i.pattern}`:`Inv\xE1lido ${n[i.format]??o.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${o.divisor}`;case"unrecognized_keys":return`Llave${o.keys.length>1?"s":""} desconocida${o.keys.length>1?"s":""}: ${Je(o.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${o.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${o.origin}`;default:return"Entrada inv\xE1lida"}}}});function PMt(){return{localeError:Ugn()}}var Ugn,MMt=v(()=>{zn();Ugn=()=>{let t={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0622\u0631\u0627\u06CC\u0647";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return o=>{switch(o.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${r(o.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":return o.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${Ut(o.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${Je(o.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${a.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${n[i.format]??o.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${o.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${o.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${Je(o.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${o.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${o.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}}});function RMt(){return{localeError:zgn()}}var zgn,IMt=v(()=>{zn();zgn=()=>{let t={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return o=>{switch(o.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${o.expected}, oli ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${Ut(o.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Liian suuri: ${a.subject} t\xE4ytyy olla ${i}${o.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Liian pieni: ${a.subject} t\xE4ytyy olla ${i}${o.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${n[i.format]??o.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${o.divisor} monikerta`;case"unrecognized_keys":return`${o.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${Je(o.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}}});function AMt(){return{localeError:Vgn()}}var Vgn,NMt=v(()=>{zn();Vgn=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombre";case"object":{if(Array.isArray(o))return"tableau";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : ${o.expected} attendu, ${r(o.input)} re\xE7u`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : ${Ut(o.values[0])} attendu`:`Option invalide : une valeur parmi ${Je(o.values,"|")} attendue`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Trop grand : ${o.origin??"valeur"} doit ${a.verb} ${i}${o.maximum.toString()} ${a.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o.origin??"valeur"} doit \xEAtre ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Trop petit : ${o.origin} doit ${a.verb} ${i}${o.minimum.toString()} ${a.unit}`:`Trop petit : ${o.origin} doit \xEAtre ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${Je(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}}});function DMt(){return{localeError:Hgn()}}var Hgn,jMt=v(()=>{zn();Hgn=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${o.expected}, re\xE7u ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : attendu ${Ut(o.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u2264":"<",a=e(o.origin);return a?`Trop grand : attendu que ${o.origin??"la valeur"} ait ${i}${o.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${o.origin??"la valeur"} soit ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u2265":">",a=e(o.origin);return a?`Trop petit : attendu que ${o.origin} ait ${i}${o.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${o.origin} soit ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${Je(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}}});function $Mt(){return{localeError:Wgn()}}var Wgn,LMt=v(()=>{zn();Wgn=()=>{let t={string:{unit:"\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u05E7\u05DC\u05D8",email:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",url:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",emoji:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",date:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",time:"\u05D6\u05DE\u05DF ISO",duration:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",ipv4:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",ipv6:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",cidrv4:"\u05D8\u05D5\u05D5\u05D7 IPv4",cidrv6:"\u05D8\u05D5\u05D5\u05D7 IPv6",base64:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",base64url:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",json_string:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",e164:"\u05DE\u05E1\u05E4\u05E8 E.164",jwt:"JWT",template_literal:"\u05E7\u05DC\u05D8"};return o=>{switch(o.code){case"invalid_type":return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${o.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${Ut(o.values[0])}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05D0\u05D7\u05EA \u05DE\u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA  ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${o.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${o.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${o.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${i}${o.minimum.toString()} ${a.unit}`:`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${o.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1"${i.prefix}"`:i.format==="ends_with"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${i.suffix}"`:i.format==="includes"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${i.includes}"`:i.format==="regex"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${i.pattern}`:`${n[i.format]??o.format} \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${o.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${o.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${o.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${Je(o.keys,", ")}`;case"invalid_key":return`\u05DE\u05E4\u05EA\u05D7 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${o.origin}`;case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${o.origin}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}}});function FMt(){return{localeError:Jgn()}}var Jgn,kMt=v(()=>{zn();Jgn=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(o))return"t\xF6mb";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return o=>{switch(o.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o.expected}, a kapott \xE9rt\xE9k ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${Ut(o.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`T\xFAl nagy: ${o.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${o.maximum.toString()} ${a.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${o.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} m\xE9rete t\xFAl kicsi ${i}${o.minimum.toString()} ${a.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} t\xFAl kicsi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${n[i.format]??o.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${o.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${o.keys.length>1?"s":""}: ${Je(o.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${o.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${o.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}}});function qMt(){return{localeError:Kgn()}}var Kgn,BMt=v(()=>{zn();Kgn=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak valid: diharapkan ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak valid: diharapkan ${Ut(o.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Terlalu besar: diharapkan ${o.origin??"value"} memiliki ${i}${o.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${o.origin??"value"} menjadi ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Terlalu kecil: diharapkan ${o.origin} memiliki ${i}${o.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${o.origin} menjadi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${n[i.format]??o.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${o.keys.length>1?"s":""}: ${Je(o.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${o.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${o.origin}`;default:return"Input tidak valid"}}}});function UMt(){return{localeError:Ggn()}}var Ggn,zMt=v(()=>{zn();Ggn=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numero";case"object":{if(Array.isArray(o))return"vettore";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input non valido: atteso ${o.expected}, ricevuto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input non valido: atteso ${Ut(o.values[0])}`:`Opzione non valida: atteso uno tra ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Troppo grande: ${o.origin??"valore"} deve avere ${i}${o.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${o.origin??"valore"} deve essere ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Troppo piccolo: ${o.origin} deve avere ${i}${o.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${o.origin} deve essere ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${o.divisor}`;case"unrecognized_keys":return`Chiav${o.keys.length>1?"i":"e"} non riconosciut${o.keys.length>1?"e":"a"}: ${Je(o.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${o.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${o.origin}`;default:return"Input non valido"}}}});function VMt(){return{localeError:Xgn()}}var Xgn,HMt=v(()=>{zn();Xgn=()=>{let t={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(o))return"\u914D\u5217";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${o.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${r(o.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":return o.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${Ut(o.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${Je(o.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=o.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",a=e(o.origin);return a?`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${a.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=o.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",a=e(o.origin);return a?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${a.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${o.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${o.keys.length>1?"\u7FA4":""}: ${Je(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}}});function WMt(){return{localeError:Zgn()}}var Zgn,JMt=v(()=>{zn();Zgn=()=>{let t={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(o))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(o===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return o=>{switch(o.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${Ut(o.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()} ${a.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()} ${a.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${o.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${Je(o.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}}});function KMt(){return{localeError:Ygn()}}var Ygn,GMt=v(()=>{zn();Ygn=()=>{let t={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return o=>{switch(o.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${r(o.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":return o.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${Ut(o.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${Je(o.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=o.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",a=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=e(o.origin),u=s?.unit??"\uC694\uC18C";return s?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()}${u} ${i}${a}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()} ${i}${a}`}case"too_small":{let i=o.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",a=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=e(o.origin),u=s?.unit??"\uC694\uC18C";return s?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()}${u} ${i}${a}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()} ${i}${a}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${n[i.format]??o.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${o.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${Je(o.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${o.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${o.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}}});function XMt(){return{localeError:Qgn()}}var Qgn,ZMt=v(()=>{zn();Qgn=()=>{let t={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(o))return"\u043D\u0438\u0437\u0430";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return o=>{switch(o.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${Ut(o.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.minimum.toString()} ${a.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${Je(o.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${o.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${o.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}}});function YMt(){return{localeError:eyn()}}var eyn,QMt=v(()=>{zn();eyn=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombor";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak sah: dijangka ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak sah: dijangka ${Ut(o.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Terlalu besar: dijangka ${o.origin??"nilai"} ${a.verb} ${i}${o.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${o.origin??"nilai"} adalah ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Terlalu kecil: dijangka ${o.origin} ${a.verb} ${i}${o.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${o.origin} adalah ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${n[i.format]??o.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${Je(o.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${o.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${o.origin}`;default:return"Input tidak sah"}}}});function eRt(){return{localeError:tyn()}}var tyn,tRt=v(()=>{zn();tyn=()=>{let t={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"getal";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return o=>{switch(o.code){case"invalid_type":return`Ongeldige invoer: verwacht ${o.expected}, ontving ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ongeldige invoer: verwacht ${Ut(o.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Te lang: verwacht dat ${o.origin??"waarde"} ${i}${o.maximum.toString()} ${a.unit??"elementen"} bevat`:`Te lang: verwacht dat ${o.origin??"waarde"} ${i}${o.maximum.toString()} is`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Te kort: verwacht dat ${o.origin} ${i}${o.minimum.toString()} ${a.unit} bevat`:`Te kort: verwacht dat ${o.origin} ${i}${o.minimum.toString()} is`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${o.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${o.keys.length>1?"s":""}: ${Je(o.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${o.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${o.origin}`;default:return"Ongeldige invoer"}}}});function rRt(){return{localeError:ryn()}}var ryn,nRt=v(()=>{zn();ryn=()=>{let t={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"tall";case"object":{if(Array.isArray(o))return"liste";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Ugyldig input: forventet ${o.expected}, fikk ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ugyldig verdi: forventet ${Ut(o.values[0])}`:`Ugyldig valg: forventet en av ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${n[i.format]??o.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${Je(o.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${o.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${o.origin}`;default:return"Ugyldig input"}}}});function oRt(){return{localeError:nyn()}}var nyn,iRt=v(()=>{zn();nyn=()=>{let t={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numara";case"object":{if(Array.isArray(o))return"saf";if(o===null)return"gayb";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return o=>{switch(o.code){case"invalid_type":return`F\xE2sit giren: umulan ${o.expected}, al\u0131nan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`F\xE2sit giren: umulan ${Ut(o.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} ${a.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} ${a.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=o;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${n[i.format]??o.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${o.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${o.keys.length>1?"s":""}: ${Je(o.keys,", ")}`;case"invalid_key":return`${o.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${o.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}}});function aRt(){return{localeError:oyn()}}var oyn,sRt=v(()=>{zn();oyn=()=>{let t={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0627\u0631\u06D0";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return o=>{switch(o.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${r(o.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":return o.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${Ut(o.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${Je(o.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0648\u064A`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${a.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${n[i.format]??o.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${o.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${o.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${Je(o.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${o.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${o.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}}});function uRt(){return{localeError:iyn()}}var iyn,lRt=v(()=>{zn();iyn=()=>{let t={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"liczba";case"object":{if(Array.isArray(o))return"tablica";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return o=>{switch(o.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o.expected}, otrzymano ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${Ut(o.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.maximum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.minimum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${n[i.format]??o.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${o.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${o.keys.length>1?"s":""}: ${Je(o.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${o.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${o.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}}});function cRt(){return{localeError:ayn()}}var ayn,dRt=v(()=>{zn();ayn=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(o))return"array";if(o===null)return"nulo";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${o.expected}, recebido ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: esperado ${Ut(o.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Muito grande: esperado que ${o.origin??"valor"} tivesse ${i}${o.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${o.origin??"valor"} fosse ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Muito pequeno: esperado que ${o.origin} tivesse ${i}${o.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${o.origin} fosse ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`:i.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inv\xE1lido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`:`${n[i.format]??o.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${o.divisor}`;case"unrecognized_keys":return`Chave${o.keys.length>1?"s":""} desconhecida${o.keys.length>1?"s":""}: ${Je(o.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${o.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${o.origin}`;default:return"Campo inv\xE1lido"}}}});function fRt(t,e,r,n){let o=Math.abs(t),i=o%10,a=o%100;return a>=11&&a<=19?n:i===1?e:i>=2&&i<=4?r:n}function pRt(){return{localeError:syn()}}var syn,mRt=v(()=>{zn();syn=()=>{let t={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${Ut(o.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);if(a){let s=Number(o.maximum),u=fRt(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.maximum.toString()} ${u}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);if(a){let s=Number(o.minimum),u=fRt(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.minimum.toString()} ${u}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${o.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0438":""}: ${Je(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${o.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}}});function hRt(){return{localeError:uyn()}}var uyn,gRt=v(()=>{zn();uyn=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(o))return"tabela";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return o=>{switch(o.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${o.expected}, prejeto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${Ut(o.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} imelo ${i}${o.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Premajhno: pri\u010Dakovano, da bo ${o.origin} imelo ${i}${o.minimum.toString()} ${a.unit}`:`Premajhno: pri\u010Dakovano, da bo ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${n[i.format]??o.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${o.divisor}`;case"unrecognized_keys":return`Neprepoznan${o.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${Je(o.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${o.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${o.origin}`;default:return"Neveljaven vnos"}}}});function yRt(){return{localeError:lyn()}}var lyn,bRt=v(()=>{zn();lyn=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"antal";case"object":{if(Array.isArray(o))return"lista";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return o=>{switch(o.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${o.expected}, fick ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${Ut(o.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`F\xF6r stor(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()} ${a.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()} ${a.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${n[i.format]??o.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${Je(o.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${o.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${o.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}}});function _Rt(){return{localeError:cyn()}}var cyn,vRt=v(()=>{zn();cyn=()=>{let t={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(o))return"\u0B85\u0BA3\u0BBF";if(o===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${Ut(o.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${Je(o.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} ${a.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} ${a.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${o.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${o.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${Je(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}}});function wRt(){return{localeError:dyn()}}var dyn,SRt=v(()=>{zn();dyn=()=>{let t={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(o))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(o===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return o=>{switch(o.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${Ut(o.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",a=e(o.origin);return a?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()} ${a.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",a=e(o.origin);return a?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()} ${a.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${o.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${Je(o.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}}});function CRt(){return{localeError:pyn()}}var fyn,pyn,xRt=v(()=>{zn();fyn=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},pyn=()=>{let t={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(n){return t[n]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return n=>{switch(n.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${n.expected}, al\u0131nan ${fyn(n.input)}`;case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${Ut(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${Je(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()} ${i.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()} ${i.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[o.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${Je(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}}});function TRt(){return{localeError:myn()}}var myn,ORt=v(()=>{zn();myn=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${Ut(o.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${a.verb} ${i}${o.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} ${a.verb} ${i}${o.minimum.toString()} ${a.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} \u0431\u0443\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0456":""}: ${Je(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${o.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}}});function ERt(){return{localeError:hyn()}}var hyn,PRt=v(()=>{zn();hyn=()=>{let t={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(o))return"\u0622\u0631\u06D2";if(o===null)return"\u0646\u0644";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return o=>{switch(o.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${r(o.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":return o.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${Ut(o.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${Je(o.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${o.maximum.toString()} ${a.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${o.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u06D2 ${i}${o.minimum.toString()} ${a.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u0627 ${i}${o.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${o.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${o.keys.length>1?"\u0632":""}: ${Je(o.keys,"\u060C ")}`;case"invalid_key":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}}});function MRt(){return{localeError:gyn()}}var gyn,RRt=v(()=>{zn();gyn=()=>{let t={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(o))return"m\u1EA3ng";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return o=>{switch(o.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${Ut(o.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${a.verb} ${i}${o.maximum.toString()} ${a.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${a.verb} ${i}${o.minimum.toString()} ${a.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${n[i.format]??o.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${o.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${Je(o.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}}});function IRt(){return{localeError:yyn()}}var yyn,ARt=v(()=>{zn();yyn=()=>{let t={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(o))return"\u6570\u7EC4";if(o===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${Ut(o.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()} ${a.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()} ${a.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${n[i.format]??o.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${o.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${Je(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${o.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}}});function NRt(){return{localeError:byn()}}var byn,DRt=v(()=>{zn();byn=()=>{let t={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o.expected}\uFF0C\u4F46\u6536\u5230 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${Ut(o.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${Je(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()} ${a.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()} ${a.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${o.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${o.keys.length>1?"\u5011":""}\uFF1A${Je(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}}});var bee={};En(bee,{ar:()=>dMt,az:()=>pMt,be:()=>gMt,ca:()=>bMt,cs:()=>vMt,de:()=>SMt,en:()=>phe,eo:()=>xMt,es:()=>OMt,fa:()=>PMt,fi:()=>RMt,fr:()=>AMt,frCA:()=>DMt,he:()=>$Mt,hu:()=>FMt,id:()=>qMt,it:()=>UMt,ja:()=>VMt,kh:()=>WMt,ko:()=>KMt,mk:()=>XMt,ms:()=>YMt,nl:()=>eRt,no:()=>rRt,ota:()=>oRt,pl:()=>uRt,ps:()=>aRt,pt:()=>cRt,ru:()=>pRt,sl:()=>hRt,sv:()=>yRt,ta:()=>_Rt,th:()=>wRt,tr:()=>CRt,ua:()=>TRt,ur:()=>ERt,vi:()=>MRt,zhCN:()=>IRt,zhTW:()=>NRt});var _Ve=v(()=>{fMt();mMt();yMt();_Mt();wMt();CMt();bVe();TMt();EMt();MMt();IMt();NMt();jMt();LMt();kMt();BMt();zMt();HMt();JMt();GMt();ZMt();QMt();tRt();nRt();iRt();sRt();lRt();dRt();mRt();gRt();bRt();vRt();SRt();xRt();ORt();PRt();RRt();ARt();DRt()});function mhe(){return new nJ}var vVe,wVe,nJ,xh,SVe=v(()=>{vVe=Symbol("ZodOutput"),wVe=Symbol("ZodInput"),nJ=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};xh=mhe()});function CVe(t,e){return new t({type:"string",...vt(e)})}function xVe(t,e){return new t({type:"string",coerce:!0,...vt(e)})}function hhe(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...vt(e)})}function _ee(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...vt(e)})}function ghe(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...vt(e)})}function yhe(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...vt(e)})}function bhe(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...vt(e)})}function _he(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...vt(e)})}function vhe(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...vt(e)})}function whe(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...vt(e)})}function She(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...vt(e)})}function Che(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...vt(e)})}function xhe(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...vt(e)})}function The(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...vt(e)})}function Ohe(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...vt(e)})}function Ehe(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...vt(e)})}function Phe(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...vt(e)})}function Mhe(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...vt(e)})}function Rhe(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...vt(e)})}function Ihe(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...vt(e)})}function Ahe(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...vt(e)})}function Nhe(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...vt(e)})}function Dhe(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...vt(e)})}function jhe(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...vt(e)})}function OVe(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...vt(e)})}function EVe(t,e){return new t({type:"string",format:"date",check:"string_format",...vt(e)})}function PVe(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...vt(e)})}function MVe(t,e){return new t({type:"string",format:"duration",check:"string_format",...vt(e)})}function RVe(t,e){return new t({type:"number",checks:[],...vt(e)})}function IVe(t,e){return new t({type:"number",coerce:!0,checks:[],...vt(e)})}function AVe(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...vt(e)})}function NVe(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...vt(e)})}function DVe(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...vt(e)})}function jVe(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...vt(e)})}function $Ve(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...vt(e)})}function LVe(t,e){return new t({type:"boolean",...vt(e)})}function FVe(t,e){return new t({type:"boolean",coerce:!0,...vt(e)})}function kVe(t,e){return new t({type:"bigint",...vt(e)})}function qVe(t,e){return new t({type:"bigint",coerce:!0,...vt(e)})}function BVe(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...vt(e)})}function UVe(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...vt(e)})}function zVe(t,e){return new t({type:"symbol",...vt(e)})}function VVe(t,e){return new t({type:"undefined",...vt(e)})}function HVe(t,e){return new t({type:"null",...vt(e)})}function WVe(t){return new t({type:"any"})}function Bz(t){return new t({type:"unknown"})}function vee(t,e){return new t({type:"never",...vt(e)})}function JVe(t,e){return new t({type:"void",...vt(e)})}function KVe(t,e){return new t({type:"date",...vt(e)})}function GVe(t,e){return new t({type:"date",coerce:!0,...vt(e)})}function XVe(t,e){return new t({type:"nan",...vt(e)})}function kN(t,e){return new ohe({check:"less_than",...vt(e),value:t,inclusive:!1})}function bS(t,e){return new ohe({check:"less_than",...vt(e),value:t,inclusive:!0})}function qN(t,e){return new ihe({check:"greater_than",...vt(e),value:t,inclusive:!1})}function E_(t,e){return new ihe({check:"greater_than",...vt(e),value:t,inclusive:!0})}function ZVe(t){return qN(0,t)}function YVe(t){return kN(0,t)}function QVe(t){return bS(0,t)}function eHe(t){return E_(0,t)}function Uz(t,e){return new X4e({check:"multiple_of",...vt(e),value:t})}function oJ(t,e){return new Q4e({check:"max_size",...vt(e),maximum:t})}function zz(t,e){return new e2e({check:"min_size",...vt(e),minimum:t})}function wee(t,e){return new t2e({check:"size_equals",...vt(e),size:t})}function iJ(t,e){return new r2e({check:"max_length",...vt(e),maximum:t})}function VL(t,e){return new n2e({check:"min_length",...vt(e),minimum:t})}function aJ(t,e){return new o2e({check:"length_equals",...vt(e),length:t})}function See(t,e){return new i2e({check:"string_format",format:"regex",...vt(e),pattern:t})}function Cee(t){return new a2e({check:"string_format",format:"lowercase",...vt(t)})}function xee(t){return new s2e({check:"string_format",format:"uppercase",...vt(t)})}function Tee(t,e){return new u2e({check:"string_format",format:"includes",...vt(e),includes:t})}function Oee(t,e){return new l2e({check:"string_format",format:"starts_with",...vt(e),prefix:t})}function Eee(t,e){return new c2e({check:"string_format",format:"ends_with",...vt(e),suffix:t})}function tHe(t,e,r){return new d2e({check:"property",property:t,schema:e,...vt(r)})}function Pee(t,e){return new f2e({check:"mime_type",mime:t,...vt(e)})}function BN(t){return new p2e({check:"overwrite",tx:t})}function Mee(t){return BN(e=>e.normalize(t))}function Ree(){return BN(t=>t.trim())}function Iee(){return BN(t=>t.toLowerCase())}function Aee(){return BN(t=>t.toUpperCase())}function Nee(t,e,r){return new t({type:"array",element:e,...vt(r)})}function _yn(t,e,r){return new t({type:"union",options:e,...vt(r)})}function vyn(t,e,r,n){return new t({type:"union",options:r,discriminator:e,...vt(n)})}function wyn(t,e,r){return new t({type:"intersection",left:e,right:r})}function rHe(t,e,r,n){let o=r instanceof lo,i=o?n:r,a=o?r:null;return new t({type:"tuple",items:e,rest:a,...vt(i)})}function Syn(t,e,r,n){return new t({type:"record",keyType:e,valueType:r,...vt(n)})}function Cyn(t,e,r,n){return new t({type:"map",keyType:e,valueType:r,...vt(n)})}function xyn(t,e,r){return new t({type:"set",valueType:e,...vt(r)})}function Tyn(t,e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new t({type:"enum",entries:n,...vt(r)})}function Oyn(t,e,r){return new t({type:"enum",entries:e,...vt(r)})}function Eyn(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...vt(r)})}function nHe(t,e){return new t({type:"file",...vt(e)})}function Pyn(t,e){return new t({type:"transform",transform:e})}function Myn(t,e){return new t({type:"optional",innerType:e})}function Ryn(t,e){return new t({type:"nullable",innerType:e})}function Iyn(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():r}})}function Ayn(t,e,r){return new t({type:"nonoptional",innerType:e,...vt(r)})}function Nyn(t,e){return new t({type:"success",innerType:e})}function Dyn(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function jyn(t,e,r){return new t({type:"pipe",in:e,out:r})}function $yn(t,e){return new t({type:"readonly",innerType:e})}function Lyn(t,e,r){return new t({type:"template_literal",parts:e,...vt(r)})}function Fyn(t,e){return new t({type:"lazy",getter:e})}function kyn(t,e){return new t({type:"promise",innerType:e})}function oHe(t,e,r){let n=vt(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function iHe(t,e,r){return new t({type:"custom",check:"custom",fn:e,...vt(r)})}function aHe(t,e){let r=vt(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),a=new Set(o),s=t.Pipe??gee,u=t.Boolean??fee,l=t.String??Fz,c=t.Transform??hee,d=new c({type:"transform",transform:(m,h)=>{let y=m;return r.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:a.has(y)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:h.value,inst:d}),{})},error:r.error}),f=new s({type:"pipe",in:new l({type:"string",error:r.error}),out:d,error:r.error});return new s({type:"pipe",in:f,out:new u({type:"boolean",error:r.error}),error:r.error})}function sHe(t,e,r,n={}){let o=vt(n),i={...vt(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}var TVe,uHe=v(()=>{ahe();yee();zn();TVe={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function lHe(t){return new $he({type:"function",input:Array.isArray(t?.input)?rHe(qz,t?.input):t?.input??Nee(mee,Bz(kz)),output:t?.output??Bz(kz)})}var $he,jRt=v(()=>{uHe();the();yee();yee();$he=class{constructor(e){this._def=e,this.def=e}implement(e){if(typeof e!="function")throw new Error("implement() must be called with a function");let r=(...n)=>{let o=this._def.input?Dz(this._def.input,n,void 0,{callee:r}):n;if(!Array.isArray(o))throw new Error("Invalid arguments schema: not an array or tuple schema.");let i=e(...o);return this._def.output?Dz(this._def.output,i,void 0,{callee:r}):i};return r}implementAsync(e){if(typeof e!="function")throw new Error("implement() must be called with a function");let r=async(...n)=>{let o=this._def.input?await jz(this._def.input,n,void 0,{callee:r}):n;if(!Array.isArray(o))throw new Error("Invalid arguments schema: not an array or tuple schema.");let i=await e(...o);return this._def.output?jz(this._def.output,i,void 0,{callee:r}):i};return r}input(...e){let r=this.constructor;return Array.isArray(e[0])?new r({type:"function",input:new qz({type:"tuple",items:e[0],rest:e[1]}),output:this._def.output}):new r({type:"function",input:e[0],output:this._def.output})}output(e){let r=this.constructor;return new r({type:"function",input:this._def.input,output:e})}}});function HL(t,e){if(t instanceof nJ){let n=new Dee(e),o={};for(let s of t._idmap.entries()){let[u,l]=s;n.process(l)}let i={},a={registry:t,uri:e?.uri,defs:o};for(let s of t._idmap.entries()){let[u,l]=s;i[u]=n.emit(l,{...e,external:a})}if(Object.keys(o).length>0){let s=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[s]:o}}return{schemas:i}}let r=new Dee(e);return r.process(t),r.emit(t,e)}function Tm(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Tm(o.element,r);case"object":{for(let i in o.shape)if(Tm(o.shape[i],r))return!0;return!1}case"union":{for(let i of o.options)if(Tm(i,r))return!0;return!1}case"intersection":return Tm(o.left,r)||Tm(o.right,r);case"tuple":{for(let i of o.items)if(Tm(i,r))return!0;return!!(o.rest&&Tm(o.rest,r))}case"record":return Tm(o.keyType,r)||Tm(o.valueType,r);case"map":return Tm(o.keyType,r)||Tm(o.valueType,r);case"set":return Tm(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Tm(o.innerType,r);case"lazy":return Tm(o.getter(),r);case"default":return Tm(o.innerType,r);case"prefault":return Tm(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Tm(o.in,r)||Tm(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var Dee,$Rt=v(()=>{SVe();zn();Dee=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??xh,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},a=this.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,s);let u=e._zod.toJSONSchema?.();if(u)s.schema=u;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},f=e._zod.parent;if(f)s.ref=f,this.process(f,d),this.seen.get(f).isParent=!0;else{let p=s.schema;switch(o.type){case"string":{let m=p;m.type="string";let{minimum:h,maximum:y,format:g,patterns:b,contentEncoding:_}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof y=="number"&&(m.maxLength=y),g&&(m.format=i[g]??g,m.format===""&&delete m.format),_&&(m.contentEncoding=_),b&&b.size>0){let w=[...b];w.length===1?m.pattern=w[0].source:w.length>1&&(s.schema.allOf=[...w.map(T=>({...this.target==="draft-7"?{type:"string"}:{},pattern:T.source}))])}break}case"number":{let m=p,{minimum:h,maximum:y,format:g,multipleOf:b,exclusiveMaximum:_,exclusiveMinimum:w}=e._zod.bag;typeof g=="string"&&g.includes("int")?m.type="integer":m.type="number",typeof w=="number"&&(m.exclusiveMinimum=w),typeof h=="number"&&(m.minimum=h,typeof w=="number"&&(w>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof _=="number"&&(m.exclusiveMaximum=_),typeof y=="number"&&(m.maximum=y,typeof _=="number"&&(_<=y?delete m.maximum:delete m.exclusiveMaximum)),typeof b=="number"&&(m.multipleOf=b);break}case"boolean":{let m=p;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{p.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{p.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let m=p,{minimum:h,maximum:y}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof y=="number"&&(m.maxItems=y),m.type="array",m.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let m=p;m.type="object",m.properties={};let h=o.shape;for(let b in h)m.properties[b]=this.process(h[b],{...d,path:[...d.path,"properties",b]});let y=new Set(Object.keys(h)),g=new Set([...y].filter(b=>{let _=o.shape[b]._zod;return this.io==="input"?_.optin===void 0:_.optout===void 0}));g.size>0&&(m.required=Array.from(g)),o.catchall?._zod.def.type==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{let m=p;m.anyOf=o.options.map((h,y)=>this.process(h,{...d,path:[...d.path,"anyOf",y]}));break}case"intersection":{let m=p,h=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),y=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),g=_=>"allOf"in _&&Object.keys(_).length===1,b=[...g(h)?h.allOf:[h],...g(y)?y.allOf:[y]];m.allOf=b;break}case"tuple":{let m=p;m.type="array";let h=o.items.map((b,_)=>this.process(b,{...d,path:[...d.path,"prefixItems",_]}));if(this.target==="draft-2020-12"?m.prefixItems=h:m.items=h,o.rest){let b=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?m.items=b:m.additionalItems=b}o.rest&&(m.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:y,maximum:g}=e._zod.bag;typeof y=="number"&&(m.minItems=y),typeof g=="number"&&(m.maxItems=g);break}case"record":{let m=p;m.type="object",m.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),m.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=p,h=ree(o.entries);h.every(y=>typeof y=="number")&&(m.type="number"),h.every(y=>typeof y=="string")&&(m.type="string"),m.enum=h;break}case"literal":{let m=p,h=[];for(let y of o.values)if(y===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof y=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(y))}else h.push(y);if(h.length!==0)if(h.length===1){let y=h[0];m.type=y===null?"null":typeof y,m.const=y}else h.every(y=>typeof y=="number")&&(m.type="number"),h.every(y=>typeof y=="string")&&(m.type="string"),h.every(y=>typeof y=="boolean")&&(m.type="string"),h.every(y=>y===null)&&(m.type="null"),m.enum=h;break}case"file":{let m=p,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:y,maximum:g,mime:b}=e._zod.bag;y!==void 0&&(h.minLength=y),g!==void 0&&(h.maxLength=g),b?b.length===1?(h.contentMediaType=b[0],Object.assign(m,h)):m.anyOf=b.map(_=>({...h,contentMediaType:_})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,d);p.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"success":{let m=p;m.type="boolean";break}case"default":{this.process(o.innerType,d),s.ref=o.innerType,p.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),s.ref=o.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),s.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}p.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=p,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,d),s.ref=m;break}case"readonly":{this.process(o.innerType,d),s.ref=o.innerType,p.readOnly=!0;break}case"promise":{this.process(o.innerType,d),s.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,d),s.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let l=this.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),this.io==="input"&&Tm(e)&&(delete s.schema.examples,delete s.schema.default),this.io==="input"&&s.schema._prefault&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=c=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let h=n.external.registry.get(c[0])?.id,y=n.external.uri??(b=>b);if(h)return{ref:y(h)};let g=c[1].defId??c[1].schema.id??`schema${this.counter++}`;return c[1].defId=g,{defId:g,ref:`${y("__shared")}#/${d}/${g}`}}if(c[1]===o)return{ref:"#"};let p=`#/${d}/`,m=c[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:p+m}},a=c=>{if(c[1].schema.$ref)return;let d=c[1],{ref:f,defId:p}=i(c);d.def={...d.schema},p&&(d.defId=p);let m=d.schema;for(let h in m)delete m[h];m.$ref=f};if(n.cycles==="throw")for(let c of this.seen.entries()){let d=c[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>

Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of this.seen.entries()){let d=c[1];if(e===c[0]){a(c);continue}if(n.external){let p=n.external.registry.get(c[0])?.id;if(e!==c[0]&&p){a(c);continue}}if(this.metadataRegistry.get(c[0])?.id){a(c);continue}if(d.cycle){a(c);continue}if(d.count>1&&n.reused==="ref"){a(c);continue}}let s=(c,d)=>{let f=this.seen.get(c),p=f.def??f.schema,m={...p};if(f.ref===null)return;let h=f.ref;if(f.ref=null,h){s(h,d);let y=this.seen.get(h).schema;y.$ref&&d.target==="draft-7"?(p.allOf=p.allOf??[],p.allOf.push(y)):(Object.assign(p,y),Object.assign(p,m))}f.isParent||this.override({zodSchema:c,jsonSchema:p,path:f.path??[]})};for(let c of[...this.seen.entries()].reverse())s(c[0],{target:this.target});let u={};if(this.target==="draft-2020-12"?u.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?u.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let c=n.external.registry.get(e)?.id;if(!c)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(c)}Object.assign(u,o.def);let l=n.external?.defs??{};for(let c of this.seen.entries()){let d=c[1];d.def&&d.defId&&(l[d.defId]=d.def)}n.external||Object.keys(l).length>0&&(this.target==="draft-2020-12"?u.$defs=l:u.definitions=l);try{return JSON.parse(JSON.stringify(u))}catch{throw new Error("Error converting schema to JSON.")}}}});var LRt={};var FRt=v(()=>{});var UN={};En(UN,{$ZodAny:()=>K2e,$ZodArray:()=>mee,$ZodAsyncError:()=>YT,$ZodBase64:()=>F2e,$ZodBase64URL:()=>k2e,$ZodBigInt:()=>che,$ZodBigIntFormat:()=>V2e,$ZodBoolean:()=>fee,$ZodCIDRv4:()=>j2e,$ZodCIDRv6:()=>$2e,$ZodCUID:()=>x2e,$ZodCUID2:()=>T2e,$ZodCatch:()=>dVe,$ZodCheck:()=>hc,$ZodCheckBigIntFormat:()=>Y4e,$ZodCheckEndsWith:()=>c2e,$ZodCheckGreaterThan:()=>ihe,$ZodCheckIncludes:()=>u2e,$ZodCheckLengthEquals:()=>o2e,$ZodCheckLessThan:()=>ohe,$ZodCheckLowerCase:()=>a2e,$ZodCheckMaxLength:()=>r2e,$ZodCheckMaxSize:()=>Q4e,$ZodCheckMimeType:()=>f2e,$ZodCheckMinLength:()=>n2e,$ZodCheckMinSize:()=>e2e,$ZodCheckMultipleOf:()=>X4e,$ZodCheckNumberFormat:()=>Z4e,$ZodCheckOverwrite:()=>p2e,$ZodCheckProperty:()=>d2e,$ZodCheckRegex:()=>i2e,$ZodCheckSizeEquals:()=>t2e,$ZodCheckStartsWith:()=>l2e,$ZodCheckStringFormat:()=>rJ,$ZodCheckUpperCase:()=>s2e,$ZodCustom:()=>yVe,$ZodCustomStringFormat:()=>U2e,$ZodDate:()=>X2e,$ZodDefault:()=>sVe,$ZodDiscriminatedUnion:()=>Y2e,$ZodE164:()=>q2e,$ZodEmail:()=>v2e,$ZodEmoji:()=>S2e,$ZodEnum:()=>nVe,$ZodError:()=>uee,$ZodFile:()=>iVe,$ZodFunction:()=>$he,$ZodGUID:()=>b2e,$ZodIPv4:()=>N2e,$ZodIPv6:()=>D2e,$ZodISODate:()=>R2e,$ZodISODateTime:()=>M2e,$ZodISODuration:()=>A2e,$ZodISOTime:()=>I2e,$ZodIntersection:()=>Q2e,$ZodJWT:()=>B2e,$ZodKSUID:()=>P2e,$ZodLazy:()=>gVe,$ZodLiteral:()=>oVe,$ZodMap:()=>tVe,$ZodNaN:()=>fVe,$ZodNanoID:()=>C2e,$ZodNever:()=>pee,$ZodNonOptional:()=>lVe,$ZodNull:()=>J2e,$ZodNullable:()=>aVe,$ZodNumber:()=>lhe,$ZodNumberFormat:()=>z2e,$ZodObject:()=>Z2e,$ZodOptional:()=>fhe,$ZodPipe:()=>gee,$ZodPrefault:()=>uVe,$ZodPromise:()=>hVe,$ZodReadonly:()=>pVe,$ZodRealError:()=>tJ,$ZodRecord:()=>eVe,$ZodRegistry:()=>nJ,$ZodSet:()=>rVe,$ZodString:()=>Fz,$ZodStringFormat:()=>Nu,$ZodSuccess:()=>cVe,$ZodSymbol:()=>H2e,$ZodTemplateLiteral:()=>mVe,$ZodTransform:()=>hee,$ZodTuple:()=>qz,$ZodType:()=>lo,$ZodULID:()=>O2e,$ZodURL:()=>w2e,$ZodUUID:()=>_2e,$ZodUndefined:()=>W2e,$ZodUnion:()=>dhe,$ZodUnknown:()=>kz,$ZodVoid:()=>G2e,$ZodXID:()=>E2e,$brand:()=>o4e,$constructor:()=>Te,$input:()=>wVe,$output:()=>vVe,Doc:()=>dee,JSONSchema:()=>LRt,JSONSchemaGenerator:()=>Dee,NEVER:()=>n4e,TimePrecision:()=>TVe,_any:()=>WVe,_array:()=>Nee,_base64:()=>Ahe,_base64url:()=>Nhe,_bigint:()=>kVe,_boolean:()=>LVe,_catch:()=>Dyn,_cidrv4:()=>Rhe,_cidrv6:()=>Ihe,_coercedBigint:()=>qVe,_coercedBoolean:()=>FVe,_coercedDate:()=>GVe,_coercedNumber:()=>IVe,_coercedString:()=>xVe,_cuid:()=>Che,_cuid2:()=>xhe,_custom:()=>oHe,_date:()=>KVe,_default:()=>Iyn,_discriminatedUnion:()=>vyn,_e164:()=>Dhe,_email:()=>hhe,_emoji:()=>whe,_endsWith:()=>Eee,_enum:()=>Tyn,_file:()=>nHe,_float32:()=>NVe,_float64:()=>DVe,_gt:()=>qN,_gte:()=>E_,_guid:()=>_ee,_includes:()=>Tee,_int:()=>AVe,_int32:()=>jVe,_int64:()=>BVe,_intersection:()=>wyn,_ipv4:()=>Phe,_ipv6:()=>Mhe,_isoDate:()=>EVe,_isoDateTime:()=>OVe,_isoDuration:()=>MVe,_isoTime:()=>PVe,_jwt:()=>jhe,_ksuid:()=>Ehe,_lazy:()=>Fyn,_length:()=>aJ,_literal:()=>Eyn,_lowercase:()=>Cee,_lt:()=>kN,_lte:()=>bS,_map:()=>Cyn,_max:()=>bS,_maxLength:()=>iJ,_maxSize:()=>oJ,_mime:()=>Pee,_min:()=>E_,_minLength:()=>VL,_minSize:()=>zz,_multipleOf:()=>Uz,_nan:()=>XVe,_nanoid:()=>She,_nativeEnum:()=>Oyn,_negative:()=>YVe,_never:()=>vee,_nonnegative:()=>eHe,_nonoptional:()=>Ayn,_nonpositive:()=>QVe,_normalize:()=>Mee,_null:()=>HVe,_nullable:()=>Ryn,_number:()=>RVe,_optional:()=>Myn,_overwrite:()=>BN,_parse:()=>Zme,_parseAsync:()=>Yme,_pipe:()=>jyn,_positive:()=>ZVe,_promise:()=>kyn,_property:()=>tHe,_readonly:()=>$yn,_record:()=>Syn,_refine:()=>iHe,_regex:()=>See,_safeParse:()=>Qme,_safeParseAsync:()=>ehe,_set:()=>xyn,_size:()=>wee,_startsWith:()=>Oee,_string:()=>CVe,_stringFormat:()=>sHe,_stringbool:()=>aHe,_success:()=>Nyn,_symbol:()=>zVe,_templateLiteral:()=>Lyn,_toLowerCase:()=>Iee,_toUpperCase:()=>Aee,_transform:()=>Pyn,_trim:()=>Ree,_tuple:()=>rHe,_uint32:()=>$Ve,_uint64:()=>UVe,_ulid:()=>The,_undefined:()=>VVe,_union:()=>_yn,_unknown:()=>Bz,_uppercase:()=>xee,_url:()=>vhe,_uuid:()=>ghe,_uuidv4:()=>yhe,_uuidv6:()=>bhe,_uuidv7:()=>_he,_void:()=>JVe,_xid:()=>Ohe,clone:()=>wd,config:()=>vd,flattenError:()=>lee,formatError:()=>cee,function:()=>lHe,globalConfig:()=>eee,globalRegistry:()=>xh,isValidBase64:()=>L2e,isValidBase64URL:()=>uMt,isValidJWT:()=>lMt,locales:()=>bee,parse:()=>Dz,parseAsync:()=>jz,prettifyError:()=>y4e,regexes:()=>Lz,registry:()=>mhe,safeParse:()=>_4e,safeParseAsync:()=>v4e,toDotPath:()=>VPt,toJSONSchema:()=>HL,treeifyError:()=>g4e,util:()=>Ft,version:()=>h2e});var _y=v(()=>{Y6();the();b4e();yee();ahe();g2e();zn();nhe();_Ve();SVe();m2e();jRt();uHe();$Rt();FRt()});function vy(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_zod"in e))return!1;let r=e._zod;return typeof r=="object"&&r!==null&&"def"in r}function Zv(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_def"in e)||"_zod"in e)return!1;let r=e._def;return typeof r=="object"&&r!=null&&"typeName"in r}function Hi(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(vy(t)||Zv(t))}async function Wz(t,e){if(vy(t))try{return{success:!0,data:await jz(t,e)}}catch(r){return{success:!1,error:r}}if(Zv(t))return await t.safeParseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function Jz(t,e){if(vy(t))return await jz(t,e);if(Zv(t))return await t.parseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Kz(t){if(vy(t))return xh.get(t)?.description;if(Zv(t)||"description"in t&&typeof t.description=="string")return t.description}function $ee(t){return Hi(t)?Zv(t)?t._def.typeName==="ZodString":vy(t)?t._zod.def.type==="string":!1:!1}function Hz(t){return vy(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="object":!1}function cHe(t){return vy(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="array":!1}function kRt(t){return vy(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="optional":!1}function qRt(t){return vy(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="nullable":!1}function jee(t,e=!1){if(Zv(t))return t.strict();if(Hz(t)){let r=t._zod.def.shape;if(e)for(let[i,a]of Object.entries(t._zod.def.shape)){if(Hz(a))r[i]=jee(a,e);else if(cHe(a)){let u=a._zod.def.element;Hz(u)&&(u=jee(u,e)),r[i]=wd(a,{...a._zod.def,element:u})}else r[i]=a;let s=xh.get(a);s&&xh.add(r[i],s)}let n=wd(t,{...t._zod.def,shape:r,catchall:vee(pee)}),o=xh.get(t);return o&&xh.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function qyn(t){return Zv(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function Byn(t){return vy(t)&&t._zod.def.type==="pipe"}function Vz(t,e,r){let n=r.get(t);if(n!==void 0)return n;if(Zv(t))return qyn(t)?Vz(t._def.schema,e,r):t;if(vy(t)){let o=t;if(Byn(t)&&(o=Vz(t._zod.def.in,e,r)),e){if(Hz(o)){let a={};for(let[s,u]of Object.entries(o._zod.def.shape))a[s]=Vz(u,e,r);o=wd(o,{...o._zod.def,shape:a})}else if(cHe(o)){let a=Vz(o._zod.def.element,e,r);o=wd(o,{...o._zod.def,element:a})}else if(kRt(o)){let a=Vz(o._zod.def.innerType,e,r);o=wd(o,{...o._zod.def,innerType:a})}else if(qRt(o)){let a=Vz(o._zod.def.innerType,e,r);o=wd(o,{...o._zod.def,innerType:a})}}let i=xh.get(t);return i&&xh.add(o,i),r.set(t,o),o}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function dHe(t,e=!1){return Vz(t,e,new WeakMap)}function fHe(t){return t instanceof Error&&(t.constructor.name==="ZodError"||t.constructor.name==="$ZodError")}var zN=v(()=>{_y()});function pHe(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function zyn(t){let e="";for(let[r,n]of Object.entries(t))e+=`	classDef ${r} ${n};
`;return e}function BRt(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 m="default",h={[m]:"{0}({1})"};n!==void 0&&(h[n]="{0}([{1}]):::first"),o!==void 0&&(h[o]="{0}([{1}]):::last");for(let[y,g]of Object.entries(t)){let b=g.name.split(":").pop()??"",_=Uyn.some(T=>b.startsWith(T)&&b.endsWith(T))?`<p>${b}</p>`:b;Object.keys(g.metadata??{}).length&&(_+=`<hr/><small><em>${Object.entries(g.metadata??{}).map(([T,O])=>`${T} = ${O}`).join(`
`)}</em></small>`);let w=(h[y]??h[m]).replace("{0}",pHe(y)).replace("{1}",_);l+=`	${w}
`}}let c={};for(let m of e){let h=m.source.split(":"),y=m.target.split(":"),g=h.filter((b,_)=>b===y[_]).join(":");c[g]||(c[g]=[]),c[g].push(m)}let d=new Set;function f(m){return[...m].sort((h,y)=>h.split(":").length-y.split(":").length)}function p(m,h){let y=m.length===1&&m[0].source===m[0].target;if(h&&!y){let b=h.split(":").pop();if(d.has(h))throw new Error(`Found duplicate subgraph '${b}' at '${h} -- 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(h),l+=`	subgraph ${b}
`}let g=f(Object.keys(c).filter(b=>b.startsWith(`${h}:`)&&b!==h&&b.split(":").length===h.split(":").length+1));for(let b of g)p(c[b],b);for(let b of m){let{source:_,target:w,data:T,conditional:O}=b,E="";if(T!==void 0){let P=T,R=P.split(" ");R.length>u&&(P=Array.from({length:Math.ceil(R.length/u)},(I,A)=>R.slice(A*u,(A+1)*u).join(" ")).join("&nbsp;<br>&nbsp;")),E=O?` -. &nbsp;${P}&nbsp; .-> `:` -- &nbsp;${P}&nbsp; --> `}else E=O?" -.-> ":" --> ";l+=`	${pHe(_)}${E}${pHe(w)};
`}h&&!y&&(l+=`	end
`)}p(c[""]??[],"");for(let m in c)!m.includes(":")&&m!==""&&p(c[m],m);return a&&(l+=zyn(i??{})),l}async function URt(t,e){let r=e?.backgroundColor??"white",n=e?.imageType??"png",o=UPt(t);r!==void 0&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(r)||(r=`!${r}`));let i=`https://mermaid.ink/img/${o}?bgColor=${r}&type=${n}`,a=await fetch(i);if(!a.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${a.status}`,`Status text: ${a.statusText}`].join(`
`));return await a.blob()}var Uyn,zRt=v(()=>{Gme();Uyn=["*","_","`"]});var HRt,VRt,WRt,Lhe=v(()=>{HRt=Symbol("Let zodToJsonSchema decide on which parser to use"),VRt={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},WRt=t=>typeof t=="string"?{...VRt,name:t}:{...VRt,...t}});var JRt,mHe=v(()=>{Lhe();JRt=t=>{let e=WRt(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},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}]))}}});var Fhe,khe=v(()=>{Fhe=(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("/")}});function Fl(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Fhe(e,t.currentPath):e.join("/")}}var _S=v(()=>{khe()});function hHe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Wi(t,e,r,n,o){t[e]=r,hHe(t,e,n,o)}var WL=v(()=>{});var Ri,gHe,dr,QT,Lee=v(()=>{(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ri||(Ri={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(gHe||(gHe={}));dr=Ri.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),QT=t=>{switch(typeof t){case"undefined":return dr.undefined;case"string":return dr.string;case"number":return Number.isNaN(t)?dr.nan:dr.number;case"boolean":return dr.boolean;case"function":return dr.function;case"bigint":return dr.bigint;case"symbol":return dr.symbol;case"object":return Array.isArray(t)?dr.array:t===null?dr.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?dr.promise:typeof Map<"u"&&t instanceof Map?dr.map:typeof Set<"u"&&t instanceof Set?dr.set:typeof Date<"u"&&t instanceof Date?dr.date:dr.object;default:return dr.unknown}}});var ut,Vyn,P_,qhe=v(()=>{Lee();ut=Ri.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"]),Vyn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),P_=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,Ri.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};P_.create=t=>new P_(t)});var Hyn,VN,yHe=v(()=>{qhe();Lee();Hyn=(t,e)=>{let r;switch(t.code){case ut.invalid_type:t.received===dr.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ut.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ri.jsonStringifyReplacer)}`;break;case ut.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ri.joinValues(t.keys,", ")}`;break;case ut.invalid_union:r="Invalid input";break;case ut.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ri.joinValues(t.options)}`;break;case ut.invalid_enum_value:r=`Invalid enum value. Expected ${Ri.joinValues(t.options)}, received '${t.received}'`;break;case ut.invalid_arguments:r="Invalid function arguments";break;case ut.invalid_return_type:r="Invalid function return type";break;case ut.invalid_date:r="Invalid date";break;case ut.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}"`:Ri.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ut.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case ut.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 ut.custom:r="Invalid input";break;case ut.invalid_intersection_types:r="Intersection results could not be merged";break;case ut.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ut.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ri.assertNever(t)}return{message:r}},VN=Hyn});function Wyn(t){KRt=t}function sJ(){return KRt}var KRt,Bhe=v(()=>{yHe();KRt=VN});function Xt(t,e){let r=sJ(),n=Fee({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===VN?void 0:VN].filter(o=>!!o)});t.common.issues.push(n)}var Fee,Jyn,bg,Pn,Gz,wy,Uhe,zhe,JL,uJ,bHe=v(()=>{Bhe();yHe();Fee=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}},Jyn=[];bg=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 Pn;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 Pn;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}}},Pn=Object.freeze({status:"aborted"}),Gz=t=>({status:"dirty",value:t}),wy=t=>({status:"valid",value:t}),Uhe=t=>t.status==="aborted",zhe=t=>t.status==="dirty",JL=t=>t.status==="valid",uJ=t=>typeof Promise<"u"&&t instanceof Promise});var GRt=v(()=>{});var $r,XRt=v(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})($r||($r={}))});function Xo(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}function eIt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function cbn(t){return new RegExp(`^${eIt(t)}$`)}function tIt(t){let e=`${QRt}T${eIt(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 dbn(t,e){return!!((e==="v4"||!e)&&nbn.test(t)||(e==="v6"||!e)&&ibn.test(t))}function fbn(t,e){if(!Qyn.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function pbn(t,e){return!!((e==="v4"||!e)&&obn.test(t)||(e==="v6"||!e)&&abn.test(t))}function mbn(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}function lJ(t){if(t instanceof M_){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=vS.create(lJ(n))}return new M_({...t._def,shape:()=>e})}else return t instanceof JN?new JN({...t._def,type:lJ(t.element)}):t instanceof vS?vS.create(lJ(t.unwrap())):t instanceof tO?tO.create(lJ(t.unwrap())):t instanceof eO?eO.create(t.items.map(e=>lJ(e))):t}function vHe(t,e){let r=QT(t),n=QT(e);if(t===e)return{valid:!0,data:t};if(r===dr.object&&n===dr.object){let o=Ri.objectKeys(e),i=Ri.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=vHe(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===dr.array&&n===dr.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=vHe(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===dr.date&&n===dr.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function rIt(t,e){return new a4({values:t,typeName:Ne.ZodEnum,...Xo(e)})}function YRt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function nIt(t,e={},r){return t?GL.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=YRt(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=YRt(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):GL.create()}var wS,ZRt,fi,Kyn,Gyn,Xyn,Zyn,Yyn,Qyn,ebn,tbn,rbn,_He,nbn,obn,ibn,abn,sbn,ubn,QRt,lbn,KL,Xz,Zz,Yz,Qz,cJ,e4,t4,GL,WN,AC,dJ,JN,M_,r4,HN,Vhe,n4,eO,Hhe,fJ,pJ,Whe,o4,i4,a4,s4,XL,SS,vS,tO,u4,l4,mJ,hbn,kee,qee,c4,gbn,Ne,ybn,oIt,iIt,bbn,_bn,aIt,vbn,wbn,Sbn,Cbn,xbn,Tbn,Obn,Ebn,Pbn,Mbn,Rbn,Ibn,Abn,Nbn,Dbn,jbn,$bn,Lbn,Fbn,kbn,qbn,Bbn,Ubn,zbn,Vbn,Hbn,Wbn,Jbn,Kbn,Gbn,Xbn,Zbn,Ybn,Qbn,sIt=v(()=>{qhe();Bhe();XRt();bHe();Lee();wS=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ZRt=(t,e)=>{if(JL(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 P_(t.common.issues);return this._error=r,this._error}}};fi=class{get description(){return this._def.description}_getType(e){return QT(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:QT(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new bg,ctx:{common:e.parent.common,data:e.data,parsedType:QT(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(uJ(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:QT(e)},o=this._parseSync({data:e,path:n.path,parent:n});return ZRt(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:QT(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return JL(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>JL(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:QT(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(uJ(o)?o:Promise.resolve(o));return ZRt(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:ut.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 SS({schema:this,typeName:Ne.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return vS.create(this,this._def)}nullable(){return tO.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return JN.create(this)}promise(){return XL.create(this,this._def)}or(e){return r4.create([this,e],this._def)}and(e){return n4.create(this,e,this._def)}transform(e){return new SS({...Xo(this._def),schema:this,typeName:Ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new u4({...Xo(this._def),innerType:this,defaultValue:r,typeName:Ne.ZodDefault})}brand(){return new kee({typeName:Ne.ZodBranded,type:this,...Xo(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new l4({...Xo(this._def),innerType:this,catchValue:r,typeName:Ne.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return qee.create(this,e)}readonly(){return c4.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Kyn=/^c[^\s-]{8,}$/i,Gyn=/^[0-9a-z]+$/,Xyn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Zyn=/^[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,Yyn=/^[a-z0-9_-]{21}$/i,Qyn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ebn=/^[-+]?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)?)??$/,tbn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rbn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",nbn=/^(?:(?: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])$/,obn=/^(?:(?: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])$/,ibn=/^(([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]))$/,abn=/^(([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])$/,sbn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ubn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,QRt="((\\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])))",lbn=new RegExp(`^${QRt}$`);KL=class t extends fi{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==dr.string){let i=this._getOrReturnCtx(e);return Xt(i,{code:ut.invalid_type,expected:dr.string,received:i.parsedType}),Pn}let n=new bg,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),Xt(o,{code:ut.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),Xt(o,{code:ut.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?Xt(o,{code:ut.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&Xt(o,{code:ut.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")tbn.test(e.data)||(o=this._getOrReturnCtx(e,o),Xt(o,{validation:"email",code:ut.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")_He||(_He=new RegExp(rbn,"u")),_He.test(e.data)||(o=this._getOrReturnCtx(e,o),Xt(o,{validation:"emoji",code:ut.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Zyn.test(e.data)||(o=this._getOrReturnCtx(e,o),Xt(o,{validation:"uuid",code:ut.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Yyn.test(e.data)||(o=this._getOrReturnCtx(e,o),Xt(o,{validation:"nanoid",code:ut.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Kyn.test(e.data)||(o=this._getOrReturnCtx(e,o),Xt(o,{validation:"cuid",code:ut.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Gyn.test(e.data)||(o=this._getOrReturnCtx(e,o),Xt(o,{validation:"cuid2",code:ut.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Xyn.test(e.data)||(o=this._getOrReturnCtx(e,o),Xt(o,{validation:"ulid",code:ut.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),Xt(o,{validation:"url",code:ut.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),Xt(o,{validation:"regex",code:ut.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),Xt(o,{code:ut.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),Xt(o,{code:ut.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),Xt(o,{code:ut.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?tIt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Xt(o,{code:ut.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?lbn.test(e.data)||(o=this._getOrReturnCtx(e,o),Xt(o,{code:ut.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?cbn(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Xt(o,{code:ut.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?ebn.test(e.data)||(o=this._getOrReturnCtx(e,o),Xt(o,{validation:"duration",code:ut.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?dbn(e.data,i.version)||(o=this._getOrReturnCtx(e,o),Xt(o,{validation:"ip",code:ut.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?fbn(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),Xt(o,{validation:"jwt",code:ut.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?pbn(e.data,i.version)||(o=this._getOrReturnCtx(e,o),Xt(o,{validation:"cidr",code:ut.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?sbn.test(e.data)||(o=this._getOrReturnCtx(e,o),Xt(o,{validation:"base64",code:ut.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?ubn.test(e.data)||(o=this._getOrReturnCtx(e,o),Xt(o,{validation:"base64url",code:ut.invalid_string,message:i.message}),n.dirty()):Ri.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:ut.invalid_string,...$r.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...$r.errToObj(e)})}url(e){return this._addCheck({kind:"url",...$r.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...$r.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...$r.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...$r.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...$r.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...$r.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...$r.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...$r.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...$r.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...$r.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...$r.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...$r.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...$r.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,...$r.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...$r.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...$r.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...$r.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...$r.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...$r.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...$r.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...$r.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...$r.errToObj(r)})}nonempty(e){return this.min(1,$r.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}};KL.create=t=>new KL({checks:[],typeName:Ne.ZodString,coerce:t?.coerce??!1,...Xo(t)});Xz=class t extends fi{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)!==dr.number){let i=this._getOrReturnCtx(e);return Xt(i,{code:ut.invalid_type,expected:dr.number,received:i.parsedType}),Pn}let n,o=new bg;for(let i of this._def.checks)i.kind==="int"?Ri.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Xt(n,{code:ut.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),Xt(n,{code:ut.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),Xt(n,{code:ut.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?mbn(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),Xt(n,{code:ut.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Xt(n,{code:ut.not_finite,message:i.message}),o.dirty()):Ri.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,$r.toString(r))}gt(e,r){return this.setLimit("min",e,!1,$r.toString(r))}lte(e,r){return this.setLimit("max",e,!0,$r.toString(r))}lt(e,r){return this.setLimit("max",e,!1,$r.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:$r.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:$r.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$r.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$r.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$r.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$r.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:$r.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:$r.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:$r.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:$r.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"&&Ri.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)}};Xz.create=t=>new Xz({checks:[],typeName:Ne.ZodNumber,coerce:t?.coerce||!1,...Xo(t)});Zz=class t extends fi{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)!==dr.bigint)return this._getInvalidInput(e);let n,o=new bg;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),Xt(n,{code:ut.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),Xt(n,{code:ut.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),Xt(n,{code:ut.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ri.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Xt(r,{code:ut.invalid_type,expected:dr.bigint,received:r.parsedType}),Pn}gte(e,r){return this.setLimit("min",e,!0,$r.toString(r))}gt(e,r){return this.setLimit("min",e,!1,$r.toString(r))}lte(e,r){return this.setLimit("max",e,!0,$r.toString(r))}lt(e,r){return this.setLimit("max",e,!1,$r.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:$r.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:$r.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:$r.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:$r.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:$r.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:$r.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}};Zz.create=t=>new Zz({checks:[],typeName:Ne.ZodBigInt,coerce:t?.coerce??!1,...Xo(t)});Yz=class extends fi{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==dr.boolean){let n=this._getOrReturnCtx(e);return Xt(n,{code:ut.invalid_type,expected:dr.boolean,received:n.parsedType}),Pn}return wy(e.data)}};Yz.create=t=>new Yz({typeName:Ne.ZodBoolean,coerce:t?.coerce||!1,...Xo(t)});Qz=class t extends fi{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==dr.date){let i=this._getOrReturnCtx(e);return Xt(i,{code:ut.invalid_type,expected:dr.date,received:i.parsedType}),Pn}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return Xt(i,{code:ut.invalid_date}),Pn}let n=new bg,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),Xt(o,{code:ut.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),Xt(o,{code:ut.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ri.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:$r.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:$r.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}};Qz.create=t=>new Qz({checks:[],coerce:t?.coerce||!1,typeName:Ne.ZodDate,...Xo(t)});cJ=class extends fi{_parse(e){if(this._getType(e)!==dr.symbol){let n=this._getOrReturnCtx(e);return Xt(n,{code:ut.invalid_type,expected:dr.symbol,received:n.parsedType}),Pn}return wy(e.data)}};cJ.create=t=>new cJ({typeName:Ne.ZodSymbol,...Xo(t)});e4=class extends fi{_parse(e){if(this._getType(e)!==dr.undefined){let n=this._getOrReturnCtx(e);return Xt(n,{code:ut.invalid_type,expected:dr.undefined,received:n.parsedType}),Pn}return wy(e.data)}};e4.create=t=>new e4({typeName:Ne.ZodUndefined,...Xo(t)});t4=class extends fi{_parse(e){if(this._getType(e)!==dr.null){let n=this._getOrReturnCtx(e);return Xt(n,{code:ut.invalid_type,expected:dr.null,received:n.parsedType}),Pn}return wy(e.data)}};t4.create=t=>new t4({typeName:Ne.ZodNull,...Xo(t)});GL=class extends fi{constructor(){super(...arguments),this._any=!0}_parse(e){return wy(e.data)}};GL.create=t=>new GL({typeName:Ne.ZodAny,...Xo(t)});WN=class extends fi{constructor(){super(...arguments),this._unknown=!0}_parse(e){return wy(e.data)}};WN.create=t=>new WN({typeName:Ne.ZodUnknown,...Xo(t)});AC=class extends fi{_parse(e){let r=this._getOrReturnCtx(e);return Xt(r,{code:ut.invalid_type,expected:dr.never,received:r.parsedType}),Pn}};AC.create=t=>new AC({typeName:Ne.ZodNever,...Xo(t)});dJ=class extends fi{_parse(e){if(this._getType(e)!==dr.undefined){let n=this._getOrReturnCtx(e);return Xt(n,{code:ut.invalid_type,expected:dr.void,received:n.parsedType}),Pn}return wy(e.data)}};dJ.create=t=>new dJ({typeName:Ne.ZodVoid,...Xo(t)});JN=class t extends fi{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==dr.array)return Xt(r,{code:ut.invalid_type,expected:dr.array,received:r.parsedType}),Pn;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(Xt(r,{code:a?ut.too_big:ut.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&&(Xt(r,{code:ut.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&&(Xt(r,{code:ut.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 wS(r,a,r.path,s)))).then(a=>bg.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new wS(r,a,r.path,s)));return bg.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:$r.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:$r.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:$r.toString(r)}})}nonempty(e){return this.min(1,e)}};JN.create=(t,e)=>new JN({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ne.ZodArray,...Xo(e)});M_=class t extends fi{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=Ri.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==dr.object){let l=this._getOrReturnCtx(e);return Xt(l,{code:ut.invalid_type,expected:dr.object,received:l.parsedType}),Pn}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof AC&&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 wS(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof AC){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&&(Xt(o,{code:ut.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 wS(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=>bg.mergeObjectSync(n,l)):bg.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return $r.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:$r.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ne.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Ri.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Ri.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return lJ(this)}partial(e){let r={};for(let n of Ri.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Ri.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof vS;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return rIt(Ri.objectKeys(this.shape))}};M_.create=(t,e)=>new M_({shape:()=>t,unknownKeys:"strip",catchall:AC.create(),typeName:Ne.ZodObject,...Xo(e)});M_.strictCreate=(t,e)=>new M_({shape:()=>t,unknownKeys:"strict",catchall:AC.create(),typeName:Ne.ZodObject,...Xo(e)});M_.lazycreate=(t,e)=>new M_({shape:t,unknownKeys:"strip",catchall:AC.create(),typeName:Ne.ZodObject,...Xo(e)});r4=class extends fi{_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 P_(s.ctx.common.issues));return Xt(r,{code:ut.invalid_union,unionErrors:a}),Pn}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 P_(u));return Xt(r,{code:ut.invalid_union,unionErrors:s}),Pn}}get options(){return this._def.options}};r4.create=(t,e)=>new r4({options:t,typeName:Ne.ZodUnion,...Xo(e)});HN=t=>t instanceof o4?HN(t.schema):t instanceof SS?HN(t.innerType()):t instanceof i4?[t.value]:t instanceof a4?t.options:t instanceof s4?Ri.objectValues(t.enum):t instanceof u4?HN(t._def.innerType):t instanceof e4?[void 0]:t instanceof t4?[null]:t instanceof vS?[void 0,...HN(t.unwrap())]:t instanceof tO?[null,...HN(t.unwrap())]:t instanceof kee||t instanceof c4?HN(t.unwrap()):t instanceof l4?HN(t._def.innerType):[],Vhe=class t extends fi{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==dr.object)return Xt(r,{code:ut.invalid_type,expected:dr.object,received:r.parsedType}),Pn;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}):(Xt(r,{code:ut.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Pn)}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=HN(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:Ne.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Xo(n)})}};n4=class extends fi{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(Uhe(i)||Uhe(a))return Pn;let s=vHe(i.value,a.value);return s.valid?((zhe(i)||zhe(a))&&r.dirty(),{status:r.value,value:s.data}):(Xt(n,{code:ut.invalid_intersection_types}),Pn)};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}))}};n4.create=(t,e,r)=>new n4({left:t,right:e,typeName:Ne.ZodIntersection,...Xo(r)});eO=class t extends fi{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==dr.array)return Xt(n,{code:ut.invalid_type,expected:dr.array,received:n.parsedType}),Pn;if(n.data.length<this._def.items.length)return Xt(n,{code:ut.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Pn;!this._def.rest&&n.data.length>this._def.items.length&&(Xt(n,{code:ut.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 wS(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>bg.mergeArray(r,a)):bg.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};eO.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new eO({items:t,typeName:Ne.ZodTuple,rest:null,...Xo(e)})};Hhe=class t extends fi{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!==dr.object)return Xt(n,{code:ut.invalid_type,expected:dr.object,received:n.parsedType}),Pn;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new wS(n,s,n.path,s)),value:a._parse(new wS(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?bg.mergeObjectAsync(r,o):bg.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof fi?new t({keyType:e,valueType:r,typeName:Ne.ZodRecord,...Xo(n)}):new t({keyType:KL.create(),valueType:e,typeName:Ne.ZodRecord,...Xo(r)})}},fJ=class extends fi{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!==dr.map)return Xt(n,{code:ut.invalid_type,expected:dr.map,received:n.parsedType}),Pn;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new wS(n,s,n.path,[l,"key"])),value:i._parse(new wS(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 Pn;(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 Pn;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};fJ.create=(t,e,r)=>new fJ({valueType:e,keyType:t,typeName:Ne.ZodMap,...Xo(r)});pJ=class t extends fi{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==dr.set)return Xt(n,{code:ut.invalid_type,expected:dr.set,received:n.parsedType}),Pn;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(Xt(n,{code:ut.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&&(Xt(n,{code:ut.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 Pn;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 wS(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:$r.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:$r.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};pJ.create=(t,e)=>new pJ({valueType:t,minSize:null,maxSize:null,typeName:Ne.ZodSet,...Xo(e)});Whe=class t extends fi{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==dr.function)return Xt(r,{code:ut.invalid_type,expected:dr.function,received:r.parsedType}),Pn;function n(s,u){return Fee({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,sJ(),VN].filter(l=>!!l),issueData:{code:ut.invalid_arguments,argumentsError:u}})}function o(s,u){return Fee({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,sJ(),VN].filter(l=>!!l),issueData:{code:ut.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof XL){let s=this;return wy(async function(...u){let l=new P_([]),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 wy(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new P_([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new P_([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:eO.create(e).rest(WN.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||eO.create([]).rest(WN.create()),returns:r||WN.create(),typeName:Ne.ZodFunction,...Xo(n)})}},o4=class extends fi{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})}};o4.create=(t,e)=>new o4({getter:t,typeName:Ne.ZodLazy,...Xo(e)});i4=class extends fi{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Xt(r,{received:r.data,code:ut.invalid_literal,expected:this._def.value}),Pn}return{status:"valid",value:e.data}}get value(){return this._def.value}};i4.create=(t,e)=>new i4({value:t,typeName:Ne.ZodLiteral,...Xo(e)});a4=class t extends fi{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Xt(r,{expected:Ri.joinValues(n),received:r.parsedType,code:ut.invalid_type}),Pn}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return Xt(r,{received:r.data,code:ut.invalid_enum_value,options:n}),Pn}return wy(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})}};a4.create=rIt;s4=class extends fi{_parse(e){let r=Ri.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==dr.string&&n.parsedType!==dr.number){let o=Ri.objectValues(r);return Xt(n,{expected:Ri.joinValues(o),received:n.parsedType,code:ut.invalid_type}),Pn}if(this._cache||(this._cache=new Set(Ri.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=Ri.objectValues(r);return Xt(n,{received:n.data,code:ut.invalid_enum_value,options:o}),Pn}return wy(e.data)}get enum(){return this._def.values}};s4.create=(t,e)=>new s4({values:t,typeName:Ne.ZodNativeEnum,...Xo(e)});XL=class extends fi{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==dr.promise&&r.common.async===!1)return Xt(r,{code:ut.invalid_type,expected:dr.promise,received:r.parsedType}),Pn;let n=r.parsedType===dr.promise?r.data:Promise.resolve(r.data);return wy(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};XL.create=(t,e)=>new XL({type:t,typeName:Ne.ZodPromise,...Xo(e)});SS=class extends fi{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{Xt(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 Pn;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?Pn:u.status==="dirty"?Gz(u.value):r.value==="dirty"?Gz(u.value):u});{if(r.value==="aborted")return Pn;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Pn:s.status==="dirty"?Gz(s.value):r.value==="dirty"?Gz(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"?Pn:(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"?Pn:(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(!JL(a))return Pn;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=>JL(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):Pn);Ri.assertNever(o)}};SS.create=(t,e,r)=>new SS({schema:t,typeName:Ne.ZodEffects,effect:e,...Xo(r)});SS.createWithPreprocess=(t,e,r)=>new SS({schema:e,effect:{type:"preprocess",transform:t},typeName:Ne.ZodEffects,...Xo(r)});vS=class extends fi{_parse(e){return this._getType(e)===dr.undefined?wy(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};vS.create=(t,e)=>new vS({innerType:t,typeName:Ne.ZodOptional,...Xo(e)});tO=class extends fi{_parse(e){return this._getType(e)===dr.null?wy(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};tO.create=(t,e)=>new tO({innerType:t,typeName:Ne.ZodNullable,...Xo(e)});u4=class extends fi{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===dr.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};u4.create=(t,e)=>new u4({innerType:t,typeName:Ne.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Xo(e)});l4=class extends fi{_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 uJ(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new P_(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new P_(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};l4.create=(t,e)=>new l4({innerType:t,typeName:Ne.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Xo(e)});mJ=class extends fi{_parse(e){if(this._getType(e)!==dr.nan){let n=this._getOrReturnCtx(e);return Xt(n,{code:ut.invalid_type,expected:dr.nan,received:n.parsedType}),Pn}return{status:"valid",value:e.data}}};mJ.create=t=>new mJ({typeName:Ne.ZodNaN,...Xo(t)});hbn=Symbol("zod_brand"),kee=class extends fi{_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}},qee=class t extends fi{_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"?Pn:i.status==="dirty"?(r.dirty(),Gz(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"?Pn: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:Ne.ZodPipeline})}},c4=class extends fi{_parse(e){let r=this._def.innerType._parse(e),n=o=>(JL(o)&&(o.value=Object.freeze(o.value)),o);return uJ(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};c4.create=(t,e)=>new c4({innerType:t,typeName:Ne.ZodReadonly,...Xo(e)});gbn={object:M_.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ne||(Ne={}));ybn=(t,e={message:`Input not instance of ${t.name}`})=>nIt(r=>r instanceof t,e),oIt=KL.create,iIt=Xz.create,bbn=mJ.create,_bn=Zz.create,aIt=Yz.create,vbn=Qz.create,wbn=cJ.create,Sbn=e4.create,Cbn=t4.create,xbn=GL.create,Tbn=WN.create,Obn=AC.create,Ebn=dJ.create,Pbn=JN.create,Mbn=M_.create,Rbn=M_.strictCreate,Ibn=r4.create,Abn=Vhe.create,Nbn=n4.create,Dbn=eO.create,jbn=Hhe.create,$bn=fJ.create,Lbn=pJ.create,Fbn=Whe.create,kbn=o4.create,qbn=i4.create,Bbn=a4.create,Ubn=s4.create,zbn=XL.create,Vbn=SS.create,Hbn=vS.create,Wbn=tO.create,Jbn=SS.createWithPreprocess,Kbn=qee.create,Gbn=()=>oIt().optional(),Xbn=()=>iIt().optional(),Zbn=()=>aIt().optional(),Ybn={string:t=>KL.create({...t,coerce:!0}),number:t=>Xz.create({...t,coerce:!0}),boolean:t=>Yz.create({...t,coerce:!0}),bigint:t=>Zz.create({...t,coerce:!0}),date:t=>Qz.create({...t,coerce:!0})},Qbn=Pn});var Ae={};En(Ae,{BRAND:()=>hbn,DIRTY:()=>Gz,EMPTY_PATH:()=>Jyn,INVALID:()=>Pn,NEVER:()=>Qbn,OK:()=>wy,ParseStatus:()=>bg,Schema:()=>fi,ZodAny:()=>GL,ZodArray:()=>JN,ZodBigInt:()=>Zz,ZodBoolean:()=>Yz,ZodBranded:()=>kee,ZodCatch:()=>l4,ZodDate:()=>Qz,ZodDefault:()=>u4,ZodDiscriminatedUnion:()=>Vhe,ZodEffects:()=>SS,ZodEnum:()=>a4,ZodError:()=>P_,ZodFirstPartyTypeKind:()=>Ne,ZodFunction:()=>Whe,ZodIntersection:()=>n4,ZodIssueCode:()=>ut,ZodLazy:()=>o4,ZodLiteral:()=>i4,ZodMap:()=>fJ,ZodNaN:()=>mJ,ZodNativeEnum:()=>s4,ZodNever:()=>AC,ZodNull:()=>t4,ZodNullable:()=>tO,ZodNumber:()=>Xz,ZodObject:()=>M_,ZodOptional:()=>vS,ZodParsedType:()=>dr,ZodPipeline:()=>qee,ZodPromise:()=>XL,ZodReadonly:()=>c4,ZodRecord:()=>Hhe,ZodSchema:()=>fi,ZodSet:()=>pJ,ZodString:()=>KL,ZodSymbol:()=>cJ,ZodTransformer:()=>SS,ZodTuple:()=>eO,ZodType:()=>fi,ZodUndefined:()=>e4,ZodUnion:()=>r4,ZodUnknown:()=>WN,ZodVoid:()=>dJ,addIssueToContext:()=>Xt,any:()=>xbn,array:()=>Pbn,bigint:()=>_bn,boolean:()=>aIt,coerce:()=>Ybn,custom:()=>nIt,date:()=>vbn,datetimeRegex:()=>tIt,defaultErrorMap:()=>VN,discriminatedUnion:()=>Abn,effect:()=>Vbn,enum:()=>Bbn,function:()=>Fbn,getErrorMap:()=>sJ,getParsedType:()=>QT,instanceof:()=>ybn,intersection:()=>Nbn,isAborted:()=>Uhe,isAsync:()=>uJ,isDirty:()=>zhe,isValid:()=>JL,late:()=>gbn,lazy:()=>kbn,literal:()=>qbn,makeIssue:()=>Fee,map:()=>$bn,nan:()=>bbn,nativeEnum:()=>Ubn,never:()=>Obn,null:()=>Cbn,nullable:()=>Wbn,number:()=>iIt,object:()=>Mbn,objectUtil:()=>gHe,oboolean:()=>Zbn,onumber:()=>Xbn,optional:()=>Hbn,ostring:()=>Gbn,pipeline:()=>Kbn,preprocess:()=>Jbn,promise:()=>zbn,quotelessJson:()=>Vyn,record:()=>jbn,set:()=>Lbn,setErrorMap:()=>Wyn,strictObject:()=>Rbn,string:()=>oIt,symbol:()=>wbn,transformer:()=>Vbn,tuple:()=>Dbn,undefined:()=>Sbn,union:()=>Ibn,unknown:()=>Tbn,util:()=>Ri,void:()=>Ebn});var Bee=v(()=>{Bhe();bHe();GRt();Lee();sIt();qhe()});var rO=v(()=>{Bee();Bee()});function uIt(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==Ne.ZodAny&&(r.items=Fn(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Wi(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Wi(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Wi(r,"minItems",t.exactLength.value,t.exactLength.message,e),Wi(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var wHe=v(()=>{WL();Sd();rO()});function lIt(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?Wi(r,"minimum",n.value,n.message,e):Wi(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Wi(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Wi(r,"maximum",n.value,n.message,e):Wi(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Wi(r,"maximum",n.value,n.message,e));break;case"multipleOf":Wi(r,"multipleOf",n.value,n.message,e);break}return r}var SHe=v(()=>{WL()});function cIt(){return{type:"boolean"}}var CHe=v(()=>{});function Jhe(t,e){return Fn(t.type._def,e)}var Khe=v(()=>{Sd()});var dIt,xHe=v(()=>{Sd();dIt=(t,e)=>Fn(t.innerType._def,e)});function THe(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map(o=>THe(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 e_n(t,e)}}var e_n,OHe=v(()=>{WL();e_n=(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":Wi(r,"minimum",n.value,n.message,e);break;case"max":Wi(r,"maximum",n.value,n.message,e);break}return r}});function fIt(t,e){return{...Fn(t.innerType._def,e),default:t.defaultValue()}}var EHe=v(()=>{Sd()});function pIt(t,e){return e.effectStrategy==="input"?Fn(t.schema._def,e):Fl(e)}var PHe=v(()=>{_S();Sd()});function mIt(t){return{type:"string",enum:Array.from(t.values)}}var MHe=v(()=>{});function hIt(t,e){let r=[Fn(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Fn(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(t_n(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 t_n,RHe=v(()=>{Sd();t_n=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function gIt(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 IHe=v(()=>{});function Ghe(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":Wi(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":Wi(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":DC(r,"email",n.message,e);break;case"format:idn-email":DC(r,"idn-email",n.message,e);break;case"pattern:zod":Tb(r,NC.email,n.message,e);break}break;case"url":DC(r,"uri",n.message,e);break;case"uuid":DC(r,"uuid",n.message,e);break;case"regex":Tb(r,n.regex,n.message,e);break;case"cuid":Tb(r,NC.cuid,n.message,e);break;case"cuid2":Tb(r,NC.cuid2,n.message,e);break;case"startsWith":Tb(r,RegExp(`^${NHe(n.value,e)}`),n.message,e);break;case"endsWith":Tb(r,RegExp(`${NHe(n.value,e)}$`),n.message,e);break;case"datetime":DC(r,"date-time",n.message,e);break;case"date":DC(r,"date",n.message,e);break;case"time":DC(r,"time",n.message,e);break;case"duration":DC(r,"duration",n.message,e);break;case"length":Wi(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),Wi(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":Tb(r,RegExp(NHe(n.value,e)),n.message,e);break;case"ip":n.version!=="v6"&&DC(r,"ipv4",n.message,e),n.version!=="v4"&&DC(r,"ipv6",n.message,e);break;case"base64url":Tb(r,NC.base64url,n.message,e);break;case"jwt":Tb(r,NC.jwt,n.message,e);break;case"cidr":n.version!=="v6"&&Tb(r,NC.ipv4Cidr,n.message,e),n.version!=="v4"&&Tb(r,NC.ipv6Cidr,n.message,e);break;case"emoji":Tb(r,NC.emoji(),n.message,e);break;case"ulid":Tb(r,NC.ulid,n.message,e);break;case"base64":switch(e.base64Strategy){case"format:binary":DC(r,"binary",n.message,e);break;case"contentEncoding:base64":Wi(r,"contentEncoding","base64",n.message,e);break;case"pattern:zod":Tb(r,NC.base64,n.message,e);break}break;case"nanoid":Tb(r,NC.nanoid,n.message,e);break;case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function NHe(t,e){return e.patternStrategy==="escape"?n_n(t):t}function n_n(t){let e="";for(let r=0;r<t.length;r++)r_n.has(t[r])||(e+="\\"),e+=t[r];return e}function DC(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}}})):Wi(t,"format",e,r,n)}function Tb(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:yIt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Wi(t,"pattern",yIt(e,n),r,n)}function yIt(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 AHe,NC,r_n,Xhe=v(()=>{WL();NC={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:()=>(AHe===void 0&&(AHe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),AHe),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-_]*$/};r_n=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function Zhe(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===Ne.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:Fn(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??Fl(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:Fn(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===Ne.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=Ghe(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===Ne.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===Ne.ZodBranded&&t.keyType._def.type._def.typeName===Ne.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=Jhe(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var Yhe=v(()=>{_S();Khe();Xhe();Sd();rO()});function bIt(t,e){return e.mapStrategy==="record"?Zhe(t,e):{type:"array",maxItems:125,items:{type:"array",items:[Fn(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Fl(e),Fn(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Fl(e)],minItems:2,maxItems:2}}}var DHe=v(()=>{_S();Yhe();Sd()});function _It(t){let e=t.values,r=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),n=Array.from(new Set(r.map(o=>typeof o)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:r}}var jHe=v(()=>{});function vIt(t){return t.target==="openAi"?void 0:{not:Fl({...t,currentPath:[...t.currentPath,"not"]})}}var $He=v(()=>{_S()});function wIt(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var LHe=v(()=>{});function CIt(t,e){if(e.target==="openApi3")return SIt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Uee&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=Uee[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":return i._def.value===null?[...o,"null"]:o;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 SIt(t,e)}var Uee,SIt,Qhe=v(()=>{Sd();Uee={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};SIt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Fn(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 xIt(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:Uee[t.innerType._def.typeName],nullable:!0}:{type:[Uee[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Fn(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Fn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var FHe=v(()=>{Qhe();Sd()});function TIt(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",hHe(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Wi(r,"minimum",n.value,n.message,e):Wi(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Wi(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Wi(r,"maximum",n.value,n.message,e):Wi(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Wi(r,"maximum",n.value,n.message,e));break;case"multipleOf":Wi(r,"multipleOf",n.value,n.message,e);break}return r}var kHe=v(()=>{WL()});function OIt(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},o=[],i=t.shape();for(let s in i){let u=i[s];if(u===void 0||u._def===void 0)continue;let l=i_n(u);l&&r&&(u._def.typeName==="ZodOptional"&&(u=u._def.innerType),u.isNullable()||(u=u.nullable()),l=!1);let c=Fn(u._def,{...e,currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]});c!==void 0&&(n.properties[s]=c,l||o.push(s))}o.length&&(n.required=o);let a=o_n(t,e);return a!==void 0&&(n.additionalProperties=a),n}function o_n(t,e){if(t.catchall._def.typeName!=="ZodNever")return Fn(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function i_n(t){try{return t.isOptional()}catch{return!0}}var qHe=v(()=>{Sd()});var EIt,BHe=v(()=>{_S();Sd();EIt=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Fn(t.innerType._def,e);let r=Fn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Fl(e)},r]}:Fl(e)}});var PIt,UHe=v(()=>{Sd();PIt=(t,e)=>{if(e.pipeStrategy==="input")return Fn(t.in._def,e);if(e.pipeStrategy==="output")return Fn(t.out._def,e);let r=Fn(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]});return{allOf:[r,Fn(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]})].filter(n=>n!==void 0)}}});function MIt(t,e){return Fn(t.type._def,e)}var zHe=v(()=>{Sd()});function RIt(t,e){let r={type:"array",uniqueItems:!0,items:Fn(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Wi(r,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Wi(r,"maxItems",t.maxSize.value,t.maxSize.message,e),r}var VHe=v(()=>{WL();Sd()});function IIt(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Fn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Fn(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Fn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var HHe=v(()=>{Sd()});function AIt(t){return{not:Fl(t)}}var WHe=v(()=>{_S()});function NIt(t){return Fl(t)}var JHe=v(()=>{_S()});var DIt,KHe=v(()=>{Sd();DIt=(t,e)=>Fn(t.innerType._def,e)});var jIt,GHe=v(()=>{_S();wHe();SHe();CHe();Khe();xHe();OHe();EHe();PHe();MHe();RHe();IHe();Xhe();Yhe();DHe();jHe();$He();LHe();Qhe();FHe();kHe();qHe();BHe();UHe();zHe();VHe();HHe();WHe();JHe();KHe();rO();jIt=(t,e,r)=>{switch(e){case Ne.ZodString:return Ghe(t,r);case Ne.ZodNumber:return TIt(t,r);case Ne.ZodObject:return OIt(t,r);case Ne.ZodBigInt:return lIt(t,r);case Ne.ZodBoolean:return cIt();case Ne.ZodDate:return THe(t,r);case Ne.ZodUndefined:return AIt(r);case Ne.ZodNull:return wIt(r);case Ne.ZodArray:return uIt(t,r);case Ne.ZodUnion:case Ne.ZodDiscriminatedUnion:return CIt(t,r);case Ne.ZodIntersection:return hIt(t,r);case Ne.ZodTuple:return IIt(t,r);case Ne.ZodRecord:return Zhe(t,r);case Ne.ZodLiteral:return gIt(t,r);case Ne.ZodEnum:return mIt(t);case Ne.ZodNativeEnum:return _It(t);case Ne.ZodNullable:return xIt(t,r);case Ne.ZodOptional:return EIt(t,r);case Ne.ZodMap:return bIt(t,r);case Ne.ZodSet:return RIt(t,r);case Ne.ZodLazy:return()=>t.getter()._def;case Ne.ZodPromise:return MIt(t,r);case Ne.ZodNaN:case Ne.ZodNever:return vIt(r);case Ne.ZodEffects:return pIt(t,r);case Ne.ZodAny:return Fl(r);case Ne.ZodUnknown:return NIt(r);case Ne.ZodDefault:return fIt(t,r);case Ne.ZodBranded:return Jhe(t,r);case Ne.ZodReadonly:return DIt(t,r);case Ne.ZodCatch:return dIt(t,r);case Ne.ZodPipeline:return PIt(t,r);case Ne.ZodFunction:case Ne.ZodVoid:case Ne.ZodSymbol:return;default:return(n=>{})(e)}}});function Fn(t,e,r=!1){let n=e.seen.get(t);if(e.override){let s=e.override?.(t,e,n,r);if(s!==HRt)return s}if(n&&!r){let s=a_n(n,e);if(s!==void 0)return s}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=jIt(t,t.typeName,e),a=typeof i=="function"?Fn(i(),e):i;if(a&&s_n(t,e,a),e.postProcess){let s=e.postProcess(a,t,e);return o.jsonSchema=a,s}return o.jsonSchema=a,a}var a_n,s_n,Sd=v(()=>{Lhe();khe();_S();GHe();a_n=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Fhe(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`),Fl(e)):e.$refStrategy==="seen"?Fl(e):void 0}},s_n=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var $It,XHe=v(()=>{mHe();_S();Sd();$It=(t,e)=>{let r=JRt(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:Fn(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??Fl(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=Fn(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??Fl(r),a=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;a!==void 0&&(i.title=a),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));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 LIt=v(()=>{Lhe();mHe();WL();khe();_S();wHe();SHe();CHe();Khe();xHe();OHe();EHe();PHe();MHe();RHe();IHe();Xhe();Yhe();DHe();jHe();$He();LHe();Qhe();FHe();kHe();qHe();BHe();UHe();zHe();VHe();HHe();WHe();JHe();KHe();GHe();Sd();XHe()});function KN(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(!KN(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(!KN(t[a],e[a]))return!1;return!0}return t===e}var ZHe=v(()=>{});function Yv(t){return encodeURI(u_n(t))}function u_n(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var ege=v(()=>{});function GN(t,e=Object.create(null),r=f_n,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:GN(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(d_n[i])continue;let a=`${n}/${Yv(i)}`,s=t[i];if(Array.isArray(s)){if(l_n[i]){let u=s.length;for(let l=0;l<u;l++)GN(s[l],e,r,`${a}/${l}`)}}else if(c_n[i])for(let u in s)GN(s[u],e,r,`${a}/${Yv(u)}`);else GN(s,e,r,a)}return e}var l_n,c_n,d_n,f_n,tge=v(()=>{ege();l_n={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},c_n={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},d_n={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},f_n=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 R_(t){return t.test.bind(t)}function N_n(t){return t%4===0&&(t%100!==0||t%400===0)}function FIt(t){let e=t.match(p_n);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&N_n(r)?29:m_n[n])}function kIt(t,e){let r=e.match(h_n);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 j_n(t){let e=t.split(D_n);return e.length==2&&FIt(e[0])&&kIt(!0,e[1])}function F_n(t){return $_n.test(t)&&L_n.test(t)}function q_n(t){if(k_n.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var p_n,m_n,h_n,g_n,y_n,b_n,__n,v_n,w_n,S_n,C_n,x_n,T_n,O_n,E_n,P_n,M_n,R_n,I_n,A_n,YHe,D_n,$_n,L_n,k_n,QHe=v(()=>{p_n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,m_n=[0,31,28,31,30,31,30,31,31,30,31,30,31],h_n=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,g_n=/^(?=.{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,y_n=/^(?:[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,b_n=/^(?:(?:[^\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,__n=/^(?:(?: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,v_n=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,w_n=/^(?:\/(?:[^~/]|~0|~1)*)*$/,S_n=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,C_n=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,x_n=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,T_n=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,O_n=/^\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,E_n=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,P_n=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))},M_n=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,R_n=/^((([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,I_n=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));A_n={date:FIt,time:kIt.bind(void 0,!1),"date-time":j_n,duration:I_n,uri:F_n,"uri-reference":R_(y_n),"uri-template":R_(b_n),url:R_(__n),email:P_n,hostname:R_(g_n),ipv4:R_(M_n),ipv6:R_(R_n),regex:q_n,uuid:R_(v_n),"json-pointer":R_(w_n),"json-pointer-uri-fragment":R_(S_n),"relative-json-pointer":R_(C_n)},YHe={...A_n,date:R_(x_n),time:R_(T_n),"date-time":R_(O_n),"uri-reference":R_(E_n)};D_n=/t|\s/i;$_n=/\/|:/,L_n=/^(?:[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;k_n=/[^\\]\\Z/});var qIt,BIt=v(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(qIt||(qIt={}))});function UIt(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 eWe=v(()=>{});function fl(t,e,r="2019-09",n=GN(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:y,required:g,not:b,anyOf:_,allOf:w,oneOf:T,if:O,then:E,else:P,format:R,properties:I,patternProperties:A,additionalProperties:B,unevaluatedProperties:k,minProperties:q,maxProperties:Z,propertyNames:V,dependentRequired:Y,dependentSchemas:X,dependencies:W,prefixItems:re,items:ue,additionalItems:le,unevaluatedItems:L,contains:J,minContains:ne,maxContains:D,minItems:N,maxItems:z,uniqueItems:H,minimum:oe,maximum:Q,exclusiveMinimum:de,exclusiveMaximum:fe,multipleOf:De,minLength:st,maxLength:Le,pattern:Bt,__absolute_ref__:Pt,__absolute_recursive_ref__:Nt}=e,$e=[];if(p===!0&&i===null&&(i=e),f==="#"){let ft=i===null?n[Nt]:i,Ve=`${s}/$recursiveRef`,Rt=fl(t,i===null?e:i,r,n,o,ft,a,Ve,u);Rt.valid||$e.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:Ve,error:"A subschema had errors."},...Rt.errors)}if(d!==void 0){let Ve=n[Pt||d];if(Ve===void 0){let He=`Unresolved $ref "${d}".`;throw Pt&&Pt!==d&&(He+=`  Absolute URI "${Pt}".`),He+=`
Known schemas:
- ${Object.keys(n).join(`
- `)}`,new Error(He)}let Rt=`${s}/$ref`,ze=fl(t,Ve,r,n,o,i,a,Rt,u);if(ze.valid||$e.push({instanceLocation:a,keyword:"$ref",keywordLocation:Rt,error:"A subschema had errors."},...ze.errors),r==="4"||r==="7")return{valid:$e.length===0,errors:$e}}if(Array.isArray(m)){let ft=m.length,Ve=!1;for(let Rt=0;Rt<ft;Rt++)if(c===m[Rt]||m[Rt]==="integer"&&c==="number"&&t%1===0&&t===t){Ve=!0;break}Ve||$e.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)&&$e.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`}):m!==void 0&&c!==m&&$e.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`});if(h!==void 0&&(c==="object"||c==="array"?KN(t,h)||$e.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):t!==h&&$e.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`})),y!==void 0&&(c==="object"||c==="array"?y.some(ft=>KN(t,ft))||$e.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(y)}.`}):y.some(ft=>t===ft)||$e.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(y)}.`})),b!==void 0){let ft=`${s}/not`;fl(t,b,r,n,o,i,a,ft).valid&&$e.push({instanceLocation:a,keyword:"not",keywordLocation:ft,error:'Instance matched "not" schema.'})}let Fr=[];if(_!==void 0){let ft=`${s}/anyOf`,Ve=$e.length,Rt=!1;for(let ze=0;ze<_.length;ze++){let He=_[ze],We=Object.create(u),Jt=fl(t,He,r,n,o,p===!0?i:null,a,`${ft}/${ze}`,We);$e.push(...Jt.errors),Rt=Rt||Jt.valid,Jt.valid&&Fr.push(We)}Rt?$e.length=Ve:$e.splice(Ve,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:ft,error:"Instance does not match any subschemas."})}if(w!==void 0){let ft=`${s}/allOf`,Ve=$e.length,Rt=!0;for(let ze=0;ze<w.length;ze++){let He=w[ze],We=Object.create(u),Jt=fl(t,He,r,n,o,p===!0?i:null,a,`${ft}/${ze}`,We);$e.push(...Jt.errors),Rt=Rt&&Jt.valid,Jt.valid&&Fr.push(We)}Rt?$e.length=Ve:$e.splice(Ve,0,{instanceLocation:a,keyword:"allOf",keywordLocation:ft,error:"Instance does not match every subschema."})}if(T!==void 0){let ft=`${s}/oneOf`,Ve=$e.length,Rt=T.filter((ze,He)=>{let We=Object.create(u),Jt=fl(t,ze,r,n,o,p===!0?i:null,a,`${ft}/${He}`,We);return $e.push(...Jt.errors),Jt.valid&&Fr.push(We),Jt.valid}).length;Rt===1?$e.length=Ve:$e.splice(Ve,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:ft,error:`Instance does not match exactly one subschema (${Rt} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...Fr),O!==void 0){let ft=`${s}/if`;if(fl(t,O,r,n,o,i,a,ft,u).valid){if(E!==void 0){let Rt=fl(t,E,r,n,o,i,a,`${s}/then`,u);Rt.valid||$e.push({instanceLocation:a,keyword:"if",keywordLocation:ft,error:'Instance does not match "then" schema.'},...Rt.errors)}}else if(P!==void 0){let Rt=fl(t,P,r,n,o,i,a,`${s}/else`,u);Rt.valid||$e.push({instanceLocation:a,keyword:"if",keywordLocation:ft,error:'Instance does not match "else" schema.'},...Rt.errors)}}if(c==="object"){if(g!==void 0)for(let ze of g)ze in t||$e.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${ze}".`});let ft=Object.keys(t);if(q!==void 0&&ft.length<q&&$e.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${q} properties.`}),Z!==void 0&&ft.length>Z&&$e.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${Z} properties.`}),V!==void 0){let ze=`${s}/propertyNames`;for(let He in t){let We=`${a}/${Yv(He)}`,Jt=fl(He,V,r,n,o,i,We,ze);Jt.valid||$e.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:ze,error:`Property name "${He}" does not match schema.`},...Jt.errors)}}if(Y!==void 0){let ze=`${s}/dependantRequired`;for(let He in Y)if(He in t){let We=Y[He];for(let Jt of We)Jt in t||$e.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:ze,error:`Instance has "${He}" but does not have "${Jt}".`})}}if(X!==void 0)for(let ze in X){let He=`${s}/dependentSchemas`;if(ze in t){let We=fl(t,X[ze],r,n,o,i,a,`${He}/${Yv(ze)}`,u);We.valid||$e.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:He,error:`Instance has "${ze}" but does not match dependant schema.`},...We.errors)}}if(W!==void 0){let ze=`${s}/dependencies`;for(let He in W)if(He in t){let We=W[He];if(Array.isArray(We))for(let Jt of We)Jt in t||$e.push({instanceLocation:a,keyword:"dependencies",keywordLocation:ze,error:`Instance has "${He}" but does not have "${Jt}".`});else{let Jt=fl(t,We,r,n,o,i,a,`${ze}/${Yv(He)}`);Jt.valid||$e.push({instanceLocation:a,keyword:"dependencies",keywordLocation:ze,error:`Instance has "${He}" but does not match dependant schema.`},...Jt.errors)}}}let Ve=Object.create(null),Rt=!1;if(I!==void 0){let ze=`${s}/properties`;for(let He in I){if(!(He in t))continue;let We=`${a}/${Yv(He)}`,Jt=fl(t[He],I[He],r,n,o,i,We,`${ze}/${Yv(He)}`);if(Jt.valid)u[He]=Ve[He]=!0;else if(Rt=o,$e.push({instanceLocation:a,keyword:"properties",keywordLocation:ze,error:`Property "${He}" does not match schema.`},...Jt.errors),Rt)break}}if(!Rt&&A!==void 0){let ze=`${s}/patternProperties`;for(let He in A){let We=new RegExp(He,"u"),Jt=A[He];for(let so in t){if(!We.test(so))continue;let au=`${a}/${Yv(so)}`,An=fl(t[so],Jt,r,n,o,i,au,`${ze}/${Yv(He)}`);An.valid?u[so]=Ve[so]=!0:(Rt=o,$e.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:ze,error:`Property "${so}" matches pattern "${He}" but does not match associated schema.`},...An.errors))}}}if(!Rt&&B!==void 0){let ze=`${s}/additionalProperties`;for(let He in t){if(Ve[He])continue;let We=`${a}/${Yv(He)}`,Jt=fl(t[He],B,r,n,o,i,We,ze);Jt.valid?u[He]=!0:(Rt=o,$e.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:ze,error:`Property "${He}" does not match additional properties schema.`},...Jt.errors))}}else if(!Rt&&k!==void 0){let ze=`${s}/unevaluatedProperties`;for(let He in t)if(!u[He]){let We=`${a}/${Yv(He)}`,Jt=fl(t[He],k,r,n,o,i,We,ze);Jt.valid?u[He]=!0:$e.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:ze,error:`Property "${He}" does not match unevaluated properties schema.`},...Jt.errors)}}}else if(c==="array"){z!==void 0&&t.length>z&&$e.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${t.length} > ${z}).`}),N!==void 0&&t.length<N&&$e.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${t.length} < ${N}).`});let ft=t.length,Ve=0,Rt=!1;if(re!==void 0){let ze=`${s}/prefixItems`,He=Math.min(re.length,ft);for(;Ve<He;Ve++){let We=fl(t[Ve],re[Ve],r,n,o,i,`${a}/${Ve}`,`${ze}/${Ve}`);if(u[Ve]=!0,!We.valid&&(Rt=o,$e.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:ze,error:"Items did not match schema."},...We.errors),Rt))break}}if(ue!==void 0){let ze=`${s}/items`;if(Array.isArray(ue)){let He=Math.min(ue.length,ft);for(;Ve<He;Ve++){let We=fl(t[Ve],ue[Ve],r,n,o,i,`${a}/${Ve}`,`${ze}/${Ve}`);if(u[Ve]=!0,!We.valid&&(Rt=o,$e.push({instanceLocation:a,keyword:"items",keywordLocation:ze,error:"Items did not match schema."},...We.errors),Rt))break}}else for(;Ve<ft;Ve++){let He=fl(t[Ve],ue,r,n,o,i,`${a}/${Ve}`,ze);if(u[Ve]=!0,!He.valid&&(Rt=o,$e.push({instanceLocation:a,keyword:"items",keywordLocation:ze,error:"Items did not match schema."},...He.errors),Rt))break}if(!Rt&&le!==void 0){let He=`${s}/additionalItems`;for(;Ve<ft;Ve++){let We=fl(t[Ve],le,r,n,o,i,`${a}/${Ve}`,He);u[Ve]=!0,We.valid||(Rt=o,$e.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:He,error:"Items did not match additional items schema."},...We.errors))}}}if(J!==void 0)if(ft===0&&ne===void 0)$e.push({instanceLocation:a,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(ne!==void 0&&ft<ne)$e.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${ft}) than minContains (${ne}).`});else{let ze=`${s}/contains`,He=$e.length,We=0;for(let Jt=0;Jt<ft;Jt++){let so=fl(t[Jt],J,r,n,o,i,`${a}/${Jt}`,ze);so.valid?(u[Jt]=!0,We++):$e.push(...so.errors)}We>=(ne||0)&&($e.length=He),ne===void 0&&D===void 0&&We===0?$e.splice(He,0,{instanceLocation:a,keyword:"contains",keywordLocation:ze,error:"Array does not contain item matching schema."}):ne!==void 0&&We<ne?$e.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${ne} items matching schema. Only ${We} items were found.`}):D!==void 0&&We>D&&$e.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${D} items matching schema. ${We} items were found.`})}if(!Rt&&L!==void 0){let ze=`${s}/unevaluatedItems`;for(Ve;Ve<ft;Ve++){if(u[Ve])continue;let He=fl(t[Ve],L,r,n,o,i,`${a}/${Ve}`,ze);u[Ve]=!0,He.valid||$e.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:ze,error:"Items did not match unevaluated items schema."},...He.errors)}}if(H)for(let ze=0;ze<ft;ze++){let He=t[ze],We=typeof He=="object"&&He!==null;for(let Jt=0;Jt<ft;Jt++){if(ze===Jt)continue;let so=t[Jt];(He===so||We&&(typeof so=="object"&&so!==null)&&KN(He,so))&&($e.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${ze} and ${Jt}.`}),ze=Number.MAX_SAFE_INTEGER,Jt=Number.MAX_SAFE_INTEGER)}}}else if(c==="number"){if(r==="4"?(oe!==void 0&&(de===!0&&t<=oe||t<oe)&&$e.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${de?"or equal to ":""} ${oe}.`}),Q!==void 0&&(fe===!0&&t>=Q||t>Q)&&$e.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${fe?"or equal to ":""} ${Q}.`})):(oe!==void 0&&t<oe&&$e.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${oe}.`}),Q!==void 0&&t>Q&&$e.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Q}.`}),de!==void 0&&t<=de&&$e.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${t} is less than ${de}.`}),fe!==void 0&&t>=fe&&$e.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${t} is greater than or equal to ${fe}.`})),De!==void 0){let ft=t%De;Math.abs(0-ft)>=11920929e-14&&Math.abs(De-ft)>=11920929e-14&&$e.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${t} is not a multiple of ${De}.`})}}else if(c==="string"){let ft=st===void 0&&Le===void 0?0:UIt(t);st!==void 0&&ft<st&&$e.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${ft} < ${st}).`}),Le!==void 0&&ft>Le&&$e.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${ft} > ${Le}).`}),Bt!==void 0&&!new RegExp(Bt,"u").test(t)&&$e.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),R!==void 0&&YHe[R]&&!YHe[R](t)&&$e.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${R}".`})}return{valid:$e.length===0,errors:$e}}var tWe=v(()=>{ZHe();tge();QHe();ege();eWe()});var zIt=v(()=>{tge();tWe()});var rge=v(()=>{ZHe();tge();QHe();ege();BIt();eWe();tWe();zIt()});function Ii(t,e){if(vy(t)){let r=dHe(t,!0);return Hz(r)?HL(jee(r,!0),e):HL(t,e)}return Zv(t)?$It(t):t}function zee(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=>zee(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=>zee(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=GN(t);return r[e]?zee(r[e]):!1}return!1}var Sy=v(()=>{zo();zN();XHe();LIt();_y();rge()});function B_n(t,e){if(t!==void 0&&!j6(t))return t;if(QQ(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 U_n(t){return QQ(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...Ii(t.data.schema),title:t.data.name}}}function VIt(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 HIt(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 rWe,JIt=v(()=>{zo();Gme();zRt();Sy();y_();rWe=class WIt{constructor(e){x(this,"nodes",{});x(this,"edges",[]);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]=j6(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...U_n(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??gu(),i={id:o,data:e,name:B_n(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 VIt(this)}lastNode(){return HIt(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(u=>u.id).every(j6)&&(n="");let o=u=>n?`${n}:${u}`:u;Object.entries(e.nodes).forEach(([u,l])=>{this.nodes[o(u)]={...l,id:o(u)}});let i=e.edges.map(u=>({...u,source:o(u.source),target:o(u.target)}));this.edges=[...this.edges,...i];let a=e.firstNode(),s=e.lastNode();return[a?{id:o(a.id),data:a.data}:void 0,s?{id:o(s.id),data:s.data}:void 0]}trimFirstNode(){let e=this.firstNode();e&&VIt(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&HIt(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 j6(o)&&r.get(i)===1?i:o};return new WIt({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 BRt(a.nodes,a.edges,{firstNode:s?.id,lastNode:u?.id,withStyles:r,curveStyle:n,nodeColors:o,wrapLabelNWords:i})}async drawMermaidPng(e){return URt(this.drawMermaid(e),{backgroundColor:e?.backgroundColor})}}});function KIt(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 T_.fromReadableStream(r)}var GIt=v(()=>{XT()});function nWe(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function nge(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function ZIt(t){return t!=null&&typeof t=="object"&&typeof t.next=="function"}async function YIt(t,e){try{let r=await t.next();for(;!r.done;)await e?.(r.value),r=await t.next();return r.value}finally{await t.return?.(void 0)}}function*oWe(t,e){for(;;){let{value:r,done:n}=yg.runWithConfig(x_(t),e.next.bind(e),!0);if(n)break;yield r}}async function*oge(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await yg.runWithConfig(x_(t),r.next.bind(e),!0);if(o)break;yield n}}var XIt,iWe=v(()=>{Oz();Ez();GT();XIt=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function Om(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function V_n(t){if(Mme(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function XN(t){if(typeof t=="function")return new YN({func:t});if(Ti.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=XN(n);return new hJ({steps:e})}else throw new Error(`Expected a Runnable, function or object.
Instead got an unsupported type.`)}function H_n(t,e){let r=e.name??t.getName(),n=e.description??Kz(e.schema);return $ee(e.schema)?new aWe({name:r,description:n,schema:Ae.object({input:Ae.string()}).transform(o=>o.input),bound:t}):new aWe({name:r,description:n,schema:e.schema,bound:t})}var Ti,ZN,sWe,gc,hJ,z_n,YN,nAt,ige,oAt,aWe,_g=v(()=>{xpe();DL();Oz();Ez();GT();G6();XT();IPt();$Pt();t4e();Iz();qPt();Gme();zN();JIt();GIt();iWe();y_();kze();rO();Ti=class extends b_{constructor(){super(...arguments);x(this,"lc_runnable",!0);x(this,"name")}getName(e){let r=this.name??this.constructor.lc_name()??this.constructor.name;return e?`${r}${e}`:r}withRetry(e){return new sWe({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new ZN({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new nAt({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(vi);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)=>vi(i===0?e:n))}return Array.from({length:r},()=>vi(e))}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=new IC({maxConcurrency:o[0]?.maxConcurrency??n?.maxConcurrency,onFailedAttempt:s=>{throw s}}),a=e.map((s,u)=>i.call(async()=>{try{return await this.invoke(s,o[u])}catch(l){if(n?.returnExceptions)return l;throw l}}));return Promise.all(a)}async*_streamIterator(e,r){yield this.invoke(e,r)}async stream(e,r){let n=vi(r),o=new Pz({generator:this._streamIterator(e,n),config:n});return await o.setup,T_.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=vi(e):r=vi({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=vi(n),i=await(await C_(o))?.handleChainStart(this.toJSON(),Om(r,"input"),o.runId,o?.runType,void 0,void 0,o?.runName??this.getName());delete o.runId;let a;try{a=await MC(e.call(this,r,o,i),n?.signal)}catch(s){throw await i?.handleChainError(s),s}return await i?.handleChainEnd(Om(a,"output")),a}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(C_)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),Om(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{u=await MC(e.call(this,r,i,s,o),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(Om(u,"output")))),u}_concatOutputChunks(e,r){return RC(e,r)}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=vi(n),l=await C_(u),c=this;async function*d(){for await(let p of e){if(i)if(o===void 0)o=p;else try{o=c._concatOutputChunks(o,p)}catch{o=void 0,i=!1}yield p}}let f;try{let p=await CPt(r.bind(this),d(),async()=>l?.handleChainStart(this.toJSON(),{input:""},u.runId,u.runType,void 0,void 0,u.runName??this.getName(),void 0,{lc_defers_inputs:!0}),n?.signal,u);delete u.runId,f=p.setup;let m=f?.handlers.find(DPt),h=p.output;m!==void 0&&f!==void 0&&(h=m.tapOutputIterable(f.runId,h));let y=f?.handlers.find(RPt);y!==void 0&&f!==void 0&&(h=y.tapOutputIterable(f.runId,h));for await(let g of h)if(yield g,s)if(a===void 0)a=g;else try{a=this._concatOutputChunks(a,g)}catch{a=void 0,s=!1}}catch(p){throw await f?.handleChainError(p,void 0,void 0,void 0,{inputs:Om(o,"input")}),p}await f?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:Om(o,"input")})}getGraph(e){let r=new rWe,n=r.addNode({name:`${this.getName()}Input`,schema:Ae.any()}),o=r.addNode(this),i=r.addNode({name:`${this.getName()}Output`,schema:Ae.any()});return r.addEdge(n,o),r.addEdge(o,i),r}pipe(e){return new gc({first:this,last:XN(e)})}pick(e){return this.pipe(new oAt(e))}assign(e){return this.pipe(new ige(new hJ({steps:e})))}async*transform(e,r){let n;for await(let o of e)n===void 0?n=o:n=this._concatOutputChunks(n,o);yield*this._streamIterator(n,vi(r))}async*streamLog(e,r,n){let o=new e4e({...n,autoClose:!1,_schemaFormat:"original"}),i=vi(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 LN({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"?KIt(o):T_.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new jPt({...n,autoClose:!1}),i=vi(r),a=i.runId??gu();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(){let m,h=null;try{r?.signal?"any"in AbortSignal?m=AbortSignal.any([u.signal,r.signal]):(m=r.signal,h=()=>{u.abort()},r.signal.addEventListener("abort",h,{once:!0})):m=u.signal;let y=await l.stream(e,{...i,signal:m}),g=o.tapOutputIterable(a,y);for await(let b of g)if(u.signal.aborted)break}finally{await o.finish(),m&&h&&m.removeEventListener("abort",h)}}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=vi(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new e4e({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new BPt({...n}),f=this._streamLog(e,c,a);for await(let m of f){if(o?o=o.concat(m):o=Qze.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 b={...o.state},_={run_id:b.id,event:`on_${b.type}_start`,name:l,tags:s,metadata:u,data:{input:e}};d.includeEvent(_,b.type)&&(yield _)}let h=m.ops.filter(b=>b.path.startsWith("/logs/")).map(b=>b.path.split("/")[2]),y=[...new Set(h)];for(let b of y){let _,w={},T=o.state.logs[b];if(T.end_time===void 0?T.streamed_output.length>0?_="stream":_="start":_="end",_==="start")T.inputs!==void 0&&(w.input=T.inputs);else if(_==="end")T.inputs!==void 0&&(w.input=T.inputs),w.output=T.final_output;else if(_==="stream"){let O=T.streamed_output.length;if(O!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${O} instead. Encountered in: "${T.name}"`);w={chunk:T.streamed_output[0]},T.streamed_output=[]}yield{event:`on_${T.type}_${_}`,name:T.name,run_id:T.id,tags:T.tags,metadata:T.metadata,data:w}}let{state:g}=o;if(g.streamed_output.length>0){let b=g.streamed_output.length;if(b!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${b} instead. Encountered in: "${g.name}"`);let _={chunk:g.streamed_output[0]};g.streamed_output=[];let w={event:`on_${g.type}_stream`,run_id:g.id,tags:s,metadata:u,name:l,data:_};d.includeEvent(w,g.type)&&(yield w)}}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 QQ(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new ZN({bound:this,config:{},configFactories:[o=>({callbacks:[new r4e({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return H_n(this,e)}},ZN=class QIt extends Ti{constructor(r){super(r);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"bound");x(this,"config");x(this,"kwargs");x(this,"configFactories");this.bound=r.bound,this.kwargs=r.kwargs,this.config=r.config,this.configFactories=r.configFactories}static lc_name(){return"RunnableBinding"}getName(r){return this.bound.getName(r)}async _mergeConfig(...r){let n=K6(this.config,...r);return K6(n,...this.configFactories?await Promise.all(this.configFactories.map(async o=>await o(n))):[])}withConfig(r){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...r}})}withRetry(r){return new sWe({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:r?.stopAfterAttempt,...r})}async invoke(r,n){return this.bound.invoke(r,await this._mergeConfig(n,this.kwargs))}async batch(r,n,o){let i=Array.isArray(n)?await Promise.all(n.map(async a=>this._mergeConfig(vi(a),this.kwargs))):await this._mergeConfig(vi(n),this.kwargs);return this.bound.batch(r,i,o)}_concatOutputChunks(r,n){return this.bound._concatOutputChunks(r,n)}async*_streamIterator(r,n){yield*this.bound._streamIterator(r,await this._mergeConfig(vi(n),this.kwargs))}async stream(r,n){return this.bound.stream(r,await this._mergeConfig(vi(n),this.kwargs))}async*transform(r,n){yield*this.bound.transform(r,await this._mergeConfig(vi(n),this.kwargs))}streamEvents(r,n,o){let i=this,a=async function*(){yield*i.bound.streamEvents(r,{...await i._mergeConfig(vi(n),i.kwargs),version:n.version},o)};return T_.fromAsyncGenerator(a())}static isRunnableBinding(r){return r.bound&&Ti.isRunnable(r.bound)}withListeners({onStart:r,onEnd:n,onError:o}){return new QIt({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[i=>({callbacks:[new r4e({config:i,onStart:r,onEnd:n,onError:o})]})]})}},sWe=class extends ZN{constructor(e){super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"maxAttemptNumber",3);x(this,"onFailedAttempt",()=>{});this.maxAttemptNumber=e.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=e.onFailedAttempt??this.onFailedAttempt}static lc_name(){return"RunnableRetry"}_patchConfigForRetry(e,r,n){let o=e>1?`retry:attempt:${e}`:void 0;return Nc(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return YQ(o=>super.invoke(e,this._patchConfigForRetry(o,r,n)),{onFailedAttempt:({error: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 YQ(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:({error: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)}},gc=class Vee extends Ti{constructor(r){super(r);x(this,"first");x(this,"middle",[]);x(this,"last");x(this,"omitSequenceTags",!1);x(this,"lc_serializable",!0);x(this,"lc_namespace",["langchain_core","runnables"]);this.first=r.first,this.middle=r.middle??this.middle,this.last=r.last,this.name=r.name,this.omitSequenceTags=r.omitSequenceTags??this.omitSequenceTags}static lc_name(){return"RunnableSequence"}get steps(){return[this.first,...this.middle,this.last]}async invoke(r,n){let o=vi(n),i=await(await C_(o))?.handleChainStart(this.toJSON(),Om(r,"input"),o.runId,void 0,void 0,void 0,o?.runName);delete o.runId;let a=r,s;try{let u=[this.first,...this.middle];for(let l=0;l<u.length;l+=1)a=await MC(u[l].invoke(a,Nc(o,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${l+1}`)})),n?.signal);if(n?.signal?.aborted)throw UL(n.signal);s=await this.last.invoke(a,Nc(o,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${this.steps.length}`)}))}catch(u){throw await i?.handleChainError(u),u}return await i?.handleChainEnd(Om(s,"output")),s}async batch(r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(C_)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),Om(r[c],"input"),i[c].runId,void 0,void 0,void 0,i[c].runName);return delete i[c].runId,d})),u=r;try{for(let l=0;l<this.steps.length;l+=1)u=await MC(this.steps[l].batch(u,s.map((c,d)=>{let f=c?.getChild(this.omitSequenceTags?void 0:`seq:step:${l+1}`);return Nc(i[d],{callbacks:f})}),o),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(Om(u,"output")))),u}_concatOutputChunks(r,n){return this.last._concatOutputChunks(r,n)}async*_streamIterator(r,n){let o=await C_(n),{runId:i,...a}=n??{},s=await o?.handleChainStart(this.toJSON(),Om(r,"input"),i,void 0,void 0,void 0,a?.runName),u=[this.first,...this.middle,this.last],l=!0,c;async function*d(){yield r}try{let f=u[0].transform(d(),Nc(a,{callbacks:s?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let p=1;p<u.length;p+=1)f=await u[p].transform(f,Nc(a,{callbacks:s?.getChild(this.omitSequenceTags?void 0:`seq:step:${p+1}`)}));for await(let p of f)if(n?.signal?.throwIfAborted(),yield p,l)if(c===void 0)c=p;else try{c=this._concatOutputChunks(c,p)}catch{c=void 0,l=!1}}catch(f){throw await s?.handleChainError(f),f}await s?.handleChainEnd(Om(c,"output"))}getGraph(r){let n=new rWe,o=null;return this.steps.forEach((i,a)=>{let s=i.getGraph(r);a!==0&&s.trimFirstNode(),a!==this.steps.length-1&&s.trimLastNode(),n.extend(s);let u=s.firstNode();if(!u)throw new Error(`Runnable ${i} has no first node`);o&&n.addEdge(o,u),o=s.lastNode()}),n}pipe(r){return Vee.isRunnableSequence(r)?new Vee({first:this.first,middle:this.middle.concat([this.last,r.first,...r.middle]),last:r.last,name:this.name??r.name}):new Vee({first:this.first,middle:[...this.middle,this.last],last:XN(r),name:this.name})}static isRunnableSequence(r){return Array.isArray(r.middle)&&Ti.isRunnable(r)}static from([r,...n],o){let i={};return typeof o=="string"?i.name=o:o!==void 0&&(i=o),new Vee({...i,first:XN(r),middle:n.slice(0,-1).map(XN),last:XN(n[n.length-1])})}},hJ=class eAt extends Ti{constructor(r){super(r);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"steps");this.steps={};for(let[n,o]of Object.entries(r.steps))this.steps[n]=XN(o)}static lc_name(){return"RunnableMap"}getStepsKeys(){return Object.keys(this.steps)}static from(r){return new eAt({steps:r})}async invoke(r,n){let o=vi(n),i=await(await C_(o))?.handleChainStart(this.toJSON(),{input:r},o.runId,void 0,void 0,void 0,o?.runName);delete o.runId;let a={};try{let s=Object.entries(this.steps).map(async([u,l])=>{a[u]=await l.invoke(r,Nc(o,{callbacks:i?.getChild(`map:key:${u}`)}))});await MC(Promise.all(s),n?.signal)}catch(s){throw await i?.handleChainError(s),s}return await i?.handleChainEnd(a),a}async*_transform(r,n,o){let i={...this.steps},a=Xze(r,Object.keys(i).length),s=new Map(Object.entries(i).map(([u,l],c)=>{let d=l.transform(a[c],Nc(o,{callbacks:n?.getChild(`map:key:${u}`)}));return[u,d.next().then(f=>({key:u,gen:d,result:f}))]}));for(;s.size;){let{key:u,result:l,gen:c}=await MC(Promise.race(s.values()),o?.signal);s.delete(u),l.done||(yield{[u]:l.value},s.set(u,c.next().then(d=>({key:u,gen:c,result:d}))))}}transform(r,n){return this._transformStreamWithConfig(r,this._transform.bind(this),n)}async stream(r,n){async function*o(){yield r}let i=vi(n),a=new Pz({generator:this.transform(o(),i),config:i});return await a.setup,T_.fromAsyncGenerator(a)}},z_n=class tAt extends Ti{constructor(r){super(r);x(this,"lc_serializable",!1);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"func");if(!Mme(r.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=r.func}async invoke(r,n){let[o]=this._getOptionsList(n??{},1),i=await C_(o);return MC(this.func(Nc(o,{callbacks:i}),r),o?.signal)}async*_streamIterator(r,n){let[o]=this._getOptionsList(n??{},1),i=await this.invoke(r,n);if(nge(i)){for await(let a of i)o?.signal?.throwIfAborted(),yield a;return}if(XIt(i)){for(;;){o?.signal?.throwIfAborted();let a=i.next();if(a.done)break;yield a.value}return}yield i}static from(r){return new tAt({func:r})}};YN=class rAt extends Ti{constructor(r){if(Mme(r.func))return z_n.from(r.func);super(r);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"func");V_n(r.func),this.func=r.func}static lc_name(){return"RunnableLambda"}static from(r){return new rAt({func:r})}async _invoke(r,n,o){return new Promise((i,a)=>{let s=Nc(n,{callbacks:o?.getChild(),recursionLimit:(n?.recursionLimit??jme)-1});yg.runWithConfig(x_(s),async()=>{try{let u=await this.func(r,{...s});if(u&&Ti.isRunnable(u)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");u=await u.invoke(r,{...s,recursionLimit:(s.recursionLimit??jme)-1})}else if(nge(u)){let l;for await(let c of oge(s,u))if(n?.signal?.throwIfAborted(),l===void 0)l=c;else try{l=this._concatOutputChunks(l,c)}catch{l=c}u=l}else if(nWe(u)){let l;for(let c of oWe(s,u))if(n?.signal?.throwIfAborted(),l===void 0)l=c;else try{l=this._concatOutputChunks(l,c)}catch{l=c}u=l}i(u)}catch(u){a(u)}})})}async invoke(r,n){return this._callWithConfig(this._invoke.bind(this),r,n)}async*_transform(r,n,o){let i;for await(let u of r)if(i===void 0)i=u;else try{i=this._concatOutputChunks(i,u)}catch{i=u}let a=Nc(o,{callbacks:n?.getChild(),recursionLimit:(o?.recursionLimit??jme)-1}),s=await new Promise((u,l)=>{yg.runWithConfig(x_(a),async()=>{try{u(await this.func(i,{...a,config:a}))}catch(c){l(c)}})});if(s&&Ti.isRunnable(s)){if(o?.recursionLimit===0)throw new Error("Recursion limit reached.");let u=await s.stream(i,a);for await(let l of u)yield l}else if(nge(s))for await(let u of oge(a,s))o?.signal?.throwIfAborted(),yield u;else if(nWe(s))for(let u of oWe(a,s))o?.signal?.throwIfAborted(),yield u;else yield s}transform(r,n){return this._transformStreamWithConfig(r,this._transform.bind(this),n)}async stream(r,n){async function*o(){yield r}let i=vi(n),a=new Pz({generator:this.transform(o(),i),config:i});return await a.setup,T_.fromAsyncGenerator(a)}},nAt=class extends Ti{constructor(e){super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"runnable");x(this,"fallbacks");this.runnable=e.runnable,this.fallbacks=e.fallbacks}static lc_name(){return"RunnableWithFallbacks"}*runnables(){yield this.runnable;for(let e of this.fallbacks)yield e}async invoke(e,r){let n=vi(r),o=await C_(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),Om(e,"input"),i,void 0,void 0,void 0,a?.runName),u=Nc(a,{callbacks:s?.getChild()});return await yg.runWithConfig(u,async()=>{let l;for(let c of this.runnables()){n?.signal?.throwIfAborted();try{let d=await c.invoke(e,u);return await s?.handleChainEnd(Om(d,"output")),d}catch(d){l===void 0&&(l=d)}}throw l===void 0?new Error("No error stored at end of fallback."):(await s?.handleChainError(l),l)})}async*_streamIterator(e,r){let n=vi(r),o=await C_(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),Om(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=Nc(a,{callbacks:s?.getChild()});try{l=oge(f,await d.stream(e,f));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:this._concatOutputChunks(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(Om(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=>C_(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),Om(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)=>Nc(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(Om(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.")}};ige=class extends Ti{constructor(e){e instanceof hJ&&(e={mapper:e});super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"mapper");this.mapper=e.mapper}static lc_name(){return"RunnableAssign"}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]=Xze(e),s=this.mapper.transform(a,Nc(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=vi(r),i=new Pz({generator:this.transform(n(),o),config:o});return await i.setup,T_.fromAsyncGenerator(i)}},oAt=class extends Ti{constructor(e){(typeof e=="string"||Array.isArray(e))&&(e={keys:e});super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"keys");this.keys=e.keys}static lc_name(){return"RunnablePick"}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=vi(r),i=new Pz({generator:this.transform(n(),o),config:o});return await i.setup,T_.fromAsyncGenerator(i)}},aWe=class extends ZN{constructor(e){let r=gc.from([YN.from(async n=>{let o;if(NL(n))try{o=await Jz(this.schema,n.args)}catch{throw new xQ("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??{}});x(this,"name");x(this,"description");x(this,"schema");this.name=e.name,this.description=e.description,this.schema=e.schema}static lc_name(){return"RunnableToolLike"}}});var pl,age=v(()=>{GT();XT();_g();pl=class extends Ti{constructor(e){super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"func");e&&(this.func=e.func)}static lc_name(){return"RunnablePassthrough"}async invoke(e,r){let n=vi(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=vi(r),o,i=!0;for await(let a of this._transformStreamWithConfig(e,s=>s,n))if(yield a,i)if(o===void 0)o=a;else try{o=RC(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(e){return new ige(new hJ({steps:e}))}}});var iAt=v(()=>{GT();_g()});var aAt=v(()=>{GT();XT();_g()});var sAt=v(()=>{my();k6();mS();RQ();Ape();LL();Dpe();IQ();TC();_g()});var uAt,lAt=v(()=>{uAt=["tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result"]});var cAt,dAt=v(()=>{cAt=["image","video","audio","text-plain","file"]});var W_n,fAt=v(()=>{lAt();dAt();W_n=["text","reasoning",...uAt,...cAt]});var ra=v(()=>{zo();PQ();HBe();my();Rpe();k6();mS();RQ();Ape();LL();Dpe();IQ();TC();sAt();fAt()});var pAt=v(()=>{my();mS();LL();_g();ra();age()});var Qv=v(()=>{zo();GT();G6();_g();age();iAt();aAt();pAt()});var gJ,d4,CS,yJ=v(()=>{F6();_g();Qv();gJ=class extends Ti{parseResultWithPrompt(t,e,r){return this.parseResult(t,r)}_baseMessageToString(t){return typeof t.content=="string"?t.content:this._baseMessageContentToString(t.content)}_baseMessageContentToString(t){return JSON.stringify(t)}async invoke(t,e){return typeof t=="string"?this._callWithConfig(async(r,n)=>this.parseResult([{text:r}],n?.callbacks),t,{...e,runType:"parser"}):this._callWithConfig(async(r,n)=>this.parseResult([{message:r,text:this._baseMessageToString(r)}],n?.callbacks),t,{...e,runType:"parser"})}},d4=class extends gJ{parseResult(t,e){return this.parse(t[0].text,e)}async parseWithPrompt(t,e,r){return this.parse(t,r)}_type(){throw new Error("_type not implemented")}},CS=class extends Error{constructor(e,r,n,o=!1){super(e);x(this,"llmOutput");x(this,"observation");x(this,"sendToLLM");if(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");AL(this,"OUTPUT_PARSING_FAILURE")}}});var bJ,_J,ZL=v(()=>{my();TC();xm();yJ();rge();bJ=class extends d4{async*_transform(t){for await(let e of t)typeof e=="string"?yield this.parseResult([{text:e}]):yield this.parseResult([{message:e,text:this._baseMessageToString(e)}])}async*transform(t,e){yield*this._transformStreamWithConfig(t,this._transform.bind(this),{...e,runType:"parser"})}},_J=class extends bJ{constructor(e){super(e);x(this,"diff",!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(Mpe(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new Mi({message:o,text:o.content})}else if(pS(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new Mi({message:$pe(o),text:o.content})}else i=new ZT({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!KN(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var mAt=v(()=>{ZL()});var hAt=v(()=>{yJ();ZL()});var uWe,gAt=v(()=>{ZL();uWe=class extends bJ{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers","string"]);x(this,"lc_serializable",!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.')}_messageContentToString(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;case"reasoning":case"thinking":case"redacted_thinking":return"";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._messageContentToString(n),"")}}});var jC,yAt=v(()=>{zN();Sy();yJ();rO();jC=class extends d4{constructor(e){super(e);x(this,"lc_namespace",["langchain","output_parsers","structured"]);this.schema=e}static lc_name(){return"StructuredOutputParser"}toJSON(){return this.toJSONNotImplemented()}static fromZodSchema(e){return new this(e)}static fromNamesAndDescriptions(e){let r=Ae.object(Object.fromEntries(Object.entries(e).map(([n,o])=>[n,Ae.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(Ii(this.schema))}
\`\`\`
`}async parse(e){try{let r=e.trim(),n=(r.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||r.match(/```json\s*([\s\S]*?)```/)?.[1]||r).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(o,i)=>`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await Jz(this.schema,JSON.parse(n))}catch(r){throw new CS(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}}});var lWe=v(()=>{zo();XQ();ZQ();Zze()});var ew,cWe=v(()=>{CQ();ZQ();ZL();lWe();ew=class extends _J{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers"]);x(this,"lc_serializable",!0)}static lc_name(){return"JsonOutputParser"}_concatOutputChunks(e,r){return this.diff?super._concatOutputChunks(e,r):r}_diff(e,r){if(r)return e?Hme(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return Cpe(e[0].text)}async parse(e){return Cpe(e,JSON.parse)}getFormatInstructions(){return""}_baseMessageToString(e){return e.text}}});var K_n,G_n,bAt=v(()=>{K_n=function(){let t={};t.parser=function(D,N){return new r(D,N)},t.SAXParser=r,t.SAXStream=l,t.createStream=u,t.MAX_BUFFER_LENGTH=65536;let e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(D,N){if(!(this instanceof r))return new r(D,N);var z=this;o(z),z.q=z.c="",z.bufferCheckPosition=t.MAX_BUFFER_LENGTH,z.opt=N||{},z.opt.lowercase=z.opt.lowercase||z.opt.lowercasetags,z.looseCase=z.opt.lowercase?"toLowerCase":"toUpperCase",z.tags=[],z.closed=z.closedRoot=z.sawRoot=!1,z.tag=z.error=null,z.strict=!!D,z.noscript=!!(D||z.opt.noscript),z.state=P.BEGIN,z.strictEntities=z.opt.strictEntities,z.ENTITIES=z.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),z.attribList=[],z.opt.xmlns&&(z.ns=Object.create(m)),z.trackPosition=z.opt.position!==!1,z.trackPosition&&(z.position=z.line=z.column=0),I(z,"onready")}Object.create||(Object.create=function(D){function N(){}return N.prototype=D,new N}),Object.keys||(Object.keys=function(D){var N=[];for(var z in D)D.hasOwnProperty(z)&&N.push(z);return N});function n(D){for(var N=Math.max(t.MAX_BUFFER_LENGTH,10),z=0,H=0,oe=e.length;H<oe;H++){var Q=D[e[H]].length;if(Q>N)switch(e[H]){case"textNode":B(D);break;case"cdata":A(D,"oncdata",D.cdata),D.cdata="";break;case"script":A(D,"onscript",D.script),D.script="";break;default:q(D,"Max buffer length exceeded: "+e[H])}z=Math.max(z,Q)}D.bufferCheckPosition=t.MAX_BUFFER_LENGTH-z+D.position}function o(D){for(var N=0,z=e.length;N<z;N++)D[e[N]]=""}function i(D){B(D),D.cdata!==""&&(A(D,"oncdata",D.cdata),D.cdata=""),D.script!==""&&(A(D,"onscript",D.script),D.script="")}r.prototype={end:function(){Z(this)},write:ne,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){i(this)}};var a=ReadableStream;a||(a=function(){});var s=t.EVENTS.filter(function(D){return D!=="error"&&D!=="end"});function u(D,N){return new l(D,N)}function l(D,N){if(!(this instanceof l))return new l(D,N);a.apply(this),this._parser=new r(D,N),this.writable=!0,this.readable=!0;var z=this;this._parser.onend=function(){z.emit("end")},this._parser.onerror=function(H){z.emit("error",H),z._parser.error=null},this._decoder=null,s.forEach(function(H){Object.defineProperty(z,"on"+H,{get:function(){return z._parser["on"+H]},set:function(oe){if(!oe)return z.removeAllListeners(H),z._parser["on"+H]=oe,oe;z.on(H,oe)},enumerable:!0,configurable:!1})})}l.prototype=Object.create(a.prototype,{constructor:{value:l}}),l.prototype.write=function(D){return this._parser.write(D.toString()),this.emit("data",D),!0},l.prototype.end=function(D){return D&&D.length&&this.write(D),this._parser.end(),!0},l.prototype.on=function(D,N){var z=this;return!z._parser["on"+D]&&s.indexOf(D)!==-1&&(z._parser["on"+D]=function(){var H=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);H.splice(0,0,D),z.emit.apply(z,H)}),a.prototype.on.call(z,D,N)};var c="[CDATA[",d="DOCTYPE",f="http://www.w3.org/XML/1998/namespace",p="http://www.w3.org/2000/xmlns/",m={xml:f,xmlns:p},h=/[:_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]/,y=/[:_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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,g=/[#:_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]/,b=/[#:_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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function _(D){return D===" "||D===`
`||D==="\r"||D==="	"}function w(D){return D==='"'||D==="'"}function T(D){return D===">"||_(D)}function O(D,N){return D.test(N)}function E(D,N){return!O(D,N)}var P=0;t.STATE={BEGIN:P++,BEGIN_WHITESPACE:P++,TEXT:P++,TEXT_ENTITY:P++,OPEN_WAKA:P++,SGML_DECL:P++,SGML_DECL_QUOTED:P++,DOCTYPE:P++,DOCTYPE_QUOTED:P++,DOCTYPE_DTD:P++,DOCTYPE_DTD_QUOTED:P++,COMMENT_STARTING:P++,COMMENT:P++,COMMENT_ENDING:P++,COMMENT_ENDED:P++,CDATA:P++,CDATA_ENDING:P++,CDATA_ENDING_2:P++,PROC_INST:P++,PROC_INST_BODY:P++,PROC_INST_ENDING:P++,OPEN_TAG:P++,OPEN_TAG_SLASH:P++,ATTRIB:P++,ATTRIB_NAME:P++,ATTRIB_NAME_SAW_WHITE:P++,ATTRIB_VALUE:P++,ATTRIB_VALUE_QUOTED:P++,ATTRIB_VALUE_CLOSED:P++,ATTRIB_VALUE_UNQUOTED:P++,ATTRIB_VALUE_ENTITY_Q:P++,ATTRIB_VALUE_ENTITY_U:P++,CLOSE_TAG:P++,CLOSE_TAG_SAW_WHITE:P++,SCRIPT:P++,SCRIPT_ENDING:P++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(D){var N=t.ENTITIES[D],z=typeof N=="number"?String.fromCharCode(N):N;t.ENTITIES[D]=z});for(var R in t.STATE)t.STATE[t.STATE[R]]=R;P=t.STATE;function I(D,N,z){D[N]&&D[N](z)}function A(D,N,z){D.textNode&&B(D),I(D,N,z)}function B(D){D.textNode=k(D.opt,D.textNode),D.textNode&&I(D,"ontext",D.textNode),D.textNode=""}function k(D,N){return D.trim&&(N=N.trim()),D.normalize&&(N=N.replace(/\s+/g," ")),N}function q(D,N){return B(D),D.trackPosition&&(N+=`
Line: `+D.line+`
Column: `+D.column+`
Char: `+D.c),N=new Error(N),D.error=N,I(D,"onerror",N),D}function Z(D){return D.sawRoot&&!D.closedRoot&&V(D,"Unclosed root tag"),D.state!==P.BEGIN&&D.state!==P.BEGIN_WHITESPACE&&D.state!==P.TEXT&&q(D,"Unexpected end"),B(D),D.c="",D.closed=!0,I(D,"onend"),r.call(D,D.strict,D.opt),D}function V(D,N){if(typeof D!="object"||!(D instanceof r))throw new Error("bad call to strictFail");D.strict&&q(D,N)}function Y(D){D.strict||(D.tagName=D.tagName[D.looseCase]());var N=D.tags[D.tags.length-1]||D,z=D.tag={name:D.tagName,attributes:{}};D.opt.xmlns&&(z.ns=N.ns),D.attribList.length=0,A(D,"onopentagstart",z)}function X(D,N){var z=D.indexOf(":")<0?["",D]:D.split(":"),H=z[0],oe=z[1];return N&&D==="xmlns"&&(H="xmlns",oe=""),{prefix:H,local:oe}}function W(D){if(D.strict||(D.attribName=D.attribName[D.looseCase]()),D.attribList.indexOf(D.attribName)!==-1||D.tag.attributes.hasOwnProperty(D.attribName)){D.attribName=D.attribValue="";return}if(D.opt.xmlns){var N=X(D.attribName,!0),z=N.prefix,H=N.local;if(z==="xmlns")if(H==="xml"&&D.attribValue!==f)V(D,"xml: prefix must be bound to "+f+`
Actual: `+D.attribValue);else if(H==="xmlns"&&D.attribValue!==p)V(D,"xmlns: prefix must be bound to "+p+`
Actual: `+D.attribValue);else{var oe=D.tag,Q=D.tags[D.tags.length-1]||D;oe.ns===Q.ns&&(oe.ns=Object.create(Q.ns)),oe.ns[H]=D.attribValue}D.attribList.push([D.attribName,D.attribValue])}else D.tag.attributes[D.attribName]=D.attribValue,A(D,"onattribute",{name:D.attribName,value:D.attribValue});D.attribName=D.attribValue=""}function re(D,N){if(D.opt.xmlns){var z=D.tag,H=X(D.tagName);z.prefix=H.prefix,z.local=H.local,z.uri=z.ns[H.prefix]||"",z.prefix&&!z.uri&&(V(D,"Unbound namespace prefix: "+JSON.stringify(D.tagName)),z.uri=H.prefix);var oe=D.tags[D.tags.length-1]||D;z.ns&&oe.ns!==z.ns&&Object.keys(z.ns).forEach(function(Fr){A(D,"onopennamespace",{prefix:Fr,uri:z.ns[Fr]})});for(var Q=0,de=D.attribList.length;Q<de;Q++){var fe=D.attribList[Q],De=fe[0],st=fe[1],Le=X(De,!0),Bt=Le.prefix,Pt=Le.local,Nt=Bt===""?"":z.ns[Bt]||"",$e={name:De,value:st,prefix:Bt,local:Pt,uri:Nt};Bt&&Bt!=="xmlns"&&!Nt&&(V(D,"Unbound namespace prefix: "+JSON.stringify(Bt)),$e.uri=Bt),D.tag.attributes[De]=$e,A(D,"onattribute",$e)}D.attribList.length=0}D.tag.isSelfClosing=!!N,D.sawRoot=!0,D.tags.push(D.tag),A(D,"onopentag",D.tag),N||(!D.noscript&&D.tagName.toLowerCase()==="script"?D.state=P.SCRIPT:D.state=P.TEXT,D.tag=null,D.tagName=""),D.attribName=D.attribValue="",D.attribList.length=0}function ue(D){if(!D.tagName){V(D,"Weird empty close tag."),D.textNode+="</>",D.state=P.TEXT;return}if(D.script){if(D.tagName!=="script"){D.script+="</"+D.tagName+">",D.tagName="",D.state=P.SCRIPT;return}A(D,"onscript",D.script),D.script=""}var N=D.tags.length,z=D.tagName;D.strict||(z=z[D.looseCase]());for(var H=z;N--&&D.tags[N].name!==H;)V(D,"Unexpected close tag");if(N<0){V(D,"Unmatched closing tag: "+D.tagName),D.textNode+="</"+D.tagName+">",D.state=P.TEXT;return}D.tagName=z;for(var oe=D.tags.length;oe-- >N;){var Q=D.tag=D.tags.pop();D.tagName=D.tag.name,A(D,"onclosetag",D.tagName);var de={};for(var fe in Q.ns)de[fe]=Q.ns[fe];var De=D.tags[D.tags.length-1]||D;D.opt.xmlns&&Q.ns!==De.ns&&Object.keys(Q.ns).forEach(function(st){var Le=Q.ns[st];A(D,"onclosenamespace",{prefix:st,uri:Le})})}N===0&&(D.closedRoot=!0),D.tagName=D.attribValue=D.attribName="",D.attribList.length=0,D.state=P.TEXT}function le(D){var N=D.entity,z=N.toLowerCase(),H,oe="";return D.ENTITIES[N]?D.ENTITIES[N]:D.ENTITIES[z]?D.ENTITIES[z]:(N=z,N.charAt(0)==="#"&&(N.charAt(1)==="x"?(N=N.slice(2),H=parseInt(N,16),oe=H.toString(16)):(N=N.slice(1),H=parseInt(N,10),oe=H.toString(10))),N=N.replace(/^0+/,""),isNaN(H)||oe.toLowerCase()!==N?(V(D,"Invalid character entity"),"&"+D.entity+";"):String.fromCodePoint(H))}function L(D,N){N==="<"?(D.state=P.OPEN_WAKA,D.startTagPosition=D.position):_(N)||(V(D,"Non-whitespace before first tag."),D.textNode=N,D.state=P.TEXT)}function J(D,N){var z="";return N<D.length&&(z=D.charAt(N)),z}function ne(D){var N=this;if(this.error)throw this.error;if(N.closed)return q(N,"Cannot write after close. Assign an onready handler.");if(D===null)return Z(N);typeof D=="object"&&(D=D.toString());for(var z=0,H="";H=J(D,z++),N.c=H,!!H;)switch(N.trackPosition&&(N.position++,H===`
`?(N.line++,N.column=0):N.column++),N.state){case P.BEGIN:if(N.state=P.BEGIN_WHITESPACE,H==="\uFEFF")continue;L(N,H);continue;case P.BEGIN_WHITESPACE:L(N,H);continue;case P.TEXT:if(N.sawRoot&&!N.closedRoot){for(var oe=z-1;H&&H!=="<"&&H!=="&";)H=J(D,z++),H&&N.trackPosition&&(N.position++,H===`
`?(N.line++,N.column=0):N.column++);N.textNode+=D.substring(oe,z-1)}H==="<"&&!(N.sawRoot&&N.closedRoot&&!N.strict)?(N.state=P.OPEN_WAKA,N.startTagPosition=N.position):(!_(H)&&(!N.sawRoot||N.closedRoot)&&V(N,"Text data outside of root node."),H==="&"?N.state=P.TEXT_ENTITY:N.textNode+=H);continue;case P.SCRIPT:H==="<"?N.state=P.SCRIPT_ENDING:N.script+=H;continue;case P.SCRIPT_ENDING:H==="/"?N.state=P.CLOSE_TAG:(N.script+="<"+H,N.state=P.SCRIPT);continue;case P.OPEN_WAKA:if(H==="!")N.state=P.SGML_DECL,N.sgmlDecl="";else if(!_(H))if(O(h,H))N.state=P.OPEN_TAG,N.tagName=H;else if(H==="/")N.state=P.CLOSE_TAG,N.tagName="";else if(H==="?")N.state=P.PROC_INST,N.procInstName=N.procInstBody="";else{if(V(N,"Unencoded <"),N.startTagPosition+1<N.position){var Q=N.position-N.startTagPosition;H=new Array(Q).join(" ")+H}N.textNode+="<"+H,N.state=P.TEXT}continue;case P.SGML_DECL:(N.sgmlDecl+H).toUpperCase()===c?(A(N,"onopencdata"),N.state=P.CDATA,N.sgmlDecl="",N.cdata=""):N.sgmlDecl+H==="--"?(N.state=P.COMMENT,N.comment="",N.sgmlDecl=""):(N.sgmlDecl+H).toUpperCase()===d?(N.state=P.DOCTYPE,(N.doctype||N.sawRoot)&&V(N,"Inappropriately located doctype declaration"),N.doctype="",N.sgmlDecl=""):H===">"?(A(N,"onsgmldeclaration",N.sgmlDecl),N.sgmlDecl="",N.state=P.TEXT):(w(H)&&(N.state=P.SGML_DECL_QUOTED),N.sgmlDecl+=H);continue;case P.SGML_DECL_QUOTED:H===N.q&&(N.state=P.SGML_DECL,N.q=""),N.sgmlDecl+=H;continue;case P.DOCTYPE:H===">"?(N.state=P.TEXT,A(N,"ondoctype",N.doctype),N.doctype=!0):(N.doctype+=H,H==="["?N.state=P.DOCTYPE_DTD:w(H)&&(N.state=P.DOCTYPE_QUOTED,N.q=H));continue;case P.DOCTYPE_QUOTED:N.doctype+=H,H===N.q&&(N.q="",N.state=P.DOCTYPE);continue;case P.DOCTYPE_DTD:N.doctype+=H,H==="]"?N.state=P.DOCTYPE:w(H)&&(N.state=P.DOCTYPE_DTD_QUOTED,N.q=H);continue;case P.DOCTYPE_DTD_QUOTED:N.doctype+=H,H===N.q&&(N.state=P.DOCTYPE_DTD,N.q="");continue;case P.COMMENT:H==="-"?N.state=P.COMMENT_ENDING:N.comment+=H;continue;case P.COMMENT_ENDING:H==="-"?(N.state=P.COMMENT_ENDED,N.comment=k(N.opt,N.comment),N.comment&&A(N,"oncomment",N.comment),N.comment=""):(N.comment+="-"+H,N.state=P.COMMENT);continue;case P.COMMENT_ENDED:H!==">"?(V(N,"Malformed comment"),N.comment+="--"+H,N.state=P.COMMENT):N.state=P.TEXT;continue;case P.CDATA:H==="]"?N.state=P.CDATA_ENDING:N.cdata+=H;continue;case P.CDATA_ENDING:H==="]"?N.state=P.CDATA_ENDING_2:(N.cdata+="]"+H,N.state=P.CDATA);continue;case P.CDATA_ENDING_2:H===">"?(N.cdata&&A(N,"oncdata",N.cdata),A(N,"onclosecdata"),N.cdata="",N.state=P.TEXT):H==="]"?N.cdata+="]":(N.cdata+="]]"+H,N.state=P.CDATA);continue;case P.PROC_INST:H==="?"?N.state=P.PROC_INST_ENDING:_(H)?N.state=P.PROC_INST_BODY:N.procInstName+=H;continue;case P.PROC_INST_BODY:if(!N.procInstBody&&_(H))continue;H==="?"?N.state=P.PROC_INST_ENDING:N.procInstBody+=H;continue;case P.PROC_INST_ENDING:H===">"?(A(N,"onprocessinginstruction",{name:N.procInstName,body:N.procInstBody}),N.procInstName=N.procInstBody="",N.state=P.TEXT):(N.procInstBody+="?"+H,N.state=P.PROC_INST_BODY);continue;case P.OPEN_TAG:O(y,H)?N.tagName+=H:(Y(N),H===">"?re(N):H==="/"?N.state=P.OPEN_TAG_SLASH:(_(H)||V(N,"Invalid character in tag name"),N.state=P.ATTRIB));continue;case P.OPEN_TAG_SLASH:H===">"?(re(N,!0),ue(N)):(V(N,"Forward-slash in opening tag not followed by >"),N.state=P.ATTRIB);continue;case P.ATTRIB:if(_(H))continue;H===">"?re(N):H==="/"?N.state=P.OPEN_TAG_SLASH:O(h,H)?(N.attribName=H,N.attribValue="",N.state=P.ATTRIB_NAME):V(N,"Invalid attribute name");continue;case P.ATTRIB_NAME:H==="="?N.state=P.ATTRIB_VALUE:H===">"?(V(N,"Attribute without value"),N.attribValue=N.attribName,W(N),re(N)):_(H)?N.state=P.ATTRIB_NAME_SAW_WHITE:O(y,H)?N.attribName+=H:V(N,"Invalid attribute name");continue;case P.ATTRIB_NAME_SAW_WHITE:if(H==="=")N.state=P.ATTRIB_VALUE;else{if(_(H))continue;V(N,"Attribute without value"),N.tag.attributes[N.attribName]="",N.attribValue="",A(N,"onattribute",{name:N.attribName,value:""}),N.attribName="",H===">"?re(N):O(h,H)?(N.attribName=H,N.state=P.ATTRIB_NAME):(V(N,"Invalid attribute name"),N.state=P.ATTRIB)}continue;case P.ATTRIB_VALUE:if(_(H))continue;w(H)?(N.q=H,N.state=P.ATTRIB_VALUE_QUOTED):(V(N,"Unquoted attribute value"),N.state=P.ATTRIB_VALUE_UNQUOTED,N.attribValue=H);continue;case P.ATTRIB_VALUE_QUOTED:if(H!==N.q){H==="&"?N.state=P.ATTRIB_VALUE_ENTITY_Q:N.attribValue+=H;continue}W(N),N.q="",N.state=P.ATTRIB_VALUE_CLOSED;continue;case P.ATTRIB_VALUE_CLOSED:_(H)?N.state=P.ATTRIB:H===">"?re(N):H==="/"?N.state=P.OPEN_TAG_SLASH:O(h,H)?(V(N,"No whitespace between attributes"),N.attribName=H,N.attribValue="",N.state=P.ATTRIB_NAME):V(N,"Invalid attribute name");continue;case P.ATTRIB_VALUE_UNQUOTED:if(!T(H)){H==="&"?N.state=P.ATTRIB_VALUE_ENTITY_U:N.attribValue+=H;continue}W(N),H===">"?re(N):N.state=P.ATTRIB;continue;case P.CLOSE_TAG:if(N.tagName)H===">"?ue(N):O(y,H)?N.tagName+=H:N.script?(N.script+="</"+N.tagName,N.tagName="",N.state=P.SCRIPT):(_(H)||V(N,"Invalid tagname in closing tag"),N.state=P.CLOSE_TAG_SAW_WHITE);else{if(_(H))continue;E(h,H)?N.script?(N.script+="</"+H,N.state=P.SCRIPT):V(N,"Invalid tagname in closing tag."):N.tagName=H}continue;case P.CLOSE_TAG_SAW_WHITE:if(_(H))continue;H===">"?ue(N):V(N,"Invalid characters in closing tag");continue;case P.TEXT_ENTITY:case P.ATTRIB_VALUE_ENTITY_Q:case P.ATTRIB_VALUE_ENTITY_U:var de,fe;switch(N.state){case P.TEXT_ENTITY:de=P.TEXT,fe="textNode";break;case P.ATTRIB_VALUE_ENTITY_Q:de=P.ATTRIB_VALUE_QUOTED,fe="attribValue";break;case P.ATTRIB_VALUE_ENTITY_U:de=P.ATTRIB_VALUE_UNQUOTED,fe="attribValue";break}if(H===";")if(N.opt.unparsedEntities){var De=le(N);N.entity="",N.state=de,N.write(De)}else N[fe]+=le(N),N.entity="",N.state=de;else O(N.entity.length?b:g,H)?N.entity+=H:(V(N,"Invalid character in entity name"),N[fe]+="&"+N.entity+H,N.entity="",N.state=de);continue;default:throw new Error(N,"Unknown state: "+N.state)}return N.position>=N.bufferCheckPosition&&n(N),N}return String.fromCodePoint||function(){var D=String.fromCharCode,N=Math.floor,z=function(){var H=16384,oe=[],Q,de,fe=-1,De=arguments.length;if(!De)return"";for(var st="";++fe<De;){var Le=Number(arguments[fe]);if(!isFinite(Le)||Le<0||Le>1114111||N(Le)!==Le)throw RangeError("Invalid code point: "+Le);Le<=65535?oe.push(Le):(Le-=65536,Q=(Le>>10)+55296,de=Le%1024+56320,oe.push(Q,de)),(fe+1===De||oe.length>H)&&(st+=D.apply(null,oe),oe.length=0)}return st};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:z,configurable:!0,writable:!0}):String.fromCodePoint=z}(),t},G_n=K_n()});var _At=v(()=>{ZQ();ZL();lWe();bAt()});var nO=v(()=>{zo();CQ();yJ();ZL();mAt();hAt();gAt();yAt();cWe();_At()});var oO,vJ=v(()=>{_g();oO=class extends Ti{constructor(e){super(e);x(this,"lc_serializable",!0);x(this,"lc_namespace",["langchain_core","prompts",this._getPromptType()]);x(this,"inputVariables");x(this,"outputParser");x(this,"partialVariables");x(this,"metadata");x(this,"tags");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)}get lc_attributes(){return{partialVariables:void 0}}async mergePartialAndUserVariables(e){let r=this.partialVariables??{},n={};for(let[o,i]of Object.entries(r))typeof i=="string"?n[o]=i:n[o]=await i();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"})}}});var dWe,sge,uge,vAt,Hee=v(()=>{zo();DL();LL();TC();dWe=class extends b_{},sge=class extends dWe{constructor(e){super({value:e});x(this,"lc_namespace",["langchain_core","prompt_values"]);x(this,"lc_serializable",!0);x(this,"value");this.value=e}static lc_name(){return"StringPromptValue"}toString(){return this.value}toChatMessages(){return[new Au(this.value)]}},uge=class extends dWe{constructor(e){Array.isArray(e)&&(e={messages:e});super(e);x(this,"lc_namespace",["langchain_core","prompt_values"]);x(this,"lc_serializable",!0);x(this,"messages");this.messages=e.messages}static lc_name(){return"ChatPromptValue"}toString(){return Ll(this.messages)}toChatMessages(){return this.messages}},vAt=class extends dWe{constructor(e){"imageUrl"in e||(e={imageUrl:e});super(e);x(this,"lc_namespace",["langchain_core","prompt_values"]);x(this,"lc_serializable",!0);x(this,"imageUrl");x(this,"value");this.imageUrl=e.imageUrl}static lc_name(){return"ImagePromptValue"}toString(){return this.imageUrl.url}toChatMessages(){return[new Au({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var f4,Wee=v(()=>{Hee();vJ();f4=class extends oO{async formatPromptValue(t){return new sge(await this.format(t))}}});function pWe(t){return typeof t=="function"}function Z_n(t){return SJ(t)?"array":typeof t}function fWe(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function wAt(t,e){return t!=null&&typeof t=="object"&&e in t}function Y_n(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function evn(t,e){return Q_n.call(t,e)}function rvn(t){return!evn(tvn,t)}function ovn(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return nvn[r]})}function lvn(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(P){if(typeof P=="string"&&(P=P.split(avn,2)),!SJ(P)||P.length!==2)throw new Error("Invalid tags: "+P);d=new RegExp(fWe(P[0])+"\\s*"),f=new RegExp("\\s*"+fWe(P[1])),p=new RegExp("\\s*"+fWe("}"+P[1]))}m(e||xS.tags);for(var h=new Kee(t),y,g,b,_,w,T;!h.eos();){if(y=h.pos,b=h.scanUntil(d),b)for(var O=0,E=b.length;O<E;++O)_=b.charAt(O),rvn(_)?(i.push(o.length),u+=_):(s=!0,r=!0,u+=" "),o.push(["text",_,y,y+1]),y+=1,_===`
`&&(c(),u="",l=0,r=!1);if(!h.scan(d))break;if(a=!0,g=h.scan(uvn)||"name",h.scan(ivn),g==="="?(b=h.scanUntil(SAt),h.scan(SAt),h.scanUntil(f)):g==="{"?(b=h.scanUntil(p),h.scan(svn),h.scanUntil(f),g="&"):b=h.scanUntil(f),!h.scan(f))throw new Error("Unclosed tag at "+h.pos);if(g==">"?w=[g,b,y,h.pos,u,l,r]:w=[g,b,y,h.pos],l++,o.push(w),g==="#"||g==="^")n.push(w);else if(g==="/"){if(T=n.pop(),!T)throw new Error('Unopened section "'+b+'" at '+y);if(T[1]!==b)throw new Error('Unclosed section "'+T[1]+'" at '+y)}else g==="name"||g==="{"||g==="&"?s=!0:g==="="&&m(b)}if(c(),T=n.pop(),T)throw new Error('Unclosed section "'+T[1]+'" at '+h.pos);return dvn(cvn(o))}function cvn(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 dvn(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 Kee(t){this.string=t,this.tail=t,this.pos=0}function wJ(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Ob(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}var X_n,SJ,Q_n,tvn,nvn,ivn,avn,SAt,svn,uvn,xS,Jee,lge,CAt=v(()=>{X_n=Object.prototype.toString,SJ=Array.isArray||function(e){return X_n.call(e)==="[object Array]"};Q_n=RegExp.prototype.test;tvn=/\S/;nvn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};ivn=/\s*/,avn=/\s+/,SAt=/\s*=/,svn=/\s*\}/,uvn=/#|\^|\/|>|\{|&|=|!/;Kee.prototype.eos=function(){return this.tail===""};Kee.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};Kee.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};wJ.prototype.push=function(e){return new wJ(e,this)};wJ.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=wAt(i,a[s])||Y_n(i,a[s])),i=i[a[s++]];else i=o.view[e],u=wAt(o.view,e);if(u){n=i;break}o=o.parent}r[e]=n}return pWe(n)&&(n=n.call(this.view)),n};Ob.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Ob.prototype.parse=function(e,r){var n=this.templateCache,o=e+":"+(r||xS.tags).join(":"),i=typeof n<"u",a=i?n.get(o):void 0;return a==null&&(a=lvn(e,r),i&&n.set(o,a)),a};Ob.prototype.render=function(e,r,n,o){var i=this.getConfigTags(o),a=this.parse(e,i),s=r instanceof wJ?r:new wJ(r,void 0);return this.renderTokens(a,s,n,e,o)};Ob.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};Ob.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(SJ(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(pWe(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}};Ob.prototype.renderInverted=function(e,r,n,o,i){var a=r.lookup(e[1]);if(!a||SJ(a)&&a.length===0)return this.renderTokens(e[4],r,n,o,i)};Ob.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(`
`)};Ob.prototype.renderPartial=function(e,r,n,o){if(n){var i=this.getConfigTags(o),a=pWe(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)}}};Ob.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};Ob.prototype.escapedValue=function(e,r,n){var o=this.getConfigEscape(n)||xS.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===xS.escape?String(i):o(i)};Ob.prototype.rawValue=function(e){return e[1]};Ob.prototype.getConfigTags=function(e){return SJ(e)?e:e&&typeof e=="object"?e.tags:void 0};Ob.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!SJ(e))return e.escape};xS={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){Jee.templateCache=t},get templateCache(){return Jee.templateCache}},Jee=new Ob;xS.clearCache=function(){return Jee.clearCache()};xS.parse=function(e,r){return Jee.parse(e,r)};xS.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Z_n(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Jee.render(e,r,n,o)};xS.escape=ovn;xS.Scanner=Kee;xS.Context=wJ;xS.Writer=Ob;lge=xS});function xAt(){lge.escape=t=>t}var CJ,TAt,Gee,OAt,EAt,cge,PAt,tw,xJ,TJ,p4=v(()=>{F6();CAt();CJ=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},TAt=(t,e=[])=>{let r=[];for(let n of t)if(n[0]==="name"){let o=n[1].includes(".")?n[1].split(".")[0]:n[1];r.push({type:"variable",name:o})}else if(["#","&","^",">"].includes(n[0])){if(r.push({type:"variable",name:n[1]}),n[0]==="#"&&n.length>4&&Array.isArray(n[4])){let o=[...e,n[1]],i=TAt(n[4],o);r.push(...i)}}else r.push({type:"literal",text:n[1]});return r},Gee=t=>(xAt(),TAt(lge.parse(t))),OAt=(t,e)=>CJ(t).reduce((r,n)=>{if(n.type==="variable"){if(n.name in e)return r+(typeof e[n.name]=="string"?e[n.name]:JSON.stringify(e[n.name]));throw new Error(`(f-string) Missing value for input ${n.name}`)}return r+n.text},""),EAt=(t,e)=>(xAt(),lge.render(t,e)),cge={"f-string":OAt,mustache:EAt},PAt={"f-string":CJ,mustache:Gee},tw=(t,e,r)=>{try{return cge[e](t,r)}catch(n){throw AL(n,"INVALID_PROMPT_INPUT")}},xJ=(t,e)=>PAt[e](t),TJ=(t,e,r)=>{if(!(e in cge)){let n=Object.keys(cge);throw new Error(`Invalid template format. Got \`${e}\`;
                         should be one of ${n}`)}try{let n=Object.fromEntries(r.map(o=>[o,"foo"]));Array.isArray(t)?t.forEach(o=>{if(o.type==="text"&&"text"in o&&typeof o.text=="string")tw(o.text,e,n);else if(o.type==="image_url"){if(typeof o.image_url=="string")tw(o.image_url,e,n);else if(typeof o.image_url=="object"&&o.image_url!==null&&"url"in o.image_url&&typeof o.image_url.url=="string"){let i=o.image_url.url;tw(i,e,n)}}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):tw(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var Ku,dge=v(()=>{Wee();p4();Ku=class Xee extends f4{constructor(r){super(r);x(this,"template");x(this,"templateFormat","f-string");x(this,"validateTemplate",!0);x(this,"additionalContentFields");if(r.templateFormat==="mustache"&&r.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,r),this.validateTemplate){if(this.templateFormat==="mustache")throw new Error("Mustache templates cannot be validated.");let n=this.inputVariables;this.partialVariables&&(n=n.concat(Object.keys(this.partialVariables))),TJ(this.template,this.templateFormat,n)}}static lc_name(){return"PromptTemplate"}_getPromptType(){return"prompt"}async format(r){let n=await this.mergePartialAndUserVariables(r);return tw(this.template,this.templateFormat,n)}static fromExamples(r,n,o,i=`

`,a=""){return new Xee({inputVariables:o,template:[a,...r,n].join(i)})}static fromTemplate(r,n){let{templateFormat:o="f-string",...i}=n??{},a=new Set;return xJ(r,o).forEach(s=>{s.type==="variable"&&a.add(s.name)}),new Xee({inputVariables:[...a],templateFormat:o,template:r,...i})}async partial(r){let n=this.inputVariables.filter(i=>!(i in r)),o={...this.partialVariables??{},...r};return new Xee({...this,inputVariables:n,partialVariables: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(r){if(!r.template)throw new Error("Prompt template must have a template");return new Xee({inputVariables:r.input_variables,template:r.template,templateFormat:r.template_format})}}});var Zee,mWe=v(()=>{Hee();vJ();p4();Zee=class MAt extends oO{constructor(r){super(r);x(this,"lc_namespace",["langchain_core","prompts","image"]);x(this,"template");x(this,"templateFormat","f-string");x(this,"validateTemplate",!0);x(this,"additionalContentFields");if(this.template=r.template,this.templateFormat=r.templateFormat??this.templateFormat,this.validateTemplate=r.validateTemplate??this.validateTemplate,this.additionalContentFields=r.additionalContentFields,this.validateTemplate){let n=this.inputVariables;this.partialVariables&&(n=n.concat(Object.keys(this.partialVariables))),TJ([{type:"image_url",image_url:this.template}],this.templateFormat,n)}}static lc_name(){return"ImagePromptTemplate"}_getPromptType(){return"prompt"}async partial(r){let n=this.inputVariables.filter(i=>!(i in r)),o={...this.partialVariables??{},...r};return new MAt({...this,inputVariables:n,partialVariables:o})}async format(r){let n={};for(let[s,u]of Object.entries(this.template))typeof u=="string"?n[s]=tw(u,this.templateFormat,r):n[s]=u;let o=r.url||n.url,i=r.detail||n.detail;if(!o)throw new Error("Must provide either an image URL.");if(typeof o!="string")throw new Error("url must be a string.");let a={url:o};return i&&(a.detail=i),a}async formatPromptValue(r){return new vAt(await this.format(r))}}});function hWe(t,e){let r=[];for(let n of Object.values(t))if(typeof n=="string")xJ(n,e).forEach(o=>{o.type==="variable"&&r.push(o.name)});else if(Array.isArray(n))for(let o of n)typeof o=="string"?xJ(o,e).forEach(i=>{i.type==="variable"&&r.push(i.name)}):typeof o=="object"&&r.push(...hWe(o,e));else typeof n=="object"&&n!==null&&r.push(...hWe(n,e));return Array.from(new Set(r))}function gWe(t,e,r){let n={};for(let[o,i]of Object.entries(t))if(typeof i=="string")n[o]=tw(i,r,e);else if(Array.isArray(i)){let a=[];for(let s of i)typeof s=="string"?a.push(tw(s,r,e)):typeof s=="object"&&a.push(gWe(s,e,r));n[o]=a}else typeof i=="object"&&i!==null?n[o]=gWe(i,e,r):n[o]=i;return n}var fge,yWe=v(()=>{_g();p4();fge=class extends Ti{constructor(e){let r=e.templateFormat??"f-string",n=hWe(e.template,r);super({inputVariables:n,...e});x(this,"lc_namespace",["langchain_core","prompts","dict"]);x(this,"lc_serializable",!0);x(this,"template");x(this,"templateFormat");x(this,"inputVariables");this.template=e.template,this.templateFormat=r,this.inputVariables=n}static lc_name(){return"DictPromptTemplate"}async format(e){return gWe(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}}});function fvn(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).length===1&&"text"in t&&typeof t.text=="string"}function pvn(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 mvn(t){return typeof t.formatMessages=="function"}function hvn(t,e){if(mvn(t)||pS(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)==="}}")return new QN({variableName:o.slice(2,-2),optional:!0});if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}")return new QN({variableName:o.slice(1,-1),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=OC(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 rw.fromTemplate(n,e);if(r._getType()==="ai")return vWe.fromTemplate(n,e);if(r._getType()==="system")return $C.fromTemplate(n,e);if(hy.isInstance(r))return IAt.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function gvn(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var mge,QN,RAt,bWe,IAt,_We,rw,vWe,$C,Eb,Yee=v(()=>{F6();my();mS();RQ();LL();IQ();TC();_g();ra();Hee();vJ();Wee();p4();dge();mWe();yWe();mge=class extends Ti{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","prompts","chat"]);x(this,"lc_serializable",!0)}async invoke(e,r){return this._callWithConfig(n=>this.formatMessages(n),e,{...r,runType:"prompt"})}},QN=class extends mge{constructor(e){typeof e=="string"&&(e={variableName:e});super(e);x(this,"variableName");x(this,"optional");this.variableName=e.variableName,this.optional=e.optional??!1}static lc_name(){return"MessagesPlaceholder"}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(OC):n=[OC(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}},RAt=class extends mge{constructor(e){"prompt"in e||(e={prompt:e});super(e);x(this,"prompt");this.prompt=e.prompt}get inputVariables(){return this.prompt.inputVariables}async formatMessages(e){return[await this.format(e)]}},bWe=class extends oO{constructor(t){super(t)}async format(t){return(await this.formatPromptValue(t)).toString()}async formatPromptValue(t){return new uge(await this.formatMessages(t))}},IAt=class extends RAt{constructor(e,r){"prompt"in e||(e={prompt:e,role:r});super(e);x(this,"role");this.role=e.role}static lc_name(){return"ChatMessagePromptTemplate"}async format(e){return new hy(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this(Ku.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}};_We=class extends mge{constructor(e,r){"prompt"in e||(e={prompt:e});super(e);x(this,"lc_namespace",["langchain_core","prompts","chat"]);x(this,"lc_serializable",!0);x(this,"inputVariables",[]);x(this,"additionalOptions",{});x(this,"prompt");x(this,"messageClass");x(this,"chatMessageClass");if(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}static _messageClass(){throw new Error("Can not invoke _messageClass from inside _StringImageMessagePromptTemplate")}createMessage(e){let r=this.constructor;if(r._messageClass())return new(r._messageClass())({content:e});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(Ku.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string")n.push(Ku.fromTemplate(o,r));else if(o!==null)if(fvn(o)){let i="";typeof o.text=="string"&&(i=o.text??"");let a={...r,additionalContentFields:o};n.push(Ku.fromTemplate(i,a))}else if(pvn(o)){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=Gee(i):u=CJ(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 Zee({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=Gee(i.url):u=CJ(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new Zee({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 fge({template:o,templateFormat:r?.templateFormat}));return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof f4){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 f4){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),i!==""&&r.push({...a,type:"text",text:i})}else if(n instanceof Zee){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 fge){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)]}},rw=class extends _We{static _messageClass(){return Au}static lc_name(){return"HumanMessagePromptTemplate"}},vWe=class extends _We{static _messageClass(){return uo}static lc_name(){return"AIMessagePromptTemplate"}},$C=class extends _We{static _messageClass(){return v_}static lc_name(){return"SystemMessagePromptTemplate"}};Eb=class pge extends bWe{constructor(r){super(r);x(this,"promptMessages");x(this,"validateTemplate",!0);x(this,"templateFormat","f-string");if(r.templateFormat==="mustache"&&r.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,r),this.validateTemplate){let n=new Set;for(let u of this.promptMessages)if(!(u instanceof Sm))for(let l of u.inputVariables)n.add(l);let o=this.inputVariables,i=new Set(this.partialVariables?o.concat(Object.keys(this.partialVariables)):o),a=new Set([...i].filter(u=>!n.has(u)));if(a.size>0)throw new Error(`Input variables \`${[...a]}\` are not used in any of the prompt messages.`);let s=new Set([...n].filter(u=>!i.has(u)));if(s.size>0)throw new Error(`Input variables \`${[...s]}\` are used in prompt messages but not in the prompt template.`)}}static lc_name(){return"ChatPromptTemplate"}get lc_aliases(){return{promptMessages:"messages"}}_getPromptType(){return"chat"}async _parseImagePrompts(r,n){return typeof r.content=="string"||(r.content=await Promise.all(r.content.map(async o=>{if(o.type!=="image_url")return o;let i="";typeof o.image_url=="string"?i=o.image_url:typeof o.image_url=="object"&&o.image_url!==null&&"url"in o.image_url&&typeof o.image_url.url=="string"&&(i=o.image_url.url);let a=await Ku.fromTemplate(i,{templateFormat:this.templateFormat}).format(n);return typeof o.image_url=="object"&&o.image_url!==null&&"url"in o.image_url?o.image_url.url=a:o.image_url=a,o}))),r}async formatMessages(r){let n=await this.mergePartialAndUserVariables(r),o=[];for(let i of this.promptMessages)if(i instanceof Sm)o.push(await this._parseImagePrompts(i,n));else{let a;this.templateFormat==="mustache"?a={...n}:a=i.inputVariables.reduce((u,l)=>{if(!(l in n)&&!(gvn(i)&&i.optional))throw AL(new Error(`Missing value for input variable \`${l.toString()}\``),"INVALID_PROMPT_INPUT");return u[l]=n[l],u},{});let s=await i.formatMessages(a);o=o.concat(s)}return o}async partial(r){let n=this.inputVariables.filter(i=>!(i in r)),o={...this.partialVariables??{},...r};return new pge({...this,inputVariables:n,partialVariables:o})}static fromTemplate(r,n){let o=new rw({prompt:Ku.fromTemplate(r,n)});return this.fromMessages([o])}static fromMessages(r,n){let o=r.reduce((s,u)=>s.concat(u instanceof pge?u.promptMessages:[hvn(u,n)]),[]),i=r.reduce((s,u)=>u instanceof pge?Object.assign(s,u.partialVariables):s,Object.create(null)),a=new Set;for(let s of o)if(!(s instanceof Sm))for(let u of s.inputVariables)u in i||a.add(u);return new this({...n,inputVariables:[...a],promptMessages:o,partialVariables:i,templateFormat:n?.templateFormat})}}});var AAt=v(()=>{Wee();p4();dge();Yee()});var NAt=v(()=>{vJ();Yee()});var DAt=v(()=>{_g();Yee()});var TS=v(()=>{zo();vJ();Wee();p4();dge();mWe();yWe();Yee();AAt();NAt();DAt()});var yvn,OJ,hge=v(()=>{yvn=Object.defineProperty,OJ=(t,e)=>{for(var r in e)yvn(t,r,{get:e[r],enumerable:!0})}});var bvn,Qee,wWe=v(()=>{hge();bvn={};OJ(bvn,{formatDocumentsAsString:()=>Qee});Qee=t=>t.map(e=>e.pageContent).join(`

`)});function yc(t,e){let r=`atom${++_vn}`,n={toString(){return(kl.env?kl.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=vvn,n.write=wvn),e&&(n.write=e),n}function vvn(t){return t(this)}function wvn(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var kl,_vn,jAt,SWe,CWe,yge,TWe,Svn,Cvn,OWe,$At,gge,kAt,LAt,EJ,xWe,xvn,Tvn,FAt,YL,qAt,QL,ete,BAt,EWe=v(()=>{kl={},_vn=0;jAt=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,SWe=t=>"init"in t,CWe=t=>!!t.write,yge=new WeakMap,TWe=t=>{var e;return OWe(t)&&!((e=yge.get(t))!=null&&e[1])},Svn=(t,e)=>{let r=yge.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((kl.env?kl.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},Cvn=t=>{if(yge.has(t))return;let e=[new Set,!1];yge.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},OWe=t=>typeof t?.then=="function",$At=t=>"v"in t||"e"in t,gge=t=>{if("e"in t)throw t.e;if((kl.env?kl.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},kAt=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},LAt=(t,e,r,n,o)=>{var i;if((kl.env?kl.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),TWe(r.v)&&kAt(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&xvn(t,n,e)},EJ=()=>[new Map,new Map,new Set],xWe=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},xvn=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},Tvn=(t,e)=>t[0].get(e),FAt=(t,e)=>{t[2].add(e)},YL=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},qAt=(...[t,e,r,n])=>{let o;(kl.env?kl.env.MODE:void 0)!=="production"&&(o=new Set);let i=(_,w,T)=>{let O="v"in w,E=w.v,P=TWe(w.v)?w.v:null;if(OWe(T)){Cvn(T);for(let R of w.d.keys())kAt(_,T,t(R));w.v=T,delete w.e}else w.v=T,delete w.e;(!O||!Object.is(E,w.v))&&(++w.n,P&&Svn(P,T))},a=(_,w,T)=>{var O;let E=t(w);if($At(E)&&(E.m&&!T?.has(w)||Array.from(E.d).every(([k,q])=>a(_,k,T).n===q)))return E;E.d.clear();let P=!0,R=k=>{if(jAt(w,k)){let Z=t(k);if(!$At(Z))if(SWe(k))i(k,Z,k.init);else throw new Error("no atom init");return gge(Z)}let q=a(_,k,T);try{return gge(q)}finally{if(P)LAt(_,w,E,k,q);else{let Z=EJ();LAt(Z,w,E,k,q),p(Z,w,E),YL(Z)}}},I,A,B={get signal(){return I||(I=new AbortController),I.signal},get setSelf(){return(kl.env?kl.env.MODE:void 0)!=="production"&&!CWe(w)&&console.warn("setSelf function cannot be used with read-only atom"),!A&&CWe(w)&&(A=(...k)=>{if((kl.env?kl.env.MODE:void 0)!=="production"&&P&&console.warn("setSelf function cannot be called in sync"),!P)return f(w,...k)}),A}};try{let k=e(w,R,B);if(i(w,E,k),OWe(k)){(O=k.onCancel)==null||O.call(k,()=>I?.abort());let q=()=>{if(E.m){let Z=EJ();p(Z,w,E),YL(Z)}};k.then(q,q)}return E}catch(k){return delete E.v,E.e=k,++E.n,E}finally{P=!1}},s=_=>gge(a(void 0,_)),u=(_,w,T)=>{var O,E;let P=new Map;for(let R of((O=T.m)==null?void 0:O.t)||[])P.set(R,t(R));for(let R of T.p)P.set(R,t(R));return(E=Tvn(_,w))==null||E.forEach(R=>{P.set(R,t(R))}),P};function l(_,w,T){let O=[],E=new Set,P=new Set,R=[[w,T]];for(;R.length>0;){let[I,A]=R[R.length-1];if(P.has(I)){R.pop();continue}if(E.has(I)){O.push([I,A,A.n]),P.add(I),R.pop();continue}E.add(I);for(let[B,k]of u(_,I,A))I!==B&&!E.has(B)&&R.push([B,k])}return[O,P]}let c=(_,w,T)=>{let[O,E]=l(_,w,T),P=new Set([w]);for(let R=O.length-1;R>=0;--R){let[I,A,B]=O[R],k=!1;for(let q of A.d.keys())if(q!==I&&P.has(q)){k=!0;break}k&&(a(_,I,E),p(_,I,A),B!==A.n&&(xWe(_,I,A),P.add(I))),E.delete(I)}},d=(_,w,...T)=>{let O=!0,E=R=>gge(a(_,R)),P=(R,...I)=>{let A=t(R);try{if(jAt(w,R)){if(!SWe(R))throw new Error("atom not writable");let B=A.n,k=I[0];i(R,A,k),p(_,R,A),B!==A.n&&(xWe(_,R,A),c(_,R,A));return}else return d(_,R,...I)}finally{O||YL(_)}};try{return r(w,E,P,...T)}finally{O=!1}},f=(_,...w)=>{let T=EJ();try{return d(T,_,...w)}finally{YL(T)}},p=(_,w,T)=>{if(T.m&&!TWe(T.v)){for(let O of T.d.keys())T.m.d.has(O)||(m(_,O,t(O)).t.add(w),T.m.d.add(O));for(let O of T.m.d||[])if(!T.d.has(O)){T.m.d.delete(O);let E=h(_,O,t(O));E?.t.delete(w)}}},m=(_,w,T)=>{if(!T.m){a(_,w);for(let O of T.d.keys())m(_,O,t(O)).t.add(w);if(T.m={l:new Set,d:new Set(T.d.keys()),t:new Set},(kl.env?kl.env.MODE:void 0)!=="production"&&o.add(w),CWe(w)){let O=T.m,E,P=(R,I)=>{let A=!0;E=(...B)=>{try{return d(R,w,...B)}finally{A||YL(R)}};try{return I()}finally{A=!1}};FAt(_,()=>{let R=P(_,()=>n(w,(...I)=>E(...I)));R&&(O.u=I=>P(I,R))})}}return T.m},h=(_,w,T)=>{if(T.m&&!T.m.l.size&&!Array.from(T.m.t).some(O=>{var E;return(E=t(O).m)==null?void 0:E.d.has(w)})){let O=T.m.u;O&&FAt(_,()=>O(_)),delete T.m,(kl.env?kl.env.MODE:void 0)!=="production"&&o.delete(w);for(let E of T.d.keys()){let P=h(_,E,t(E));P?.t.delete(w)}return}return T.m},b={get:s,set:f,sub:(_,w)=>{let T=EJ(),O=t(_),P=m(T,_,O).l;return P.add(w),YL(T),()=>{P.delete(w);let R=EJ();h(R,_,O),YL(R)}},unstable_derive:_=>qAt(..._(t,e,r,n))};return(kl.env?kl.env.MODE:void 0)!=="production"&&Object.assign(b,{dev4_get_internal_weak_map:()=>({get:w=>{let T=t(w);if(T.n!==0)return T}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:w=>{let T=EJ();for(let[O,E]of w)if(SWe(O)){let P=t(O),R=P.n;i(O,P,E),p(T,O,P),R!==P.n&&(xWe(T,O,P),c(T,O,P))}YL(T)}}),b},QL=()=>{let t=new WeakMap;return qAt(r=>{if((kl.env?kl.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)})},BAt=()=>(ete||(ete=QL(),(kl.env?kl.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=ete),globalThis.__JOTAI_DEFAULT_STORE__!==ete&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),ete)});var YAt=S($i=>{"use strict";var tte=Symbol.for("react.element"),Ovn=Symbol.for("react.portal"),Evn=Symbol.for("react.fragment"),Pvn=Symbol.for("react.strict_mode"),Mvn=Symbol.for("react.profiler"),Rvn=Symbol.for("react.provider"),Ivn=Symbol.for("react.context"),Avn=Symbol.for("react.forward_ref"),Nvn=Symbol.for("react.suspense"),Dvn=Symbol.for("react.memo"),jvn=Symbol.for("react.lazy"),UAt=Symbol.iterator;function $vn(t){return t===null||typeof t!="object"?null:(t=UAt&&t[UAt]||t["@@iterator"],typeof t=="function"?t:null)}var HAt={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},WAt=Object.assign,JAt={};function PJ(t,e,r){this.props=t,this.context=e,this.refs=JAt,this.updater=r||HAt}PJ.prototype.isReactComponent={};PJ.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")};PJ.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function KAt(){}KAt.prototype=PJ.prototype;function MWe(t,e,r){this.props=t,this.context=e,this.refs=JAt,this.updater=r||HAt}var RWe=MWe.prototype=new KAt;RWe.constructor=MWe;WAt(RWe,PJ.prototype);RWe.isPureReactComponent=!0;var zAt=Array.isArray,GAt=Object.prototype.hasOwnProperty,IWe={current:null},XAt={key:!0,ref:!0,__self:!0,__source:!0};function ZAt(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)GAt.call(e,n)&&!XAt.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:tte,type:t,key:i,ref:a,props:o,_owner:IWe.current}}function Lvn(t,e){return{$$typeof:tte,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function AWe(t){return typeof t=="object"&&t!==null&&t.$$typeof===tte}function Fvn(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var VAt=/\/+/g;function PWe(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Fvn(""+t.key):e.toString(36)}function _ge(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 tte:case Ovn:a=!0}}if(a)return a=t,o=o(a),t=n===""?"."+PWe(a,0):n,zAt(o)?(r="",t!=null&&(r=t.replace(VAt,"$&/")+"/"),_ge(o,e,r,"",function(l){return l})):o!=null&&(AWe(o)&&(o=Lvn(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(VAt,"$&/")+"/")+t)),e.push(o)),1;if(a=0,n=n===""?".":n+":",zAt(t))for(var s=0;s<t.length;s++){i=t[s];var u=n+PWe(i,s);a+=_ge(i,e,r,u,o)}else if(u=$vn(t),typeof u=="function")for(t=u.call(t),s=0;!(i=t.next()).done;)i=i.value,u=n+PWe(i,s++),a+=_ge(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 bge(t,e,r){if(t==null)return t;var n=[],o=0;return _ge(t,n,"","",function(i){return e.call(r,i,o++)}),n}function kvn(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 Pb={current:null},vge={transition:null},qvn={ReactCurrentDispatcher:Pb,ReactCurrentBatchConfig:vge,ReactCurrentOwner:IWe};$i.Children={map:bge,forEach:function(t,e,r){bge(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return bge(t,function(){e++}),e},toArray:function(t){return bge(t,function(e){return e})||[]},only:function(t){if(!AWe(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};$i.Component=PJ;$i.Fragment=Evn;$i.Profiler=Mvn;$i.PureComponent=MWe;$i.StrictMode=Pvn;$i.Suspense=Nvn;$i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qvn;$i.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=WAt({},t.props),o=t.key,i=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,a=IWe.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(u in e)GAt.call(e,u)&&!XAt.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:tte,type:t.type,key:o,ref:i,props:n,_owner:a}};$i.createContext=function(t){return t={$$typeof:Ivn,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:Rvn,_context:t},t.Consumer=t};$i.createElement=ZAt;$i.createFactory=function(t){var e=ZAt.bind(null,t);return e.type=t,e};$i.createRef=function(){return{current:null}};$i.forwardRef=function(t){return{$$typeof:Avn,render:t}};$i.isValidElement=AWe;$i.lazy=function(t){return{$$typeof:jvn,_payload:{_status:-1,_result:t},_init:kvn}};$i.memo=function(t,e){return{$$typeof:Dvn,type:t,compare:e===void 0?null:e}};$i.startTransition=function(t){var e=vge.transition;vge.transition={};try{t()}finally{vge.transition=e}};$i.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};$i.useCallback=function(t,e){return Pb.current.useCallback(t,e)};$i.useContext=function(t){return Pb.current.useContext(t)};$i.useDebugValue=function(){};$i.useDeferredValue=function(t){return Pb.current.useDeferredValue(t)};$i.useEffect=function(t,e){return Pb.current.useEffect(t,e)};$i.useId=function(){return Pb.current.useId()};$i.useImperativeHandle=function(t,e,r){return Pb.current.useImperativeHandle(t,e,r)};$i.useInsertionEffect=function(t,e){return Pb.current.useInsertionEffect(t,e)};$i.useLayoutEffect=function(t,e){return Pb.current.useLayoutEffect(t,e)};$i.useMemo=function(t,e){return Pb.current.useMemo(t,e)};$i.useReducer=function(t,e,r){return Pb.current.useReducer(t,e,r)};$i.useRef=function(t){return Pb.current.useRef(t)};$i.useState=function(t){return Pb.current.useState(t)};$i.useSyncExternalStore=function(t,e,r){return Pb.current.useSyncExternalStore(t,e,r)};$i.useTransition=function(){return Pb.current.useTransition()};$i.version="18.2.0"});var K=S((yUi,QAt)=>{"use strict";QAt.exports=YAt()});function I_(t,e){let r=tNt(e),[[n,o,i],a]=(0,Cy.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,Cy.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);DWe(c)&&rNt(eNt(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,Cy.useDebugValue)(s),DWe(s)){let l=eNt(s);return Uvn(l)}return s}function nNt(t,e){let r=tNt(e);return(0,Cy.useCallback)((...o)=>{if((wge.env?wge.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function e1(t,e){return[I_(t,e),nNt(t,e)]}var Cy,wge,Bvn,tNt,DWe,rNt,Uvn,NWe,eNt,oNt=v(()=>{"use client";Cy=$(K(),1);EWe();wge={},Bvn=(0,Cy.createContext)(void 0),tNt=t=>{let e=(0,Cy.useContext)(Bvn);return t?.store||e||BAt()},DWe=t=>typeof t?.then=="function",rNt=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},Uvn=Cy.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(rNt(t),t)}),NWe=new WeakMap,eNt=t=>{let e=NWe.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((wge.env?wge.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");DWe(l)?(NWe.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),NWe.set(t,e)),e}});var LC=v(()=>{EWe();oNt()});function RJ(t){return typeof t=="string"&&zvn.includes(t)}function Vvn(t){return typeof t=="string"?t.trim():""}function Sge(t){if(typeof t=="number"&&Number.isFinite(t)&&t>0)return t;if(typeof t=="string"){let e=Number(t);if(Number.isFinite(e)&&e>0)return e;let r=Date.parse(t);if(Number.isFinite(r))return r}return null}function Hvn(t,e){let r=new Intl.Collator(void 0),n=u=>Vvn(e.getName(u)),o=u=>{let l=e.getCreatedAtMs(u);return Number.isFinite(l)?l:0},i=u=>{let l=o(u);return Sge(e.getLastUsedAtMs(u))??l},a=typeof e.getManualOrder=="function"?u=>{let l=e.getManualOrder?.(u);return typeof l=="number"&&Number.isFinite(l)?l:0}:null,s=t==="manual"&&!a?"name":t;return(u,l)=>{let c=n(u),d=n(l),f=o(u),p=o(l),m=i(u),h=i(l);if(s==="manual"){let _=a(u),w=a(l);if(_!==w)return _-w}else if(s==="name"){let _=r.compare(c,d);if(_!==0)return _}else if(s==="created"){let _=p-f;if(_!==0)return _}else{let _=h-m;if(_!==0)return _}let y=r.compare(c,d);if(y!==0)return y;let g=p-f;if(g!==0)return g;let b=h-m;return b!==0?b:0}}function iO(t,e,r){return[...t].sort(Hvn(e,r))}var zvn,MJ,t1=v(()=>{zvn=["recent","created","name","manual"];MJ=class{constructor(e={}){this.lastTouchedAtMsByKey=new Map;this.lastPersistedAtMsByKey=new Map;this.revision=0;this.listeners=new Set;this.minIntervalMs=e.minIntervalMs??3e4,this.nowMs=e.nowMs??(()=>Date.now())}notifyChange(){this.revision+=1;for(let e of this.listeners)e()}getRevision(){return this.revision}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}touch(e){let r=this.nowMs();return this.lastTouchedAtMsByKey.set(e,r),this.notifyChange(),r}shouldPersist(e,r){let n=this.lastTouchedAtMsByKey.get(e);if(!n)return null;let o=Sge(r),i=this.lastPersistedAtMsByKey.get(e),a=Math.max(o??0,i??0);return a===0?n:n-a<this.minIntervalMs?null:n}markPersisted(e,r){let n=Sge(r);if(!n)return;let o=this.lastPersistedAtMsByKey.get(e)??0;this.lastPersistedAtMsByKey.set(e,Math.max(o,n))}getLastTouchedAt(e){return this.lastTouchedAtMsByKey.get(e)??null}getEffectiveLastUsedAt(e,r){let n=this.lastTouchedAtMsByKey.get(e),o=Sge(r);return Math.max(n??0,o??0)}clear(e){if(e){this.lastTouchedAtMsByKey.delete(e),this.lastPersistedAtMsByKey.delete(e),this.notifyChange();return}this.lastTouchedAtMsByKey.clear(),this.lastPersistedAtMsByKey.clear(),this.notifyChange()}}});var r1={};En(r1,{getModelKeyFromModel:()=>no,getSettings:()=>ee,resetSettings:()=>jWe,sanitizeQaExclusions:()=>aNt,sanitizeSettings:()=>$We,setSettings:()=>A_,settingsAtom:()=>eF,settingsStore:()=>jo,subscribeToSettingsChange:()=>ml,updateSetting:()=>Re,useSettingsValue:()=>kr});function Wvn(t){let e=new Set((t.activeEmbeddingModels||[]).map(r=>no(r)));return t.embeddingModelKey&&e.has(t.embeddingModelKey)?t.embeddingModelKey:Do.embeddingModelKey}function A_(t){let e=Jvn({...ee(),...t});e.embeddingModelKey=Wvn(e),jo.set(eF,e)}function aNt(t){let r=(typeof t=="string"?t:LWe).split(",").map(o=>decodeURIComponent(o.trim())).filter(o=>o.length>0),n=new Map;return r.forEach(o=>{let i=o.replace(/\/+$/,""),a=i.length>0?i:o;if(a===FC){n.set(FC,FC);return}if(!n.has(a)){let s=i.length>0&&o.endsWith("/")?`${i}/`:o;n.set(a,s)}}),n.set(FC,FC),Array.from(n.values()).map(o=>encodeURIComponent(o)).join(",")}function Re(t,e){let r=ee();A_({...r,[t]:e})}function ee(){return jo.get(eF)}function jWe(){let t={...Do,activeModels:aO.map(e=>({...e,enabled:!0})),activeEmbeddingModels:m4.map(e=>({...e,enabled:!0}))};A_(t)}function ml(t){let e=ee();return jo.sub(eF,()=>{let r=ee();t(e,r),e=r})}function kr(){return I_(eF,{store:jo})}function $We(t){let e=t||Do,r=e,{enableSelfHostedSearch:n,selfHostedSearchUrl:o,selfHostedSearchApiKey:i,enableMiyoSearch:a}=r;e.userId||(e.userId=gu()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(E=>({...E,provider:E.provider==="azure_openai"?"azure openai":E.provider})):e.activeEmbeddingModels=m4.map(E=>({...E,enabled:!0}));let s={...e},u=s;delete u.miyoRemoteVaultPath,delete u.miyoVaultName,delete u.enableMiyoSearch,n!==void 0&&s.enableSelfHostMode===void 0&&(s.enableSelfHostMode=n),o!==void 0&&!s.selfHostUrl&&(s.selfHostUrl=o),i!==void 0&&!s.selfHostApiKey&&(s.selfHostApiKey=i),a!==void 0&&s.enableMiyo===void 0&&(s.enableMiyo=a);let l=Number(e.temperature);s.temperature=isNaN(l)?Do.temperature:l;let c=Number(e.maxTokens);s.maxTokens=isNaN(c)?Do.maxTokens:c;let d=Number(e.contextTurns);s.contextTurns=isNaN(d)?Do.contextTurns:d;let f=Number(e.embeddingRequestsPerMin);s.embeddingRequestsPerMin=isNaN(f)?Do.embeddingRequestsPerMin:f;let p=Number(e.embeddingBatchSize);s.embeddingBatchSize=isNaN(p)?Do.embeddingBatchSize:p;let m=Number(e.lexicalSearchRamLimit);if(isNaN(m)?s.lexicalSearchRamLimit=Do.lexicalSearchRamLimit:s.lexicalSearchRamLimit=Math.min(1e3,Math.max(20,m)),typeof s.autoAddActiveContentToContext!="boolean"){let E=e.includeActiveNoteAsContext;typeof E=="boolean"?s.autoAddActiveContentToContext=E:s.autoAddActiveContentToContext=Do.autoAddActiveContentToContext}typeof s.generateAIChatTitleOnSave!="boolean"&&(s.generateAIChatTitleOnSave=Do.generateAIChatTitleOnSave),typeof s.enableMiyo!="boolean"&&(s.enableMiyo=Do.enableMiyo),typeof s.miyoSearchAll!="boolean"&&(s.miyoSearchAll=Do.miyoSearchAll),typeof s.miyoServerUrl!="string"&&(s.miyoServerUrl=Do.miyoServerUrl),["firecrawl","perplexity"].includes(s.selfHostSearchProvider)||(s.selfHostSearchProvider=Do.selfHostSearchProvider),typeof s.passMarkdownImages!="boolean"&&(s.passMarkdownImages=Do.passMarkdownImages),typeof s.enableInlineCitations!="boolean"&&(s.enableInlineCitations=Do.enableInlineCitations),typeof s.enableCustomPromptTemplating!="boolean"&&(s.enableCustomPromptTemplating=Do.enableCustomPromptTemplating);let y=Number(e.autonomousAgentMaxIterations);isNaN(y)||y<4||y>Cge?s.autonomousAgentMaxIterations=Do.autonomousAgentMaxIterations:s.autonomousAgentMaxIterations=y,Array.isArray(s.autonomousAgentEnabledToolIds)||(s.autonomousAgentEnabledToolIds=Do.autonomousAgentEnabledToolIds);let g={writeToFile:"writeFile",replaceInFile:"editFile"};s.autonomousAgentEnabledToolIds=s.autonomousAgentEnabledToolIds.map(E=>g[E]??E),(!s.memoryFolderName||typeof s.memoryFolderName!="string")&&(s.memoryFolderName=Do.memoryFolderName),typeof s.enableRecentConversations!="boolean"&&(s.enableRecentConversations=Do.enableRecentConversations),typeof s.enableSavedMemory!="boolean"&&(s.enableSavedMemory=Do.enableSavedMemory);let b=Number(e.maxRecentConversations);isNaN(b)||b<10||b>50?s.maxRecentConversations=Do.maxRecentConversations:s.maxRecentConversations=b,typeof s.autosaveChat!="boolean"&&(s.autosaveChat=Do.autosaveChat);let _=Number(e.autoCompactThreshold);if(isNaN(_)?s.autoCompactThreshold=Do.autoCompactThreshold:s.autoCompactThreshold=Math.min(1e6,Math.max(64e3,_)),typeof s.quickCommandIncludeNoteContext!="boolean"&&(s.quickCommandIncludeNoteContext=Do.quickCommandIncludeNoteContext),e.quickCommandModelKey!==void 0&&typeof e.quickCommandModelKey!="string"&&(s.quickCommandModelKey=Do.quickCommandModelKey),typeof s.autoAddSelectionToContext!="boolean"){let E=e.autoIncludeTextSelection;typeof E=="boolean"?s.autoAddSelectionToContext=E:s.autoAddSelectionToContext=Do.autoAddSelectionToContext}typeof s.autoAcceptEdits!="boolean"&&(s.autoAcceptEdits=Do.autoAcceptEdits),Object.values(IJ).includes(s.defaultSendShortcut)||(s.defaultSendShortcut=Do.defaultSendShortcut);let w=(e.defaultSaveFolder||"").trim();s.defaultSaveFolder=w.length>0?w:Do.defaultSaveFolder;let T=(e.customPromptsFolder||"").trim();s.customPromptsFolder=T.length>0?T:Do.customPromptsFolder,(!RJ(s.chatHistorySortStrategy)||s.chatHistorySortStrategy==="manual")&&(s.chatHistorySortStrategy=Do.chatHistorySortStrategy),(!RJ(s.projectListSortStrategy)||s.projectListSortStrategy==="manual")&&(s.projectListSortStrategy=Do.projectListSortStrategy);let O=(e.userSystemPromptsFolder||"").trim();return s.userSystemPromptsFolder=O.length>0?O:Do.userSystemPromptsFolder,s.qaExclusions=aNt(e.qaExclusions),s}function Jvn(t){return t.activeModels=iNt(t.activeModels,aO),t.activeEmbeddingModels=Kvn(iNt(t.activeEmbeddingModels,m4)),t}function no(t){return`${t.name}|${t.provider}`}function iNt(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(no(n),{...n})}),t.forEach(n=>{let o=no(n),i=r.get(o);if(i){let a=e.find(s=>s.name===n.name&&s.provider===n.provider);a?r.set(o,{...a,...n,isBuiltIn:!0,believerExclusive:a.believerExclusive}):r.set(o,{...n,isBuiltIn:i.isBuiltIn})}else r.set(o,n)}),Array.from(r.values())}function Kvn(t){let e=new Set(Object.values(kC));return t.filter(r=>e.has(r.provider))}var jo,eF,Qe=v(()=>{LC();y_();t1();gr();jo=QL(),eF=yc(Do)});function Wr(t,e=!1){try{if(t instanceof Error){let n=t?.cause instanceof Error?t.cause.message:t?.cause?String(t.cause):"",o=e&&t.stack?t.stack:"",i=[t.message];return n&&i.push(`more message: ${n}`),o&&i.push(o),i.join(`
`)}return JSON.stringify(t)??String(t)}catch{return String(t)}}var FWe=v(()=>{});var kWe,Em,h4=v(()=>{FWe();Dt();Qe();kWe=class t{constructor(){this.maxLines=500;this.maxLineChars=8e3;this.buffer=[];this.initialized=!1;this.flushing=!1}static getInstance(){return t.instance||(t.instance=new t),t.instance}getLogPath(){return"copilot/copilot-log.md"}async ensureInitialized(){this.initialized||(this.initialized=!0)}hasVault(){try{return typeof app<"u"&&!!app.vault?.adapter}catch{return!1}}sanitizeForSingleLine(e){if(e instanceof Error){let r=Wr(e,!0);return this.escapeAngleBrackets(this.collapseToSingleLine(r))}if(typeof e=="string")return this.escapeAngleBrackets(this.collapseToSingleLine(e));try{let r=JSON.stringify(e);return this.escapeAngleBrackets(this.collapseToSingleLine(r??String(e)))}catch{return this.escapeAngleBrackets(this.collapseToSingleLine(String(e)))}}collapseToSingleLine(e){let r=e.replace(/[\r\n]+/g,"\\n").replace(/\t/g," ");return r.length<=this.maxLineChars?r:r.slice(0,this.maxLineChars)+` \u2026 [truncated ${r.length-this.maxLineChars} chars]`}async append(e,...r){await this.ensureInitialized();let n=new Date().toISOString(),o=r.map(a=>this.sanitizeForSingleLine(a)),i=`${n} ${e} ${o.join(" ")}`.trim();this.buffer.push(i),this.buffer.length>this.maxLines&&this.buffer.splice(0,this.buffer.length-this.maxLines)}escapeAngleBrackets(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;")}async appendMarkdownBlock(e){if(await this.ensureInitialized(),!(!Array.isArray(e)||e.length===0))for(let r of e){let n=typeof r=="string"?r:String(r??"");this.buffer.push(n),this.buffer.length>this.maxLines&&this.buffer.splice(0,this.buffer.length-this.maxLines)}}async flush(){if(this.hasVault()&&!this.flushing){this.flushing=!0;try{let e=this.getLogPath();if(await app.vault.adapter.exists(e)){let r=this.buffer.join(`
`)+(this.buffer.length?`
`:"");await app.vault.adapter.write(e,r)}}catch{}finally{this.flushing=!1}}}async clear(){if(this.buffer=[],!!this.hasVault())try{let e=this.getLogPath();await app.vault.adapter.exists(e)&&await app.vault.adapter.remove(e)}catch{}}sanitizeSettingsForLog(){let e=ee();return this.removeKeysRecursive(e)}removeKeysRecursive(e){if(e==null)return e;if(Array.isArray(e))return e.map(r=>this.removeKeysRecursive(r));if(typeof e=="object"&&e.constructor===Object){let r={},n=e;for(let[o,i]of Object.entries(n))/apiKey$/i.test(o)||/licenseKey$/i.test(o)||/_api_key$/i.test(o)||/_license_key$/i.test(o)||/orgId$/i.test(o)||/instanceName$/i.test(o)||/deploymentName$/i.test(o)||/apiVersion$/i.test(o)||(r[o]=this.removeKeysRecursive(i));return r}return e}async openLogFile(){if(!this.hasVault())return;let e=this.getLogPath(),r=[...this.buffer];try{let o=this.sanitizeSettingsForLog(),a=["","## Settings","```json",...JSON.stringify(o,null,2).split(`
`),"```"];r.push(...a)}catch{}try{let o=r.join(`
`)+(r.length?`
`:""),i=e.includes("/")?e.split("/").slice(0,-1).join("/"):"";i&&await ql(i),await app.vault.adapter.exists(e)?await app.vault.adapter.write(e,o):await app.vault.create(e,o)}catch{}let n=app.vault.getAbstractFileByPath(e);try{n&&await app.workspace.getLeaf(!0).openFile(n)}catch{}}},Em=kWe.getInstance()});function F(...t){ee().debug&&console.log(...t),Em.append("INFO",...t)}function ie(...t){ee().debug&&console.error(...t),Em.append("ERROR",...t)}function Ce(...t){ee().debug&&console.warn(...t),Em.append("WARN",...t)}function xge(t){Em.appendMarkdownBlock(t)}function sNt(t,e){if(ee().debug)try{if(typeof console.table=="function"){Array.isArray(e)&&e.length>0?console.table(t,e):console.table(t);return}}catch{}F("Table:",JSON.stringify(t))}var Xe=v(()=>{Qe();h4()});var uNt=S((qWe,AJ)=>{(function(t,e){typeof qWe=="object"&&typeof AJ<"u"?AJ.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(qWe,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(C){t=C}function n(C){return C instanceof Array||Object.prototype.toString.call(C)==="[object Array]"}function o(C){return C!=null&&Object.prototype.toString.call(C)==="[object Object]"}function i(C,M){return Object.prototype.hasOwnProperty.call(C,M)}function a(C){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(C).length===0;var M;for(M in C)if(i(C,M))return!1;return!0}function s(C){return C===void 0}function u(C){return typeof C=="number"||Object.prototype.toString.call(C)==="[object Number]"}function l(C){return C instanceof Date||Object.prototype.toString.call(C)==="[object Date]"}function c(C,M){var j=[],U,G=C.length;for(U=0;U<G;++U)j.push(M(C[U],U));return j}function d(C,M){for(var j in M)i(M,j)&&(C[j]=M[j]);return i(M,"toString")&&(C.toString=M.toString),i(M,"valueOf")&&(C.valueOf=M.valueOf),C}function f(C,M,j,U){return _0t(C,M,j,U,!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(C){return C._pf==null&&(C._pf=p()),C._pf}var h;Array.prototype.some?h=Array.prototype.some:h=function(C){var M=Object(this),j=M.length>>>0,U;for(U=0;U<j;U++)if(U in M&&C.call(this,M[U],U,M))return!0;return!1};function y(C){if(C._isValid==null){var M=m(C),j=h.call(M.parsedDateParts,function(G){return G!=null}),U=!isNaN(C._d.getTime())&&M.overflow<0&&!M.empty&&!M.invalidEra&&!M.invalidMonth&&!M.invalidWeekday&&!M.weekdayMismatch&&!M.nullInput&&!M.invalidFormat&&!M.userInvalidated&&(!M.meridiem||M.meridiem&&j);if(C._strict&&(U=U&&M.charsLeftOver===0&&M.unusedTokens.length===0&&M.bigHour===void 0),Object.isFrozen==null||!Object.isFrozen(C))C._isValid=U;else return U}return C._isValid}function g(C){var M=f(NaN);return C!=null?d(m(M),C):m(M).userInvalidated=!0,M}var b=e.momentProperties=[],_=!1;function w(C,M){var j,U,G,pe=b.length;if(s(M._isAMomentObject)||(C._isAMomentObject=M._isAMomentObject),s(M._i)||(C._i=M._i),s(M._f)||(C._f=M._f),s(M._l)||(C._l=M._l),s(M._strict)||(C._strict=M._strict),s(M._tzm)||(C._tzm=M._tzm),s(M._isUTC)||(C._isUTC=M._isUTC),s(M._offset)||(C._offset=M._offset),s(M._pf)||(C._pf=m(M)),s(M._locale)||(C._locale=M._locale),pe>0)for(j=0;j<pe;j++)U=b[j],G=M[U],s(G)||(C[U]=G);return C}function T(C){w(this,C),this._d=new Date(C._d!=null?C._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),_===!1&&(_=!0,e.updateOffset(this),_=!1)}function O(C){return C instanceof T||C!=null&&C._isAMomentObject!=null}function E(C){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+C)}function P(C,M){var j=!0;return d(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,C),j){var U=[],G,pe,Fe,sn=arguments.length;for(pe=0;pe<sn;pe++){if(G="",typeof arguments[pe]=="object"){G+=`
[`+pe+"] ";for(Fe in arguments[0])i(arguments[0],Fe)&&(G+=Fe+": "+arguments[0][Fe]+", ");G=G.slice(0,-2)}else G=arguments[pe];U.push(G)}E(C+`
Arguments: `+Array.prototype.slice.call(U).join("")+`
`+new Error().stack),j=!1}return M.apply(this,arguments)},M)}var R={};function I(C,M){e.deprecationHandler!=null&&e.deprecationHandler(C,M),R[C]||(E(M),R[C]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function A(C){return typeof Function<"u"&&C instanceof Function||Object.prototype.toString.call(C)==="[object Function]"}function B(C){var M,j;for(j in C)i(C,j)&&(M=C[j],A(M)?this[j]=M:this["_"+j]=M);this._config=C,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function k(C,M){var j=d({},C),U;for(U in M)i(M,U)&&(o(C[U])&&o(M[U])?(j[U]={},d(j[U],C[U]),d(j[U],M[U])):M[U]!=null?j[U]=M[U]:delete j[U]);for(U in C)i(C,U)&&!i(M,U)&&o(C[U])&&(j[U]=d({},j[U]));return j}function q(C){C!=null&&this.set(C)}var Z;Object.keys?Z=Object.keys:Z=function(C){var M,j=[];for(M in C)i(C,M)&&j.push(M);return j};var V={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function Y(C,M,j){var U=this._calendar[C]||this._calendar.sameElse;return A(U)?U.call(M,j):U}function X(C,M,j){var U=""+Math.abs(C),G=M-U.length,pe=C>=0;return(pe?j?"+":"":"-")+Math.pow(10,Math.max(0,G)).toString().substr(1)+U}var W=/(\[[^\[]*\])|(\\)?([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,re=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,ue={},le={};function L(C,M,j,U){var G=U;typeof U=="string"&&(G=function(){return this[U]()}),C&&(le[C]=G),M&&(le[M[0]]=function(){return X(G.apply(this,arguments),M[1],M[2])}),j&&(le[j]=function(){return this.localeData().ordinal(G.apply(this,arguments),C)})}function J(C){return C.match(/\[[\s\S]/)?C.replace(/^\[|\]$/g,""):C.replace(/\\/g,"")}function ne(C){var M=C.match(W),j,U;for(j=0,U=M.length;j<U;j++)le[M[j]]?M[j]=le[M[j]]:M[j]=J(M[j]);return function(G){var pe="",Fe;for(Fe=0;Fe<U;Fe++)pe+=A(M[Fe])?M[Fe].call(G,C):M[Fe];return pe}}function D(C,M){return C.isValid()?(M=N(M,C.localeData()),ue[M]=ue[M]||ne(M),ue[M](C)):C.localeData().invalidDate()}function N(C,M){var j=5;function U(G){return M.longDateFormat(G)||G}for(re.lastIndex=0;j>=0&&re.test(C);)C=C.replace(re,U),re.lastIndex=0,j-=1;return C}var z={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 H(C){var M=this._longDateFormat[C],j=this._longDateFormat[C.toUpperCase()];return M||!j?M:(this._longDateFormat[C]=j.match(W).map(function(U){return U==="MMMM"||U==="MM"||U==="DD"||U==="dddd"?U.slice(1):U}).join(""),this._longDateFormat[C])}var oe="Invalid date";function Q(){return this._invalidDate}var de="%d",fe=/\d{1,2}/;function De(C){return this._ordinal.replace("%d",C)}var st={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Le(C,M,j,U){var G=this._relativeTime[j];return A(G)?G(C,M,j,U):G.replace(/%d/i,C)}function Bt(C,M){var j=this._relativeTime[C>0?"future":"past"];return A(j)?j(M):j.replace(/%s/i,M)}var Pt={};function Nt(C,M){var j=C.toLowerCase();Pt[j]=Pt[j+"s"]=Pt[M]=C}function $e(C){return typeof C=="string"?Pt[C]||Pt[C.toLowerCase()]:void 0}function Fr(C){var M={},j,U;for(U in C)i(C,U)&&(j=$e(U),j&&(M[j]=C[U]));return M}var ft={};function Ve(C,M){ft[C]=M}function Rt(C){var M=[],j;for(j in C)i(C,j)&&M.push({unit:j,priority:ft[j]});return M.sort(function(U,G){return U.priority-G.priority}),M}function ze(C){return C%4===0&&C%100!==0||C%400===0}function He(C){return C<0?Math.ceil(C)||0:Math.floor(C)}function We(C){var M=+C,j=0;return M!==0&&isFinite(M)&&(j=He(M)),j}function Jt(C,M){return function(j){return j!=null?(au(this,C,j),e.updateOffset(this,M),this):so(this,C)}}function so(C,M){return C.isValid()?C._d["get"+(C._isUTC?"UTC":"")+M]():NaN}function au(C,M,j){C.isValid()&&!isNaN(j)&&(M==="FullYear"&&ze(C.year())&&C.month()===1&&C.date()===29?(j=We(j),C._d["set"+(C._isUTC?"UTC":"")+M](j,C.month(),lpe(j,C.month()))):C._d["set"+(C._isUTC?"UTC":"")+M](j))}function An(C){return C=$e(C),A(this[C])?this[C]():this}function _i(C,M){if(typeof C=="object"){C=Fr(C);var j=Rt(C),U,G=j.length;for(U=0;U<G;U++)this[j[U].unit](C[j[U].unit])}else if(C=$e(C),A(this[C]))return this[C](M);return this}var Nl=/\d/,Vi=/\d\d/,g_=/\d{3}/,mg=/\d{4}/,cS=/[+-]?\d{6}/,ji=/\d\d?/,LT=/\d\d\d\d?/,SC=/\d\d\d\d\d\d?/,dS=/\d{1,3}/,Xs=/\d{1,4}/,Dl=/[+-]?\d{1,6}/,Iu=/\d+/,wm=/[+-]?\d+/,_d=/Z|[+-]\d\d:?\d\d/gi,sl=/Z|[+-]\d\d(?::?\d\d)?/gi,nt=/[+-]?\d+(\.\d{1,3})?/,Nr=/[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,Ue;Ue={};function Ee(C,M,j){Ue[C]=A(M)?M:function(U,G){return U&&j?j:M}}function Mt(C,M){return i(Ue,C)?Ue[C](M._strict,M._locale):new RegExp(Yt(C))}function Yt(C){return Ln(C.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(M,j,U,G,pe){return j||U||G||pe}))}function Ln(C){return C.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var ul={};function xi(C,M){var j,U=M,G;for(typeof C=="string"&&(C=[C]),u(M)&&(U=function(pe,Fe){Fe[M]=We(pe)}),G=C.length,j=0;j<G;j++)ul[C[j]]=U}function zv(C,M){xi(C,function(j,U,G,pe){G._w=G._w||{},M(j,G._w,G,pe)})}function PL(C,M,j){M!=null&&i(ul,C)&&ul[C](M,j._a,j,C)}var Sh=0,CC=1,Vv=2,jl=3,gb=4,Hv=5,TN=6,San=7,Can=8;function xan(C,M){return(C%M+M)%M}var ed;Array.prototype.indexOf?ed=Array.prototype.indexOf:ed=function(C){var M;for(M=0;M<this.length;++M)if(this[M]===C)return M;return-1};function lpe(C,M){if(isNaN(C)||isNaN(M))return NaN;var j=xan(M,12);return C+=(M-j)/12,j===1?ze(C)?29:28:31-j%7%2}L("M",["MM",2],"Mo",function(){return this.month()+1}),L("MMM",0,0,function(C){return this.localeData().monthsShort(this,C)}),L("MMMM",0,0,function(C){return this.localeData().months(this,C)}),Nt("month","M"),Ve("month",8),Ee("M",ji),Ee("MM",ji,Vi),Ee("MMM",function(C,M){return M.monthsShortRegex(C)}),Ee("MMMM",function(C,M){return M.monthsRegex(C)}),xi(["M","MM"],function(C,M){M[CC]=We(C)-1}),xi(["MMM","MMMM"],function(C,M,j,U){var G=j._locale.monthsParse(C,U,j._strict);G!=null?M[CC]=G:m(j).invalidMonth=C});var Tan="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),o0t="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),i0t=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Oan=Nr,Ean=Nr;function Pan(C,M){return C?n(this._months)?this._months[C.month()]:this._months[(this._months.isFormat||i0t).test(M)?"format":"standalone"][C.month()]:n(this._months)?this._months:this._months.standalone}function Man(C,M){return C?n(this._monthsShort)?this._monthsShort[C.month()]:this._monthsShort[i0t.test(M)?"format":"standalone"][C.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Ran(C,M,j){var U,G,pe,Fe=C.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],U=0;U<12;++U)pe=f([2e3,U]),this._shortMonthsParse[U]=this.monthsShort(pe,"").toLocaleLowerCase(),this._longMonthsParse[U]=this.months(pe,"").toLocaleLowerCase();return j?M==="MMM"?(G=ed.call(this._shortMonthsParse,Fe),G!==-1?G:null):(G=ed.call(this._longMonthsParse,Fe),G!==-1?G:null):M==="MMM"?(G=ed.call(this._shortMonthsParse,Fe),G!==-1?G:(G=ed.call(this._longMonthsParse,Fe),G!==-1?G:null)):(G=ed.call(this._longMonthsParse,Fe),G!==-1?G:(G=ed.call(this._shortMonthsParse,Fe),G!==-1?G:null))}function Ian(C,M,j){var U,G,pe;if(this._monthsParseExact)return Ran.call(this,C,M,j);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),U=0;U<12;U++){if(G=f([2e3,U]),j&&!this._longMonthsParse[U]&&(this._longMonthsParse[U]=new RegExp("^"+this.months(G,"").replace(".","")+"$","i"),this._shortMonthsParse[U]=new RegExp("^"+this.monthsShort(G,"").replace(".","")+"$","i")),!j&&!this._monthsParse[U]&&(pe="^"+this.months(G,"")+"|^"+this.monthsShort(G,""),this._monthsParse[U]=new RegExp(pe.replace(".",""),"i")),j&&M==="MMMM"&&this._longMonthsParse[U].test(C))return U;if(j&&M==="MMM"&&this._shortMonthsParse[U].test(C))return U;if(!j&&this._monthsParse[U].test(C))return U}}function a0t(C,M){var j;if(!C.isValid())return C;if(typeof M=="string"){if(/^\d+$/.test(M))M=We(M);else if(M=C.localeData().monthsParse(M),!u(M))return C}return j=Math.min(C.date(),lpe(C.year(),M)),C._d["set"+(C._isUTC?"UTC":"")+"Month"](M,j),C}function s0t(C){return C!=null?(a0t(this,C),e.updateOffset(this,!0),this):so(this,"Month")}function Aan(){return lpe(this.year(),this.month())}function Nan(C){return this._monthsParseExact?(i(this,"_monthsRegex")||u0t.call(this),C?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=Oan),this._monthsShortStrictRegex&&C?this._monthsShortStrictRegex:this._monthsShortRegex)}function Dan(C){return this._monthsParseExact?(i(this,"_monthsRegex")||u0t.call(this),C?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=Ean),this._monthsStrictRegex&&C?this._monthsStrictRegex:this._monthsRegex)}function u0t(){function C(Fe,sn){return sn.length-Fe.length}var M=[],j=[],U=[],G,pe;for(G=0;G<12;G++)pe=f([2e3,G]),M.push(this.monthsShort(pe,"")),j.push(this.months(pe,"")),U.push(this.months(pe,"")),U.push(this.monthsShort(pe,""));for(M.sort(C),j.sort(C),U.sort(C),G=0;G<12;G++)M[G]=Ln(M[G]),j[G]=Ln(j[G]);for(G=0;G<24;G++)U[G]=Ln(U[G]);this._monthsRegex=new RegExp("^("+U.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+j.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+M.join("|")+")","i")}L("Y",0,0,function(){var C=this.year();return C<=9999?X(C,4):"+"+C}),L(0,["YY",2],0,function(){return this.year()%100}),L(0,["YYYY",4],0,"year"),L(0,["YYYYY",5],0,"year"),L(0,["YYYYYY",6,!0],0,"year"),Nt("year","y"),Ve("year",1),Ee("Y",wm),Ee("YY",ji,Vi),Ee("YYYY",Xs,mg),Ee("YYYYY",Dl,cS),Ee("YYYYYY",Dl,cS),xi(["YYYYY","YYYYYY"],Sh),xi("YYYY",function(C,M){M[Sh]=C.length===2?e.parseTwoDigitYear(C):We(C)}),xi("YY",function(C,M){M[Sh]=e.parseTwoDigitYear(C)}),xi("Y",function(C,M){M[Sh]=parseInt(C,10)});function gQ(C){return ze(C)?366:365}e.parseTwoDigitYear=function(C){return We(C)+(We(C)>68?1900:2e3)};var l0t=Jt("FullYear",!0);function jan(){return ze(this.year())}function $an(C,M,j,U,G,pe,Fe){var sn;return C<100&&C>=0?(sn=new Date(C+400,M,j,U,G,pe,Fe),isFinite(sn.getFullYear())&&sn.setFullYear(C)):sn=new Date(C,M,j,U,G,pe,Fe),sn}function yQ(C){var M,j;return C<100&&C>=0?(j=Array.prototype.slice.call(arguments),j[0]=C+400,M=new Date(Date.UTC.apply(null,j)),isFinite(M.getUTCFullYear())&&M.setUTCFullYear(C)):M=new Date(Date.UTC.apply(null,arguments)),M}function cpe(C,M,j){var U=7+M-j,G=(7+yQ(C,0,U).getUTCDay()-M)%7;return-G+U-1}function c0t(C,M,j,U,G){var pe=(7+j-U)%7,Fe=cpe(C,U,G),sn=1+7*(M-1)+pe+Fe,di,hu;return sn<=0?(di=C-1,hu=gQ(di)+sn):sn>gQ(C)?(di=C+1,hu=sn-gQ(C)):(di=C,hu=sn),{year:di,dayOfYear:hu}}function bQ(C,M,j){var U=cpe(C.year(),M,j),G=Math.floor((C.dayOfYear()-U-1)/7)+1,pe,Fe;return G<1?(Fe=C.year()-1,pe=G+ON(Fe,M,j)):G>ON(C.year(),M,j)?(pe=G-ON(C.year(),M,j),Fe=C.year()+1):(Fe=C.year(),pe=G),{week:pe,year:Fe}}function ON(C,M,j){var U=cpe(C,M,j),G=cpe(C+1,M,j);return(gQ(C)-U+G)/7}L("w",["ww",2],"wo","week"),L("W",["WW",2],"Wo","isoWeek"),Nt("week","w"),Nt("isoWeek","W"),Ve("week",5),Ve("isoWeek",5),Ee("w",ji),Ee("ww",ji,Vi),Ee("W",ji),Ee("WW",ji,Vi),zv(["w","ww","W","WW"],function(C,M,j,U){M[U.substr(0,1)]=We(C)});function Lan(C){return bQ(C,this._week.dow,this._week.doy).week}var Fan={dow:0,doy:6};function kan(){return this._week.dow}function qan(){return this._week.doy}function Ban(C){var M=this.localeData().week(this);return C==null?M:this.add((C-M)*7,"d")}function Uan(C){var M=bQ(this,1,4).week;return C==null?M:this.add((C-M)*7,"d")}L("d",0,"do","day"),L("dd",0,0,function(C){return this.localeData().weekdaysMin(this,C)}),L("ddd",0,0,function(C){return this.localeData().weekdaysShort(this,C)}),L("dddd",0,0,function(C){return this.localeData().weekdays(this,C)}),L("e",0,0,"weekday"),L("E",0,0,"isoWeekday"),Nt("day","d"),Nt("weekday","e"),Nt("isoWeekday","E"),Ve("day",11),Ve("weekday",11),Ve("isoWeekday",11),Ee("d",ji),Ee("e",ji),Ee("E",ji),Ee("dd",function(C,M){return M.weekdaysMinRegex(C)}),Ee("ddd",function(C,M){return M.weekdaysShortRegex(C)}),Ee("dddd",function(C,M){return M.weekdaysRegex(C)}),zv(["dd","ddd","dddd"],function(C,M,j,U){var G=j._locale.weekdaysParse(C,U,j._strict);G!=null?M.d=G:m(j).invalidWeekday=C}),zv(["d","e","E"],function(C,M,j,U){M[U]=We(C)});function zan(C,M){return typeof C!="string"?C:isNaN(C)?(C=M.weekdaysParse(C),typeof C=="number"?C:null):parseInt(C,10)}function Van(C,M){return typeof C=="string"?M.weekdaysParse(C)%7||7:isNaN(C)?null:C}function dBe(C,M){return C.slice(M,7).concat(C.slice(0,M))}var Han="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),d0t="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Wan="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Jan=Nr,Kan=Nr,Gan=Nr;function Xan(C,M){var j=n(this._weekdays)?this._weekdays:this._weekdays[C&&C!==!0&&this._weekdays.isFormat.test(M)?"format":"standalone"];return C===!0?dBe(j,this._week.dow):C?j[C.day()]:j}function Zan(C){return C===!0?dBe(this._weekdaysShort,this._week.dow):C?this._weekdaysShort[C.day()]:this._weekdaysShort}function Yan(C){return C===!0?dBe(this._weekdaysMin,this._week.dow):C?this._weekdaysMin[C.day()]:this._weekdaysMin}function Qan(C,M,j){var U,G,pe,Fe=C.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],U=0;U<7;++U)pe=f([2e3,1]).day(U),this._minWeekdaysParse[U]=this.weekdaysMin(pe,"").toLocaleLowerCase(),this._shortWeekdaysParse[U]=this.weekdaysShort(pe,"").toLocaleLowerCase(),this._weekdaysParse[U]=this.weekdays(pe,"").toLocaleLowerCase();return j?M==="dddd"?(G=ed.call(this._weekdaysParse,Fe),G!==-1?G:null):M==="ddd"?(G=ed.call(this._shortWeekdaysParse,Fe),G!==-1?G:null):(G=ed.call(this._minWeekdaysParse,Fe),G!==-1?G:null):M==="dddd"?(G=ed.call(this._weekdaysParse,Fe),G!==-1||(G=ed.call(this._shortWeekdaysParse,Fe),G!==-1)?G:(G=ed.call(this._minWeekdaysParse,Fe),G!==-1?G:null)):M==="ddd"?(G=ed.call(this._shortWeekdaysParse,Fe),G!==-1||(G=ed.call(this._weekdaysParse,Fe),G!==-1)?G:(G=ed.call(this._minWeekdaysParse,Fe),G!==-1?G:null)):(G=ed.call(this._minWeekdaysParse,Fe),G!==-1||(G=ed.call(this._weekdaysParse,Fe),G!==-1)?G:(G=ed.call(this._shortWeekdaysParse,Fe),G!==-1?G:null))}function esn(C,M,j){var U,G,pe;if(this._weekdaysParseExact)return Qan.call(this,C,M,j);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),U=0;U<7;U++){if(G=f([2e3,1]).day(U),j&&!this._fullWeekdaysParse[U]&&(this._fullWeekdaysParse[U]=new RegExp("^"+this.weekdays(G,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[U]=new RegExp("^"+this.weekdaysShort(G,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[U]=new RegExp("^"+this.weekdaysMin(G,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[U]||(pe="^"+this.weekdays(G,"")+"|^"+this.weekdaysShort(G,"")+"|^"+this.weekdaysMin(G,""),this._weekdaysParse[U]=new RegExp(pe.replace(".",""),"i")),j&&M==="dddd"&&this._fullWeekdaysParse[U].test(C))return U;if(j&&M==="ddd"&&this._shortWeekdaysParse[U].test(C))return U;if(j&&M==="dd"&&this._minWeekdaysParse[U].test(C))return U;if(!j&&this._weekdaysParse[U].test(C))return U}}function tsn(C){if(!this.isValid())return C!=null?this:NaN;var M=this._isUTC?this._d.getUTCDay():this._d.getDay();return C!=null?(C=zan(C,this.localeData()),this.add(C-M,"d")):M}function rsn(C){if(!this.isValid())return C!=null?this:NaN;var M=(this.day()+7-this.localeData()._week.dow)%7;return C==null?M:this.add(C-M,"d")}function nsn(C){if(!this.isValid())return C!=null?this:NaN;if(C!=null){var M=Van(C,this.localeData());return this.day(this.day()%7?M:M-7)}else return this.day()||7}function osn(C){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||fBe.call(this),C?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=Jan),this._weekdaysStrictRegex&&C?this._weekdaysStrictRegex:this._weekdaysRegex)}function isn(C){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||fBe.call(this),C?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Kan),this._weekdaysShortStrictRegex&&C?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function asn(C){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||fBe.call(this),C?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Gan),this._weekdaysMinStrictRegex&&C?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function fBe(){function C(yb,IN){return IN.length-yb.length}var M=[],j=[],U=[],G=[],pe,Fe,sn,di,hu;for(pe=0;pe<7;pe++)Fe=f([2e3,1]).day(pe),sn=Ln(this.weekdaysMin(Fe,"")),di=Ln(this.weekdaysShort(Fe,"")),hu=Ln(this.weekdays(Fe,"")),M.push(sn),j.push(di),U.push(hu),G.push(sn),G.push(di),G.push(hu);M.sort(C),j.sort(C),U.sort(C),G.sort(C),this._weekdaysRegex=new RegExp("^("+G.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+U.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+M.join("|")+")","i")}function pBe(){return this.hours()%12||12}function ssn(){return this.hours()||24}L("H",["HH",2],0,"hour"),L("h",["hh",2],0,pBe),L("k",["kk",2],0,ssn),L("hmm",0,0,function(){return""+pBe.apply(this)+X(this.minutes(),2)}),L("hmmss",0,0,function(){return""+pBe.apply(this)+X(this.minutes(),2)+X(this.seconds(),2)}),L("Hmm",0,0,function(){return""+this.hours()+X(this.minutes(),2)}),L("Hmmss",0,0,function(){return""+this.hours()+X(this.minutes(),2)+X(this.seconds(),2)});function f0t(C,M){L(C,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),M)})}f0t("a",!0),f0t("A",!1),Nt("hour","h"),Ve("hour",13);function p0t(C,M){return M._meridiemParse}Ee("a",p0t),Ee("A",p0t),Ee("H",ji),Ee("h",ji),Ee("k",ji),Ee("HH",ji,Vi),Ee("hh",ji,Vi),Ee("kk",ji,Vi),Ee("hmm",LT),Ee("hmmss",SC),Ee("Hmm",LT),Ee("Hmmss",SC),xi(["H","HH"],jl),xi(["k","kk"],function(C,M,j){var U=We(C);M[jl]=U===24?0:U}),xi(["a","A"],function(C,M,j){j._isPm=j._locale.isPM(C),j._meridiem=C}),xi(["h","hh"],function(C,M,j){M[jl]=We(C),m(j).bigHour=!0}),xi("hmm",function(C,M,j){var U=C.length-2;M[jl]=We(C.substr(0,U)),M[gb]=We(C.substr(U)),m(j).bigHour=!0}),xi("hmmss",function(C,M,j){var U=C.length-4,G=C.length-2;M[jl]=We(C.substr(0,U)),M[gb]=We(C.substr(U,2)),M[Hv]=We(C.substr(G)),m(j).bigHour=!0}),xi("Hmm",function(C,M,j){var U=C.length-2;M[jl]=We(C.substr(0,U)),M[gb]=We(C.substr(U))}),xi("Hmmss",function(C,M,j){var U=C.length-4,G=C.length-2;M[jl]=We(C.substr(0,U)),M[gb]=We(C.substr(U,2)),M[Hv]=We(C.substr(G))});function usn(C){return(C+"").toLowerCase().charAt(0)==="p"}var lsn=/[ap]\.?m?\.?/i,csn=Jt("Hours",!0);function dsn(C,M,j){return C>11?j?"pm":"PM":j?"am":"AM"}var m0t={calendar:V,longDateFormat:z,invalidDate:oe,ordinal:de,dayOfMonthOrdinalParse:fe,relativeTime:st,months:Tan,monthsShort:o0t,week:Fan,weekdays:Han,weekdaysMin:Wan,weekdaysShort:d0t,meridiemParse:lsn},$l={},_Q={},vQ;function fsn(C,M){var j,U=Math.min(C.length,M.length);for(j=0;j<U;j+=1)if(C[j]!==M[j])return j;return U}function h0t(C){return C&&C.toLowerCase().replace("_","-")}function psn(C){for(var M=0,j,U,G,pe;M<C.length;){for(pe=h0t(C[M]).split("-"),j=pe.length,U=h0t(C[M+1]),U=U?U.split("-"):null;j>0;){if(G=dpe(pe.slice(0,j).join("-")),G)return G;if(U&&U.length>=j&&fsn(pe,U)>=j-1)break;j--}M++}return vQ}function msn(C){return C.match("^[^/\\\\]*$")!=null}function dpe(C){var M=null,j;if($l[C]===void 0&&typeof AJ<"u"&&AJ&&AJ.exports&&msn(C))try{M=vQ._abbr,j=require,j("./locale/"+C),ML(M)}catch{$l[C]=null}return $l[C]}function ML(C,M){var j;return C&&(s(M)?j=EN(C):j=mBe(C,M),j?vQ=j:typeof console<"u"&&console.warn&&console.warn("Locale "+C+" not found. Did you forget to load it?")),vQ._abbr}function mBe(C,M){if(M!==null){var j,U=m0t;if(M.abbr=C,$l[C]!=null)I("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."),U=$l[C]._config;else if(M.parentLocale!=null)if($l[M.parentLocale]!=null)U=$l[M.parentLocale]._config;else if(j=dpe(M.parentLocale),j!=null)U=j._config;else return _Q[M.parentLocale]||(_Q[M.parentLocale]=[]),_Q[M.parentLocale].push({name:C,config:M}),null;return $l[C]=new q(k(U,M)),_Q[C]&&_Q[C].forEach(function(G){mBe(G.name,G.config)}),ML(C),$l[C]}else return delete $l[C],null}function hsn(C,M){if(M!=null){var j,U,G=m0t;$l[C]!=null&&$l[C].parentLocale!=null?$l[C].set(k($l[C]._config,M)):(U=dpe(C),U!=null&&(G=U._config),M=k(G,M),U==null&&(M.abbr=C),j=new q(M),j.parentLocale=$l[C],$l[C]=j),ML(C)}else $l[C]!=null&&($l[C].parentLocale!=null?($l[C]=$l[C].parentLocale,C===ML()&&ML(C)):$l[C]!=null&&delete $l[C]);return $l[C]}function EN(C){var M;if(C&&C._locale&&C._locale._abbr&&(C=C._locale._abbr),!C)return vQ;if(!n(C)){if(M=dpe(C),M)return M;C=[C]}return psn(C)}function gsn(){return Z($l)}function hBe(C){var M,j=C._a;return j&&m(C).overflow===-2&&(M=j[CC]<0||j[CC]>11?CC:j[Vv]<1||j[Vv]>lpe(j[Sh],j[CC])?Vv:j[jl]<0||j[jl]>24||j[jl]===24&&(j[gb]!==0||j[Hv]!==0||j[TN]!==0)?jl:j[gb]<0||j[gb]>59?gb:j[Hv]<0||j[Hv]>59?Hv:j[TN]<0||j[TN]>999?TN:-1,m(C)._overflowDayOfYear&&(M<Sh||M>Vv)&&(M=Vv),m(C)._overflowWeeks&&M===-1&&(M=San),m(C)._overflowWeekday&&M===-1&&(M=Can),m(C).overflow=M),C}var ysn=/^\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)?)?$/,bsn=/^\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)?)?$/,_sn=/Z|[+-]\d\d(?::?\d\d)?/,fpe=[["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]],gBe=[["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/]],vsn=/^\/?Date\((-?\d+)/i,wsn=/^(?:(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}))$/,Ssn={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 g0t(C){var M,j,U=C._i,G=ysn.exec(U)||bsn.exec(U),pe,Fe,sn,di,hu=fpe.length,yb=gBe.length;if(G){for(m(C).iso=!0,M=0,j=hu;M<j;M++)if(fpe[M][1].exec(G[1])){Fe=fpe[M][0],pe=fpe[M][2]!==!1;break}if(Fe==null){C._isValid=!1;return}if(G[3]){for(M=0,j=yb;M<j;M++)if(gBe[M][1].exec(G[3])){sn=(G[2]||" ")+gBe[M][0];break}if(sn==null){C._isValid=!1;return}}if(!pe&&sn!=null){C._isValid=!1;return}if(G[4])if(_sn.exec(G[4]))di="Z";else{C._isValid=!1;return}C._f=Fe+(sn||"")+(di||""),bBe(C)}else C._isValid=!1}function Csn(C,M,j,U,G,pe){var Fe=[xsn(C),o0t.indexOf(M),parseInt(j,10),parseInt(U,10),parseInt(G,10)];return pe&&Fe.push(parseInt(pe,10)),Fe}function xsn(C){var M=parseInt(C,10);return M<=49?2e3+M:M<=999?1900+M:M}function Tsn(C){return C.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Osn(C,M,j){if(C){var U=d0t.indexOf(C),G=new Date(M[0],M[1],M[2]).getDay();if(U!==G)return m(j).weekdayMismatch=!0,j._isValid=!1,!1}return!0}function Esn(C,M,j){if(C)return Ssn[C];if(M)return 0;var U=parseInt(j,10),G=U%100,pe=(U-G)/100;return pe*60+G}function y0t(C){var M=wsn.exec(Tsn(C._i)),j;if(M){if(j=Csn(M[4],M[3],M[2],M[5],M[6],M[7]),!Osn(M[1],j,C))return;C._a=j,C._tzm=Esn(M[8],M[9],M[10]),C._d=yQ.apply(null,C._a),C._d.setUTCMinutes(C._d.getUTCMinutes()-C._tzm),m(C).rfc2822=!0}else C._isValid=!1}function Psn(C){var M=vsn.exec(C._i);if(M!==null){C._d=new Date(+M[1]);return}if(g0t(C),C._isValid===!1)delete C._isValid;else return;if(y0t(C),C._isValid===!1)delete C._isValid;else return;C._strict?C._isValid=!1:e.createFromInputFallback(C)}e.createFromInputFallback=P("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(C){C._d=new Date(C._i+(C._useUTC?" UTC":""))});function R6(C,M,j){return C??M??j}function Msn(C){var M=new Date(e.now());return C._useUTC?[M.getUTCFullYear(),M.getUTCMonth(),M.getUTCDate()]:[M.getFullYear(),M.getMonth(),M.getDate()]}function yBe(C){var M,j,U=[],G,pe,Fe;if(!C._d){for(G=Msn(C),C._w&&C._a[Vv]==null&&C._a[CC]==null&&Rsn(C),C._dayOfYear!=null&&(Fe=R6(C._a[Sh],G[Sh]),(C._dayOfYear>gQ(Fe)||C._dayOfYear===0)&&(m(C)._overflowDayOfYear=!0),j=yQ(Fe,0,C._dayOfYear),C._a[CC]=j.getUTCMonth(),C._a[Vv]=j.getUTCDate()),M=0;M<3&&C._a[M]==null;++M)C._a[M]=U[M]=G[M];for(;M<7;M++)C._a[M]=U[M]=C._a[M]==null?M===2?1:0:C._a[M];C._a[jl]===24&&C._a[gb]===0&&C._a[Hv]===0&&C._a[TN]===0&&(C._nextDay=!0,C._a[jl]=0),C._d=(C._useUTC?yQ:$an).apply(null,U),pe=C._useUTC?C._d.getUTCDay():C._d.getDay(),C._tzm!=null&&C._d.setUTCMinutes(C._d.getUTCMinutes()-C._tzm),C._nextDay&&(C._a[jl]=24),C._w&&typeof C._w.d<"u"&&C._w.d!==pe&&(m(C).weekdayMismatch=!0)}}function Rsn(C){var M,j,U,G,pe,Fe,sn,di,hu;M=C._w,M.GG!=null||M.W!=null||M.E!=null?(pe=1,Fe=4,j=R6(M.GG,C._a[Sh],bQ(ll(),1,4).year),U=R6(M.W,1),G=R6(M.E,1),(G<1||G>7)&&(di=!0)):(pe=C._locale._week.dow,Fe=C._locale._week.doy,hu=bQ(ll(),pe,Fe),j=R6(M.gg,C._a[Sh],hu.year),U=R6(M.w,hu.week),M.d!=null?(G=M.d,(G<0||G>6)&&(di=!0)):M.e!=null?(G=M.e+pe,(M.e<0||M.e>6)&&(di=!0)):G=pe),U<1||U>ON(j,pe,Fe)?m(C)._overflowWeeks=!0:di!=null?m(C)._overflowWeekday=!0:(sn=c0t(j,U,G,pe,Fe),C._a[Sh]=sn.year,C._dayOfYear=sn.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function bBe(C){if(C._f===e.ISO_8601){g0t(C);return}if(C._f===e.RFC_2822){y0t(C);return}C._a=[],m(C).empty=!0;var M=""+C._i,j,U,G,pe,Fe,sn=M.length,di=0,hu,yb;for(G=N(C._f,C._locale).match(W)||[],yb=G.length,j=0;j<yb;j++)pe=G[j],U=(M.match(Mt(pe,C))||[])[0],U&&(Fe=M.substr(0,M.indexOf(U)),Fe.length>0&&m(C).unusedInput.push(Fe),M=M.slice(M.indexOf(U)+U.length),di+=U.length),le[pe]?(U?m(C).empty=!1:m(C).unusedTokens.push(pe),PL(pe,U,C)):C._strict&&!U&&m(C).unusedTokens.push(pe);m(C).charsLeftOver=sn-di,M.length>0&&m(C).unusedInput.push(M),C._a[jl]<=12&&m(C).bigHour===!0&&C._a[jl]>0&&(m(C).bigHour=void 0),m(C).parsedDateParts=C._a.slice(0),m(C).meridiem=C._meridiem,C._a[jl]=Isn(C._locale,C._a[jl],C._meridiem),hu=m(C).era,hu!==null&&(C._a[Sh]=C._locale.erasConvertYear(hu,C._a[Sh])),yBe(C),hBe(C)}function Isn(C,M,j){var U;return j==null?M:C.meridiemHour!=null?C.meridiemHour(M,j):(C.isPM!=null&&(U=C.isPM(j),U&&M<12&&(M+=12),!U&&M===12&&(M=0)),M)}function Asn(C){var M,j,U,G,pe,Fe,sn=!1,di=C._f.length;if(di===0){m(C).invalidFormat=!0,C._d=new Date(NaN);return}for(G=0;G<di;G++)pe=0,Fe=!1,M=w({},C),C._useUTC!=null&&(M._useUTC=C._useUTC),M._f=C._f[G],bBe(M),y(M)&&(Fe=!0),pe+=m(M).charsLeftOver,pe+=m(M).unusedTokens.length*10,m(M).score=pe,sn?pe<U&&(U=pe,j=M):(U==null||pe<U||Fe)&&(U=pe,j=M,Fe&&(sn=!0));d(C,j||M)}function Nsn(C){if(!C._d){var M=Fr(C._i),j=M.day===void 0?M.date:M.day;C._a=c([M.year,M.month,j,M.hour,M.minute,M.second,M.millisecond],function(U){return U&&parseInt(U,10)}),yBe(C)}}function Dsn(C){var M=new T(hBe(b0t(C)));return M._nextDay&&(M.add(1,"d"),M._nextDay=void 0),M}function b0t(C){var M=C._i,j=C._f;return C._locale=C._locale||EN(C._l),M===null||j===void 0&&M===""?g({nullInput:!0}):(typeof M=="string"&&(C._i=M=C._locale.preparse(M)),O(M)?new T(hBe(M)):(l(M)?C._d=M:n(j)?Asn(C):j?bBe(C):jsn(C),y(C)||(C._d=null),C))}function jsn(C){var M=C._i;s(M)?C._d=new Date(e.now()):l(M)?C._d=new Date(M.valueOf()):typeof M=="string"?Psn(C):n(M)?(C._a=c(M.slice(0),function(j){return parseInt(j,10)}),yBe(C)):o(M)?Nsn(C):u(M)?C._d=new Date(M):e.createFromInputFallback(C)}function _0t(C,M,j,U,G){var pe={};return(M===!0||M===!1)&&(U=M,M=void 0),(j===!0||j===!1)&&(U=j,j=void 0),(o(C)&&a(C)||n(C)&&C.length===0)&&(C=void 0),pe._isAMomentObject=!0,pe._useUTC=pe._isUTC=G,pe._l=j,pe._i=C,pe._f=M,pe._strict=U,Dsn(pe)}function ll(C,M,j,U){return _0t(C,M,j,U,!1)}var $sn=P("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var C=ll.apply(null,arguments);return this.isValid()&&C.isValid()?C<this?this:C:g()}),Lsn=P("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var C=ll.apply(null,arguments);return this.isValid()&&C.isValid()?C>this?this:C:g()});function v0t(C,M){var j,U;if(M.length===1&&n(M[0])&&(M=M[0]),!M.length)return ll();for(j=M[0],U=1;U<M.length;++U)(!M[U].isValid()||M[U][C](j))&&(j=M[U]);return j}function Fsn(){var C=[].slice.call(arguments,0);return v0t("isBefore",C)}function ksn(){var C=[].slice.call(arguments,0);return v0t("isAfter",C)}var qsn=function(){return Date.now?Date.now():+new Date},wQ=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Bsn(C){var M,j=!1,U,G=wQ.length;for(M in C)if(i(C,M)&&!(ed.call(wQ,M)!==-1&&(C[M]==null||!isNaN(C[M]))))return!1;for(U=0;U<G;++U)if(C[wQ[U]]){if(j)return!1;parseFloat(C[wQ[U]])!==We(C[wQ[U]])&&(j=!0)}return!0}function Usn(){return this._isValid}function zsn(){return xC(NaN)}function ppe(C){var M=Fr(C),j=M.year||0,U=M.quarter||0,G=M.month||0,pe=M.week||M.isoWeek||0,Fe=M.day||0,sn=M.hour||0,di=M.minute||0,hu=M.second||0,yb=M.millisecond||0;this._isValid=Bsn(M),this._milliseconds=+yb+hu*1e3+di*6e4+sn*1e3*60*60,this._days=+Fe+pe*7,this._months=+G+U*3+j*12,this._data={},this._locale=EN(),this._bubble()}function mpe(C){return C instanceof ppe}function _Be(C){return C<0?Math.round(-1*C)*-1:Math.round(C)}function Vsn(C,M,j){var U=Math.min(C.length,M.length),G=Math.abs(C.length-M.length),pe=0,Fe;for(Fe=0;Fe<U;Fe++)(j&&C[Fe]!==M[Fe]||!j&&We(C[Fe])!==We(M[Fe]))&&pe++;return pe+G}function w0t(C,M){L(C,0,0,function(){var j=this.utcOffset(),U="+";return j<0&&(j=-j,U="-"),U+X(~~(j/60),2)+M+X(~~j%60,2)})}w0t("Z",":"),w0t("ZZ",""),Ee("Z",sl),Ee("ZZ",sl),xi(["Z","ZZ"],function(C,M,j){j._useUTC=!0,j._tzm=vBe(sl,C)});var Hsn=/([\+\-]|\d\d)/gi;function vBe(C,M){var j=(M||"").match(C),U,G,pe;return j===null?null:(U=j[j.length-1]||[],G=(U+"").match(Hsn)||["-",0,0],pe=+(G[1]*60)+We(G[2]),pe===0?0:G[0]==="+"?pe:-pe)}function wBe(C,M){var j,U;return M._isUTC?(j=M.clone(),U=(O(C)||l(C)?C.valueOf():ll(C).valueOf())-j.valueOf(),j._d.setTime(j._d.valueOf()+U),e.updateOffset(j,!1),j):ll(C).local()}function SBe(C){return-Math.round(C._d.getTimezoneOffset())}e.updateOffset=function(){};function Wsn(C,M,j){var U=this._offset||0,G;if(!this.isValid())return C!=null?this:NaN;if(C!=null){if(typeof C=="string"){if(C=vBe(sl,C),C===null)return this}else Math.abs(C)<16&&!j&&(C=C*60);return!this._isUTC&&M&&(G=SBe(this)),this._offset=C,this._isUTC=!0,G!=null&&this.add(G,"m"),U!==C&&(!M||this._changeInProgress?T0t(this,xC(C-U,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?U:SBe(this)}function Jsn(C,M){return C!=null?(typeof C!="string"&&(C=-C),this.utcOffset(C,M),this):-this.utcOffset()}function Ksn(C){return this.utcOffset(0,C)}function Gsn(C){return this._isUTC&&(this.utcOffset(0,C),this._isUTC=!1,C&&this.subtract(SBe(this),"m")),this}function Xsn(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var C=vBe(_d,this._i);C!=null?this.utcOffset(C):this.utcOffset(0,!0)}return this}function Zsn(C){return this.isValid()?(C=C?ll(C).utcOffset():0,(this.utcOffset()-C)%60===0):!1}function Ysn(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Qsn(){if(!s(this._isDSTShifted))return this._isDSTShifted;var C={},M;return w(C,this),C=b0t(C),C._a?(M=C._isUTC?f(C._a):ll(C._a),this._isDSTShifted=this.isValid()&&Vsn(C._a,M.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function eun(){return this.isValid()?!this._isUTC:!1}function tun(){return this.isValid()?this._isUTC:!1}function S0t(){return this.isValid()?this._isUTC&&this._offset===0:!1}var run=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,nun=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function xC(C,M){var j=C,U=null,G,pe,Fe;return mpe(C)?j={ms:C._milliseconds,d:C._days,M:C._months}:u(C)||!isNaN(+C)?(j={},M?j[M]=+C:j.milliseconds=+C):(U=run.exec(C))?(G=U[1]==="-"?-1:1,j={y:0,d:We(U[Vv])*G,h:We(U[jl])*G,m:We(U[gb])*G,s:We(U[Hv])*G,ms:We(_Be(U[TN]*1e3))*G}):(U=nun.exec(C))?(G=U[1]==="-"?-1:1,j={y:gz(U[2],G),M:gz(U[3],G),w:gz(U[4],G),d:gz(U[5],G),h:gz(U[6],G),m:gz(U[7],G),s:gz(U[8],G)}):j==null?j={}:typeof j=="object"&&("from"in j||"to"in j)&&(Fe=oun(ll(j.from),ll(j.to)),j={},j.ms=Fe.milliseconds,j.M=Fe.months),pe=new ppe(j),mpe(C)&&i(C,"_locale")&&(pe._locale=C._locale),mpe(C)&&i(C,"_isValid")&&(pe._isValid=C._isValid),pe}xC.fn=ppe.prototype,xC.invalid=zsn;function gz(C,M){var j=C&&parseFloat(C.replace(",","."));return(isNaN(j)?0:j)*M}function C0t(C,M){var j={};return j.months=M.month()-C.month()+(M.year()-C.year())*12,C.clone().add(j.months,"M").isAfter(M)&&--j.months,j.milliseconds=+M-+C.clone().add(j.months,"M"),j}function oun(C,M){var j;return C.isValid()&&M.isValid()?(M=wBe(M,C),C.isBefore(M)?j=C0t(C,M):(j=C0t(M,C),j.milliseconds=-j.milliseconds,j.months=-j.months),j):{milliseconds:0,months:0}}function x0t(C,M){return function(j,U){var G,pe;return U!==null&&!isNaN(+U)&&(I(M,"moment()."+M+"(period, number) is deprecated. Please use moment()."+M+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),pe=j,j=U,U=pe),G=xC(j,U),T0t(this,G,C),this}}function T0t(C,M,j,U){var G=M._milliseconds,pe=_Be(M._days),Fe=_Be(M._months);C.isValid()&&(U=U??!0,Fe&&a0t(C,so(C,"Month")+Fe*j),pe&&au(C,"Date",so(C,"Date")+pe*j),G&&C._d.setTime(C._d.valueOf()+G*j),U&&e.updateOffset(C,pe||Fe))}var iun=x0t(1,"add"),aun=x0t(-1,"subtract");function O0t(C){return typeof C=="string"||C instanceof String}function sun(C){return O(C)||l(C)||O0t(C)||u(C)||lun(C)||uun(C)||C===null||C===void 0}function uun(C){var M=o(C)&&!a(C),j=!1,U=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],G,pe,Fe=U.length;for(G=0;G<Fe;G+=1)pe=U[G],j=j||i(C,pe);return M&&j}function lun(C){var M=n(C),j=!1;return M&&(j=C.filter(function(U){return!u(U)&&O0t(C)}).length===0),M&&j}function cun(C){var M=o(C)&&!a(C),j=!1,U=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],G,pe;for(G=0;G<U.length;G+=1)pe=U[G],j=j||i(C,pe);return M&&j}function dun(C,M){var j=C.diff(M,"days",!0);return j<-6?"sameElse":j<-1?"lastWeek":j<0?"lastDay":j<1?"sameDay":j<2?"nextDay":j<7?"nextWeek":"sameElse"}function fun(C,M){arguments.length===1&&(arguments[0]?sun(arguments[0])?(C=arguments[0],M=void 0):cun(arguments[0])&&(M=arguments[0],C=void 0):(C=void 0,M=void 0));var j=C||ll(),U=wBe(j,this).startOf("day"),G=e.calendarFormat(this,U)||"sameElse",pe=M&&(A(M[G])?M[G].call(this,j):M[G]);return this.format(pe||this.localeData().calendar(G,this,ll(j)))}function pun(){return new T(this)}function mun(C,M){var j=O(C)?C:ll(C);return this.isValid()&&j.isValid()?(M=$e(M)||"millisecond",M==="millisecond"?this.valueOf()>j.valueOf():j.valueOf()<this.clone().startOf(M).valueOf()):!1}function hun(C,M){var j=O(C)?C:ll(C);return this.isValid()&&j.isValid()?(M=$e(M)||"millisecond",M==="millisecond"?this.valueOf()<j.valueOf():this.clone().endOf(M).valueOf()<j.valueOf()):!1}function gun(C,M,j,U){var G=O(C)?C:ll(C),pe=O(M)?M:ll(M);return this.isValid()&&G.isValid()&&pe.isValid()?(U=U||"()",(U[0]==="("?this.isAfter(G,j):!this.isBefore(G,j))&&(U[1]===")"?this.isBefore(pe,j):!this.isAfter(pe,j))):!1}function yun(C,M){var j=O(C)?C:ll(C),U;return this.isValid()&&j.isValid()?(M=$e(M)||"millisecond",M==="millisecond"?this.valueOf()===j.valueOf():(U=j.valueOf(),this.clone().startOf(M).valueOf()<=U&&U<=this.clone().endOf(M).valueOf())):!1}function bun(C,M){return this.isSame(C,M)||this.isAfter(C,M)}function _un(C,M){return this.isSame(C,M)||this.isBefore(C,M)}function vun(C,M,j){var U,G,pe;if(!this.isValid())return NaN;if(U=wBe(C,this),!U.isValid())return NaN;switch(G=(U.utcOffset()-this.utcOffset())*6e4,M=$e(M),M){case"year":pe=hpe(this,U)/12;break;case"month":pe=hpe(this,U);break;case"quarter":pe=hpe(this,U)/3;break;case"second":pe=(this-U)/1e3;break;case"minute":pe=(this-U)/6e4;break;case"hour":pe=(this-U)/36e5;break;case"day":pe=(this-U-G)/864e5;break;case"week":pe=(this-U-G)/6048e5;break;default:pe=this-U}return j?pe:He(pe)}function hpe(C,M){if(C.date()<M.date())return-hpe(M,C);var j=(M.year()-C.year())*12+(M.month()-C.month()),U=C.clone().add(j,"months"),G,pe;return M-U<0?(G=C.clone().add(j-1,"months"),pe=(M-U)/(U-G)):(G=C.clone().add(j+1,"months"),pe=(M-U)/(G-U)),-(j+pe)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function wun(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function Sun(C){if(!this.isValid())return null;var M=C!==!0,j=M?this.clone().utc():this;return j.year()<0||j.year()>9999?D(j,M?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):A(Date.prototype.toISOString)?M?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",D(j,"Z")):D(j,M?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Cun(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var C="moment",M="",j,U,G,pe;return this.isLocal()||(C=this.utcOffset()===0?"moment.utc":"moment.parseZone",M="Z"),j="["+C+'("]',U=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",G="-MM-DD[T]HH:mm:ss.SSS",pe=M+'[")]',this.format(j+U+G+pe)}function xun(C){C||(C=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var M=D(this,C);return this.localeData().postformat(M)}function Tun(C,M){return this.isValid()&&(O(C)&&C.isValid()||ll(C).isValid())?xC({to:this,from:C}).locale(this.locale()).humanize(!M):this.localeData().invalidDate()}function Oun(C){return this.from(ll(),C)}function Eun(C,M){return this.isValid()&&(O(C)&&C.isValid()||ll(C).isValid())?xC({from:this,to:C}).locale(this.locale()).humanize(!M):this.localeData().invalidDate()}function Pun(C){return this.to(ll(),C)}function E0t(C){var M;return C===void 0?this._locale._abbr:(M=EN(C),M!=null&&(this._locale=M),this)}var P0t=P("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(C){return C===void 0?this.localeData():this.locale(C)});function M0t(){return this._locale}var gpe=1e3,I6=60*gpe,ype=60*I6,R0t=(365*400+97)*24*ype;function A6(C,M){return(C%M+M)%M}function I0t(C,M,j){return C<100&&C>=0?new Date(C+400,M,j)-R0t:new Date(C,M,j).valueOf()}function A0t(C,M,j){return C<100&&C>=0?Date.UTC(C+400,M,j)-R0t:Date.UTC(C,M,j)}function Mun(C){var M,j;if(C=$e(C),C===void 0||C==="millisecond"||!this.isValid())return this;switch(j=this._isUTC?A0t:I0t,C){case"year":M=j(this.year(),0,1);break;case"quarter":M=j(this.year(),this.month()-this.month()%3,1);break;case"month":M=j(this.year(),this.month(),1);break;case"week":M=j(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":M=j(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":M=j(this.year(),this.month(),this.date());break;case"hour":M=this._d.valueOf(),M-=A6(M+(this._isUTC?0:this.utcOffset()*I6),ype);break;case"minute":M=this._d.valueOf(),M-=A6(M,I6);break;case"second":M=this._d.valueOf(),M-=A6(M,gpe);break}return this._d.setTime(M),e.updateOffset(this,!0),this}function Run(C){var M,j;if(C=$e(C),C===void 0||C==="millisecond"||!this.isValid())return this;switch(j=this._isUTC?A0t:I0t,C){case"year":M=j(this.year()+1,0,1)-1;break;case"quarter":M=j(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":M=j(this.year(),this.month()+1,1)-1;break;case"week":M=j(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":M=j(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":M=j(this.year(),this.month(),this.date()+1)-1;break;case"hour":M=this._d.valueOf(),M+=ype-A6(M+(this._isUTC?0:this.utcOffset()*I6),ype)-1;break;case"minute":M=this._d.valueOf(),M+=I6-A6(M,I6)-1;break;case"second":M=this._d.valueOf(),M+=gpe-A6(M,gpe)-1;break}return this._d.setTime(M),e.updateOffset(this,!0),this}function Iun(){return this._d.valueOf()-(this._offset||0)*6e4}function Aun(){return Math.floor(this.valueOf()/1e3)}function Nun(){return new Date(this.valueOf())}function Dun(){var C=this;return[C.year(),C.month(),C.date(),C.hour(),C.minute(),C.second(),C.millisecond()]}function jun(){var C=this;return{years:C.year(),months:C.month(),date:C.date(),hours:C.hours(),minutes:C.minutes(),seconds:C.seconds(),milliseconds:C.milliseconds()}}function $un(){return this.isValid()?this.toISOString():null}function Lun(){return y(this)}function Fun(){return d({},m(this))}function kun(){return m(this).overflow}function qun(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}L("N",0,0,"eraAbbr"),L("NN",0,0,"eraAbbr"),L("NNN",0,0,"eraAbbr"),L("NNNN",0,0,"eraName"),L("NNNNN",0,0,"eraNarrow"),L("y",["y",1],"yo","eraYear"),L("y",["yy",2],0,"eraYear"),L("y",["yyy",3],0,"eraYear"),L("y",["yyyy",4],0,"eraYear"),Ee("N",CBe),Ee("NN",CBe),Ee("NNN",CBe),Ee("NNNN",Yun),Ee("NNNNN",Qun),xi(["N","NN","NNN","NNNN","NNNNN"],function(C,M,j,U){var G=j._locale.erasParse(C,U,j._strict);G?m(j).era=G:m(j).invalidEra=C}),Ee("y",Iu),Ee("yy",Iu),Ee("yyy",Iu),Ee("yyyy",Iu),Ee("yo",eln),xi(["y","yy","yyy","yyyy"],Sh),xi(["yo"],function(C,M,j,U){var G;j._locale._eraYearOrdinalRegex&&(G=C.match(j._locale._eraYearOrdinalRegex)),j._locale.eraYearOrdinalParse?M[Sh]=j._locale.eraYearOrdinalParse(C,G):M[Sh]=parseInt(C,10)});function Uun(C,M){var j,U,G,pe=this._eras||EN("en")._eras;for(j=0,U=pe.length;j<U;++j){switch(typeof pe[j].since){case"string":G=e(pe[j].since).startOf("day"),pe[j].since=G.valueOf();break}switch(typeof pe[j].until){case"undefined":pe[j].until=1/0;break;case"string":G=e(pe[j].until).startOf("day").valueOf(),pe[j].until=G.valueOf();break}}return pe}function zun(C,M,j){var U,G,pe=this.eras(),Fe,sn,di;for(C=C.toUpperCase(),U=0,G=pe.length;U<G;++U)if(Fe=pe[U].name.toUpperCase(),sn=pe[U].abbr.toUpperCase(),di=pe[U].narrow.toUpperCase(),j)switch(M){case"N":case"NN":case"NNN":if(sn===C)return pe[U];break;case"NNNN":if(Fe===C)return pe[U];break;case"NNNNN":if(di===C)return pe[U];break}else if([Fe,sn,di].indexOf(C)>=0)return pe[U]}function Vun(C,M){var j=C.since<=C.until?1:-1;return M===void 0?e(C.since).year():e(C.since).year()+(M-C.offset)*j}function Hun(){var C,M,j,U=this.localeData().eras();for(C=0,M=U.length;C<M;++C)if(j=this.clone().startOf("day").valueOf(),U[C].since<=j&&j<=U[C].until||U[C].until<=j&&j<=U[C].since)return U[C].name;return""}function Wun(){var C,M,j,U=this.localeData().eras();for(C=0,M=U.length;C<M;++C)if(j=this.clone().startOf("day").valueOf(),U[C].since<=j&&j<=U[C].until||U[C].until<=j&&j<=U[C].since)return U[C].narrow;return""}function Jun(){var C,M,j,U=this.localeData().eras();for(C=0,M=U.length;C<M;++C)if(j=this.clone().startOf("day").valueOf(),U[C].since<=j&&j<=U[C].until||U[C].until<=j&&j<=U[C].since)return U[C].abbr;return""}function Kun(){var C,M,j,U,G=this.localeData().eras();for(C=0,M=G.length;C<M;++C)if(j=G[C].since<=G[C].until?1:-1,U=this.clone().startOf("day").valueOf(),G[C].since<=U&&U<=G[C].until||G[C].until<=U&&U<=G[C].since)return(this.year()-e(G[C].since).year())*j+G[C].offset;return this.year()}function Gun(C){return i(this,"_erasNameRegex")||xBe.call(this),C?this._erasNameRegex:this._erasRegex}function Xun(C){return i(this,"_erasAbbrRegex")||xBe.call(this),C?this._erasAbbrRegex:this._erasRegex}function Zun(C){return i(this,"_erasNarrowRegex")||xBe.call(this),C?this._erasNarrowRegex:this._erasRegex}function CBe(C,M){return M.erasAbbrRegex(C)}function Yun(C,M){return M.erasNameRegex(C)}function Qun(C,M){return M.erasNarrowRegex(C)}function eln(C,M){return M._eraYearOrdinalRegex||Iu}function xBe(){var C=[],M=[],j=[],U=[],G,pe,Fe=this.eras();for(G=0,pe=Fe.length;G<pe;++G)M.push(Ln(Fe[G].name)),C.push(Ln(Fe[G].abbr)),j.push(Ln(Fe[G].narrow)),U.push(Ln(Fe[G].name)),U.push(Ln(Fe[G].abbr)),U.push(Ln(Fe[G].narrow));this._erasRegex=new RegExp("^("+U.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+M.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+C.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+j.join("|")+")","i")}L(0,["gg",2],0,function(){return this.weekYear()%100}),L(0,["GG",2],0,function(){return this.isoWeekYear()%100});function bpe(C,M){L(0,[C,C.length],0,M)}bpe("gggg","weekYear"),bpe("ggggg","weekYear"),bpe("GGGG","isoWeekYear"),bpe("GGGGG","isoWeekYear"),Nt("weekYear","gg"),Nt("isoWeekYear","GG"),Ve("weekYear",1),Ve("isoWeekYear",1),Ee("G",wm),Ee("g",wm),Ee("GG",ji,Vi),Ee("gg",ji,Vi),Ee("GGGG",Xs,mg),Ee("gggg",Xs,mg),Ee("GGGGG",Dl,cS),Ee("ggggg",Dl,cS),zv(["gggg","ggggg","GGGG","GGGGG"],function(C,M,j,U){M[U.substr(0,2)]=We(C)}),zv(["gg","GG"],function(C,M,j,U){M[U]=e.parseTwoDigitYear(C)});function tln(C){return N0t.call(this,C,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function rln(C){return N0t.call(this,C,this.isoWeek(),this.isoWeekday(),1,4)}function nln(){return ON(this.year(),1,4)}function oln(){return ON(this.isoWeekYear(),1,4)}function iln(){var C=this.localeData()._week;return ON(this.year(),C.dow,C.doy)}function aln(){var C=this.localeData()._week;return ON(this.weekYear(),C.dow,C.doy)}function N0t(C,M,j,U,G){var pe;return C==null?bQ(this,U,G).year:(pe=ON(C,U,G),M>pe&&(M=pe),sln.call(this,C,M,j,U,G))}function sln(C,M,j,U,G){var pe=c0t(C,M,j,U,G),Fe=yQ(pe.year,0,pe.dayOfYear);return this.year(Fe.getUTCFullYear()),this.month(Fe.getUTCMonth()),this.date(Fe.getUTCDate()),this}L("Q",0,"Qo","quarter"),Nt("quarter","Q"),Ve("quarter",7),Ee("Q",Nl),xi("Q",function(C,M){M[CC]=(We(C)-1)*3});function uln(C){return C==null?Math.ceil((this.month()+1)/3):this.month((C-1)*3+this.month()%3)}L("D",["DD",2],"Do","date"),Nt("date","D"),Ve("date",9),Ee("D",ji),Ee("DD",ji,Vi),Ee("Do",function(C,M){return C?M._dayOfMonthOrdinalParse||M._ordinalParse:M._dayOfMonthOrdinalParseLenient}),xi(["D","DD"],Vv),xi("Do",function(C,M){M[Vv]=We(C.match(ji)[0])});var D0t=Jt("Date",!0);L("DDD",["DDDD",3],"DDDo","dayOfYear"),Nt("dayOfYear","DDD"),Ve("dayOfYear",4),Ee("DDD",dS),Ee("DDDD",g_),xi(["DDD","DDDD"],function(C,M,j){j._dayOfYear=We(C)});function lln(C){var M=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return C==null?M:this.add(C-M,"d")}L("m",["mm",2],0,"minute"),Nt("minute","m"),Ve("minute",14),Ee("m",ji),Ee("mm",ji,Vi),xi(["m","mm"],gb);var cln=Jt("Minutes",!1);L("s",["ss",2],0,"second"),Nt("second","s"),Ve("second",15),Ee("s",ji),Ee("ss",ji,Vi),xi(["s","ss"],Hv);var dln=Jt("Seconds",!1);L("S",0,0,function(){return~~(this.millisecond()/100)}),L(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),L(0,["SSS",3],0,"millisecond"),L(0,["SSSS",4],0,function(){return this.millisecond()*10}),L(0,["SSSSS",5],0,function(){return this.millisecond()*100}),L(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),L(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),L(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),L(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Nt("millisecond","ms"),Ve("millisecond",16),Ee("S",dS,Nl),Ee("SS",dS,Vi),Ee("SSS",dS,g_);var RL,j0t;for(RL="SSSS";RL.length<=9;RL+="S")Ee(RL,Iu);function fln(C,M){M[TN]=We(("0."+C)*1e3)}for(RL="S";RL.length<=9;RL+="S")xi(RL,fln);j0t=Jt("Milliseconds",!1),L("z",0,0,"zoneAbbr"),L("zz",0,0,"zoneName");function pln(){return this._isUTC?"UTC":""}function mln(){return this._isUTC?"Coordinated Universal Time":""}var pt=T.prototype;pt.add=iun,pt.calendar=fun,pt.clone=pun,pt.diff=vun,pt.endOf=Run,pt.format=xun,pt.from=Tun,pt.fromNow=Oun,pt.to=Eun,pt.toNow=Pun,pt.get=An,pt.invalidAt=kun,pt.isAfter=mun,pt.isBefore=hun,pt.isBetween=gun,pt.isSame=yun,pt.isSameOrAfter=bun,pt.isSameOrBefore=_un,pt.isValid=Lun,pt.lang=P0t,pt.locale=E0t,pt.localeData=M0t,pt.max=Lsn,pt.min=$sn,pt.parsingFlags=Fun,pt.set=_i,pt.startOf=Mun,pt.subtract=aun,pt.toArray=Dun,pt.toObject=jun,pt.toDate=Nun,pt.toISOString=Sun,pt.inspect=Cun,typeof Symbol<"u"&&Symbol.for!=null&&(pt[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),pt.toJSON=$un,pt.toString=wun,pt.unix=Aun,pt.valueOf=Iun,pt.creationData=qun,pt.eraName=Hun,pt.eraNarrow=Wun,pt.eraAbbr=Jun,pt.eraYear=Kun,pt.year=l0t,pt.isLeapYear=jan,pt.weekYear=tln,pt.isoWeekYear=rln,pt.quarter=pt.quarters=uln,pt.month=s0t,pt.daysInMonth=Aan,pt.week=pt.weeks=Ban,pt.isoWeek=pt.isoWeeks=Uan,pt.weeksInYear=iln,pt.weeksInWeekYear=aln,pt.isoWeeksInYear=nln,pt.isoWeeksInISOWeekYear=oln,pt.date=D0t,pt.day=pt.days=tsn,pt.weekday=rsn,pt.isoWeekday=nsn,pt.dayOfYear=lln,pt.hour=pt.hours=csn,pt.minute=pt.minutes=cln,pt.second=pt.seconds=dln,pt.millisecond=pt.milliseconds=j0t,pt.utcOffset=Wsn,pt.utc=Ksn,pt.local=Gsn,pt.parseZone=Xsn,pt.hasAlignedHourOffset=Zsn,pt.isDST=Ysn,pt.isLocal=eun,pt.isUtcOffset=tun,pt.isUtc=S0t,pt.isUTC=S0t,pt.zoneAbbr=pln,pt.zoneName=mln,pt.dates=P("dates accessor is deprecated. Use date instead.",D0t),pt.months=P("months accessor is deprecated. Use month instead",s0t),pt.years=P("years accessor is deprecated. Use year instead",l0t),pt.zone=P("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Jsn),pt.isDSTShifted=P("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Qsn);function hln(C){return ll(C*1e3)}function gln(){return ll.apply(null,arguments).parseZone()}function $0t(C){return C}var ls=q.prototype;ls.calendar=Y,ls.longDateFormat=H,ls.invalidDate=Q,ls.ordinal=De,ls.preparse=$0t,ls.postformat=$0t,ls.relativeTime=Le,ls.pastFuture=Bt,ls.set=B,ls.eras=Uun,ls.erasParse=zun,ls.erasConvertYear=Vun,ls.erasAbbrRegex=Xun,ls.erasNameRegex=Gun,ls.erasNarrowRegex=Zun,ls.months=Pan,ls.monthsShort=Man,ls.monthsParse=Ian,ls.monthsRegex=Dan,ls.monthsShortRegex=Nan,ls.week=Lan,ls.firstDayOfYear=qan,ls.firstDayOfWeek=kan,ls.weekdays=Xan,ls.weekdaysMin=Yan,ls.weekdaysShort=Zan,ls.weekdaysParse=esn,ls.weekdaysRegex=osn,ls.weekdaysShortRegex=isn,ls.weekdaysMinRegex=asn,ls.isPM=usn,ls.meridiem=dsn;function _pe(C,M,j,U){var G=EN(),pe=f().set(U,M);return G[j](pe,C)}function L0t(C,M,j){if(u(C)&&(M=C,C=void 0),C=C||"",M!=null)return _pe(C,M,j,"month");var U,G=[];for(U=0;U<12;U++)G[U]=_pe(C,U,j,"month");return G}function TBe(C,M,j,U){typeof C=="boolean"?(u(M)&&(j=M,M=void 0),M=M||""):(M=C,j=M,C=!1,u(M)&&(j=M,M=void 0),M=M||"");var G=EN(),pe=C?G._week.dow:0,Fe,sn=[];if(j!=null)return _pe(M,(j+pe)%7,U,"day");for(Fe=0;Fe<7;Fe++)sn[Fe]=_pe(M,(Fe+pe)%7,U,"day");return sn}function yln(C,M){return L0t(C,M,"months")}function bln(C,M){return L0t(C,M,"monthsShort")}function _ln(C,M,j){return TBe(C,M,j,"weekdays")}function vln(C,M,j){return TBe(C,M,j,"weekdaysShort")}function wln(C,M,j){return TBe(C,M,j,"weekdaysMin")}ML("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(C){var M=C%10,j=We(C%100/10)===1?"th":M===1?"st":M===2?"nd":M===3?"rd":"th";return C+j}}),e.lang=P("moment.lang is deprecated. Use moment.locale instead.",ML),e.langData=P("moment.langData is deprecated. Use moment.localeData instead.",EN);var PN=Math.abs;function Sln(){var C=this._data;return this._milliseconds=PN(this._milliseconds),this._days=PN(this._days),this._months=PN(this._months),C.milliseconds=PN(C.milliseconds),C.seconds=PN(C.seconds),C.minutes=PN(C.minutes),C.hours=PN(C.hours),C.months=PN(C.months),C.years=PN(C.years),this}function F0t(C,M,j,U){var G=xC(M,j);return C._milliseconds+=U*G._milliseconds,C._days+=U*G._days,C._months+=U*G._months,C._bubble()}function Cln(C,M){return F0t(this,C,M,1)}function xln(C,M){return F0t(this,C,M,-1)}function k0t(C){return C<0?Math.floor(C):Math.ceil(C)}function Tln(){var C=this._milliseconds,M=this._days,j=this._months,U=this._data,G,pe,Fe,sn,di;return C>=0&&M>=0&&j>=0||C<=0&&M<=0&&j<=0||(C+=k0t(OBe(j)+M)*864e5,M=0,j=0),U.milliseconds=C%1e3,G=He(C/1e3),U.seconds=G%60,pe=He(G/60),U.minutes=pe%60,Fe=He(pe/60),U.hours=Fe%24,M+=He(Fe/24),di=He(q0t(M)),j+=di,M-=k0t(OBe(di)),sn=He(j/12),j%=12,U.days=M,U.months=j,U.years=sn,this}function q0t(C){return C*4800/146097}function OBe(C){return C*146097/4800}function Oln(C){if(!this.isValid())return NaN;var M,j,U=this._milliseconds;if(C=$e(C),C==="month"||C==="quarter"||C==="year")switch(M=this._days+U/864e5,j=this._months+q0t(M),C){case"month":return j;case"quarter":return j/3;case"year":return j/12}else switch(M=this._days+Math.round(OBe(this._months)),C){case"week":return M/7+U/6048e5;case"day":return M+U/864e5;case"hour":return M*24+U/36e5;case"minute":return M*1440+U/6e4;case"second":return M*86400+U/1e3;case"millisecond":return Math.floor(M*864e5)+U;default:throw new Error("Unknown unit "+C)}}function Eln(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+We(this._months/12)*31536e6:NaN}function MN(C){return function(){return this.as(C)}}var Pln=MN("ms"),Mln=MN("s"),Rln=MN("m"),Iln=MN("h"),Aln=MN("d"),Nln=MN("w"),Dln=MN("M"),jln=MN("Q"),$ln=MN("y");function Lln(){return xC(this)}function Fln(C){return C=$e(C),this.isValid()?this[C+"s"]():NaN}function yz(C){return function(){return this.isValid()?this._data[C]:NaN}}var kln=yz("milliseconds"),qln=yz("seconds"),Bln=yz("minutes"),Uln=yz("hours"),zln=yz("days"),Vln=yz("months"),Hln=yz("years");function Wln(){return He(this.days()/7)}var RN=Math.round,N6={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Jln(C,M,j,U,G){return G.relativeTime(M||1,!!j,C,U)}function Kln(C,M,j,U){var G=xC(C).abs(),pe=RN(G.as("s")),Fe=RN(G.as("m")),sn=RN(G.as("h")),di=RN(G.as("d")),hu=RN(G.as("M")),yb=RN(G.as("w")),IN=RN(G.as("y")),IL=pe<=j.ss&&["s",pe]||pe<j.s&&["ss",pe]||Fe<=1&&["m"]||Fe<j.m&&["mm",Fe]||sn<=1&&["h"]||sn<j.h&&["hh",sn]||di<=1&&["d"]||di<j.d&&["dd",di];return j.w!=null&&(IL=IL||yb<=1&&["w"]||yb<j.w&&["ww",yb]),IL=IL||hu<=1&&["M"]||hu<j.M&&["MM",hu]||IN<=1&&["y"]||["yy",IN],IL[2]=M,IL[3]=+C>0,IL[4]=U,Jln.apply(null,IL)}function Gln(C){return C===void 0?RN:typeof C=="function"?(RN=C,!0):!1}function Xln(C,M){return N6[C]===void 0?!1:M===void 0?N6[C]:(N6[C]=M,C==="s"&&(N6.ss=M-1),!0)}function Zln(C,M){if(!this.isValid())return this.localeData().invalidDate();var j=!1,U=N6,G,pe;return typeof C=="object"&&(M=C,C=!1),typeof C=="boolean"&&(j=C),typeof M=="object"&&(U=Object.assign({},N6,M),M.s!=null&&M.ss==null&&(U.ss=M.s-1)),G=this.localeData(),pe=Kln(this,!j,U,G),j&&(pe=G.pastFuture(+this,pe)),G.postformat(pe)}var EBe=Math.abs;function D6(C){return(C>0)-(C<0)||+C}function vpe(){if(!this.isValid())return this.localeData().invalidDate();var C=EBe(this._milliseconds)/1e3,M=EBe(this._days),j=EBe(this._months),U,G,pe,Fe,sn=this.asSeconds(),di,hu,yb,IN;return sn?(U=He(C/60),G=He(U/60),C%=60,U%=60,pe=He(j/12),j%=12,Fe=C?C.toFixed(3).replace(/\.?0+$/,""):"",di=sn<0?"-":"",hu=D6(this._months)!==D6(sn)?"-":"",yb=D6(this._days)!==D6(sn)?"-":"",IN=D6(this._milliseconds)!==D6(sn)?"-":"",di+"P"+(pe?hu+pe+"Y":"")+(j?hu+j+"M":"")+(M?yb+M+"D":"")+(G||U||C?"T":"")+(G?IN+G+"H":"")+(U?IN+U+"M":"")+(C?IN+Fe+"S":"")):"P0D"}var ta=ppe.prototype;ta.isValid=Usn,ta.abs=Sln,ta.add=Cln,ta.subtract=xln,ta.as=Oln,ta.asMilliseconds=Pln,ta.asSeconds=Mln,ta.asMinutes=Rln,ta.asHours=Iln,ta.asDays=Aln,ta.asWeeks=Nln,ta.asMonths=Dln,ta.asQuarters=jln,ta.asYears=$ln,ta.valueOf=Eln,ta._bubble=Tln,ta.clone=Lln,ta.get=Fln,ta.milliseconds=kln,ta.seconds=qln,ta.minutes=Bln,ta.hours=Uln,ta.days=zln,ta.weeks=Wln,ta.months=Vln,ta.years=Hln,ta.humanize=Zln,ta.toISOString=vpe,ta.toString=vpe,ta.toJSON=vpe,ta.locale=E0t,ta.localeData=M0t,ta.toIsoString=P("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",vpe),ta.lang=P0t,L("X",0,0,"unix"),L("x",0,0,"valueOf"),Ee("x",wm),Ee("X",nt),xi("X",function(C,M,j){j._d=new Date(parseFloat(C)*1e3)}),xi("x",function(C,M,j){j._d=new Date(We(C))});return e.version="2.29.4",r(ll),e.fn=pt,e.min=Fsn,e.max=ksn,e.now=qsn,e.utc=f,e.unix=hln,e.months=yln,e.isDate=l,e.locale=ML,e.invalid=g,e.duration=xC,e.isMoment=O,e.weekdays=_ln,e.parseZone=gln,e.localeData=EN,e.isDuration=mpe,e.monthsShort=bln,e.weekdaysMin=wln,e.defineLocale=mBe,e.updateLocale=hsn,e.locales=gsn,e.weekdaysShort=vln,e.normalizeUnits=$e,e.relativeTimeRounding=Gln,e.relativeTimeThreshold=Xln,e.calendarFormat=dun,e.prototype=pt,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 nw(t,e){let r=ee();return e?.apiKey||r[Tge[t]]||""}function Gvn(){return[{name:"copilot-plus-flash",provider:"copilot-plus"},{name:"google/gemini-2.5-flash",provider:"openrouterai"}]}function lNt(t){return Gvn().some(e=>e.name===t.name&&e.provider===t.provider)}var g4=v(()=>{gr();Qe()});var cNt={};En(cNt,{CustomError:()=>qo,MissingApiKeyError:()=>nte,MissingModelKeyError:()=>NJ,MissingPlusLicenseError:()=>y4,TimeoutError:()=>rte,UserCancelledError:()=>BWe});var qo,rte,nte,y4,NJ,BWe,OS=v(()=>{qo=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype)}},rte=class t extends Error{constructor(e,r){super(`${e} timed out after ${r}ms`),this.name="TimeoutError",Object.setPrototypeOf(this,t.prototype)}},nte=class t extends Error{constructor(e="API key is not configured."){super(e),this.name="MissingApiKeyError",Object.setPrototypeOf(this,t.prototype)}},y4=class t extends Error{constructor(e="Copilot Plus license key is not configured."){super(e),this.name="MissingPlusLicenseError",Object.setPrototypeOf(this,t.prototype)}},NJ=class t extends Error{constructor(e="No model key found. Please select a model in settings."){super(e),this.name="MissingModelKeyError",Object.setPrototypeOf(this,t.prototype)}},BWe=class t extends Error{constructor(){super("User cancelled"),this.name="UserCancelledError",Object.setPrototypeOf(this,t.prototype)}}});function n1(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return t}}function fNt(t){let e=t?.detail||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function Zvn(t){let e=fNt(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function pNt(t){let e=fNt(t);return Zvn(t)?zWe.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:zWe.UNKNOWN_ERROR)}function DJ(t){return t.replace(/^#/,"").trim()}function jJ(t,e={}){let{trimStart:r=!0}=e;if(t.startsWith("---")){let n=t.indexOf("---",3);if(n!==-1){let o=t.slice(n+3);return r?o.trimStart():o.startsWith(`\r
`)?o.slice(2):o.startsWith(`
`)||o.startsWith("\r")?o.slice(1):o}}return t}function sO(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(DJ(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(DJ(i))}):typeof n=="string"&&o.add(DJ(n))),Array.from(o)}function Oge(t,e,r){if(e.length===0)return[];e=e.map(i=>DJ(i));let n=r&&r.length>0?r:ite(t,"/"),o=[];for(let i of n){let a=sO(i);e.some(s=>a.includes(s))&&o.push(i)}return o}async function ql(t){let e=(0,xy.normalizePath)(t).replace(/^\/+/,"").replace(/\/+$/,"");if(!e)return;let r=e.split("/").filter(Boolean),n="";for(let o of r){n=n?`${n}/${o}`:o;let i=app.vault.getAbstractFileByPath(n);if(i){if(i instanceof xy.TFile)throw new Error(`Path conflict: "${n}" exists as a file, expected folder.`);continue}await app.vault.adapter.mkdir(n)}}function Ege(t){return t?GWe.includes(t.extension):!1}async function $J(t,e){return Ege(t)?await e.read(t):null}function Pge(t){return t.basename}function uO(t){return t?PNt.includes(t.extension):!1}function Rb(t){return t==="copilot_plus"||t==="project"}function LJ(t,e){return t?Ege(t)?!0:Rb(e):!1}function hNt(t,e){return!t||!e?!1:t.includes(VWe)&&e.includes(VWe)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function Mge(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 gNt(t,e){let r=new Map;return t.forEach(n=>{let o=e.getAbstractFileByPath(n);if(o instanceof xy.TFile)r.set(o.path,o);else{let a=e.getMarkdownFiles().filter(s=>s.basename===n);a.length>0&&(ewn(n,e)?r.set(a[0].path,a[0]):console.warn(`Found multiple files with title "${n}". Expected a full path for duplicate titles.`))}}),Array.from(r.values())}function ES(t,e){let r=/\[\[(.*?)\]\]/g,n=t.match(r);if(!n)return[];let o=n.map(i=>i.slice(2,-2));return gNt(o,e)}function yNt(t,e){let r=/\{\[\[(.*?)\]\]\}/g,n=t.match(r);if(!n)return[];let o=n.map(i=>i.slice(3,-3));return gNt(o,e)}function ewn(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function bNt(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function _Nt(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}function HWe(t){if(!t||typeof t!="string")return{isValid:!1,error:"URL is required"};let e=t.trim();if(!e)return{isValid:!1,error:"URL cannot be empty"};let r=WWe(e);return r?/^[a-zA-Z0-9_-]{11}$/.test(r)?{isValid:!0,videoId:r}:{isValid:!1,error:"Invalid YouTube video ID"}:{isValid:!1,error:"Invalid YouTube URL format"}}function WWe(t){try{let e=[/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/v\/)([a-zA-Z0-9_-]{11})/,/youtube\.com\/shorts\/([a-zA-Z0-9_-]{11})/];for(let r of e){let n=t.match(r);if(n&&n[1])return n[1]}return null}catch{return null}}function vNt(t){return`https://www.youtube.com/watch?v=${t}`}function wNt(t){return HWe(t).isValid}function SNt(t){if(!t||typeof t!="string")return!1;try{let e=new URL(t.trim());return(e.hostname==="x.com"||e.hostname==="www.x.com"||e.hostname==="twitter.com"||e.hostname==="www.twitter.com")&&e.pathname.includes("/status/")}catch{return!1}}function CNt(t){let e=t.matchAll(new RegExp(twn,"g"));return Array.from(e,r=>r[0])}async function hl(t,e={}){let{throwOnHttpError:r=!0}=e,n=new Headers(e.headers),o=Object.fromEntries(n.entries());delete o["content-length"],F("safeFetch request");let i=e.method?.toUpperCase()||"POST",s=await(0,xy.requestUrl)({url:t,contentType:"application/json",headers:o,method:i,...["POST","PUT","PATCH"].includes(i)&&{body:e.body?.toString()},throw:!1});if(r&&s.status>=400){let u;try{u=typeof s.json=="string"?JSON.parse(s.json):s.json}catch{try{u=typeof s.text=="string"?JSON.parse(s.text):s.text}catch{u=null}}let l=new Error(zWe.REQUEST_FAILED(s.status));if(l.json=u,u?.detail?.reason==="Invalid license key"||u?.reason==="Invalid license key")l.message="Invalid license key";else if(u?.detail?.message||u?.message){let c=u?.detail?.message||u?.message,d=u?.detail?.reason||u?.reason;l.message=d?`${c}: ${d}`:c}else u?.detail?l.message=JSON.stringify(u.detail):u&&(l.message+=". "+JSON.stringify(u));throw l}return{ok:s.status>=200&&s.status<300,status:s.status,statusText:s.status.toString(),headers:new Headers(s.headers),url:t,type:"basic",redirected:!1,bytes:()=>Promise.resolve(new Uint8Array(0)),body:rwn(s.text),bodyUsed:!0,json:()=>s.json,text:async()=>s.text,arrayBuffer:async()=>{if(s.arrayBuffer)return s.arrayBuffer;let u=s.text.replace(/^data:.*;base64,/,""),l=atob(u),c=new Uint8Array(l.length);for(let d=0;d<l.length;d++)c[d]=l.charCodeAt(d);return c.buffer},blob:()=>{throw new Error("not implemented")},formData:()=>{throw new Error("not implemented")},clone:()=>{throw new Error("not implemented")}}}function Rge(t,e={}){return hl(t,{...e,throwOnHttpError:!1})}function rwn(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function ate(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function PS(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 o1(t){let e=qC[t];return{...e,label:e.label||t}}function wg(t,e){let r=qC[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}function lO(t){let e=t;return e=lte(e),e=e.replace(/```xml\s*[\s\S]*?<write(?:File|ToFile)>[\s\S]*?<\/write(?:File|ToFile)>[\s\S]*?```/g,""),e=e.replace(/<write(?:File|ToFile)>[\s\S]*?<\/write(?:File|ToFile)>/g,""),e=e.replace(/<!--TOOL_CALL_START:[^:]+:[^:]+:[^:]+:[^:]+:[^:]*:[^:]+-->[\s\S]*?<!--TOOL_CALL_END:[^:]+:[\s\S]*?-->/g,""),e=e.replace(/<!--AGENT_REASONING:\w+:\d+:.*-->/g,""),e=e.replace(/\n{3,}/g,`

`),e=e.trim(),e}async function FJ(t,e=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new xy.Notice("No active leaf found.");return}if(r.view instanceof xy.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof xy.MarkdownView)){new xy.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to"),a=lO(t),s=a.split(`
`),u=(b,_)=>{let w=_.length-1;return w===0?{line:b.line,ch:b.ch+(_[0]?.length??0)}:{line:b.line+w,ch:_[_.length-1]?.length??0}},l=()=>{let b=e?o:i;n.replaceRange(a,b,i),n.setSelection(b,u(b,s))},c=()=>{n.focus(),new xy.Notice("Message inserted into the active note.")},d=n.cm;if(!(d?.state?.doc&&typeof d.dispatch=="function")){l(),c();return}let{from:p,to:m}=d.state.selection.main,h=e?p:m,y=d.state.toText(a),g=h+y.length;try{d.dispatch({changes:{from:h,to:m,insert:y},selection:{anchor:h,head:g}})}catch(b){Ce("CM6 dispatch failed, falling back to Obsidian API",b),l()}c()}function Ige(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function Age(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 xNt(){try{return{version:(await(0,xy.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 ste(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 nwn(t){return typeof t=="string"?t.startsWith("gpt-5"):(t.modelName||t.model||"").startsWith("gpt-5")}function kJ(t){let e=typeof t=="string"?t:t.modelName||t.model||"",r=ste(e),n=nwn(e),o=e.startsWith("claude-3-7-sonnet")||e.startsWith("claude-sonnet-4")||e.startsWith("claude-opus-4");return{isOSeries:r,isGPT5:n,isThinkingEnabled:o}}function ute(t,e="system"){return ste(t)?"human":e}function JWe(){let t=["3rd party (openai-format)","ollama","lm-studio","azure openai","github-copilot","copilot-plus","copilot-plus-jina"];return Object.keys(qC).filter(e=>!t.includes(e))}function qJ(t,e){if(t.provider==="amazon-bedrock")return t.apiKey||e.amazonBedrockApiKey?{hasApiKey:!0}:{hasApiKey:!1,errorNotice:"Amazon Bedrock API key is missing. Please add a key in Settings > API Keys or update the model configuration."};if(t.provider==="github-copilot")return!(t.apiKey||e.githubCopilotToken||e.githubCopilotAccessToken)?{hasApiKey:!1,errorNotice:"GitHub Copilot is not authenticated. Please connect it in Settings > Copilot > Basic Tab > Set Keys."}:{hasApiKey:!0};let r=!!JWe().find(o=>o===t.provider),n=!nw(t.provider,t);return r&&n?{hasApiKey:!1,errorNotice:`Please configure API Key for ${t.name} in settings first.
Path: Settings > copilot plugin > Basic Tab > Set Keys`}:{hasApiKey:!0}}function tF(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e.type==="text").map(e=>e.text).join(""):String(t||"")}function lte(t){let r=tF(t).replace(/<think>[\s\S]*?<\/think>/g,"");return r=r.replace(/<think>[\s\S]*$/g,""),r.trim()}function Nge(t){return tF(t).replace(/<errorChunk>[\s\S]*?<\/errorChunk>/g,"").trim()}function TNt(){return crypto.randomUUID()}async function Ib(t){let e=console.warn;try{return console.warn=function(...r){if(!(r[0]?.includes&&(r[0].includes("Failed to calculate number of tokens")||r[0].includes("Unknown model"))))return e.apply(console,r)},await t()}finally{console.warn=e}}async function ONt(t,e,r="Operation"){let{TimeoutError:n}=await Promise.resolve().then(()=>(OS(),cNt)),o=new AbortController,i=setTimeout(()=>{o.abort()},e);try{return await Promise.race([t(o.signal),new Promise((a,s)=>{o.signal.addEventListener("abort",()=>{s(new n(r,e))})})])}finally{clearTimeout(i)}}function cte(){let t=app.workspace.getActiveViewOfType(xy.MarkdownView);return t?t.getState().source===!0:!0}function b4(t){return new TextEncoder().encode(t).length}function ote(t,e){if(e<=0)return"";let r=new TextEncoder;if(r.encode(t).length<=e)return t;let o=0,i=t.length,a="";for(;o<=i;){let s=Math.floor((o+i)/2),u=t.substring(0,s);r.encode(u).length<=e?(a=u,o=s+1):i=s-1}return a}function KWe(t){let e=t.split("/"),r=e[e.length-1];if(b4(r)<=UWe)return t;let n=r.lastIndexOf("."),o=n>=0?r.substring(n):"",i=n>=0?r.substring(0,n):r,a=b4(o),s=UWe-a;return s<=0?e[e.length-1]=ote(r,UWe):e[e.length-1]=ote(i,s)+o,e.join("/")}async function ENt(t,e=!0){let r=null;app.workspace.iterateAllLeaves(n=>{if(n.view.getViewType()==="markdown"||n.view.getViewType()==="pdf"||n.view.getViewType()==="canvas"){let o=n.view.file;o&&o.path===t.path&&(r=n)}}),r&&e?app.workspace.setActiveLeaf(r,{focus:!0}):r||await app.workspace.getLeaf("tab").openFile(t)}var dNt,xy,zWe,ite,Yvn,Qvn,mNt,vg,twn,UWe,Dt=v(()=>{rd();gr();Xe();dNt=$(uNt()),xy=require("obsidian");g4();FWe();zWe={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}`};ite=(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})};Yvn=t=>t.last?.modelName||t.last?.model,Qvn=t=>t.last?.retriever!==void 0,mNt=t=>Yvn(t)||Qvn(t),vg=(t,e="local")=>{let r=(0,dNt.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};twn=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/;UWe=255});var BJ,XWe,dte,rd=v(()=>{nO();TS();Qv();wWe();Dt();BJ=class BJ{static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.withConfig({signal:i?.signal}),s=gc.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return BJ.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=BJ.instances.get("llm_chain");return r||(r=BJ.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,u=Ku.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=Ku.fromTemplate(`{system_message}

Answer the question with as detailed as possible based only on the following context:
{context}

Question: {question}
`),d=y=>y.map(b=>`Human: ${b[0]}
Assistant: ${b[1]}`).join(`
`),f=gc.from([{question:y=>(n&&console.log("Input Question: ",y.question),y.question),chat_history:y=>{let g=d(y.chat_history);return n&&console.log("Formatted Chat History: ",g),g}},u,o,new uWe,y=>{let g=lte(y),b=Nge(g);return n&&console.log("Standalone Question: ",b),b}]),p=async y=>(r(y),Qee(y)),m=gc.from([{context:i.pipe(p),question:new pl,system_message:()=>a},c,o]);return f.pipe(m)}};BJ.instances=new Map;XWe=BJ,dte=XWe});var fte=v(()=>{});var ZWe,i1,Du,Zs,ow,FC,own,iwn,awn,swn,uwn,LWe,RNt,INt,pte,N_,YWe,mte,_4,hte,QWe,gte,e3e,t3e,Dge,r3e,yte,jge,$ge,n3e,Lge,lwn,o3e,Cge,iw,a1,Ab,UJ,Mb,rF,aO,kC,m4,VWe,qC,Tge,ANt,IJ,ur,Fge,kge,GWe,PNt,zJ,Do,MS,gr=v(()=>{y_();rd();fte();ZWe="https://api.brevilabs.com/v1",i1="https://models.brevilabs.com/v1",Du="copilot-chat-view",Zs="user",ow="ai",FC="copilot",own=`${FC}/copilot-conversations`,iwn=`${FC}/copilot-custom-prompts`,awn=`${FC}/memory`,swn=`${FC}/system-prompts`,uwn="",LWe=FC,RNt=`You are Obsidian Copilot, a helpful assistant that integrates AI to Obsidian note-taking.
  1. Never mention that you do not have access to something. Always rely on the user provided context.
  2. Always answer to the best of your knowledge. If you are unsure about something, say so and ask the user to provide more context.
  3. If the user mentions "note", it most likely means an Obsidian note in the vault, not the generic meaning of a note.
  4. If the user mentions "@vault", it means the user wants you to search the Obsidian vault for information relevant to the query. The search results will be provided to you in the context along with the user query, read it carefully and answer the question based on the information provided. If there's no relevant information in the vault, just say so.
  5. If the user mentions any other tool with the @ symbol, check the context for their results. If nothing is found, just ignore the @ symbol in the query.
  6. Always use $'s instead of \\[ etc. for LaTeX equations.
  7. When showing note titles, use [[title]] format and do not wrap them in \` \`.
  8. When showing **Obsidian internal** image links, use ![[link]] format and do not wrap them in \` \`.
  9. When showing **web** image links, use ![link](url) format and do not wrap them in \` \`.
  10. When generating a table, format as github markdown tables, however, for table headings, immediately add ' |' after the table heading.
  11. Always respond in the language of the user's query.
  12. Do NOT mention the additional context provided such as getCurrentTime and getTimeRangeMs if it's irrelevant to the user message.
  13. If the user mentions "tags", it most likely means tags in Obsidian note properties.
  14. YouTube URLs: If the user provides YouTube URLs in their message, transcriptions will be automatically fetched and provided to you. You don't need to do anything special - just use the transcription content if available.
  15. For markdown lists, always use '- ' (hyphen followed by exactly one space) for bullet points, with no leading spaces before the hyphen. Never use '*' (asterisk) for bullets.`,INt=`Return the new note content or canvas JSON in <writeFile> tags.

  # Steps to find the the target notes
  1. Extract the target note information from user message and find out the note path from the context below.
  2. If target note is not specified, use the <active_note> as the target note.
  3. If still failed to find the target note or the note path, ask the user to specify the target note.

  # Examples

  Input: Add a new section to note A
  Output:
  <writeFile>
  <path>path/to/file.md</path>
  <content>The FULL CONTENT of the note A with added section goes here</content>
  </writeFile>

  Input: Create a new canvas with "Hello, world!"
  Output:
  <writeFile>
  <path>path/to/file.canvas</path>
  <content>
  {
    "nodes": [
      {
        "id": "1",
        "type": "text",
        "text": "Hello, world!",
        "x": 0,
        "y": 0,
        "width": 200,
        "height": 50
      }
    ],
    "edges": []
  }
  </content>
  </writeFile>

  Input: Create a canvas with a file node and a group
  Output:
  <writeFile>
  <path>path/to/file.canvas</path>
  <content>
  {
    "nodes": [
      {"id": "1", "type": "file", "file": "note.md", "subpath": "#heading", "x": 100, "y": 100, "width": 300, "height": 200, "color": "2"},
      {"id": "2", "type": "group", "label": "My Group", "x": 50, "y": 50, "width": 400, "height": 300, "color": "1"},
      {"id": "3", "type": "link", "url": "https://example.com", "x": 500, "y": 100, "width": 200, "height": 100, "color": "#FF5733"}
    ],
    "edges": [
      {"id": "e1-2", "fromNode": "1", "toNode": "3", "fromSide": "right", "toSide": "left", "fromEnd": "arrow", "toEnd": "none", "color": "3", "label": "references"}
    ]
  }
  </content>
  </writeFile>

  # Canvas JSON Format (JSON Canvas spec 1.0)
  Required node fields: id, type, x, y, width, height
  Node types: "text" (needs text), "file" (needs file), "link" (needs url), "group" (optional label)
  Optional node fields: color (hex #FF0000 or preset "1"-"6"), subpath (file nodes, starts with #)
  Required edge fields: id, fromNode, toNode
  Optional edge fields: fromSide/toSide ("top"/"right"/"bottom"/"left"), fromEnd/toEnd ("none"/"arrow"), color, label
  All IDs must be unique. Edge nodes must reference existing node IDs.
  Position nodes with reasonable spacing and logical visual flow.
  `,pte="note_context",N_="selected_text",YWe="web_selected_text",mte="variable",_4="variable_note",hte="embedded_pdf",QWe="embedded_note",gte="dataview_block",e3e="retrieved_document",t3e="web_tab_context",Dge="active_web_tab",r3e="youtube_video_context",yte="{activeWebTab}",jge=6e3,$ge=.4,n3e=448e3,Lge=3e4,lwn=30,o3e=5*60*1e3,Cge=16,iw={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree",COMPACTING:"Compacting"},a1={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"},Ab={MAX_TOKENS:6e3,TEMPERATURE:.1,REASONING_EFFORT:"low",VERBOSITY:"medium"},UJ=131072,Mb=(g=>(g.OPENROUTERAI="openrouterai",g.OPENAI="openai",g.OPENAI_FORMAT="3rd party (openai-format)",g.ANTHROPIC="anthropic",g.GOOGLE="google",g.XAI="xai",g.AMAZON_BEDROCK="amazon-bedrock",g.AZURE_OPENAI="azure openai",g.GROQ="groq",g.OLLAMA="ollama",g.LM_STUDIO="lm-studio",g.COPILOT_PLUS="copilot-plus",g.MISTRAL="mistralai",g.DEEPSEEK="deepseek",g.COHEREAI="cohereai",g.SILICONFLOW="siliconflow",g.GITHUB_COPILOT="github-copilot",g))(Mb||{}),rF={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},aO=[{name:"copilot-plus-flash",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,core:!0,plusExclusive:!0,projectEnabled:!1,capabilities:["vision"]},{name:"google/gemini-2.5-flash",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-5.4",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"gpt-5-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"claude-sonnet-4-6",provider:"anthropic",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"gemini-3.1-flash-lite-preview",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gemini-2.5-flash",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"google/gemini-3-flash-preview",provider:"openrouterai",enabled:!1,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"google/gemini-3.1-pro-preview",provider:"openrouterai",enabled:!1,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"google/gemini-2.5-pro",provider:"openrouterai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"openai/gpt-5.4",provider:"openrouterai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"openai/gpt-5-mini",provider:"openrouterai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"grok-4-1-fast",provider:"xai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"x-ai/grok-4.1-fast",provider:"openrouterai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-4.1",provider:"openai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-4.1-mini",provider:"openai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"claude-opus-4-6",provider:"anthropic",enabled:!1,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"gemini-3-flash-preview",provider:"google",enabled:!1,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"gemini-3.1-pro-preview",provider:"google",enabled:!1,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"gemini-2.5-pro",provider:"google",enabled:!1,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"deepseek-chat",provider:"deepseek",enabled:!1,isBuiltIn:!0},{name:"deepseek-reasoner",provider:"deepseek",enabled:!1,isBuiltIn:!0,capabilities:["reasoning"]},{name:"deepseek-ai/DeepSeek-V3",provider:"siliconflow",enabled:!1,isBuiltIn:!1,baseUrl:"https://api.siliconflow.com/v1"},{name:"deepseek-ai/DeepSeek-R1",provider:"siliconflow",enabled:!1,isBuiltIn:!1,baseUrl:"https://api.siliconflow.com/v1",capabilities:["reasoning"]}],kC=(d=>(d.OPENAI="openai",d.OPENROUTERAI="openrouterai",d.COHEREAI="cohereai",d.GOOGLE="google",d.AZURE_OPENAI="azure openai",d.OLLAMA="ollama",d.LM_STUDIO="lm-studio",d.OPENAI_FORMAT="3rd party (openai-format)",d.COPILOT_PLUS="copilot-plus",d.COPILOT_PLUS_JINA="copilot-plus-jina",d.SILICONFLOW="siliconflow",d))(kC||{}),m4=[{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:"openai/text-embedding-3-small",provider:"openrouterai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"text-embedding-3-small",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"text-embedding-3-large",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"embed-multilingual-light-v3.0",provider:"cohereai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"text-embedding-004",provider:"google",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"gemini-embedding-001",provider:"google",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"gemini-embedding-2-preview",provider:"google",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"Qwen/Qwen3-Embedding-0.6B",provider:"siliconflow",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,baseUrl:"https://api.siliconflow.com/v1"}],VWe="nomic-embed-text",qC={openrouterai:{label:"OpenRouter",host:"https://openrouter.ai/api/v1/",curlBaseURL:"https://openrouter.ai/api/v1",keyManagementURL:"https://openrouter.ai/keys",listModelURL:"https://openrouter.ai/api/v1/models",testModel:"openai/gpt-5-mini"},google:{label:"Gemini",host:"https://generativelanguage.googleapis.com",curlBaseURL:"https://generativelanguage.googleapis.com/v1beta",keyManagementURL:"https://makersuite.google.com/app/apikey",listModelURL:"https://generativelanguage.googleapis.com/v1beta/models",testModel:"gemini-2.5-flash"},anthropic:{label:"Anthropic",host:"https://api.anthropic.com/",curlBaseURL:"https://api.anthropic.com",keyManagementURL:"https://console.anthropic.com/settings/keys",listModelURL:"https://api.anthropic.com/v1/models",testModel:"claude-sonnet-4-6"},openai:{label:"OpenAI",host:"https://api.openai.com",curlBaseURL:"https://api.openai.com/v1",keyManagementURL:"https://platform.openai.com/api-keys",listModelURL:"https://api.openai.com/v1/models",testModel:"gpt-5.4"},xai:{label:"XAI",host:"https://api.x.ai/v1",curlBaseURL:"https://api.x.ai/v1",keyManagementURL:"https://console.x.ai",listModelURL:"https://api.x.ai/v1/models",testModel:"grok-4-1-fast"},"azure openai":{label:"Azure",host:"https://<resource>.services.ai.azure.com/models",curlBaseURL:"https://<resource>.services.ai.azure.com/models",keyManagementURL:"https://ai.azure.com",listModelURL:""},groq:{label:"Groq",host:"https://api.groq.com/openai",curlBaseURL:"https://api.groq.com/openai/v1",keyManagementURL:"https://console.groq.com/keys",listModelURL:"https://api.groq.com/openai/v1/models",testModel:"llama3-8b-8192"},cohereai:{label:"Cohere",host:"https://api.cohere.com",curlBaseURL:"https://api.cohere.com/v1",keyManagementURL:"https://dashboard.cohere.ai/api-keys",listModelURL:"https://api.cohere.com/v1/models",testModel:"command-r"},siliconflow:{label:"SiliconFlow",host:"https://api.siliconflow.com/v1",curlBaseURL:"https://api.siliconflow.com/v1",keyManagementURL:"https://cloud.siliconflow.com/me/account/ak",listModelURL:"https://api.siliconflow.com/v1/models",testModel:"deepseek-ai/DeepSeek-V3"},ollama:{label:"Ollama",host:"http://localhost:11434/v1/",curlBaseURL:"http://localhost:11434",keyManagementURL:"",listModelURL:""},"lm-studio":{label:"LM Studio",host:"http://localhost:1234/v1",curlBaseURL:"http://localhost:1234/v1",keyManagementURL:"",listModelURL:""},"3rd party (openai-format)":{label:"OpenAI Format",host:"https://api.example.com/v1",curlBaseURL:"https://api.example.com/v1",keyManagementURL:"",listModelURL:""},mistralai:{label:"Mistral",host:"https://api.mistral.ai/v1",curlBaseURL:"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/",curlBaseURL:"https://api.deepseek.com",keyManagementURL:"https://platform.deepseek.com/api-keys",listModelURL:"https://api.deepseek.com/models",testModel:"deepseek-chat"},"amazon-bedrock":{label:"Amazon Bedrock",host:"https://bedrock-runtime.{region}.amazonaws.com",curlBaseURL:"https://bedrock-runtime.{region}.amazonaws.com",keyManagementURL:"https://console.aws.amazon.com/iam/home#/security_credentials",listModelURL:""},"copilot-plus":{label:"Copilot Plus",host:i1,curlBaseURL:i1,keyManagementURL:"",listModelURL:""},"copilot-plus-jina":{label:"Copilot Plus",host:i1,curlBaseURL:i1,keyManagementURL:"",listModelURL:""},"github-copilot":{label:"GitHub Copilot",host:"https://api.githubcopilot.com",curlBaseURL:"https://api.githubcopilot.com",keyManagementURL:"https://github.com/settings/apps/authorizations",listModelURL:""}},Tge={anthropic:"anthropicApiKey",openai:"openAIApiKey","azure openai":"azureOpenAIApiKey",google:"googleApiKey",groq:"groqApiKey",openrouterai:"openRouterAiApiKey",cohereai:"cohereApiKey",xai:"xaiApiKey","copilot-plus":"plusLicenseKey",mistralai:"mistralApiKey",deepseek:"deepseekApiKey","amazon-bedrock":"amazonBedrockApiKey",siliconflow:"siliconflowApiKey","github-copilot":"githubCopilotToken"},ANt=["NEVER","ON STARTUP","ON MODE SWITCH"],IJ=(r=>(r.ENTER="enter",r.SHIFT_ENTER="shift+enter",r))(IJ||{}),ur={TRIGGER_QUICK_COMMAND:"trigger-quick-command",CLEAR_LOCAL_COPILOT_INDEX:"clear-local-copilot-index",CLEAR_COPILOT_CACHE:"clear-copilot-cache",COUNT_WORD_AND_TOKENS_SELECTION:"count-word-and-tokens-selection",COUNT_TOTAL_VAULT_TOKENS:"count-total-vault-tokens",DEBUG_WORD_COMPLETION:"debug-word-completion",FORCE_REINDEX_VAULT_TO_COPILOT_INDEX:"force-reindex-vault-to-copilot-index",GARBAGE_COLLECT_COPILOT_INDEX:"garbage-collect-copilot-index",INDEX_VAULT_TO_COPILOT_INDEX:"index-vault-to-copilot-index",INSPECT_COPILOT_INDEX_BY_NOTE_PATHS:"copilot-inspect-index-by-note-paths",LIST_INDEXED_FILES:"copilot-list-indexed-files",LOAD_COPILOT_CHAT_CONVERSATION:"load-copilot-chat-conversation",NEW_CHAT:"new-chat",OPEN_COPILOT_CHAT_WINDOW:"chat-open-window",REMOVE_FILES_FROM_COPILOT_INDEX:"remove-files-from-copilot-index",SEARCH_ORAMA_DB:"copilot-search-orama-db",TOGGLE_COPILOT_CHAT_WINDOW:"chat-toggle-window",ADD_SELECTION_TO_CHAT_CONTEXT:"add-selection-to-chat-context",ADD_WEB_SELECTION_TO_CHAT_CONTEXT:"add-web-selection-to-chat-context",ADD_CUSTOM_COMMAND:"add-custom-command",APPLY_CUSTOM_COMMAND:"apply-custom-command",OPEN_LOG_FILE:"open-log-file",CLEAR_LOG_FILE:"clear-log-file",DOWNLOAD_YOUTUBE_SCRIPT:"download-youtube-script",TRIGGER_QUICK_ASK:"trigger-quick-ask"},Fge={[ur.TRIGGER_QUICK_COMMAND]:"Trigger quick command",[ur.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[ur.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[ur.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[ur.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[ur.DEBUG_WORD_COMPLETION]:"Word completion: Debug",[ur.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[ur.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[ur.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[ur.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[ur.LIST_INDEXED_FILES]:"List all indexed files (debug)",[ur.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[ur.NEW_CHAT]:"New Copilot Chat",[ur.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[ur.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[ur.SEARCH_ORAMA_DB]:"Search semantic index (debug)",[ur.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window",[ur.ADD_SELECTION_TO_CHAT_CONTEXT]:"Add selection to chat context",[ur.ADD_WEB_SELECTION_TO_CHAT_CONTEXT]:"Add web selection to chat context",[ur.ADD_CUSTOM_COMMAND]:"Add new custom command",[ur.APPLY_CUSTOM_COMMAND]:"Apply custom command",[ur.OPEN_LOG_FILE]:"Create log file",[ur.CLEAR_LOG_FILE]:"Clear log file",[ur.DOWNLOAD_YOUTUBE_SCRIPT]:"Download YouTube Script (plus)",[ur.TRIGGER_QUICK_ASK]:"Quick Ask"},kge={[ur.NEW_CHAT]:"message-square-plus",[ur.OPEN_COPILOT_CHAT_WINDOW]:"message-square",[ur.TOGGLE_COPILOT_CHAT_WINDOW]:"message-square",[ur.LOAD_COPILOT_CHAT_CONVERSATION]:"history",[ur.TRIGGER_QUICK_COMMAND]:"terminal-square",[ur.TRIGGER_QUICK_ASK]:"sparkles",[ur.ADD_SELECTION_TO_CHAT_CONTEXT]:"text-cursor-input",[ur.ADD_WEB_SELECTION_TO_CHAT_CONTEXT]:"globe",[ur.ADD_CUSTOM_COMMAND]:"plus-circle",[ur.APPLY_CUSTOM_COMMAND]:"play-circle",[ur.INDEX_VAULT_TO_COPILOT_INDEX]:"refresh-cw",[ur.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"rotate-cw",[ur.CLEAR_LOCAL_COPILOT_INDEX]:"trash-2",[ur.CLEAR_COPILOT_CACHE]:"eraser",[ur.GARBAGE_COLLECT_COPILOT_INDEX]:"filter-x",[ur.COUNT_TOTAL_VAULT_TOKENS]:"calculator",[ur.COUNT_WORD_AND_TOKENS_SELECTION]:"hash",[ur.OPEN_LOG_FILE]:"file-text",[ur.CLEAR_LOG_FILE]:"file-x",[ur.DOWNLOAD_YOUTUBE_SCRIPT]:"youtube"},GWe=["md","canvas","base"],PNt=[...GWe,"pdf"],zJ={NON_MARKDOWN_FILES_RESTRICTED:"Non-markdown files are only available in Copilot Plus mode. Please upgrade to access this file type.",URL_PROCESSING_RESTRICTED:"URL processing is only available in Copilot Plus mode. URLs will not be processed for context.",UNSUPPORTED_FILE_TYPE:t=>`${t.toUpperCase()} files are not supported in the current mode.`},Do={userId:gu(),isPlusUser:!1,plusLicenseKey:"",openAIApiKey:"",openAIOrgId:"",huggingfaceApiKey:"",cohereApiKey:"",anthropicApiKey:"",azureOpenAIApiKey:"",azureOpenAIApiInstanceName:"",azureOpenAIApiDeploymentName:"",azureOpenAIApiVersion:"",azureOpenAIApiEmbeddingDeploymentName:"",googleApiKey:"",openRouterAiApiKey:"",xaiApiKey:"",mistralApiKey:"",deepseekApiKey:"",amazonBedrockApiKey:"",amazonBedrockRegion:"",siliconflowApiKey:"",githubCopilotAccessToken:"",githubCopilotToken:"",githubCopilotTokenExpiresAt:0,defaultChainType:"llm_chain",defaultModelKey:"google/gemini-2.5-flash|openrouterai",embeddingModelKey:"openai/text-embedding-3-small|openrouterai",temperature:Ab.TEMPERATURE,maxTokens:Ab.MAX_TOKENS,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:own,defaultConversationTag:"copilot-conversation",autosaveChat:!0,generateAIChatTitleOnSave:!0,autoAddActiveContentToContext:!0,defaultOpenArea:"view",defaultSendShortcut:"enter",customPromptsFolder:iwn,indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:LWe,qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:lwn,enableInlineCitations:!0,groqApiKey:"",activeModels:aO,activeEmbeddingModels:m4,embeddingRequestsPerMin:60,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,lexicalSearchRamLimit:100,promptUsageTimestamps:{},promptSortStrategy:"timestamp",chatHistorySortStrategy:"recent",projectListSortStrategy:"recent",defaultConversationNoteName:"{$topic}@{$date}_{$time}",inlineEditCommands:[],projectList:[],lastDismissedVersion:null,passMarkdownImages:!0,enableAutonomousAgent:!0,enableCustomPromptTemplating:!0,enableSemanticSearchV3:!1,enableSelfHostMode:!1,enableMiyo:!1,miyoSearchAll:!1,selfHostModeValidatedAt:null,selfHostValidationCount:0,selfHostUrl:"",selfHostApiKey:"",miyoServerUrl:"",selfHostSearchProvider:"firecrawl",firecrawlApiKey:"",perplexityApiKey:"",supadataApiKey:"",enableLexicalBoosts:!0,suggestedDefaultCommands:!1,autonomousAgentMaxIterations:4,autonomousAgentEnabledToolIds:["localSearch","readNote","webSearch","pomodoro","youtubeTranscription","writeFile","editFile","updateMemory"],reasoningEffort:Ab.REASONING_EFFORT,verbosity:Ab.VERBOSITY,memoryFolderName:awn,enableRecentConversations:!0,maxRecentConversations:30,enableSavedMemory:!0,quickCommandModelKey:void 0,quickCommandIncludeNoteContext:!0,autoIncludeTextSelection:!1,autoAddSelectionToContext:!1,autoAcceptEdits:!1,diffViewMode:"split",userSystemPromptsFolder:swn,defaultSystemPromptTitle:"",autoCompactThreshold:128e3,convertedDocOutputFolder:uwn},MS={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change",ABORT_STREAM:"abort-stream"}});var a3e=S(qge=>{"use strict";qge.byteLength=dwn;qge.toByteArray=pwn;qge.fromByteArray=gwn;var cO=[],RS=[],cwn=typeof Uint8Array<"u"?Uint8Array:Array,i3e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(v4=0,NNt=i3e.length;v4<NNt;++v4)cO[v4]=i3e[v4],RS[i3e.charCodeAt(v4)]=v4;var v4,NNt;RS[45]=62;RS[95]=63;function DNt(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 dwn(t){var e=DNt(t),r=e[0],n=e[1];return(r+n)*3/4-n}function fwn(t,e,r){return(e+r)*3/4-r}function pwn(t){var e,r=DNt(t),n=r[0],o=r[1],i=new cwn(fwn(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u<s;u+=4)e=RS[t.charCodeAt(u)]<<18|RS[t.charCodeAt(u+1)]<<12|RS[t.charCodeAt(u+2)]<<6|RS[t.charCodeAt(u+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=RS[t.charCodeAt(u)]<<2|RS[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=RS[t.charCodeAt(u)]<<10|RS[t.charCodeAt(u+1)]<<4|RS[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function mwn(t){return cO[t>>18&63]+cO[t>>12&63]+cO[t>>6&63]+cO[t&63]}function hwn(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(mwn(n));return o.join("")}function gwn(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,s=r-n;a<s;a+=i)o.push(hwn(t,a,a+i>s?s:a+i));return n===1?(e=t[r-1],o.push(cO[e>>2]+cO[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(cO[e>>10]+cO[e>>4&63]+cO[e<<2&63]+"=")),o.join("")}});var jNt=S(s3e=>{s3e.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)};s3e.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 IS=S(JJ=>{"use strict";var u3e=a3e(),HJ=jNt(),$Nt=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;JJ.Buffer=Be;JJ.SlowBuffer=Swn;JJ.INSPECT_MAX_BYTES=50;var Bge=2147483647;JJ.kMaxLength=Bge;Be.TYPED_ARRAY_SUPPORT=ywn();!Be.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ywn(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(Be.prototype,"parent",{enumerable:!0,get:function(){if(Be.isBuffer(this))return this.buffer}});Object.defineProperty(Be.prototype,"offset",{enumerable:!0,get:function(){if(Be.isBuffer(this))return this.byteOffset}});function s1(t){if(t>Bge)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,Be.prototype),e}function Be(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f3e(t)}return qNt(t,e,r)}Be.poolSize=8192;function qNt(t,e,r){if(typeof t=="string")return _wn(t,e);if(ArrayBuffer.isView(t))return vwn(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(dO(t,ArrayBuffer)||t&&dO(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(dO(t,SharedArrayBuffer)||t&&dO(t.buffer,SharedArrayBuffer)))return c3e(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return Be.from(n,e,r);let o=wwn(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return Be.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}Be.from=function(t,e,r){return qNt(t,e,r)};Object.setPrototypeOf(Be.prototype,Uint8Array.prototype);Object.setPrototypeOf(Be,Uint8Array);function BNt(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 bwn(t,e,r){return BNt(t),t<=0?s1(t):e!==void 0?typeof r=="string"?s1(t).fill(e,r):s1(t).fill(e):s1(t)}Be.alloc=function(t,e,r){return bwn(t,e,r)};function f3e(t){return BNt(t),s1(t<0?0:p3e(t)|0)}Be.allocUnsafe=function(t){return f3e(t)};Be.allocUnsafeSlow=function(t){return f3e(t)};function _wn(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Be.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=UNt(t,e)|0,n=s1(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function l3e(t){let e=t.length<0?0:p3e(t.length)|0,r=s1(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function vwn(t){if(dO(t,Uint8Array)){let e=new Uint8Array(t);return c3e(e.buffer,e.byteOffset,e.byteLength)}return l3e(t)}function c3e(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,Be.prototype),n}function wwn(t){if(Be.isBuffer(t)){let e=p3e(t.length)|0,r=s1(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||h3e(t.length)?s1(0):l3e(t);if(t.type==="Buffer"&&Array.isArray(t.data))return l3e(t.data)}function p3e(t){if(t>=Bge)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Bge.toString(16)+" bytes");return t|0}function Swn(t){return+t!=t&&(t=0),Be.alloc(+t)}Be.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==Be.prototype};Be.compare=function(e,r){if(dO(e,Uint8Array)&&(e=Be.from(e,e.offset,e.byteLength)),dO(r,Uint8Array)&&(r=Be.from(r,r.offset,r.byteLength)),!Be.isBuffer(e)||!Be.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,o=r.length;for(let i=0,a=Math.min(n,o);i<a;++i)if(e[i]!==r[i]){n=e[i],o=r[i];break}return n<o?-1:o<n?1:0};Be.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}};Be.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return Be.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let o=Be.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){let a=e[n];if(dO(a,Uint8Array))i+a.length>o.length?(Be.isBuffer(a)||(a=Be.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(Be.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function UNt(t,e){if(Be.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||dO(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 d3e(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ZNt(t).length;default:if(o)return n?-1:d3e(t).length;e=(""+e).toLowerCase(),o=!0}}Be.byteLength=UNt;function Cwn(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 Nwn(this,e,r);case"utf8":case"utf-8":return VNt(this,e,r);case"ascii":return Iwn(this,e,r);case"latin1":case"binary":return Awn(this,e,r);case"base64":return Mwn(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Dwn(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}Be.prototype._isBuffer=!0;function w4(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}Be.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)w4(this,r,r+1);return this};Be.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)w4(this,r,r+3),w4(this,r+1,r+2);return this};Be.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)w4(this,r,r+7),w4(this,r+1,r+6),w4(this,r+2,r+5),w4(this,r+3,r+4);return this};Be.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?VNt(this,0,e):Cwn.apply(this,arguments)};Be.prototype.toLocaleString=Be.prototype.toString;Be.prototype.equals=function(e){if(!Be.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:Be.compare(this,e)===0};Be.prototype.inspect=function(){let e="",r=JJ.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};$Nt&&(Be.prototype[$Nt]=Be.prototype.inspect);Be.prototype.compare=function(e,r,n,o,i){if(dO(e,Uint8Array)&&(e=Be.from(e,e.offset,e.byteLength)),!Be.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),r<0||n>e.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=n)return 0;if(o>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,i>>>=0,this===e)return 0;let a=i-o,s=n-r,u=Math.min(a,s),l=this.slice(o,i),c=e.slice(r,n);for(let d=0;d<u;++d)if(l[d]!==c[d]){a=l[d],s=c[d];break}return a<s?-1:s<a?1:0};function zNt(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,h3e(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0)if(o)r=0;else return-1;if(typeof e=="string"&&(e=Be.from(e,n)),Be.isBuffer(e))return e.length===0?-1:LNt(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):LNt(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function LNt(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}Be.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};Be.prototype.indexOf=function(e,r,n){return zNt(this,e,r,n,!0)};Be.prototype.lastIndexOf=function(e,r,n){return zNt(this,e,r,n,!1)};function xwn(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(h3e(s))return a;t[r+a]=s}return a}function Twn(t,e,r,n){return Uge(d3e(e,t.length-r),t,r,n)}function Own(t,e,r,n){return Uge(Fwn(e),t,r,n)}function Ewn(t,e,r,n){return Uge(ZNt(e),t,r,n)}function Pwn(t,e,r,n){return Uge(kwn(e,t.length-r),t,r,n)}Be.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 xwn(this,e,r,n);case"utf8":case"utf-8":return Twn(this,e,r,n);case"ascii":case"latin1":case"binary":return Own(this,e,r,n);case"base64":return Ewn(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pwn(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};Be.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Mwn(t,e,r){return e===0&&r===t.length?u3e.fromByteArray(t):u3e.fromByteArray(t.slice(e,r))}function VNt(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 Rwn(n)}var FNt=4096;function Rwn(t){let e=t.length;if(e<=FNt)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=FNt));return r}function Iwn(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 Awn(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 Nwn(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+=qwn[t[i]];return o}function Dwn(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}Be.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,Be.prototype),o};function Th(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")}Be.prototype.readUintLE=Be.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Th(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return o};Be.prototype.readUintBE=Be.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Th(e,r,this.length);let o=this[e+--r],i=1;for(;r>0&&(i*=256);)o+=this[e+--r]*i;return o};Be.prototype.readUint8=Be.prototype.readUInt8=function(e,r){return e=e>>>0,r||Th(e,1,this.length),this[e]};Be.prototype.readUint16LE=Be.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Th(e,2,this.length),this[e]|this[e+1]<<8};Be.prototype.readUint16BE=Be.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Th(e,2,this.length),this[e]<<8|this[e+1]};Be.prototype.readUint32LE=Be.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Th(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};Be.prototype.readUint32BE=Be.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Th(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};Be.prototype.readBigUInt64LE=nF(function(e){e=e>>>0,WJ(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&bte(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))});Be.prototype.readBigUInt64BE=nF(function(e){e=e>>>0,WJ(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&bte(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)});Be.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Th(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};Be.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Th(e,r,this.length);let o=r,i=1,a=this[e+--o];for(;o>0&&(i*=256);)a+=this[e+--o]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*r)),a};Be.prototype.readInt8=function(e,r){return e=e>>>0,r||Th(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};Be.prototype.readInt16LE=function(e,r){e=e>>>0,r||Th(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};Be.prototype.readInt16BE=function(e,r){e=e>>>0,r||Th(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};Be.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Th(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};Be.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Th(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};Be.prototype.readBigInt64LE=nF(function(e){e=e>>>0,WJ(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&bte(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)});Be.prototype.readBigInt64BE=nF(function(e){e=e>>>0,WJ(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&bte(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)});Be.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Th(e,4,this.length),HJ.read(this,e,!0,23,4)};Be.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Th(e,4,this.length),HJ.read(this,e,!1,23,4)};Be.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Th(e,8,this.length),HJ.read(this,e,!0,52,8)};Be.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Th(e,8,this.length),HJ.read(this,e,!1,52,8)};function D_(t,e,r,n,o,i){if(!Be.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")}Be.prototype.writeUintLE=Be.prototype.writeUIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){let s=Math.pow(2,8*n)-1;D_(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};Be.prototype.writeUintBE=Be.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;D_(this,e,r,n,s,0)}let i=n-1,a=1;for(this[r+i]=e&255;--i>=0&&(a*=256);)this[r+i]=e/a&255;return r+n};Be.prototype.writeUint8=Be.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||D_(this,e,r,1,255,0),this[r]=e&255,r+1};Be.prototype.writeUint16LE=Be.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||D_(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};Be.prototype.writeUint16BE=Be.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||D_(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};Be.prototype.writeUint32LE=Be.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||D_(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};Be.prototype.writeUint32BE=Be.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||D_(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 HNt(t,e,r,n,o){XNt(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 WNt(t,e,r,n,o){XNt(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i=i>>8,t[r+6]=i,i=i>>8,t[r+5]=i,i=i>>8,t[r+4]=i;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a=a>>8,t[r+2]=a,a=a>>8,t[r+1]=a,a=a>>8,t[r]=a,r+8}Be.prototype.writeBigUInt64LE=nF(function(e,r=0){return HNt(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});Be.prototype.writeBigUInt64BE=nF(function(e,r=0){return WNt(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});Be.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);D_(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};Be.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);D_(this,e,r,n,u-1,-u)}let i=n-1,a=1,s=0;for(this[r+i]=e&255;--i>=0&&(a*=256);)e<0&&s===0&&this[r+i+1]!==0&&(s=1),this[r+i]=(e/a>>0)-s&255;return r+n};Be.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||D_(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};Be.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||D_(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};Be.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||D_(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};Be.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||D_(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};Be.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||D_(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};Be.prototype.writeBigInt64LE=nF(function(e,r=0){return HNt(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});Be.prototype.writeBigInt64BE=nF(function(e,r=0){return WNt(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function JNt(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 KNt(t,e,r,n,o){return e=+e,r=r>>>0,o||JNt(t,e,r,4,34028234663852886e22,-34028234663852886e22),HJ.write(t,e,r,n,23,4),r+4}Be.prototype.writeFloatLE=function(e,r,n){return KNt(this,e,r,!0,n)};Be.prototype.writeFloatBE=function(e,r,n){return KNt(this,e,r,!1,n)};function GNt(t,e,r,n,o){return e=+e,r=r>>>0,o||JNt(t,e,r,8,17976931348623157e292,-17976931348623157e292),HJ.write(t,e,r,n,52,8),r+8}Be.prototype.writeDoubleLE=function(e,r,n){return GNt(this,e,r,!0,n)};Be.prototype.writeDoubleBE=function(e,r,n){return GNt(this,e,r,!1,n)};Be.prototype.copy=function(e,r,n,o){if(!Be.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&o<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};Be.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"&&!Be.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=Be.isBuffer(e)?e:Be.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 VJ={};function m3e(t,e,r){VJ[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}`}}}m3e("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);m3e("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);m3e("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=kNt(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=kNt(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function kNt(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 jwn(t,e,r){WJ(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&bte(e,t.length-(r+1))}function XNt(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 VJ.ERR_OUT_OF_RANGE("value",s,t)}jwn(n,o,i)}function WJ(t,e){if(typeof t!="number")throw new VJ.ERR_INVALID_ARG_TYPE(e,"number",t)}function bte(t,e,r){throw Math.floor(t)!==t?(WJ(t,r),new VJ.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new VJ.ERR_BUFFER_OUT_OF_BOUNDS:new VJ.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var $wn=/[^+/0-9A-Za-z-_]/g;function Lwn(t){if(t=t.split("=")[0],t=t.trim().replace($wn,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function d3e(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 Fwn(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function kwn(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 ZNt(t){return u3e.toByteArray(Lwn(t))}function Uge(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 dO(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function h3e(t){return t!==t}var qwn=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 nF(t){return typeof BigInt>"u"?Bwn:t}function Bwn(){throw new Error("BigInt not supported")}});function _te(){return QNt.Platform.isDesktop&&zge||(zge=require("electron")?.remote?.safeStorage),zge}async function v3e(){return await crypto.subtle.importKey("raw",Uwn,Vge.name,!1,["encrypt","decrypt"])}async function e1t(t){if(!t.enableEncryption)return t;let e={...t},r=Object.keys(t).filter(n=>n.toLowerCase().includes("apikey")||n==="plusLicenseKey"||n==="githubCopilotAccessToken"||n==="githubCopilotToken");for(let n of r){let o=t[n];e[n]=await g3e(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await g3e(n.apiKey||"")})))),Array.isArray(t.activeEmbeddingModels)&&(e.activeEmbeddingModels=await Promise.all(t.activeEmbeddingModels.map(async n=>({...n,apiKey:await g3e(n.apiKey||"")})))),e}async function g3e(t){if(!t||t.startsWith(w3e))return t;t1t(t)&&(t=t.replace(Hge,""));try{if(_te()?.isEncryptionAvailable()){let o=_te().encryptString(t);return b3e+o.toString("base64")}let e=await v3e(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(Vge,e,r);return _3e+Vwn(n)}catch(e){return console.error("Encryption failed:",e),t}}async function kn(t){if(!t||zwn(t))return t;if(t1t(t))return t.replace(Hge,"");if(t.startsWith(b3e)){let r=t.replace(b3e,""),n=y3e.Buffer.from(r,"base64");return _te().decryptString(n)}if(t.startsWith(_3e)){let r=t.replace(_3e,""),n=await v3e(),o=YNt(r),i=await crypto.subtle.decrypt(Vge,n,o);return new TextDecoder().decode(i)}let e=t.replace(w3e,"");try{if(_te()?.isEncryptionAvailable())try{let i=y3e.Buffer.from(e,"base64");return _te().decryptString(i)}catch{}let r=await v3e(),n=YNt(e),o=await crypto.subtle.decrypt(Vge,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function zwn(t){return!t.startsWith(w3e)&&!t.startsWith(Hge)}function t1t(t){return t.startsWith(Hge)}function Vwn(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 YNt(t){let e=window.atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r.buffer}var y3e,QNt,zge,b3e,_3e,w3e,Hge,Uwn,Vge,BC=v(()=>{y3e=$(IS()),QNt=require("obsidian"),zge=null;b3e="enc_desk_",_3e="enc_web_",w3e="enc_",Hge="dec_",Uwn=new TextEncoder().encode("obsidian-copilot-v1"),Vge={name:"AES-GCM",iv:new Uint8Array(12)}});function a1t(t){jo.set(Jge,t)}function j_(){return jo.get(Jge)}function s1t(t){return jo.sub(Jge,t)}function oF(){return e1(Jge,{store:jo})}function UC(){return jo.get(Kge)}function S4(t){jo.set(Kge,t)}function u1t(t){return jo.sub(Kge,t)}function aw(){return e1(Kge,{store:jo})}function C4(t){jo.set(Wge,t)}function Gu(){return jo.get(Wge)}function XJ(t){return jo.sub(Wge,()=>{t(jo.get(Wge))})}function fO(t){jo.set(i1t,t)}function Gge(){return e1(i1t,{store:jo})}function ZJ(){return UC()==="project"}function pO(t){jo.set(S3e,t)}function zC(){return jo.get(S3e)}function l1t(t){let e=zC();pO(e.filter(r=>r.id!==t))}function c1t(){pO([])}function d1t(){return e1(S3e,{store:jo})}function f1t(t){jo.set(vte,t)}function mO(t,e){jo.set(vte,r=>({...r,[t]:e(r[t])}))}function YJ(){return e1(vte,{store:jo})}function QJ(){return jo.get(wte)}function C3e(t){jo.set(wte,t)}function Sg(t){jo.set(wte,e=>({...e,...t}))}function x3e(){AS!==null&&(clearTimeout(AS),AS=null),KJ=0,GJ=0,jo.set(wte,{isActive:!1,isPaused:!1,isCancelled:!1,indexedCount:0,totalFiles:0,errors:[],completionStatus:"none"})}function p1t(t){GJ=t;let e=Date.now();e-KJ>=o1t?(KJ=e,AS!==null&&(clearTimeout(AS),AS=null),Sg({indexedCount:GJ})):AS===null&&(AS=setTimeout(()=>{KJ=Date.now(),AS=null,Sg({indexedCount:GJ})},o1t-(e-KJ)))}function m1t(){AS!==null&&(clearTimeout(AS),AS=null),Sg({indexedCount:GJ}),KJ=0,GJ=0}function e5(){return e1(wte,{store:jo})}var r1t,Jge,n1t,Kge,Wge,i1t,vte,wte,S3e,KJ,GJ,AS,o1t,na=v(()=>{rd();Qe();LC();r1t=yc(null),Jge=yc(t=>{let e=t(r1t);return e!==null?e:t(eF).defaultModelKey},(t,e,r)=>{e(r1t,r)}),n1t=yc(null),Kge=yc(t=>{let e=t(n1t);return e!==null?e:t(eF).defaultChainType},(t,e,r)=>{e(n1t,r)}),Wge=yc(null),i1t=yc(!1),vte=yc({success:[],failed:[],processingFiles:[],total:[]}),wte=yc({isActive:!1,isPaused:!1,isCancelled:!1,indexedCount:0,totalFiles:0,errors:[],completionStatus:"none"}),S3e=yc([]);KJ=0,GJ=0,AS=null,o1t=500});var x1t=S(Xu=>{"use strict";function P3e(t,e){var r=t.length;t.push(e);e:for(;0<r;){var n=r-1>>>1,o=t[n];if(0<Xge(o,e))t[n]=e,t[r]=o,r=n;else break e}}function VC(t){return t.length===0?null:t[0]}function Yge(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>Xge(s,r))u<o&&0>Xge(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(u<o&&0>Xge(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function Xge(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(h1t=performance,Xu.unstable_now=function(){return h1t.now()}):(T3e=Date,g1t=T3e.now(),Xu.unstable_now=function(){return T3e.now()-g1t});var h1t,T3e,g1t,hO=[],iF=[],Hwn=1,NS=null,Ty=3,Qge=!1,x4=!1,Cte=!1,_1t=typeof setTimeout=="function"?setTimeout:null,v1t=typeof clearTimeout=="function"?clearTimeout:null,y1t=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M3e(t){for(var e=VC(iF);e!==null;){if(e.callback===null)Yge(iF);else if(e.startTime<=t)Yge(iF),e.sortIndex=e.expirationTime,P3e(hO,e);else break;e=VC(iF)}}function R3e(t){if(Cte=!1,M3e(t),!x4)if(VC(hO)!==null)x4=!0,A3e(I3e);else{var e=VC(iF);e!==null&&N3e(R3e,e.startTime-t)}}function I3e(t,e){x4=!1,Cte&&(Cte=!1,v1t(xte),xte=-1),Qge=!0;var r=Ty;try{for(M3e(e),NS=VC(hO);NS!==null&&(!(NS.expirationTime>e)||t&&!C1t());){var n=NS.callback;if(typeof n=="function"){NS.callback=null,Ty=NS.priorityLevel;var o=n(NS.expirationTime<=e);e=Xu.unstable_now(),typeof o=="function"?NS.callback=o:NS===VC(hO)&&Yge(hO),M3e(e)}else Yge(hO);NS=VC(hO)}if(NS!==null)var i=!0;else{var a=VC(iF);a!==null&&N3e(R3e,a.startTime-e),i=!1}return i}finally{NS=null,Ty=r,Qge=!1}}var eye=!1,Zge=null,xte=-1,w1t=5,S1t=-1;function C1t(){return!(Xu.unstable_now()-S1t<w1t)}function O3e(){if(Zge!==null){var t=Xu.unstable_now();S1t=t;var e=!0;try{e=Zge(!0,t)}finally{e?Ste():(eye=!1,Zge=null)}}else eye=!1}var Ste;typeof y1t=="function"?Ste=function(){y1t(O3e)}:typeof MessageChannel<"u"?(E3e=new MessageChannel,b1t=E3e.port2,E3e.port1.onmessage=O3e,Ste=function(){b1t.postMessage(null)}):Ste=function(){_1t(O3e,0)};var E3e,b1t;function A3e(t){Zge=t,eye||(eye=!0,Ste())}function N3e(t,e){xte=_1t(function(){t(Xu.unstable_now())},e)}Xu.unstable_IdlePriority=5;Xu.unstable_ImmediatePriority=1;Xu.unstable_LowPriority=4;Xu.unstable_NormalPriority=3;Xu.unstable_Profiling=null;Xu.unstable_UserBlockingPriority=2;Xu.unstable_cancelCallback=function(t){t.callback=null};Xu.unstable_continueExecution=function(){x4||Qge||(x4=!0,A3e(I3e))};Xu.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"):w1t=0<t?Math.floor(1e3/t):5};Xu.unstable_getCurrentPriorityLevel=function(){return Ty};Xu.unstable_getFirstCallbackNode=function(){return VC(hO)};Xu.unstable_next=function(t){switch(Ty){case 1:case 2:case 3:var e=3;break;default:e=Ty}var r=Ty;Ty=e;try{return t()}finally{Ty=r}};Xu.unstable_pauseExecution=function(){};Xu.unstable_requestPaint=function(){};Xu.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=Ty;Ty=t;try{return e()}finally{Ty=r}};Xu.unstable_scheduleCallback=function(t,e,r){var n=Xu.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:Hwn++,callback:e,priorityLevel:t,startTime:r,expirationTime:o,sortIndex:-1},r>n?(t.sortIndex=r,P3e(iF,t),VC(hO)===null&&t===VC(iF)&&(Cte?(v1t(xte),xte=-1):Cte=!0,N3e(R3e,r-n))):(t.sortIndex=o,P3e(hO,t),x4||Qge||(x4=!0,A3e(I3e))),t};Xu.unstable_shouldYield=C1t;Xu.unstable_wrapCallback=function(t){var e=Ty;return function(){var r=Ty;Ty=e;try{return t.apply(this,arguments)}finally{Ty=r}}}});var O1t=S((vzi,T1t)=>{"use strict";T1t.exports=x1t()});var A$t=S(fw=>{"use strict";var NDt=K(),cw=O1t();function dt(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 DDt=new Set,Wte={};function L4(t,e){w5(t,e),w5(t+"Capture",e)}function w5(t,e){for(Wte[t]=e,t=0;t<e.length;t++)DDt.add(e[t])}var p1=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),r6e=Object.prototype.hasOwnProperty,Wwn=/^[: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]*$/,E1t={},P1t={};function Jwn(t){return r6e.call(P1t,t)?!0:r6e.call(E1t,t)?!1:Wwn.test(t)?P1t[t]=!0:(E1t[t]=!0,!1)}function Kwn(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 Gwn(t,e,r,n){if(e===null||typeof e>"u"||Kwn(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 jb(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 Tg={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Tg[t]=new jb(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Tg[e]=new jb(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Tg[t]=new jb(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Tg[t]=new jb(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){Tg[t]=new jb(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Tg[t]=new jb(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Tg[t]=new jb(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Tg[t]=new jb(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Tg[t]=new jb(t,5,!1,t.toLowerCase(),null,!1,!1)});var K6e=/[\-:]([a-z])/g;function G6e(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(K6e,G6e);Tg[e]=new jb(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(K6e,G6e);Tg[e]=new jb(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(K6e,G6e);Tg[e]=new jb(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Tg[t]=new jb(t,1,!1,t.toLowerCase(),null,!1,!1)});Tg.xlinkHref=new jb("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Tg[t]=new jb(t,1,!1,t.toLowerCase(),null,!0,!0)});function X6e(t,e,r,n){var o=Tg.hasOwnProperty(e)?Tg[e]:null;(o!==null?o.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(Gwn(e,r,o,n)&&(r=null),n||o===null?Jwn(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 y1=NDt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,tye=Symbol.for("react.element"),n5=Symbol.for("react.portal"),o5=Symbol.for("react.fragment"),Z6e=Symbol.for("react.strict_mode"),n6e=Symbol.for("react.profiler"),jDt=Symbol.for("react.provider"),$Dt=Symbol.for("react.context"),Y6e=Symbol.for("react.forward_ref"),o6e=Symbol.for("react.suspense"),i6e=Symbol.for("react.suspense_list"),Q6e=Symbol.for("react.memo"),sF=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var LDt=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var M1t=Symbol.iterator;function Tte(t){return t===null||typeof t!="object"?null:(t=M1t&&t[M1t]||t["@@iterator"],typeof t=="function"?t:null)}var vc=Object.assign,D3e;function Nte(t){if(D3e===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);D3e=e&&e[1]||""}return`
`+D3e+t}var j3e=!1;function $3e(t,e){if(!t||j3e)return"";j3e=!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{j3e=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?Nte(t):""}function Xwn(t){switch(t.tag){case 5:return Nte(t.type);case 16:return Nte("Lazy");case 13:return Nte("Suspense");case 19:return Nte("SuspenseList");case 0:case 2:case 15:return t=$3e(t.type,!1),t;case 11:return t=$3e(t.type.render,!1),t;case 1:return t=$3e(t.type,!0),t;default:return""}}function a6e(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 o5:return"Fragment";case n5:return"Portal";case n6e:return"Profiler";case Z6e:return"StrictMode";case o6e:return"Suspense";case i6e:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case $Dt:return(t.displayName||"Context")+".Consumer";case jDt:return(t._context.displayName||"Context")+".Provider";case Y6e:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Q6e:return e=t.displayName||null,e!==null?e:a6e(t.type)||"Memo";case sF:e=t._payload,t=t._init;try{return a6e(t(e))}catch{}}return null}function Zwn(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 a6e(e);case 8:return e===Z6e?"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 wF(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function FDt(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Ywn(t){var e=FDt(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 rye(t){t._valueTracker||(t._valueTracker=Ywn(t))}function kDt(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=FDt(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Rye(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 s6e(t,e){var r=e.checked;return vc({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function R1t(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=wF(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 qDt(t,e){e=e.checked,e!=null&&X6e(t,"checked",e,!1)}function u6e(t,e){qDt(t,e);var r=wF(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")?l6e(t,e.type,r):e.hasOwnProperty("defaultValue")&&l6e(t,e.type,wF(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function I1t(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 l6e(t,e,r){(e!=="number"||Rye(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var Dte=Array.isArray;function h5(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=""+wF(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 c6e(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(dt(91));return vc({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function A1t(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(dt(92));if(Dte(r)){if(1<r.length)throw Error(dt(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:wF(r)}}function BDt(t,e){var r=wF(e.value),n=wF(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 N1t(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function UDt(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 d6e(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?UDt(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var nye,zDt=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(nye=nye||document.createElement("div"),nye.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=nye.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Jte(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var Lte={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},Qwn=["Webkit","ms","Moz","O"];Object.keys(Lte).forEach(function(t){Qwn.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Lte[e]=Lte[t]})});function VDt(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||Lte.hasOwnProperty(t)&&Lte[t]?(""+e).trim():e+"px"}function HDt(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=VDt(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var eSn=vc({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 f6e(t,e){if(e){if(eSn[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(dt(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(dt(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(dt(61))}if(e.style!=null&&typeof e.style!="object")throw Error(dt(62))}}function p6e(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 m6e=null;function eJe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var h6e=null,g5=null,y5=null;function D1t(t){if(t=dre(t)){if(typeof h6e!="function")throw Error(dt(280));var e=t.stateNode;e&&(e=obe(e),h6e(t.stateNode,t.type,e))}}function WDt(t){g5?y5?y5.push(t):y5=[t]:g5=t}function JDt(){if(g5){var t=g5,e=y5;if(y5=g5=null,D1t(t),e)for(t=0;t<e.length;t++)D1t(e[t])}}function KDt(t,e){return t(e)}function GDt(){}var L3e=!1;function XDt(t,e,r){if(L3e)return t(e,r);L3e=!0;try{return KDt(t,e,r)}finally{L3e=!1,(g5!==null||y5!==null)&&(GDt(),JDt())}}function Kte(t,e){var r=t.stateNode;if(r===null)return null;var n=obe(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(dt(231,e,typeof r));return r}var g6e=!1;if(p1)try{t5={},Object.defineProperty(t5,"passive",{get:function(){g6e=!0}}),window.addEventListener("test",t5,t5),window.removeEventListener("test",t5,t5)}catch{g6e=!1}var t5;function tSn(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 Fte=!1,Iye=null,Aye=!1,y6e=null,rSn={onError:function(t){Fte=!0,Iye=t}};function nSn(t,e,r,n,o,i,a,s,u){Fte=!1,Iye=null,tSn.apply(rSn,arguments)}function oSn(t,e,r,n,o,i,a,s,u){if(nSn.apply(this,arguments),Fte){if(Fte){var l=Iye;Fte=!1,Iye=null}else throw Error(dt(198));Aye||(Aye=!0,y6e=l)}}function F4(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 ZDt(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 j1t(t){if(F4(t)!==t)throw Error(dt(188))}function iSn(t){var e=t.alternate;if(!e){if(e=F4(t),e===null)throw Error(dt(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 j1t(o),t;if(i===n)return j1t(o),e;i=i.sibling}throw Error(dt(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(dt(189))}}if(r.alternate!==n)throw Error(dt(190))}if(r.tag!==3)throw Error(dt(188));return r.stateNode.current===r?t:e}function YDt(t){return t=iSn(t),t!==null?QDt(t):null}function QDt(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=QDt(t);if(e!==null)return e;t=t.sibling}return null}var ejt=cw.unstable_scheduleCallback,$1t=cw.unstable_cancelCallback,aSn=cw.unstable_shouldYield,sSn=cw.unstable_requestPaint,nd=cw.unstable_now,uSn=cw.unstable_getCurrentPriorityLevel,tJe=cw.unstable_ImmediatePriority,tjt=cw.unstable_UserBlockingPriority,Nye=cw.unstable_NormalPriority,lSn=cw.unstable_LowPriority,rjt=cw.unstable_IdlePriority,ebe=null,_O=null;function cSn(t){if(_O&&typeof _O.onCommitFiberRoot=="function")try{_O.onCommitFiberRoot(ebe,t,void 0,(t.current.flags&128)===128)}catch{}}var GC=Math.clz32?Math.clz32:pSn,dSn=Math.log,fSn=Math.LN2;function pSn(t){return t>>>=0,t===0?32:31-(dSn(t)/fSn|0)|0}var oye=64,iye=4194304;function jte(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 Dye(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=jte(s):(i&=a,i!==0&&(n=jte(i)))}else a=r&~o,a!==0?n=jte(a):i!==0&&(n=jte(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-GC(e),o=1<<r,n|=t[r],e&=~o;return n}function mSn(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 hSn(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var a=31-GC(i),s=1<<a,u=o[a];u===-1?((s&r)===0||(s&n)!==0)&&(o[a]=mSn(s,e)):u<=e&&(t.expiredLanes|=s),i&=~s}}function b6e(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function njt(){var t=oye;return oye<<=1,(oye&4194240)===0&&(oye=64),t}function F3e(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function lre(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-GC(e),t[e]=r}function gSn(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-GC(r),i=1<<o;e[o]=0,n[o]=-1,t[o]=-1,r&=~i}}function rJe(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-GC(r),o=1<<n;o&e|t[n]&e&&(t[n]|=e),r&=~o}}var uu=0;function ojt(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var ijt,nJe,ajt,sjt,ujt,_6e=!1,aye=[],pF=null,mF=null,hF=null,Gte=new Map,Xte=new Map,lF=[],ySn="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 L1t(t,e){switch(t){case"focusin":case"focusout":pF=null;break;case"dragenter":case"dragleave":mF=null;break;case"mouseover":case"mouseout":hF=null;break;case"pointerover":case"pointerout":Gte.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xte.delete(e.pointerId)}}function Ote(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=dre(e),e!==null&&nJe(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function bSn(t,e,r,n,o){switch(e){case"focusin":return pF=Ote(pF,t,e,r,n,o),!0;case"dragenter":return mF=Ote(mF,t,e,r,n,o),!0;case"mouseover":return hF=Ote(hF,t,e,r,n,o),!0;case"pointerover":var i=o.pointerId;return Gte.set(i,Ote(Gte.get(i)||null,t,e,r,n,o)),!0;case"gotpointercapture":return i=o.pointerId,Xte.set(i,Ote(Xte.get(i)||null,t,e,r,n,o)),!0}return!1}function ljt(t){var e=E4(t.target);if(e!==null){var r=F4(e);if(r!==null){if(e=r.tag,e===13){if(e=ZDt(r),e!==null){t.blockedOn=e,ujt(t.priority,function(){ajt(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 vye(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=v6e(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);m6e=n,r.target.dispatchEvent(n),m6e=null}else return e=dre(r),e!==null&&nJe(e),t.blockedOn=r,!1;e.shift()}return!0}function F1t(t,e,r){vye(t)&&r.delete(e)}function _Sn(){_6e=!1,pF!==null&&vye(pF)&&(pF=null),mF!==null&&vye(mF)&&(mF=null),hF!==null&&vye(hF)&&(hF=null),Gte.forEach(F1t),Xte.forEach(F1t)}function Ete(t,e){t.blockedOn===e&&(t.blockedOn=null,_6e||(_6e=!0,cw.unstable_scheduleCallback(cw.unstable_NormalPriority,_Sn)))}function Zte(t){function e(o){return Ete(o,t)}if(0<aye.length){Ete(aye[0],t);for(var r=1;r<aye.length;r++){var n=aye[r];n.blockedOn===t&&(n.blockedOn=null)}}for(pF!==null&&Ete(pF,t),mF!==null&&Ete(mF,t),hF!==null&&Ete(hF,t),Gte.forEach(e),Xte.forEach(e),r=0;r<lF.length;r++)n=lF[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<lF.length&&(r=lF[0],r.blockedOn===null);)ljt(r),r.blockedOn===null&&lF.shift()}var b5=y1.ReactCurrentBatchConfig,jye=!0;function vSn(t,e,r,n){var o=uu,i=b5.transition;b5.transition=null;try{uu=1,oJe(t,e,r,n)}finally{uu=o,b5.transition=i}}function wSn(t,e,r,n){var o=uu,i=b5.transition;b5.transition=null;try{uu=4,oJe(t,e,r,n)}finally{uu=o,b5.transition=i}}function oJe(t,e,r,n){if(jye){var o=v6e(t,e,r,n);if(o===null)H3e(t,e,n,$ye,r),L1t(t,n);else if(bSn(o,t,e,r,n))n.stopPropagation();else if(L1t(t,n),e&4&&-1<ySn.indexOf(t)){for(;o!==null;){var i=dre(o);if(i!==null&&ijt(i),i=v6e(t,e,r,n),i===null&&H3e(t,e,n,$ye,r),i===o)break;o=i}o!==null&&n.stopPropagation()}else H3e(t,e,n,null,r)}}var $ye=null;function v6e(t,e,r,n){if($ye=null,t=eJe(n),t=E4(t),t!==null)if(e=F4(t),e===null)t=null;else if(r=e.tag,r===13){if(t=ZDt(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 $ye=t,null}function cjt(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(uSn()){case tJe:return 1;case tjt:return 4;case Nye:case lSn:return 16;case rjt:return 536870912;default:return 16}default:return 16}}var dF=null,iJe=null,wye=null;function djt(){if(wye)return wye;var t,e=iJe,r=e.length,n,o="value"in dF?dF.value:dF.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 wye=o.slice(t,1<n?1-n:void 0)}function Sye(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 sye(){return!0}function k1t(){return!1}function dw(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)?sye:k1t,this.isPropagationStopped=k1t,this}return vc(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=sye)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=sye)},persist:function(){},isPersistent:sye}),e}var P5={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},aJe=dw(P5),cre=vc({},P5,{view:0,detail:0}),SSn=dw(cre),k3e,q3e,Pte,tbe=vc({},cre,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:sJe,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!==Pte&&(Pte&&t.type==="mousemove"?(k3e=t.screenX-Pte.screenX,q3e=t.screenY-Pte.screenY):q3e=k3e=0,Pte=t),k3e)},movementY:function(t){return"movementY"in t?t.movementY:q3e}}),q1t=dw(tbe),CSn=vc({},tbe,{dataTransfer:0}),xSn=dw(CSn),TSn=vc({},cre,{relatedTarget:0}),B3e=dw(TSn),OSn=vc({},P5,{animationName:0,elapsedTime:0,pseudoElement:0}),ESn=dw(OSn),PSn=vc({},P5,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),MSn=dw(PSn),RSn=vc({},P5,{data:0}),B1t=dw(RSn),ISn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ASn={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"},NSn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function DSn(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=NSn[t])?!!e[t]:!1}function sJe(){return DSn}var jSn=vc({},cre,{key:function(t){if(t.key){var e=ISn[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Sye(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?ASn[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:sJe,charCode:function(t){return t.type==="keypress"?Sye(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Sye(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),$Sn=dw(jSn),LSn=vc({},tbe,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),U1t=dw(LSn),FSn=vc({},cre,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:sJe}),kSn=dw(FSn),qSn=vc({},P5,{propertyName:0,elapsedTime:0,pseudoElement:0}),BSn=dw(qSn),USn=vc({},tbe,{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}),zSn=dw(USn),VSn=[9,13,27,32],uJe=p1&&"CompositionEvent"in window,kte=null;p1&&"documentMode"in document&&(kte=document.documentMode);var HSn=p1&&"TextEvent"in window&&!kte,fjt=p1&&(!uJe||kte&&8<kte&&11>=kte),z1t=" ",V1t=!1;function pjt(t,e){switch(t){case"keyup":return VSn.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mjt(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var i5=!1;function WSn(t,e){switch(t){case"compositionend":return mjt(e);case"keypress":return e.which!==32?null:(V1t=!0,z1t);case"textInput":return t=e.data,t===z1t&&V1t?null:t;default:return null}}function JSn(t,e){if(i5)return t==="compositionend"||!uJe&&pjt(t,e)?(t=djt(),wye=iJe=dF=null,i5=!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 fjt&&e.locale!=="ko"?null:e.data;default:return null}}var KSn={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 H1t(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!KSn[t.type]:e==="textarea"}function hjt(t,e,r,n){WDt(n),e=Lye(e,"onChange"),0<e.length&&(r=new aJe("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var qte=null,Yte=null;function GSn(t){Ojt(t,0)}function rbe(t){var e=u5(t);if(kDt(e))return t}function XSn(t,e){if(t==="change")return e}var gjt=!1;p1&&(p1?(lye="oninput"in document,lye||(U3e=document.createElement("div"),U3e.setAttribute("oninput","return;"),lye=typeof U3e.oninput=="function"),uye=lye):uye=!1,gjt=uye&&(!document.documentMode||9<document.documentMode));var uye,lye,U3e;function W1t(){qte&&(qte.detachEvent("onpropertychange",yjt),Yte=qte=null)}function yjt(t){if(t.propertyName==="value"&&rbe(Yte)){var e=[];hjt(e,Yte,t,eJe(t)),XDt(GSn,e)}}function ZSn(t,e,r){t==="focusin"?(W1t(),qte=e,Yte=r,qte.attachEvent("onpropertychange",yjt)):t==="focusout"&&W1t()}function YSn(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return rbe(Yte)}function QSn(t,e){if(t==="click")return rbe(e)}function e0n(t,e){if(t==="input"||t==="change")return rbe(e)}function t0n(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var ZC=typeof Object.is=="function"?Object.is:t0n;function Qte(t,e){if(ZC(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(!r6e.call(e,o)||!ZC(t[o],e[o]))return!1}return!0}function J1t(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function K1t(t,e){var r=J1t(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=J1t(r)}}function bjt(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?bjt(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function _jt(){for(var t=window,e=Rye();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Rye(t.document)}return e}function lJe(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 r0n(t){var e=_jt(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&bjt(r.ownerDocument.documentElement,r)){if(n!==null&&lJe(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=K1t(r,i);var a=K1t(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 n0n=p1&&"documentMode"in document&&11>=document.documentMode,a5=null,w6e=null,Bte=null,S6e=!1;function G1t(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;S6e||a5==null||a5!==Rye(n)||(n=a5,"selectionStart"in n&&lJe(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}),Bte&&Qte(Bte,n)||(Bte=n,n=Lye(w6e,"onSelect"),0<n.length&&(e=new aJe("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=a5)))}function cye(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var s5={animationend:cye("Animation","AnimationEnd"),animationiteration:cye("Animation","AnimationIteration"),animationstart:cye("Animation","AnimationStart"),transitionend:cye("Transition","TransitionEnd")},z3e={},vjt={};p1&&(vjt=document.createElement("div").style,"AnimationEvent"in window||(delete s5.animationend.animation,delete s5.animationiteration.animation,delete s5.animationstart.animation),"TransitionEvent"in window||delete s5.transitionend.transition);function nbe(t){if(z3e[t])return z3e[t];if(!s5[t])return t;var e=s5[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in vjt)return z3e[t]=e[r];return t}var wjt=nbe("animationend"),Sjt=nbe("animationiteration"),Cjt=nbe("animationstart"),xjt=nbe("transitionend"),Tjt=new Map,X1t="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 CF(t,e){Tjt.set(t,e),L4(e,[t])}for(dye=0;dye<X1t.length;dye++)fye=X1t[dye],Z1t=fye.toLowerCase(),Y1t=fye[0].toUpperCase()+fye.slice(1),CF(Z1t,"on"+Y1t);var fye,Z1t,Y1t,dye;CF(wjt,"onAnimationEnd");CF(Sjt,"onAnimationIteration");CF(Cjt,"onAnimationStart");CF("dblclick","onDoubleClick");CF("focusin","onFocus");CF("focusout","onBlur");CF(xjt,"onTransitionEnd");w5("onMouseEnter",["mouseout","mouseover"]);w5("onMouseLeave",["mouseout","mouseover"]);w5("onPointerEnter",["pointerout","pointerover"]);w5("onPointerLeave",["pointerout","pointerover"]);L4("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));L4("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));L4("onBeforeInput",["compositionend","keypress","textInput","paste"]);L4("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));L4("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));L4("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $te="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(" "),o0n=new Set("cancel close invalid load scroll toggle".split(" ").concat($te));function Q1t(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,oSn(n,e,void 0,t),t.currentTarget=null}function Ojt(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;Q1t(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;Q1t(o,s,l),i=u}}}if(Aye)throw t=y6e,Aye=!1,y6e=null,t}function gl(t,e){var r=e[E6e];r===void 0&&(r=e[E6e]=new Set);var n=t+"__bubble";r.has(n)||(Ejt(e,t,2,!1),r.add(n))}function V3e(t,e,r){var n=0;e&&(n|=4),Ejt(r,t,n,e)}var pye="_reactListening"+Math.random().toString(36).slice(2);function ere(t){if(!t[pye]){t[pye]=!0,DDt.forEach(function(r){r!=="selectionchange"&&(o0n.has(r)||V3e(r,!1,t),V3e(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[pye]||(e[pye]=!0,V3e("selectionchange",!1,e))}}function Ejt(t,e,r,n){switch(cjt(e)){case 1:var o=vSn;break;case 4:o=wSn;break;default:o=oJe}r=o.bind(null,e,r,t),o=void 0,!g6e||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 H3e(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=E4(s),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}s=s.parentNode}}n=n.return}XDt(function(){var l=i,c=eJe(r),d=[];e:{var f=Tjt.get(t);if(f!==void 0){var p=aJe,m=t;switch(t){case"keypress":if(Sye(r)===0)break e;case"keydown":case"keyup":p=$Sn;break;case"focusin":m="focus",p=B3e;break;case"focusout":m="blur",p=B3e;break;case"beforeblur":case"afterblur":p=B3e;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=q1t;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=xSn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=kSn;break;case wjt:case Sjt:case Cjt:p=ESn;break;case xjt:p=BSn;break;case"scroll":p=SSn;break;case"wheel":p=zSn;break;case"copy":case"cut":case"paste":p=MSn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=U1t}var h=(e&4)!==0,y=!h&&t==="scroll",g=h?f!==null?f+"Capture":null:f;h=[];for(var b=l,_;b!==null;){_=b;var w=_.stateNode;if(_.tag===5&&w!==null&&(_=w,g!==null&&(w=Kte(b,g),w!=null&&h.push(tre(b,w,_)))),y)break;b=b.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!==m6e&&(m=r.relatedTarget||r.fromElement)&&(E4(m)||m[m1]))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?E4(m):null,m!==null&&(y=F4(m),m!==y||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=l),p!==m)){if(h=q1t,w="onMouseLeave",g="onMouseEnter",b="mouse",(t==="pointerout"||t==="pointerover")&&(h=U1t,w="onPointerLeave",g="onPointerEnter",b="pointer"),y=p==null?f:u5(p),_=m==null?f:u5(m),f=new h(w,b+"leave",p,r,c),f.target=y,f.relatedTarget=_,w=null,E4(c)===l&&(h=new h(g,b+"enter",m,r,c),h.target=_,h.relatedTarget=y,w=h),y=w,p&&m)t:{for(h=p,g=m,b=0,_=h;_;_=r5(_))b++;for(_=0,w=g;w;w=r5(w))_++;for(;0<b-_;)h=r5(h),b--;for(;0<_-b;)g=r5(g),_--;for(;b--;){if(h===g||g!==null&&h===g.alternate)break t;h=r5(h),g=r5(g)}h=null}else h=null;p!==null&&eDt(d,f,p,h,!1),m!==null&&y!==null&&eDt(d,y,m,h,!0)}}e:{if(f=l?u5(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var T=XSn;else if(H1t(f))if(gjt)T=e0n;else{T=YSn;var O=ZSn}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(T=QSn);if(T&&(T=T(t,l))){hjt(d,T,r,c);break e}O&&O(t,f,l),t==="focusout"&&(O=f._wrapperState)&&O.controlled&&f.type==="number"&&l6e(f,"number",f.value)}switch(O=l?u5(l):window,t){case"focusin":(H1t(O)||O.contentEditable==="true")&&(a5=O,w6e=l,Bte=null);break;case"focusout":Bte=w6e=a5=null;break;case"mousedown":S6e=!0;break;case"contextmenu":case"mouseup":case"dragend":S6e=!1,G1t(d,r,c);break;case"selectionchange":if(n0n)break;case"keydown":case"keyup":G1t(d,r,c)}var E;if(uJe)e:{switch(t){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else i5?pjt(t,r)&&(P="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(P="onCompositionStart");P&&(fjt&&r.locale!=="ko"&&(i5||P!=="onCompositionStart"?P==="onCompositionEnd"&&i5&&(E=djt()):(dF=c,iJe="value"in dF?dF.value:dF.textContent,i5=!0)),O=Lye(l,P),0<O.length&&(P=new B1t(P,t,null,r,c),d.push({event:P,listeners:O}),E?P.data=E:(E=mjt(r),E!==null&&(P.data=E)))),(E=HSn?WSn(t,r):JSn(t,r))&&(l=Lye(l,"onBeforeInput"),0<l.length&&(c=new B1t("onBeforeInput","beforeinput",null,r,c),d.push({event:c,listeners:l}),c.data=E))}Ojt(d,e)})}function tre(t,e,r){return{instance:t,listener:e,currentTarget:r}}function Lye(t,e){for(var r=e+"Capture",n=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Kte(t,r),i!=null&&n.unshift(tre(t,i,o)),i=Kte(t,e),i!=null&&n.push(tre(t,i,o))),t=t.return}return n}function r5(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function eDt(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=Kte(r,i),u!=null&&a.unshift(tre(r,u,s))):o||(u=Kte(r,i),u!=null&&a.push(tre(r,u,s)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var i0n=/\r\n?/g,a0n=/\u0000|\uFFFD/g;function tDt(t){return(typeof t=="string"?t:""+t).replace(i0n,`
`).replace(a0n,"")}function mye(t,e,r){if(e=tDt(e),tDt(t)!==e&&r)throw Error(dt(425))}function Fye(){}var C6e=null,x6e=null;function T6e(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 O6e=typeof setTimeout=="function"?setTimeout:void 0,s0n=typeof clearTimeout=="function"?clearTimeout:void 0,rDt=typeof Promise=="function"?Promise:void 0,u0n=typeof queueMicrotask=="function"?queueMicrotask:typeof rDt<"u"?function(t){return rDt.resolve(null).then(t).catch(l0n)}:O6e;function l0n(t){setTimeout(function(){throw t})}function W3e(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),Zte(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=o}while(r);Zte(e)}function gF(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 nDt(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 M5=Math.random().toString(36).slice(2),bO="__reactFiber$"+M5,rre="__reactProps$"+M5,m1="__reactContainer$"+M5,E6e="__reactEvents$"+M5,c0n="__reactListeners$"+M5,d0n="__reactHandles$"+M5;function E4(t){var e=t[bO];if(e)return e;for(var r=t.parentNode;r;){if(e=r[m1]||r[bO]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=nDt(t);t!==null;){if(r=t[bO])return r;t=nDt(t)}return e}t=r,r=t.parentNode}return null}function dre(t){return t=t[bO]||t[m1],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function u5(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(dt(33))}function obe(t){return t[rre]||null}var P6e=[],l5=-1;function xF(t){return{current:t}}function yl(t){0>l5||(t.current=P6e[l5],P6e[l5]=null,l5--)}function Zu(t,e){l5++,P6e[l5]=t.current,t.current=e}var SF={},My=xF(SF),F_=xF(!1),A4=SF;function S5(t,e){var r=t.type.contextTypes;if(!r)return SF;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 k_(t){return t=t.childContextTypes,t!=null}function kye(){yl(F_),yl(My)}function oDt(t,e,r){if(My.current!==SF)throw Error(dt(168));Zu(My,e),Zu(F_,r)}function Pjt(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(dt(108,Zwn(t)||"Unknown",o));return vc({},r,n)}function qye(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||SF,A4=My.current,Zu(My,t),Zu(F_,F_.current),!0}function iDt(t,e,r){var n=t.stateNode;if(!n)throw Error(dt(169));r?(t=Pjt(t,e,A4),n.__reactInternalMemoizedMergedChildContext=t,yl(F_),yl(My),Zu(My,t)):yl(F_),Zu(F_,r)}var l1=null,ibe=!1,J3e=!1;function Mjt(t){l1===null?l1=[t]:l1.push(t)}function f0n(t){ibe=!0,Mjt(t)}function TF(){if(!J3e&&l1!==null){J3e=!0;var t=0,e=uu;try{var r=l1;for(uu=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}l1=null,ibe=!1}catch(o){throw l1!==null&&(l1=l1.slice(t+1)),ejt(tJe,TF),o}finally{uu=e,J3e=!1}}return null}var c5=[],d5=0,Bye=null,Uye=0,DS=[],jS=0,N4=null,c1=1,d1="";function T4(t,e){c5[d5++]=Uye,c5[d5++]=Bye,Bye=t,Uye=e}function Rjt(t,e,r){DS[jS++]=c1,DS[jS++]=d1,DS[jS++]=N4,N4=t;var n=c1;t=d1;var o=32-GC(n)-1;n&=~(1<<o),r+=1;var i=32-GC(e)+o;if(30<i){var a=o-o%5;i=(n&(1<<a)-1).toString(32),n>>=a,o-=a,c1=1<<32-GC(e)+o|r<<o|n,d1=i+t}else c1=1<<i|r<<o|n,d1=t}function cJe(t){t.return!==null&&(T4(t,1),Rjt(t,1,0))}function dJe(t){for(;t===Bye;)Bye=c5[--d5],c5[d5]=null,Uye=c5[--d5],c5[d5]=null;for(;t===N4;)N4=DS[--jS],DS[jS]=null,d1=DS[--jS],DS[jS]=null,c1=DS[--jS],DS[jS]=null}var lw=null,uw=null,Bl=!1,KC=null;function Ijt(t,e){var r=$S(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 aDt(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,lw=t,uw=gF(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,lw=t,uw=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=N4!==null?{id:c1,overflow:d1}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=$S(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,lw=t,uw=null,!0):!1;default:return!1}}function M6e(t){return(t.mode&1)!==0&&(t.flags&128)===0}function R6e(t){if(Bl){var e=uw;if(e){var r=e;if(!aDt(t,e)){if(M6e(t))throw Error(dt(418));e=gF(r.nextSibling);var n=lw;e&&aDt(t,e)?Ijt(n,r):(t.flags=t.flags&-4097|2,Bl=!1,lw=t)}}else{if(M6e(t))throw Error(dt(418));t.flags=t.flags&-4097|2,Bl=!1,lw=t}}}function sDt(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;lw=t}function hye(t){if(t!==lw)return!1;if(!Bl)return sDt(t),Bl=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!T6e(t.type,t.memoizedProps)),e&&(e=uw)){if(M6e(t))throw Ajt(),Error(dt(418));for(;e;)Ijt(t,e),e=gF(e.nextSibling)}if(sDt(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(dt(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){uw=gF(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}uw=null}}else uw=lw?gF(t.stateNode.nextSibling):null;return!0}function Ajt(){for(var t=uw;t;)t=gF(t.nextSibling)}function C5(){uw=lw=null,Bl=!1}function fJe(t){KC===null?KC=[t]:KC.push(t)}var p0n=y1.ReactCurrentBatchConfig;function WC(t,e){if(t&&t.defaultProps){e=vc({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}var zye=xF(null),Vye=null,f5=null,pJe=null;function mJe(){pJe=f5=Vye=null}function hJe(t){var e=zye.current;yl(zye),t._currentValue=e}function I6e(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 _5(t,e){Vye=t,pJe=f5=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&e)!==0&&(L_=!0),t.firstContext=null)}function FS(t){var e=t._currentValue;if(pJe!==t)if(t={context:t,memoizedValue:e,next:null},f5===null){if(Vye===null)throw Error(dt(308));f5=t,Vye.dependencies={lanes:0,firstContext:t}}else f5=f5.next=t;return e}var P4=null;function gJe(t){P4===null?P4=[t]:P4.push(t)}function Njt(t,e,r,n){var o=e.interleaved;return o===null?(r.next=r,gJe(e)):(r.next=o.next,o.next=r),e.interleaved=r,h1(t,n)}function h1(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 uF=!1;function yJe(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Djt(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 f1(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function yF(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,(is&2)!==0){var o=n.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),n.pending=e,h1(t,r)}return o=n.interleaved,o===null?(e.next=e,gJe(n)):(e.next=o.next,o.next=e),n.interleaved=e,h1(t,r)}function Cye(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,rJe(t,r)}}function uDt(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 Hye(t,e,r,n){var o=t.updateQueue;uF=!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=vc({},d,f);break e;case 2:uF=!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);j4|=a,t.lanes=a,t.memoizedState=d}}function lDt(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(dt(191,o));o.call(n)}}}var jjt=new NDt.Component().refs;function A6e(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:vc({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var abe={isMounted:function(t){return(t=t._reactInternals)?F4(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=Db(),o=_F(t),i=f1(n,o);i.payload=e,r!=null&&(i.callback=r),e=yF(t,i,o),e!==null&&(XC(e,t,o,n),Cye(e,t,o))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=Db(),o=_F(t),i=f1(n,o);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=yF(t,i,o),e!==null&&(XC(e,t,o,n),Cye(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=Db(),n=_F(t),o=f1(r,n);o.tag=2,e!=null&&(o.callback=e),e=yF(t,o,n),e!==null&&(XC(e,t,n,r),Cye(e,t,n))}};function cDt(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?!Qte(r,n)||!Qte(o,i):!0}function $jt(t,e,r){var n=!1,o=SF,i=e.contextType;return typeof i=="object"&&i!==null?i=FS(i):(o=k_(e)?A4:My.current,n=e.contextTypes,i=(n=n!=null)?S5(t,o):SF),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=abe,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function dDt(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&&abe.enqueueReplaceState(e,e.state,null)}function N6e(t,e,r,n){var o=t.stateNode;o.props=r,o.state=t.memoizedState,o.refs=jjt,yJe(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=FS(i):(i=k_(e)?A4:My.current,o.context=S5(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(A6e(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&&abe.enqueueReplaceState(o,o.state,null),Hye(t,r,o,n),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function Mte(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(dt(309));var n=r.stateNode}if(!n)throw Error(dt(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===jjt&&(s=o.refs={}),a===null?delete s[i]:s[i]=a},e._stringRef=i,e)}if(typeof t!="string")throw Error(dt(284));if(!r._owner)throw Error(dt(290,t))}return t}function gye(t,e){throw t=Object.prototype.toString.call(e),Error(dt(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function fDt(t){var e=t._init;return e(t._payload)}function Ljt(t){function e(g,b){if(t){var _=g.deletions;_===null?(g.deletions=[b],g.flags|=16):_.push(b)}}function r(g,b){if(!t)return null;for(;b!==null;)e(g,b),b=b.sibling;return null}function n(g,b){for(g=new Map;b!==null;)b.key!==null?g.set(b.key,b):g.set(b.index,b),b=b.sibling;return g}function o(g,b){return g=vF(g,b),g.index=0,g.sibling=null,g}function i(g,b,_){return g.index=_,t?(_=g.alternate,_!==null?(_=_.index,_<b?(g.flags|=2,b):_):(g.flags|=2,b)):(g.flags|=1048576,b)}function a(g){return t&&g.alternate===null&&(g.flags|=2),g}function s(g,b,_,w){return b===null||b.tag!==6?(b=e6e(_,g.mode,w),b.return=g,b):(b=o(b,_),b.return=g,b)}function u(g,b,_,w){var T=_.type;return T===o5?c(g,b,_.props.children,w,_.key):b!==null&&(b.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===sF&&fDt(T)===b.type)?(w=o(b,_.props),w.ref=Mte(g,b,_),w.return=g,w):(w=Mye(_.type,_.key,_.props,null,g.mode,w),w.ref=Mte(g,b,_),w.return=g,w)}function l(g,b,_,w){return b===null||b.tag!==4||b.stateNode.containerInfo!==_.containerInfo||b.stateNode.implementation!==_.implementation?(b=t6e(_,g.mode,w),b.return=g,b):(b=o(b,_.children||[]),b.return=g,b)}function c(g,b,_,w,T){return b===null||b.tag!==7?(b=I4(_,g.mode,w,T),b.return=g,b):(b=o(b,_),b.return=g,b)}function d(g,b,_){if(typeof b=="string"&&b!==""||typeof b=="number")return b=e6e(""+b,g.mode,_),b.return=g,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case tye:return _=Mye(b.type,b.key,b.props,null,g.mode,_),_.ref=Mte(g,null,b),_.return=g,_;case n5:return b=t6e(b,g.mode,_),b.return=g,b;case sF:var w=b._init;return d(g,w(b._payload),_)}if(Dte(b)||Tte(b))return b=I4(b,g.mode,_,null),b.return=g,b;gye(g,b)}return null}function f(g,b,_,w){var T=b!==null?b.key:null;if(typeof _=="string"&&_!==""||typeof _=="number")return T!==null?null:s(g,b,""+_,w);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case tye:return _.key===T?u(g,b,_,w):null;case n5:return _.key===T?l(g,b,_,w):null;case sF:return T=_._init,f(g,b,T(_._payload),w)}if(Dte(_)||Tte(_))return T!==null?null:c(g,b,_,w,null);gye(g,_)}return null}function p(g,b,_,w,T){if(typeof w=="string"&&w!==""||typeof w=="number")return g=g.get(_)||null,s(b,g,""+w,T);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case tye:return g=g.get(w.key===null?_:w.key)||null,u(b,g,w,T);case n5:return g=g.get(w.key===null?_:w.key)||null,l(b,g,w,T);case sF:var O=w._init;return p(g,b,_,O(w._payload),T)}if(Dte(w)||Tte(w))return g=g.get(_)||null,c(b,g,w,T,null);gye(b,w)}return null}function m(g,b,_,w){for(var T=null,O=null,E=b,P=b=0,R=null;E!==null&&P<_.length;P++){E.index>P?(R=E,E=null):R=E.sibling;var I=f(g,E,_[P],w);if(I===null){E===null&&(E=R);break}t&&E&&I.alternate===null&&e(g,E),b=i(I,b,P),O===null?T=I:O.sibling=I,O=I,E=R}if(P===_.length)return r(g,E),Bl&&T4(g,P),T;if(E===null){for(;P<_.length;P++)E=d(g,_[P],w),E!==null&&(b=i(E,b,P),O===null?T=E:O.sibling=E,O=E);return Bl&&T4(g,P),T}for(E=n(g,E);P<_.length;P++)R=p(E,g,P,_[P],w),R!==null&&(t&&R.alternate!==null&&E.delete(R.key===null?P:R.key),b=i(R,b,P),O===null?T=R:O.sibling=R,O=R);return t&&E.forEach(function(A){return e(g,A)}),Bl&&T4(g,P),T}function h(g,b,_,w){var T=Tte(_);if(typeof T!="function")throw Error(dt(150));if(_=T.call(_),_==null)throw Error(dt(151));for(var O=T=null,E=b,P=b=0,R=null,I=_.next();E!==null&&!I.done;P++,I=_.next()){E.index>P?(R=E,E=null):R=E.sibling;var A=f(g,E,I.value,w);if(A===null){E===null&&(E=R);break}t&&E&&A.alternate===null&&e(g,E),b=i(A,b,P),O===null?T=A:O.sibling=A,O=A,E=R}if(I.done)return r(g,E),Bl&&T4(g,P),T;if(E===null){for(;!I.done;P++,I=_.next())I=d(g,I.value,w),I!==null&&(b=i(I,b,P),O===null?T=I:O.sibling=I,O=I);return Bl&&T4(g,P),T}for(E=n(g,E);!I.done;P++,I=_.next())I=p(E,g,P,I.value,w),I!==null&&(t&&I.alternate!==null&&E.delete(I.key===null?P:I.key),b=i(I,b,P),O===null?T=I:O.sibling=I,O=I);return t&&E.forEach(function(B){return e(g,B)}),Bl&&T4(g,P),T}function y(g,b,_,w){if(typeof _=="object"&&_!==null&&_.type===o5&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case tye:e:{for(var T=_.key,O=b;O!==null;){if(O.key===T){if(T=_.type,T===o5){if(O.tag===7){r(g,O.sibling),b=o(O,_.props.children),b.return=g,g=b;break e}}else if(O.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===sF&&fDt(T)===O.type){r(g,O.sibling),b=o(O,_.props),b.ref=Mte(g,O,_),b.return=g,g=b;break e}r(g,O);break}else e(g,O);O=O.sibling}_.type===o5?(b=I4(_.props.children,g.mode,w,_.key),b.return=g,g=b):(w=Mye(_.type,_.key,_.props,null,g.mode,w),w.ref=Mte(g,b,_),w.return=g,g=w)}return a(g);case n5:e:{for(O=_.key;b!==null;){if(b.key===O)if(b.tag===4&&b.stateNode.containerInfo===_.containerInfo&&b.stateNode.implementation===_.implementation){r(g,b.sibling),b=o(b,_.children||[]),b.return=g,g=b;break e}else{r(g,b);break}else e(g,b);b=b.sibling}b=t6e(_,g.mode,w),b.return=g,g=b}return a(g);case sF:return O=_._init,y(g,b,O(_._payload),w)}if(Dte(_))return m(g,b,_,w);if(Tte(_))return h(g,b,_,w);gye(g,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,b!==null&&b.tag===6?(r(g,b.sibling),b=o(b,_),b.return=g,g=b):(r(g,b),b=e6e(_,g.mode,w),b.return=g,g=b),a(g)):r(g,b)}return y}var x5=Ljt(!0),Fjt=Ljt(!1),fre={},vO=xF(fre),nre=xF(fre),ore=xF(fre);function M4(t){if(t===fre)throw Error(dt(174));return t}function bJe(t,e){switch(Zu(ore,e),Zu(nre,t),Zu(vO,fre),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:d6e(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=d6e(e,t)}yl(vO),Zu(vO,e)}function T5(){yl(vO),yl(nre),yl(ore)}function kjt(t){M4(ore.current);var e=M4(vO.current),r=d6e(e,t.type);e!==r&&(Zu(nre,t),Zu(vO,r))}function _Je(t){nre.current===t&&(yl(vO),yl(nre))}var bc=xF(0);function Wye(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 K3e=[];function vJe(){for(var t=0;t<K3e.length;t++)K3e[t]._workInProgressVersionPrimary=null;K3e.length=0}var xye=y1.ReactCurrentDispatcher,G3e=y1.ReactCurrentBatchConfig,D4=0,_c=null,Mm=null,Oh=null,Jye=!1,Ute=!1,ire=0,m0n=0;function Oy(){throw Error(dt(321))}function wJe(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!ZC(t[r],e[r]))return!1;return!0}function SJe(t,e,r,n,o,i){if(D4=i,_c=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,xye.current=t===null||t.memoizedState===null?b0n:_0n,t=r(n,o),Ute){i=0;do{if(Ute=!1,ire=0,25<=i)throw Error(dt(301));i+=1,Oh=Mm=null,e.updateQueue=null,xye.current=v0n,t=r(n,o)}while(Ute)}if(xye.current=Kye,e=Mm!==null&&Mm.next!==null,D4=0,Oh=Mm=_c=null,Jye=!1,e)throw Error(dt(300));return t}function CJe(){var t=ire!==0;return ire=0,t}function yO(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Oh===null?_c.memoizedState=Oh=t:Oh=Oh.next=t,Oh}function kS(){if(Mm===null){var t=_c.alternate;t=t!==null?t.memoizedState:null}else t=Mm.next;var e=Oh===null?_c.memoizedState:Oh.next;if(e!==null)Oh=e,Mm=t;else{if(t===null)throw Error(dt(310));Mm=t,t={memoizedState:Mm.memoizedState,baseState:Mm.baseState,baseQueue:Mm.baseQueue,queue:Mm.queue,next:null},Oh===null?_c.memoizedState=Oh=t:Oh=Oh.next=t}return Oh}function are(t,e){return typeof e=="function"?e(t):e}function X3e(t){var e=kS(),r=e.queue;if(r===null)throw Error(dt(311));r.lastRenderedReducer=t;var n=Mm,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((D4&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,_c.lanes|=c,j4|=c}l=l.next}while(l!==null&&l!==i);u===null?a=n:u.next=s,ZC(n,e.memoizedState)||(L_=!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,_c.lanes|=i,j4|=i,o=o.next;while(o!==t)}else o===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function Z3e(t){var e=kS(),r=e.queue;if(r===null)throw Error(dt(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);ZC(i,e.memoizedState)||(L_=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function qjt(){}function Bjt(t,e){var r=_c,n=kS(),o=e(),i=!ZC(n.memoizedState,o);if(i&&(n.memoizedState=o,L_=!0),n=n.queue,xJe(Vjt.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||Oh!==null&&Oh.memoizedState.tag&1){if(r.flags|=2048,sre(9,zjt.bind(null,r,n,o,e),void 0,null),Eh===null)throw Error(dt(349));(D4&30)!==0||Ujt(r,e,o)}return o}function Ujt(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=_c.updateQueue,e===null?(e={lastEffect:null,stores:null},_c.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function zjt(t,e,r,n){e.value=r,e.getSnapshot=n,Hjt(e)&&Wjt(t)}function Vjt(t,e,r){return r(function(){Hjt(e)&&Wjt(t)})}function Hjt(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!ZC(t,r)}catch{return!0}}function Wjt(t){var e=h1(t,1);e!==null&&XC(e,t,1,-1)}function pDt(t){var e=yO();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:are,lastRenderedState:t},e.queue=t,t=t.dispatch=y0n.bind(null,_c,t),[e.memoizedState,t]}function sre(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=_c.updateQueue,e===null?(e={lastEffect:null,stores:null},_c.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 Jjt(){return kS().memoizedState}function Tye(t,e,r,n){var o=yO();_c.flags|=t,o.memoizedState=sre(1|e,r,void 0,n===void 0?null:n)}function sbe(t,e,r,n){var o=kS();n=n===void 0?null:n;var i=void 0;if(Mm!==null){var a=Mm.memoizedState;if(i=a.destroy,n!==null&&wJe(n,a.deps)){o.memoizedState=sre(e,r,i,n);return}}_c.flags|=t,o.memoizedState=sre(1|e,r,i,n)}function mDt(t,e){return Tye(8390656,8,t,e)}function xJe(t,e){return sbe(2048,8,t,e)}function Kjt(t,e){return sbe(4,2,t,e)}function Gjt(t,e){return sbe(4,4,t,e)}function Xjt(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 Zjt(t,e,r){return r=r!=null?r.concat([t]):null,sbe(4,4,Xjt.bind(null,e,t),r)}function TJe(){}function Yjt(t,e){var r=kS();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&wJe(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function Qjt(t,e){var r=kS();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&wJe(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function e$t(t,e,r){return(D4&21)===0?(t.baseState&&(t.baseState=!1,L_=!0),t.memoizedState=r):(ZC(r,e)||(r=njt(),_c.lanes|=r,j4|=r,t.baseState=!0),e)}function h0n(t,e){var r=uu;uu=r!==0&&4>r?r:4,t(!0);var n=G3e.transition;G3e.transition={};try{t(!1),e()}finally{uu=r,G3e.transition=n}}function t$t(){return kS().memoizedState}function g0n(t,e,r){var n=_F(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},r$t(t))n$t(e,r);else if(r=Njt(t,e,r,n),r!==null){var o=Db();XC(r,t,n,o),o$t(r,e,n)}}function y0n(t,e,r){var n=_F(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(r$t(t))n$t(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,ZC(s,a)){var u=e.interleaved;u===null?(o.next=o,gJe(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=Njt(t,e,o,n),r!==null&&(o=Db(),XC(r,t,n,o),o$t(r,e,n))}}function r$t(t){var e=t.alternate;return t===_c||e!==null&&e===_c}function n$t(t,e){Ute=Jye=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function o$t(t,e,r){if((r&4194240)!==0){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,rJe(t,r)}}var Kye={readContext:FS,useCallback:Oy,useContext:Oy,useEffect:Oy,useImperativeHandle:Oy,useInsertionEffect:Oy,useLayoutEffect:Oy,useMemo:Oy,useReducer:Oy,useRef:Oy,useState:Oy,useDebugValue:Oy,useDeferredValue:Oy,useTransition:Oy,useMutableSource:Oy,useSyncExternalStore:Oy,useId:Oy,unstable_isNewReconciler:!1},b0n={readContext:FS,useCallback:function(t,e){return yO().memoizedState=[t,e===void 0?null:e],t},useContext:FS,useEffect:mDt,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,Tye(4194308,4,Xjt.bind(null,e,t),r)},useLayoutEffect:function(t,e){return Tye(4194308,4,t,e)},useInsertionEffect:function(t,e){return Tye(4,2,t,e)},useMemo:function(t,e){var r=yO();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=yO();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=g0n.bind(null,_c,t),[n.memoizedState,t]},useRef:function(t){var e=yO();return t={current:t},e.memoizedState=t},useState:pDt,useDebugValue:TJe,useDeferredValue:function(t){return yO().memoizedState=t},useTransition:function(){var t=pDt(!1),e=t[0];return t=h0n.bind(null,t[1]),yO().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=_c,o=yO();if(Bl){if(r===void 0)throw Error(dt(407));r=r()}else{if(r=e(),Eh===null)throw Error(dt(349));(D4&30)!==0||Ujt(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,mDt(Vjt.bind(null,n,i,t),[t]),n.flags|=2048,sre(9,zjt.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=yO(),e=Eh.identifierPrefix;if(Bl){var r=d1,n=c1;r=(n&~(1<<32-GC(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=ire++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=m0n++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},_0n={readContext:FS,useCallback:Yjt,useContext:FS,useEffect:xJe,useImperativeHandle:Zjt,useInsertionEffect:Kjt,useLayoutEffect:Gjt,useMemo:Qjt,useReducer:X3e,useRef:Jjt,useState:function(){return X3e(are)},useDebugValue:TJe,useDeferredValue:function(t){var e=kS();return e$t(e,Mm.memoizedState,t)},useTransition:function(){var t=X3e(are)[0],e=kS().memoizedState;return[t,e]},useMutableSource:qjt,useSyncExternalStore:Bjt,useId:t$t,unstable_isNewReconciler:!1},v0n={readContext:FS,useCallback:Yjt,useContext:FS,useEffect:xJe,useImperativeHandle:Zjt,useInsertionEffect:Kjt,useLayoutEffect:Gjt,useMemo:Qjt,useReducer:Z3e,useRef:Jjt,useState:function(){return Z3e(are)},useDebugValue:TJe,useDeferredValue:function(t){var e=kS();return Mm===null?e.memoizedState=t:e$t(e,Mm.memoizedState,t)},useTransition:function(){var t=Z3e(are)[0],e=kS().memoizedState;return[t,e]},useMutableSource:qjt,useSyncExternalStore:Bjt,useId:t$t,unstable_isNewReconciler:!1};function O5(t,e){try{var r="",n=e;do r+=Xwn(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 Y3e(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function D6e(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var w0n=typeof WeakMap=="function"?WeakMap:Map;function i$t(t,e,r){r=f1(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){Xye||(Xye=!0,V6e=n),D6e(t,e)},r}function a$t(t,e,r){r=f1(-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(){D6e(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){D6e(t,e),typeof n!="function"&&(bF===null?bF=new Set([this]):bF.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function hDt(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new w0n;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=j0n.bind(null,t,e,r),e.then(t,t))}function gDt(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 yDt(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=f1(-1,1),e.tag=2,yF(r,e,1))),r.lanes|=1),t):(t.flags|=65536,t.lanes=o,t)}var S0n=y1.ReactCurrentOwner,L_=!1;function Nb(t,e,r,n){e.child=t===null?Fjt(e,null,r,n):x5(e,t.child,r,n)}function bDt(t,e,r,n,o){r=r.render;var i=e.ref;return _5(e,o),n=SJe(t,e,r,n,i,o),r=CJe(),t!==null&&!L_?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,g1(t,e,o)):(Bl&&r&&cJe(e),e.flags|=1,Nb(t,e,n,o),e.child)}function _Dt(t,e,r,n,o){if(t===null){var i=r.type;return typeof i=="function"&&!NJe(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,s$t(t,e,i,n,o)):(t=Mye(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:Qte,r(a,n)&&t.ref===e.ref)return g1(t,e,o)}return e.flags|=1,t=vF(i,n),t.ref=e.ref,t.return=e,e.child=t}function s$t(t,e,r,n,o){if(t!==null){var i=t.memoizedProps;if(Qte(i,n)&&t.ref===e.ref)if(L_=!1,e.pendingProps=n=i,(t.lanes&o)!==0)(t.flags&131072)!==0&&(L_=!0);else return e.lanes=t.lanes,g1(t,e,o)}return j6e(t,e,r,n,o)}function u$t(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},Zu(m5,sw),sw|=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,Zu(m5,sw),sw|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,Zu(m5,sw),sw|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,Zu(m5,sw),sw|=n;return Nb(t,e,o,r),e.child}function l$t(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function j6e(t,e,r,n,o){var i=k_(r)?A4:My.current;return i=S5(e,i),_5(e,o),r=SJe(t,e,r,n,i,o),n=CJe(),t!==null&&!L_?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,g1(t,e,o)):(Bl&&n&&cJe(e),e.flags|=1,Nb(t,e,r,o),e.child)}function vDt(t,e,r,n,o){if(k_(r)){var i=!0;qye(e)}else i=!1;if(_5(e,o),e.stateNode===null)Oye(t,e),$jt(e,r,n),N6e(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=FS(l):(l=k_(r)?A4:My.current,l=S5(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)&&dDt(e,a,n,l),uF=!1;var f=e.memoizedState;a.state=f,Hye(e,n,a,o),u=e.memoizedState,s!==n||f!==u||F_.current||uF?(typeof c=="function"&&(A6e(e,r,c,n),u=e.memoizedState),(s=uF||cDt(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,Djt(t,e),s=e.memoizedProps,l=e.type===e.elementType?s:WC(e.type,s),a.props=l,d=e.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=FS(u):(u=k_(r)?A4:My.current,u=S5(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)&&dDt(e,a,n,u),uF=!1,f=e.memoizedState,a.state=f,Hye(e,n,a,o);var m=e.memoizedState;s!==d||f!==m||F_.current||uF?(typeof p=="function"&&(A6e(e,r,p,n),m=e.memoizedState),(l=uF||cDt(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 $6e(t,e,r,n,i,o)}function $6e(t,e,r,n,o,i){l$t(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return o&&iDt(e,r,!1),g1(t,e,i);n=e.stateNode,S0n.current=e;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=x5(e,t.child,null,i),e.child=x5(e,null,s,i)):Nb(t,e,s,i),e.memoizedState=n.state,o&&iDt(e,r,!0),e.child}function c$t(t){var e=t.stateNode;e.pendingContext?oDt(t,e.pendingContext,e.pendingContext!==e.context):e.context&&oDt(t,e.context,!1),bJe(t,e.containerInfo)}function wDt(t,e,r,n,o){return C5(),fJe(o),e.flags|=256,Nb(t,e,r,n),e.child}var L6e={dehydrated:null,treeContext:null,retryLane:0};function F6e(t){return{baseLanes:t,cachePool:null,transitions:null}}function d$t(t,e,r){var n=e.pendingProps,o=bc.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),Zu(bc,o&1),t===null)return R6e(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=cbe(a,n,0,null),t=I4(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=F6e(r),e.memoizedState=L6e,t):OJe(e,a));if(o=t.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return C0n(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=vF(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=vF(s,i):(i=I4(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?F6e(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~r,e.memoizedState=L6e,n}return i=t.child,t=i.sibling,n=vF(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 OJe(t,e){return e=cbe({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function yye(t,e,r,n){return n!==null&&fJe(n),x5(e,t.child,null,r),t=OJe(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function C0n(t,e,r,n,o,i,a){if(r)return e.flags&256?(e.flags&=-257,n=Y3e(Error(dt(422))),yye(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,o=e.mode,n=cbe({mode:"visible",children:n.children},o,0,null),i=I4(i,o,a,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,(e.mode&1)!==0&&x5(e,t.child,null,a),e.child.memoizedState=F6e(a),e.memoizedState=L6e,i);if((e.mode&1)===0)return yye(t,e,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(dt(419)),n=Y3e(i,n,void 0),yye(t,e,a,n)}if(s=(a&t.childLanes)!==0,L_||s){if(n=Eh,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,h1(t,o),XC(n,t,o,-1))}return AJe(),n=Y3e(Error(dt(421))),yye(t,e,a,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=$0n.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,uw=gF(o.nextSibling),lw=e,Bl=!0,KC=null,t!==null&&(DS[jS++]=c1,DS[jS++]=d1,DS[jS++]=N4,c1=t.id,d1=t.overflow,N4=e),e=OJe(e,n.children),e.flags|=4096,e)}function SDt(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),I6e(t.return,e,r)}function Q3e(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 f$t(t,e,r){var n=e.pendingProps,o=n.revealOrder,i=n.tail;if(Nb(t,e,n.children,r),n=bc.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&&SDt(t,r,e);else if(t.tag===19)SDt(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(Zu(bc,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&&Wye(t)===null&&(o=r),r=r.sibling;r=o,r===null?(o=e.child,e.child=null):(o=r.sibling,r.sibling=null),Q3e(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&&Wye(t)===null){e.child=o;break}t=o.sibling,o.sibling=r,r=o,o=t}Q3e(e,!0,r,null,i);break;case"together":Q3e(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Oye(t,e){(e.mode&1)===0&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function g1(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),j4|=e.lanes,(r&e.childLanes)===0)return null;if(t!==null&&e.child!==t.child)throw Error(dt(153));if(e.child!==null){for(t=e.child,r=vF(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=vF(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function x0n(t,e,r){switch(e.tag){case 3:c$t(e),C5();break;case 5:kjt(e);break;case 1:k_(e.type)&&qye(e);break;case 4:bJe(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;Zu(zye,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(Zu(bc,bc.current&1),e.flags|=128,null):(r&e.child.childLanes)!==0?d$t(t,e,r):(Zu(bc,bc.current&1),t=g1(t,e,r),t!==null?t.sibling:null);Zu(bc,bc.current&1);break;case 19:if(n=(r&e.childLanes)!==0,(t.flags&128)!==0){if(n)return f$t(t,e,r);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Zu(bc,bc.current),n)break;return null;case 22:case 23:return e.lanes=0,u$t(t,e,r)}return g1(t,e,r)}var p$t,k6e,m$t,h$t;p$t=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}};k6e=function(){};m$t=function(t,e,r,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,M4(vO.current);var i=null;switch(r){case"input":o=s6e(t,o),n=s6e(t,n),i=[];break;case"select":o=vc({},o,{value:void 0}),n=vc({},n,{value:void 0}),i=[];break;case"textarea":o=c6e(t,o),n=c6e(t,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=Fye)}f6e(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"&&(Wte.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"&&(Wte.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&gl("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)}};h$t=function(t,e,r,n){r!==n&&(e.flags|=4)};function Rte(t,e){if(!Bl)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 Ey(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 T0n(t,e,r){var n=e.pendingProps;switch(dJe(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ey(e),null;case 1:return k_(e.type)&&kye(),Ey(e),null;case 3:return n=e.stateNode,T5(),yl(F_),yl(My),vJe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(hye(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,KC!==null&&(J6e(KC),KC=null))),k6e(t,e),Ey(e),null;case 5:_Je(e);var o=M4(ore.current);if(r=e.type,t!==null&&e.stateNode!=null)m$t(t,e,r,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(dt(166));return Ey(e),null}if(t=M4(vO.current),hye(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[bO]=e,n[rre]=i,t=(e.mode&1)!==0,r){case"dialog":gl("cancel",n),gl("close",n);break;case"iframe":case"object":case"embed":gl("load",n);break;case"video":case"audio":for(o=0;o<$te.length;o++)gl($te[o],n);break;case"source":gl("error",n);break;case"img":case"image":case"link":gl("error",n),gl("load",n);break;case"details":gl("toggle",n);break;case"input":R1t(n,i),gl("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},gl("invalid",n);break;case"textarea":A1t(n,i),gl("invalid",n)}f6e(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&&mye(n.textContent,s,t),o=["children",s]):typeof s=="number"&&n.textContent!==""+s&&(i.suppressHydrationWarning!==!0&&mye(n.textContent,s,t),o=["children",""+s]):Wte.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&gl("scroll",n)}switch(r){case"input":rye(n),I1t(n,i,!0);break;case"textarea":rye(n),N1t(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=Fye)}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=UDt(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[bO]=e,t[rre]=n,p$t(t,e,!1,!1),e.stateNode=t;e:{switch(a=p6e(r,n),r){case"dialog":gl("cancel",t),gl("close",t),o=n;break;case"iframe":case"object":case"embed":gl("load",t),o=n;break;case"video":case"audio":for(o=0;o<$te.length;o++)gl($te[o],t);o=n;break;case"source":gl("error",t),o=n;break;case"img":case"image":case"link":gl("error",t),gl("load",t),o=n;break;case"details":gl("toggle",t),o=n;break;case"input":R1t(t,n),o=s6e(t,n),gl("invalid",t);break;case"option":o=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=vc({},n,{value:void 0}),gl("invalid",t);break;case"textarea":A1t(t,n),o=c6e(t,n),gl("invalid",t);break;default:o=n}f6e(r,o),s=o;for(i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="style"?HDt(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&zDt(t,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&Jte(t,u):typeof u=="number"&&Jte(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Wte.hasOwnProperty(i)?u!=null&&i==="onScroll"&&gl("scroll",t):u!=null&&X6e(t,i,u,a))}switch(r){case"input":rye(t),I1t(t,n,!1);break;case"textarea":rye(t),N1t(t);break;case"option":n.value!=null&&t.setAttribute("value",""+wF(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?h5(t,!!n.multiple,i,!1):n.defaultValue!=null&&h5(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=Fye)}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 Ey(e),null;case 6:if(t&&e.stateNode!=null)h$t(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(dt(166));if(r=M4(ore.current),M4(vO.current),hye(e)){if(n=e.stateNode,r=e.memoizedProps,n[bO]=e,(i=n.nodeValue!==r)&&(t=lw,t!==null))switch(t.tag){case 3:mye(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&mye(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[bO]=e,e.stateNode=n}return Ey(e),null;case 13:if(yl(bc),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Bl&&uw!==null&&(e.mode&1)!==0&&(e.flags&128)===0)Ajt(),C5(),e.flags|=98560,i=!1;else if(i=hye(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(dt(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(dt(317));i[bO]=e}else C5(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Ey(e),i=!1}else KC!==null&&(J6e(KC),KC=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||(bc.current&1)!==0?Rm===0&&(Rm=3):AJe())),e.updateQueue!==null&&(e.flags|=4),Ey(e),null);case 4:return T5(),k6e(t,e),t===null&&ere(e.stateNode.containerInfo),Ey(e),null;case 10:return hJe(e.type._context),Ey(e),null;case 17:return k_(e.type)&&kye(),Ey(e),null;case 19:if(yl(bc),i=e.memoizedState,i===null)return Ey(e),null;if(n=(e.flags&128)!==0,a=i.rendering,a===null)if(n)Rte(i,!1);else{if(Rm!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(a=Wye(t),a!==null){for(e.flags|=128,Rte(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 Zu(bc,bc.current&1|2),e.child}t=t.sibling}i.tail!==null&&nd()>E5&&(e.flags|=128,n=!0,Rte(i,!1),e.lanes=4194304)}else{if(!n)if(t=Wye(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),Rte(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Bl)return Ey(e),null}else 2*nd()-i.renderingStartTime>E5&&r!==1073741824&&(e.flags|=128,n=!0,Rte(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=nd(),e.sibling=null,r=bc.current,Zu(bc,n?r&1|2:r&1),e):(Ey(e),null);case 22:case 23:return IJe(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&(e.mode&1)!==0?(sw&1073741824)!==0&&(Ey(e),e.subtreeFlags&6&&(e.flags|=8192)):Ey(e),null;case 24:return null;case 25:return null}throw Error(dt(156,e.tag))}function O0n(t,e){switch(dJe(e),e.tag){case 1:return k_(e.type)&&kye(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return T5(),yl(F_),yl(My),vJe(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return _Je(e),null;case 13:if(yl(bc),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(dt(340));C5()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return yl(bc),null;case 4:return T5(),null;case 10:return hJe(e.type._context),null;case 22:case 23:return IJe(),null;case 24:return null;default:return null}}var bye=!1,Py=!1,E0n=typeof WeakSet=="function"?WeakSet:Set,Pr=null;function p5(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){jc(t,e,n)}else r.current=null}function q6e(t,e,r){try{r()}catch(n){jc(t,e,n)}}var CDt=!1;function P0n(t,e){if(C6e=jye,t=_jt(),lJe(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(x6e={focusedElem:t,selectionRange:r},jye=!1,Pr=e;Pr!==null;)if(e=Pr,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Pr=t;else for(;Pr!==null;){e=Pr;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,y=m.memoizedState,g=e.stateNode,b=g.getSnapshotBeforeUpdate(e.elementType===e.type?h:WC(e.type,h),y);g.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(dt(163))}}catch(w){jc(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,Pr=t;break}Pr=e.return}return m=CDt,CDt=!1,m}function zte(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&&q6e(e,r,i)}o=o.next}while(o!==n)}}function ube(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 B6e(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 g$t(t){var e=t.alternate;e!==null&&(t.alternate=null,g$t(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[bO],delete e[rre],delete e[E6e],delete e[c0n],delete e[d0n])),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 y$t(t){return t.tag===5||t.tag===3||t.tag===4}function xDt(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||y$t(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 U6e(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=Fye));else if(n!==4&&(t=t.child,t!==null))for(U6e(t,e,r),t=t.sibling;t!==null;)U6e(t,e,r),t=t.sibling}function z6e(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(z6e(t,e,r),t=t.sibling;t!==null;)z6e(t,e,r),t=t.sibling}var Cg=null,JC=!1;function aF(t,e,r){for(r=r.child;r!==null;)b$t(t,e,r),r=r.sibling}function b$t(t,e,r){if(_O&&typeof _O.onCommitFiberUnmount=="function")try{_O.onCommitFiberUnmount(ebe,r)}catch{}switch(r.tag){case 5:Py||p5(r,e);case 6:var n=Cg,o=JC;Cg=null,aF(t,e,r),Cg=n,JC=o,Cg!==null&&(JC?(t=Cg,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Cg.removeChild(r.stateNode));break;case 18:Cg!==null&&(JC?(t=Cg,r=r.stateNode,t.nodeType===8?W3e(t.parentNode,r):t.nodeType===1&&W3e(t,r),Zte(t)):W3e(Cg,r.stateNode));break;case 4:n=Cg,o=JC,Cg=r.stateNode.containerInfo,JC=!0,aF(t,e,r),Cg=n,JC=o;break;case 0:case 11:case 14:case 15:if(!Py&&(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)&&q6e(r,e,a),o=o.next}while(o!==n)}aF(t,e,r);break;case 1:if(!Py&&(p5(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){jc(r,e,s)}aF(t,e,r);break;case 21:aF(t,e,r);break;case 22:r.mode&1?(Py=(n=Py)||r.memoizedState!==null,aF(t,e,r),Py=n):aF(t,e,r);break;default:aF(t,e,r)}}function TDt(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new E0n),e.forEach(function(n){var o=L0n.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function HC(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:Cg=s.stateNode,JC=!1;break e;case 3:Cg=s.stateNode.containerInfo,JC=!0;break e;case 4:Cg=s.stateNode.containerInfo,JC=!0;break e}s=s.return}if(Cg===null)throw Error(dt(160));b$t(i,a,o),Cg=null,JC=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){jc(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)_$t(e,t),e=e.sibling}function _$t(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(HC(e,t),gO(t),n&4){try{zte(3,t,t.return),ube(3,t)}catch(h){jc(t,t.return,h)}try{zte(5,t,t.return)}catch(h){jc(t,t.return,h)}}break;case 1:HC(e,t),gO(t),n&512&&r!==null&&p5(r,r.return);break;case 5:if(HC(e,t),gO(t),n&512&&r!==null&&p5(r,r.return),t.flags&32){var o=t.stateNode;try{Jte(o,"")}catch(h){jc(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&&qDt(o,i),p6e(s,a);var l=p6e(s,i);for(a=0;a<u.length;a+=2){var c=u[a],d=u[a+1];c==="style"?HDt(o,d):c==="dangerouslySetInnerHTML"?zDt(o,d):c==="children"?Jte(o,d):X6e(o,c,d,l)}switch(s){case"input":u6e(o,i);break;case"textarea":BDt(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?h5(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?h5(o,!!i.multiple,i.defaultValue,!0):h5(o,!!i.multiple,i.multiple?[]:"",!1))}o[rre]=i}catch(h){jc(t,t.return,h)}}break;case 6:if(HC(e,t),gO(t),n&4){if(t.stateNode===null)throw Error(dt(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(h){jc(t,t.return,h)}}break;case 3:if(HC(e,t),gO(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Zte(e.containerInfo)}catch(h){jc(t,t.return,h)}break;case 4:HC(e,t),gO(t);break;case 13:HC(e,t),gO(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(MJe=nd())),n&4&&TDt(t);break;case 22:if(c=r!==null&&r.memoizedState!==null,t.mode&1?(Py=(l=Py)||c,HC(e,t),Py=l):HC(e,t),gO(t),n&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&(t.mode&1)!==0)for(Pr=t,c=t.child;c!==null;){for(d=Pr=c;Pr!==null;){switch(f=Pr,p=f.child,f.tag){case 0:case 11:case 14:case 15:zte(4,f,f.return);break;case 1:p5(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){jc(n,r,h)}}break;case 5:p5(f,f.return);break;case 22:if(f.memoizedState!==null){EDt(d);continue}}p!==null?(p.return=f,Pr=p):EDt(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=VDt("display",a))}catch(h){jc(t,t.return,h)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(h){jc(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:HC(e,t),gO(t),n&4&&TDt(t);break;case 21:break;default:HC(e,t),gO(t)}}function gO(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(y$t(r)){var n=r;break e}r=r.return}throw Error(dt(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(Jte(o,""),n.flags&=-33);var i=xDt(t);z6e(t,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,s=xDt(t);U6e(t,s,a);break;default:throw Error(dt(161))}}catch(u){jc(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function M0n(t,e,r){Pr=t,v$t(t,e,r)}function v$t(t,e,r){for(var n=(t.mode&1)!==0;Pr!==null;){var o=Pr,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||bye;if(!a){var s=o.alternate,u=s!==null&&s.memoizedState!==null||Py;s=bye;var l=Py;if(bye=a,(Py=u)&&!l)for(Pr=o;Pr!==null;)a=Pr,u=a.child,a.tag===22&&a.memoizedState!==null?PDt(o):u!==null?(u.return=a,Pr=u):PDt(o);for(;i!==null;)Pr=i,v$t(i,e,r),i=i.sibling;Pr=o,bye=s,Py=l}ODt(t,e,r)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,Pr=i):ODt(t,e,r)}}function ODt(t){for(;Pr!==null;){var e=Pr;if((e.flags&8772)!==0){var r=e.alternate;try{if((e.flags&8772)!==0)switch(e.tag){case 0:case 11:case 15:Py||ube(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!Py)if(r===null)n.componentDidMount();else{var o=e.elementType===e.type?r.memoizedProps:WC(e.type,r.memoizedProps);n.componentDidUpdate(o,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&lDt(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}lDt(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&&Zte(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(dt(163))}Py||e.flags&512&&B6e(e)}catch(f){jc(e,e.return,f)}}if(e===t){Pr=null;break}if(r=e.sibling,r!==null){r.return=e.return,Pr=r;break}Pr=e.return}}function EDt(t){for(;Pr!==null;){var e=Pr;if(e===t){Pr=null;break}var r=e.sibling;if(r!==null){r.return=e.return,Pr=r;break}Pr=e.return}}function PDt(t){for(;Pr!==null;){var e=Pr;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{ube(4,e)}catch(u){jc(e,r,u)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var o=e.return;try{n.componentDidMount()}catch(u){jc(e,o,u)}}var i=e.return;try{B6e(e)}catch(u){jc(e,i,u)}break;case 5:var a=e.return;try{B6e(e)}catch(u){jc(e,a,u)}}}catch(u){jc(e,e.return,u)}if(e===t){Pr=null;break}var s=e.sibling;if(s!==null){s.return=e.return,Pr=s;break}Pr=e.return}}var R0n=Math.ceil,Gye=y1.ReactCurrentDispatcher,EJe=y1.ReactCurrentOwner,LS=y1.ReactCurrentBatchConfig,is=0,Eh=null,Cd=null,xg=0,sw=0,m5=xF(0),Rm=0,ure=null,j4=0,lbe=0,PJe=0,Vte=null,$_=null,MJe=0,E5=1/0,u1=null,Xye=!1,V6e=null,bF=null,_ye=!1,fF=null,Zye=0,Hte=0,H6e=null,Eye=-1,Pye=0;function Db(){return(is&6)!==0?nd():Eye!==-1?Eye:Eye=nd()}function _F(t){return(t.mode&1)===0?1:(is&2)!==0&&xg!==0?xg&-xg:p0n.transition!==null?(Pye===0&&(Pye=njt()),Pye):(t=uu,t!==0||(t=window.event,t=t===void 0?16:cjt(t.type)),t)}function XC(t,e,r,n){if(50<Hte)throw Hte=0,H6e=null,Error(dt(185));lre(t,r,n),((is&2)===0||t!==Eh)&&(t===Eh&&((is&2)===0&&(lbe|=r),Rm===4&&cF(t,xg)),q_(t,n),r===1&&is===0&&(e.mode&1)===0&&(E5=nd()+500,ibe&&TF()))}function q_(t,e){var r=t.callbackNode;hSn(t,e);var n=Dye(t,t===Eh?xg:0);if(n===0)r!==null&&$1t(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&$1t(r),e===1)t.tag===0?f0n(MDt.bind(null,t)):Mjt(MDt.bind(null,t)),u0n(function(){(is&6)===0&&TF()}),r=null;else{switch(ojt(n)){case 1:r=tJe;break;case 4:r=tjt;break;case 16:r=Nye;break;case 536870912:r=rjt;break;default:r=Nye}r=P$t(r,w$t.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function w$t(t,e){if(Eye=-1,Pye=0,(is&6)!==0)throw Error(dt(327));var r=t.callbackNode;if(v5()&&t.callbackNode!==r)return null;var n=Dye(t,t===Eh?xg:0);if(n===0)return null;if((n&30)!==0||(n&t.expiredLanes)!==0||e)e=Yye(t,n);else{e=n;var o=is;is|=2;var i=C$t();(Eh!==t||xg!==e)&&(u1=null,E5=nd()+500,R4(t,e));do try{N0n();break}catch(s){S$t(t,s)}while(!0);mJe(),Gye.current=i,is=o,Cd!==null?e=0:(Eh=null,xg=0,e=Rm)}if(e!==0){if(e===2&&(o=b6e(t),o!==0&&(n=o,e=W6e(t,o))),e===1)throw r=ure,R4(t,0),cF(t,n),q_(t,nd()),r;if(e===6)cF(t,n);else{if(o=t.current.alternate,(n&30)===0&&!I0n(o)&&(e=Yye(t,n),e===2&&(i=b6e(t),i!==0&&(n=i,e=W6e(t,i))),e===1))throw r=ure,R4(t,0),cF(t,n),q_(t,nd()),r;switch(t.finishedWork=o,t.finishedLanes=n,e){case 0:case 1:throw Error(dt(345));case 2:O4(t,$_,u1);break;case 3:if(cF(t,n),(n&130023424)===n&&(e=MJe+500-nd(),10<e)){if(Dye(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){Db(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=O6e(O4.bind(null,t,$_,u1),e);break}O4(t,$_,u1);break;case 4:if(cF(t,n),(n&4194240)===n)break;for(e=t.eventTimes,o=-1;0<n;){var a=31-GC(n);i=1<<a,a=e[a],a>o&&(o=a),n&=~i}if(n=o,n=nd()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*R0n(n/1960))-n,10<n){t.timeoutHandle=O6e(O4.bind(null,t,$_,u1),n);break}O4(t,$_,u1);break;case 5:O4(t,$_,u1);break;default:throw Error(dt(329))}}}return q_(t,nd()),t.callbackNode===r?w$t.bind(null,t):null}function W6e(t,e){var r=Vte;return t.current.memoizedState.isDehydrated&&(R4(t,e).flags|=256),t=Yye(t,e),t!==2&&(e=$_,$_=r,e!==null&&J6e(e)),t}function J6e(t){$_===null?$_=t:$_.push.apply($_,t)}function I0n(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(!ZC(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 cF(t,e){for(e&=~PJe,e&=~lbe,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-GC(e),n=1<<r;t[r]=-1,e&=~n}}function MDt(t){if((is&6)!==0)throw Error(dt(327));v5();var e=Dye(t,0);if((e&1)===0)return q_(t,nd()),null;var r=Yye(t,e);if(t.tag!==0&&r===2){var n=b6e(t);n!==0&&(e=n,r=W6e(t,n))}if(r===1)throw r=ure,R4(t,0),cF(t,e),q_(t,nd()),r;if(r===6)throw Error(dt(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,O4(t,$_,u1),q_(t,nd()),null}function RJe(t,e){var r=is;is|=1;try{return t(e)}finally{is=r,is===0&&(E5=nd()+500,ibe&&TF())}}function $4(t){fF!==null&&fF.tag===0&&(is&6)===0&&v5();var e=is;is|=1;var r=LS.transition,n=uu;try{if(LS.transition=null,uu=1,t)return t()}finally{uu=n,LS.transition=r,is=e,(is&6)===0&&TF()}}function IJe(){sw=m5.current,yl(m5)}function R4(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,s0n(r)),Cd!==null)for(r=Cd.return;r!==null;){var n=r;switch(dJe(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&kye();break;case 3:T5(),yl(F_),yl(My),vJe();break;case 5:_Je(n);break;case 4:T5();break;case 13:yl(bc);break;case 19:yl(bc);break;case 10:hJe(n.type._context);break;case 22:case 23:IJe()}r=r.return}if(Eh=t,Cd=t=vF(t.current,null),xg=sw=e,Rm=0,ure=null,PJe=lbe=j4=0,$_=Vte=null,P4!==null){for(e=0;e<P4.length;e++)if(r=P4[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}P4=null}return t}function S$t(t,e){do{var r=Cd;try{if(mJe(),xye.current=Kye,Jye){for(var n=_c.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}Jye=!1}if(D4=0,Oh=Mm=_c=null,Ute=!1,ire=0,EJe.current=null,r===null||r.return===null){Rm=1,ure=e,Cd=null;break}e:{var i=t,a=r.return,s=r,u=e;if(e=xg,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=gDt(a);if(p!==null){p.flags&=-257,yDt(p,a,s,i,e),p.mode&1&&hDt(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){hDt(i,l,e),AJe();break e}u=Error(dt(426))}}else if(Bl&&s.mode&1){var y=gDt(a);if(y!==null){(y.flags&65536)===0&&(y.flags|=256),yDt(y,a,s,i,e),fJe(O5(u,s));break e}}i=u=O5(u,s),Rm!==4&&(Rm=2),Vte===null?Vte=[i]:Vte.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var g=i$t(i,u,e);uDt(i,g);break e;case 1:s=u;var b=i.type,_=i.stateNode;if((i.flags&128)===0&&(typeof b.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(bF===null||!bF.has(_)))){i.flags|=65536,e&=-e,i.lanes|=e;var w=a$t(i,s,e);uDt(i,w);break e}}i=i.return}while(i!==null)}T$t(r)}catch(T){e=T,Cd===r&&r!==null&&(Cd=r=r.return);continue}break}while(!0)}function C$t(){var t=Gye.current;return Gye.current=Kye,t===null?Kye:t}function AJe(){(Rm===0||Rm===3||Rm===2)&&(Rm=4),Eh===null||(j4&268435455)===0&&(lbe&268435455)===0||cF(Eh,xg)}function Yye(t,e){var r=is;is|=2;var n=C$t();(Eh!==t||xg!==e)&&(u1=null,R4(t,e));do try{A0n();break}catch(o){S$t(t,o)}while(!0);if(mJe(),is=r,Gye.current=n,Cd!==null)throw Error(dt(261));return Eh=null,xg=0,Rm}function A0n(){for(;Cd!==null;)x$t(Cd)}function N0n(){for(;Cd!==null&&!aSn();)x$t(Cd)}function x$t(t){var e=E$t(t.alternate,t,sw);t.memoizedProps=t.pendingProps,e===null?T$t(t):Cd=e,EJe.current=null}function T$t(t){var e=t;do{var r=e.alternate;if(t=e.return,(e.flags&32768)===0){if(r=T0n(r,e,sw),r!==null){Cd=r;return}}else{if(r=O0n(r,e),r!==null){r.flags&=32767,Cd=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Rm=6,Cd=null;return}}if(e=e.sibling,e!==null){Cd=e;return}Cd=e=t}while(e!==null);Rm===0&&(Rm=5)}function O4(t,e,r){var n=uu,o=LS.transition;try{LS.transition=null,uu=1,D0n(t,e,r,n)}finally{LS.transition=o,uu=n}return null}function D0n(t,e,r,n){do v5();while(fF!==null);if((is&6)!==0)throw Error(dt(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(dt(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(gSn(t,i),t===Eh&&(Cd=Eh=null,xg=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||_ye||(_ye=!0,P$t(Nye,function(){return v5(),null})),i=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||i){i=LS.transition,LS.transition=null;var a=uu;uu=1;var s=is;is|=4,EJe.current=null,P0n(t,r),_$t(r,t),r0n(x6e),jye=!!C6e,x6e=C6e=null,t.current=r,M0n(r,t,o),sSn(),is=s,uu=a,LS.transition=i}else t.current=r;if(_ye&&(_ye=!1,fF=t,Zye=o),i=t.pendingLanes,i===0&&(bF=null),cSn(r.stateNode,n),q_(t,nd()),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(Xye)throw Xye=!1,t=V6e,V6e=null,t;return(Zye&1)!==0&&t.tag!==0&&v5(),i=t.pendingLanes,(i&1)!==0?t===H6e?Hte++:(Hte=0,H6e=t):Hte=0,TF(),null}function v5(){if(fF!==null){var t=ojt(Zye),e=LS.transition,r=uu;try{if(LS.transition=null,uu=16>t?16:t,fF===null)var n=!1;else{if(t=fF,fF=null,Zye=0,(is&6)!==0)throw Error(dt(331));var o=is;for(is|=4,Pr=t.current;Pr!==null;){var i=Pr,a=i.child;if((Pr.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;u<s.length;u++){var l=s[u];for(Pr=l;Pr!==null;){var c=Pr;switch(c.tag){case 0:case 11:case 15:zte(8,c,i)}var d=c.child;if(d!==null)d.return=c,Pr=d;else for(;Pr!==null;){c=Pr;var f=c.sibling,p=c.return;if(g$t(c),c===l){Pr=null;break}if(f!==null){f.return=p,Pr=f;break}Pr=p}}}var m=i.alternate;if(m!==null){var h=m.child;if(h!==null){m.child=null;do{var y=h.sibling;h.sibling=null,h=y}while(h!==null)}}Pr=i}}if((i.subtreeFlags&2064)!==0&&a!==null)a.return=i,Pr=a;else e:for(;Pr!==null;){if(i=Pr,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:zte(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,Pr=g;break e}Pr=i.return}}var b=t.current;for(Pr=b;Pr!==null;){a=Pr;var _=a.child;if((a.subtreeFlags&2064)!==0&&_!==null)_.return=a,Pr=_;else e:for(a=b;Pr!==null;){if(s=Pr,(s.flags&2048)!==0)try{switch(s.tag){case 0:case 11:case 15:ube(9,s)}}catch(T){jc(s,s.return,T)}if(s===a){Pr=null;break e}var w=s.sibling;if(w!==null){w.return=s.return,Pr=w;break e}Pr=s.return}}if(is=o,TF(),_O&&typeof _O.onPostCommitFiberRoot=="function")try{_O.onPostCommitFiberRoot(ebe,t)}catch{}n=!0}return n}finally{uu=r,LS.transition=e}}return!1}function RDt(t,e,r){e=O5(r,e),e=i$t(t,e,1),t=yF(t,e,1),e=Db(),t!==null&&(lre(t,1,e),q_(t,e))}function jc(t,e,r){if(t.tag===3)RDt(t,t,r);else for(;e!==null;){if(e.tag===3){RDt(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(bF===null||!bF.has(n))){t=O5(r,t),t=a$t(e,t,1),e=yF(e,t,1),t=Db(),e!==null&&(lre(e,1,t),q_(e,t));break}}e=e.return}}function j0n(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=Db(),t.pingedLanes|=t.suspendedLanes&r,Eh===t&&(xg&r)===r&&(Rm===4||Rm===3&&(xg&130023424)===xg&&500>nd()-MJe?R4(t,0):PJe|=r),q_(t,e)}function O$t(t,e){e===0&&((t.mode&1)===0?e=1:(e=iye,iye<<=1,(iye&130023424)===0&&(iye=4194304)));var r=Db();t=h1(t,e),t!==null&&(lre(t,e,r),q_(t,r))}function $0n(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),O$t(t,r)}function L0n(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(dt(314))}n!==null&&n.delete(e),O$t(t,r)}var E$t;E$t=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||F_.current)L_=!0;else{if((t.lanes&r)===0&&(e.flags&128)===0)return L_=!1,x0n(t,e,r);L_=(t.flags&131072)!==0}else L_=!1,Bl&&(e.flags&1048576)!==0&&Rjt(e,Uye,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;Oye(t,e),t=e.pendingProps;var o=S5(e,My.current);_5(e,r),o=SJe(null,e,n,t,o,r);var i=CJe();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,k_(n)?(i=!0,qye(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,yJe(e),o.updater=abe,e.stateNode=o,o._reactInternals=e,N6e(e,n,t,r),e=$6e(null,e,n,!0,i,r)):(e.tag=0,Bl&&i&&cJe(e),Nb(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(Oye(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=k0n(n),t=WC(n,t),o){case 0:e=j6e(null,e,n,t,r);break e;case 1:e=vDt(null,e,n,t,r);break e;case 11:e=bDt(null,e,n,t,r);break e;case 14:e=_Dt(null,e,n,WC(n.type,t),r);break e}throw Error(dt(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:WC(n,o),j6e(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:WC(n,o),vDt(t,e,n,o,r);case 3:e:{if(c$t(e),t===null)throw Error(dt(387));n=e.pendingProps,i=e.memoizedState,o=i.element,Djt(t,e),Hye(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=O5(Error(dt(423)),e),e=wDt(t,e,n,r,o);break e}else if(n!==o){o=O5(Error(dt(424)),e),e=wDt(t,e,n,r,o);break e}else for(uw=gF(e.stateNode.containerInfo.firstChild),lw=e,Bl=!0,KC=null,r=Fjt(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(C5(),n===o){e=g1(t,e,r);break e}Nb(t,e,n,r)}e=e.child}return e;case 5:return kjt(e),t===null&&R6e(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,T6e(n,o)?a=null:i!==null&&T6e(n,i)&&(e.flags|=32),l$t(t,e),Nb(t,e,a,r),e.child;case 6:return t===null&&R6e(e),null;case 13:return d$t(t,e,r);case 4:return bJe(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=x5(e,null,n,r):Nb(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:WC(n,o),bDt(t,e,n,o,r);case 7:return Nb(t,e,e.pendingProps,r),e.child;case 8:return Nb(t,e,e.pendingProps.children,r),e.child;case 12:return Nb(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,Zu(zye,n._currentValue),n._currentValue=a,i!==null)if(ZC(i.value,a)){if(i.children===o.children&&!F_.current){e=g1(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=f1(-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),I6e(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(dt(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),I6e(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}Nb(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,_5(e,r),o=FS(o),n=n(o),e.flags|=1,Nb(t,e,n,r),e.child;case 14:return n=e.type,o=WC(n,e.pendingProps),o=WC(n.type,o),_Dt(t,e,n,o,r);case 15:return s$t(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:WC(n,o),Oye(t,e),e.tag=1,k_(n)?(t=!0,qye(e)):t=!1,_5(e,r),$jt(e,n,o),N6e(e,n,o,r),$6e(null,e,n,!0,t,r);case 19:return f$t(t,e,r);case 22:return u$t(t,e,r)}throw Error(dt(156,e.tag))};function P$t(t,e){return ejt(t,e)}function F0n(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 $S(t,e,r,n){return new F0n(t,e,r,n)}function NJe(t){return t=t.prototype,!(!t||!t.isReactComponent)}function k0n(t){if(typeof t=="function")return NJe(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Y6e)return 11;if(t===Q6e)return 14}return 2}function vF(t,e){var r=t.alternate;return r===null?(r=$S(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 Mye(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")NJe(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case o5:return I4(r.children,o,i,e);case Z6e:a=8,o|=8;break;case n6e:return t=$S(12,r,e,o|2),t.elementType=n6e,t.lanes=i,t;case o6e:return t=$S(13,r,e,o),t.elementType=o6e,t.lanes=i,t;case i6e:return t=$S(19,r,e,o),t.elementType=i6e,t.lanes=i,t;case LDt:return cbe(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case jDt:a=10;break e;case $Dt:a=9;break e;case Y6e:a=11;break e;case Q6e:a=14;break e;case sF:a=16,n=null;break e}throw Error(dt(130,t==null?t:typeof t,""))}return e=$S(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function I4(t,e,r,n){return t=$S(7,t,n,e),t.lanes=r,t}function cbe(t,e,r,n){return t=$S(22,t,n,e),t.elementType=LDt,t.lanes=r,t.stateNode={isHidden:!1},t}function e6e(t,e,r){return t=$S(6,t,null,e),t.lanes=r,t}function t6e(t,e,r){return e=$S(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function q0n(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=F3e(0),this.expirationTimes=F3e(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=F3e(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function DJe(t,e,r,n,o,i,a,s,u){return t=new q0n(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=$S(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},yJe(i),t}function B0n(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:n5,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function M$t(t){if(!t)return SF;t=t._reactInternals;e:{if(F4(t)!==t||t.tag!==1)throw Error(dt(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(k_(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(dt(171))}if(t.tag===1){var r=t.type;if(k_(r))return Pjt(t,r,e)}return e}function R$t(t,e,r,n,o,i,a,s,u){return t=DJe(r,n,!0,t,o,i,a,s,u),t.context=M$t(null),r=t.current,n=Db(),o=_F(r),i=f1(n,o),i.callback=e??null,yF(r,i,o),t.current.lanes=o,lre(t,o,n),q_(t,n),t}function dbe(t,e,r,n){var o=e.current,i=Db(),a=_F(o);return r=M$t(r),e.context===null?e.context=r:e.pendingContext=r,e=f1(i,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=yF(o,e,a),t!==null&&(XC(t,o,a,i),Cye(t,o,a)),a}function Qye(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 IDt(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function jJe(t,e){IDt(t,e),(t=t.alternate)&&IDt(t,e)}function U0n(){return null}var I$t=typeof reportError=="function"?reportError:function(t){console.error(t)};function $Je(t){this._internalRoot=t}fbe.prototype.render=$Je.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(dt(409));dbe(t,e,null,null)};fbe.prototype.unmount=$Je.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;$4(function(){dbe(null,t,null,null)}),e[m1]=null}};function fbe(t){this._internalRoot=t}fbe.prototype.unstable_scheduleHydration=function(t){if(t){var e=sjt();t={blockedOn:null,target:t,priority:e};for(var r=0;r<lF.length&&e!==0&&e<lF[r].priority;r++);lF.splice(r,0,t),r===0&&ljt(t)}};function LJe(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function pbe(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function ADt(){}function z0n(t,e,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var l=Qye(a);i.call(l)}}var a=R$t(e,n,t,0,null,!1,!1,"",ADt);return t._reactRootContainer=a,t[m1]=a.current,ere(t.nodeType===8?t.parentNode:t),$4(),a}for(;o=t.lastChild;)t.removeChild(o);if(typeof n=="function"){var s=n;n=function(){var l=Qye(u);s.call(l)}}var u=DJe(t,0,!1,null,null,!1,!1,"",ADt);return t._reactRootContainer=u,t[m1]=u.current,ere(t.nodeType===8?t.parentNode:t),$4(function(){dbe(e,u,r,n)}),u}function mbe(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=Qye(a);s.call(u)}}dbe(e,a,t,o)}else a=z0n(r,e,t,o,n);return Qye(a)}ijt=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=jte(e.pendingLanes);r!==0&&(rJe(e,r|1),q_(e,nd()),(is&6)===0&&(E5=nd()+500,TF()))}break;case 13:$4(function(){var n=h1(t,1);if(n!==null){var o=Db();XC(n,t,1,o)}}),jJe(t,1)}};nJe=function(t){if(t.tag===13){var e=h1(t,134217728);if(e!==null){var r=Db();XC(e,t,134217728,r)}jJe(t,134217728)}};ajt=function(t){if(t.tag===13){var e=_F(t),r=h1(t,e);if(r!==null){var n=Db();XC(r,t,e,n)}jJe(t,e)}};sjt=function(){return uu};ujt=function(t,e){var r=uu;try{return uu=t,e()}finally{uu=r}};h6e=function(t,e,r){switch(e){case"input":if(u6e(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=obe(n);if(!o)throw Error(dt(90));kDt(n),u6e(n,o)}}}break;case"textarea":BDt(t,r);break;case"select":e=r.value,e!=null&&h5(t,!!r.multiple,e,!1)}};KDt=RJe;GDt=$4;var V0n={usingClientEntryPoint:!1,Events:[dre,u5,obe,WDt,JDt,RJe]},Ite={findFiberByHostInstance:E4,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},H0n={bundleType:Ite.bundleType,version:Ite.version,rendererPackageName:Ite.rendererPackageName,rendererConfig:Ite.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:y1.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=YDt(t),t===null?null:t.stateNode},findFiberByHostInstance:Ite.findFiberByHostInstance||U0n,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Ate=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Ate.isDisabled&&Ate.supportsFiber))try{ebe=Ate.inject(H0n),_O=Ate}catch{}var Ate;fw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=V0n;fw.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!LJe(e))throw Error(dt(200));return B0n(t,e,null,r)};fw.createRoot=function(t,e){if(!LJe(t))throw Error(dt(299));var r=!1,n="",o=I$t;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=DJe(t,1,!1,null,null,r,!1,n,o),t[m1]=e.current,ere(t.nodeType===8?t.parentNode:t),new $Je(e)};fw.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(dt(188)):(t=Object.keys(t).join(","),Error(dt(268,t)));return t=YDt(e),t=t===null?null:t.stateNode,t};fw.flushSync=function(t){return $4(t)};fw.hydrate=function(t,e,r){if(!pbe(e))throw Error(dt(200));return mbe(null,t,e,!0,r)};fw.hydrateRoot=function(t,e,r){if(!LJe(t))throw Error(dt(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=I$t;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=R$t(e,null,t,1,r??null,o,!1,i,a),t[m1]=e.current,ere(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 fbe(e)};fw.render=function(t,e,r){if(!pbe(e))throw Error(dt(200));return mbe(null,t,e,!1,r)};fw.unmountComponentAtNode=function(t){if(!pbe(t))throw Error(dt(40));return t._reactRootContainer?($4(function(){mbe(null,null,t,!1,function(){t._reactRootContainer=null,t[m1]=null})}),!0):!1};fw.unstable_batchedUpdates=RJe;fw.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!pbe(r))throw Error(dt(200));if(t==null||t._reactInternals===void 0)throw Error(dt(38));return mbe(t,e,r,!1,n)};fw.version="18.2.0-next-9e3b772b8-20220608"});var yu=S((Szi,D$t)=>{"use strict";function N$t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(N$t)}catch(t){console.error(t)}}N$t(),D$t.exports=A$t()});var Im=S(FJe=>{"use strict";var j$t=yu();FJe.createRoot=j$t.createRoot,FJe.hydrateRoot=j$t.hydrateRoot;var Czi});function $$t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function L$t(...t){return e=>{let r=!1,n=t.map(o=>{let i=$$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():$$t(t[o],null)}}}}var W0n,F$t=v(()=>{W0n=$(K(),1)});var q$t=S(hbe=>{"use strict";var J0n=K(),K0n=Symbol.for("react.element"),G0n=Symbol.for("react.fragment"),X0n=Object.prototype.hasOwnProperty,Z0n=J0n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Y0n={key:!0,ref:!0,__self:!0,__source:!0};function k$t(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)X0n.call(e,n)&&!Y0n.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:K0n,type:t,key:i,ref:a,props:o,_owner:Z0n.current}}hbe.Fragment=G0n;hbe.jsx=k$t;hbe.jsxs=k$t});var wt=S((Ezi,B$t)=>{"use strict";B$t.exports=q$t()});function eCn(t){return typeof t=="object"&&t!==null&&"then"in t}function U$t(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===Q0n&&"_payload"in t&&eCn(t._payload)}function tCn(t){let e=rCn(t),r=xd.forwardRef((n,o)=>{let{children:i,...a}=n;U$t(i)&&typeof ybe=="function"&&(i=ybe(i._payload));let s=xd.Children.toArray(i),u=s.find(oCn);if(u){let l=u.props.children,c=s.map(d=>d===u?xd.Children.count(l)>1?xd.Children.only(null):xd.isValidElement(l)?l.props.children:null:d);return(0,gbe.jsx)(e,{...a,ref:o,children:xd.isValidElement(l)?xd.cloneElement(l,void 0,c):null})}return(0,gbe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function rCn(t){let e=xd.forwardRef((r,n)=>{let{children:o,...i}=r;if(U$t(o)&&typeof ybe=="function"&&(o=ybe(o._payload)),xd.isValidElement(o)){let a=aCn(o),s=iCn(i,o.props);return o.type!==xd.Fragment&&(s.ref=n?L$t(n,a):a),xd.cloneElement(o,s)}return xd.Children.count(o)>1?xd.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}function oCn(t){return xd.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===nCn}function iCn(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function aCn(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 xd,gbe,Q0n,ybe,z$t,nCn,V$t=v(()=>{xd=$(K(),1);F$t();gbe=$(wt(),1),Q0n=Symbol.for("react.lazy"),ybe=xd[" use ".trim().toString()];z$t=tCn("Slot");nCn=Symbol("radix.slottable")});function H$t(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=H$t(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function bbe(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=H$t(t))&&(n&&(n+=" "),n+=e);return n}var kJe=v(()=>{});var W$t,J$t,R5,_be=v(()=>{kJe();W$t=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,J$t=bbe,R5=(t,e)=>r=>{var n;if(e?.variants==null)return J$t(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=W$t(c)||W$t(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,y]=m;return Array.isArray(y)?y.includes({...i,...s}[h]):{...i,...s}[h]===y})?[...l,d,f]:l},[]);return J$t(t,a,u,r?.class,r?.className)}});function bCn(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=eLt(e))&&(n&&(n+=" "),n+=r);return n}function X$t(t,...e){let r,n,o,i=a;function a(u){let l=e.reduce((c,d)=>d(c),t());return r=hCn(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=yCn(u,r);return o(u,c),c}return function(){return i(bCn.apply(null,arguments))}}var UJe,sCn,Y$t,K$t,uCn,lCn,BJe,G$t,cCn,dCn,fCn,Q$t,pCn,mCn,hCn,gCn,yCn,eLt,bl,tLt,_Cn,vCn,wCn,SCn,CCn,xCn,TCn,b1,OF,I5,qJe,pre,OCn,ai,EF,ECn,PCn,MCn,RCn,ICn,ACn,mre,A5,NCn,rLt,DCn,jCn,Z$t,$Cn,hre,LCn,FCn,nLt,oLt=v(()=>{UJe="-",sCn=t=>{let e=lCn(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(UJe);return s[0]===""&&s.length!==1&&s.shift(),Y$t(s,e)||uCn(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},Y$t=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?Y$t(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(UJe);return e.validators.find(({validator:a})=>a(i))?.classGroupId},K$t=/^\[(.+)\]$/,uCn=t=>{if(K$t.test(t)){let e=K$t.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},lCn=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return dCn(Object.entries(t.classGroups),r).forEach(([i,a])=>{BJe(a,n,i,e)}),n},BJe=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:G$t(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(cCn(o)){BJe(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{BJe(a,G$t(e,i),r,n)})})},G$t=(t,e)=>{let r=t;return e.split(UJe).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},cCn=t=>t.isThemeGetter,dCn=(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,fCn=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)}}},Q$t="!",pCn=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 y=0;y<s.length;y++){let g=s[y];if(l===0){if(g===o&&(n||s.slice(y,y+i)===e)){u.push(s.slice(c,y)),c=y+i;continue}if(g==="/"){d=y;continue}}g==="["?l++:g==="]"&&l--}let f=u.length===0?s:s.substring(c),p=f.startsWith(Q$t),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},mCn=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},hCn=t=>({cache:fCn(t.cacheSize),parseClassName:pCn(t),...sCn(t)}),gCn=/\s+/,yCn=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split(gCn),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 y=mCn(c).join(":"),g=d?y+Q$t:y,b=g+h;if(i.includes(b))continue;i.push(b);let _=o(h,m);for(let w=0;w<_.length;++w){let T=_[w];i.push(g+T)}s=l+(s.length>0?" "+s:s)}return s};eLt=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=eLt(t[n]))&&(r&&(r+=" "),r+=e);return r};bl=t=>{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},tLt=/^\[(?:([a-z-]+):)?(.+)\]$/i,_Cn=/^\d+\/\d+$/,vCn=new Set(["px","full","screen"]),wCn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,SCn=/\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$/,CCn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,xCn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TCn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,b1=t=>I5(t)||vCn.has(t)||_Cn.test(t),OF=t=>A5(t,"length",NCn),I5=t=>!!t&&!Number.isNaN(Number(t)),qJe=t=>A5(t,"number",I5),pre=t=>!!t&&Number.isInteger(Number(t)),OCn=t=>t.endsWith("%")&&I5(t.slice(0,-1)),ai=t=>tLt.test(t),EF=t=>wCn.test(t),ECn=new Set(["length","size","percentage"]),PCn=t=>A5(t,ECn,rLt),MCn=t=>A5(t,"position",rLt),RCn=new Set(["image","url"]),ICn=t=>A5(t,RCn,jCn),ACn=t=>A5(t,"",DCn),mre=()=>!0,A5=(t,e,r)=>{let n=tLt.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},NCn=t=>SCn.test(t)&&!CCn.test(t),rLt=()=>!1,DCn=t=>xCn.test(t),jCn=t=>TCn.test(t),Z$t=()=>{let t=bl("colors"),e=bl("spacing"),r=bl("blur"),n=bl("brightness"),o=bl("borderColor"),i=bl("borderRadius"),a=bl("borderSpacing"),s=bl("borderWidth"),u=bl("contrast"),l=bl("grayscale"),c=bl("hueRotate"),d=bl("invert"),f=bl("gap"),p=bl("gradientColorStops"),m=bl("gradientColorStopPositions"),h=bl("inset"),y=bl("margin"),g=bl("opacity"),b=bl("padding"),_=bl("saturate"),w=bl("scale"),T=bl("sepia"),O=bl("skew"),E=bl("space"),P=bl("translate"),R=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",ai,e],B=()=>[ai,e],k=()=>["",b1,OF],q=()=>["auto",I5,ai],Z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",ai],re=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ue=()=>[I5,ai];return{cacheSize:500,separator:":",theme:{colors:[mre],spacing:[b1,OF],blur:["none","",EF,ai],brightness:ue(),borderColor:[t],borderRadius:["none","","full",EF,ai],borderSpacing:B(),borderWidth:k(),contrast:ue(),grayscale:W(),hueRotate:ue(),invert:W(),gap:B(),gradientColorStops:[t],gradientColorStopPositions:[OCn,OF],inset:A(),margin:A(),opacity:ue(),padding:B(),saturate:ue(),scale:ue(),sepia:W(),skew:ue(),space:B(),translate:B()},classGroups:{aspect:[{aspect:["auto","square","video",ai]}],container:["container"],columns:[{columns:[EF]}],"break-after":[{"break-after":re()}],"break-before":[{"break-before":re()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Z(),ai]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],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",pre,ai]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ai]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",pre,ai]}],"grid-cols":[{"grid-cols":[mre]}],"col-start-end":[{col:["auto",{span:["full",pre,ai]},ai]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[mre]}],"row-start-end":[{row:["auto",{span:[pre,ai]},ai]}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ai]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ai]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...X()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...X(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...X(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ai,e]}],"min-w":[{"min-w":[ai,e,"min","max","fit"]}],"max-w":[{"max-w":[ai,e,"none","full","min","max","fit","prose",{screen:[EF]},EF]}],h:[{h:[ai,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ai,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ai,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ai,e,"auto","min","max","fit"]}],"font-size":[{text:["base",EF,OF]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",qJe]}],"font-family":[{font:[mre]}],"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",ai]}],"line-clamp":[{"line-clamp":["none",I5,qJe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",b1,ai]}],"list-image":[{"list-image":["none",ai]}],"list-style-type":[{list:["none","disc","decimal",ai]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",b1,OF]}],"underline-offset":[{"underline-offset":["auto",b1,ai]}],"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:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ai]}],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",ai]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Z(),MCn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",PCn]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ICn]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:V()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[b1,ai]}],"outline-w":[{outline:[b1,OF]}],"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":[b1,OF]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",EF,ACn]}],"shadow-color":[{shadow:[mre]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...Y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Y()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",EF,ai]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[_]}],sepia:[{sepia:[T]}],"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":[_]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"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",ai]}],duration:[{duration:ue()}],ease:[{ease:["linear","in","out","in-out",ai]}],delay:[{delay:ue()}],animate:[{animate:["none","spin","ping","pulse","bounce",ai]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[pre,ai]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[O]}],"skew-y":[{"skew-y":[O]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ai]}],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",ai]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"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",ai]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[b1,OF,qJe]}],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"]}}},$Cn=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{hre(t,"cacheSize",e),hre(t,"prefix",r),hre(t,"separator",n),hre(t,"experimentalParseClassName",o);for(let s in a)LCn(t[s],a[s]);for(let s in i)FCn(t[s],i[s]);return t},hre=(t,e,r)=>{r!==void 0&&(t[e]=r)},LCn=(t,e)=>{if(e)for(let r in e)hre(t,r,e[r])},FCn=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},nLt=(t,...e)=>typeof t=="function"?X$t(Z$t,t,...e):X$t(()=>$Cn(Z$t(),t),...e)});function Se(...t){return kCn(bbe(t))}var kCn,zr=v(()=>{kJe();oLt();kCn=nLt({prefix:"tw-",extend:{classGroups:{"text-color":["text-muted","text-success","text-warning","text-error","text-accent"],"font-size":["text-smallest","text-smaller","text-small","text-ui-smaller","text-ui-small","text-ui-medium","text-ui-larger"]}}})});var vbe,qCn,me,xn=v(()=>{vbe=$(K());V$t();_be();zr();qCn=R5("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"}}),me=vbe.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>vbe.createElement(n?z$t:"button",{className:Se(qCn({variant:e,size:r,className:t})),ref:i,...o}));me.displayName="Button"});var iLt,wbe,zJe=v(()=>{iLt=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),wbe=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim()});var aLt,sLt=v(()=>{aLt={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 gre,uLt,lLt=v(()=>{gre=$(K());sLt();zJe();uLt=(0,gre.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,gre.createElement)("svg",{ref:u,...aLt,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:wbe("lucide",o),...s},[...a.map(([l,c])=>(0,gre.createElement)(l,c)),...Array.isArray(i)?i:[i]]))});var Sbe,Me,jt=v(()=>{Sbe=$(K());zJe();lLt();Me=(t,e)=>{let r=(0,Sbe.forwardRef)(({className:n,...o},i)=>(0,Sbe.createElement)(uLt,{ref:i,iconNode:e,className:wbe(`lucide-${iLt(t)}`,n),...o}));return r.displayName=`${t}`,r}});var yre,cLt=v(()=>{jt();yre=Me("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])});var _1,dLt=v(()=>{jt();_1=Me("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]])});var bre,fLt=v(()=>{jt();bre=Me("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])});var N5,pLt=v(()=>{jt();N5=Me("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]])});var Yu,mLt=v(()=>{jt();Yu=Me("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])});var Ji,hLt=v(()=>{jt();Ji=Me("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])});var od,gLt=v(()=>{jt();od=Me("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])});var Og,yLt=v(()=>{jt();Og=Me("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])});var $b,bLt=v(()=>{jt();$b=Me("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])});var B_,_Lt=v(()=>{jt();B_=Me("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])});var PF,vLt=v(()=>{jt();PF=Me("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])});var v1,wLt=v(()=>{jt();v1=Me("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]])});var MF,SLt=v(()=>{jt();MF=Me("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 pw,CLt=v(()=>{jt();pw=Me("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])});var RF,xLt=v(()=>{jt();RF=Me("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]])});var wO,TLt=v(()=>{jt();wO=Me("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 _re,OLt=v(()=>{jt();_re=Me("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])});var vre,ELt=v(()=>{jt();vre=Me("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]])});var wre,PLt=v(()=>{jt();wre=Me("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 Sre,MLt=v(()=>{jt();Sre=Me("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]])});var Cre,RLt=v(()=>{jt();Cre=Me("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 D5,ILt=v(()=>{jt();D5=Me("CopyPlus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["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 U_,ALt=v(()=>{jt();U_=Me("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 xre,NLt=v(()=>{jt();xre=Me("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]])});var Tre,DLt=v(()=>{jt();Tre=Me("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 YC,jLt=v(()=>{jt();YC=Me("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 Ore,$Lt=v(()=>{jt();Ore=Me("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 SO,LLt=v(()=>{jt();SO=Me("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 IF,FLt=v(()=>{jt();IF=Me("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 w1,kLt=v(()=>{jt();w1=Me("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 Ere,qLt=v(()=>{jt();Ere=Me("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 S1,BLt=v(()=>{jt();S1=Me("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 Pre,ULt=v(()=>{jt();Pre=Me("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]])});var C1,zLt=v(()=>{jt();C1=Me("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]])});var Mre,VLt=v(()=>{jt();Mre=Me("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]])});var Rre,HLt=v(()=>{jt();Rre=Me("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 Ire,WLt=v(()=>{jt();Ire=Me("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 ju,JLt=v(()=>{jt();ju=Me("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 Are,KLt=v(()=>{jt();Are=Me("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]])});var Am,GLt=v(()=>{jt();Am=Me("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 _l,XLt=v(()=>{jt();_l=Me("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 QC,ZLt=v(()=>{jt();QC=Me("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 AF,YLt=v(()=>{jt();AF=Me("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]])});var Nre,QLt=v(()=>{jt();Nre=Me("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 Dre,eFt=v(()=>{jt();Dre=Me("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 jre,tFt=v(()=>{jt();jre=Me("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 $re,rFt=v(()=>{jt();$re=Me("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 k4,nFt=v(()=>{jt();k4=Me("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 ex,oFt=v(()=>{jt();ex=Me("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 Us,iFt=v(()=>{jt();Us=Me("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])});var Lre,aFt=v(()=>{jt();Lre=Me("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 j5,sFt=v(()=>{jt();j5=Me("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]])});var Fre,uFt=v(()=>{jt();Fre=Me("MessageSquareX",[["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"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]])});var $5,lFt=v(()=>{jt();$5=Me("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 L5,cFt=v(()=>{jt();L5=Me("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]])});var qS,dFt=v(()=>{jt();qS=Me("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 Lb,fFt=v(()=>{jt();Lb=Me("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 NF,pFt=v(()=>{jt();NF=Me("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 DF,mFt=v(()=>{jt();DF=Me("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 kre,hFt=v(()=>{jt();kre=Me("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])});var Fb,gFt=v(()=>{jt();Fb=Me("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])});var qre,yFt=v(()=>{jt();qre=Me("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 jF,bFt=v(()=>{jt();jF=Me("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 Bre,_Ft=v(()=>{jt();Bre=Me("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]])});var q4,vFt=v(()=>{jt();q4=Me("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])});var Ure,wFt=v(()=>{jt();Ure=Me("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 B4,SFt=v(()=>{jt();B4=Me("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])});var U4,CFt=v(()=>{jt();U4=Me("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])});var zre,xFt=v(()=>{jt();zre=Me("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])});var Ry,TFt=v(()=>{jt();Ry=Me("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 x1,OFt=v(()=>{jt();x1=Me("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 z_,EFt=v(()=>{jt();z_=Me("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 z4,PFt=v(()=>{jt();z4=Me("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])});var T1,MFt=v(()=>{jt();T1=Me("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 Vre,RFt=v(()=>{jt();Vre=Me("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 Iy,IFt=v(()=>{jt();Iy=Me("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 Eg,AFt=v(()=>{jt();Eg=Me("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 mw,NFt=v(()=>{jt();mw=Me("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 Ho,DFt=v(()=>{jt();Ho=Me("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])});var Hre,jFt=v(()=>{jt();Hre=Me("ZapOff",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])});var Wre,$Ft=v(()=>{jt();Wre=Me("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])});var Mr=v(()=>{bLt();_Lt();vLt();SLt();CLt();xLt();TLt();LLt();FLt();iFt();dFt();fFt();TFt();OFt();EFt();AFt();cLt();dLt();fLt();pLt();mLt();hLt();gLt();yLt();wLt();OLt();ELt();PLt();MLt();RLt();ILt();ALt();NLt();DLt();jLt();$Lt();kLt();qLt();BLt();ULt();zLt();VLt();HLt();WLt();JLt();KLt();GLt();XLt();ZLt();YLt();QLt();eFt();tFt();rFt();nFt();oFt();aFt();sFt();uFt();lFt();cFt();pFt();mFt();hFt();gFt();yFt();bFt();_Ft();vFt();wFt();SFt();CFt();xFt();PFt();MFt();RFt();IFt();NFt();DFt();jFt();$Ft();});function BCn({onCancel:t}){let e=ee(),r=VJe(e.defaultModelKey)&&VJe(e.embeddingModelKey);return CO.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},CO.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},CO.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&CO.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.")),CO.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},CO.default.createElement(me,{variant:"ghost",onClick:t},"Close"),CO.default.createElement(me,{variant:"default",onClick:()=>{V4(a1.EXPIRED_MODAL)}},"Renew Now ",CO.default.createElement(w1,{className:"tw-size-4"}))))}var CO,LFt,FFt,Cbe,kFt=v(()=>{CO=$(K()),LFt=require("obsidian"),FFt=$(Im());xn();id();gr();Mr();Qe();Cbe=class extends LFt.Modal{constructor(e){super(e),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:e}=this;this.root=(0,FFt.createRoot)(e);let r=()=>{this.close()};this.root.render(CO.default.createElement(BCn,{onCancel:r}))}onClose(){this.root.unmount()}}});var BFt=S(qFt=>{"use strict";Object.defineProperty(qFt,"__esModule",{value:!0})});var UFt=S(xbe=>{"use strict";Object.defineProperty(xbe,"__esModule",{value:!0});xbe.V2ChatStreamRequestSafetyMode=void 0;xbe.V2ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",Off:"OFF"}});var zFt=S(Tbe=>{"use strict";Object.defineProperty(Tbe,"__esModule",{value:!0});Tbe.V2ChatStreamRequestToolChoice=void 0;Tbe.V2ChatStreamRequestToolChoice={Required:"REQUIRED",None:"NONE"}});var HFt=S(VFt=>{"use strict";Object.defineProperty(VFt,"__esModule",{value:!0})});var JFt=S(WFt=>{"use strict";Object.defineProperty(WFt,"__esModule",{value:!0})});var KFt=S(Obe=>{"use strict";Object.defineProperty(Obe,"__esModule",{value:!0});Obe.V2ChatRequestSafetyMode=void 0;Obe.V2ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",Off:"OFF"}});var GFt=S(Ebe=>{"use strict";Object.defineProperty(Ebe,"__esModule",{value:!0});Ebe.V2ChatRequestToolChoice=void 0;Ebe.V2ChatRequestToolChoice={Required:"REQUIRED",None:"NONE"}});var ZFt=S(XFt=>{"use strict";Object.defineProperty(XFt,"__esModule",{value:!0})});var YFt=S(Pbe=>{"use strict";Object.defineProperty(Pbe,"__esModule",{value:!0});Pbe.V2EmbedRequestTruncate=void 0;Pbe.V2EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var ekt=S(QFt=>{"use strict";Object.defineProperty(QFt,"__esModule",{value:!0})});var rkt=S(tkt=>{"use strict";Object.defineProperty(tkt,"__esModule",{value:!0})});var HJe=S(Pg=>{"use strict";var UCn=Pg&&Pg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tx=Pg&&Pg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UCn(e,t,r)};Object.defineProperty(Pg,"__esModule",{value:!0});tx(BFt(),Pg);tx(UFt(),Pg);tx(zFt(),Pg);tx(HFt(),Pg);tx(JFt(),Pg);tx(KFt(),Pg);tx(GFt(),Pg);tx(ZFt(),Pg);tx(YFt(),Pg);tx(ekt(),Pg);tx(rkt(),Pg)});var WJe=S(nkt=>{"use strict";Object.defineProperty(nkt,"__esModule",{value:!0})});var okt=S(H4=>{"use strict";var zCn=H4&&H4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VCn=H4&&H4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zCn(e,t,r)};Object.defineProperty(H4,"__esModule",{value:!0});VCn(WJe(),H4)});var akt=S($F=>{"use strict";var HCn=$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]}),ikt=$F&&$F.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&HCn(e,t,r)};Object.defineProperty($F,"__esModule",{value:!0});ikt(HJe(),$F);ikt(okt(),$F)});var skt=S(Mbe=>{"use strict";Object.defineProperty(Mbe,"__esModule",{value:!0});Mbe.CreateEmbedJobRequestTruncate=void 0;Mbe.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var JJe=S(W4=>{"use strict";var WCn=W4&&W4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=W4&&W4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&WCn(e,t,r)};Object.defineProperty(W4,"__esModule",{value:!0});JCn(skt(),W4)});var KJe=S(ukt=>{"use strict";Object.defineProperty(ukt,"__esModule",{value:!0})});var lkt=S(J4=>{"use strict";var KCn=J4&&J4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=J4&&J4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KCn(e,t,r)};Object.defineProperty(J4,"__esModule",{value:!0});GCn(KJe(),J4)});var dkt=S(LF=>{"use strict";var XCn=LF&&LF.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ckt=LF&&LF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&XCn(e,t,r)};Object.defineProperty(LF,"__esModule",{value:!0});ckt(JJe(),LF);ckt(lkt(),LF)});var pkt=S(fkt=>{"use strict";Object.defineProperty(fkt,"__esModule",{value:!0})});var hkt=S(mkt=>{"use strict";Object.defineProperty(mkt,"__esModule",{value:!0})});var ykt=S(gkt=>{"use strict";Object.defineProperty(gkt,"__esModule",{value:!0})});var _kt=S(bkt=>{"use strict";Object.defineProperty(bkt,"__esModule",{value:!0})});var GJe=S(xO=>{"use strict";var ZCn=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]}),Rbe=xO&&xO.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ZCn(e,t,r)};Object.defineProperty(xO,"__esModule",{value:!0});Rbe(pkt(),xO);Rbe(hkt(),xO);Rbe(ykt(),xO);Rbe(_kt(),xO)});var XJe=S(vkt=>{"use strict";Object.defineProperty(vkt,"__esModule",{value:!0})});var wkt=S(K4=>{"use strict";var YCn=K4&&K4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QCn=K4&&K4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&YCn(e,t,r)};Object.defineProperty(K4,"__esModule",{value:!0});QCn(XJe(),K4)});var Ckt=S(FF=>{"use strict";var exn=FF&&FF.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Skt=FF&&FF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&exn(e,t,r)};Object.defineProperty(FF,"__esModule",{value:!0});Skt(GJe(),FF);Skt(wkt(),FF)});var xkt=S(Ibe=>{"use strict";Object.defineProperty(Ibe,"__esModule",{value:!0});Ibe.BaseType=void 0;Ibe.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var Tkt=S(Abe=>{"use strict";Object.defineProperty(Abe,"__esModule",{value:!0});Abe.Strategy=void 0;Abe.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var Ekt=S(Okt=>{"use strict";Object.defineProperty(Okt,"__esModule",{value:!0})});var Pkt=S(Nbe=>{"use strict";Object.defineProperty(Nbe,"__esModule",{value:!0});Nbe.LoraTargetModules=void 0;Nbe.LoraTargetModules={LoraTargetModulesUnspecified:"LORA_TARGET_MODULES_UNSPECIFIED",LoraTargetModulesQv:"LORA_TARGET_MODULES_QV",LoraTargetModulesQkvo:"LORA_TARGET_MODULES_QKVO",LoraTargetModulesQkvoFfn:"LORA_TARGET_MODULES_QKVO_FFN"}});var Rkt=S(Mkt=>{"use strict";Object.defineProperty(Mkt,"__esModule",{value:!0})});var Akt=S(Ikt=>{"use strict";Object.defineProperty(Ikt,"__esModule",{value:!0})});var Dkt=S(Nkt=>{"use strict";Object.defineProperty(Nkt,"__esModule",{value:!0})});var jkt=S(Dbe=>{"use strict";Object.defineProperty(Dbe,"__esModule",{value:!0});Dbe.Status=void 0;Dbe.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 Lkt=S($kt=>{"use strict";Object.defineProperty($kt,"__esModule",{value:!0})});var kkt=S(Fkt=>{"use strict";Object.defineProperty(Fkt,"__esModule",{value:!0})});var Bkt=S(qkt=>{"use strict";Object.defineProperty(qkt,"__esModule",{value:!0})});var zkt=S(Ukt=>{"use strict";Object.defineProperty(Ukt,"__esModule",{value:!0})});var Hkt=S(Vkt=>{"use strict";Object.defineProperty(Vkt,"__esModule",{value:!0})});var Jkt=S(Wkt=>{"use strict";Object.defineProperty(Wkt,"__esModule",{value:!0})});var Gkt=S(Kkt=>{"use strict";Object.defineProperty(Kkt,"__esModule",{value:!0})});var Zkt=S(Xkt=>{"use strict";Object.defineProperty(Xkt,"__esModule",{value:!0})});var Qkt=S(Ykt=>{"use strict";Object.defineProperty(Ykt,"__esModule",{value:!0})});var tqt=S(eqt=>{"use strict";Object.defineProperty(eqt,"__esModule",{value:!0})});var ZJe=S(Ul=>{"use strict";var txn=Ul&&Ul.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ph=Ul&&Ul.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&txn(e,t,r)};Object.defineProperty(Ul,"__esModule",{value:!0});Ph(xkt(),Ul);Ph(Tkt(),Ul);Ph(Ekt(),Ul);Ph(Pkt(),Ul);Ph(Rkt(),Ul);Ph(Akt(),Ul);Ph(Dkt(),Ul);Ph(jkt(),Ul);Ph(Lkt(),Ul);Ph(kkt(),Ul);Ph(Bkt(),Ul);Ph(zkt(),Ul);Ph(Hkt(),Ul);Ph(Jkt(),Ul);Ph(Gkt(),Ul);Ph(Zkt(),Ul);Ph(Qkt(),Ul);Ph(tqt(),Ul)});var rqt=S(G4=>{"use strict";var rxn=G4&&G4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nxn=G4&&G4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rxn(e,t,r)};Object.defineProperty(G4,"__esModule",{value:!0});nxn(ZJe(),G4)});var oqt=S(hw=>{"use strict";var nqt=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]}),oxn=hw&&hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ixn=hw&&hw.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nqt(r,e,n[o]);return oxn(r,e),r}}(),axn=hw&&hw.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nqt(e,t,r)};Object.defineProperty(hw,"__esModule",{value:!0});hw.finetuning=void 0;hw.finetuning=ixn(rqt());axn(ZJe(),hw)});var YJe=S(iqt=>{"use strict";Object.defineProperty(iqt,"__esModule",{value:!0})});var aqt=S(X4=>{"use strict";var sxn=X4&&X4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uxn=X4&&X4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sxn(e,t,r)};Object.defineProperty(X4,"__esModule",{value:!0});uxn(YJe(),X4)});var uqt=S(kF=>{"use strict";var lxn=kF&&kF.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sqt=kF&&kF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&lxn(e,t,r)};Object.defineProperty(kF,"__esModule",{value:!0});sqt(oqt(),kF);sqt(aqt(),kF)});var QJe=S(lqt=>{"use strict";Object.defineProperty(lqt,"__esModule",{value:!0})});var cqt=S(Z4=>{"use strict";var cxn=Z4&&Z4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dxn=Z4&&Z4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cxn(e,t,r)};Object.defineProperty(Z4,"__esModule",{value:!0});dxn(QJe(),Z4)});var dqt=S(Y4=>{"use strict";var fxn=Y4&&Y4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pxn=Y4&&Y4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fxn(e,t,r)};Object.defineProperty(Y4,"__esModule",{value:!0});pxn(cqt(),Y4)});var e5e=S(fqt=>{"use strict";Object.defineProperty(fqt,"__esModule",{value:!0})});var pqt=S(Q4=>{"use strict";var mxn=Q4&&Q4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hxn=Q4&&Q4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mxn(e,t,r)};Object.defineProperty(Q4,"__esModule",{value:!0});hxn(e5e(),Q4)});var mqt=S(e2=>{"use strict";var gxn=e2&&e2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yxn=e2&&e2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&gxn(e,t,r)};Object.defineProperty(e2,"__esModule",{value:!0});yxn(pqt(),e2)});var gqt=S(zs=>{"use strict";var hqt=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]}),bxn=zs&&zs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F5=zs&&zs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hqt(r,e,n[o]);return bxn(r,e),r}}(),O1=zs&&zs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hqt(e,t,r)};Object.defineProperty(zs,"__esModule",{value:!0});zs.models=zs.connectors=zs.finetuning=zs.datasets=zs.embedJobs=zs.v2=void 0;zs.v2=F5(akt());O1(HJe(),zs);zs.embedJobs=F5(dkt());O1(JJe(),zs);zs.datasets=F5(Ckt());O1(GJe(),zs);zs.finetuning=F5(uqt());zs.connectors=F5(dqt());zs.models=F5(mqt());O1(WJe(),zs);O1(KJe(),zs);O1(XJe(),zs);O1(QJe(),zs);O1(e5e(),zs);O1(YJe(),zs)});var yqt=S(jbe=>{"use strict";Object.defineProperty(jbe,"__esModule",{value:!0});jbe.ChatStreamRequestPromptTruncation=void 0;jbe.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var bqt=S($be=>{"use strict";Object.defineProperty($be,"__esModule",{value:!0});$be.ChatStreamRequestCitationQuality=void 0;$be.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var _qt=S(Lbe=>{"use strict";Object.defineProperty(Lbe,"__esModule",{value:!0});Lbe.ChatStreamRequestSafetyMode=void 0;Lbe.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var wqt=S(vqt=>{"use strict";Object.defineProperty(vqt,"__esModule",{value:!0})});var Sqt=S(Fbe=>{"use strict";Object.defineProperty(Fbe,"__esModule",{value:!0});Fbe.ChatRequestPromptTruncation=void 0;Fbe.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var Cqt=S(kbe=>{"use strict";Object.defineProperty(kbe,"__esModule",{value:!0});kbe.ChatRequestCitationQuality=void 0;kbe.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var xqt=S(qbe=>{"use strict";Object.defineProperty(qbe,"__esModule",{value:!0});qbe.ChatRequestSafetyMode=void 0;qbe.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var Oqt=S(Tqt=>{"use strict";Object.defineProperty(Tqt,"__esModule",{value:!0})});var Eqt=S(Bbe=>{"use strict";Object.defineProperty(Bbe,"__esModule",{value:!0});Bbe.GenerateStreamRequestTruncate=void 0;Bbe.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var Pqt=S(Ube=>{"use strict";Object.defineProperty(Ube,"__esModule",{value:!0});Ube.GenerateStreamRequestReturnLikelihoods=void 0;Ube.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var Rqt=S(Mqt=>{"use strict";Object.defineProperty(Mqt,"__esModule",{value:!0})});var Iqt=S(zbe=>{"use strict";Object.defineProperty(zbe,"__esModule",{value:!0});zbe.GenerateRequestTruncate=void 0;zbe.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var Aqt=S(Vbe=>{"use strict";Object.defineProperty(Vbe,"__esModule",{value:!0});Vbe.GenerateRequestReturnLikelihoods=void 0;Vbe.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var Dqt=S(Nqt=>{"use strict";Object.defineProperty(Nqt,"__esModule",{value:!0})});var jqt=S(Hbe=>{"use strict";Object.defineProperty(Hbe,"__esModule",{value:!0});Hbe.EmbedRequestTruncate=void 0;Hbe.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var Lqt=S($qt=>{"use strict";Object.defineProperty($qt,"__esModule",{value:!0})});var kqt=S(Fqt=>{"use strict";Object.defineProperty(Fqt,"__esModule",{value:!0})});var Bqt=S(qqt=>{"use strict";Object.defineProperty(qqt,"__esModule",{value:!0})});var zqt=S(Uqt=>{"use strict";Object.defineProperty(Uqt,"__esModule",{value:!0})});var Hqt=S(Vqt=>{"use strict";Object.defineProperty(Vqt,"__esModule",{value:!0})});var Wqt=S(Wbe=>{"use strict";Object.defineProperty(Wbe,"__esModule",{value:!0});Wbe.ClassifyRequestTruncate=void 0;Wbe.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var Kqt=S(Jqt=>{"use strict";Object.defineProperty(Jqt,"__esModule",{value:!0})});var Gqt=S(Jbe=>{"use strict";Object.defineProperty(Jbe,"__esModule",{value:!0});Jbe.ClassifyResponseClassificationsItemClassificationType=void 0;Jbe.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var Zqt=S(Xqt=>{"use strict";Object.defineProperty(Xqt,"__esModule",{value:!0})});var Qqt=S(Yqt=>{"use strict";Object.defineProperty(Yqt,"__esModule",{value:!0})});var eBt=S(Kbe=>{"use strict";Object.defineProperty(Kbe,"__esModule",{value:!0});Kbe.SummarizeRequestLength=void 0;Kbe.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var tBt=S(Gbe=>{"use strict";Object.defineProperty(Gbe,"__esModule",{value:!0});Gbe.SummarizeRequestFormat=void 0;Gbe.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var rBt=S(Xbe=>{"use strict";Object.defineProperty(Xbe,"__esModule",{value:!0});Xbe.SummarizeRequestExtractiveness=void 0;Xbe.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var oBt=S(nBt=>{"use strict";Object.defineProperty(nBt,"__esModule",{value:!0})});var aBt=S(iBt=>{"use strict";Object.defineProperty(iBt,"__esModule",{value:!0})});var uBt=S(sBt=>{"use strict";Object.defineProperty(sBt,"__esModule",{value:!0})});var cBt=S(lBt=>{"use strict";Object.defineProperty(lBt,"__esModule",{value:!0})});var fBt=S(dBt=>{"use strict";Object.defineProperty(dBt,"__esModule",{value:!0})});var mBt=S(pBt=>{"use strict";Object.defineProperty(pBt,"__esModule",{value:!0})});var gBt=S(hBt=>{"use strict";Object.defineProperty(hBt,"__esModule",{value:!0})});var bBt=S(yBt=>{"use strict";Object.defineProperty(yBt,"__esModule",{value:!0})});var vBt=S(_Bt=>{"use strict";Object.defineProperty(_Bt,"__esModule",{value:!0})});var SBt=S(wBt=>{"use strict";Object.defineProperty(wBt,"__esModule",{value:!0})});var xBt=S(CBt=>{"use strict";Object.defineProperty(CBt,"__esModule",{value:!0})});var OBt=S(TBt=>{"use strict";Object.defineProperty(TBt,"__esModule",{value:!0})});var PBt=S(EBt=>{"use strict";Object.defineProperty(EBt,"__esModule",{value:!0})});var RBt=S(MBt=>{"use strict";Object.defineProperty(MBt,"__esModule",{value:!0})});var ABt=S(IBt=>{"use strict";Object.defineProperty(IBt,"__esModule",{value:!0})});var DBt=S(NBt=>{"use strict";Object.defineProperty(NBt,"__esModule",{value:!0})});var jBt=S(Zbe=>{"use strict";Object.defineProperty(Zbe,"__esModule",{value:!0});Zbe.ChatCitationType=void 0;Zbe.ChatCitationType={TextContent:"TEXT_CONTENT",Plan:"PLAN"}});var LBt=S($Bt=>{"use strict";Object.defineProperty($Bt,"__esModule",{value:!0})});var kBt=S(FBt=>{"use strict";Object.defineProperty(FBt,"__esModule",{value:!0})});var BBt=S(qBt=>{"use strict";Object.defineProperty(qBt,"__esModule",{value:!0})});var zBt=S(UBt=>{"use strict";Object.defineProperty(UBt,"__esModule",{value:!0})});var VBt=S(Ybe=>{"use strict";Object.defineProperty(Ybe,"__esModule",{value:!0});Ybe.FinishReason=void 0;Ybe.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var WBt=S(HBt=>{"use strict";Object.defineProperty(HBt,"__esModule",{value:!0})});var KBt=S(JBt=>{"use strict";Object.defineProperty(JBt,"__esModule",{value:!0})});var XBt=S(GBt=>{"use strict";Object.defineProperty(GBt,"__esModule",{value:!0})});var YBt=S(ZBt=>{"use strict";Object.defineProperty(ZBt,"__esModule",{value:!0})});var eUt=S(QBt=>{"use strict";Object.defineProperty(QBt,"__esModule",{value:!0})});var rUt=S(tUt=>{"use strict";Object.defineProperty(tUt,"__esModule",{value:!0})});var oUt=S(nUt=>{"use strict";Object.defineProperty(nUt,"__esModule",{value:!0})});var aUt=S(iUt=>{"use strict";Object.defineProperty(iUt,"__esModule",{value:!0})});var uUt=S(sUt=>{"use strict";Object.defineProperty(sUt,"__esModule",{value:!0})});var cUt=S(lUt=>{"use strict";Object.defineProperty(lUt,"__esModule",{value:!0})});var fUt=S(dUt=>{"use strict";Object.defineProperty(dUt,"__esModule",{value:!0})});var pUt=S(Qbe=>{"use strict";Object.defineProperty(Qbe,"__esModule",{value:!0});Qbe.ChatStreamEndEventFinishReason=void 0;Qbe.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});var hUt=S(mUt=>{"use strict";Object.defineProperty(mUt,"__esModule",{value:!0})});var yUt=S(gUt=>{"use strict";Object.defineProperty(gUt,"__esModule",{value:!0})});var _Ut=S(bUt=>{"use strict";Object.defineProperty(bUt,"__esModule",{value:!0})});var wUt=S(vUt=>{"use strict";Object.defineProperty(vUt,"__esModule",{value:!0})});var CUt=S(SUt=>{"use strict";Object.defineProperty(SUt,"__esModule",{value:!0})});var xUt=S(e_e=>{"use strict";Object.defineProperty(e_e,"__esModule",{value:!0});e_e.ImageUrlDetail=void 0;e_e.ImageUrlDetail={Auto:"auto",Low:"low",High:"high"}});var OUt=S(TUt=>{"use strict";Object.defineProperty(TUt,"__esModule",{value:!0})});var PUt=S(EUt=>{"use strict";Object.defineProperty(EUt,"__esModule",{value:!0})});var RUt=S(MUt=>{"use strict";Object.defineProperty(MUt,"__esModule",{value:!0})});var AUt=S(IUt=>{"use strict";Object.defineProperty(IUt,"__esModule",{value:!0})});var DUt=S(NUt=>{"use strict";Object.defineProperty(NUt,"__esModule",{value:!0})});var $Ut=S(jUt=>{"use strict";Object.defineProperty(jUt,"__esModule",{value:!0})});var FUt=S(LUt=>{"use strict";Object.defineProperty(LUt,"__esModule",{value:!0})});var qUt=S(kUt=>{"use strict";Object.defineProperty(kUt,"__esModule",{value:!0})});var UUt=S(BUt=>{"use strict";Object.defineProperty(BUt,"__esModule",{value:!0})});var VUt=S(zUt=>{"use strict";Object.defineProperty(zUt,"__esModule",{value:!0})});var WUt=S(HUt=>{"use strict";Object.defineProperty(HUt,"__esModule",{value:!0})});var JUt=S(t_e=>{"use strict";Object.defineProperty(t_e,"__esModule",{value:!0});t_e.CitationType=void 0;t_e.CitationType={TextContent:"TEXT_CONTENT",ThinkingContent:"THINKING_CONTENT",Plan:"PLAN"}});var GUt=S(KUt=>{"use strict";Object.defineProperty(KUt,"__esModule",{value:!0})});var ZUt=S(XUt=>{"use strict";Object.defineProperty(XUt,"__esModule",{value:!0})});var QUt=S(YUt=>{"use strict";Object.defineProperty(YUt,"__esModule",{value:!0})});var tzt=S(ezt=>{"use strict";Object.defineProperty(ezt,"__esModule",{value:!0})});var nzt=S(rzt=>{"use strict";Object.defineProperty(rzt,"__esModule",{value:!0})});var izt=S(ozt=>{"use strict";Object.defineProperty(ozt,"__esModule",{value:!0})});var szt=S(azt=>{"use strict";Object.defineProperty(azt,"__esModule",{value:!0})});var lzt=S(uzt=>{"use strict";Object.defineProperty(uzt,"__esModule",{value:!0})});var dzt=S(czt=>{"use strict";Object.defineProperty(czt,"__esModule",{value:!0})});var pzt=S(fzt=>{"use strict";Object.defineProperty(fzt,"__esModule",{value:!0})});var hzt=S(mzt=>{"use strict";Object.defineProperty(mzt,"__esModule",{value:!0})});var yzt=S(gzt=>{"use strict";Object.defineProperty(gzt,"__esModule",{value:!0})});var _zt=S(bzt=>{"use strict";Object.defineProperty(bzt,"__esModule",{value:!0})});var wzt=S(vzt=>{"use strict";Object.defineProperty(vzt,"__esModule",{value:!0})});var Czt=S(Szt=>{"use strict";Object.defineProperty(Szt,"__esModule",{value:!0})});var Tzt=S(xzt=>{"use strict";Object.defineProperty(xzt,"__esModule",{value:!0})});var Ozt=S(r_e=>{"use strict";Object.defineProperty(r_e,"__esModule",{value:!0});r_e.CitationOptionsMode=void 0;r_e.CitationOptionsMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var Pzt=S(Ezt=>{"use strict";Object.defineProperty(Ezt,"__esModule",{value:!0})});var Rzt=S(Mzt=>{"use strict";Object.defineProperty(Mzt,"__esModule",{value:!0})});var Azt=S(Izt=>{"use strict";Object.defineProperty(Izt,"__esModule",{value:!0})});var Dzt=S(Nzt=>{"use strict";Object.defineProperty(Nzt,"__esModule",{value:!0})});var jzt=S(n_e=>{"use strict";Object.defineProperty(n_e,"__esModule",{value:!0});n_e.ThinkingType=void 0;n_e.ThinkingType={Enabled:"enabled",Disabled:"disabled"}});var Lzt=S($zt=>{"use strict";Object.defineProperty($zt,"__esModule",{value:!0})});var Fzt=S(o_e=>{"use strict";Object.defineProperty(o_e,"__esModule",{value:!0});o_e.ChatFinishReason=void 0;o_e.ChatFinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",MaxTokens:"MAX_TOKENS",ToolCall:"TOOL_CALL",Error:"ERROR"}});var qzt=S(kzt=>{"use strict";Object.defineProperty(kzt,"__esModule",{value:!0})});var Uzt=S(Bzt=>{"use strict";Object.defineProperty(Bzt,"__esModule",{value:!0})});var Vzt=S(zzt=>{"use strict";Object.defineProperty(zzt,"__esModule",{value:!0})});var Wzt=S(Hzt=>{"use strict";Object.defineProperty(Hzt,"__esModule",{value:!0})});var Kzt=S(Jzt=>{"use strict";Object.defineProperty(Jzt,"__esModule",{value:!0})});var Xzt=S(Gzt=>{"use strict";Object.defineProperty(Gzt,"__esModule",{value:!0})});var Yzt=S(Zzt=>{"use strict";Object.defineProperty(Zzt,"__esModule",{value:!0})});var e4t=S(Qzt=>{"use strict";Object.defineProperty(Qzt,"__esModule",{value:!0})});var r4t=S(t4t=>{"use strict";Object.defineProperty(t4t,"__esModule",{value:!0})});var o4t=S(n4t=>{"use strict";Object.defineProperty(n4t,"__esModule",{value:!0})});var i4t=S(i_e=>{"use strict";Object.defineProperty(i_e,"__esModule",{value:!0});i_e.ChatContentStartEventDeltaMessageContentType=void 0;i_e.ChatContentStartEventDeltaMessageContentType={Text:"text",Thinking:"thinking"}});var s4t=S(a4t=>{"use strict";Object.defineProperty(a4t,"__esModule",{value:!0})});var l4t=S(u4t=>{"use strict";Object.defineProperty(u4t,"__esModule",{value:!0})});var d4t=S(c4t=>{"use strict";Object.defineProperty(c4t,"__esModule",{value:!0})});var p4t=S(f4t=>{"use strict";Object.defineProperty(f4t,"__esModule",{value:!0})});var h4t=S(m4t=>{"use strict";Object.defineProperty(m4t,"__esModule",{value:!0})});var y4t=S(g4t=>{"use strict";Object.defineProperty(g4t,"__esModule",{value:!0})});var _4t=S(b4t=>{"use strict";Object.defineProperty(b4t,"__esModule",{value:!0})});var w4t=S(v4t=>{"use strict";Object.defineProperty(v4t,"__esModule",{value:!0})});var C4t=S(S4t=>{"use strict";Object.defineProperty(S4t,"__esModule",{value:!0})});var T4t=S(x4t=>{"use strict";Object.defineProperty(x4t,"__esModule",{value:!0})});var E4t=S(O4t=>{"use strict";Object.defineProperty(O4t,"__esModule",{value:!0})});var M4t=S(P4t=>{"use strict";Object.defineProperty(P4t,"__esModule",{value:!0})});var I4t=S(R4t=>{"use strict";Object.defineProperty(R4t,"__esModule",{value:!0})});var N4t=S(A4t=>{"use strict";Object.defineProperty(A4t,"__esModule",{value:!0})});var j4t=S(D4t=>{"use strict";Object.defineProperty(D4t,"__esModule",{value:!0})});var L4t=S($4t=>{"use strict";Object.defineProperty($4t,"__esModule",{value:!0})});var k4t=S(F4t=>{"use strict";Object.defineProperty(F4t,"__esModule",{value:!0})});var B4t=S(q4t=>{"use strict";Object.defineProperty(q4t,"__esModule",{value:!0})});var z4t=S(U4t=>{"use strict";Object.defineProperty(U4t,"__esModule",{value:!0})});var H4t=S(V4t=>{"use strict";Object.defineProperty(V4t,"__esModule",{value:!0})});var J4t=S(W4t=>{"use strict";Object.defineProperty(W4t,"__esModule",{value:!0})});var G4t=S(K4t=>{"use strict";Object.defineProperty(K4t,"__esModule",{value:!0})});var Z4t=S(X4t=>{"use strict";Object.defineProperty(X4t,"__esModule",{value:!0})});var Q4t=S(Y4t=>{"use strict";Object.defineProperty(Y4t,"__esModule",{value:!0})});var t2t=S(e2t=>{"use strict";Object.defineProperty(e2t,"__esModule",{value:!0})});var n2t=S(r2t=>{"use strict";Object.defineProperty(r2t,"__esModule",{value:!0})});var i2t=S(o2t=>{"use strict";Object.defineProperty(o2t,"__esModule",{value:!0})});var s2t=S(a2t=>{"use strict";Object.defineProperty(a2t,"__esModule",{value:!0})});var l2t=S(u2t=>{"use strict";Object.defineProperty(u2t,"__esModule",{value:!0})});var d2t=S(c2t=>{"use strict";Object.defineProperty(c2t,"__esModule",{value:!0})});var p2t=S(f2t=>{"use strict";Object.defineProperty(f2t,"__esModule",{value:!0})});var h2t=S(m2t=>{"use strict";Object.defineProperty(m2t,"__esModule",{value:!0})});var y2t=S(g2t=>{"use strict";Object.defineProperty(g2t,"__esModule",{value:!0})});var _2t=S(b2t=>{"use strict";Object.defineProperty(b2t,"__esModule",{value:!0})});var w2t=S(v2t=>{"use strict";Object.defineProperty(v2t,"__esModule",{value:!0})});var S2t=S(a_e=>{"use strict";Object.defineProperty(a_e,"__esModule",{value:!0});a_e.EmbedInputType=void 0;a_e.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering",Image:"image"}});var C2t=S(s_e=>{"use strict";Object.defineProperty(s_e,"__esModule",{value:!0});s_e.EmbeddingType=void 0;s_e.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary",Base64:"base64"}});var T2t=S(x2t=>{"use strict";Object.defineProperty(x2t,"__esModule",{value:!0})});var E2t=S(O2t=>{"use strict";Object.defineProperty(O2t,"__esModule",{value:!0})});var M2t=S(P2t=>{"use strict";Object.defineProperty(P2t,"__esModule",{value:!0})});var I2t=S(R2t=>{"use strict";Object.defineProperty(R2t,"__esModule",{value:!0})});var N2t=S(A2t=>{"use strict";Object.defineProperty(A2t,"__esModule",{value:!0})});var j2t=S(D2t=>{"use strict";Object.defineProperty(D2t,"__esModule",{value:!0})});var L2t=S($2t=>{"use strict";Object.defineProperty($2t,"__esModule",{value:!0})});var k2t=S(F2t=>{"use strict";Object.defineProperty(F2t,"__esModule",{value:!0})});var B2t=S(q2t=>{"use strict";Object.defineProperty(q2t,"__esModule",{value:!0})});var U2t=S(u_e=>{"use strict";Object.defineProperty(u_e,"__esModule",{value:!0});u_e.EmbedJobStatus=void 0;u_e.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var z2t=S(l_e=>{"use strict";Object.defineProperty(l_e,"__esModule",{value:!0});l_e.EmbedJobTruncate=void 0;l_e.EmbedJobTruncate={Start:"START",End:"END"}});var H2t=S(V2t=>{"use strict";Object.defineProperty(V2t,"__esModule",{value:!0})});var J2t=S(W2t=>{"use strict";Object.defineProperty(W2t,"__esModule",{value:!0})});var G2t=S(K2t=>{"use strict";Object.defineProperty(K2t,"__esModule",{value:!0})});var Z2t=S(X2t=>{"use strict";Object.defineProperty(X2t,"__esModule",{value:!0})});var Q2t=S(Y2t=>{"use strict";Object.defineProperty(Y2t,"__esModule",{value:!0})});var eVt=S(c_e=>{"use strict";Object.defineProperty(c_e,"__esModule",{value:!0});c_e.DatasetValidationStatus=void 0;c_e.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var tVt=S(d_e=>{"use strict";Object.defineProperty(d_e,"__esModule",{value:!0});d_e.DatasetType=void 0;d_e.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 nVt=S(rVt=>{"use strict";Object.defineProperty(rVt,"__esModule",{value:!0})});var iVt=S(oVt=>{"use strict";Object.defineProperty(oVt,"__esModule",{value:!0})});var sVt=S(aVt=>{"use strict";Object.defineProperty(aVt,"__esModule",{value:!0})});var lVt=S(uVt=>{"use strict";Object.defineProperty(uVt,"__esModule",{value:!0})});var dVt=S(cVt=>{"use strict";Object.defineProperty(cVt,"__esModule",{value:!0})});var pVt=S(fVt=>{"use strict";Object.defineProperty(fVt,"__esModule",{value:!0})});var hVt=S(mVt=>{"use strict";Object.defineProperty(mVt,"__esModule",{value:!0})});var yVt=S(gVt=>{"use strict";Object.defineProperty(gVt,"__esModule",{value:!0})});var _Vt=S(bVt=>{"use strict";Object.defineProperty(bVt,"__esModule",{value:!0})});var wVt=S(vVt=>{"use strict";Object.defineProperty(vVt,"__esModule",{value:!0})});var SVt=S(f_e=>{"use strict";Object.defineProperty(f_e,"__esModule",{value:!0});f_e.ConnectorAuthStatus=void 0;f_e.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var xVt=S(CVt=>{"use strict";Object.defineProperty(CVt,"__esModule",{value:!0})});var OVt=S(TVt=>{"use strict";Object.defineProperty(TVt,"__esModule",{value:!0})});var PVt=S(EVt=>{"use strict";Object.defineProperty(EVt,"__esModule",{value:!0})});var MVt=S(p_e=>{"use strict";Object.defineProperty(p_e,"__esModule",{value:!0});p_e.AuthTokenType=void 0;p_e.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var IVt=S(RVt=>{"use strict";Object.defineProperty(RVt,"__esModule",{value:!0})});var NVt=S(AVt=>{"use strict";Object.defineProperty(AVt,"__esModule",{value:!0})});var jVt=S(DVt=>{"use strict";Object.defineProperty(DVt,"__esModule",{value:!0})});var LVt=S($Vt=>{"use strict";Object.defineProperty($Vt,"__esModule",{value:!0})});var kVt=S(FVt=>{"use strict";Object.defineProperty(FVt,"__esModule",{value:!0})});var BVt=S(qVt=>{"use strict";Object.defineProperty(qVt,"__esModule",{value:!0})});var UVt=S(m_e=>{"use strict";Object.defineProperty(m_e,"__esModule",{value:!0});m_e.CompatibleEndpoint=void 0;m_e.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var VVt=S(zVt=>{"use strict";Object.defineProperty(zVt,"__esModule",{value:!0})});var WVt=S(HVt=>{"use strict";Object.defineProperty(HVt,"__esModule",{value:!0})});var JVt=S(he=>{"use strict";var _xn=he&&he.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_e=he&&he.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_xn(e,t,r)};Object.defineProperty(he,"__esModule",{value:!0});_e(yqt(),he);_e(bqt(),he);_e(_qt(),he);_e(wqt(),he);_e(Sqt(),he);_e(Cqt(),he);_e(xqt(),he);_e(Oqt(),he);_e(Eqt(),he);_e(Pqt(),he);_e(Rqt(),he);_e(Iqt(),he);_e(Aqt(),he);_e(Dqt(),he);_e(jqt(),he);_e(Lqt(),he);_e(kqt(),he);_e(Bqt(),he);_e(zqt(),he);_e(Hqt(),he);_e(Wqt(),he);_e(Kqt(),he);_e(Gqt(),he);_e(Zqt(),he);_e(Qqt(),he);_e(eBt(),he);_e(tBt(),he);_e(rBt(),he);_e(oBt(),he);_e(aBt(),he);_e(uBt(),he);_e(cBt(),he);_e(fBt(),he);_e(mBt(),he);_e(gBt(),he);_e(bBt(),he);_e(vBt(),he);_e(SBt(),he);_e(xBt(),he);_e(OBt(),he);_e(PBt(),he);_e(RBt(),he);_e(ABt(),he);_e(DBt(),he);_e(jBt(),he);_e(LBt(),he);_e(kBt(),he);_e(BBt(),he);_e(zBt(),he);_e(VBt(),he);_e(WBt(),he);_e(KBt(),he);_e(XBt(),he);_e(YBt(),he);_e(eUt(),he);_e(rUt(),he);_e(oUt(),he);_e(aUt(),he);_e(uUt(),he);_e(cUt(),he);_e(fUt(),he);_e(pUt(),he);_e(hUt(),he);_e(yUt(),he);_e(_Ut(),he);_e(wUt(),he);_e(CUt(),he);_e(xUt(),he);_e(OUt(),he);_e(PUt(),he);_e(RUt(),he);_e(AUt(),he);_e(DUt(),he);_e($Ut(),he);_e(FUt(),he);_e(qUt(),he);_e(UUt(),he);_e(VUt(),he);_e(WUt(),he);_e(JUt(),he);_e(GUt(),he);_e(ZUt(),he);_e(QUt(),he);_e(tzt(),he);_e(nzt(),he);_e(izt(),he);_e(szt(),he);_e(lzt(),he);_e(dzt(),he);_e(pzt(),he);_e(hzt(),he);_e(yzt(),he);_e(_zt(),he);_e(wzt(),he);_e(Czt(),he);_e(Tzt(),he);_e(Ozt(),he);_e(Pzt(),he);_e(Rzt(),he);_e(Azt(),he);_e(Dzt(),he);_e(jzt(),he);_e(Lzt(),he);_e(Fzt(),he);_e(qzt(),he);_e(Uzt(),he);_e(Vzt(),he);_e(Wzt(),he);_e(Kzt(),he);_e(Xzt(),he);_e(Yzt(),he);_e(e4t(),he);_e(r4t(),he);_e(o4t(),he);_e(i4t(),he);_e(s4t(),he);_e(l4t(),he);_e(d4t(),he);_e(p4t(),he);_e(h4t(),he);_e(y4t(),he);_e(_4t(),he);_e(w4t(),he);_e(C4t(),he);_e(T4t(),he);_e(E4t(),he);_e(M4t(),he);_e(I4t(),he);_e(N4t(),he);_e(j4t(),he);_e(L4t(),he);_e(k4t(),he);_e(B4t(),he);_e(z4t(),he);_e(H4t(),he);_e(J4t(),he);_e(G4t(),he);_e(Z4t(),he);_e(Q4t(),he);_e(t2t(),he);_e(n2t(),he);_e(i2t(),he);_e(s2t(),he);_e(l2t(),he);_e(d2t(),he);_e(p2t(),he);_e(h2t(),he);_e(y2t(),he);_e(_2t(),he);_e(w2t(),he);_e(S2t(),he);_e(C2t(),he);_e(T2t(),he);_e(E2t(),he);_e(M2t(),he);_e(I2t(),he);_e(N2t(),he);_e(j2t(),he);_e(L2t(),he);_e(k2t(),he);_e(B2t(),he);_e(U2t(),he);_e(z2t(),he);_e(H2t(),he);_e(J2t(),he);_e(G2t(),he);_e(Z2t(),he);_e(Q2t(),he);_e(eVt(),he);_e(tVt(),he);_e(nVt(),he);_e(iVt(),he);_e(sVt(),he);_e(lVt(),he);_e(dVt(),he);_e(pVt(),he);_e(hVt(),he);_e(yVt(),he);_e(_Vt(),he);_e(wVt(),he);_e(SVt(),he);_e(xVt(),he);_e(OVt(),he);_e(PVt(),he);_e(MVt(),he);_e(IVt(),he);_e(NVt(),he);_e(jVt(),he);_e(LVt(),he);_e(kVt(),he);_e(BVt(),he);_e(UVt(),he);_e(VVt(),he);_e(WVt(),he)});var h_e=S(Jre=>{"use strict";Object.defineProperty(Jre,"__esModule",{value:!0});Jre.toJson=void 0;Jre.fromJson=wxn;var vxn=(t,e,r)=>JSON.stringify(t,e,r);Jre.toJson=vxn;function wxn(t,e){return JSON.parse(t,e)}});var KVt=S(g_e=>{"use strict";Object.defineProperty(g_e,"__esModule",{value:!0});g_e.CohereError=void 0;var Sxn=h_e(),t5e=class t extends Error{constructor({message:e,statusCode:r,body:n,rawResponse:o}){super(Cxn({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,t.prototype),this.statusCode=r,this.body=n,this.rawResponse=o}};g_e.CohereError=t5e;function Cxn({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: ${(0,Sxn.toJson)(r,void 0,2)}`),n.join(`
`)}});var GVt=S(y_e=>{"use strict";Object.defineProperty(y_e,"__esModule",{value:!0});y_e.CohereTimeoutError=void 0;var r5e=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};y_e.CohereTimeoutError=r5e});var $c=S(k5=>{"use strict";Object.defineProperty(k5,"__esModule",{value:!0});k5.CohereTimeoutError=k5.CohereError=void 0;var xxn=KVt();Object.defineProperty(k5,"CohereError",{enumerable:!0,get:function(){return xxn.CohereError}});var Txn=GVt();Object.defineProperty(k5,"CohereTimeoutError",{enumerable:!0,get:function(){return Txn.CohereTimeoutError}})});var XVt=S(TO=>{"use strict";var Oxn=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]}),Exn=TO&&TO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pxn=TO&&TO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Oxn(r,e,n[o]);return Exn(r,e),r}}();Object.defineProperty(TO,"__esModule",{value:!0});TO.BadRequestError=void 0;var Mxn=Pxn($c()),n5e=class t extends Mxn.CohereError{constructor(e,r){super({message:"BadRequestError",statusCode:400,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};TO.BadRequestError=n5e});var ZVt=S(OO=>{"use strict";var Rxn=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]}),Ixn=OO&&OO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Axn=OO&&OO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Rxn(r,e,n[o]);return Ixn(r,e),r}}();Object.defineProperty(OO,"__esModule",{value:!0});OO.UnauthorizedError=void 0;var Nxn=Axn($c()),o5e=class t extends Nxn.CohereError{constructor(e,r){super({message:"UnauthorizedError",statusCode:401,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};OO.UnauthorizedError=o5e});var YVt=S(EO=>{"use strict";var Dxn=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]}),jxn=EO&&EO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$xn=EO&&EO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Dxn(r,e,n[o]);return jxn(r,e),r}}();Object.defineProperty(EO,"__esModule",{value:!0});EO.ForbiddenError=void 0;var Lxn=$xn($c()),i5e=class t extends Lxn.CohereError{constructor(e,r){super({message:"ForbiddenError",statusCode:403,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};EO.ForbiddenError=i5e});var QVt=S(PO=>{"use strict";var Fxn=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]}),kxn=PO&&PO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qxn=PO&&PO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Fxn(r,e,n[o]);return kxn(r,e),r}}();Object.defineProperty(PO,"__esModule",{value:!0});PO.NotFoundError=void 0;var Bxn=qxn($c()),a5e=class t extends Bxn.CohereError{constructor(e,r){super({message:"NotFoundError",statusCode:404,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};PO.NotFoundError=a5e});var eHt=S(MO=>{"use strict";var Uxn=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]}),zxn=MO&&MO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vxn=MO&&MO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Uxn(r,e,n[o]);return zxn(r,e),r}}();Object.defineProperty(MO,"__esModule",{value:!0});MO.UnprocessableEntityError=void 0;var Hxn=Vxn($c()),s5e=class t extends Hxn.CohereError{constructor(e,r){super({message:"UnprocessableEntityError",statusCode:422,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};MO.UnprocessableEntityError=s5e});var tHt=S(RO=>{"use strict";var Wxn=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]}),Jxn=RO&&RO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kxn=RO&&RO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Wxn(r,e,n[o]);return Jxn(r,e),r}}();Object.defineProperty(RO,"__esModule",{value:!0});RO.TooManyRequestsError=void 0;var Gxn=Kxn($c()),u5e=class t extends Gxn.CohereError{constructor(e,r){super({message:"TooManyRequestsError",statusCode:429,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};RO.TooManyRequestsError=u5e});var rHt=S(IO=>{"use strict";var Xxn=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]}),Zxn=IO&&IO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yxn=IO&&IO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Xxn(r,e,n[o]);return Zxn(r,e),r}}();Object.defineProperty(IO,"__esModule",{value:!0});IO.InvalidTokenError=void 0;var Qxn=Yxn($c()),l5e=class t extends Qxn.CohereError{constructor(e,r){super({message:"InvalidTokenError",statusCode:498,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};IO.InvalidTokenError=l5e});var nHt=S(AO=>{"use strict";var eTn=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]}),tTn=AO&&AO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rTn=AO&&AO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eTn(r,e,n[o]);return tTn(r,e),r}}();Object.defineProperty(AO,"__esModule",{value:!0});AO.ClientClosedRequestError=void 0;var nTn=rTn($c()),c5e=class t extends nTn.CohereError{constructor(e,r){super({message:"ClientClosedRequestError",statusCode:499,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};AO.ClientClosedRequestError=c5e});var oHt=S(NO=>{"use strict";var oTn=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]}),iTn=NO&&NO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aTn=NO&&NO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&oTn(r,e,n[o]);return iTn(r,e),r}}();Object.defineProperty(NO,"__esModule",{value:!0});NO.InternalServerError=void 0;var sTn=aTn($c()),d5e=class t extends sTn.CohereError{constructor(e,r){super({message:"InternalServerError",statusCode:500,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};NO.InternalServerError=d5e});var iHt=S(DO=>{"use strict";var uTn=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]}),lTn=DO&&DO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cTn=DO&&DO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&uTn(r,e,n[o]);return lTn(r,e),r}}();Object.defineProperty(DO,"__esModule",{value:!0});DO.NotImplementedError=void 0;var dTn=cTn($c()),f5e=class t extends dTn.CohereError{constructor(e,r){super({message:"NotImplementedError",statusCode:501,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};DO.NotImplementedError=f5e});var aHt=S(jO=>{"use strict";var fTn=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]}),pTn=jO&&jO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mTn=jO&&jO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fTn(r,e,n[o]);return pTn(r,e),r}}();Object.defineProperty(jO,"__esModule",{value:!0});jO.ServiceUnavailableError=void 0;var hTn=mTn($c()),p5e=class t extends hTn.CohereError{constructor(e,r){super({message:"ServiceUnavailableError",statusCode:503,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};jO.ServiceUnavailableError=p5e});var sHt=S($O=>{"use strict";var gTn=$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]}),yTn=$O&&$O.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bTn=$O&&$O.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gTn(r,e,n[o]);return yTn(r,e),r}}();Object.defineProperty($O,"__esModule",{value:!0});$O.GatewayTimeoutError=void 0;var _Tn=bTn($c()),m5e=class t extends _Tn.CohereError{constructor(e,r){super({message:"GatewayTimeoutError",statusCode:504,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};$O.GatewayTimeoutError=m5e});var uHt=S(Mh=>{"use strict";var vTn=Mh&&Mh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BS=Mh&&Mh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vTn(e,t,r)};Object.defineProperty(Mh,"__esModule",{value:!0});BS(XVt(),Mh);BS(ZVt(),Mh);BS(YVt(),Mh);BS(QVt(),Mh);BS(eHt(),Mh);BS(tHt(),Mh);BS(rHt(),Mh);BS(nHt(),Mh);BS(oHt(),Mh);BS(iHt(),Mh);BS(aHt(),Mh);BS(sHt(),Mh)});var cHt=S(lHt=>{"use strict";Object.defineProperty(lHt,"__esModule",{value:!0})});var dHt=S(t2=>{"use strict";var wTn=t2&&t2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),STn=t2&&t2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&wTn(e,t,r)};Object.defineProperty(t2,"__esModule",{value:!0});STn(cHt(),t2)});var E1=S(LO=>{"use strict";var CTn=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]}),b_e=LO&&LO.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&CTn(e,t,r)};Object.defineProperty(LO,"__esModule",{value:!0});b_e(gqt(),LO);b_e(JVt(),LO);b_e(uHt(),LO);b_e(dHt(),LO)});var y5e={};En(y5e,{__addDisposableResource:()=>AHt,__assign:()=>__e,__asyncDelegator:()=>xHt,__asyncGenerator:()=>CHt,__asyncValues:()=>THt,__await:()=>q5,__awaiter:()=>yHt,__classPrivateFieldGet:()=>MHt,__classPrivateFieldIn:()=>IHt,__classPrivateFieldSet:()=>RHt,__createBinding:()=>w_e,__decorate:()=>mHt,__disposeResources:()=>NHt,__esDecorate:()=>xTn,__exportStar:()=>_Ht,__extends:()=>fHt,__generator:()=>bHt,__importDefault:()=>PHt,__importStar:()=>EHt,__makeTemplateObject:()=>OHt,__metadata:()=>gHt,__param:()=>hHt,__propKey:()=>OTn,__read:()=>g5e,__rest:()=>pHt,__runInitializers:()=>TTn,__setFunctionName:()=>ETn,__spread:()=>vHt,__spreadArray:()=>SHt,__spreadArrays:()=>wHt,__values:()=>v_e,default:()=>RTn});function fHt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");h5e(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function pHt(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 mHt(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 hHt(t,e){return function(r,n){e(r,n,t)}}function xTn(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 y=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(d=a(y.get))&&(c.get=d),(d=a(y.set))&&(c.set=d),(d=a(y.init))&&o.unshift(d)}else(d=a(y))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function TTn(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 OTn(t){return typeof t=="symbol"?t:"".concat(t)}function ETn(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 gHt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function yHt(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 bHt(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 _Ht(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&w_e(e,t,r)}function v_e(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 g5e(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 vHt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(g5e(arguments[e]));return t}function wHt(){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 SHt(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 q5(t){return this instanceof q5?(this.v=t,this):new q5(t)}function CHt(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(y,g){i.push([p,h,y,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 q5?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 xHt(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:q5(t[o](a)),done:!1}:i?i(a):a}:i}}function THt(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 v_e=="function"?v_e(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 OHt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function EHt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&w_e(e,t,r);return PTn(e,t),e}function PHt(t){return t&&t.__esModule?t:{default:t}}function MHt(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 RHt(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 IHt(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 AHt(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 NHt(t){function e(i){t.error=t.hasError?new MTn(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 h5e,__e,w_e,PTn,MTn,RTn,b5e=v(()=>{h5e=function(t,e){return h5e=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])},h5e(t,e)};__e=function(){return __e=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},__e.apply(this,arguments)};w_e=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};PTn=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};MTn=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};RTn={__extends:fHt,__assign:__e,__rest:pHt,__decorate:mHt,__param:hHt,__metadata:gHt,__awaiter:yHt,__generator:bHt,__createBinding:w_e,__exportStar:_Ht,__values:v_e,__read:g5e,__spread:vHt,__spreadArrays:wHt,__spreadArray:SHt,__await:q5,__asyncGenerator:CHt,__asyncDelegator:xHt,__asyncValues:THt,__makeTemplateObject:OHt,__importStar:EHt,__importDefault:PHt,__classPrivateFieldGet:MHt,__classPrivateFieldSet:RHt,__classPrivateFieldIn:IHt,__addDisposableResource:AHt,__disposeResources:NHt}});var _5e=S(US=>{"use strict";Object.defineProperty(US,"__esModule",{value:!0});US.MAX_HASHABLE_LENGTH=US.INIT=US.KEY=US.DIGEST_LENGTH=US.BLOCK_SIZE=void 0;US.BLOCK_SIZE=64;US.DIGEST_LENGTH=32;US.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]);US.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];US.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var DHt=S(S_e=>{"use strict";Object.defineProperty(S_e,"__esModule",{value:!0});S_e.RawSha256=void 0;var zS=_5e(),ITn=function(){function t(){this.state=Int32Array.from(zS.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>zS.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===zS.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%zS.BLOCK_SIZE>=zS.BLOCK_SIZE-8){for(var o=this.bufferLength;o<zS.BLOCK_SIZE;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<zS.BLOCK_SIZE-8;o++)r.setUint8(o,0);r.setUint32(zS.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),r.setUint32(zS.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(zS.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<zS.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 y=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&c)|0)+(d+(zS.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+y|0,s=a,a=i,i=o,o=y+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}();S_e.RawSha256=ITn});var LHt=S(($Ki,$Ht)=>{var C_e=Object.defineProperty,ATn=Object.getOwnPropertyDescriptor,NTn=Object.getOwnPropertyNames,DTn=Object.prototype.hasOwnProperty,jTn=(t,e)=>C_e(t,"name",{value:e,configurable:!0}),$Tn=(t,e)=>{for(var r in e)C_e(t,r,{get:e[r],enumerable:!0})},LTn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of NTn(e))!DTn.call(t,o)&&o!==r&&C_e(t,o,{get:()=>e[o],enumerable:!(n=ATn(e,o))||n.enumerable});return t},FTn=t=>LTn(C_e({},"__esModule",{value:!0}),t),jHt={};$Tn(jHt,{isArrayBuffer:()=>kTn});$Ht.exports=FTn(jHt);var kTn=jTn(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var BHt=S((LKi,qHt)=>{var x_e=Object.defineProperty,qTn=Object.getOwnPropertyDescriptor,BTn=Object.getOwnPropertyNames,UTn=Object.prototype.hasOwnProperty,FHt=(t,e)=>x_e(t,"name",{value:e,configurable:!0}),zTn=(t,e)=>{for(var r in e)x_e(t,r,{get:e[r],enumerable:!0})},VTn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of BTn(e))!UTn.call(t,o)&&o!==r&&x_e(t,o,{get:()=>e[o],enumerable:!(n=qTn(e,o))||n.enumerable});return t},HTn=t=>VTn(x_e({},"__esModule",{value:!0}),t),kHt={};zTn(kHt,{fromArrayBuffer:()=>JTn,fromString:()=>KTn});qHt.exports=HTn(kHt);var WTn=LHt(),v5e=IS(),JTn=FHt((t,e=0,r=t.byteLength-e)=>{if(!(0,WTn.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return v5e.Buffer.from(t,e,r)},"fromArrayBuffer"),KTn=FHt((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?v5e.Buffer.from(t,e):v5e.Buffer.from(t)},"fromString")});var WHt=S((FKi,HHt)=>{var T_e=Object.defineProperty,GTn=Object.getOwnPropertyDescriptor,XTn=Object.getOwnPropertyNames,ZTn=Object.prototype.hasOwnProperty,w5e=(t,e)=>T_e(t,"name",{value:e,configurable:!0}),YTn=(t,e)=>{for(var r in e)T_e(t,r,{get:e[r],enumerable:!0})},QTn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of XTn(e))!ZTn.call(t,o)&&o!==r&&T_e(t,o,{get:()=>e[o],enumerable:!(n=GTn(e,o))||n.enumerable});return t},eOn=t=>QTn(T_e({},"__esModule",{value:!0}),t),UHt={};YTn(UHt,{fromUtf8:()=>VHt,toUint8Array:()=>tOn,toUtf8:()=>rOn});HHt.exports=eOn(UHt);var zHt=BHt(),VHt=w5e(t=>{let e=(0,zHt.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),tOn=w5e(t=>typeof t=="string"?VHt(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),rOn=w5e(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,zHt.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var JHt=S(O_e=>{"use strict";Object.defineProperty(O_e,"__esModule",{value:!0});O_e.convertToBuffer=void 0;var nOn=WHt(),oOn=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:nOn.fromUtf8;function iOn(t){return t instanceof Uint8Array?t:typeof t=="string"?oOn(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}O_e.convertToBuffer=iOn});var KHt=S(E_e=>{"use strict";Object.defineProperty(E_e,"__esModule",{value:!0});E_e.isEmptyData=void 0;function aOn(t){return typeof t=="string"?t.length===0:t.byteLength===0}E_e.isEmptyData=aOn});var GHt=S(P_e=>{"use strict";Object.defineProperty(P_e,"__esModule",{value:!0});P_e.numToUint8=void 0;function sOn(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}P_e.numToUint8=sOn});var XHt=S(M_e=>{"use strict";Object.defineProperty(M_e,"__esModule",{value:!0});M_e.uint32ArrayFrom=void 0;function uOn(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)}M_e.uint32ArrayFrom=uOn});var R_e=S(FO=>{"use strict";Object.defineProperty(FO,"__esModule",{value:!0});FO.uint32ArrayFrom=FO.numToUint8=FO.isEmptyData=FO.convertToBuffer=void 0;var lOn=JHt();Object.defineProperty(FO,"convertToBuffer",{enumerable:!0,get:function(){return lOn.convertToBuffer}});var cOn=KHt();Object.defineProperty(FO,"isEmptyData",{enumerable:!0,get:function(){return cOn.isEmptyData}});var dOn=GHt();Object.defineProperty(FO,"numToUint8",{enumerable:!0,get:function(){return dOn.numToUint8}});var fOn=XHt();Object.defineProperty(FO,"uint32ArrayFrom",{enumerable:!0,get:function(){return fOn.uint32ArrayFrom}})});var YHt=S(N_e=>{"use strict";Object.defineProperty(N_e,"__esModule",{value:!0});N_e.Sha256=void 0;var ZHt=(b5e(),wpe(y5e)),A_e=_5e(),I_e=DHt(),S5e=R_e(),pOn=function(){function t(e){this.secret=e,this.hash=new I_e.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,S5e.isEmptyData)(e)||this.error))try{this.hash.update((0,S5e.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 ZHt.__awaiter(this,void 0,void 0,function(){return ZHt.__generator(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new I_e.RawSha256,this.secret){this.outer=new I_e.RawSha256;var e=mOn(this.secret),r=new Uint8Array(A_e.BLOCK_SIZE);r.set(e);for(var n=0;n<A_e.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}();N_e.Sha256=pOn;function mOn(t){var e=(0,S5e.convertToBuffer)(t);if(e.byteLength>A_e.BLOCK_SIZE){var r=new I_e.RawSha256;r.update(e),e=r.digest()}var n=new Uint8Array(A_e.BLOCK_SIZE);return n.set(e),n}});var x5e=S(C5e=>{"use strict";Object.defineProperty(C5e,"__esModule",{value:!0});var hOn=(b5e(),wpe(y5e));hOn.__exportStar(YHt(),C5e)});var QHt=v(()=>{});var eWt=v(()=>{});var tWt=v(()=>{});var D_e,T5e=v(()=>{D_e=class t extends Error{constructor(r,n=!0){let o,i=!0;typeof n=="boolean"?(o=void 0,i=n):n!=null&&typeof n=="object"&&(o=n.logger,i=n.tryNextLink??!0);super(r);x(this,"name","ProviderError");x(this,"tryNextLink");this.tryNextLink=i,Object.setPrototypeOf(this,t.prototype),o?.debug?.(`@smithy/property-provider ${i?"->":"(!)"} ${r}`)}static from(r,n=!0){return Object.assign(new this(r.message,n),r)}}});var Nm,rWt=v(()=>{T5e();Nm=class t extends D_e{constructor(r,n=!0){super(r,n);x(this,"name","CredentialsProviderError");Object.setPrototypeOf(this,t.prototype)}}});var nWt=v(()=>{});var oWt=v(()=>{});var iWt=v(()=>{});var aWt,sWt=v(()=>{aWt=(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 qF=v(()=>{rWt();T5e();nWt();oWt();iWt();sWt()});function j_e(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 O5e=v(()=>{});var uWt=v(()=>{});var lWt=v(()=>{uWt()});var B5=S($u=>{"use strict";$u.HttpAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})($u.HttpAuthLocation||($u.HttpAuthLocation={}));$u.HttpApiKeyAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})($u.HttpApiKeyAuthLocation||($u.HttpApiKeyAuthLocation={}));$u.EndpointURLScheme=void 0;(function(t){t.HTTP="http",t.HTTPS="https"})($u.EndpointURLScheme||($u.EndpointURLScheme={}));$u.AlgorithmId=void 0;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})($u.AlgorithmId||($u.AlgorithmId={}));var gOn=t=>{let e=[];return t.sha256!==void 0&&e.push({algorithmId:()=>$u.AlgorithmId.SHA256,checksumConstructor:()=>t.sha256}),t.md5!=null&&e.push({algorithmId:()=>$u.AlgorithmId.MD5,checksumConstructor:()=>t.md5}),{addChecksumAlgorithm(r){e.push(r)},checksumAlgorithms(){return e}}},yOn=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e},bOn=t=>gOn(t),_On=t=>yOn(t);$u.FieldPosition=void 0;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})($u.FieldPosition||($u.FieldPosition={}));var vOn="__smithy_context";$u.IniSectionType=void 0;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})($u.IniSectionType||($u.IniSectionType={}));$u.RequestHandlerProtocol=void 0;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})($u.RequestHandlerProtocol||($u.RequestHandlerProtocol={}));$u.SMITHY_CONTEXT_KEY=vOn;$u.getDefaultClientConfiguration=bOn;$u.resolveDefaultRuntimeConfig=_On});var cWt=v(()=>{});var dWt=v(()=>{});var fWt=v(()=>{});function wOn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var $_e,pWt=v(()=>{$_e=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=wOn(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 mWt=v(()=>{});var hWt=v(()=>{});var gWt=v(()=>{});var yWt=v(()=>{lWt();cWt();dWt();fWt();pWt();mWt();hWt();gWt()});var SOn,COn,L_e,E5e=v(()=>{yWt();SOn=t=>e=>async r=>{if(!$_e.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)},COn={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},L_e=t=>({applyToStack:e=>{e.add(SOn(t),COn)}})});var xOn,TOn,F_e,bWt=v(()=>{xOn=()=>(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}},TOn={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},F_e=t=>({applyToStack:e=>{e.add(xOn(),TOn)}})});var P5e=v(()=>{bWt()});var _Wt,vWt=v(()=>{_Wt={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"}});var wWt,M5e=v(()=>{wWt=()=>t=>async e=>t(e)});var k_e,SWt=v(()=>{vWt();M5e();k_e=t=>({applyToStack:e=>{e.add(wWt(),_Wt)}})});var R5e=v(()=>{SWt();M5e()});var CWt=v(()=>{});var VS=S(I5e=>{"use strict";var xWt=B5(),OOn=t=>t[xWt.SMITHY_CONTEXT_KEY]||(t[xWt.SMITHY_CONTEXT_KEY]={}),EOn=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};I5e.getSmithyContext=OOn;I5e.normalizeProvider=EOn});var TWt,OWt=v(()=>{TWt=(t,e)=>{if(!e||e.length===0)return t;let r=[];for(let n of e)for(let o of t)o.schemeId.split("#")[1]===n&&r.push(o);for(let n of t)r.find(({schemeId:o})=>o===n.schemeId)||r.push(n);return r}});function POn(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var EWt,PWt,A5e=v(()=>{EWt=$(VS());OWt();PWt=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=t.authSchemePreference?await t.authSchemePreference():[],s=TWt(i,a),u=POn(t.httpAuthSchemes),l=(0,EWt.getSmithyContext)(n),c=[];for(let d of s){let f=u.get(d.schemeId);if(!f){c.push(`HttpAuthScheme \`${d.schemeId}\` was not enabled for this service.`);continue}let p=f.identityProvider(await e.identityProviderConfigProvider(t));if(!p){c.push(`HttpAuthScheme \`${d.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:m={},signingProperties:h={}}=d.propertiesExtractor?.(t,n)||{};d.identityProperties=Object.assign(d.identityProperties||{},m),d.signingProperties=Object.assign(d.signingProperties||{},h),l.selectedHttpAuthScheme={httpAuthOption:d,identity:await p(d.identityProperties),signer:f.signer};break}if(!l.selectedHttpAuthScheme)throw new Error(c.join(`
`));return r(o)}});var MOn,q_e,MWt=v(()=>{A5e();MOn={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},q_e=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(PWt(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),MOn)}})});var RWt=v(()=>{});var IWt=v(()=>{});var B_e,AWt=v(()=>{B_e={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var N5e=v(()=>{RWt();AWt();IWt()});var aGi,NWt=v(()=>{N5e();aGi={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:B_e.name}});var DWt=v(()=>{A5e();MWt();NWt()});var jWt=v(()=>{});var $Wt=v(()=>{jWt()});var LWt=v(()=>{});var FWt=v(()=>{});var kWt=v(()=>{});function ROn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var BF,qWt=v(()=>{BF=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=ROn(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 U5,BWt=v(()=>{U5=class{constructor(e){x(this,"statusCode");x(this,"reason");x(this,"headers");x(this,"body");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 UWt=v(()=>{});var zWt=v(()=>{});var Kre=v(()=>{$Wt();LWt();FWt();kWt();qWt();BWt();UWt();zWt()});var VWt,IOn,AOn,HWt,D5e=v(()=>{Kre();VWt=$(VS()),IOn=t=>e=>{throw e},AOn=(t,e)=>{},HWt=t=>(e,r)=>async n=>{if(!BF.isInstance(n.request))return e(n);let i=(0,VWt.getSmithyContext)(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||IOn)(a));return(u.successHandler||AOn)(l.response,a),l}});var NOn,U_e,WWt=v(()=>{D5e();NOn={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},U_e=t=>({applyToStack:e=>{e.addRelativeTo(HWt(t),NOn)}})});var JWt=v(()=>{D5e();WWt()});var P1,KWt=v(()=>{P1=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});function j5e(t,e,r,n,o){return async function*(a,s,...u){let l=s,c=a.startingToken??l[r],d=!0,f;for(;d;){if(l[r]=c,o&&(l[o]=l[o]??a.pageSize),a.client instanceof t)f=await DOn(e,a.client,s,a.withCommand,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield f;let p=c;c=jOn(f,n),d=!!(c&&(!a.stopOnSameToken||c!==p))}return void 0}}var DOn,jOn,GWt=v(()=>{DOn=async(t,e,r,n=i=>i,...o)=>{let i=new t(r);return i=n(i)??i,await e.send(i,...o)};jOn=(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 XWt,$5e,ZWt,UF,r2,YWt,L5e=v(()=>{XWt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$5e=Object.entries(XWt).reduce((t,[e,r])=>(t[r]=Number(e),t),{}),ZWt=XWt.split(""),UF=6,r2=8,YWt=63});var gw,QWt=v(()=>{L5e();gw=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 $5e))throw new TypeError(`Invalid character ${t[l]} in base64 string.`);i|=$5e[t[l]]<<(c-l)*UF,a+=UF}else i>>=UF;let s=o/4*3;i>>=a%r2;let u=Math.floor(a/r2);for(let l=0;l<u;l++){let c=(u-l-1)*r2;n.setUint8(s+l,(i&255<<c)>>c)}}return new Uint8Array(r)}});var e3t,t3t=v(()=>{e3t=t=>new TextEncoder().encode(t)});var r3t=v(()=>{});var n3t=v(()=>{});var o3t=v(()=>{t3t();r3t();n3t()});function yw(t){let e;typeof t=="string"?e=e3t(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)*r2,s+=r2;let u=Math.ceil(s/UF);a<<=u*UF-s;for(let l=1;l<=u;l++){let c=(u-l)*UF;o+=ZWt[(a&YWt<<c)>>c]}o+="==".slice(0,4-u)}return o}var i3t=v(()=>{o3t();L5e()});var kO=v(()=>{QWt();i3t()});var a3t,s3t=v(()=>{a3t=t=>new TextEncoder().encode(t)});var u3t=v(()=>{});var z_e,l3t=v(()=>{z_e=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});var F5e=v(()=>{s3t();u3t();l3t()});var z5,c3t=v(()=>{kO();F5e();z5=class t extends Uint8Array{static fromString(e,r="utf-8"){if(typeof e=="string")return r==="base64"?t.mutate(gw(e)):t.mutate(a3t(e));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 e==="base64"?yw(this):z_e(this)}}});var d3t=v(()=>{});var k5e,f3t=v(()=>{k5e=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var p3t=v(()=>{});var m3t=v(()=>{});var h3t=v(()=>{});var g3t=v(()=>{});var y3t=v(()=>{});var b3t=v(()=>{y3t()});var _3t=v(()=>{});var v3t=v(()=>{});var w3t=v(()=>{});var S3t=v(()=>{});var Gre,C3t=v(()=>{Gre=class{constructor(e){x(this,"statusCode");x(this,"reason");x(this,"headers");x(this,"body");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 x3t=v(()=>{});var T3t=v(()=>{});var O3t=v(()=>{b3t();_3t();v3t();w3t();S3t();C3t();x3t();T3t()});var Xre=S(q5e=>{"use strict";var E3t=t=>encodeURIComponent(t).replace(/[!'()*]/g,$On),$On=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`,LOn=t=>t.split("/").map(E3t).join("/");q5e.escapeUri=E3t;q5e.escapeUriPath=LOn});function P3t(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=(0,V_e.escapeUri)(r),Array.isArray(n))for(let o=0,i=n.length;o<i;o++)e.push(`${r}=${(0,V_e.escapeUri)(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${(0,V_e.escapeUri)(n)}`),e.push(o)}}return e.join("&")}var V_e,M3t=v(()=>{V_e=$(Xre())});function B5e(t,e){return new Request(t,e)}var R3t=v(()=>{});function I3t(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 A3t=v(()=>{});var U5e,zF,N3t=v(()=>{O3t();M3t();R3t();A3t();U5e={supported:void 0},zF=class t{constructor(e){x(this,"config");x(this,"configProvider");typeof e=="function"?this.configProvider=e().then(r=>r||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),U5e.supported===void 0&&(U5e.supported=typeof Request<"u"&&"keepalive"in B5e("https://[::1]"))}static create(e){return typeof e?.handle=="function"?e:new t(e)}destroy(){}async handle(e,{abortSignal:r,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);let o=n??this.config.requestTimeout,i=this.config.keepAlive===!0,a=this.config.credentials;if(r?.aborted){let b=new Error("Request aborted");return b.name="AbortError",Promise.reject(b)}let s=e.path,u=P3t(e.query||{});u&&(s+=`?${u}`),e.fragment&&(s+=`#${e.fragment}`);let l="";if(e.username!=null||e.password!=null){let b=e.username??"",_=e.password??"";l=`${b}:${_}@`}let{port:c,method:d}=e,f=`${e.protocol}//${l}${e.hostname}${c?`:${c}`:""}${s}`,p=d==="GET"||d==="HEAD"?void 0:e.body,m={body:p,headers:new Headers(e.headers),method:d,credentials:a};this.config?.cache&&(m.cache=this.config.cache),p&&(m.duplex="half"),typeof AbortController<"u"&&(m.signal=r),U5e.supported&&(m.keepalive=i),typeof this.config.requestInit=="function"&&Object.assign(m,this.config.requestInit(e));let h=()=>{},y=B5e(f,m),g=[fetch(y).then(b=>{let _=b.headers,w={};for(let O of _.entries())w[O[0]]=O[1];return b.body!=null?{response:new Gre({headers:w,reason:b.statusText,statusCode:b.status,body:b.body})}:b.blob().then(O=>({response:new Gre({headers:w,reason:b.statusText,statusCode:b.status,body:O})}))}),I3t(o)];return r&&g.push(new Promise((b,_)=>{let w=()=>{let T=new Error("Request aborted");T.name="AbortError",_(T)};if(typeof r.addEventListener=="function"){let T=r;T.addEventListener("abort",w,{once:!0}),h=()=>T.removeEventListener("abort",w)}else r.onabort=w})),Promise.race(g).finally(h)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}});async function FOn(t){let e=await qOn(t),r=gw(e);return new Uint8Array(r)}async function kOn(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 qOn(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 V5,D3t=v(()=>{kO();V5=async t=>typeof Blob=="function"&&t instanceof Blob||t.constructor?.name==="Blob"?Blob.prototype.arrayBuffer!==void 0?new Uint8Array(await t.arrayBuffer()):FOn(t):kOn(t)});var Zre=v(()=>{N3t();D3t()});function $3t(t){let e="";for(let r=0;r<t.byteLength;r++)e+=j3t[t[r]];return e}var j3t,BOn,L3t=v(()=>{j3t={},BOn={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),j3t[t]=e,BOn[e]=t}});var F3t,q3t,k3t,B3t=v(()=>{Zre();kO();L3t();F5e();f3t();F3t="The stream has already been transformed.",q3t=t=>{if(!k3t(t)&&!k5e(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(F3t);return e=!0,await V5(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 yw(i);if(o==="hex")return $3t(i);if(o===void 0||o==="utf8"||o==="utf-8")return z_e(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(F3t);if(e=!0,k3t(t))return n(t);if(k5e(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},k3t=t=>typeof Blob=="function"&&t instanceof Blob});var U3t=v(()=>{});var z5e=v(()=>{c3t();d3t();p3t();m3t();h3t();g3t();B3t();U3t()});var M1,V5e=v(()=>{z5e();M1=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return z5.mutate(t);if(!t)return z5.mutate(new Uint8Array);let r=e.streamCollector(t);return z5.mutate(await r)}});function H5e(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var z3t=v(()=>{});var VF,W5e=v(()=>{VF=t=>typeof t=="function"?t():t});var H_e,W_e=v(()=>{H_e=(t,e,r,n,o)=>({name:e,namespace:t,traits:r,input:n,output:o})});var V3t,H3t,J5e,W3t=v(()=>{Kre();V3t=$(VS());W_e();H3t=t=>(e,r)=>async n=>{let{response:o}=await e(n),{operationSchema:i}=(0,V3t.getSmithyContext)(r),[,a,s,u,l,c]=i??[];try{let d=await t.protocol.deserializeResponse(H_e(a,s,u,l,c),{...t,...r},o);return{response:o,output:d}}catch(d){if(Object.defineProperty(d,"$response",{value:o,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in d)){let f="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{d.message+=`
  `+f}catch{!r.logger||r.logger?.constructor?.name==="NoOpLogger"?console.warn(f):r.logger?.warn?.(f)}typeof d.$responseBodyText<"u"&&d.$response&&(d.$response.body=d.$responseBodyText);try{if(U5.isInstance(o)){let{headers:p={}}=o,m=Object.entries(p);d.$metadata={httpStatusCode:o.statusCode,requestId:J5e(/^x-[\w-]+-request-?id$/,m),extendedRequestId:J5e(/^x-[\w-]+-id-2$/,m),cfId:J5e(/^x-[\w-]+-cf-id$/,m)}}}catch{}}throw d}},J5e=(t,e)=>(e.find(([r])=>r.match(t))||[void 0,void 0])[1]});var J3t,K3t,G3t=v(()=>{J3t=$(VS());W_e();K3t=t=>(e,r)=>async n=>{let{operationSchema:o}=(0,J3t.getSmithyContext)(r),[,i,a,s,u,l]=o??[],c=r.endpointV2?.url&&t.urlParser?async()=>t.urlParser(r.endpointV2.url):t.endpoint,d=await t.protocol.serializeRequest(H_e(i,a,s,u,l),n.input,{...t,...r,endpoint:c});return e({...n,request:d})}});function J_e(t){return{applyToStack:e=>{e.add(K3t(t),zOn),e.add(H3t(t),UOn),t.protocol.setSerdeContext(t)}}}var UOn,zOn,X3t=v(()=>{W3t();G3t();UOn={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},zOn={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var HS,n2=v(()=>{HS=class{constructor(){x(this,"name");x(this,"namespace");x(this,"traits")}static assign(e,r){return Object.assign(e,r)}static[Symbol.hasInstance](e){let r=this.prototype.isPrototypeOf(e);return!r&&typeof e=="object"&&e!==null?e.symbol===this.symbol:r}getName(){return this.namespace+"#"+this.name}}});var K_e,Z3t,Y3t=v(()=>{n2();K_e=class K_e extends HS{constructor(){super(...arguments);x(this,"name");x(this,"traits");x(this,"valueSchema");x(this,"symbol",K_e.symbol)}};x(K_e,"symbol",Symbol.for("@smithy/lis"));Z3t=K_e});var G_e,Q3t,e6t=v(()=>{n2();G_e=class G_e extends HS{constructor(){super(...arguments);x(this,"name");x(this,"traits");x(this,"keySchema");x(this,"valueSchema");x(this,"symbol",G_e.symbol)}};x(G_e,"symbol",Symbol.for("@smithy/map"));Q3t=G_e});var X_e,t6t,r6t=v(()=>{n2();X_e=class X_e extends HS{constructor(){super(...arguments);x(this,"name");x(this,"traits");x(this,"input");x(this,"output");x(this,"symbol",X_e.symbol)}};x(X_e,"symbol",Symbol.for("@smithy/ope"));t6t=X_e});var Y_e,Z_e,K5e=v(()=>{n2();Y_e=class Y_e extends HS{constructor(){super(...arguments);x(this,"name");x(this,"traits");x(this,"memberNames");x(this,"memberList");x(this,"symbol",Y_e.symbol)}};x(Y_e,"symbol",Symbol.for("@smithy/str"));Z_e=Y_e});var Q_e,n6t,o6t=v(()=>{K5e();Q_e=class Q_e extends Z_e{constructor(){super(...arguments);x(this,"ctor");x(this,"symbol",Q_e.symbol)}};x(Q_e,"symbol",Symbol.for("@smithy/err"));n6t=Q_e});function o2(t){if(typeof t=="object")return t;t=t|0;let e={},r=0;for(let n of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(t>>r++&1)===1&&(e[n]=1);return e}var G5e=v(()=>{});function Yre(t,e){if(t instanceof oa)return Object.assign(t,{memberName:e,_isMemberSchema:!0});let r=oa;return new r(t,e)}var HF,oa,X5e,VOn,i6t=v(()=>{W5e();G5e();HF=class HF{constructor(e,r){x(this,"ref");x(this,"memberName");x(this,"symbol",HF.symbol);x(this,"name");x(this,"schema");x(this,"_isMemberSchema");x(this,"traits");x(this,"memberTraits");x(this,"normalizedTraits");this.ref=e,this.memberName=r;let n=[],o=e,i=e;for(this._isMemberSchema=!1;X5e(o);)n.push(o[1]),o=o[0],i=VF(o),this._isMemberSchema=!0;if(n.length>0){this.memberTraits={};for(let a=n.length-1;a>=0;--a){let s=n[a];Object.assign(this.memberTraits,o2(s))}}else this.memberTraits=0;if(i instanceof HF){let a=this.memberTraits;Object.assign(this,i),this.memberTraits=Object.assign({},a,i.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=r??i.memberName;return}if(this.schema=VF(i),VOn(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(i),this.traits=0),this._isMemberSchema&&!r)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){let r=this.prototype.isPrototypeOf(e);return!r&&typeof e=="object"&&e!==null?e.symbol===this.symbol:r}static of(e){let r=VF(e);if(r instanceof HF)return r;if(X5e(r)){let[n,o]=r;if(n instanceof HF)return Object.assign(n.getMergedTraits(),o2(o)),n;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}return new HF(r)}getSchema(){let e=this.schema;return e[0]===0?e[4]:e}getName(e=!1){let{name:r}=this;return!e&&r&&r.includes("#")?r.split("#")[1]:r||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){let e=this.getSchema();return typeof e=="number"?e>=64&&e<128:e[0]===1}isMapSchema(){let e=this.getSchema();return typeof e=="number"?e>=128&&e<=255:e[0]===2}isStructSchema(){let r=this.getSchema()[0];return r===3||r===-3||r===4}isUnionSchema(){return this.getSchema()[0]===4}isBlobSchema(){let e=this.getSchema();return e===21||e===42}isTimestampSchema(){let e=this.getSchema();return typeof e=="number"&&e>=4&&e<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){let{streaming:e}=this.getMergedTraits();return!!e||this.getSchema()===42}isIdempotencyToken(){let e=i=>(i&4)===4||!!i?.idempotencyToken,{normalizedTraits:r,traits:n,memberTraits:o}=this;return e(r)||e(n)||e(o)}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return o2(this.memberTraits)}getOwnTraits(){return o2(this.traits)}getKeySchema(){let[e,r]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!r)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);let n=this.getSchema(),o=e?15:n[4]??0;return Yre([o,0],"key")}getValueSchema(){let e=this.getSchema(),[r,n,o]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],i=typeof e=="number"?63&e:e&&typeof e=="object"&&(n||o)?e[3+e[0]]:r?15:void 0;if(i!=null)return Yre([i,0],n?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){let r=this.getSchema();if(this.isStructSchema()&&r[4].includes(e)){let n=r[4].indexOf(e),o=r[5][n];return Yre(X5e(o)?o:[o,0],e)}if(this.isDocumentSchema())return Yre([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no no member=${e}.`)}getMemberSchemas(){let e={};try{for(let[r,n]of this.structIterator())e[r]=n}catch{}return e}getEventStreamMember(){if(this.isStructSchema()){for(let[e,r]of this.structIterator())if(r.isStreaming()&&r.isStructSchema())return e}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");let e=this.getSchema();for(let r=0;r<e[4].length;++r)yield[e[4][r],Yre([e[5][r],0],e[4][r])]}};x(HF,"symbol",Symbol.for("@smithy/nor"));oa=HF;X5e=t=>Array.isArray(t)&&t.length===2,VOn=t=>Array.isArray(t)&&t.length>=5});var eve,a6t,s6t=v(()=>{n2();eve=class eve extends HS{constructor(){super(...arguments);x(this,"name");x(this,"schemaRef");x(this,"traits");x(this,"symbol",eve.symbol)}};x(eve,"symbol",Symbol.for("@smithy/sim"));a6t=eve});var u6t=v(()=>{});var qO,Vs,l6t=v(()=>{qO=class qO{constructor(e,r=new Map,n=new Map){x(this,"namespace");x(this,"schemas");x(this,"exceptions");this.namespace=e,this.schemas=r,this.exceptions=n}static for(e){return qO.registries.has(e)||qO.registries.set(e,new qO(e)),qO.registries.get(e)}register(e,r){let n=this.normalizeShapeId(e);qO.for(n.split("#")[0]).schemas.set(n,r)}getSchema(e){let r=this.normalizeShapeId(e);if(!this.schemas.has(r))throw new Error(`@smithy/core/schema - schema not found for ${r}`);return this.schemas.get(r)}registerError(e,r){let n=e,o=qO.for(n[1]);o.schemas.set(n[1]+"#"+n[2],n),o.exceptions.set(n,r)}getErrorCtor(e){let r=e;return qO.for(r[1]).exceptions.get(r)}getBaseException(){for(let e of this.exceptions.keys())if(Array.isArray(e)){let[,r,n]=e,o=r+"#"+n;if(o.startsWith("smithy.ts.sdk.synthetic.")&&o.endsWith("ServiceException"))return e}}find(e){return[...this.schemas.values()].find(e)}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}};x(qO,"registries",new Map);Vs=qO});var Mg=v(()=>{W5e();X3t();Y3t();e6t();r6t();W_e();o6t();i6t();n2();s6t();K5e();u6t();G5e();l6t()});var c6t=v(()=>{});var Z5e,HOn,d6t,WOn,f6t,p6t,m6t,JOn,h6t,g6t,KOn,tve,H5,y6t,GOn,XOn,Y5e=v(()=>{Z5e=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&XOn.warn(GOn(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},HOn=Math.ceil(34028234663852886e22),d6t=t=>{let e=Z5e(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>HOn)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},WOn=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},f6t=t=>m6t(t,16),p6t=t=>m6t(t,8),m6t=(t,e)=>{let r=WOn(t);if(r!==void 0&&JOn(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},JOn=(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]}},h6t=t=>Z5e(typeof t=="string"?tve(t):t),g6t=t=>d6t(typeof t=="string"?tve(t):t),KOn=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,tve=t=>{let e=t.match(KOn);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},H5=t=>f6t(typeof t=="string"?tve(t):t),y6t=t=>p6t(typeof t=="string"?tve(t):t),GOn=t=>String(new TypeError(t).stack||t).split(`
`).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
`),XOn={warn:console.warn}});function rve(t){let e=t.getUTCFullYear(),r=t.getUTCMonth(),n=t.getUTCDay(),o=t.getUTCDate(),i=t.getUTCHours(),a=t.getUTCMinutes(),s=t.getUTCSeconds(),u=o<10?`0${o}`:`${o}`,l=i<10?`0${i}`:`${i}`,c=a<10?`0${a}`:`${a}`,d=s<10?`0${s}`:`${s}`;return`${ZOn[n]}, ${u} ${eKe[r]} ${e} ${l}:${c}:${d} GMT`}var ZOn,eKe,YOn,b6t,QOn,_6t,eEn,tEn,rEn,v6t,w6t,Qre,nEn,oEn,iEn,Q5e,aEn,sEn,uEn,BO,lEn,cEn,W5,S6t=v(()=>{Y5e();ZOn=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],eKe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];YOn=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),b6t=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=YOn.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=H5(W5(n)),d=BO(o,"month",1,12),f=BO(i,"day",1,31);return Qre(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},QOn=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),_6t=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=QOn.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=H5(W5(n)),f=BO(o,"month",1,12),p=BO(i,"day",1,31),m=Qre(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&m.setTime(m.getTime()-cEn(c)),m},eEn=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$/),tEn=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$/),rEn=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})$/),v6t=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let e=eEn.exec(t);if(e){let[r,n,o,i,a,s,u,l]=e;return Qre(H5(W5(i)),Q5e(o),BO(n,"day",1,31),{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})}if(e=tEn.exec(t),e){let[r,n,o,i,a,s,u,l]=e;return iEn(Qre(nEn(i),Q5e(o),BO(n,"day",1,31),{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l}))}if(e=rEn.exec(t),e){let[r,n,o,i,a,s,u,l]=e;return Qre(H5(W5(l)),Q5e(n),BO(o.trimLeft(),"day",1,31),{hours:i,minutes:a,seconds:s,fractionalMilliseconds:u})}throw new TypeError("Invalid RFC-7231 date-time value")},w6t=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=h6t(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))},Qre=(t,e,r,n)=>{let o=e-1;return sEn(t,o,r),new Date(Date.UTC(t,o,r,BO(n.hours,"hour",0,23),BO(n.minutes,"minute",0,59),BO(n.seconds,"seconds",0,60),lEn(n.fractionalMilliseconds)))},nEn=t=>{let e=new Date().getUTCFullYear(),r=Math.floor(e/100)*100+H5(W5(t));return r<e?r+100:r},oEn=50*365*24*60*60*1e3,iEn=t=>t.getTime()-new Date().getTime()>oEn?new Date(Date.UTC(t.getUTCFullYear()-100,t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds())):t,Q5e=t=>{let e=eKe.indexOf(t);if(e<0)throw new TypeError(`Invalid month: ${t}`);return e+1},aEn=[31,28,31,30,31,30,31,31,30,31,30,31],sEn=(t,e,r)=>{let n=aEn[e];if(e===1&&uEn(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${eKe[e]} in ${t}: ${r}`)},uEn=t=>t%4===0&&(t%100!==0||t%400===0),BO=(t,e,r,n)=>{let o=y6t(W5(t));if(o<r||o>n)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},lEn=t=>t==null?0:g6t("0."+t)*1e3,cEn=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},W5=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var tKe,C6t=v(()=>{tKe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)});var Ay,i2,x6t=v(()=>{C6t();Ay=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0")),i2=()=>{if(tKe)return tKe();let t=new Uint8Array(16);return crypto.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128,Ay[t[0]]+Ay[t[1]]+Ay[t[2]]+Ay[t[3]]+"-"+Ay[t[4]]+Ay[t[5]]+"-"+Ay[t[6]]+Ay[t[7]]+"-"+Ay[t[8]]+Ay[t[9]]+"-"+Ay[t[10]]+Ay[t[11]]+Ay[t[12]]+Ay[t[13]]+Ay[t[14]]+Ay[t[15]]}});var rKe=v(()=>{x6t()});var T6t=v(()=>{rKe()});var WS,O6t=v(()=>{WS=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};WS.from=t=>t&&typeof t=="object"&&(t instanceof WS||"deserializeJSON"in t)?t:typeof t=="string"||Object.getPrototypeOf(t)===String.prototype?WS(String(t)):WS(JSON.stringify(t));WS.fromObject=WS.from});var E6t=v(()=>{});function R1(t,e,r){let n=Number(t);if(n<e||n>r)throw new Error(`Value ${n} out of range [${e}, ${r}]`)}var nKe,oKe,iKe,P6t,M6t,dEn,fEn,pEn,mEn,hEn,R6t,I6t,A6t,N6t=v(()=>{nKe="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",oKe="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",iKe="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",P6t="(\\d?\\d)",M6t="(\\d{4})",dEn=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),fEn=new RegExp(`^${nKe}, ${P6t} ${oKe} ${M6t} ${iKe} GMT$`),pEn=new RegExp(`^${nKe}, ${P6t}-${oKe}-(\\d\\d) ${iKe} GMT$`),mEn=new RegExp(`^${nKe} ${oKe} ( [1-9]|\\d\\d) ${iKe} ${M6t}$`),hEn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],R6t=t=>{if(t==null)return;let e=NaN;if(typeof t=="number")e=t;else if(typeof t=="string"){if(!/^-?\d*\.?\d+$/.test(t))throw new TypeError("parseEpochTimestamp - numeric string invalid.");e=Number.parseFloat(t)}else typeof t=="object"&&t.tag===1&&(e=t.value);if(isNaN(e)||Math.abs(e)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(e*1e3))},I6t=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC3339 timestamps must be strings");let e=dEn.exec(t);if(!e)throw new TypeError(`Invalid RFC3339 timestamp format ${t}`);let[,r,n,o,i,a,s,,u,l]=e;R1(n,1,12),R1(o,1,31),R1(i,0,23),R1(a,0,59),R1(s,0,60);let c=new Date(Date.UTC(Number(r),Number(n)-1,Number(o),Number(i),Number(a),Number(s),Number(u)?Math.round(parseFloat(`0.${u}`)*1e3):0));if(c.setUTCFullYear(Number(r)),l.toUpperCase()!="Z"){let[,d,f,p]=/([+-])(\d\d):(\d\d)/.exec(l)||[void 0,"+",0,0],m=d==="-"?1:-1;c.setTime(c.getTime()+m*(Number(f)*60*60*1e3+Number(p)*60*1e3))}return c},A6t=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC7231 timestamps must be strings.");let e,r,n,o,i,a,s,u;if((u=fEn.exec(t))?[,e,r,n,o,i,a,s]=u:(u=pEn.exec(t))?([,e,r,n,o,i,a,s]=u,n=(Number(n)+1900).toString()):(u=mEn.exec(t))&&([,r,e,o,i,a,s,n]=u),n&&a){let l=Date.UTC(Number(n),hEn.indexOf(r),Number(e),Number(o),Number(i),Number(a),s?Math.round(parseFloat(`0.${s}`)*1e3):0);R1(e,1,31),R1(o,0,23),R1(i,0,59),R1(a,0,60);let c=new Date(l);return c.setUTCFullYear(Number(n)),c}throw new TypeError(`Invalid RFC7231 date-time value ${t}.`)}});var D6t=v(()=>{});var j6t,$6t=v(()=>{j6t=t=>{let e=t.length,r=[],n=!1,o,i=0;for(let a=0;a<e;++a){let s=t[a];switch(s){case'"':o!=="\\"&&(n=!n);break;case",":n||(r.push(t.slice(i,a)),i=a+1);break;default:}o=s}return r.push(t.slice(i)),r.map(a=>{a=a.trim();let s=a.length;return s<2?a:(a[0]==='"'&&a[s-1]==='"'&&(a=a.slice(1,s-1)),a.replace(/\\"/g,'"'))})}});var L6t,Rh,F6t=v(()=>{L6t=/^-?\d*(\.\d+)?$/,Rh=class t{constructor(e,r){x(this,"string");x(this,"type");if(this.string=e,this.type=r,!L6t.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||typeof e!="object")return!1;let r=e;return t.prototype.isPrototypeOf(e)||r.type==="bigDecimal"&&L6t.test(r.string)}}});var WF=v(()=>{c6t();S6t();T6t();O6t();Y5e();E6t();N6t();D6t();$6t();F6t()});var J5,nve=v(()=>{J5=class{constructor(){x(this,"serdeContext")}setSerdeContext(e){this.serdeContext=e}}});var k6t,q6t=v(()=>{k6t=t=>new TextEncoder().encode(t)});var B6t=v(()=>{});var ove,U6t=v(()=>{ove=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 aKe=v(()=>{q6t();B6t();U6t()});var sKe,z6t=v(()=>{aKe();sKe=class{constructor({marshaller:e,serializer:r,deserializer:n,serdeContext:o,defaultContentType:i}){x(this,"marshaller");x(this,"serializer");x(this,"deserializer");x(this,"serdeContext");x(this,"defaultContentType");this.marshaller=e,this.serializer=r,this.deserializer=n,this.serdeContext=o,this.defaultContentType=i}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:n}){let o=this.marshaller,i=r.getEventStreamMember(),a=r.getMemberSchema(i),s=this.serializer,u=this.defaultContentType,l=Symbol("initialRequestMarker"),c={async*[Symbol.asyncIterator](){if(n){let d={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:u}};s.write(r,n);let f=s.flush();yield{[l]:!0,headers:d,body:f}}for await(let d of e)yield d}};return o.serialize(c,d=>{if(d[l])return{headers:d.headers,body:d.body};let f=Object.keys(d).find(b=>b!=="__type")??"",{additionalHeaders:p,body:m,eventType:h,explicitPayloadContentType:y}=this.writeEventBody(f,a,d);return{headers:{":event-type":{type:"string",value:h},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:y??u},...p},body:m}})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:n}){let o=this.marshaller,i=r.getEventStreamMember(),s=r.getMemberSchema(i).getMemberSchemas(),u=Symbol("initialResponseMarker"),l=o.deserialize(e.body,async f=>{let p=Object.keys(f).find(h=>h!=="__type")??"",m=f[p].body;if(p==="initial-response"){let h=await this.deserializer.read(r,m);return delete h[i],{[u]:!0,...h}}else if(p in s){let h=s[p];if(h.isStructSchema()){let y={},g=!1;for(let[b,_]of h.structIterator()){let{eventHeader:w,eventPayload:T}=_.getMergedTraits();if(g=g||!!(w||T),T)_.isBlobSchema()?y[b]=m:_.isStringSchema()?y[b]=(this.serdeContext?.utf8Encoder??ove)(m):_.isStructSchema()&&(y[b]=await this.deserializer.read(_,m));else if(w){let O=f[p].headers[b]?.value;O!=null&&(_.isNumericSchema()?O&&typeof O=="object"&&"bytes"in O?y[b]=BigInt(O.toString()):y[b]=Number(O):y[b]=O)}}if(g)return{[p]:y}}return{[p]:await this.deserializer.read(h,m)}}else return{$unknown:f}}),c=l[Symbol.asyncIterator](),d=await c.next();if(d.done)return l;if(d.value?.[u]){if(!r)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let[f,p]of Object.entries(d.value))n[f]=p}return{async*[Symbol.asyncIterator](){for(d?.value?.[u]||(yield d.value);;){let{done:f,value:p}=await c.next();if(f)break;yield p}}}}writeEventBody(e,r,n){let o=this.serializer,i=e,a=null,s,u=r.getSchema()[4].includes(e),l={};if(u){let f=r.getMemberSchema(e);if(f.isStructSchema()){for(let[p,m]of f.structIterator()){let{eventHeader:h,eventPayload:y}=m.getMergedTraits();if(y)a=p;else if(h){let g=n[e][p],b="binary";m.isNumericSchema()?(-2)**31<=g&&g<=2**31-1?b="integer":b="long":m.isTimestampSchema()?b="timestamp":m.isStringSchema()?b="string":m.isBooleanSchema()&&(b="boolean"),g!=null&&(l[p]={type:b,value:g},delete n[e][p])}}if(a!==null){let p=f.getMemberSchema(a);p.isBlobSchema()?s="application/octet-stream":p.isStringSchema()&&(s="text/plain"),o.write(p,n[e][a])}else o.write(f,n[e])}else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}else{let[f,p]=n[e];i=f,o.write(15,p)}let c=o.flush();return{body:typeof c=="string"?(this.serdeContext?.utf8Decoder??k6t)(c):c,eventType:i,explicitPayloadContentType:s,additionalHeaders:l}}}});var V6t={};En(V6t,{EventStreamSerde:()=>sKe});var H6t=v(()=>{z6t()});var ive,uKe=v(()=>{Mg();Kre();nve();ive=class extends J5{constructor(r){super();x(this,"options");this.options=r}getRequestType(){return BF}getResponseType(){return U5}setSerdeContext(r){this.serdeContext=r,this.serializer.setSerdeContext(r),this.deserializer.setSerdeContext(r),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(r)}updateServiceEndpoint(r,n){if("url"in n){r.protocol=n.url.protocol,r.hostname=n.url.hostname,r.port=n.url.port?Number(n.url.port):void 0,r.path=n.url.pathname,r.fragment=n.url.hash||void 0,r.username=n.url.username||void 0,r.password=n.url.password||void 0,r.query||(r.query={});for(let[o,i]of n.url.searchParams.entries())r.query[o]=i;return r}else return r.protocol=n.protocol,r.hostname=n.hostname,r.port=n.port?Number(n.port):void 0,r.path=n.path,r.query={...n.query},r}setHostPrefix(r,n,o){if(this.serdeContext?.disableHostPrefix)return;let i=oa.of(n.input),a=o2(n.traits??{});if(a.endpoint){let s=a.endpoint?.[0];if(typeof s=="string"){let u=[...i.structIterator()].filter(([,l])=>l.getMergedTraits().hostLabel);for(let[l]of u){let c=o[l];if(typeof c!="string")throw new Error(`@smithy/core/schema - ${l} in input must be a string as hostLabel.`);s=s.replace(`{${l}}`,c)}r.hostname=s+r.hostname}}}deserializeMetadata(r){return{httpStatusCode:r.statusCode,requestId:r.headers["x-amzn-requestid"]??r.headers["x-amzn-request-id"]??r.headers["x-amz-request-id"],extendedRequestId:r.headers["x-amz-id-2"],cfId:r.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:r,requestSchema:n,initialRequest:o}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:r,requestSchema:n,initialRequest:o})}async deserializeEventStream({response:r,responseSchema:n,initialResponseContainer:o}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:r,responseSchema:n,initialResponseContainer:o})}async loadEventStreamCapability(){let{EventStreamSerde:r}=await Promise.resolve().then(()=>(H6t(),V6t));return new r({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(r,n,o,i,a){return[]}getEventStreamMarshaller(){let r=this.serdeContext;if(!r.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return r.eventStreamMarshaller}}});var W6t=v(()=>{});var K5,J6t=v(()=>{Mg();Kre();V5e();uKe();K5=class extends ive{async serializeRequest(e,r,n){let o=this.serializer,i={},a={},s=await n.endpoint(),u=oa.of(e?.input),l=u.getSchema(),c,d=new BF({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:i,headers:a,body:void 0});s&&(this.updateServiceEndpoint(d,s),this.setHostPrefix(d,e,r));let f={...r};if(r){let p=u.getEventStreamMember();if(p){if(f[p]){let m={};for(let[h,y]of u.structIterator())h!==p&&f[h]&&(o.write(y,f[h]),m[h]=o.flush());c=await this.serializeEventStream({eventStream:f[p],requestSchema:u,initialRequest:m})}}else o.write(l,f),c=o.flush()}return d.headers=a,d.query=i,d.body=c,d.method="POST",d}async deserializeResponse(e,r,n){let o=this.deserializer,i=oa.of(e.output),a={};if(n.statusCode>=300){let u=await M1(n.body,r);throw u.byteLength>0&&Object.assign(a,await o.read(15,u)),await this.handleError(e,r,n,a,this.deserializeMetadata(n)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let u in n.headers){let l=n.headers[u];delete n.headers[u],n.headers[u.toLowerCase()]=l}let s=i.getEventStreamMember();if(s)a[s]=await this.deserializeEventStream({response:n,responseSchema:i,initialResponseContainer:a});else{let u=await M1(n.body,r);u.byteLength>0&&Object.assign(a,await o.read(i,u))}return a.$metadata=this.deserializeMetadata(n),a}}});var K6t=v(()=>{});var G6t=v(()=>{});function JF(t,e){if(e.timestampFormat.useTrait&&t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7))return t.getSchema();let{httpLabel:r,httpPrefixHeaders:n,httpHeader:o,httpQuery:i}=t.getMergedTraits();return(e.httpBindings?typeof n=="string"||o?6:i||r?5:void 0:void 0)??e.timestampFormat.default}var lKe=v(()=>{});var ave,X6t=v(()=>{Mg();WF();kO();aKe();nve();lKe();ave=class extends J5{constructor(r){super();x(this,"settings");this.settings=r}read(r,n){let o=oa.of(r);if(o.isListSchema())return j6t(n).map(i=>this.read(o.getValueSchema(),i));if(o.isBlobSchema())return(this.serdeContext?.base64Decoder??gw)(n);if(o.isTimestampSchema())switch(JF(o,this.settings)){case 5:return I6t(n);case 6:return A6t(n);case 7:return R6t(n);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",n),new Date(n)}if(o.isStringSchema()){let i=o.getMergedTraits().mediaType,a=n;if(i)return o.getMergedTraits().httpHeader&&(a=this.base64ToUtf8(a)),(i==="application/json"||i.endsWith("+json"))&&(a=WS.from(a)),a}return o.isNumericSchema()?Number(n):o.isBigIntegerSchema()?BigInt(n):o.isBigDecimalSchema()?new Rh(n,"bigDecimal"):o.isBooleanSchema()?String(n).toLowerCase()==="true":n}base64ToUtf8(r){return(this.serdeContext?.utf8Encoder??ove)((this.serdeContext?.base64Decoder??gw)(r))}}});var Z6t=v(()=>{});var Y6t=v(()=>{});var Q6t=v(()=>{});var KF=v(()=>{V5e();z3t();W6t();uKe();J6t();G6t();K6t();X6t();Z6t();Q6t();Y6t();lKe();nve()});var eJt=v(()=>{});function tJt(t,e,r){t.__smithy_context?t.__smithy_context.features||(t.__smithy_context.features={}):t.__smithy_context={features:{}},t.__smithy_context.features[e]=r}var rJt=v(()=>{});var G5,nJt=v(()=>{G5=class{constructor(e){x(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 oJt=v(()=>{});var iJt=v(()=>{});var X5,aJt=v(()=>{X5=class{async sign(e,r,n){return e}}});var sJt=v(()=>{oJt();iJt();aJt()});var gEn,uJt,cKe,lJt,cJt=v(()=>{gEn=t=>function(r){return cKe(r)&&r.expiration.getTime()-Date.now()<t},uJt=gEn(3e5),cKe=t=>t.expiration!==void 0,lJt=(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 dJt=v(()=>{nJt();sJt();cJt()});var UO=v(()=>{CWt();DWt();JWt();KWt();GWt();eJt();rJt();dJt()});function bEn(t){return t===void 0?!0:typeof t=="string"&&t.length<=50}function sve(t){let e=P1(t.userAgentAppId??yEn),{customUserAgent:r}=t;return Object.assign(t,{customUserAgent:typeof r=="string"?[[r]]:r,userAgentAppId:async()=>{let n=await e();if(!bEn(n)){let o=t.logger?.constructor?.name==="NoOpLogger"||!t.logger?console:t.logger;typeof n!="string"?o?.warn("userAgentAppId must be a string or undefined."):n.length>50&&o?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return n}})}var yEn,fJt=v(()=>{UO();yEn=void 0});var Z5,pJt=v(()=>{Z5=class{constructor({size:e,params:r}){x(this,"capacity");x(this,"data",new Map);x(this,"parameters",[]);this.capacity=e??50,r&&(this.parameters=r)}get(e,r){let n=this.hash(e);if(n===!1)return r();if(!this.data.has(n)){if(this.data.size>this.capacity+10){let o=this.data.keys(),i=0;for(;;){let{value:a,done:s}=o.next();if(this.data.delete(a),s||++i>10)break}}this.data.set(n,r())}return this.data.get(n)}size(){return this.data.size}hash(e){let r="",{parameters:n}=this;if(n.length===0)return!1;for(let o of n){let i=String(e[o]??"");if(i.includes("|;"))return!1;r+=i+"|;"}return r}}});var _En,ene,dKe=v(()=>{_En=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}$"),ene=t=>_En.test(t)||t.startsWith("[")&&t.endsWith("]")});var vEn,a2,fKe=v(()=>{vEn=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),a2=(t,e=!1)=>{if(!e)return vEn.test(t);let r=t.split(".");for(let n of r)if(!a2(n))return!1;return!0}});var I1,uve=v(()=>{I1={}});var A1,mJt=v(()=>{A1="endpoints"});function JS(t){return typeof t!="object"||t==null?t:"ref"in t?`$${JS(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(JS).join(", ")})`:JSON.stringify(t,null,2)}var hJt=v(()=>{});var tne=v(()=>{mJt();hJt()});var vl,gJt=v(()=>{vl=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var yJt=v(()=>{});var bJt=v(()=>{});var _Jt=v(()=>{});var vJt=v(()=>{});var wJt=v(()=>{});var SJt=v(()=>{});var KS=v(()=>{gJt();yJt();bJt();_Jt();vJt();wJt();SJt()});var CJt,xJt=v(()=>{CJt=(t,e)=>t===e});var TJt,OJt=v(()=>{KS();TJt=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 vl(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new vl(`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 lve,EJt=v(()=>{KS();OJt();lve=(t,e)=>TJt(e).reduce((r,n)=>{if(typeof r!="object")throw new vl(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var PJt,MJt=v(()=>{PJt=t=>t!=null});var RJt,IJt=v(()=>{RJt=t=>!t});var cve,pKe,AJt,NJt=v(()=>{cve=$(B5());dKe();pKe={[cve.EndpointURLScheme.HTTP]:80,[cve.EndpointURLScheme.HTTPS]:443},AJt=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:y={}}=t,g=new URL(`${m}//${f}${p?`:${p}`:""}${h}`);return g.search=Object.entries(y).map(([b,_])=>`${b}=${_}`).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(cve.EndpointURLScheme).includes(u))return null;let l=ene(o),c=r.includes(`${n}:${pKe[u]}`)||typeof t=="string"&&t.includes(`${n}:${pKe[u]}`),d=`${n}${c?`:${pKe[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var DJt,jJt=v(()=>{DJt=(t,e)=>t===e});var $Jt,LJt=v(()=>{$Jt=(t,e,r,n)=>e>=r||t.length<r?null:n?t.substring(t.length-r,t.length-e):t.substring(e,r)});var FJt,kJt=v(()=>{FJt=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var mKe=v(()=>{xJt();EJt();MJt();fKe();IJt();NJt();jJt();LJt();kJt()});var qJt,BJt=v(()=>{mKe();qJt={booleanEquals:CJt,getAttr:lve,isSet:PJt,isValidHostLabel:a2,not:RJt,parseURL:AJt,stringEquals:DJt,substring:$Jt,uriEncode:FJt}});var dve,hKe=v(()=>{mKe();dve=(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(lve(n[u],l))}else r.push(n[s]);o=a+1}return r.join("")}});var UJt,zJt=v(()=>{UJt=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var s2,fve,VJt,rne=v(()=>{KS();uve();BJt();hKe();zJt();s2=(t,e,r)=>{if(typeof t=="string")return dve(t,r);if(t.fn)return VJt.callFunction(t,r);if(t.ref)return UJt(t,r);throw new vl(`'${e}': ${String(t)} is not a string, function or reference.`)},fve=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:VJt.evaluateExpression(i,"arg",r)),o=t.split(".");return o[0]in I1&&o[1]!=null?I1[o[0]][o[1]](...n):qJt[t](...n)},VJt={evaluateExpression:s2,callFunction:fve}});var HJt=v(()=>{rne()});var WJt,JJt=v(()=>{tne();KS();HJt();WJt=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new vl(`'${t}' is already defined in Reference Record.`);let n=fve(e,r);return r.logger?.debug?.(`${A1} evaluateCondition: ${JS(e)} = ${JS(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var Y5,pve=v(()=>{tne();JJt();Y5=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=WJt(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${A1} assign: ${i.name} := ${JS(i.value)}`))}return{result:!0,referenceRecord:r}}});var KJt,GJt=v(()=>{KS();rne();KJt=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=s2(i,"Header value entry",e);if(typeof a!="string")throw new vl(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var gKe,XJt,ZJt,YJt=v(()=>{KS();hKe();gKe=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:ZJt.getEndpointProperty(o,e)}),{}),XJt=(t,e)=>{if(Array.isArray(t))return t.map(r=>XJt(r,e));switch(typeof t){case"string":return dve(t,e);case"object":if(t===null)throw new vl(`Unexpected endpoint property: ${t}`);return ZJt.getEndpointProperties(t,e);case"boolean":return t;default:throw new vl(`Unexpected endpoint property type: ${typeof t}`)}},ZJt={getEndpointProperty:XJt,getEndpointProperties:gKe}});var QJt,e5t=v(()=>{KS();rne();QJt=(t,e)=>{let r=s2(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 vl(`Endpoint URL must be a string, got ${typeof r}`)}});var t5t,r5t=v(()=>{tne();pve();GJt();YJt();e5t();t5t=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=Y5(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${A1} Resolving endpoint from template: ${JS(n)}`),{...l!=null&&{headers:KJt(l,a)},...u!=null&&{properties:gKe(u,a)},url:QJt(s,a)}}});var n5t,o5t=v(()=>{KS();pve();rne();n5t=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=Y5(r,e);if(o)throw new vl(s2(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var yKe,wEn,i5t,a5t=v(()=>{KS();pve();r5t();o5t();yKe=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=t5t(r,e);if(n)return n}else if(r.type==="error")n5t(r,e);else if(r.type==="tree"){let n=i5t.evaluateTreeRule(r,e);if(n)return n}else throw new vl(`Unknown endpoint rule: ${r}`);throw new vl("Rules evaluation failed")},wEn=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=Y5(r,e);if(o)return i5t.evaluateRules(n,{...e,referenceRecord:{...e.referenceRecord,...i}})},i5t={evaluateRules:yKe,evaluateTreeRule:wEn}});var s5t=v(()=>{uve();a5t()});var mve,u5t=v(()=>{tne();KS();s5t();mve=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${A1} Initial EndpointParams: ${JS(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 vl(`Missing required parameter: '${l}'`);let u=yKe(i,{endpointParams:r,logger:n,referenceRecord:{}});return e.logger?.debug?.(`${A1} Resolved endpoint: ${JS(u)}`),u}});var u2=v(()=>{pJt();dKe();fKe();uve();u5t();KS()});var bKe=v(()=>{u2()});var _Ke,l5t=v(()=>{u2();bKe();_Ke=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!_Ke(r))return!1;return!0}return!(!a2(t)||t.length<3||t.length>63||t!==t.toLowerCase()||ene(t))}});var c5t,SEn,d5t,f5t=v(()=>{c5t=":",SEn="/",d5t=t=>{let e=t.split(c5t);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join(c5t)==="")return null;let u=s.map(l=>l.split(SEn)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var m5t,p5t=v(()=>{m5t={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-east-2":{description:"Asia Pacific (Taipei)"},"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)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws 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)"},"mx-central-1":{description:"Mexico (Central)"},"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-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"EU (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso 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:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{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-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}],version:"1.1"}});var xEn,TEn,h5t,g5t,vKe=v(()=>{p5t();xEn=m5t,TEn="",h5t=t=>{let{partitions:e}=xEn;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}},g5t=()=>TEn});var nne,y5t=v(()=>{u2();l5t();f5t();vKe();nne={isVirtualHostableS3Bucket:_Ke,parseArn:d5t,partition:h5t};I1.aws=nne});function b5t(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 _5t=v(()=>{});var GF,hve=v(()=>{_5t();GF=t=>{if(typeof t=="string")return GF(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=b5t(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var v5t=v(()=>{});var w5t=v(()=>{});var S5t=v(()=>{});var C5t=v(()=>{});var x5t=v(()=>{});var T5t=v(()=>{});var O5t=v(()=>{});var E5t=v(()=>{});var P5t=v(()=>{S5t();C5t();x5t();T5t();O5t();E5t()});var gve=v(()=>{y5t();vKe();bKe();v5t();w5t();P5t()});var M5t=v(()=>{});var R5t=v(()=>{M5t()});var I5t=v(()=>{});var A5t=v(()=>{});var N5t=v(()=>{});function OEn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var yve,D5t=v(()=>{yve=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=OEn(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 j5t=v(()=>{});var $5t=v(()=>{});var L5t=v(()=>{});var F5t=v(()=>{R5t();I5t();A5t();N5t();D5t();j5t();$5t();L5t()});var k5t=v(()=>{});function Q5(t,e,r){return t.$source||(t.$source={}),t.$source[e]=r,t}var q5t=v(()=>{});function rx(t,e,r){t.__aws_sdk_context?t.__aws_sdk_context.features||(t.__aws_sdk_context.features={}):t.__aws_sdk_context={features:{}},t.__aws_sdk_context.features[e]=r}var B5t=v(()=>{});var U5t=v(()=>{});var bve=v(()=>{k5t();q5t();B5t();U5t()});var z5t=v(()=>{});var V5t=v(()=>{z5t()});var H5t=v(()=>{});var W5t=v(()=>{});var J5t=v(()=>{});function EEn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var XF,K5t=v(()=>{XF=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=EEn(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 _ve,G5t=v(()=>{_ve=class{constructor(e){x(this,"statusCode");x(this,"reason");x(this,"headers");x(this,"body");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 X5t=v(()=>{});var Z5t=v(()=>{});var one=v(()=>{V5t();H5t();W5t();J5t();K5t();G5t();X5t();Z5t()});var wKe,Y5t=v(()=>{one();wKe=t=>_ve.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var vve,SKe=v(()=>{vve=t=>new Date(Date.now()+t)});var Q5t,eKt=v(()=>{SKe();Q5t=(t,e)=>Math.abs(vve(e).getTime()-t)>=3e5});var CKe,tKt=v(()=>{eKt();CKe=(t,e)=>{let r=Date.parse(t);return Q5t(r,e)?r-Date.now():e}});var rKt=v(()=>{Y5t();SKe();tKt()});var ine,nKt,l2,oKt=v(()=>{one();rKt();ine=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},nKt=async t=>{let e=ine("context",t.context),r=ine("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await ine("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},l2=class{async sign(e,r,n){if(!XF.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await nKt(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:vve(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??wKe(r.$response);if(n){let o=ine("config",e.config),i=o.systemClockOffset;o.systemClockOffset=CKe(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=wKe(e);if(n){let o=ine("config",r.config);o.systemClockOffset=CKe(n,o.systemClockOffset)}}}});var iKt=v(()=>{});var aKt=v(()=>{});var sKt=v(()=>{});function lKt(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 xKe)e[r/2]=xKe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function GS(t){let e="";for(let r=0;r<t.byteLength;r++)e+=uKt[t[r]];return e}var uKt,xKe,eK=v(()=>{uKt={},xKe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),uKt[t]=e,xKe[e]=t}});var ane,TKe=v(()=>{ane=t=>new TextEncoder().encode(t)});var N1,cKt=v(()=>{TKe();N1=t=>typeof t=="string"?ane(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var wve,dKt=v(()=>{wve=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 ZF=v(()=>{TKe();cKt();dKt()});var fKt,pKt,OKe,mKt,hKt,EKe,PKe,MKe,RKe,PEn,gKt,yKt,sne,bKt,_Kt,vKt,wKt,Sve,SKt,CKt,xKt,IKe,TKt,YF=v(()=>{fKt="X-Amz-Algorithm",pKt="X-Amz-Credential",OKe="X-Amz-Date",mKt="X-Amz-SignedHeaders",hKt="X-Amz-Expires",EKe="X-Amz-Signature",PKe="X-Amz-Security-Token",MKe="authorization",RKe=OKe.toLowerCase(),PEn="date",gKt=[MKe,RKe,PEn],yKt=EKe.toLowerCase(),sne="x-amz-content-sha256",bKt=PKe.toLowerCase(),_Kt={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},vKt=/^proxy-/,wKt=/^sec-/,Sve="AWS4-HMAC-SHA256",SKt="AWS4-HMAC-SHA256-PAYLOAD",CKt="UNSIGNED-PAYLOAD",xKt=50,IKe="aws4_request",TKt=60*60*24*7});var Cve,AKe,xve,EKt,OKt,NKe=v(()=>{eK();ZF();YF();Cve={},AKe=[],xve=(t,e,r)=>`${t}/${e}/${r}/${IKe}`,EKt=async(t,e,r,n,o)=>{let i=await OKt(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${GS(i)}:${e.sessionToken}`;if(a in Cve)return Cve[a];for(AKe.push(a);AKe.length>xKt;)delete Cve[AKe.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,IKe])s=await OKt(t,s,u);return Cve[a]=s},OKt=(t,e,r)=>{let n=new t(e);return n.update(N1(r)),n.digest()}});var DKe,PKt=v(()=>{YF();DKe=({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 _Kt||e?.has(i)||vKt.test(i)||wKt.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var MKt,RKt=v(()=>{MKt=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var Tve,IKt=v(()=>{RKt();eK();ZF();YF();Tve=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===sne)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||MKt(e)){let n=new r;return n.update(N1(e)),GS(await n.digest())}return CKt}});function NKt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var Ove,AKt,MEn,jKe,DKt=v(()=>{eK();ZF();Ove=class{format(e){let r=[];for(let i of Object.keys(e)){let a=ane(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=ane(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(jKe.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!MEn.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(lKt(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"})(AKt||(AKt={}));MEn=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,jKe=class t{constructor(e){x(this,"bytes");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&&NKt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&NKt(e),parseInt(GS(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var jKt,$Kt=v(()=>{jKt=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var LKt,FKt=v(()=>{one();LKt=(t,e={})=>{let{headers:r,query:n={}}=XF.clone(t);for(let o of Object.keys(r)){let i=o.toLowerCase();(i.slice(0,6)==="x-amz-"&&!e.unhoistableHeaders?.has(i)||e.hoistableHeaders?.has(i))&&(n[o]=r[o],delete r[o])}return{...t,headers:r,query:n}}});var $Ke,kKt=v(()=>{one();YF();$Ke=t=>{t=XF.clone(t);for(let e of Object.keys(t.headers))gKt.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var Eve,qKt,BKt=v(()=>{Eve=$(Xre());YF();qKt=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t)){if(n.toLowerCase()===yKt)continue;let o=(0,Eve.escapeUri)(n);e.push(o);let i=t[n];typeof i=="string"?r[o]=`${o}=${(0,Eve.escapeUri)(i)}`:Array.isArray(i)&&(r[o]=i.slice(0).reduce((a,s)=>a.concat([`${o}=${(0,Eve.escapeUri)(s)}`]),[]).sort().join("&"))}return e.sort().map(n=>r[n]).filter(n=>n).join("&")}});var UKt,REn,zKt=v(()=>{UKt=t=>REn(t).toISOString().replace(/\.\d{3}Z$/,"Z"),REn=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var LKe,VKt,Pve,HKt=v(()=>{eK();LKe=$(VS()),VKt=$(Xre());ZF();BKt();zKt();Pve=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){x(this,"service");x(this,"regionProvider");x(this,"credentialProvider");x(this,"sha256");x(this,"uriEscapePath");x(this,"applyChecksum");this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=(0,LKe.normalizeProvider)(n),this.credentialProvider=(0,LKe.normalizeProvider)(r)}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${qKt(e)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}

${o.join(";")}
${n}`}async createStringToSign(e,r,n,o){let i=new this.sha256;i.update(N1(n));let a=await i.digest();return`${o}
${e}
${r}
${GS(a)}`}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(0,VKt.escapeUri)(n).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(e){let r=UKt(e).replace(/[\-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}}});var une,WKt=v(()=>{eK();ZF();YF();NKe();PKt();IKt();DKt();$Kt();FKt();kKt();HKt();une=class extends Pve{constructor({applyChecksum:r,credentials:n,region:o,service:i,sha256:a,uriEscapePath:s=!0}){super({applyChecksum:r,credentials:n,region:o,service:i,sha256:a,uriEscapePath:s});x(this,"headerFormatter",new Ove)}async presign(r,n={}){let{signingDate:o=new Date,expiresIn:i=3600,unsignableHeaders:a,unhoistableHeaders:s,signableHeaders:u,hoistableHeaders:l,signingRegion:c,signingService:d}=n,f=await this.credentialProvider();this.validateResolvedCredentials(f);let p=c??await this.regionProvider(),{longDate:m,shortDate:h}=this.formatDate(o);if(i>TKt)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let y=xve(h,p,d??this.service),g=LKt($Ke(r),{unhoistableHeaders:s,hoistableHeaders:l});f.sessionToken&&(g.query[PKe]=f.sessionToken),g.query[fKt]=Sve,g.query[pKt]=`${f.accessKeyId}/${y}`,g.query[OKe]=m,g.query[hKt]=i.toString(10);let b=DKe(g,a,u);return g.query[mKt]=this.getCanonicalHeaderList(b),g.query[EKe]=await this.getSignature(m,y,this.getSigningKey(f,p,h,d),this.createCanonicalRequest(g,b,await Tve(r,this.sha256))),g}async sign(r,n){return typeof r=="string"?this.signString(r,n):r.headers&&r.payload?this.signEvent(r,n):r.message?this.signMessage(r,n):this.signRequest(r,n)}async signEvent({headers:r,payload:n},{signingDate:o=new Date,priorSignature:i,signingRegion:a,signingService:s}){let u=a??await this.regionProvider(),{shortDate:l,longDate:c}=this.formatDate(o),d=xve(l,u,s??this.service),f=await Tve({headers:{},body:n},this.sha256),p=new this.sha256;p.update(r);let m=GS(await p.digest()),h=[SKt,c,d,i,m,f].join(`
`);return this.signString(h,{signingDate:o,signingRegion:u,signingService:s})}async signMessage(r,{signingDate:n=new Date,signingRegion:o,signingService:i}){return this.signEvent({headers:this.headerFormatter.format(r.message.headers),payload:r.message.body},{signingDate:n,signingRegion:o,signingService:i,priorSignature:r.priorSignature}).then(s=>({message:r.message,signature:s}))}async signString(r,{signingDate:n=new Date,signingRegion:o,signingService:i}={}){let a=await this.credentialProvider();this.validateResolvedCredentials(a);let s=o??await this.regionProvider(),{shortDate:u}=this.formatDate(n),l=new this.sha256(await this.getSigningKey(a,s,u,i));return l.update(N1(r)),GS(await l.digest())}async signRequest(r,{signingDate:n=new Date,signableHeaders:o,unsignableHeaders:i,signingRegion:a,signingService:s}={}){let u=await this.credentialProvider();this.validateResolvedCredentials(u);let l=a??await this.regionProvider(),c=$Ke(r),{longDate:d,shortDate:f}=this.formatDate(n),p=xve(f,l,s??this.service);c.headers[RKe]=d,u.sessionToken&&(c.headers[bKt]=u.sessionToken);let m=await Tve(c,this.sha256);!jKt(sne,c.headers)&&this.applyChecksum&&(c.headers[sne]=m);let h=DKe(c,i,o),y=await this.getSignature(d,p,this.getSigningKey(u,l,f,s),this.createCanonicalRequest(c,h,m));return c.headers[MKe]=`${Sve} Credential=${u.accessKeyId}/${p}, SignedHeaders=${this.getCanonicalHeaderList(h)}, Signature=${y}`,c}async getSignature(r,n,o,i){let a=await this.createStringToSign(r,n,i,Sve),s=new this.sha256(await o);return s.update(N1(a)),GS(await s.digest())}getSigningKey(r,n,o,i){return EKt(this.sha256,r,o,n,i||this.service)}}});var JKt=v(()=>{});var KKt=v(()=>{WKt();YF();NKe();JKt()});function IEn(t,{credentials:e,credentialDefaultProvider:r}){let n;return e?e?.memoized?n=e:n=lJt(e,uJt,cKe):r?n=P1(r(Object.assign({},t,{parentClientConfig:t}))):n=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},n.memoized=!0,n}function AEn(t,e){if(e.configBound)return e;let r=async n=>e({...n,callerClientConfig:t});return r.memoized=e.memoized,r.configBound=!0,r}var Mve,GKt=v(()=>{bve();UO();KKt();Mve=t=>{let e=t.credentials,r=!!t.credentials,n;Object.defineProperty(t,"credentials",{set(l){l&&l!==e&&l!==n&&(r=!0),e=l;let c=IEn(t,{credentials:e,credentialDefaultProvider:t.credentialDefaultProvider}),d=AEn(t,c);if(r&&!d.attributed){let f=typeof e=="object"&&e!==null;n=async p=>{let h=await d(p);return f&&(!h.$source||Object.keys(h.$source).length===0)?Q5(h,"CREDENTIALS_CODE","e"):h},n.memoized=d.memoized,n.configBound=d.configBound,n.attributed=!0}else n=d},get(){return n},enumerable:!0,configurable:!0}),t.credentials=e;let{signingEscapePath:o=!0,systemClockOffset:i=t.systemClockOffset||0,sha256:a}=t,s;return t.signer?s=P1(t.signer):t.regionInfoProvider?s=()=>P1(t.region)().then(async l=>[await t.regionInfoProvider(l,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},l]).then(([l,c])=>{let{signingRegion:d,signingService:f}=l;t.signingRegion=t.signingRegion||d||c,t.signingName=t.signingName||f||t.serviceId;let p={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:a,uriEscapePath:o},m=t.signerConstructor||une;return new m(p)}):s=async l=>{l=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await P1(t.region)(),properties:{}},l);let c=l.signingRegion,d=l.signingName;t.signingRegion=t.signingRegion||c,t.signingName=t.signingName||d||t.serviceId;let f={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:a,uriEscapePath:o},p=t.signerConstructor||une;return new p(f)},Object.assign(t,{systemClockOffset:i,signingEscapePath:o,signer:s})}});var XKt=v(()=>{oKt();aKt();sKt();GKt()});var ZKt=v(()=>{XKt();iKt()});var YKt,Rve,QKt=v(()=>{YKt=typeof TextEncoder=="function"?new TextEncoder:null,Rve=t=>{if(typeof t=="string"){if(YKt)return YKt.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 FKe=v(()=>{QKt()});var c2,QF,tK,e8t,t8t,r8t=v(()=>{c2=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},QF=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,tK=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>e8t[p.step]-e8t[f.step]||t8t[p.priority||"normal"]-t8t[f.priority||"normal"]),i=d=>{let f=!1,p=m=>{let h=c2(m.name,m.aliases);if(h.includes(d)){f=!0;for(let y of h)n.delete(y);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 c2(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(y=>{let g={...y,before:[],after:[]};for(let b of c2(g.name,g.aliases))m[b]=g;f.push(g)}),e.forEach(y=>{let g={...y,before:[],after:[]};for(let b of c2(g.name,g.aliases))m[b]=g;p.push(g)}),p.forEach(y=>{if(y.toMiddleware){let g=m[y.toMiddleware];if(g===void 0){if(d)return;throw new Error(`${y.toMiddleware} is not found when adding ${QF(y.name,y.aliases)} middleware ${y.relation} ${y.toMiddleware}`)}y.relation==="after"&&g.after.push(y),y.relation==="before"&&g.before.push(y)}}),o(f).map(u).reduce((y,g)=>(y.push(...g),y),[])},c={add:(d,f={})=>{let{name:p,override:m,aliases:h}=f,y={step:"initialize",priority:"normal",middleware:d,...f},g=c2(p,h);if(g.length>0){if(g.some(b=>n.has(b))){if(!m)throw new Error(`Duplicate middleware name '${QF(p,h)}'`);for(let b of g){let _=t.findIndex(T=>T.name===b||T.aliases?.some(O=>O===b));if(_===-1)continue;let w=t[_];if(w.step!==y.step||y.priority!==w.priority)throw new Error(`"${QF(w.name,w.aliases)}" middleware with ${w.priority} priority in ${w.step} step cannot be overridden by "${QF(p,h)}" middleware with ${y.priority} priority in ${y.step} step.`);t.splice(_,1)}}for(let b of g)n.add(b)}t.push(y)},addRelativeTo:(d,f)=>{let{name:p,override:m,aliases:h}=f,y={middleware:d,...f},g=c2(p,h);if(g.length>0){if(g.some(b=>n.has(b))){if(!m)throw new Error(`Duplicate middleware name '${QF(p,h)}'`);for(let b of g){let _=e.findIndex(T=>T.name===b||T.aliases?.some(O=>O===b));if(_===-1)continue;let w=e[_];if(w.toMiddleware!==y.toMiddleware||w.relation!==y.relation)throw new Error(`"${QF(w.name,w.aliases)}" middleware ${w.relation} "${w.toMiddleware}" middleware cannot be overridden by "${QF(p,h)}" middleware ${y.relation} "${y.toMiddleware}" middleware.`);e.splice(_,1)}}for(let b of g)n.add(b)}e.push(y)},clone:()=>s(tK()),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:y,aliases:g}=m;if(h&&h.includes(d)){let b=c2(y,g);for(let _ of b)n.delete(_);return f=!0,!1}return!0};return t=t.filter(p),e=e.filter(p),f},concat:d=>{let f=s(tK());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 QF(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},e8t={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},t8t={high:3,normal:2,low:1}});var kKe=v(()=>{r8t()});var d2,n8t=v(()=>{kKe();d2=class{constructor(e){x(this,"config");x(this,"middlewareStack",tK());x(this,"initConfig");x(this,"handlers");this.config=e;let{protocol:r,protocolSettings:n}=e;n&&typeof r=="function"&&(e.protocol=new r(n))}send(e,r,n){let o=typeof r!="function"?r:void 0,i=typeof r=="function"?r:n,a=o===void 0&&this.config.cacheMiddleware===!0,s;if(a){this.handlers||(this.handlers=new WeakMap);let u=this.handlers;u.has(e.constructor)?s=u.get(e.constructor):(s=e.resolveMiddleware(this.middlewareStack,this.config,o),u.set(e.constructor,s))}else delete this.handlers,s=e.resolveMiddleware(this.middlewareStack,this.config,o);if(i)s(e).then(u=>i(null,u.output),u=>i(u)).catch(()=>{});else return s(e).then(u=>u.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}});var o8t=v(()=>{KF()});function Ive(t,e){if(e==null)return e;let r=oa.of(t);if(r.getMergedTraits().sensitive)return qKe;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return qKe}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return qKe}else if(r.isStructSchema()&&typeof e=="object"){let n=e,o={};for(let[i,a]of r.structIterator())n[i]!=null&&(o[i]=Ive(a,n[i]));return o}return e}var qKe,i8t=v(()=>{Mg();qKe="***SensitiveInformation***"});var a8t,fn,BKe,s8t=v(()=>{kKe();a8t=$(B5());i8t();fn=class{constructor(){x(this,"middlewareStack",tK());x(this,"schema")}static classBuilder(){return new BKe}resolveMiddlewareWithContext(e,r,n,{middlewareFn:o,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,smithyContext:l,additionalContext:c,CommandCtor:d}){for(let y of o.bind(this)(d,e,r,n))this.middlewareStack.use(y);let f=e.concat(this.middlewareStack),{logger:p}=r,m={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,[a8t.SMITHY_CONTEXT_KEY]:{commandInstance:this,...l},...c},{requestHandler:h}=r;return f.resolve(y=>h.handle(y.request,n||{}),m)}},BKe=class{constructor(){x(this,"_init",()=>{});x(this,"_ep",{});x(this,"_middlewareFn",()=>[]);x(this,"_commandName","");x(this,"_clientName","");x(this,"_additionalContext",{});x(this,"_smithyContext",{});x(this,"_inputFilterSensitiveLog");x(this,"_outputFilterSensitiveLog");x(this,"_serializer",null);x(this,"_deserializer",null);x(this,"_operationSchema")}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}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){let e=this,r;return r=class extends fn{constructor(...[o]){super();x(this,"input");x(this,"serialize",e._serializer);x(this,"deserialize",e._deserializer);this.input=o??{},e._init(this),this.schema=e._operationSchema}static getEndpointParameterInstructions(){return e._ep}resolveMiddleware(o,i,a){let s=e._operationSchema,u=s?.[4]??s?.input,l=s?.[5]??s?.output;return this.resolveMiddlewareWithContext(o,i,a,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(s?Ive.bind(null,u):c=>c),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(s?Ive.bind(null,l):c=>c),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}});var u8t=v(()=>{});var Ave,l8t=v(()=>{Ave=(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 rK,UKe,c8t=v(()=>{rK=class t extends Error{constructor(r){super(r.message);x(this,"$fault");x(this,"$response");x(this,"$retryable");x(this,"$metadata");Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=r.name,this.$fault=r.$fault,this.$metadata=r.$metadata}static isInstance(r){if(!r)return!1;let n=r;return t.prototype.isPrototypeOf(n)||!!n.$fault&&!!n.$metadata&&(n.$fault==="client"||n.$fault==="server")}static[Symbol.hasInstance](r){if(!r)return!1;let n=r;return this===t?t.isInstance(r):t.isInstance(r)?n.name&&this.name?this.prototype.isPrototypeOf(r)||n.name===this.name:this.prototype.isPrototypeOf(r):!1}},UKe=(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 d8t=v(()=>{});var Nve,f8t=v(()=>{Nve=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 p8t=v(()=>{});var m8t=v(()=>{});var zKe,h8t,g8t,y8t=v(()=>{zKe=$(B5()),h8t=t=>{let e=[];for(let r in zKe.AlgorithmId){let n=zKe.AlgorithmId[r];t[n]!==void 0&&e.push({algorithmId:()=>n,checksumConstructor:()=>t[n]})}return{addChecksumAlgorithm(r){e.push(r)},checksumAlgorithms(){return e}}},g8t=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var b8t,_8t,v8t=v(()=>{b8t=t=>({setRetryStrategy(e){t.retryStrategy=e},retryStrategy(){return t.retryStrategy}}),_8t=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var Dve,jve,w8t=v(()=>{y8t();v8t();Dve=t=>Object.assign(h8t(t),b8t(t)),jve=t=>Object.assign(g8t(t),_8t(t))});var S8t=v(()=>{w8t()});var C8t=v(()=>{});var VKe,x8t=v(()=>{VKe=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]=VKe(t[r]));return t}});var T8t=v(()=>{});var ek,O8t=v(()=>{ek=class{trace(){}debug(){}info(){}warn(){}error(){}}});var E8t=v(()=>{});var P8t=v(()=>{});var M8t=v(()=>{});var R8t=v(()=>{});var Bo=v(()=>{n8t();o8t();s8t();u8t();l8t();d8t();f8t();p8t();c8t();m8t();S8t();C8t();x8t();T8t();O8t();E8t();P8t();M8t();R8t();WF()});var nK,HKe=v(()=>{Mg();Bo();nK=class{constructor(e=!1){x(this,"queryCompat");this.queryCompat=e}resolveRestContentType(e,r){let n=r.getMemberSchemas(),o=Object.values(n).find(i=>!!i.getMergedTraits().httpPayload);if(o){let i=o.getMergedTraits().mediaType;return i||(o.isStringSchema()?"text/plain":o.isBlobSchema()?"application/octet-stream":e)}else if(!r.isUnitSchema()&&Object.values(n).find(a=>{let{httpQuery:s,httpQueryParams:u,httpHeader:l,httpLabel:c,httpPrefixHeaders:d}=a.getMergedTraits();return!s&&!u&&!l&&!c&&d===void 0}))return e}async getErrorSchemaOrThrowBaseException(e,r,n,o,i,a){let s=r,u=e;e.includes("#")&&([s,u]=e.split("#"));let l={$metadata:i,$fault:n.statusCode<500?"client":"server"},c=Vs.for(s);try{return{errorSchema:a?.(c,u)??c.getSchema(e),errorMetadata:l}}catch{o.message=o.message??o.Message??"UnknownError";let f=Vs.for("smithy.ts.sdk.synthetic."+s),p=f.getBaseException();if(p){let m=f.getErrorCtor(p)??Error;throw this.decorateServiceException(Object.assign(new m({name:u}),l),o)}throw this.decorateServiceException(Object.assign(new Error(u),l),o)}}decorateServiceException(e,r={}){if(this.queryCompat){let n=e.Message??r.Message,o=UKe(e,r);n&&(o.message=n),o.Error={...o.Error,Type:o.Error.Type,Code:o.Error.Code,Message:o.Error.message??o.Error.Message??n};let i=o.$metadata.requestId;return i&&(o.RequestId=i),o}return UKe(e,r)}setQueryCompatError(e,r){let n=r.headers?.["x-amzn-query-error"];if(e!==void 0&&n!=null){let[o,i]=n.split(";"),a=Object.entries(e),s={Code:o,Type:i};Object.assign(e,s);for(let[u,l]of a)s[u==="message"?"Message":u]=l;delete s.__type,e.Error=s}}queryCompatOutput(e,r){e.Error&&(r.Error=e.Error),e.Type&&(r.Type=e.Type),e.Code&&(r.Code=e.Code)}findQueryCompatibleError(e,r){try{return e.getSchema(r)}catch{return e.find(o=>oa.of(o).getMergedTraits().awsQueryError?.[0]===r)}}}});var I8t=v(()=>{});var A8t=v(()=>{});var XS,oK=v(()=>{XS=class{constructor(){x(this,"serdeContext")}setSerdeContext(e){this.serdeContext=e}}});function*$ve(t,e){if(t.isUnitSchema())return;let r=t.getSchema();for(let n=0;n<r[4].length;++n){let o=r[4][n],i=r[5][n],a=new oa([i,0],o);!(o in e)&&!a.isIdempotencyToken()||(yield[o,a])}}function*N8t(t,e,r){if(t.isUnitSchema())return;let n=t.getSchema(),o=Object.keys(e).filter(i=>i!=="__type").length;for(let i=0;i<n[4].length&&o!==0;++i){let a=n[4][i],s=n[5][i],u=new oa([s,0],a),l=a;r&&(l=u.getMergedTraits()[r]??a),l in e&&(yield[a,u],o-=1)}}var Lve=v(()=>{Mg()});var iK,WKe=v(()=>{iK=class{constructor(e,r){x(this,"from");x(this,"to");x(this,"keys");this.from=e,this.to=r,this.keys=new Set(Object.keys(this.from).filter(n=>n!=="__type"))}mark(e){this.keys.delete(e)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){let e=this.keys.values().next().value,r=this.from[e];this.to.$unknown=[e,r]}}}});function D8t(t,e,r){if(r?.source){let n=r.source;if(typeof e=="number"&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER||n!==String(e)))return n.includes(".")?new Rh(n,"bigDecimal"):BigInt(n)}return e}var j8t=v(()=>{WF()});var $8t,L8t=v(()=>{Bo();ZF();$8t=(t,e)=>M1(t,e).then(r=>(e?.utf8Encoder??wve)(r))});var F8t,k8t,Fve=v(()=>{L8t();F8t=(t,e)=>$8t(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{}}),k8t=(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&&typeof e=="object"){let i=r(e,"code");if(i&&e[i]!==void 0)return n(e[i]);if(e.__type!==void 0)return n(e.__type)}}});var kve,JKe=v(()=>{KF();Mg();WF();kO();oK();Lve();WKe();j8t();Fve();kve=class extends XS{constructor(r){super();x(this,"settings");this.settings=r}async read(r,n){return this._read(r,typeof n=="string"?JSON.parse(n,D8t):await F8t(n,this.serdeContext))}readObject(r,n){return this._read(r,n)}_read(r,n){let o=n!==null&&typeof n=="object",i=oa.of(r);if(o){if(i.isStructSchema()){let s=i.isUnionSchema(),u={},l;s&&(l=new iK(n,u));for(let[c,d]of N8t(i,n,this.settings.jsonName?"jsonName":!1)){let f=this.settings.jsonName?d.getMergedTraits().jsonName??c:c;s&&l.mark(f),n[f]!=null&&(u[c]=this._read(d,n[f]))}return s&&l.writeUnknown(),u}if(Array.isArray(n)&&i.isListSchema()){let s=i.getValueSchema(),u=[],l=!!i.getMergedTraits().sparse;for(let c of n)(l||c!=null)&&u.push(this._read(s,c));return u}if(i.isMapSchema()){let s=i.getValueSchema(),u={},l=!!i.getMergedTraits().sparse;for(let[c,d]of Object.entries(n))(l||d!=null)&&(u[c]=this._read(s,d));return u}}if(i.isBlobSchema()&&typeof n=="string")return gw(n);let a=i.getMergedTraits().mediaType;if(i.isStringSchema()&&typeof n=="string"&&a)return a==="application/json"||a.endsWith("+json")?WS.from(n):n;if(i.isTimestampSchema()&&n!=null)switch(JF(i,this.settings)){case 5:return _6t(n);case 6:return v6t(n);case 7:return w6t(n);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",n),new Date(n)}if(i.isBigIntegerSchema()&&(typeof n=="number"||typeof n=="string"))return BigInt(n);if(i.isBigDecimalSchema()&&n!=null){if(n instanceof Rh)return n;let s=n;return s.type==="bigDecimal"&&"string"in s?new Rh(s.string,s.type):new Rh(String(n),"bigDecimal")}if(i.isNumericSchema()&&typeof n=="string"){switch(n){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return n}if(i.isDocumentSchema())if(o){let s=Array.isArray(n)?[]:{};for(let[u,l]of Object.entries(n))l instanceof Rh?s[u]=l:s[u]=this._read(i,l);return s}else return structuredClone(n);return n}}});var q8t,qve,B8t=v(()=>{WF();q8t="\u039D",qve=class{constructor(){x(this,"values",new Map);x(this,"counter",0);x(this,"stage",0)}createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(e,r)=>{if(r instanceof Rh){let n=`${q8t+"nv"+this.counter++}_`+r.string;return this.values.set(`"${n}"`,r.string),n}if(typeof r=="bigint"){let n=r.toString(),o=`${q8t+"b"+this.counter++}_`+n;return this.values.set(`"${o}"`,n),o}return r}}replaceInJson(e){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return e;for(let[r,n]of this.values)e=e.replace(r,n);return e}}});var Bve,KKe=v(()=>{KF();Mg();WF();kO();oK();Lve();B8t();Bve=class extends XS{constructor(r){super();x(this,"settings");x(this,"buffer");x(this,"useReplacer",!1);x(this,"rootSchema");this.settings=r}write(r,n){this.rootSchema=oa.of(r),this.buffer=this._write(this.rootSchema,n)}writeDiscriminatedDocument(r,n){this.write(r,n),typeof this.buffer=="object"&&(this.buffer.__type=oa.of(r).getName(!0))}flush(){let{rootSchema:r,useReplacer:n}=this;if(this.rootSchema=void 0,this.useReplacer=!1,r?.isStructSchema()||r?.isDocumentSchema()){if(!n)return JSON.stringify(this.buffer);let o=new qve;return o.replaceInJson(JSON.stringify(this.buffer,o.createReplacer(),0))}return this.buffer}_write(r,n,o){let i=n!==null&&typeof n=="object",a=oa.of(r);if(i){if(a.isStructSchema()){let s={};for(let[u,l]of $ve(a,n)){let c=this._write(l,n[u],a);if(c!==void 0){let d=l.getMergedTraits().jsonName,f=this.settings.jsonName?d??u:u;s[f]=c}}if(a.isUnionSchema()&&Object.keys(s).length===0){let{$unknown:u}=n;if(Array.isArray(u)){let[l,c]=u;s[l]=this._write(15,c)}}return s}if(Array.isArray(n)&&a.isListSchema()){let s=a.getValueSchema(),u=[],l=!!a.getMergedTraits().sparse;for(let c of n)(l||c!=null)&&u.push(this._write(s,c));return u}if(a.isMapSchema()){let s=a.getValueSchema(),u={},l=!!a.getMergedTraits().sparse;for(let[c,d]of Object.entries(n))(l||d!=null)&&(u[c]=this._write(s,d));return u}if(n instanceof Uint8Array&&(a.isBlobSchema()||a.isDocumentSchema()))return a===this.rootSchema?n:(this.serdeContext?.base64Encoder??yw)(n);if(n instanceof Date&&(a.isTimestampSchema()||a.isDocumentSchema()))switch(JF(a,this.settings)){case 5:return n.toISOString().replace(".000Z","Z");case 6:return rve(n);case 7:return n.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",n),n.getTime()/1e3}n instanceof Rh&&(this.useReplacer=!0)}if(!(n===null&&o?.isStructSchema())){if(a.isStringSchema()){if(typeof n>"u"&&a.isIdempotencyToken())return i2();let s=a.getMergedTraits().mediaType;return n!=null&&s&&(s==="application/json"||s.endsWith("+json"))?WS.from(n):n}if(typeof n=="number"&&a.isNumericSchema())return Math.abs(n)===1/0||isNaN(n)?String(n):n;if(typeof n=="string"&&a.isBlobSchema())return a===this.rootSchema?n:(this.serdeContext?.base64Encoder??yw)(n);if(typeof n=="bigint"&&(this.useReplacer=!0),a.isDocumentSchema())if(i){let s=Array.isArray(n)?[]:{};for(let[u,l]of Object.entries(n))l instanceof Rh?(this.useReplacer=!0,s[u]=l):s[u]=this._write(a,l);return s}else return structuredClone(n);return n}}}});var Uve,GKe=v(()=>{oK();JKe();KKe();Uve=class extends XS{constructor(r){super();x(this,"settings");this.settings=r}createSerializer(){let r=new Bve(this.settings);return r.setSerdeContext(this.serdeContext),r}createDeserializer(){let r=new kve(this.settings);return r.setSerdeContext(this.serdeContext),r}}});var zve,XKe=v(()=>{KF();Mg();HKe();GKe();Fve();zve=class extends K5{constructor({defaultNamespace:r,serviceTarget:n,awsQueryCompatible:o,jsonCodec:i}){super({defaultNamespace:r});x(this,"serializer");x(this,"deserializer");x(this,"serviceTarget");x(this,"codec");x(this,"mixin");x(this,"awsQueryCompatible");this.serviceTarget=n,this.codec=i??new Uve({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!o,this.mixin=new nK(this.awsQueryCompatible)}async serializeRequest(r,n,o){let i=await super.serializeRequest(r,n,o);return i.path.endsWith("/")||(i.path+="/"),Object.assign(i.headers,{"content-type":`application/x-amz-json-${this.getJsonRpcVersion()}`,"x-amz-target":`${this.serviceTarget}.${r.name}`}),this.awsQueryCompatible&&(i.headers["x-amzn-query-mode"]="true"),(VF(r.input)==="unit"||!i.body)&&(i.body="{}"),i}getPayloadCodec(){return this.codec}async handleError(r,n,o,i,a){this.awsQueryCompatible&&this.mixin.setQueryCompatError(i,o);let s=k8t(o,i)??"Unknown",{errorSchema:u,errorMetadata:l}=await this.mixin.getErrorSchemaOrThrowBaseException(s,this.options.defaultNamespace,o,i,a,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:void 0),c=oa.of(u),d=i.message??i.Message??"Unknown",f=Vs.for(u[1]).getErrorCtor(u)??Error,p=new f(d),m={};for(let[h,y]of c.structIterator())i[h]!=null&&(m[h]=this.codec.createDeserializer().readObject(y,i[h]));throw this.awsQueryCompatible&&this.mixin.queryCompatOutput(i,m),this.mixin.decorateServiceException(Object.assign(p,l,{$fault:c.getMergedTraits().error,message:d},m),i)}}});var U8t=v(()=>{});var Vve,z8t=v(()=>{XKe();Vve=class extends zve{constructor({defaultNamespace:e,serviceTarget:r,awsQueryCompatible:n,jsonCodec:o}){super({defaultNamespace:e,serviceTarget:r,awsQueryCompatible:n,jsonCodec:o})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}}});var V8t=v(()=>{});var H8t=v(()=>{});var W8t=v(()=>{});var J8t=v(()=>{});function YKe(t){ZKe||(ZKe=new DOMParser);let e=ZKe.parseFromString(t,"application/xml");if(e.getElementsByTagName("parsererror").length>0)throw new Error("DOMParser XML parsing error.");let r=n=>{if(n.nodeType===Node.TEXT_NODE&&n.textContent?.trim())return n.textContent;if(n.nodeType===Node.ELEMENT_NODE){let o=n;if(o.attributes.length===0&&o.childNodes.length===0)return"";let i={},a=Array.from(o.attributes);for(let u of a)i[`${u.name}`]=u.value;let s=Array.from(o.childNodes);for(let u of s){let l=r(u);if(l!=null){let c=u.nodeName;if(s.length===1&&a.length===0&&c==="#text")return l;i[c]?Array.isArray(i[c])?i[c].push(l):i[c]=[i[c],l]:i[c]=l}else if(s.length===1&&a.length===0)return o.textContent}return i}return null};return{[e.documentElement.nodeName]:r(e.documentElement)}}var ZKe,K8t=v(()=>{});var G8t=v(()=>{J8t();W8t();K8t()});var Hve,QKe=v(()=>{G8t();KF();Mg();Bo();ZF();oK();WKe();Hve=class extends XS{constructor(r){super();x(this,"settings");x(this,"stringDeserializer");this.settings=r,this.stringDeserializer=new ave(r)}setSerdeContext(r){this.serdeContext=r,this.stringDeserializer.setSerdeContext(r)}read(r,n,o){let i=oa.of(r),a=i.getMemberSchemas();if(i.isStructSchema()&&i.isMemberSchema()&&!!Object.values(a).find(c=>!!c.getMemberTraits().eventPayload)){let c={},d=Object.keys(a)[0];return a[d].isBlobSchema()?c[d]=n:c[d]=this.read(a[d],n),c}let u=(this.serdeContext?.utf8Encoder??wve)(n),l=this.parseXml(u);return this.readSchema(r,o?l[o]:l)}readSchema(r,n){let o=oa.of(r);if(o.isUnitSchema())return;let i=o.getMergedTraits();if(o.isListSchema()&&!Array.isArray(n))return this.readSchema(o,[n]);if(n==null)return n;if(typeof n=="object"){let a=!!i.sparse,s=!!i.xmlFlattened;if(o.isListSchema()){let l=o.getValueSchema(),c=[],d=l.getMergedTraits().xmlName??"member",f=s?n:(n[0]??n)[d],p=Array.isArray(f)?f:[f];for(let m of p)(m!=null||a)&&c.push(this.readSchema(l,m));return c}let u={};if(o.isMapSchema()){let l=o.getKeySchema(),c=o.getValueSchema(),d;s?d=Array.isArray(n)?n:[n]:d=Array.isArray(n.entry)?n.entry:[n.entry];let f=l.getMergedTraits().xmlName??"key",p=c.getMergedTraits().xmlName??"value";for(let m of d){let h=m[f],y=m[p];(y!=null||a)&&(u[h]=this.readSchema(c,y))}return u}if(o.isStructSchema()){let l=o.isUnionSchema(),c;l&&(c=new iK(n,u));for(let[d,f]of o.structIterator()){let p=f.getMergedTraits(),m=p.httpPayload?p.xmlName??f.getName():f.getMemberTraits().xmlName??d;l&&c.mark(m),n[m]!=null&&(u[d]=this.readSchema(f,n[m]))}return l&&c.writeUnknown(),u}if(o.isDocumentSchema())return n;throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${o.getName(!0)}`)}return o.isListSchema()?[]:o.isMapSchema()||o.isStructSchema()?{}:this.stringDeserializer.read(o,n)}parseXml(r){if(r.length){let n;try{n=YKe(r)}catch(s){throw s&&typeof s=="object"&&Object.defineProperty(s,"$responseBodyText",{value:r}),s}let o="#text",i=Object.keys(n)[0],a=n[i];return a[o]&&(a[i]=a[o],delete a[o]),VKe(a)}return{}}}});var Wve,X8t=v(()=>{KF();Mg();WF();Bo();kO();oK();Lve();Wve=class extends XS{constructor(r){super();x(this,"settings");x(this,"buffer");this.settings=r}write(r,n,o=""){this.buffer===void 0&&(this.buffer="");let i=oa.of(r);if(o&&!o.endsWith(".")&&(o+="."),i.isBlobSchema())(typeof n=="string"||n instanceof Uint8Array)&&(this.writeKey(o),this.writeValue((this.serdeContext?.base64Encoder??yw)(n)));else if(i.isBooleanSchema()||i.isNumericSchema()||i.isStringSchema())n!=null?(this.writeKey(o),this.writeValue(String(n))):i.isIdempotencyToken()&&(this.writeKey(o),this.writeValue(i2()));else if(i.isBigIntegerSchema())n!=null&&(this.writeKey(o),this.writeValue(String(n)));else if(i.isBigDecimalSchema())n!=null&&(this.writeKey(o),this.writeValue(n instanceof Rh?n.string:String(n)));else if(i.isTimestampSchema()){if(n instanceof Date)switch(this.writeKey(o),JF(i,this.settings)){case 5:this.writeValue(n.toISOString().replace(".000Z","Z"));break;case 6:this.writeValue(rve(n));break;case 7:this.writeValue(String(n.getTime()/1e3));break}}else if(i.isDocumentSchema())Array.isArray(n)?this.write(79,n,o):n instanceof Date?this.write(4,n,o):n instanceof Uint8Array?this.write(21,n,o):n&&typeof n=="object"?this.write(143,n,o):(this.writeKey(o),this.writeValue(String(n)));else if(i.isListSchema()){if(Array.isArray(n))if(n.length===0)this.settings.serializeEmptyLists&&(this.writeKey(o),this.writeValue(""));else{let a=i.getValueSchema(),s=this.settings.flattenLists||i.getMergedTraits().xmlFlattened,u=1;for(let l of n){if(l==null)continue;let c=this.getKey("member",a.getMergedTraits().xmlName),d=s?`${o}${u}`:`${o}${c}.${u}`;this.write(a,l,d),++u}}}else if(i.isMapSchema()){if(n&&typeof n=="object"){let a=i.getKeySchema(),s=i.getValueSchema(),u=i.getMergedTraits().xmlFlattened,l=1;for(let[c,d]of Object.entries(n)){if(d==null)continue;let f=this.getKey("key",a.getMergedTraits().xmlName),p=u?`${o}${l}.${f}`:`${o}entry.${l}.${f}`,m=this.getKey("value",s.getMergedTraits().xmlName),h=u?`${o}${l}.${m}`:`${o}entry.${l}.${m}`;this.write(a,c,p),this.write(s,d,h),++l}}}else if(i.isStructSchema()){if(n&&typeof n=="object"){let a=!1;for(let[s,u]of $ve(i,n)){if(n[s]==null&&!u.isIdempotencyToken())continue;let l=this.getKey(s,u.getMergedTraits().xmlName),c=`${o}${l}`;this.write(u,n[s],c),a=!0}if(!a&&i.isUnionSchema()){let{$unknown:s}=n;if(Array.isArray(s)){let[u,l]=s,c=`${o}${u}`;this.write(15,l,c)}}}}else if(!i.isUnitSchema())throw new Error(`@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ${i.getName(!0)}`)}flush(){if(this.buffer===void 0)throw new Error("@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.");let r=this.buffer;return delete this.buffer,r}getKey(r,n){let o=n??r;return this.settings.capitalizeKeys?o[0].toUpperCase()+o.slice(1):o}writeKey(r){r.endsWith(".")&&(r=r.slice(0,r.length-1)),this.buffer+=`&${H5e(r)}=`}writeValue(r){this.buffer+=H5e(r)}}});var Jve,Z8t=v(()=>{KF();Mg();HKe();QKe();X8t();Jve=class extends K5{constructor(r){super({defaultNamespace:r.defaultNamespace});x(this,"options");x(this,"serializer");x(this,"deserializer");x(this,"mixin",new nK);this.options=r;let n={timestampFormat:{useTrait:!0,default:5},httpBindings:!1,xmlNamespace:r.xmlNamespace,serviceNamespace:r.defaultNamespace,serializeEmptyLists:!0};this.serializer=new Wve(n),this.deserializer=new Hve(n)}getShapeId(){return"aws.protocols#awsQuery"}setSerdeContext(r){this.serializer.setSerdeContext(r),this.deserializer.setSerdeContext(r)}getPayloadCodec(){throw new Error("AWSQuery protocol has no payload codec.")}async serializeRequest(r,n,o){let i=await super.serializeRequest(r,n,o);i.path.endsWith("/")||(i.path+="/"),Object.assign(i.headers,{"content-type":"application/x-www-form-urlencoded"}),(VF(r.input)==="unit"||!i.body)&&(i.body="");let a=r.name.split("#")[1]??r.name;return i.body=`Action=${a}&Version=${this.options.version}`+i.body,i.body.endsWith("&")&&(i.body=i.body.slice(-1)),i}async deserializeResponse(r,n,o){let i=this.deserializer,a=oa.of(r.output),s={};if(o.statusCode>=300){let f=await M1(o.body,n);f.byteLength>0&&Object.assign(s,await i.read(15,f)),await this.handleError(r,n,o,s,this.deserializeMetadata(o))}for(let f in o.headers){let p=o.headers[f];delete o.headers[f],o.headers[f.toLowerCase()]=p}let u=r.name.split("#")[1]??r.name,l=a.isStructSchema()&&this.useNestedResult()?u+"Result":void 0,c=await M1(o.body,n);return c.byteLength>0&&Object.assign(s,await i.read(a,c,l)),{$metadata:this.deserializeMetadata(o),...s}}useNestedResult(){return!0}async handleError(r,n,o,i,a){let s=this.loadQueryErrorCode(o,i)??"Unknown",u=this.loadQueryError(i),l=this.loadQueryErrorMessage(i);u.message=l,u.Error={Type:u.Type,Code:u.Code,Message:l};let{errorSchema:c,errorMetadata:d}=await this.mixin.getErrorSchemaOrThrowBaseException(s,this.options.defaultNamespace,o,u,a,this.mixin.findQueryCompatibleError),f=oa.of(c),p=Vs.for(c[1]).getErrorCtor(c)??Error,m=new p(l),h={Type:u.Error.Type,Code:u.Error.Code,Error:u.Error};for(let[y,g]of f.structIterator()){let b=g.getMergedTraits().xmlName??y,_=u[b]??i[b];h[y]=this.deserializer.readSchema(g,_)}throw this.mixin.decorateServiceException(Object.assign(m,d,{$fault:f.getMergedTraits().error,message:l},h),i)}loadQueryErrorCode(r,n){let o=(n.Errors?.[0]?.Error??n.Errors?.Error??n.Error)?.Code;if(o!==void 0)return o;if(r.statusCode==404)return"NotFound"}loadQueryError(r){return r.Errors?.[0]?.Error??r.Errors?.Error??r.Error}loadQueryErrorMessage(r){let n=this.loadQueryError(r);return n?.message??n?.Message??r.message??r.Message??"Unknown"}getDefaultContentType(){return"application/x-www-form-urlencoded"}}});var Y8t=v(()=>{});var Q8t=v(()=>{});var eGt=v(()=>{});var tGt=v(()=>{});var rGt=v(()=>{});var Kve=v(()=>{I8t();A8t();U8t();z8t();XKe();V8t();GKe();JKe();KKe();H8t();Fve();Y8t();Z8t();rGt();tGt();QKe();eGt();Q8t()});var aK=v(()=>{bve();ZKt();Kve()});async function nGt(t,e,r){if(r.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&rx(t,"PROTOCOL_RPC_V2_CBOR","M"),typeof e.retryStrategy=="function"){let i=await e.retryStrategy();typeof i.acquireInitialRetryToken=="function"?i.constructor?.name?.includes("Adaptive")?rx(t,"RETRY_MODE_ADAPTIVE","F"):rx(t,"RETRY_MODE_STANDARD","E"):rx(t,"RETRY_MODE_LEGACY","D")}if(typeof e.accountIdEndpointMode=="function"){let i=t.endpointV2;switch(String(i?.url?.hostname).match(NEn)&&rx(t,"ACCOUNT_ID_ENDPOINT","O"),await e.accountIdEndpointMode?.()){case"disabled":rx(t,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":rx(t,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":rx(t,"ACCOUNT_ID_MODE_REQUIRED","R");break}}let o=t.__smithy_context?.selectedHttpAuthScheme?.identity;if(o?.$source){let i=o;i.accountId&&rx(t,"RESOLVED_ACCOUNT_ID","T");for(let[a,s]of Object.entries(i.$source??{}))rx(t,a,s)}}var NEn,oGt=v(()=>{aK();NEn=/\d{12}\.ddb/});var e8e,Gve,t8e,Xve,iGt,aGt,r8e,sGt=v(()=>{e8e="user-agent",Gve="x-amz-user-agent",t8e=" ",Xve="/",iGt=/[^!$%&'*+\-.^_`|~\w]/g,aGt=/[^!$%&'*+\-.^_`|~\w#]/g,r8e="-"});function uGt(t){let e="";for(let r in t){let n=t[r];if(e.length+n.length+1<=1024){e.length?e+=","+n:e+=n;continue}break}return e}var lGt=v(()=>{});var DEn,Zve,jEn,Yve,cGt=v(()=>{gve();F5t();oGt();sGt();lGt();DEn=t=>(e,r)=>async n=>{let{request:o}=n;if(!yve.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map(Zve)||[],s=(await t.defaultUserAgentProvider()).map(Zve);await nGt(r,t,n);let u=r;s.push(`m/${uGt(Object.assign({},r.__smithy_context?.features,u.__aws_sdk_context?.features))}`);let l=t?.customUserAgent?.map(Zve)||[],c=await t.userAgentAppId();c&&s.push(Zve(["app",`${c}`]));let d=g5t(),f=(d?[d]:[]).concat([...s,...a,...l]).join(t8e),p=[...s.filter(m=>m.startsWith("aws-sdk-")),...l].join(t8e);return t.runtime!=="browser"?(p&&(i[Gve]=i[Gve]?`${i[e8e]} ${p}`:p),i[e8e]=f):i[Gve]=f,e({...n,request:o})},Zve=t=>{let e=t[0].split(Xve).map(a=>a.replace(iGt,r8e)).join(Xve),r=t[1]?.replace(aGt,r8e),n=e.indexOf(Xve),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}`}},"")},jEn={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Yve=t=>({applyToStack:e=>{e.add(DEn(t),jEn)}})});var n8e=v(()=>{fJt();cGt()});var Qve,dGt=v(()=>{Qve=!1});var ewe,fGt=v(()=>{ewe=!1});var pGt=v(()=>{});var mGt=v(()=>{});var hGt=v(()=>{dGt();fGt();pGt();mGt()});var gGt=v(()=>{});var yGt,bGt,_Gt=v(()=>{u2();yGt=new Set,bGt=(t,e=a2)=>{if(!yGt.has(t)&&!e(t))if(t==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error(`Region not accepted: region="${t}" is not a valid hostname component.`);else yGt.add(t)}});var twe,o8e=v(()=>{twe=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var vGt,wGt=v(()=>{o8e();vGt=t=>twe(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var rwe,SGt=v(()=>{_Gt();wGt();o8e();rwe=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return Object.assign(t,{region:async()=>{let n=typeof e=="function"?await e():e,o=vGt(n);return bGt(o),o},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return twe(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}})}});var CGt=v(()=>{gGt();SGt()});var xGt=v(()=>{});var TGt=v(()=>{});var OGt=v(()=>{});var EGt=v(()=>{xGt();TGt();OGt()});var lne=v(()=>{hGt();CGt();EGt()});var PGt=v(()=>{});var MGt=v(()=>{PGt()});var RGt=v(()=>{});var IGt=v(()=>{});var AGt=v(()=>{});function $En(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var nwe,NGt=v(()=>{nwe=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=$En(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 DGt=v(()=>{});var jGt=v(()=>{});var $Gt=v(()=>{});var LGt=v(()=>{MGt();RGt();IGt();AGt();NGt();DGt();jGt();$Gt()});function LEn(t){return e=>async r=>{let n=r.request;if(nwe.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(FGt)===-1)try{let a=t(o);n.headers={...n.headers,[FGt]:String(a)}}catch{}}return e({...r,request:n})}}var FGt,FEn,owe,i8e=v(()=>{LGt();FGt="content-length";FEn={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},owe=t=>({applyToStack:e=>{e.add(LEn(t.bodyLengthChecker),FEn)}})});var kGt,kEn,qEn,BEn,UEn,zEn,qGt=v(()=>{kGt=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),zEn(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!UEn(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},kEn=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,qEn=/(\d+\.){3}\d+/,BEn=/\.\./,UEn=t=>kEn.test(t)&&!qEn.test(t)&&!BEn.test(t),zEn=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 BGt=v(()=>{qGt()});var UGt,zGt=v(()=>{UGt=(t,e,r,n=!1)=>{let o=async()=>{let i;return n?i=r.clientContextParams?.[t]??r[t]??r[e]:i=r[t]??r[e],typeof i=="function"?i():i};return t==="credentialScope"||e==="CredentialScope"?async()=>{let i=typeof r.credentials=="function"?await r.credentials():r.credentials;return i?.credentialScope??i?.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{let i=typeof r.credentials=="function"?await r.credentials():r.credentials;return i?.accountId??i?.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{if(r.isCustomEndpoint===!1)return;let i=await o();if(i&&typeof i=="object"){if("url"in i)return i.url.href;if("hostname"in i){let{protocol:a,hostname:s,port:u,path:l}=i;return`${a}//${s}${u?":"+u:""}${l}`}}return i}:o}});var iwe,a8e=v(()=>{iwe=async t=>{}});var awe,swe=v(()=>{hve();awe=t=>typeof t=="object"?"url"in t?GF(t.url):t:GF(t)});var VGt,VEn,s8e=v(()=>{BGt();zGt();a8e();swe();VGt=async(t,e,r,n)=>{if(!r.isCustomEndpoint){let a;r.serviceConfiguredEndpoint?a=await r.serviceConfiguredEndpoint():a=await iwe(r.serviceId),a&&(r.endpoint=()=>Promise.resolve(awe(a)),r.isCustomEndpoint=!0)}let o=await VEn(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},VEn=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 UGt(a.name,i,r,a.type!=="builtInParams")();break;case"operationContextParams":n[i]=a.get(t);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 kGt(n),n}});var HGt=v(()=>{s8e();swe()});var WGt,JGt,u8e=v(()=>{UO();WGt=$(VS());s8e();JGt=({config:t,instructions:e})=>(r,n)=>async o=>{t.isCustomEndpoint&&tJt(n,"ENDPOINT_OVERRIDE","N");let i=await VGt(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=(0,WGt.getSmithyContext)(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 HEn,Nn,KGt=v(()=>{N5e();u8e();HEn={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:B_e.name},Nn=(t,e)=>({applyToStack:r=>{r.addRelativeTo(JGt({config:t,instructions:e}),HEn)}})});var uwe,lwe,GGt=v(()=>{uwe=$(VS());a8e();swe();lwe=t=>{let e=t.tls??!0,{endpoint:r,useDualstackEndpoint:n,useFipsEndpoint:o}=t,i=r!=null?async()=>awe(await(0,uwe.normalizeProvider)(r)()):void 0,s=Object.assign(t,{endpoint:i,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:(0,uwe.normalizeProvider)(n??!1),useFipsEndpoint:(0,uwe.normalizeProvider)(o??!1)}),u;return s.serviceConfiguredEndpoint=async()=>(t.serviceId&&!u&&(u=iwe(t.serviceId)),u),s}});var XGt=v(()=>{});var ZGt=v(()=>{});var bu=v(()=>{HGt();u8e();KGt();GGt();XGt();ZGt()});var D1,j1,cne,cwe=v(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(D1||(D1={}));j1=3,cne=D1.STANDARD});var YGt,QGt,e9t,t9t,r9t,n9t=v(()=>{YGt=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],QGt=["TimeoutError","RequestTimeout","RequestTimeoutException"],e9t=[500,502,503,504],t9t=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],r9t=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"]});var WEn,JEn,KEn,dwe,fwe,o9t,l8e=v(()=>{n9t();WEn=t=>t?.$retryable!==void 0,JEn=t=>t.$metadata?.clockSkewCorrected,KEn=t=>{let e=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return t&&t instanceof TypeError?e.has(t.message):!1},dwe=t=>t.$metadata?.httpStatusCode===429||YGt.includes(t.name)||t.$retryable?.throttling==!0,fwe=(t,e=0)=>WEn(t)||JEn(t)||QGt.includes(t.name)||t9t.includes(t?.code||"")||r9t.includes(t?.code||"")||e9t.includes(t.$metadata?.httpStatusCode||0)||KEn(t)||t.cause!==void 0&&e<=10&&fwe(t.cause,e+1),o9t=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!fwe(t)}return!1}});var mwe,pwe,c8e=v(()=>{l8e();mwe=class mwe{constructor(e){x(this,"beta");x(this,"minCapacity");x(this,"minFillRate");x(this,"scaleConstant");x(this,"smooth");x(this,"currentCapacity",0);x(this,"enabled",!1);x(this,"lastMaxRate",0);x(this,"measuredTxRate",0);x(this,"requestCount",0);x(this,"fillRate");x(this,"lastThrottleTime");x(this,"lastTimestamp",0);x(this,"lastTxRateBucket");x(this,"maxCapacity");x(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=>mwe.setTimeoutFn(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(),dwe(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))}};x(mwe,"setTimeoutFn",setTimeout);pwe=mwe});var i9t,a9t,s9t=v(()=>{i9t="amz-sdk-invocation-id",a9t="amz-sdk-request"});var l9t,c9t=v(()=>{l9t=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var d8e,d9t=v(()=>{d8e=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var sK,f8e=v(()=>{cwe();c9t();d9t();sK=class{constructor(e){x(this,"maxAttempts");x(this,"mode",D1.STANDARD);x(this,"capacity",500);x(this,"retryBackoffStrategy",l9t());x(this,"maxAttemptsProvider");this.maxAttempts=e,this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return d8e({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,d8e({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 ${j1}`),j1}}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 hwe,f9t=v(()=>{cwe();c8e();f8e();hwe=class{constructor(e,r){x(this,"maxAttemptsProvider");x(this,"rateLimiter");x(this,"standardRetryStrategy");x(this,"mode",D1.ADAPTIVE);this.maxAttemptsProvider=e;let{rateLimiter:n}=r??{};this.rateLimiter=n??new pwe,this.standardRetryStrategy=new sK(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 p9t=v(()=>{});var m9t=v(()=>{});var dne=v(()=>{f9t();p9t();c8e();f8e();cwe();s9t();m9t()});var h9t=v(()=>{});var g9t=v(()=>{h9t()});var y9t=v(()=>{});var b9t=v(()=>{});var _9t=v(()=>{});function ZEn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var gwe,v9t=v(()=>{gwe=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=ZEn(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 ywe,w9t=v(()=>{ywe=class{constructor(e){x(this,"statusCode");x(this,"reason");x(this,"headers");x(this,"body");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 S9t=v(()=>{});var C9t=v(()=>{});var x9t=v(()=>{g9t();y9t();b9t();_9t();v9t();w9t();S9t();C9t()});var T9t=v(()=>{});var O9t=v(()=>{});var E9t,P9t=v(()=>{E9t=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 M9t=v(()=>{});var R9t=v(()=>{});var p8e,bwe,I9t=v(()=>{p8e=$(VS());dne();bwe=t=>{let{retryStrategy:e,retryMode:r,maxAttempts:n}=t,o=(0,p8e.normalizeProvider)(n??j1);return Object.assign(t,{maxAttempts:o,retryStrategy:async()=>e||(await(0,p8e.normalizeProvider)(r)()===D1.ADAPTIVE?new hwe(o):new sK(o))})}});var A9t=v(()=>{});var N9t,D9t=v(()=>{N9t=t=>t?.body instanceof ReadableStream});var YEn,QEn,ePn,tPn,rPn,_we,nPn,j9t=v(()=>{x9t();l8e();Bo();dne();rKe();D9t();P9t();YEn=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(QEn(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=gwe.isInstance(c);for(d&&(c.headers[i9t]=i2());;)try{d&&(c.headers[a9t]=`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=ePn(f);if(s=E9t(f),d&&N9t(c))throw(r.logger instanceof ek?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)},QEn=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",ePn=t=>{let e={error:t,errorType:tPn(t)},r=nPn(t.$response);return r&&(e.retryAfterHint=r),e},tPn=t=>dwe(t)?"THROTTLING":fwe(t)?"TRANSIENT":o9t(t)?"SERVER_ERROR":"CLIENT_ERROR",rPn={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},_we=t=>({applyToStack:e=>{e.add(YEn(t),rPn)}}),nPn=t=>{if(!ywe.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 m8e=v(()=>{R9t();M9t();I9t();T9t();A9t();O9t();j9t()});function oPn(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function vwe(t){return{schemeId:"smithy.api#noAuth"}}var fne,$9t,L9t,F9t,h8e=v(()=>{aK();fne=$(VS()),$9t=async(t,e,r)=>({operation:(0,fne.getSmithyContext)(e).operation,region:await(0,fne.normalizeProvider)(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});L9t=t=>{let e=[];switch(t.operation){case"GetCredentialsForIdentity":{e.push(vwe(t));break}case"GetId":{e.push(vwe(t));break}case"GetOpenIdToken":{e.push(vwe(t));break}case"UnlinkIdentity":{e.push(vwe(t));break}default:e.push(oPn(t))}return e},F9t=t=>{let e=Mve(t);return Object.assign(e,{authSchemePreference:(0,fne.normalizeProvider)(t.authSchemePreference??[])})}});var k9t,co,wl=v(()=>{k9t=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),co={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var B9t,q9t=v(()=>{B9t={name:"@aws-sdk/client-cognito-identity",description:"AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native",version:"3.968.0",scripts:{build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline client-cognito-identity","build:es":"tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"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":"yarn g:vitest run -c vitest.config.e2e.mts --mode development","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.mts","test:index":"tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"},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/core":"3.968.0","@aws-sdk/credential-provider-node":"3.968.0","@aws-sdk/middleware-host-header":"3.968.0","@aws-sdk/middleware-logger":"3.968.0","@aws-sdk/middleware-recursion-detection":"3.968.0","@aws-sdk/middleware-user-agent":"3.968.0","@aws-sdk/region-config-resolver":"3.968.0","@aws-sdk/types":"3.968.0","@aws-sdk/util-endpoints":"3.968.0","@aws-sdk/util-user-agent-browser":"3.968.0","@aws-sdk/util-user-agent-node":"3.968.0","@smithy/config-resolver":"^4.4.5","@smithy/core":"^3.20.3","@smithy/fetch-http-handler":"^5.3.8","@smithy/hash-node":"^4.2.7","@smithy/invalid-dependency":"^4.2.7","@smithy/middleware-content-length":"^4.2.7","@smithy/middleware-endpoint":"^4.4.4","@smithy/middleware-retry":"^4.4.20","@smithy/middleware-serde":"^4.2.8","@smithy/middleware-stack":"^4.2.7","@smithy/node-config-provider":"^4.3.7","@smithy/node-http-handler":"^4.4.7","@smithy/protocol-http":"^5.3.7","@smithy/smithy-client":"^4.10.5","@smithy/types":"^4.11.0","@smithy/url-parser":"^4.2.7","@smithy/util-base64":"^4.3.0","@smithy/util-body-length-browser":"^4.2.0","@smithy/util-body-length-node":"^4.2.1","@smithy/util-defaults-mode-browser":"^4.3.19","@smithy/util-defaults-mode-node":"^4.2.22","@smithy/util-endpoints":"^3.2.7","@smithy/util-middleware":"^4.2.7","@smithy/util-retry":"^4.2.7","@smithy/util-utf8":"^4.2.0",tslib:"^2.6.2"},devDependencies:{"@aws-sdk/client-iam":"3.968.0","@tsconfig/node20":"20.1.8","@types/chai":"^4.2.11","@types/node":"^20.14.8",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"5.0.10",typescript:"~5.8.3"},engines:{node:">=20.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 g8e,y8e,U9t,z9t=v(()=>{g8e={name:"SHA-256"},y8e={name:"HMAC",hash:g8e},U9t=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 uK(){return typeof window<"u"?window:typeof self<"u"?self:aPn}var aPn,b8e=v(()=>{aPn={}});var lK,_8e,v8e=v(()=>{lK=$(R_e());z9t();b8e();_8e=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,lK.isEmptyData)(e)){var r=(0,lK.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 uK().crypto.subtle.sign(y8e,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,lK.isEmptyData)(this.toHash)?Promise.resolve(U9t):Promise.resolve().then(function(){return uK().crypto.subtle.digest(g8e,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){uK().crypto.subtle.importKey("raw",(0,lK.convertToBuffer)(e.secret),y8e,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function V9t(t){if(uPn(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return lPn(e)}return!1}function uPn(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function lPn(t){return t&&sPn.every(function(e){return typeof t[e]=="function"})}var sPn,H9t=v(()=>{sPn=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var W9t=v(()=>{H9t()});var J9t,K9t,wwe,G9t=v(()=>{v8e();J9t=$(x5e());W9t();b8e();K9t=$(R_e()),wwe=function(){function t(e){V9t(uK())?this.hash=new _8e(e):this.hash=new J9t.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,K9t.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var w8e=v(()=>{G9t();v8e()});var Swe,X9t,S8e=v(()=>{Swe=({serviceId:t,clientVersion:e})=>async r=>{let n=typeof window<"u"?window.navigator:void 0,o=n?.userAgent??"",i=n?.userAgentData?.platform??X9t.os(o)??"other",a=void 0,s=n?.userAgentData?.brands??[],u=s[s.length-1],l=u?.brand??X9t.browser(o)??"unknown",c=u?.version??"unknown",d=[["aws-sdk-js",e],["ua","2.1"],[`os/${i}`,a],["lang/js"],["md/browser",`${l}_${c}`]];t&&d.push([`api/${t}`,e]);let f=await r?.userAgentAppId?.();return f&&d.push([`app/${f}`]),d},X9t={os(t){if(/iPhone|iPad|iPod/.test(t))return"iOS";if(/Macintosh|Mac OS X/.test(t))return"macOS";if(/Windows NT/.test(t))return"Windows";if(/Android/.test(t))return"Android";if(/Linux/.test(t))return"Linux"},browser(t){if(/EdgiOS|EdgA|Edg\//.test(t))return"Microsoft Edge";if(/Firefox\//.test(t))return"Firefox";if(/Chrome\//.test(t))return"Chrome";if(/Safari\//.test(t))return"Safari"}}});var Z9t=v(()=>{});var Cwe,Y9t=v(()=>{Cwe=t=>()=>Promise.reject(t)});var C8e=v(()=>{Z9t();Y9t()});var Q9t,e7t=v(()=>{Q9t=["in-region","cross-region","mobile","standard","legacy"]});var xwe,cPn,t7t=v(()=>{qF();e7t();xwe=({defaultsMode:t}={})=>aWt(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(cPn()?"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 ${Q9t.join(", ")}, got ${e}`)}}),cPn=()=>{let t=window?.navigator;if(t?.connection){let{effectiveType:e,rtt:r,downlink:n}=t?.connection;if(typeof e=="string"&&e!=="4g"||Number(r)>100||Number(n)<10)return!0}return t?.userAgentData?.mobile||typeof t?.maxTouchPoints=="number"&&t?.maxTouchPoints>1}});var x8e=v(()=>{t7t()});var r7t,n7t=v(()=>{r7t=t=>new TextEncoder().encode(t)});var o7t=v(()=>{});var i7t,a7t=v(()=>{i7t=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 s7t=v(()=>{n7t();o7t();a7t()});var y7t,Ny,Dy,dK,u7t,hne,cK,zO,$1,T8e,O8e,pne,l7t,c7t,d7t,b7t,_7t,Td,mne,f7t,v7t,p7t,m7t,h7t,g7t,dPn,w7t,S7t=v(()=>{y7t="required",Ny="fn",Dy="argv",dK="ref",u7t="isSet",hne="booleanEquals",cK="error",zO="endpoint",$1="tree",T8e="PartitionResult",O8e="getAttr",pne="stringEquals",l7t={[y7t]:!1,type:"string"},c7t={[y7t]:!0,default:!1,type:"boolean"},d7t={[dK]:"Endpoint"},b7t={[Ny]:hne,[Dy]:[{[dK]:"UseFIPS"},!0]},_7t={[Ny]:hne,[Dy]:[{[dK]:"UseDualStack"},!0]},Td={},mne={[dK]:"Region"},f7t={[Ny]:O8e,[Dy]:[{[dK]:T8e},"supportsFIPS"]},v7t={[dK]:T8e},p7t={[Ny]:hne,[Dy]:[!0,{[Ny]:O8e,[Dy]:[v7t,"supportsDualStack"]}]},m7t=[b7t],h7t=[_7t],g7t=[mne],dPn={version:"1.0",parameters:{Region:l7t,UseDualStack:c7t,UseFIPS:c7t,Endpoint:l7t},rules:[{conditions:[{[Ny]:u7t,[Dy]:[d7t]}],rules:[{conditions:m7t,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:cK},{conditions:h7t,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:cK},{endpoint:{url:d7t,properties:Td,headers:Td},type:zO}],type:$1},{conditions:[{[Ny]:u7t,[Dy]:g7t}],rules:[{conditions:[{[Ny]:"aws.partition",[Dy]:g7t,assign:T8e}],rules:[{conditions:[b7t,_7t],rules:[{conditions:[{[Ny]:hne,[Dy]:[!0,f7t]},p7t],rules:[{conditions:[{[Ny]:pne,[Dy]:[mne,"us-east-1"]}],endpoint:{url:"https://cognito-identity-fips.us-east-1.amazonaws.com",properties:Td,headers:Td},type:zO},{conditions:[{[Ny]:pne,[Dy]:[mne,"us-east-2"]}],endpoint:{url:"https://cognito-identity-fips.us-east-2.amazonaws.com",properties:Td,headers:Td},type:zO},{conditions:[{[Ny]:pne,[Dy]:[mne,"us-west-1"]}],endpoint:{url:"https://cognito-identity-fips.us-west-1.amazonaws.com",properties:Td,headers:Td},type:zO},{conditions:[{[Ny]:pne,[Dy]:[mne,"us-west-2"]}],endpoint:{url:"https://cognito-identity-fips.us-west-2.amazonaws.com",properties:Td,headers:Td},type:zO},{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Td,headers:Td},type:zO}],type:$1},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:cK}],type:$1},{conditions:m7t,rules:[{conditions:[{[Ny]:hne,[Dy]:[f7t,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Td,headers:Td},type:zO}],type:$1},{error:"FIPS is enabled but this partition does not support FIPS",type:cK}],type:$1},{conditions:h7t,rules:[{conditions:[p7t],rules:[{conditions:[{[Ny]:pne,[Dy]:["aws",{[Ny]:O8e,[Dy]:[v7t,"name"]}]}],endpoint:{url:"https://cognito-identity.{Region}.amazonaws.com",properties:Td,headers:Td},type:zO},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Td,headers:Td},type:zO}],type:$1},{error:"DualStack is enabled but this partition does not support DualStack",type:cK}],type:$1},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:Td,headers:Td},type:zO}],type:$1}],type:$1},{error:"Invalid Configuration: Missing Region",type:cK}]},w7t=dPn});var fPn,C7t,x7t=v(()=>{gve();u2();S7t();fPn=new Z5({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),C7t=(t,e={})=>fPn.get(t,()=>mve(w7t,{endpointParams:t,logger:e.logger}));I1.aws=nne});var T7t,O7t=v(()=>{aK();Kve();UO();Bo();hve();kO();s7t();h8e();x7t();T7t=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??gw,base64Encoder:t?.base64Encoder??yw,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??C7t,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??L9t,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new l2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new X5}],logger:t?.logger??new ek,protocol:t?.protocol??Vve,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.cognitoidentity",xmlNamespace:"http://cognito-identity.amazonaws.com/doc/2014-06-30/",version:"2014-06-30",serviceTarget:"AWSCognitoIdentityService"},serviceId:t?.serviceId??"Cognito Identity",urlParser:t?.urlParser??GF,utf8Decoder:t?.utf8Decoder??r7t,utf8Encoder:t?.utf8Encoder??i7t})});var E7t,P7t=v(()=>{q9t();w8e();S8e();lne();Zre();C8e();Bo();FKe();x8e();dne();O7t();E7t=t=>{let e=xwe(t),r=()=>e().then(Nve),n=T7t(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??Rve,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??Swe({serviceId:n.serviceId,clientVersion:B9t.version}),maxAttempts:t?.maxAttempts??j1,region:t?.region??Cwe("Region is missing"),requestHandler:zF.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||cne),sha256:t?.sha256??wwe,streamCollector:t?.streamCollector??V5,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(Qve)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(ewe))}}});var Twe,Owe,M7t=v(()=>{Twe=t=>({setRegion(e){t.region=e},region(){return t.region}}),Owe=t=>({region:t.region()})});var R7t=v(()=>{});function I7t(){return async()=>"us-east-1"}var A7t=v(()=>{});var Ewe=v(()=>{M7t();R7t();A7t()});var N7t,D7t,j7t=v(()=>{N7t=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),D7t=t=>({httpHandler:t.httpHandler()})});var $7t=v(()=>{j7t()});var L7t=v(()=>{});var F7t=v(()=>{});var k7t=v(()=>{});var q7t=v(()=>{});var B7t=v(()=>{});var U7t=v(()=>{});var z7t=v(()=>{});var V7t=v(()=>{$7t();L7t();F7t();k7t();q7t();B7t();U7t();z7t()});var H7t,W7t,J7t=v(()=>{H7t=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}}},W7t=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var K7t,G7t=v(()=>{Ewe();V7t();Bo();J7t();K7t=(t,e)=>{let r=Object.assign(Twe(t),Dve(t),N7t(t),H7t(t));return e.forEach(n=>n.configure(r)),Object.assign(t,Owe(r),jve(r),D7t(r),W7t(r))}});var tk,Pwe=v(()=>{E5e();P5e();R5e();n8e();lne();UO();Mg();i8e();bu();m8e();Bo();h8e();wl();P7t();G7t();tk=class extends d2{constructor(...[r]){let n=E7t(r||{});super(n);x(this,"config");this.initConfig=n;let o=k9t(n),i=sve(o),a=bwe(i),s=rwe(a),u=s,l=lwe(u),c=F9t(l),d=K7t(c,r?.extensions||[]);this.config=d,this.middlewareStack.use(J_e(this.config)),this.middlewareStack.use(Yve(this.config)),this.middlewareStack.use(_we(this.config)),this.middlewareStack.use(owe(this.config)),this.middlewareStack.use(L_e(this.config)),this.middlewareStack.use(F_e(this.config)),this.middlewareStack.use(k_e(this.config)),this.middlewareStack.use(q_e(this.config,{httpAuthSchemeParametersProvider:$9t,identityProviderConfigProvider:async f=>new G5({"aws.auth#sigv4":f.credentials})})),this.middlewareStack.use(U_e(this.config))}destroy(){super.destroy()}}});var jy,E8e=v(()=>{Bo();jy=class t extends rK{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var Mwe,Rwe,Iwe,Awe,Nwe,Dwe,jwe,$we,Lwe,Fwe,kwe,P8e=v(()=>{E8e();Mwe=class t extends jy{constructor(r){super({name:"InternalErrorException",$fault:"server",...r});x(this,"name","InternalErrorException");x(this,"$fault","server");Object.setPrototypeOf(this,t.prototype)}},Rwe=class t extends jy{constructor(r){super({name:"InvalidParameterException",$fault:"client",...r});x(this,"name","InvalidParameterException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Iwe=class t extends jy{constructor(r){super({name:"LimitExceededException",$fault:"client",...r});x(this,"name","LimitExceededException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Awe=class t extends jy{constructor(r){super({name:"NotAuthorizedException",$fault:"client",...r});x(this,"name","NotAuthorizedException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Nwe=class t extends jy{constructor(r){super({name:"ResourceConflictException",$fault:"client",...r});x(this,"name","ResourceConflictException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Dwe=class t extends jy{constructor(r){super({name:"TooManyRequestsException",$fault:"client",...r});x(this,"name","TooManyRequestsException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},jwe=class t extends jy{constructor(r){super({name:"ResourceNotFoundException",$fault:"client",...r});x(this,"name","ResourceNotFoundException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},$we=class t extends jy{constructor(r){super({name:"ExternalServiceException",$fault:"client",...r});x(this,"name","ExternalServiceException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Lwe=class t extends jy{constructor(r){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...r});x(this,"name","InvalidIdentityPoolConfigurationException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Fwe=class t extends jy{constructor(r){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...r});x(this,"name","DeveloperUserAlreadyRegisteredException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},kwe=class t extends jy{constructor(r){super({name:"ConcurrentModificationException",$fault:"client",...r});x(this,"name","ConcurrentModificationException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}}});var X7t,mPn,hPn,gPn,Z7t,Y7t,yPn,bPn,_Pn,vPn,wPn,Q7t,SPn,CPn,xPn,TPn,OPn,EPn,PPn,MPn,RPn,IPn,APn,NPn,DPn,Bwe,jPn,eXt,$Pn,LPn,FPn,kPn,qPn,BPn,UPn,zPn,VPn,HPn,WPn,JPn,KPn,GPn,XPn,ZPn,YPn,QPn,eMn,tMn,rMn,nMn,oMn,iMn,aMn,sMn,uMn,kb,lMn,cMn,dMn,fMn,pMn,Ih,mMn,M8e,Uwe,hMn,gMn,tXt,yMn,fK,bMn,_Mn,vMn,wMn,SMn,CMn,xMn,TMn,OMn,EMn,PMn,MMn,RMn,IMn,AMn,NMn,DMn,jMn,$Mn,R8e,LMn,FMn,kMn,qMn,pK,rXt,BMn,UMn,zwe,nXt,I8e,zMn,VMn,HMn,WMn,oXt,JMn,KMn,GMn,XMn,ZMn,YMn,QMn,eRn,iXt,aXt,tRn,rRn,nRn,oRn,iRn,aRn,sXt,sRn,uRn,lRn,cRn,dRn,fRn,uXt,pRn,A8e,mRn,hRn,gRn,yRn,bRn,_Rn,vRn,wRn,SRn,CRn,xRn,TRn,VO,nx,HO,ox,ORn,lXt,rt,ERn,cXt,PRn,MRn,RRn,IRn,ARn,NRn,DRn,jRn,$Rn,LRn,FRn,kRn,qRn,BRn,URn,zRn,VRn,HRn,WRn,JRn,KRn,GRn,XRn,ZRn,dXt,qwe,YRn,QRn,eIn,tIn,rIn,nIn,oIn,iIn,aIn,sIn,uIn,lIn,cIn,dIn,fIn,pIn,mIn,hIn,gIn,yIn,bIn,_In,vIn,wIn,SIn,CIn,xIn,TIn,OIn,EIn,PIn,MIn,Vwe,RIn,fXt,IIn,AIn,NIn,DIn,gne,pXt,mXt,hXt,gXt,yXt,bXt,_Xt,vXt,wXt,SXt,CXt,xXt,TXt,OXt,EXt,PXt,MXt,RXt,IXt,AXt,NXt,DXt,jXt,$Xt,Sl=v(()=>{Mg();E8e();P8e();X7t="AllowClassicFlow",mPn="AccountId",hPn="AccessKeyId",gPn="AmbiguousRoleResolution",Z7t="AllowUnauthenticatedIdentities",Y7t="Credentials",yPn="CreationDate",bPn="ClientId",_Pn="CognitoIdentityProvider",vPn="CreateIdentityPoolInput",wPn="CognitoIdentityProviderList",Q7t="CognitoIdentityProviders",SPn="CreateIdentityPool",CPn="ConcurrentModificationException",xPn="CustomRoleArn",TPn="Claim",OPn="DeleteIdentities",EPn="DeleteIdentitiesInput",PPn="DescribeIdentityInput",MPn="DeleteIdentityPool",RPn="DeleteIdentityPoolInput",IPn="DescribeIdentityPoolInput",APn="DescribeIdentityPool",NPn="DeleteIdentitiesResponse",DPn="DescribeIdentity",Bwe="DeveloperProviderName",jPn="DeveloperUserAlreadyRegisteredException",eXt="DeveloperUserIdentifier",$Pn="DeveloperUserIdentifierList",LPn="DestinationUserIdentifier",FPn="Expiration",kPn="ErrorCode",qPn="ExternalServiceException",BPn="GetCredentialsForIdentity",UPn="GetCredentialsForIdentityInput",zPn="GetCredentialsForIdentityResponse",VPn="GetId",HPn="GetIdInput",WPn="GetIdentityPoolRoles",JPn="GetIdentityPoolRolesInput",KPn="GetIdentityPoolRolesResponse",GPn="GetIdResponse",XPn="GetOpenIdToken",ZPn="GetOpenIdTokenForDeveloperIdentity",YPn="GetOpenIdTokenForDeveloperIdentityInput",QPn="GetOpenIdTokenForDeveloperIdentityResponse",eMn="GetOpenIdTokenInput",tMn="GetOpenIdTokenResponse",rMn="GetPrincipalTagAttributeMap",nMn="GetPrincipalTagAttributeMapInput",oMn="GetPrincipalTagAttributeMapResponse",iMn="HideDisabled",aMn="Identities",sMn="IdentityDescription",uMn="InternalErrorException",kb="IdentityId",lMn="InvalidIdentityPoolConfigurationException",cMn="IdentityIdsToDelete",dMn="IdentitiesList",fMn="IdentityPool",pMn="InvalidParameterException",Ih="IdentityPoolId",mMn="IdentityPoolsList",M8e="IdentityPoolName",Uwe="IdentityProviderName",hMn="IdentityPoolShortDescription",gMn="IdentityProviderToken",tXt="IdentityPoolTags",yMn="IdentityPools",fK="Logins",bMn="LookupDeveloperIdentity",_Mn="LookupDeveloperIdentityInput",vMn="LookupDeveloperIdentityResponse",wMn="LimitExceededException",SMn="ListIdentities",CMn="ListIdentitiesInput",xMn="ListIdentityPools",TMn="ListIdentityPoolsInput",OMn="ListIdentityPoolsResponse",EMn="ListIdentitiesResponse",PMn="LoginsMap",MMn="LastModifiedDate",RMn="ListTagsForResource",IMn="ListTagsForResourceInput",AMn="ListTagsForResourceResponse",NMn="LoginsToRemove",DMn="MergeDeveloperIdentities",jMn="MergeDeveloperIdentitiesInput",$Mn="MergeDeveloperIdentitiesResponse",R8e="MaxResults",LMn="MappingRulesList",FMn="MappingRule",kMn="MatchType",qMn="NotAuthorizedException",pK="NextToken",rXt="OpenIdConnectProviderARNs",BMn="OIDCToken",UMn="ProviderName",zwe="PrincipalTags",nXt="Roles",I8e="ResourceArn",zMn="RoleARN",VMn="RulesConfiguration",HMn="ResourceConflictException",WMn="RulesConfigurationType",oXt="RoleMappings",JMn="RoleMappingMap",KMn="RoleMapping",GMn="ResourceNotFoundException",XMn="Rules",ZMn="SetIdentityPoolRoles",YMn="SetIdentityPoolRolesInput",QMn="SecretKey",eRn="SecretKeyString",iXt="SupportedLoginProviders",aXt="SamlProviderARNs",tRn="SetPrincipalTagAttributeMap",rRn="SetPrincipalTagAttributeMapInput",nRn="SetPrincipalTagAttributeMapResponse",oRn="ServerSideTokenCheck",iRn="SessionToken",aRn="SourceUserIdentifier",sXt="Token",sRn="TokenDuration",uRn="TagKeys",lRn="TooManyRequestsException",cRn="TagResource",dRn="TagResourceInput",fRn="TagResourceResponse",uXt="Tags",pRn="Type",A8e="UseDefaults",mRn="UnlinkDeveloperIdentity",hRn="UnlinkDeveloperIdentityInput",gRn="UnlinkIdentity",yRn="UnprocessedIdentityIds",bRn="UnprocessedIdentityIdList",_Rn="UnlinkIdentityInput",vRn="UnprocessedIdentityId",wRn="UpdateIdentityPool",SRn="UntagResource",CRn="UntagResourceInput",xRn="UntagResourceResponse",TRn="Value",VO="client",nx="error",HO="httpError",ox="message",ORn="server",lXt="smithy.ts.sdk.synthetic.com.amazonaws.cognitoidentity",rt="com.amazonaws.cognitoidentity",ERn=[0,rt,gMn,8,0],cXt=[0,rt,BMn,8,0],PRn=[0,rt,eRn,8,0],MRn=[3,rt,_Pn,0,[UMn,bPn,oRn],[0,0,2]],RRn=[-3,rt,CPn,{[nx]:VO,[HO]:400},[ox],[0]];Vs.for(rt).registerError(RRn,kwe);IRn=[3,rt,vPn,0,[M8e,Z7t,X7t,iXt,Bwe,rXt,Q7t,aXt,tXt],[0,2,2,128,0,64,()=>fXt,64,128]],ARn=[3,rt,Y7t,0,[hPn,QMn,iRn,FPn],[0,[()=>PRn,0],0,4]],NRn=[3,rt,EPn,0,[cMn],[64]],DRn=[3,rt,NPn,0,[yRn],[()=>DIn]],jRn=[3,rt,RPn,0,[Ih],[0]],$Rn=[3,rt,PPn,0,[kb],[0]],LRn=[3,rt,IPn,0,[Ih],[0]],FRn=[-3,rt,jPn,{[nx]:VO,[HO]:400},[ox],[0]];Vs.for(rt).registerError(FRn,Fwe);kRn=[-3,rt,qPn,{[nx]:VO,[HO]:400},[ox],[0]];Vs.for(rt).registerError(kRn,$we);qRn=[3,rt,UPn,0,[kb,fK,xPn],[0,[()=>gne,0],0]],BRn=[3,rt,zPn,0,[kb,Y7t],[0,[()=>ARn,0]]],URn=[3,rt,JPn,0,[Ih],[0]],zRn=[3,rt,KPn,0,[Ih,nXt,oXt],[0,128,()=>pXt]],VRn=[3,rt,HPn,0,[mPn,Ih,fK],[0,0,[()=>gne,0]]],HRn=[3,rt,GPn,0,[kb],[0]],WRn=[3,rt,YPn,0,[Ih,kb,fK,zwe,sRn],[0,0,[()=>gne,0],128,1]],JRn=[3,rt,QPn,0,[kb,sXt],[0,[()=>cXt,0]]],KRn=[3,rt,eMn,0,[kb,fK],[0,[()=>gne,0]]],GRn=[3,rt,tMn,0,[kb,sXt],[0,[()=>cXt,0]]],XRn=[3,rt,nMn,0,[Ih,Uwe],[0,0]],ZRn=[3,rt,oMn,0,[Ih,Uwe,A8e,zwe],[0,0,2,128]],dXt=[3,rt,sMn,0,[kb,fK,yPn,MMn],[0,64,4,4]],qwe=[3,rt,fMn,0,[Ih,M8e,Z7t,X7t,iXt,Bwe,rXt,Q7t,aXt,tXt],[0,0,2,2,128,0,64,()=>fXt,64,128]],YRn=[3,rt,hMn,0,[Ih,M8e],[0,0]],QRn=[-3,rt,uMn,{[nx]:ORn},[ox],[0]];Vs.for(rt).registerError(QRn,Mwe);eIn=[-3,rt,lMn,{[nx]:VO,[HO]:400},[ox],[0]];Vs.for(rt).registerError(eIn,Lwe);tIn=[-3,rt,pMn,{[nx]:VO,[HO]:400},[ox],[0]];Vs.for(rt).registerError(tIn,Rwe);rIn=[-3,rt,wMn,{[nx]:VO,[HO]:400},[ox],[0]];Vs.for(rt).registerError(rIn,Iwe);nIn=[3,rt,CMn,0,[Ih,R8e,pK,iMn],[0,1,0,2]],oIn=[3,rt,EMn,0,[Ih,aMn,pK],[0,()=>IIn,0]],iIn=[3,rt,TMn,0,[R8e,pK],[1,0]],aIn=[3,rt,OMn,0,[yMn,pK],[()=>AIn,0]],sIn=[3,rt,IMn,0,[I8e],[0]],uIn=[3,rt,AMn,0,[uXt],[128]],lIn=[3,rt,_Mn,0,[Ih,kb,eXt,R8e,pK],[0,0,0,1,0]],cIn=[3,rt,vMn,0,[kb,$Pn,pK],[0,64,0]],dIn=[3,rt,FMn,0,[TPn,kMn,TRn,zMn],[0,0,0,0]],fIn=[3,rt,jMn,0,[aRn,LPn,Bwe,Ih],[0,0,0,0]],pIn=[3,rt,$Mn,0,[kb],[0]],mIn=[-3,rt,qMn,{[nx]:VO,[HO]:403},[ox],[0]];Vs.for(rt).registerError(mIn,Awe);hIn=[-3,rt,HMn,{[nx]:VO,[HO]:409},[ox],[0]];Vs.for(rt).registerError(hIn,Nwe);gIn=[-3,rt,GMn,{[nx]:VO,[HO]:404},[ox],[0]];Vs.for(rt).registerError(gIn,jwe);yIn=[3,rt,KMn,0,[pRn,gPn,VMn],[0,0,()=>bIn]],bIn=[3,rt,WMn,0,[XMn],[()=>NIn]],_In=[3,rt,YMn,0,[Ih,nXt,oXt],[0,128,()=>pXt]],vIn=[3,rt,rRn,0,[Ih,Uwe,A8e,zwe],[0,0,2,128]],wIn=[3,rt,nRn,0,[Ih,Uwe,A8e,zwe],[0,0,2,128]],SIn=[3,rt,dRn,0,[I8e,uXt],[0,128]],CIn=[3,rt,fRn,0,[],[]],xIn=[-3,rt,lRn,{[nx]:VO,[HO]:429},[ox],[0]];Vs.for(rt).registerError(xIn,Dwe);TIn=[3,rt,hRn,0,[kb,Ih,Bwe,eXt],[0,0,0,0]],OIn=[3,rt,_Rn,0,[kb,fK,NMn],[0,[()=>gne,0],64]],EIn=[3,rt,vRn,0,[kb,kPn],[0,0]],PIn=[3,rt,CRn,0,[I8e,uRn],[0,64]],MIn=[3,rt,xRn,0,[],[]],Vwe="unit",RIn=[-3,lXt,"CognitoIdentityServiceException",0,[],[]];Vs.for(lXt).registerError(RIn,jy);fXt=[1,rt,wPn,0,()=>MRn],IIn=[1,rt,dMn,0,()=>dXt],AIn=[1,rt,mMn,0,()=>YRn],NIn=[1,rt,LMn,0,()=>dIn],DIn=[1,rt,bRn,0,()=>EIn],gne=[2,rt,PMn,0,[0,0],[()=>ERn,0]],pXt=[2,rt,JMn,0,0,()=>yIn],mXt=[9,rt,SPn,0,()=>IRn,()=>qwe],hXt=[9,rt,OPn,0,()=>NRn,()=>DRn],gXt=[9,rt,MPn,0,()=>jRn,()=>Vwe],yXt=[9,rt,DPn,0,()=>$Rn,()=>dXt],bXt=[9,rt,APn,0,()=>LRn,()=>qwe],_Xt=[9,rt,BPn,0,()=>qRn,()=>BRn],vXt=[9,rt,VPn,0,()=>VRn,()=>HRn],wXt=[9,rt,WPn,0,()=>URn,()=>zRn],SXt=[9,rt,XPn,0,()=>KRn,()=>GRn],CXt=[9,rt,ZPn,0,()=>WRn,()=>JRn],xXt=[9,rt,rMn,0,()=>XRn,()=>ZRn],TXt=[9,rt,SMn,0,()=>nIn,()=>oIn],OXt=[9,rt,xMn,0,()=>iIn,()=>aIn],EXt=[9,rt,RMn,0,()=>sIn,()=>uIn],PXt=[9,rt,bMn,0,()=>lIn,()=>cIn],MXt=[9,rt,DMn,0,()=>fIn,()=>pIn],RXt=[9,rt,ZMn,0,()=>_In,()=>Vwe],IXt=[9,rt,tRn,0,()=>vIn,()=>wIn],AXt=[9,rt,cRn,0,()=>SIn,()=>CIn],NXt=[9,rt,mRn,0,()=>TIn,()=>Vwe],DXt=[9,rt,gRn,0,()=>OIn,()=>Vwe],jXt=[9,rt,SRn,0,()=>PIn,()=>MIn],$Xt=[9,rt,wRn,0,()=>qwe,()=>qwe]});var Hwe,N8e=v(()=>{bu();Bo();wl();Sl();Hwe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").sc(mXt).build(){}});var Wwe,D8e=v(()=>{bu();Bo();wl();Sl();Wwe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").sc(hXt).build(){}});var Jwe,j8e=v(()=>{bu();Bo();wl();Sl();Jwe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").sc(gXt).build(){}});var Kwe,$8e=v(()=>{bu();Bo();wl();Sl();Kwe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").sc(yXt).build(){}});var Gwe,L8e=v(()=>{bu();Bo();wl();Sl();Gwe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").sc(bXt).build(){}});var mK,F8e=v(()=>{bu();Bo();wl();Sl();mK=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").sc(_Xt).build(){}});var hK,k8e=v(()=>{bu();Bo();wl();Sl();hK=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").sc(vXt).build(){}});var Xwe,q8e=v(()=>{bu();Bo();wl();Sl();Xwe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").sc(wXt).build(){}});var Zwe,B8e=v(()=>{bu();Bo();wl();Sl();Zwe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").sc(SXt).build(){}});var Ywe,U8e=v(()=>{bu();Bo();wl();Sl();Ywe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").sc(CXt).build(){}});var Qwe,z8e=v(()=>{bu();Bo();wl();Sl();Qwe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").sc(xXt).build(){}});var eSe,V8e=v(()=>{bu();Bo();wl();Sl();eSe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").sc(TXt).build(){}});var gK,tSe=v(()=>{bu();Bo();wl();Sl();gK=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").sc(OXt).build(){}});var rSe,H8e=v(()=>{bu();Bo();wl();Sl();rSe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").sc(EXt).build(){}});var nSe,W8e=v(()=>{bu();Bo();wl();Sl();nSe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").sc(PXt).build(){}});var oSe,J8e=v(()=>{bu();Bo();wl();Sl();oSe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").sc(MXt).build(){}});var iSe,K8e=v(()=>{bu();Bo();wl();Sl();iSe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").sc(RXt).build(){}});var aSe,G8e=v(()=>{bu();Bo();wl();Sl();aSe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").sc(IXt).build(){}});var sSe,X8e=v(()=>{bu();Bo();wl();Sl();sSe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").sc(AXt).build(){}});var uSe,Z8e=v(()=>{bu();Bo();wl();Sl();uSe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").sc(NXt).build(){}});var lSe,Y8e=v(()=>{bu();Bo();wl();Sl();lSe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").sc(DXt).build(){}});var cSe,Q8e=v(()=>{bu();Bo();wl();Sl();cSe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").sc(jXt).build(){}});var dSe,eGe=v(()=>{bu();Bo();wl();Sl();dSe=class extends fn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").sc($Xt).build(){}});var jIn,tGe,LXt=v(()=>{Bo();Pwe();N8e();D8e();j8e();$8e();L8e();F8e();k8e();q8e();B8e();U8e();z8e();V8e();tSe();H8e();W8e();J8e();K8e();G8e();X8e();Z8e();Y8e();Q8e();eGe();jIn={CreateIdentityPoolCommand:Hwe,DeleteIdentitiesCommand:Wwe,DeleteIdentityPoolCommand:Jwe,DescribeIdentityCommand:Kwe,DescribeIdentityPoolCommand:Gwe,GetCredentialsForIdentityCommand:mK,GetIdCommand:hK,GetIdentityPoolRolesCommand:Xwe,GetOpenIdTokenCommand:Zwe,GetOpenIdTokenForDeveloperIdentityCommand:Ywe,GetPrincipalTagAttributeMapCommand:Qwe,ListIdentitiesCommand:eSe,ListIdentityPoolsCommand:gK,ListTagsForResourceCommand:rSe,LookupDeveloperIdentityCommand:nSe,MergeDeveloperIdentitiesCommand:oSe,SetIdentityPoolRolesCommand:iSe,SetPrincipalTagAttributeMapCommand:aSe,TagResourceCommand:sSe,UnlinkDeveloperIdentityCommand:uSe,UnlinkIdentityCommand:lSe,UntagResourceCommand:cSe,UpdateIdentityPoolCommand:dSe},tGe=class extends tk{};Ave(jIn,tGe)});var FXt=v(()=>{N8e();D8e();j8e();$8e();L8e();F8e();k8e();q8e();B8e();U8e();z8e();V8e();tSe();H8e();W8e();J8e();K8e();G8e();X8e();Z8e();Y8e();Q8e();eGe()});var kXt=v(()=>{});var Wha,qXt=v(()=>{UO();Pwe();tSe();Wha=j5e(tk,gK,"NextToken","NextToken","MaxResults")});var BXt=v(()=>{kXt();qXt()});var UXt=v(()=>{});var zXt=v(()=>{});var VXt=v(()=>{Pwe();LXt();FXt();Sl();BXt();UXt();P8e();zXt()});var rGe={};En(rGe,{CognitoIdentityClient:()=>tk,GetCredentialsForIdentityCommand:()=>mK,GetIdCommand:()=>hK});var nGe=v(()=>{VXt()});function fSe(t){return async e=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:r,CognitoIdentityClient:n}=await Promise.resolve().then(()=>(nGe(),rGe)),o=l=>t.clientConfig?.[l]??t.parentClientConfig?.[l]??e?.callerClientConfig?.[l],{Credentials:{AccessKeyId:i=$In(t.logger),Expiration:a,SecretKey:s=FIn(t.logger),SessionToken:u}=LIn(t.logger)}=await(t.client??new n(Object.assign({},t.clientConfig??{},{region:o("region"),profile:o("profile"),userAgentAppId:o("userAgentAppId")}))).send(new r({CustomRoleArn:t.customRoleArn,IdentityId:t.identityId,Logins:t.logins?await j_e(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:i,secretAccessKey:s,sessionToken:u,expiration:a}}}function $In(t){throw new Nm("Response from Amazon Cognito contained no access key ID",{logger:t})}function LIn(t){throw new Nm("Response from Amazon Cognito contained no credentials",{logger:t})}function FIn(t){throw new Nm("Response from Amazon Cognito contained no secret key",{logger:t})}var oGe=v(()=>{qF();O5e()});var iGe,pSe,HXt=v(()=>{iGe="IdentityIds",pSe=class{constructor(e="aws:cognito-identity-ids"){x(this,"dbName");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(iGe,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(iGe,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(iGe)))}).catch(i=>{throw n.close(),i})})}}});var mSe,WXt=v(()=>{mSe=class{constructor(e={}){x(this,"store");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 JXt(){return typeof self=="object"&&self.indexedDB?new pSe:typeof window=="object"&&window.localStorage?window.localStorage:kIn}var kIn,KXt=v(()=>{HXt();WXt();kIn=new mSe});function GXt({accountId:t,cache:e=JXt(),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 f=>{let{GetIdCommand:p,CognitoIdentityClient:m}=await Promise.resolve().then(()=>(nGe(),rGe)),h=b=>n?.[b]??l?.[b]??f?.callerClientConfig?.[b],y=r??new m(Object.assign({},n??{},{region:h("region"),profile:h("profile"),userAgentAppId:h("userAgentAppId")})),g=c&&await e.getItem(c);if(!g){let{IdentityId:b=qIn(u)}=await y.send(new p({AccountId:t,IdentityPoolId:i,Logins:a?await j_e(a):void 0}));g=b,c&&Promise.resolve(e.setItem(c,g)).catch(()=>{})}return d=fSe({client:y,customRoleArn:o,logins:a,identityId:g}),d(f)};return f=>d(f).catch(async p=>{throw c&&Promise.resolve(e.removeItem(c)).catch(()=>{}),p})}function qIn(t){throw new Nm("Response from Amazon Cognito contained no identity ID",{logger:t})}var XXt=v(()=>{qF();oGe();KXt();O5e()});var aGe=v(()=>{QHt();eWt();tWt();oGe();XXt()});var BIn,ZXt=v(()=>{aGe();BIn=t=>fSe({...t})});var UIn,YXt=v(()=>{aGe();UIn=t=>GXt({...t})});var zIn,VIn,HIn,QXt,eZt=v(()=>{qF();zIn="169.254.170.2",VIn="169.254.170.23",HIn="[fd00:ec2::23]",QXt=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===zIn||t.hostname===VIn||t.hostname===HIn)){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 Nm(`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 tZt=v(()=>{});var rZt=v(()=>{tZt()});var nZt=v(()=>{});var oZt=v(()=>{});var iZt=v(()=>{});function WIn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var hSe,aZt=v(()=>{hSe=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=WIn(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 sZt=v(()=>{});var uZt=v(()=>{});var lZt=v(()=>{});var cZt=v(()=>{rZt();nZt();oZt();iZt();aZt();sZt();uZt();lZt()});function dZt(t){return new hSe({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 fZt(t,e){let n=await q3t(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 Nm("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:b6t(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new Nm(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new Nm(`Server responded with status: ${t.statusCode}`,{logger:e})}var pZt=v(()=>{qF();cZt();Bo();z5e()});var mZt,hZt=v(()=>{mZt=(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 sGe,gZt=v(()=>{Zre();qF();eZt();pZt();hZt();sGe=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new Nm("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);QXt(n,t.logger);let o=new zF;return mZt(async()=>{let i=dZt(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return fZt(a.response)},t.maxRetries??3,t.timeout??1e3)}});var yZt=v(()=>{gZt()});function JIn(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function KIn(t){return{schemeId:"smithy.api#noAuth"}}var yne,bZt,_Zt,GIn,vZt,uGe=v(()=>{aK();yne=$(VS());bne();bZt=async(t,e,r)=>({operation:(0,yne.getSmithyContext)(e).operation,region:await(0,yne.normalizeProvider)(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});_Zt=t=>{let e=[];switch(t.operation){case"AssumeRoleWithWebIdentity":{e.push(KIn(t));break}default:e.push(JIn(t))}return e},GIn=t=>Object.assign(t,{stsClientCtor:ZS}),vZt=t=>{let e=GIn(t),r=Mve(e);return Object.assign(r,{authSchemePreference:(0,yne.normalizeProvider)(t.authSchemePreference??[])})}});var wZt,gSe,ySe=v(()=>{wZt=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),gSe={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 CZt,SZt=v(()=>{CZt={name:"@aws-sdk/nested-clients",version:"3.968.0",description:"Nested clients for AWS SDK packages.",main:"./dist-cjs/index.js",module:"./dist-es/index.js",types:"./dist-types/index.d.ts",scripts:{build:"yarn lint && concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline nested-clients","build:es":"tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo",lint:"node ../../scripts/validation/submodules-linter.js --pkg nested-clients",test:"yarn g:vitest run","test:watch":"yarn g:vitest watch"},engines:{node:">=20.0.0"},sideEffects:!1,author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.968.0","@aws-sdk/middleware-host-header":"3.968.0","@aws-sdk/middleware-logger":"3.968.0","@aws-sdk/middleware-recursion-detection":"3.968.0","@aws-sdk/middleware-user-agent":"3.968.0","@aws-sdk/region-config-resolver":"3.968.0","@aws-sdk/types":"3.968.0","@aws-sdk/util-endpoints":"3.968.0","@aws-sdk/util-user-agent-browser":"3.968.0","@aws-sdk/util-user-agent-node":"3.968.0","@smithy/config-resolver":"^4.4.5","@smithy/core":"^3.20.3","@smithy/fetch-http-handler":"^5.3.8","@smithy/hash-node":"^4.2.7","@smithy/invalid-dependency":"^4.2.7","@smithy/middleware-content-length":"^4.2.7","@smithy/middleware-endpoint":"^4.4.4","@smithy/middleware-retry":"^4.4.20","@smithy/middleware-serde":"^4.2.8","@smithy/middleware-stack":"^4.2.7","@smithy/node-config-provider":"^4.3.7","@smithy/node-http-handler":"^4.4.7","@smithy/protocol-http":"^5.3.7","@smithy/smithy-client":"^4.10.5","@smithy/types":"^4.11.0","@smithy/url-parser":"^4.2.7","@smithy/util-base64":"^4.3.0","@smithy/util-body-length-browser":"^4.2.0","@smithy/util-body-length-node":"^4.2.1","@smithy/util-defaults-mode-browser":"^4.3.19","@smithy/util-defaults-mode-node":"^4.2.22","@smithy/util-endpoints":"^3.2.7","@smithy/util-middleware":"^4.2.7","@smithy/util-retry":"^4.2.7","@smithy/util-utf8":"^4.2.0",tslib:"^2.6.2"},devDependencies:{concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"5.0.10",typescript:"~5.8.3"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["./signin.d.ts","./signin.js","./sso-oidc.d.ts","./sso-oidc.js","./sts.d.ts","./sts.js","dist-*/**"],browser:{"./dist-es/submodules/signin/runtimeConfig":"./dist-es/submodules/signin/runtimeConfig.browser","./dist-es/submodules/sso-oidc/runtimeConfig":"./dist-es/submodules/sso-oidc/runtimeConfig.browser","./dist-es/submodules/sts/runtimeConfig":"./dist-es/submodules/sts/runtimeConfig.browser"},"react-native":{},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"packages/nested-clients"},exports:{"./package.json":"./package.json","./sso-oidc":{types:"./dist-types/submodules/sso-oidc/index.d.ts",module:"./dist-es/submodules/sso-oidc/index.js",node:"./dist-cjs/submodules/sso-oidc/index.js",import:"./dist-es/submodules/sso-oidc/index.js",require:"./dist-cjs/submodules/sso-oidc/index.js"},"./sts":{types:"./dist-types/submodules/sts/index.d.ts",module:"./dist-es/submodules/sts/index.js",node:"./dist-cjs/submodules/sts/index.js",import:"./dist-es/submodules/sts/index.js",require:"./dist-cjs/submodules/sts/index.js"},"./signin":{types:"./dist-types/submodules/signin/index.d.ts",module:"./dist-es/submodules/signin/index.js",node:"./dist-cjs/submodules/signin/index.js",import:"./dist-es/submodules/signin/index.js",require:"./dist-cjs/submodules/signin/index.js"}}}});var xZt,TZt=v(()=>{xZt=t=>new TextEncoder().encode(t)});var OZt=v(()=>{});var EZt,PZt=v(()=>{EZt=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 MZt=v(()=>{TZt();OZt();PZt()});var qZt,si,cs,ds,nk,rk,Rg,BZt,UZt,zZt,zl,RZt,WO,yK,cGe,IZt,lGe,VZt,AZt,Ig,NZt,HZt,WZt,$y,bw,DZt,JZt,KZt,jZt,GZt,$Zt,LZt,FZt,kZt,ZIn,XZt,ZZt=v(()=>{qZt="required",si="type",cs="fn",ds="argv",nk="ref",rk="booleanEquals",Rg="stringEquals",BZt="sigv4",UZt="sts",zZt="us-east-1",zl="endpoint",RZt="https://sts.{Region}.{PartitionResult#dnsSuffix}",WO="tree",yK="error",cGe="getAttr",IZt={[qZt]:!1,[si]:"string"},lGe={[qZt]:!0,default:!1,[si]:"boolean"},VZt={[nk]:"Endpoint"},AZt={[cs]:"isSet",[ds]:[{[nk]:"Region"}]},Ig={[nk]:"Region"},NZt={[cs]:"aws.partition",[ds]:[Ig],assign:"PartitionResult"},HZt={[nk]:"UseFIPS"},WZt={[nk]:"UseDualStack"},$y={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:BZt,signingName:UZt,signingRegion:zZt}]},headers:{}},bw={},DZt={conditions:[{[cs]:Rg,[ds]:[Ig,"aws-global"]}],[zl]:$y,[si]:zl},JZt={[cs]:rk,[ds]:[HZt,!0]},KZt={[cs]:rk,[ds]:[WZt,!0]},jZt={[cs]:cGe,[ds]:[{[nk]:"PartitionResult"},"supportsFIPS"]},GZt={[nk]:"PartitionResult"},$Zt={[cs]:rk,[ds]:[!0,{[cs]:cGe,[ds]:[GZt,"supportsDualStack"]}]},LZt=[{[cs]:"isSet",[ds]:[VZt]}],FZt=[JZt],kZt=[KZt],ZIn={version:"1.0",parameters:{Region:IZt,UseDualStack:lGe,UseFIPS:lGe,Endpoint:IZt,UseGlobalEndpoint:lGe},rules:[{conditions:[{[cs]:rk,[ds]:[{[nk]:"UseGlobalEndpoint"},!0]},{[cs]:"not",[ds]:LZt},AZt,NZt,{[cs]:rk,[ds]:[HZt,!1]},{[cs]:rk,[ds]:[WZt,!1]}],rules:[{conditions:[{[cs]:Rg,[ds]:[Ig,"ap-northeast-1"]}],endpoint:$y,[si]:zl},{conditions:[{[cs]:Rg,[ds]:[Ig,"ap-south-1"]}],endpoint:$y,[si]:zl},{conditions:[{[cs]:Rg,[ds]:[Ig,"ap-southeast-1"]}],endpoint:$y,[si]:zl},{conditions:[{[cs]:Rg,[ds]:[Ig,"ap-southeast-2"]}],endpoint:$y,[si]:zl},DZt,{conditions:[{[cs]:Rg,[ds]:[Ig,"ca-central-1"]}],endpoint:$y,[si]:zl},{conditions:[{[cs]:Rg,[ds]:[Ig,"eu-central-1"]}],endpoint:$y,[si]:zl},{conditions:[{[cs]:Rg,[ds]:[Ig,"eu-north-1"]}],endpoint:$y,[si]:zl},{conditions:[{[cs]:Rg,[ds]:[Ig,"eu-west-1"]}],endpoint:$y,[si]:zl},{conditions:[{[cs]:Rg,[ds]:[Ig,"eu-west-2"]}],endpoint:$y,[si]:zl},{conditions:[{[cs]:Rg,[ds]:[Ig,"eu-west-3"]}],endpoint:$y,[si]:zl},{conditions:[{[cs]:Rg,[ds]:[Ig,"sa-east-1"]}],endpoint:$y,[si]:zl},{conditions:[{[cs]:Rg,[ds]:[Ig,zZt]}],endpoint:$y,[si]:zl},{conditions:[{[cs]:Rg,[ds]:[Ig,"us-east-2"]}],endpoint:$y,[si]:zl},{conditions:[{[cs]:Rg,[ds]:[Ig,"us-west-1"]}],endpoint:$y,[si]:zl},{conditions:[{[cs]:Rg,[ds]:[Ig,"us-west-2"]}],endpoint:$y,[si]:zl},{endpoint:{url:RZt,properties:{authSchemes:[{name:BZt,signingName:UZt,signingRegion:"{Region}"}]},headers:bw},[si]:zl}],[si]:WO},{conditions:LZt,rules:[{conditions:FZt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[si]:yK},{conditions:kZt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[si]:yK},{endpoint:{url:VZt,properties:bw,headers:bw},[si]:zl}],[si]:WO},{conditions:[AZt],rules:[{conditions:[NZt],rules:[{conditions:[JZt,KZt],rules:[{conditions:[{[cs]:rk,[ds]:[!0,jZt]},$Zt],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:bw,headers:bw},[si]:zl}],[si]:WO},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[si]:yK}],[si]:WO},{conditions:FZt,rules:[{conditions:[{[cs]:rk,[ds]:[jZt,!0]}],rules:[{conditions:[{[cs]:Rg,[ds]:[{[cs]:cGe,[ds]:[GZt,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:bw,headers:bw},[si]:zl},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:bw,headers:bw},[si]:zl}],[si]:WO},{error:"FIPS is enabled but this partition does not support FIPS",[si]:yK}],[si]:WO},{conditions:kZt,rules:[{conditions:[$Zt],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:bw,headers:bw},[si]:zl}],[si]:WO},{error:"DualStack is enabled but this partition does not support DualStack",[si]:yK}],[si]:WO},DZt,{endpoint:{url:RZt,properties:bw,headers:bw},[si]:zl}],[si]:WO}],[si]:WO},{error:"Invalid Configuration: Missing Region",[si]:yK}]},XZt=ZIn});var YIn,YZt,QZt=v(()=>{gve();u2();ZZt();YIn=new Z5({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]}),YZt=(t,e={})=>YIn.get(t,()=>mve(XZt,{endpointParams:t,logger:e.logger}));I1.aws=nne});var eYt,tYt=v(()=>{aK();Kve();UO();Bo();hve();kO();MZt();uGe();QZt();eYt=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??gw,base64Encoder:t?.base64Encoder??yw,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??YZt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??_Zt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new l2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new X5}],logger:t?.logger??new ek,protocol:t?.protocol??Jve,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??GF,utf8Decoder:t?.utf8Decoder??xZt,utf8Encoder:t?.utf8Encoder??EZt})});var rYt,nYt=v(()=>{SZt();w8e();S8e();lne();Zre();C8e();Bo();FKe();x8e();dne();tYt();rYt=t=>{let e=xwe(t),r=()=>e().then(Nve),n=eYt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??Rve,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??Swe({serviceId:n.serviceId,clientVersion:CZt.version}),maxAttempts:t?.maxAttempts??j1,region:t?.region??Cwe("Region is missing"),requestHandler:zF.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||cne),sha256:t?.sha256??wwe,streamCollector:t?.streamCollector??V5,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(Qve)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(ewe))}}});var oYt,iYt,aYt=v(()=>{oYt=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),iYt=t=>({httpHandler:t.httpHandler()})});var sYt=v(()=>{aYt()});var uYt=v(()=>{});var lYt=v(()=>{});var cYt=v(()=>{});var dYt=v(()=>{});var fYt=v(()=>{});var pYt=v(()=>{});var mYt=v(()=>{});var hYt=v(()=>{sYt();uYt();lYt();cYt();dYt();fYt();pYt();mYt()});var gYt,yYt,bYt=v(()=>{gYt=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}}},yYt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var _Yt,vYt=v(()=>{Ewe();hYt();Bo();bYt();_Yt=(t,e)=>{let r=Object.assign(Twe(t),Dve(t),oYt(t),gYt(t));return e.forEach(n=>n.configure(r)),Object.assign(t,Owe(r),jve(r),iYt(r),yYt(r))}});var ZS,bne=v(()=>{E5e();P5e();R5e();n8e();lne();UO();Mg();i8e();bu();m8e();Bo();uGe();ySe();nYt();vYt();ZS=class extends d2{constructor(...[r]){let n=rYt(r||{});super(n);x(this,"config");this.initConfig=n;let o=wZt(n),i=sve(o),a=bwe(i),s=rwe(a),u=s,l=lwe(u),c=vZt(l),d=_Yt(c,r?.extensions||[]);this.config=d,this.middlewareStack.use(J_e(this.config)),this.middlewareStack.use(Yve(this.config)),this.middlewareStack.use(_we(this.config)),this.middlewareStack.use(owe(this.config)),this.middlewareStack.use(L_e(this.config)),this.middlewareStack.use(F_e(this.config)),this.middlewareStack.use(k_e(this.config)),this.middlewareStack.use(q_e(this.config,{httpAuthSchemeParametersProvider:bZt,identityProviderConfigProvider:async f=>new G5({"aws.auth#sigv4":f.credentials})})),this.middlewareStack.use(U_e(this.config))}destroy(){super.destroy()}}});var V_,bSe=v(()=>{Bo();V_=class t extends rK{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var _ne,vne,wne,Sne,Cne,xne,Tne,dGe=v(()=>{bSe();_ne=class t extends V_{constructor(r){super({name:"ExpiredTokenException",$fault:"client",...r});x(this,"name","ExpiredTokenException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},vne=class t extends V_{constructor(r){super({name:"MalformedPolicyDocumentException",$fault:"client",...r});x(this,"name","MalformedPolicyDocumentException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},wne=class t extends V_{constructor(r){super({name:"PackedPolicyTooLargeException",$fault:"client",...r});x(this,"name","PackedPolicyTooLargeException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Sne=class t extends V_{constructor(r){super({name:"RegionDisabledException",$fault:"client",...r});x(this,"name","RegionDisabledException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Cne=class t extends V_{constructor(r){super({name:"IDPRejectedClaimException",$fault:"client",...r});x(this,"name","IDPRejectedClaimException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},xne=class t extends V_{constructor(r){super({name:"InvalidIdentityTokenException",$fault:"client",...r});x(this,"name","InvalidIdentityTokenException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Tne=class t extends V_{constructor(r){super({name:"IDPCommunicationErrorException",$fault:"client",...r});x(this,"name","IDPCommunicationErrorException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}}});var QIn,eAn,tAn,rAn,nAn,oAn,fGe,iAn,aAn,sAn,uAn,pGe,lAn,wYt,cAn,dAn,fAn,pAn,mAn,hAn,gAn,yAn,SYt,CYt,bAn,_An,vAn,wAn,SAn,CAn,xYt,xAn,TAn,TYt,OAn,OYt,EAn,PAn,mGe,MAn,RAn,IAn,AAn,NAn,DAn,jAn,$An,LAn,FAn,f2,p2,kAn,m2,h2,g2,qAn,EYt,BAn,Ys,UAn,zAn,hGe,PYt,MYt,RYt,IYt,gGe,AYt,NYt,DYt,jYt,$Yt,LYt,FYt,kYt,qYt,BYt,UYt,zYt,VAn,HAn,yGe,bGe,_Se=v(()=>{Mg();dGe();bSe();QIn="Arn",eAn="AccessKeyId",tAn="AssumeRole",rAn="AssumedRoleId",nAn="AssumeRoleRequest",oAn="AssumeRoleResponse",fGe="AssumedRoleUser",iAn="AssumeRoleWithWebIdentity",aAn="AssumeRoleWithWebIdentityRequest",sAn="AssumeRoleWithWebIdentityResponse",uAn="Audience",pGe="Credentials",lAn="ContextAssertion",wYt="DurationSeconds",cAn="Expiration",dAn="ExternalId",fAn="ExpiredTokenException",pAn="IDPCommunicationErrorException",mAn="IDPRejectedClaimException",hAn="InvalidIdentityTokenException",gAn="Key",yAn="MalformedPolicyDocumentException",SYt="Policy",CYt="PolicyArns",bAn="ProviderArn",_An="ProvidedContexts",vAn="ProvidedContextsListType",wAn="ProvidedContext",SAn="PolicyDescriptorType",CAn="ProviderId",xYt="PackedPolicySize",xAn="PackedPolicyTooLargeException",TAn="Provider",TYt="RoleArn",OAn="RegionDisabledException",OYt="RoleSessionName",EAn="SecretAccessKey",PAn="SubjectFromWebIdentityToken",mGe="SourceIdentity",MAn="SerialNumber",RAn="SessionToken",IAn="Tags",AAn="TokenCode",NAn="TransitiveTagKeys",DAn="Tag",jAn="Value",$An="WebIdentityToken",LAn="arn",FAn="accessKeySecretType",f2="awsQueryError",p2="client",kAn="clientTokenType",m2="error",h2="httpError",g2="message",qAn="policyDescriptorListType",EYt="smithy.ts.sdk.synthetic.com.amazonaws.sts",BAn="tagListType",Ys="com.amazonaws.sts",UAn=[0,Ys,FAn,8,0],zAn=[0,Ys,kAn,8,0],hGe=[3,Ys,fGe,0,[rAn,QIn],[0,0]],PYt=[3,Ys,nAn,0,[TYt,OYt,CYt,SYt,wYt,IAn,NAn,dAn,MAn,AAn,mGe,_An],[0,0,()=>zYt,0,1,()=>HAn,64,0,0,0,0,()=>VAn]],MYt=[3,Ys,oAn,0,[pGe,fGe,xYt,mGe],[[()=>gGe,0],()=>hGe,1,0]],RYt=[3,Ys,aAn,0,[TYt,OYt,$An,CAn,CYt,SYt,wYt],[0,0,[()=>zAn,0],0,()=>zYt,0,1]],IYt=[3,Ys,sAn,0,[pGe,PAn,fGe,xYt,TAn,uAn,mGe],[[()=>gGe,0],0,()=>hGe,1,0,0,0]],gGe=[3,Ys,pGe,0,[eAn,EAn,RAn,cAn],[0,[()=>UAn,0],0,4]],AYt=[-3,Ys,fAn,{[f2]:["ExpiredTokenException",400],[m2]:p2,[h2]:400},[g2],[0]];Vs.for(Ys).registerError(AYt,_ne);NYt=[-3,Ys,pAn,{[f2]:["IDPCommunicationError",400],[m2]:p2,[h2]:400},[g2],[0]];Vs.for(Ys).registerError(NYt,Tne);DYt=[-3,Ys,mAn,{[f2]:["IDPRejectedClaim",403],[m2]:p2,[h2]:403},[g2],[0]];Vs.for(Ys).registerError(DYt,Cne);jYt=[-3,Ys,hAn,{[f2]:["InvalidIdentityToken",400],[m2]:p2,[h2]:400},[g2],[0]];Vs.for(Ys).registerError(jYt,xne);$Yt=[-3,Ys,yAn,{[f2]:["MalformedPolicyDocument",400],[m2]:p2,[h2]:400},[g2],[0]];Vs.for(Ys).registerError($Yt,vne);LYt=[-3,Ys,xAn,{[f2]:["PackedPolicyTooLarge",400],[m2]:p2,[h2]:400},[g2],[0]];Vs.for(Ys).registerError(LYt,wne);FYt=[3,Ys,SAn,0,[LAn],[0]],kYt=[3,Ys,wAn,0,[bAn,lAn],[0,0]],qYt=[-3,Ys,OAn,{[f2]:["RegionDisabledException",403],[m2]:p2,[h2]:403},[g2],[0]];Vs.for(Ys).registerError(qYt,Sne);BYt=[3,Ys,DAn,0,[gAn,jAn],[0,0]],UYt=[-3,EYt,"STSServiceException",0,[],[]];Vs.for(EYt).registerError(UYt,V_);zYt=[1,Ys,qAn,0,()=>FYt],VAn=[1,Ys,vAn,0,()=>kYt],HAn=[1,Ys,BAn,0,()=>BYt],yGe=[9,Ys,tAn,0,()=>PYt,()=>MYt],bGe=[9,Ys,iAn,0,()=>RYt,()=>IYt]});var L1,vSe=v(()=>{bu();Bo();ySe();_Se();L1=class extends fn.classBuilder().ep(gSe).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").sc(yGe).build(){}});var y2,wSe=v(()=>{bu();Bo();ySe();_Se();y2=class extends fn.classBuilder().ep(gSe).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").sc(bGe).build(){}});var WAn,SSe,VYt=v(()=>{Bo();vSe();wSe();bne();WAn={AssumeRoleCommand:L1,AssumeRoleWithWebIdentityCommand:y2},SSe=class extends ZS{};Ave(WAn,SSe)});var HYt=v(()=>{vSe();wSe()});var WYt=v(()=>{});var JYt,KYt,GYt,XYt,ZYt,YYt=v(()=>{bve();Ewe();vSe();wSe();JYt=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},KYt=async(t,e,r,n={})=>{let o=typeof t=="function"?await t():t,i=typeof e=="function"?await e():e,a="",s=o??i??(a=await I7t(n)());return r?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${o} (credential provider clientConfig)`,`${i} (contextual client)`,`${a} (STS default: AWS_REGION, profile region, or us-east-1)`),s},GYt=(t,e)=>{let r,n;return async(o,i)=>{if(n=o,!r){let{logger:c=t?.parentClientConfig?.logger,profile:d=t?.parentClientConfig?.profile,region:f,requestHandler:p=t?.parentClientConfig?.requestHandler,credentialProviderLogger:m,userAgentAppId:h=t?.parentClientConfig?.userAgentAppId}=t,y=await KYt(f,t?.parentClientConfig?.region,m,{logger:c,profile:d}),g=!ZYt(p);r=new e({...t,userAgentAppId:h,profile:d,credentialDefaultProvider:()=>async()=>n,region:y,requestHandler:g?p:void 0,logger:c})}let{Credentials:a,AssumedRoleUser:s}=await r.send(new L1(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=JYt(s),l={accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}};return Q5(l,"CREDENTIALS_STS_ASSUME_ROLE","i"),l}},XYt=(t,e)=>{let r;return async n=>{if(!r){let{logger:u=t?.parentClientConfig?.logger,profile:l=t?.parentClientConfig?.profile,region:c,requestHandler:d=t?.parentClientConfig?.requestHandler,credentialProviderLogger:f,userAgentAppId:p=t?.parentClientConfig?.userAgentAppId}=t,m=await KYt(c,t?.parentClientConfig?.region,f,{logger:u,profile:l}),h=!ZYt(d);r=new e({...t,userAgentAppId:p,profile:l,region:m,requestHandler:h?d:void 0,logger:u})}let{Credentials:o,AssumedRoleUser:i}=await r.send(new y2(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=JYt(i),s={accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}};return a&&Q5(s,"RESOLVED_ACCOUNT_ID","T"),Q5(s,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),s}},ZYt=t=>t?.metadata?.handlerProtocol==="h2"});var QYt,eQt,tQt,JAn,rQt=v(()=>{YYt();bne();QYt=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,eQt=(t={},e)=>GYt(t,QYt(ZS,e)),tQt=(t={},e)=>XYt(t,QYt(ZS,e)),JAn=t=>e=>t({roleAssumer:eQt(e),roleAssumerWithWebIdentity:tQt(e),...e})});var nQt={};En(nQt,{$Command:()=>fn,AssumeRole$:()=>yGe,AssumeRoleCommand:()=>L1,AssumeRoleRequest$:()=>PYt,AssumeRoleResponse$:()=>MYt,AssumeRoleWithWebIdentity$:()=>bGe,AssumeRoleWithWebIdentityCommand:()=>y2,AssumeRoleWithWebIdentityRequest$:()=>RYt,AssumeRoleWithWebIdentityResponse$:()=>IYt,AssumedRoleUser$:()=>hGe,Credentials$:()=>gGe,ExpiredTokenException:()=>_ne,ExpiredTokenException$:()=>AYt,IDPCommunicationErrorException:()=>Tne,IDPCommunicationErrorException$:()=>NYt,IDPRejectedClaimException:()=>Cne,IDPRejectedClaimException$:()=>DYt,InvalidIdentityTokenException:()=>xne,InvalidIdentityTokenException$:()=>jYt,MalformedPolicyDocumentException:()=>vne,MalformedPolicyDocumentException$:()=>$Yt,PackedPolicyTooLargeException:()=>wne,PackedPolicyTooLargeException$:()=>LYt,PolicyDescriptorType$:()=>FYt,ProvidedContext$:()=>kYt,RegionDisabledException:()=>Sne,RegionDisabledException$:()=>qYt,STS:()=>SSe,STSClient:()=>ZS,STSServiceException:()=>V_,STSServiceException$:()=>UYt,Tag$:()=>BYt,__Client:()=>d2,decorateDefaultCredentialProvider:()=>JAn,getDefaultRoleAssumer:()=>eQt,getDefaultRoleAssumerWithWebIdentity:()=>tQt});var _Ge=v(()=>{bne();VYt();HYt();_Se();dGe();WYt();rQt();bSe()});var oQt={};En(oQt,{AssumeRoleCommand:()=>L1,STSClient:()=>ZS});var iQt=v(()=>{_Ge()});var KAn,sQt,aQt,CSe,uQt=v(()=>{UO();qF();KAn="us-east-1",sQt=(t,e,r)=>{let n;return async(o={})=>{let{callerClientConfig:i}=o,a=t.clientConfig?.profile??i?.profile,s=t.logger??i?.logger;s?.debug("@aws-sdk/credential-providers - fromTemporaryCredentials (STS)");let u={...t.params,RoleSessionName:t.params.RoleSessionName??"aws-sdk-js-"+Date.now()};if(u?.SerialNumber){if(!t.mfaCodeProvider)throw new Nm("Temporary credential requires multi-factor authentication, but no MFA code callback was provided.",{tryNextLink:!1,logger:s});u.TokenCode=await t.mfaCodeProvider(u?.SerialNumber)}let{AssumeRoleCommand:l,STSClient:c}=await Promise.resolve().then(()=>(iQt(),oQt));if(!n){let f=typeof e=="function"?e():void 0,p=[t.masterCredentials,t.clientConfig?.credentials,void i?.credentials,i?.credentialDefaultProvider?.(),f],m="STS client default credentials";if(p[0])m="options.masterCredentials";else if(p[1])m="options.clientConfig.credentials";else{if(p[2])throw m="caller client's credentials",new Error("fromTemporaryCredentials recursion in callerClientConfig.credentials");p[3]?m="caller client's credentialDefaultProvider":p[4]&&(m="AWS SDK default credentials")}let h=[t.clientConfig?.region,i?.region,await r?.({profile:a}),KAn],y="default partition's default region";h[0]?y="options.clientConfig.region":h[1]?y="caller client's region":h[2]&&(y="file or env region");let g=[aQt(t.clientConfig?.requestHandler),aQt(i?.requestHandler)],b="STS default requestHandler";g[0]?b="options.clientConfig.requestHandler":g[1]&&(b="caller client's requestHandler"),s?.debug?.(`@aws-sdk/credential-providers - fromTemporaryCredentials STS client init with ${y}=${await P1(CSe(h))()}, ${m}, ${b}.`),n=new c({userAgentAppId:i?.userAgentAppId,...t.clientConfig,credentials:CSe(p),logger:s,profile:a,region:CSe(h),requestHandler:CSe(g)})}if(t.clientPlugins)for(let f of t.clientPlugins)n.middlewareStack.use(f);let{Credentials:d}=await n.send(new l(u));if(!d||!d.AccessKeyId||!d.SecretAccessKey)throw new Nm(`Invalid response from STS.assumeRole call with role ${u.RoleArn}`,{logger:s});return{accessKeyId:d.AccessKeyId,secretAccessKey:d.SecretAccessKey,sessionToken:d.SessionToken,expiration:d.Expiration,credentialScope:d.CredentialScope}}},aQt=t=>t?.metadata?.handlerProtocol==="h2"?void 0:t,CSe=t=>{for(let e of t)if(e!==void 0)return e}});var lQt=v(()=>{uQt()});var cQt=v(()=>{});var dQt,fQt=v(()=>{dQt=t=>async e=>{t.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:r,roleSessionName:n,webIdentityToken:o,providerId:i,policyArns:a,policy:s,durationSeconds:u}=t,{roleAssumerWithWebIdentity:l}=t;if(!l){let{getDefaultRoleAssumerWithWebIdentity:c}=await Promise.resolve().then(()=>(_Ge(),nQt));l=c({...t.clientConfig,credentialProviderLogger:t.logger,parentClientConfig:{...e?.callerClientConfig,...t.parentClientConfig}},t.clientPlugins)}return l({RoleArn:r,RoleSessionName:n??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:o,ProviderId:i,PolicyArns:a,Policy:s,DurationSeconds:u})}});var pQt=v(()=>{cQt();fQt()});var GAn,mQt=v(()=>{pQt();GAn=t=>dQt({...t})});var hQt={};En(hQt,{fromCognitoIdentity:()=>BIn,fromCognitoIdentityPool:()=>UIn,fromHttp:()=>sGe,fromTemporaryCredentials:()=>sQt,fromWebToken:()=>GAn});var gQt=v(()=>{ZXt();YXt();yZt();lQt();mQt()});var xGe=S(ok=>{"use strict";var XAn=B5(),ZAn=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),YAn=t=>({httpHandler:t.httpHandler()}),vGe=class{constructor({name:e,kind:r=XAn.FieldPosition.HEADER,values:n=[]}){x(this,"name");x(this,"kind");x(this,"values");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}},wGe=class{constructor({fields:e=[],encoding:r="utf-8"}){x(this,"entries",{});x(this,"encoding");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)}},SGe=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=QAn(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)}};function QAn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var CGe=class{constructor(e){x(this,"statusCode");x(this,"reason");x(this,"headers");x(this,"body");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"}};function eNn(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}ok.Field=vGe;ok.Fields=wGe;ok.HttpRequest=SGe;ok.HttpResponse=CGe;ok.getHttpHandlerExtensionConfiguration=ZAn;ok.isValidHostname=eNn;ok.resolveHttpHandlerRuntimeConfig=YAn});var bQt=S(OGe=>{"use strict";var yQt={},TGe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),yQt[t]=e,TGe[e]=t}function tNn(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 TGe)e[r/2]=TGe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function rNn(t){let e="";for(let r=0;r<t.byteLength;r++)e+=yQt[t[r]];return e}OGe.fromHex=tNn;OGe.toHex=rNn});var vQt=S(_Qt=>{"use strict";var nNn=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";_Qt.isArrayBuffer=nNn});var wQt=S(PGe=>{"use strict";var oNn=vQt(),EGe=IS(),iNn=(t,e=0,r=t.byteLength-e)=>{if(!oNn.isArrayBuffer(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return EGe.Buffer.from(t,e,r)},aNn=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?EGe.Buffer.from(t,e):EGe.Buffer.from(t)};PGe.fromArrayBuffer=iNn;PGe.fromString=aNn});var xQt=S(xSe=>{"use strict";var SQt=wQt(),CQt=t=>{let e=SQt.fromString(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},sNn=t=>typeof t=="string"?CQt(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),uNn=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 SQt.fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength).toString("utf8")};xSe.fromUtf8=CQt;xSe.toUint8Array=sNn;xSe.toUtf8=uNn});var OQt=S(TQt=>{"use strict";var lNn=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";TQt.isArrayBuffer=lNn});var XQt=S(pi=>{"use strict";var ik=bQt(),b2=xQt(),cNn=OQt(),RQt=xGe(),EQt=VS(),TSe=Xre(),IQt="X-Amz-Algorithm",AQt="X-Amz-Credential",DGe="X-Amz-Date",NQt="X-Amz-SignedHeaders",DQt="X-Amz-Expires",jGe="X-Amz-Signature",$Ge="X-Amz-Security-Token",dNn="X-Amz-Region-Set",LGe="authorization",FGe=DGe.toLowerCase(),jQt="date",$Qt=[LGe,FGe,jQt],LQt=jGe.toLowerCase(),RSe="x-amz-content-sha256",FQt=$Ge.toLowerCase(),fNn="host",kQt={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},qQt=/^proxy-/,BQt=/^sec-/,pNn=[/^proxy-/i,/^sec-/i],OSe="AWS4-HMAC-SHA256",mNn="AWS4-ECDSA-P256-SHA256",UQt="AWS4-HMAC-SHA256-PAYLOAD",zQt="UNSIGNED-PAYLOAD",VQt=50,kGe="aws4_request",HQt=60*60*24*7,bK={},ESe=[],PSe=(t,e,r)=>`${t}/${e}/${r}/${kGe}`,WQt=async(t,e,r,n,o)=>{let i=await PQt(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${ik.toHex(i)}:${e.sessionToken}`;if(a in bK)return bK[a];for(ESe.push(a);ESe.length>VQt;)delete bK[ESe.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,kGe])s=await PQt(t,s,u);return bK[a]=s},hNn=()=>{ESe.length=0,Object.keys(bK).forEach(t=>{delete bK[t]})},PQt=(t,e,r)=>{let n=new t(e);return n.update(b2.toUint8Array(r)),n.digest()},MGe=({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 kQt||e?.has(i)||qQt.test(i)||BQt.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n},MSe=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===RSe)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||cNn.isArrayBuffer(e)){let n=new r;return n.update(b2.toUint8Array(e)),ik.toHex(await n.digest())}return zQt},RGe=class{format(e){let r=[];for(let i of Object.keys(e)){let a=b2.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=b2.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(IGe.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!gNn.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(ik.fromHex(e.value.replace(/\-/g,"")),1),d}}},gNn=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,IGe=class t{constructor(e){x(this,"bytes");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&&MQt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&MQt(e),parseInt(ik.toHex(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};function MQt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var JQt=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1},KQt=(t,e={})=>{let{headers:r,query:n={}}=RQt.HttpRequest.clone(t);for(let o of Object.keys(r)){let i=o.toLowerCase();(i.slice(0,6)==="x-amz-"&&!e.unhoistableHeaders?.has(i)||e.hoistableHeaders?.has(i))&&(n[o]=r[o],delete r[o])}return{...t,headers:r,query:n}},AGe=t=>{t=RQt.HttpRequest.clone(t);for(let e of Object.keys(t.headers))$Qt.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t},GQt=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t)){if(n.toLowerCase()===LQt)continue;let o=TSe.escapeUri(n);e.push(o);let i=t[n];typeof i=="string"?r[o]=`${o}=${TSe.escapeUri(i)}`:Array.isArray(i)&&(r[o]=i.slice(0).reduce((a,s)=>a.concat([`${o}=${TSe.escapeUri(s)}`]),[]).sort().join("&"))}return e.sort().map(n=>r[n]).filter(n=>n).join("&")},yNn=t=>bNn(t).toISOString().replace(/\.\d{3}Z$/,"Z"),bNn=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t,ISe=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){x(this,"service");x(this,"regionProvider");x(this,"credentialProvider");x(this,"sha256");x(this,"uriEscapePath");x(this,"applyChecksum");this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=EQt.normalizeProvider(n),this.credentialProvider=EQt.normalizeProvider(r)}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${GQt(e)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}

${o.join(";")}
${n}`}async createStringToSign(e,r,n,o){let i=new this.sha256;i.update(b2.toUint8Array(n));let a=await i.digest();return`${o}
${e}
${r}
${ik.toHex(a)}`}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 TSe.escapeUri(n).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(e){let r=yNn(e).replace(/[\-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}},NGe=class extends ISe{constructor({applyChecksum:r,credentials:n,region:o,service:i,sha256:a,uriEscapePath:s=!0}){super({applyChecksum:r,credentials:n,region:o,service:i,sha256:a,uriEscapePath:s});x(this,"headerFormatter",new RGe)}async presign(r,n={}){let{signingDate:o=new Date,expiresIn:i=3600,unsignableHeaders:a,unhoistableHeaders:s,signableHeaders:u,hoistableHeaders:l,signingRegion:c,signingService:d}=n,f=await this.credentialProvider();this.validateResolvedCredentials(f);let p=c??await this.regionProvider(),{longDate:m,shortDate:h}=this.formatDate(o);if(i>HQt)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let y=PSe(h,p,d??this.service),g=KQt(AGe(r),{unhoistableHeaders:s,hoistableHeaders:l});f.sessionToken&&(g.query[$Ge]=f.sessionToken),g.query[IQt]=OSe,g.query[AQt]=`${f.accessKeyId}/${y}`,g.query[DGe]=m,g.query[DQt]=i.toString(10);let b=MGe(g,a,u);return g.query[NQt]=this.getCanonicalHeaderList(b),g.query[jGe]=await this.getSignature(m,y,this.getSigningKey(f,p,h,d),this.createCanonicalRequest(g,b,await MSe(r,this.sha256))),g}async sign(r,n){return typeof r=="string"?this.signString(r,n):r.headers&&r.payload?this.signEvent(r,n):r.message?this.signMessage(r,n):this.signRequest(r,n)}async signEvent({headers:r,payload:n},{signingDate:o=new Date,priorSignature:i,signingRegion:a,signingService:s}){let u=a??await this.regionProvider(),{shortDate:l,longDate:c}=this.formatDate(o),d=PSe(l,u,s??this.service),f=await MSe({headers:{},body:n},this.sha256),p=new this.sha256;p.update(r);let m=ik.toHex(await p.digest()),h=[UQt,c,d,i,m,f].join(`
`);return this.signString(h,{signingDate:o,signingRegion:u,signingService:s})}async signMessage(r,{signingDate:n=new Date,signingRegion:o,signingService:i}){return this.signEvent({headers:this.headerFormatter.format(r.message.headers),payload:r.message.body},{signingDate:n,signingRegion:o,signingService:i,priorSignature:r.priorSignature}).then(s=>({message:r.message,signature:s}))}async signString(r,{signingDate:n=new Date,signingRegion:o,signingService:i}={}){let a=await this.credentialProvider();this.validateResolvedCredentials(a);let s=o??await this.regionProvider(),{shortDate:u}=this.formatDate(n),l=new this.sha256(await this.getSigningKey(a,s,u,i));return l.update(b2.toUint8Array(r)),ik.toHex(await l.digest())}async signRequest(r,{signingDate:n=new Date,signableHeaders:o,unsignableHeaders:i,signingRegion:a,signingService:s}={}){let u=await this.credentialProvider();this.validateResolvedCredentials(u);let l=a??await this.regionProvider(),c=AGe(r),{longDate:d,shortDate:f}=this.formatDate(n),p=PSe(f,l,s??this.service);c.headers[FGe]=d,u.sessionToken&&(c.headers[FQt]=u.sessionToken);let m=await MSe(c,this.sha256);!JQt(RSe,c.headers)&&this.applyChecksum&&(c.headers[RSe]=m);let h=MGe(c,i,o),y=await this.getSignature(d,p,this.getSigningKey(u,l,f,s),this.createCanonicalRequest(c,h,m));return c.headers[LGe]=`${OSe} Credential=${u.accessKeyId}/${p}, SignedHeaders=${this.getCanonicalHeaderList(h)}, Signature=${y}`,c}async getSignature(r,n,o,i){let a=await this.createStringToSign(r,n,i,OSe),s=new this.sha256(await o);return s.update(b2.toUint8Array(a)),ik.toHex(await s.digest())}getSigningKey(r,n,o,i){return WQt(this.sha256,r,o,n,i||this.service)}},_Nn={SignatureV4a:null};pi.ALGORITHM_IDENTIFIER=OSe;pi.ALGORITHM_IDENTIFIER_V4A=mNn;pi.ALGORITHM_QUERY_PARAM=IQt;pi.ALWAYS_UNSIGNABLE_HEADERS=kQt;pi.AMZ_DATE_HEADER=FGe;pi.AMZ_DATE_QUERY_PARAM=DGe;pi.AUTH_HEADER=LGe;pi.CREDENTIAL_QUERY_PARAM=AQt;pi.DATE_HEADER=jQt;pi.EVENT_ALGORITHM_IDENTIFIER=UQt;pi.EXPIRES_QUERY_PARAM=DQt;pi.GENERATED_HEADERS=$Qt;pi.HOST_HEADER=fNn;pi.KEY_TYPE_IDENTIFIER=kGe;pi.MAX_CACHE_SIZE=VQt;pi.MAX_PRESIGNED_TTL=HQt;pi.PROXY_HEADER_PATTERN=qQt;pi.REGION_SET_PARAM=dNn;pi.SEC_HEADER_PATTERN=BQt;pi.SHA256_HEADER=RSe;pi.SIGNATURE_HEADER=LQt;pi.SIGNATURE_QUERY_PARAM=jGe;pi.SIGNED_HEADERS_QUERY_PARAM=NQt;pi.SignatureV4=NGe;pi.SignatureV4Base=ISe;pi.TOKEN_HEADER=FQt;pi.TOKEN_QUERY_PARAM=$Ge;pi.UNSIGNABLE_PATTERNS=pNn;pi.UNSIGNED_PAYLOAD=zQt;pi.clearCredentialCache=hNn;pi.createScope=PSe;pi.getCanonicalHeaders=MGe;pi.getCanonicalQuery=GQt;pi.getPayloadHash=MSe;pi.getSigningKey=WQt;pi.hasHeader=JQt;pi.moveHeadersToQuery=KQt;pi.prepareRequest=AGe;pi.signatureV4aContainer=_Nn});var wc=S((sva,ZQt)=>{"use strict";ZQt.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 _K=S((uva,ASe)=>{"use strict";var{AbortController:YQt,AbortSignal:vNn}=typeof self<"u"?self:typeof window<"u"?window:void 0;ASe.exports=YQt;ASe.exports.AbortSignal=vNn;ASe.exports.default=YQt});var One=S((lva,qGe)=>{"use strict";var vK=typeof Reflect=="object"?Reflect:null,QQt=vK&&typeof vK.apply=="function"?vK.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},NSe;vK&&typeof vK.ownKeys=="function"?NSe=vK.ownKeys:Object.getOwnPropertySymbols?NSe=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:NSe=function(e){return Object.getOwnPropertyNames(e)};function wNn(t){console&&console.warn&&console.warn(t)}var ter=Number.isNaN||function(e){return e!==e};function _u(){_u.init.call(this)}qGe.exports=_u;qGe.exports.once=TNn;_u.EventEmitter=_u;_u.prototype._events=void 0;_u.prototype._eventsCount=0;_u.prototype._maxListeners=void 0;var eer=10;function DSe(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(_u,"defaultMaxListeners",{enumerable:!0,get:function(){return eer},set:function(t){if(typeof t!="number"||t<0||ter(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");eer=t}});_u.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};_u.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ter(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 rer(t){return t._maxListeners===void 0?_u.defaultMaxListeners:t._maxListeners}_u.prototype.getMaxListeners=function(){return rer(this)};_u.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")QQt(u,this,r);else for(var l=u.length,c=ser(u,l),n=0;n<l;++n)QQt(c[n],this,r);return!0};function ner(t,e,r,n){var o,i,a;if(DSe(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=rer(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,wNn(s)}return t}_u.prototype.addListener=function(e,r){return ner(this,e,r,!1)};_u.prototype.on=_u.prototype.addListener;_u.prototype.prependListener=function(e,r){return ner(this,e,r,!0)};function SNn(){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 oer(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=SNn.bind(n);return o.listener=r,n.wrapFn=o,o}_u.prototype.once=function(e,r){return DSe(r),this.on(e,oer(this,e,r)),this};_u.prototype.prependOnceListener=function(e,r){return DSe(r),this.prependListener(e,oer(this,e,r)),this};_u.prototype.removeListener=function(e,r){var n,o,i,a,s;if(DSe(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():CNn(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};_u.prototype.off=_u.prototype.removeListener;_u.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 ier(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?xNn(o):ser(o,o.length)}_u.prototype.listeners=function(e){return ier(this,e,!0)};_u.prototype.rawListeners=function(e){return ier(this,e,!1)};_u.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):aer.call(t,e)};_u.prototype.listenerCount=aer;function aer(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}_u.prototype.eventNames=function(){return this._eventsCount>0?NSe(this._events):[]};function ser(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function CNn(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function xNn(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function TNn(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))}uer(t,e,i,{once:!0}),e!=="error"&&ONn(t,o,{once:!0})})}function ONn(t,e,r){typeof t.on=="function"&&uer(t,"error",e,r)}function uer(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 Ly=S((cva,UGe)=>{"use strict";var ENn=IS(),{kResistStopPropagation:PNn,SymbolDispose:MNn}=wc(),RNn=globalThis.AbortSignal||_K().AbortSignal,INn=globalThis.AbortController||_K().AbortController,ANn=Object.getPrototypeOf(async function(){}).constructor,ler=globalThis.Blob||ENn.Blob,NNn=typeof ler<"u"?function(e){return e instanceof ler}:function(e){return!1},cer=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},DNn=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},BGe=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}};UGe.exports={AggregateError:BGe,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 ANn},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:NNn,deprecate(t,e){return t},addAbortListener:One().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);cer(e,"signal"),DNn(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[PNn]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[MNn](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:RNn.any||function(e){if(e.length===1)return e[0];let r=new INn,n=()=>r.abort();return e.forEach(o=>{cer(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};UGe.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var qb=S((dva,per)=>{"use strict";var{format:jNn,inspect:jSe,AggregateError:$Nn}=Ly(),LNn=globalThis.AggregateError||$Nn,FNn=Symbol("kIsNodeError"),kNn=["string","function","number","object","Function","Object","boolean","bigint","symbol"],qNn=/^([A-Z][a-z0-9]*)+$/,BNn="__node_internal_",$Se={};function _2(t,e){if(!t)throw new $Se.ERR_INTERNAL_ASSERTION(e)}function der(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 UNn(t,e,r){if(typeof e=="function")return _2(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 _2(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:jNn(e,...r)}function Ag(t,e,r){r||(r=Error);class n extends r{constructor(...i){super(UNn(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[FNn]=!0,$Se[t]=n}function fer(t){let e=BNn+t.name;return Object.defineProperty(t,"name",{value:e}),t}function zNn(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new LNn([e,t],e.message);return r.code=e.code,r}return t||e}var zGe=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new $Se.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};Ag("ERR_ASSERTION","%s",Error);Ag("ERR_INVALID_ARG_TYPE",(t,e,r)=>{_2(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)_2(typeof u=="string","All expected entries have to be of type string"),kNn.includes(u)?o.push(u.toLowerCase()):qNn.test(u)?i.push(u):(_2(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=jSe(r,{depth:-1});n+=`. Received ${u}`}}else{let u=jSe(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);Ag("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=jSe(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);Ag("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);Ag("ERR_MISSING_ARGS",(...t)=>{_2(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);Ag("ERR_OUT_OF_RANGE",(t,e,r)=>{_2(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=der(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=der(n)),n+="n"):n=jSe(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);Ag("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Ag("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Ag("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Ag("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Ag("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Ag("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Ag("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Ag("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Ag("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Ag("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Ag("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);per.exports={AbortError:zGe,aggregateTwoErrors:fer(zNn),hideStackFrames:fer,codes:$Se}});var SK=S((fva,Cer)=>{"use strict";var{ArrayIsArray:HGe,ArrayPrototypeIncludes:yer,ArrayPrototypeJoin:ber,ArrayPrototypeMap:VNn,NumberIsInteger:WGe,NumberIsNaN:HNn,NumberMAX_SAFE_INTEGER:WNn,NumberMIN_SAFE_INTEGER:JNn,NumberParseInt:KNn,ObjectPrototypeHasOwnProperty:GNn,RegExpPrototypeExec:_er,String:XNn,StringPrototypeToUpperCase:ZNn,StringPrototypeTrim:YNn}=wc(),{hideStackFrames:YS,codes:{ERR_SOCKET_BAD_PORT:QNn,ERR_INVALID_ARG_TYPE:Fy,ERR_INVALID_ARG_VALUE:wK,ERR_OUT_OF_RANGE:v2,ERR_UNKNOWN_SIGNAL:mer}}=qb(),{normalizeEncoding:e1n}=Ly(),{isAsyncFunction:t1n,isArrayBufferView:r1n}=Ly().types,her={};function n1n(t){return t===(t|0)}function o1n(t){return t===t>>>0}var i1n=/^[0-7]+$/,a1n="must be a 32-bit unsigned integer or an octal string";function s1n(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(_er(i1n,t)===null)throw new wK(e,t,a1n);t=KNn(t,8)}return ver(t,e),t}var u1n=YS((t,e,r=JNn,n=WNn)=>{if(typeof t!="number")throw new Fy(e,"number",t);if(!WGe(t))throw new v2(e,"an integer",t);if(t<r||t>n)throw new v2(e,`>= ${r} && <= ${n}`,t)}),l1n=YS((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Fy(e,"number",t);if(!WGe(t))throw new v2(e,"an integer",t);if(t<r||t>n)throw new v2(e,`>= ${r} && <= ${n}`,t)}),ver=YS((t,e,r=!1)=>{if(typeof t!="number")throw new Fy(e,"number",t);if(!WGe(t))throw new v2(e,"an integer",t);let n=r?1:0,o=4294967295;if(t<n||t>o)throw new v2(e,`>= ${n} && <= ${o}`,t)});function JGe(t,e){if(typeof t!="string")throw new Fy(e,"string",t)}function c1n(t,e,r=void 0,n){if(typeof t!="number")throw new Fy(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&HNn(t))throw new v2(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var d1n=YS((t,e,r)=>{if(!yer(r,t)){let o="must be one of: "+ber(VNn(r,i=>typeof i=="string"?`'${i}'`:XNn(i)),", ");throw new wK(e,t,o)}});function wer(t,e){if(typeof t!="boolean")throw new Fy(e,"boolean",t)}function VGe(t,e,r){return t==null||!GNn(t,e)?r:t[e]}var f1n=YS((t,e,r=null)=>{let n=VGe(r,"allowArray",!1),o=VGe(r,"allowFunction",!1);if(!VGe(r,"nullable",!1)&&t===null||!n&&HGe(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new Fy(e,"Object",t)}),p1n=YS((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Fy(e,"a dictionary",t)}),LSe=YS((t,e,r=0)=>{if(!HGe(t))throw new Fy(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new wK(e,t,n)}});function m1n(t,e){LSe(t,e);for(let r=0;r<t.length;r++)JGe(t[r],`${e}[${r}]`)}function h1n(t,e){LSe(t,e);for(let r=0;r<t.length;r++)wer(t[r],`${e}[${r}]`)}function g1n(t,e){LSe(t,e);for(let r=0;r<t.length;r++){let n=t[r],o=`${e}[${r}]`;if(n==null)throw new Fy(o,"AbortSignal",n);Ser(n,o)}}function y1n(t,e="signal"){if(JGe(t,e),her[t]===void 0)throw her[ZNn(t)]!==void 0?new mer(t+" (signals must use all capital letters)"):new mer(t)}var b1n=YS((t,e="buffer")=>{if(!r1n(t))throw new Fy(e,["Buffer","TypedArray","DataView"],t)});function _1n(t,e){let r=e1n(e),n=t.length;if(r==="hex"&&n%2!==0)throw new wK("encoding",e,`is invalid for data of length ${n}`)}function v1n(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&YNn(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new QNn(e,t,r);return t|0}var Ser=YS((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Fy(e,"AbortSignal",t)}),w1n=YS((t,e)=>{if(typeof t!="function")throw new Fy(e,"Function",t)}),S1n=YS((t,e)=>{if(typeof t!="function"||t1n(t))throw new Fy(e,"Function",t)}),C1n=YS((t,e)=>{if(t!==void 0)throw new Fy(e,"undefined",t)});function x1n(t,e,r){if(!yer(r,t))throw new Fy(e,`('${ber(r,"|")}')`,t)}var T1n=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ger(t,e){if(typeof t>"u"||!_er(T1n,t))throw new wK(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function O1n(t){if(typeof t=="string")return ger(t,"hints"),t;if(HGe(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let o=t[n];ger(o,"hints"),r+=o,n!==e-1&&(r+=", ")}return r}throw new wK("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Cer.exports={isInt32:n1n,isUint32:o1n,parseFileMode:s1n,validateArray:LSe,validateStringArray:m1n,validateBooleanArray:h1n,validateAbortSignalArray:g1n,validateBoolean:wer,validateBuffer:b1n,validateDictionary:p1n,validateEncoding:_1n,validateFunction:w1n,validateInt32:l1n,validateInteger:u1n,validateNumber:c1n,validateObject:f1n,validateOneOf:d1n,validatePlainFunction:S1n,validatePort:v1n,validateSignalName:y1n,validateString:JGe,validateUint32:ver,validateUndefined:C1n,validateUnion:x1n,validateAbortSignal:Ser,validateLinkHeaderValue:O1n}});var ak=S((pva,Eer)=>{var ad=Eer.exports={},JO,KO;function KGe(){throw new Error("setTimeout has not been defined")}function GGe(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?JO=setTimeout:JO=KGe}catch{JO=KGe}try{typeof clearTimeout=="function"?KO=clearTimeout:KO=GGe}catch{KO=GGe}})();function xer(t){if(JO===setTimeout)return setTimeout(t,0);if((JO===KGe||!JO)&&setTimeout)return JO=setTimeout,setTimeout(t,0);try{return JO(t,0)}catch{try{return JO.call(null,t,0)}catch{return JO.call(this,t,0)}}}function E1n(t){if(KO===clearTimeout)return clearTimeout(t);if((KO===GGe||!KO)&&clearTimeout)return KO=clearTimeout,clearTimeout(t);try{return KO(t)}catch{try{return KO.call(null,t)}catch{return KO.call(this,t)}}}var F1=[],CK=!1,w2,FSe=-1;function P1n(){!CK||!w2||(CK=!1,w2.length?F1=w2.concat(F1):FSe=-1,F1.length&&Ter())}function Ter(){if(!CK){var t=xer(P1n);CK=!0;for(var e=F1.length;e;){for(w2=F1,F1=[];++FSe<e;)w2&&w2[FSe].run();FSe=-1,e=F1.length}w2=null,CK=!1,E1n(t)}}ad.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];F1.push(new Oer(t,e)),F1.length===1&&!CK&&xer(Ter)};function Oer(t,e){this.fun=t,this.array=e}Oer.prototype.run=function(){this.fun.apply(null,this.array)};ad.title="browser";ad.browser=!0;ad.env={};ad.argv=[];ad.version="";ad.versions={};function k1(){}ad.on=k1;ad.addListener=k1;ad.once=k1;ad.off=k1;ad.removeListener=k1;ad.removeAllListeners=k1;ad.emit=k1;ad.prependListener=k1;ad.prependOnceListener=k1;ad.listeners=function(t){return[]};ad.binding=function(t){throw new Error("process.binding is not supported")};ad.cwd=function(){return"/"};ad.chdir=function(t){throw new Error("process.chdir is not supported")};ad.umask=function(){return 0}});var XO=S((mva,Uer)=>{"use strict";var{SymbolAsyncIterator:Per,SymbolIterator:Mer,SymbolFor:S2}=wc(),Rer=S2("nodejs.stream.destroyed"),Ier=S2("nodejs.stream.errored"),XGe=S2("nodejs.stream.readable"),ZGe=S2("nodejs.stream.writable"),Aer=S2("nodejs.stream.disturbed"),M1n=S2("nodejs.webstream.isClosedPromise"),R1n=S2("nodejs.webstream.controllerErrorFunction");function kSe(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 qSe(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 I1n(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function GO(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Ner(t){return!!(t&&!GO(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Der(t){return!!(t&&!GO(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function jer(t){return!!(t&&!GO(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function A1n(t){return Ner(t)||Der(t)||jer(t)}function N1n(t,e){return t==null?!1:e===!0?typeof t[Per]=="function":e===!1?typeof t[Mer]=="function":typeof t[Per]=="function"||typeof t[Mer]=="function"}function BSe(t){if(!GO(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Rer]||n!=null&&n.destroyed)}function $er(t){if(!qSe(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 D1n(t,e){if(!qSe(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 j1n(t){if(!kSe(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 Ler(t,e){if(!kSe(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 Fer(t){return t&&t[XGe]!=null?t[XGe]:typeof t?.readable!="boolean"?null:BSe(t)?!1:kSe(t)&&t.readable&&!Ler(t)}function ker(t){return t&&t[ZGe]!=null?t[ZGe]:typeof t?.writable!="boolean"?null:BSe(t)?!1:qSe(t)&&t.writable&&!$er(t)}function $1n(t,e){return GO(t)?BSe(t)?!0:!(e?.readable!==!1&&Fer(t)||e?.writable!==!1&&ker(t)):null}function L1n(t){var e,r;return GO(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 F1n(t){var e,r;return GO(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 k1n(t){if(!GO(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"&&qer(t)?t._closed:null}function qer(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Ber(t){return typeof t._sent100=="boolean"&&qer(t)}function q1n(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 B1n(t){if(!GO(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Ber(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function U1n(t){var e;return!!(t&&((e=t[Aer])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function z1n(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[Ier])!==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))}Uer.exports={isDestroyed:BSe,kIsDestroyed:Rer,isDisturbed:U1n,kIsDisturbed:Aer,isErrored:z1n,kIsErrored:Ier,isReadable:Fer,kIsReadable:XGe,kIsClosedPromise:M1n,kControllerErrorFunction:R1n,kIsWritable:ZGe,isClosed:k1n,isDuplexNodeStream:I1n,isFinished:$1n,isIterable:N1n,isReadableNodeStream:kSe,isReadableStream:Ner,isReadableEnded:j1n,isReadableFinished:Ler,isReadableErrored:F1n,isNodeStream:GO,isWebStream:A1n,isWritable:ker,isWritableNodeStream:qSe,isWritableStream:Der,isWritableEnded:$er,isWritableFinished:D1n,isWritableErrored:L1n,isServerRequest:q1n,isServerResponse:Ber,willEmitClose:B1n,isTransformStream:jer}});var q1=S((hva,r9e)=>{var sk=ak(),{AbortError:Zer,codes:V1n}=qb(),{ERR_INVALID_ARG_TYPE:H1n,ERR_STREAM_PREMATURE_CLOSE:zer}=V1n,{kEmptyObject:QGe,once:e9e}=Ly(),{validateAbortSignal:W1n,validateFunction:J1n,validateObject:K1n,validateBoolean:G1n}=SK(),{Promise:X1n,PromisePrototypeThen:Z1n,SymbolDispose:Yer}=wc(),{isClosed:Y1n,isReadable:Ver,isReadableNodeStream:YGe,isReadableStream:Q1n,isReadableFinished:Her,isReadableErrored:Wer,isWritable:Jer,isWritableNodeStream:Ker,isWritableStream:eDn,isWritableFinished:Ger,isWritableErrored:Xer,isNodeStream:tDn,willEmitClose:rDn,kIsClosedPromise:nDn}=XO(),xK;function oDn(t){return t.setHeader&&typeof t.abort=="function"}var t9e=()=>{};function Qer(t,e,r){var n,o;if(arguments.length===2?(r=e,e=QGe):e==null?e=QGe:K1n(e,"options"),J1n(r,"callback"),W1n(e.signal,"options.signal"),r=e9e(r),Q1n(t)||eDn(t))return iDn(t,e,r);if(!tDn(t))throw new H1n("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:YGe(t),a=(o=e.writable)!==null&&o!==void 0?o:Ker(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=rDn(t)&&YGe(t)===i&&Ker(t)===a,d=Ger(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=Her(t,!1),m=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||a))&&(!a||d)&&r.call(t)},h=T=>{r.call(t,T)},y=Y1n(t),g=()=>{y=!0;let T=Xer(t)||Wer(t);if(T&&typeof T!="boolean")return r.call(t,T);if(i&&!p&&YGe(t,!0)&&!Her(t,!1))return r.call(t,new zer);if(a&&!d&&!Ger(t,!1))return r.call(t,new zer);r.call(t)},b=()=>{y=!0;let T=Xer(t)||Wer(t);if(T&&typeof T!="boolean")return r.call(t,T);r.call(t)},_=()=>{t.req.on("finish",f)};oDn(t)?(t.on("complete",f),c||t.on("abort",g),t.req?_():t.on("request",_)):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),y?sk.nextTick(g):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||sk.nextTick(b):(!i&&(!c||Ver(t))&&(d||Jer(t)===!1)||!a&&(!c||Jer(t))&&(p||Ver(t)===!1)||u&&t.req&&t.aborted)&&sk.nextTick(b);let w=()=>{r=t9e,t.removeListener("aborted",g),t.removeListener("complete",f),t.removeListener("abort",g),t.removeListener("request",_),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&&!y){let T=()=>{let O=r;w(),O.call(t,new Zer(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)sk.nextTick(T);else{xK=xK||Ly().addAbortListener;let O=xK(e.signal,T),E=r;r=e9e((...P)=>{O[Yer](),E.apply(t,P)})}}return w}function iDn(t,e,r){let n=!1,o=t9e;if(e.signal)if(o=()=>{n=!0,r.call(t,new Zer(void 0,{cause:e.signal.reason}))},e.signal.aborted)sk.nextTick(o);else{xK=xK||Ly().addAbortListener;let a=xK(e.signal,o),s=r;r=e9e((...u)=>{a[Yer](),s.apply(t,u)})}let i=(...a)=>{n||sk.nextTick(()=>r.apply(t,a))};return Z1n(t[nDn].promise,i,i),t9e}function aDn(t,e){var r;let n=!1;return e===null&&(e=QGe),(r=e)!==null&&r!==void 0&&r.cleanup&&(G1n(e.cleanup,"cleanup"),n=e.cleanup),new X1n((o,i)=>{let a=Qer(t,e,s=>{n&&a(),s?i(s):o()})})}r9e.exports=Qer;r9e.exports.finished=aDn});var C2=S((gva,str)=>{"use strict";var ZO=ak(),{aggregateTwoErrors:sDn,codes:{ERR_MULTIPLE_CALLBACK:uDn},AbortError:lDn}=qb(),{Symbol:rtr}=wc(),{kIsDestroyed:cDn,isDestroyed:dDn,isFinished:fDn,isServerRequest:pDn}=XO(),ntr=rtr("kDestroy"),n9e=rtr("kConstruct");function otr(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function mDn(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):(otr(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?etr(this,t,e):this.once(ntr,function(i){etr(this,sDn(i,t),e)}),this)}function etr(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;otr(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?ZO.nextTick(hDn,t,i):ZO.nextTick(itr,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function hDn(t,e){o9e(t,e),itr(t)}function itr(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 o9e(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 gDn(){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 i9e(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?ZO.nextTick(o9e,t,e):o9e(t,e))}function yDn(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(n9e,e),!(t.listenerCount(n9e)>1)&&ZO.nextTick(bDn,t)}function bDn(t){let e=!1;function r(n){if(e){i9e(t,n??new uDn);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(ntr,n):n?i9e(t,n,!0):ZO.nextTick(_Dn,t)}try{t._construct(n=>{ZO.nextTick(r,n)})}catch(n){ZO.nextTick(r,n)}}function _Dn(t){t.emit(n9e)}function ttr(t){return t?.setHeader&&typeof t.abort=="function"}function atr(t){t.emit("close")}function vDn(t,e){t.emit("error",e),ZO.nextTick(atr,t)}function wDn(t,e){!t||dDn(t)||(!e&&!fDn(t)&&(e=new lDn),pDn(t)?(t.socket=null,t.destroy(e)):ttr(t)?t.abort():ttr(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?ZO.nextTick(vDn,t,e):ZO.nextTick(atr,t),t.destroyed||(t[cDn]=!0))}str.exports={construct:yDn,destroyer:wDn,destroy:mDn,undestroy:gDn,errorOrDestroy:i9e}});var VSe=S((yva,ltr)=>{"use strict";var{ArrayIsArray:SDn,ObjectSetPrototypeOf:utr}=wc(),{EventEmitter:USe}=One();function zSe(t){USe.call(this,t)}utr(zSe.prototype,USe.prototype);utr(zSe,USe);zSe.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(),USe.listenerCount(this,"error")===0&&this.emit("error",c)}a9e(r,"error",u),a9e(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 a9e(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):SDn(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}ltr.exports={Stream:zSe,prependListener:a9e}});var Ene=S((bva,HSe)=>{"use strict";var{SymbolDispose:CDn}=wc(),{AbortError:ctr,codes:xDn}=qb(),{isNodeStream:dtr,isWebStream:TDn,kControllerErrorFunction:ODn}=XO(),EDn=q1(),{ERR_INVALID_ARG_TYPE:ftr}=xDn,s9e,PDn=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new ftr(e,"AbortSignal",t)};HSe.exports.addAbortSignal=function(e,r){if(PDn(e,"signal"),!dtr(r)&&!TDn(r))throw new ftr("stream",["ReadableStream","WritableStream","Stream"],r);return HSe.exports.addAbortSignalNoValidate(e,r)};HSe.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=dtr(e)?()=>{e.destroy(new ctr(void 0,{cause:t.reason}))}:()=>{e[ODn](new ctr(void 0,{cause:t.reason}))};if(t.aborted)r();else{s9e=s9e||Ly().addAbortListener;let n=s9e(t,r);EDn(e,n[CDn])}return e}});var htr=S((vva,mtr)=>{"use strict";var{StringPrototypeSlice:ptr,SymbolIterator:MDn,TypedArrayPrototypeSet:WSe,Uint8Array:RDn}=wc(),{Buffer:u9e}=IS(),{inspect:IDn}=Ly();mtr.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 u9e.alloc(0);let r=u9e.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)WSe(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}*[MDn](){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+=ptr(i,0,e),this.head=n,n.data=ptr(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=u9e.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)WSe(r,a,n-e),e-=a.length;else{e===a.length?(WSe(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):(WSe(r,new RDn(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 IDn(this,{...r,depth:0,customInspect:!1})}}});var Pne=S((wva,_tr)=>{"use strict";var{MathFloor:ADn,NumberIsInteger:NDn}=wc(),{validateInteger:DDn}=SK(),{ERR_INVALID_ARG_VALUE:jDn}=qb().codes,gtr=16*1024,ytr=16;function $Dn(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function btr(t){return t?ytr:gtr}function LDn(t,e){DDn(e,"value",0),t?ytr=e:gtr=e}function FDn(t,e,r,n){let o=$Dn(e,n,r);if(o!=null){if(!NDn(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new jDn(i,o)}return ADn(o)}return btr(t.objectMode)}_tr.exports={getHighWaterMark:FDn,getDefaultHighWaterMark:btr,setDefaultHighWaterMark:LDn}});var Str=S((l9e,wtr)=>{var JSe=IS(),YO=JSe.Buffer;function vtr(t,e){for(var r in t)e[r]=t[r]}YO.from&&YO.alloc&&YO.allocUnsafe&&YO.allocUnsafeSlow?wtr.exports=JSe:(vtr(JSe,l9e),l9e.Buffer=x2);function x2(t,e,r){return YO(t,e,r)}x2.prototype=Object.create(YO.prototype);vtr(YO,x2);x2.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return YO(t,e,r)};x2.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=YO(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};x2.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return YO(t)};x2.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return JSe.SlowBuffer(t)}});var Ttr=S(xtr=>{"use strict";var d9e=Str().Buffer,Ctr=d9e.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 kDn(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 qDn(t){var e=kDn(t);if(typeof e!="string"&&(d9e.isEncoding===Ctr||!Ctr(t)))throw new Error("Unknown encoding: "+t);return e||t}xtr.StringDecoder=Mne;function Mne(t){this.encoding=qDn(t);var e;switch(this.encoding){case"utf16le":this.text=WDn,this.end=JDn,e=4;break;case"utf8":this.fillLast=zDn,e=4;break;case"base64":this.text=KDn,this.end=GDn,e=3;break;default:this.write=XDn,this.end=ZDn;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=d9e.allocUnsafe(e)}Mne.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||""};Mne.prototype.end=HDn;Mne.prototype.text=VDn;Mne.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 c9e(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function BDn(t,e,r){var n=e.length-1;if(n<r)return 0;var o=c9e(e[n]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--n<r||o===-2?0:(o=c9e(e[n]),o>=0?(o>0&&(t.lastNeed=o-2),o):--n<r||o===-2?0:(o=c9e(e[n]),o>=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function UDn(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 zDn(t){var e=this.lastTotal-this.lastNeed,r=UDn(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 VDn(t,e){var r=BDn(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 HDn(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function WDn(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 JDn(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 KDn(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 GDn(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function XDn(t){return t.toString(this.encoding)}function ZDn(t){return t&&t.length?this.write(t):""}});var f9e=S((Cva,Mtr)=>{"use strict";var Otr=ak(),{PromisePrototypeThen:YDn,SymbolAsyncIterator:Etr,SymbolIterator:Ptr}=wc(),{Buffer:QDn}=IS(),{ERR_INVALID_ARG_TYPE:ejn,ERR_STREAM_NULL_VALUES:tjn}=qb().codes;function rjn(t,e,r){let n;if(typeof e=="string"||e instanceof QDn)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[Etr])o=!0,n=e[Etr]();else if(e&&e[Ptr])o=!1,n=e[Ptr]();else throw new ejn("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){YDn(s(l),()=>Otr.nextTick(c,l),d=>Otr.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 tjn;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}Mtr.exports=rjn});var Ine=S((xva,Jtr)=>{var ix=ak(),{ArrayPrototypeIndexOf:njn,NumberIsInteger:ojn,NumberIsNaN:ijn,NumberParseInt:ajn,ObjectDefineProperties:v9e,ObjectKeys:sjn,ObjectSetPrototypeOf:Atr,Promise:Ntr,SafeSet:ujn,SymbolAsyncDispose:ljn,SymbolAsyncIterator:cjn,Symbol:djn}=wc();Jtr.exports=mi;mi.ReadableState=ZSe;var{EventEmitter:fjn}=One(),{Stream:uk,prependListener:pjn}=VSe(),{Buffer:p9e}=IS(),{addAbortSignal:mjn}=Ene(),Dtr=q1(),Li=Ly().debuglog("stream",t=>{Li=t}),hjn=htr(),EK=C2(),{getHighWaterMark:gjn,getDefaultHighWaterMark:yjn}=Pne(),{aggregateTwoErrors:Rtr,codes:{ERR_INVALID_ARG_TYPE:bjn,ERR_METHOD_NOT_IMPLEMENTED:_jn,ERR_OUT_OF_RANGE:vjn,ERR_STREAM_PUSH_AFTER_EOF:wjn,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:Sjn},AbortError:Cjn}=qb(),{validateObject:xjn}=SK(),T2=djn("kPaused"),{StringDecoder:jtr}=Ttr(),Tjn=f9e();Atr(mi.prototype,uk.prototype);Atr(mi,uk);var m9e=()=>{},{errorOrDestroy:TK}=EK,OK=1,Ojn=2,$tr=4,Rne=8,Ltr=16,KSe=32,GSe=64,Ftr=128,Ejn=256,Pjn=512,Mjn=1024,b9e=2048,_9e=4096,Rjn=8192,Ijn=16384,Ajn=32768,ktr=65536,Njn=1<<17,Djn=1<<18;function Dm(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}v9e(ZSe.prototype,{objectMode:Dm(OK),ended:Dm(Ojn),endEmitted:Dm($tr),reading:Dm(Rne),constructed:Dm(Ltr),sync:Dm(KSe),needReadable:Dm(GSe),emittedReadable:Dm(Ftr),readableListening:Dm(Ejn),resumeScheduled:Dm(Pjn),errorEmitted:Dm(Mjn),emitClose:Dm(b9e),autoDestroy:Dm(_9e),destroyed:Dm(Rjn),closed:Dm(Ijn),closeEmitted:Dm(Ajn),multiAwaitDrain:Dm(ktr),readingMore:Dm(Njn),dataEmitted:Dm(Djn)});function ZSe(t,e,r){typeof r!="boolean"&&(r=e instanceof QO()),this.state=b9e|_9e|Ltr|KSe,t&&t.objectMode&&(this.state|=OK),r&&t&&t.readableObjectMode&&(this.state|=OK),this.highWaterMark=t?gjn(this,t,"readableHighWaterMark",r):yjn(!1),this.buffer=new hjn,this.length=0,this.pipes=[],this.flowing=null,this[T2]=null,t&&t.emitClose===!1&&(this.state&=~b9e),t&&t.autoDestroy===!1&&(this.state&=~_9e),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new jtr(t.encoding),this.encoding=t.encoding)}function mi(t){if(!(this instanceof mi))return new mi(t);let e=this instanceof QO();this._readableState=new ZSe(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&&mjn(t.signal,this)),uk.call(this,t),EK.construct(this,()=>{this._readableState.needReadable&&XSe(this,this._readableState)})}mi.prototype.destroy=EK.destroy;mi.prototype._undestroy=EK.undestroy;mi.prototype._destroy=function(t,e){e(t)};mi.prototype[fjn.captureRejectionSymbol]=function(t){this.destroy(t)};mi.prototype[ljn]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Cjn,this.destroy(t)),new Ntr((e,r)=>Dtr(this,n=>n&&n!==t?r(n):e(null)))};mi.prototype.push=function(t,e){return qtr(this,t,e,!1)};mi.prototype.unshift=function(t,e){return qtr(this,t,e,!0)};function qtr(t,e,r,n){Li("readableAddChunk",e);let o=t._readableState,i;if((o.state&OK)===0&&(typeof e=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?e=p9e.from(e,r).toString(o.encoding):(e=p9e.from(e,r),r=""))):e instanceof p9e?r="":uk._isUint8Array(e)?(e=uk._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new bjn("chunk",["string","Buffer","Uint8Array"],e))),i)TK(t,i);else if(e===null)o.state&=~Rne,Ljn(t,o);else if((o.state&OK)!==0||e&&e.length>0)if(n)if((o.state&$tr)!==0)TK(t,new Sjn);else{if(o.destroyed||o.errored)return!1;h9e(t,o,e,!0)}else if(o.ended)TK(t,new wjn);else{if(o.destroyed||o.errored)return!1;o.state&=~Rne,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?h9e(t,o,e,!1):XSe(t,o)):h9e(t,o,e,!1)}else n||(o.state&=~Rne,XSe(t,o));return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function h9e(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&ktr)!==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&GSe)!==0&&YSe(t)),XSe(t,e)}mi.prototype.isPaused=function(){let t=this._readableState;return t[T2]===!0||t.flowing===!1};mi.prototype.setEncoding=function(t){let e=new jtr(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 jjn=1073741824;function $jn(t){if(t>jjn)throw new vjn("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Itr(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&OK)!==0?1:ijn(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}mi.prototype.read=function(t){Li("read",t),t===void 0?t=NaN:ojn(t)||(t=ajn(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=$jn(t)),t!==0&&(e.state&=~Ftr),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Li("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?g9e(this):YSe(this),null;if(t=Itr(t,e),t===0&&e.ended)return e.length===0&&g9e(this),null;let n=(e.state&GSe)!==0;if(Li("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,Li("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,Li("reading, ended or constructing",n);else if(n){Li("do read"),e.state|=Rne|KSe,e.length===0&&(e.state|=GSe);try{this._read(e.highWaterMark)}catch(i){TK(this,i)}e.state&=~KSe,e.reading||(t=Itr(r,e))}let o;return t>0?o=Htr(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&&g9e(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function Ljn(t,e){if(Li("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?YSe(t):(e.needReadable=!1,e.emittedReadable=!0,Btr(t))}}function YSe(t){let e=t._readableState;Li("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Li("emitReadable",e.flowing),e.emittedReadable=!0,ix.nextTick(Btr,t))}function Btr(t){let e=t._readableState;Li("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,ztr(t)}function XSe(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,ix.nextTick(Fjn,t,e))}function Fjn(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(Li("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}mi.prototype._read=function(t){throw new _jn("_read()")};mi.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new ujn(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),Li("pipe count=%d opts=%j",n.pipes.length,e);let i=(!e||e.end!==!1)&&t!==ix.stdout&&t!==ix.stderr?s:y;n.endEmitted?ix.nextTick(i):r.once("end",i),t.on("unpipe",a);function a(g,b){Li("onunpipe"),g===r&&b&&b.hasUnpiped===!1&&(b.hasUnpiped=!0,c())}function s(){Li("onend"),t.end()}let u,l=!1;function c(){Li("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",y),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?(Li("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(Li("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=kjn(r,t),t.on("drain",u))}r.on("data",f);function f(g){Li("ondata");let b=t.write(g);Li("dest.write",b),b===!1&&d()}function p(g){if(Li("onerror",g),y(),t.removeListener("error",p),t.listenerCount("error")===0){let b=t._writableState||t._readableState;b&&!b.errorEmitted?TK(t,g):t.emit("error",g)}}pjn(t,"error",p);function m(){t.removeListener("finish",h),y()}t.once("close",m);function h(){Li("onfinish"),t.removeListener("close",m),y()}t.once("finish",h);function y(){Li("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||(Li("pipe resume"),r.resume()),t};function kjn(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(Li("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(Li("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}mi.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=njn(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};mi.prototype.on=function(t,e){let r=uk.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,Li("on readable",n.length,n.reading),n.length?YSe(this):n.reading||ix.nextTick(qjn,this)),r};mi.prototype.addListener=mi.prototype.on;mi.prototype.removeListener=function(t,e){let r=uk.prototype.removeListener.call(this,t,e);return t==="readable"&&ix.nextTick(Utr,this),r};mi.prototype.off=mi.prototype.removeListener;mi.prototype.removeAllListeners=function(t){let e=uk.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&ix.nextTick(Utr,this),e};function Utr(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[T2]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function qjn(t){Li("readable nexttick read 0"),t.read(0)}mi.prototype.resume=function(){let t=this._readableState;return t.flowing||(Li("resume"),t.flowing=!t.readableListening,Bjn(this,t)),t[T2]=!1,this};function Bjn(t,e){e.resumeScheduled||(e.resumeScheduled=!0,ix.nextTick(Ujn,t,e))}function Ujn(t,e){Li("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),ztr(t),e.flowing&&!e.reading&&t.read(0)}mi.prototype.pause=function(){return Li("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Li("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[T2]=!0,this};function ztr(t){let e=t._readableState;for(Li("flow",e.flowing);e.flowing&&t.read()!==null;);}mi.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=>{TK(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=sjn(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};mi.prototype[cjn]=function(){return Vtr(this)};mi.prototype.iterator=function(t){return t!==void 0&&xjn(t,"options"),Vtr(this,t)};function Vtr(t,e){typeof t.read!="function"&&(t=mi.wrap(t,{objectMode:!0}));let r=zjn(t,e);return r.stream=t,r}async function*zjn(t,e){let r=m9e;function n(a){this===t?(r(),r=m9e):r=a}t.on("readable",n);let o,i=Dtr(t,{writable:!1},a=>{o=a?Rtr(o,a):null,r(),r=m9e});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 Ntr(n)}}}catch(a){throw o=Rtr(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?EK.destroyer(t,null):(t.off("readable",n),i())}}v9e(mi.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}}});v9e(ZSe.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[T2]!==!1},set(t){this[T2]=!!t}}});mi._fromList=Htr;function Htr(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 g9e(t){let e=t._readableState;Li("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,ix.nextTick(Vjn,e,t))}function Vjn(t,e){if(Li("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)ix.nextTick(Hjn,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function Hjn(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}mi.from=function(t,e){return Tjn(mi,t,e)};var y9e;function Wtr(){return y9e===void 0&&(y9e={}),y9e}mi.fromWeb=function(t,e){return Wtr().newStreamReadableFromReadableStream(t,e)};mi.toWeb=function(t,e){return Wtr().newReadableStreamFromStreamReadable(t,e)};mi.wrap=function(t,e){var r,n;return new mi({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){EK.destroyer(t,o),i(o)}}).wrap(t)}});var n0e=S((Tva,irr)=>{var O2=ak(),{ArrayPrototypeSlice:Xtr,Error:Wjn,FunctionPrototypeSymbolHasInstance:Ztr,ObjectDefineProperty:Ytr,ObjectDefineProperties:Jjn,ObjectSetPrototypeOf:Qtr,StringPrototypeToLowerCase:Kjn,Symbol:Gjn,SymbolHasInstance:Xjn}=wc();irr.exports=Sc;Sc.WritableState=Dne;var{EventEmitter:Zjn}=One(),Ane=VSe().Stream,{Buffer:QSe}=IS(),r0e=C2(),{addAbortSignal:Yjn}=Ene(),{getHighWaterMark:Qjn,getDefaultHighWaterMark:e$n}=Pne(),{ERR_INVALID_ARG_TYPE:t$n,ERR_METHOD_NOT_IMPLEMENTED:r$n,ERR_MULTIPLE_CALLBACK:err,ERR_STREAM_CANNOT_PIPE:n$n,ERR_STREAM_DESTROYED:Nne,ERR_STREAM_ALREADY_FINISHED:o$n,ERR_STREAM_NULL_VALUES:i$n,ERR_STREAM_WRITE_AFTER_END:a$n,ERR_UNKNOWN_ENCODING:trr}=qb().codes,{errorOrDestroy:PK}=r0e;Qtr(Sc.prototype,Ane.prototype);Qtr(Sc,Ane);function C9e(){}var MK=Gjn("kOnFinished");function Dne(t,e,r){typeof r!="boolean"&&(r=e instanceof QO()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?Qjn(this,t,"writableHighWaterMark",r):e$n(!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=u$n.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,t0e(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[MK]=[]}function t0e(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Dne.prototype.getBuffer=function(){return Xtr(this.buffered,this.bufferedIndex)};Ytr(Dne.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Sc(t){let e=this instanceof QO();if(!e&&!Ztr(Sc,this))return new Sc(t);this._writableState=new Dne(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&&Yjn(t.signal,this)),Ane.call(this,t),r0e.construct(this,()=>{let r=this._writableState;r.writing||T9e(this,r),O9e(this,r)})}Ytr(Sc,Xjn,{__proto__:null,value:function(t){return Ztr(this,t)?!0:this!==Sc?!1:t&&t._writableState instanceof Dne}});Sc.prototype.pipe=function(){PK(this,new n$n)};function rrr(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"&&!QSe.isEncoding(r))throw new trr(r);typeof n!="function"&&(n=C9e)}if(e===null)throw new i$n;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=QSe.from(e,r),r="buffer");else if(e instanceof QSe)r="buffer";else if(Ane._isUint8Array(e))e=Ane._uint8ArrayToBuffer(e),r="buffer";else throw new t$n("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new a$n:o.destroyed&&(i=new Nne("write")),i?(O2.nextTick(n,i),PK(t,i,!0),i):(o.pendingcb++,s$n(t,o,e,r,n))}Sc.prototype.write=function(t,e,r){return rrr(this,t,e,r)===!0};Sc.prototype.cork=function(){this._writableState.corked++};Sc.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||T9e(this,t))};Sc.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=Kjn(e)),!QSe.isEncoding(e))throw new trr(e);return this._writableState.defaultEncoding=e,this};function s$n(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!==C9e&&(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 Ktr(t,e,r,n,o,i,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Nne("write")):r?t._writev(o,e.onwrite):t._write(o,i,e.onwrite),e.sync=!1}function Gtr(t,e,r,n){--e.pendingcb,n(r),x9e(e),PK(t,r)}function u$n(t,e){let r=t._writableState,n=r.sync,o=r.writecb;if(typeof o!="function"){PK(t,new err);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?O2.nextTick(Gtr,t,r,e,o):Gtr(t,r,e,o)):(r.buffered.length>r.bufferedIndex&&T9e(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},O2.nextTick(l$n,r.afterWriteTickInfo)):nrr(t,r,1,o))}function l$n({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,nrr(t,e,r,n)}function nrr(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&&x9e(e),O9e(t,e)}function x9e(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 Nne("write"))}let r=t[MK].splice(0);for(let o=0;o<r.length;o++){var n;r[o]((n=t.errored)!==null&&n!==void 0?n:new Nne("end"))}t0e(t)}function T9e(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?C9e:l=>{for(let c=a;c<r.length;++c)r[c].callback(l)},u=e.allNoop&&a===0?r:Xtr(r,a);u.allBuffers=e.allBuffers,Ktr(t,e,!0,e.length,u,"",s),t0e(e)}else{do{let{chunk:s,encoding:u,callback:l}=r[a];r[a++]=null;let c=o?1:s.length;Ktr(t,e,!1,c,s,u,l)}while(a<r.length&&!e.writing);a===r.length?t0e(e):a>256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}Sc.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new r$n("_write()")};Sc.prototype._writev=null;Sc.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=rrr(this,t,e);i instanceof Wjn&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,O9e(this,n,!0),n.ended=!0):n.finished?o=new o$n("end"):n.destroyed&&(o=new Nne("end"))),typeof r=="function"&&(o||n.finished?O2.nextTick(r,o):n[MK].push(r)),this};function e0e(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 c$n(t,e){let r=!1;function n(o){if(r){PK(t,o??err());return}if(r=!0,e.pendingcb--,o){let i=e[MK].splice(0);for(let a=0;a<i.length;a++)i[a](o);PK(t,o,e.sync)}else e0e(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,O2.nextTick(S9e,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(o){n(o)}e.sync=!1}function d$n(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,c$n(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function O9e(t,e,r){e0e(e)&&(d$n(t,e),e.pendingcb===0&&(r?(e.pendingcb++,O2.nextTick((n,o)=>{e0e(o)?S9e(n,o):o.pendingcb--},t,e)):e0e(e)&&(e.pendingcb++,S9e(t,e))))}function S9e(t,e){e.pendingcb--,e.finished=!0;let r=e[MK].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()}}Jjn(Sc.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 f$n=r0e.destroy;Sc.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[MK].length)&&O2.nextTick(x9e,r),f$n.call(this,t,e),this};Sc.prototype._undestroy=r0e.undestroy;Sc.prototype._destroy=function(t,e){e(t)};Sc.prototype[Zjn.captureRejectionSymbol]=function(t){this.destroy(t)};var w9e;function orr(){return w9e===void 0&&(w9e={}),w9e}Sc.fromWeb=function(t,e){return orr().newStreamWritableFromWritableStream(t,e)};Sc.toWeb=function(t){return orr().newWritableStreamFromStreamWritable(t)}});var vrr=S((Ova,_rr)=>{var E9e=ak(),p$n=IS(),{isReadable:m$n,isWritable:h$n,isIterable:arr,isNodeStream:g$n,isReadableNodeStream:srr,isWritableNodeStream:urr,isDuplexNodeStream:y$n,isReadableStream:lrr,isWritableStream:crr}=XO(),drr=q1(),{AbortError:yrr,codes:{ERR_INVALID_ARG_TYPE:b$n,ERR_INVALID_RETURN_VALUE:frr}}=qb(),{destroyer:IK}=C2(),_$n=QO(),brr=Ine(),v$n=n0e(),{createDeferredPromise:prr}=Ly(),mrr=f9e(),hrr=globalThis.Blob||p$n.Blob,w$n=typeof hrr<"u"?function(e){return e instanceof hrr}:function(e){return!1},S$n=globalThis.AbortController||_K().AbortController,{FunctionPrototypeCall:grr}=wc(),lk=class extends _$n{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)}};_rr.exports=function t(e,r){if(y$n(e))return e;if(srr(e))return RK({readable:e});if(urr(e))return RK({writable:e});if(g$n(e))return RK({writable:!1,readable:!1});if(lrr(e))return RK({readable:brr.fromWeb(e)});if(crr(e))return RK({writable:v$n.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=C$n(e);if(arr(o))return mrr(lk,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=grr(u,o,d=>{if(d!=null)throw new frr("nully","body",d)},d=>{IK(l,d)});return l=new lk({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,E9e.nextTick(d,null)}catch(f){E9e.nextTick(d,f)}})},destroy:s})}throw new frr("Iterable, AsyncIterable or AsyncFunction",r,o)}if(w$n(e))return t(e.arrayBuffer());if(arr(e))return mrr(lk,e,{objectMode:!0,writable:!1});if(lrr(e?.readable)&&crr(e?.writable))return lk.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?srr(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?urr(e?.writable)?e?.writable:t(e.writable):void 0;return RK({readable:o,writable:i})}let n=e?.then;if(typeof n=="function"){let o;return grr(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{IK(o,i)}),o=new lk({objectMode:!0,writable:!1,read(){}})}throw new b$n(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function C$n(t){let{promise:e,resolve:r}=prr(),n=new S$n,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if(E9e.nextTick(l),u)return;if(o.aborted)throw new yrr(void 0,{cause:o.reason});({promise:e,resolve:r}=prr()),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 RK(t){let e=t.readable&&typeof t.readable.read!="function"?brr.wrap(t.readable):t.readable,r=t.writable,n=!!m$n(e),o=!!h$n(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new lk({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(drr(r,d=>{o=!1,d&&IK(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&&(drr(e,d=>{n=!1,d&&IK(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 yrr),s=null,i=null,a=null,u===null?f(d):(u=f,IK(r,d),IK(e,d))},l}});var QO=S((Eva,Crr)=>{"use strict";var{ObjectDefineProperties:x$n,ObjectGetOwnPropertyDescriptor:B1,ObjectKeys:T$n,ObjectSetPrototypeOf:wrr}=wc();Crr.exports=ax;var R9e=Ine(),QS=n0e();wrr(ax.prototype,R9e.prototype);wrr(ax,R9e);{let t=T$n(QS.prototype);for(let e=0;e<t.length;e++){let r=t[e];ax.prototype[r]||(ax.prototype[r]=QS.prototype[r])}}function ax(t){if(!(this instanceof ax))return new ax(t);R9e.call(this,t),QS.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}x$n(ax.prototype,{writable:{__proto__:null,...B1(QS.prototype,"writable")},writableHighWaterMark:{__proto__:null,...B1(QS.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...B1(QS.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...B1(QS.prototype,"writableBuffer")},writableLength:{__proto__:null,...B1(QS.prototype,"writableLength")},writableFinished:{__proto__:null,...B1(QS.prototype,"writableFinished")},writableCorked:{__proto__:null,...B1(QS.prototype,"writableCorked")},writableEnded:{__proto__:null,...B1(QS.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...B1(QS.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 P9e;function Srr(){return P9e===void 0&&(P9e={}),P9e}ax.fromWeb=function(t,e){return Srr().newStreamDuplexFromReadableWritablePair(t,e)};ax.toWeb=function(t){return Srr().newReadableWritablePairFromDuplex(t)};var M9e;ax.from=function(t){return M9e||(M9e=vrr()),M9e(t,"body")}});var N9e=S((Pva,Trr)=>{"use strict";var{ObjectSetPrototypeOf:xrr,Symbol:O$n}=wc();Trr.exports=U1;var{ERR_METHOD_NOT_IMPLEMENTED:E$n}=qb().codes,A9e=QO(),{getHighWaterMark:P$n}=Pne();xrr(U1.prototype,A9e.prototype);xrr(U1,A9e);var jne=O$n("kCallback");function U1(t){if(!(this instanceof U1))return new U1(t);let e=t?P$n(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),A9e.call(this,t),this._readableState.sync=!1,this[jne]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",M$n)}function I9e(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 M$n(){this._final!==I9e&&I9e.call(this)}U1.prototype._final=I9e;U1.prototype._transform=function(t,e,r){throw new E$n("_transform()")};U1.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[jne]=r})};U1.prototype._read=function(){if(this[jne]){let t=this[jne];this[jne]=null,t()}}});var j9e=S((Mva,Err)=>{"use strict";var{ObjectSetPrototypeOf:Orr}=wc();Err.exports=AK;var D9e=N9e();Orr(AK.prototype,D9e.prototype);Orr(AK,D9e);function AK(t){if(!(this instanceof AK))return new AK(t);D9e.call(this,t)}AK.prototype._transform=function(t,e,r){r(null,t)}});var s0e=S((Rva,Arr)=>{var $ne=ak(),{ArrayIsArray:R$n,Promise:I$n,SymbolAsyncIterator:A$n,SymbolDispose:N$n}=wc(),a0e=q1(),{once:D$n}=Ly(),j$n=C2(),Prr=QO(),{aggregateTwoErrors:$$n,codes:{ERR_INVALID_ARG_TYPE:V9e,ERR_INVALID_RETURN_VALUE:$9e,ERR_MISSING_ARGS:L$n,ERR_STREAM_DESTROYED:F$n,ERR_STREAM_PREMATURE_CLOSE:k$n},AbortError:q$n}=qb(),{validateFunction:B$n,validateAbortSignal:U$n}=SK(),{isIterable:E2,isReadable:L9e,isReadableNodeStream:i0e,isNodeStream:Mrr,isTransformStream:NK,isWebStream:z$n,isReadableStream:F9e,isReadableFinished:V$n}=XO(),H$n=globalThis.AbortController||_K().AbortController,k9e,q9e,B9e;function Rrr(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=a0e(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,j$n.destroyer(t,i||new F$n("pipe")))},cleanup:o}}function W$n(t){return B$n(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function U9e(t){if(E2(t))return t;if(i0e(t))return J$n(t);throw new V9e("val",["Readable","Iterable","AsyncIterable"],t)}async function*J$n(t){q9e||(q9e=Ine()),yield*q9e.prototype[A$n].call(t)}async function o0e(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new I$n((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=a0e(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?$$n(o,l):l)}finally{u(),e.off("drain",a)}}async function z9e(t,e,r,{end:n}){NK(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 K$n(...t){return Irr(t,D$n(W$n(t)))}function Irr(t,e,r){if(t.length===1&&R$n(t[0])&&(t=t[0]),t.length<2)throw new L$n("streams");let n=new H$n,o=n.signal,i=r?.signal,a=[];U$n(i,"options.signal");function s(){m(new q$n)}B9e=B9e||Ly().addAbortListener;let u;i&&(u=B9e(i,s));let l,c,d=[],f=0;function p(_){m(_,--f===0)}function m(_,w){var T;if(_&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=_),!(!l&&!w)){for(;d.length;)d.shift()(l);(T=u)===null||T===void 0||T[N$n](),n.abort(),w&&(l||a.forEach(O=>O()),$ne.nextTick(e,l,c))}}let h;for(let _=0;_<t.length;_++){let w=t[_],T=_<t.length-1,O=_>0,E=T||r?.end!==!1,P=_===t.length-1;if(Mrr(w)){let R=function(I){I&&I.name!=="AbortError"&&I.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(I)};var b=R;if(E){let{destroy:I,cleanup:A}=Rrr(w,T,O);d.push(I),L9e(w)&&P&&a.push(A)}w.on("error",R),L9e(w)&&P&&a.push(()=>{w.removeListener("error",R)})}if(_===0)if(typeof w=="function"){if(h=w({signal:o}),!E2(h))throw new $9e("Iterable, AsyncIterable or Stream","source",h)}else E2(w)||i0e(w)||NK(w)?h=w:h=Prr.from(w);else if(typeof w=="function"){if(NK(h)){var y;h=U9e((y=h)===null||y===void 0?void 0:y.readable)}else h=U9e(h);if(h=w(h,{signal:o}),T){if(!E2(h,!0))throw new $9e("AsyncIterable",`transform[${_-1}]`,h)}else{var g;k9e||(k9e=j9e());let R=new k9e({objectMode:!0}),I=(g=h)===null||g===void 0?void 0:g.then;if(typeof I=="function")f++,I.call(h,k=>{c=k,k!=null&&R.write(k),E&&R.end(),$ne.nextTick(p)},k=>{R.destroy(k),$ne.nextTick(p,k)});else if(E2(h,!0))f++,o0e(h,R,p,{end:E});else if(F9e(h)||NK(h)){let k=h.readable||h;f++,o0e(k,R,p,{end:E})}else throw new $9e("AsyncIterable or Promise","destination",h);h=R;let{destroy:A,cleanup:B}=Rrr(h,!1,!0);d.push(A),P&&a.push(B)}}else if(Mrr(w)){if(i0e(h)){f+=2;let R=G$n(h,w,p,{end:E});L9e(w)&&P&&a.push(R)}else if(NK(h)||F9e(h)){let R=h.readable||h;f++,o0e(R,w,p,{end:E})}else if(E2(h))f++,o0e(h,w,p,{end:E});else throw new V9e("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=w}else if(z$n(w)){if(i0e(h))f++,z9e(U9e(h),w,p,{end:E});else if(F9e(h)||E2(h))f++,z9e(h,w,p,{end:E});else if(NK(h))f++,z9e(h.readable,w,p,{end:E});else throw new V9e("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=w}else h=Prr.from(w)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&$ne.nextTick(s),h}function G$n(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new k$n)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;V$n(t)?$ne.nextTick(a):t.once("end",a)}else r();return a0e(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)}),a0e(e,{readable:!1,writable:!0},r)}Arr.exports={pipelineImpl:Irr,pipeline:K$n}});var W9e=S((Iva,Frr)=>{"use strict";var{pipeline:X$n}=s0e(),u0e=QO(),{destroyer:Z$n}=C2(),{isNodeStream:l0e,isReadable:Nrr,isWritable:Drr,isWebStream:H9e,isTransformStream:P2,isWritableStream:jrr,isReadableStream:$rr}=XO(),{AbortError:Y$n,codes:{ERR_INVALID_ARG_VALUE:Lrr,ERR_MISSING_ARGS:Q$n}}=qb(),eLn=q1();Frr.exports=function(...e){if(e.length===0)throw new Q$n("streams");if(e.length===1)return u0e.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=u0e.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=u0e.from(e[p])}for(let p=0;p<e.length;++p)if(!(!l0e(e[p])&&!H9e(e[p]))){if(p<e.length-1&&!(Nrr(e[p])||$rr(e[p])||P2(e[p])))throw new Lrr(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(Drr(e[p])||jrr(e[p])||P2(e[p])))throw new Lrr(`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=X$n(e,u),d=!!(Drr(l)||jrr(l)||P2(l)),f=!!(Nrr(c)||$rr(c)||P2(c));if(s=new u0e({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(l0e(l))s._write=function(m,h,y){l.write(m,h)?y():n=y},s._final=function(m){l.end(),o=m},l.on("drain",function(){if(n){let m=n;n=null,m()}});else if(H9e(l)){let h=(P2(l)?l.writable:l).getWriter();s._write=async function(y,g,b){try{await h.ready,h.write(y).catch(()=>{}),b()}catch(_){b(_)}},s._final=async function(y){try{await h.ready,h.close().catch(()=>{}),o=y}catch(g){y(g)}}}let p=P2(c)?c.readable:c;eLn(p,()=>{if(o){let m=o;o=null,m()}})}if(f){if(l0e(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(H9e(c)){let m=(P2(c)?c.readable:c).getReader();s._read=async function(){for(;;)try{let{value:h,done:y}=await m.read();if(!s.push(h))return;if(y){s.push(null);return}}catch{return}}}}return s._destroy=function(p,m){!p&&a!==null&&(p=new Y$n),i=null,n=null,o=null,a===null?m(p):(a=m,l0e(c)&&Z$n(c,p))},s}});var Krr=S((Ava,G9e)=>{"use strict";var tLn=globalThis.AbortController||_K().AbortController,{codes:{ERR_INVALID_ARG_VALUE:rLn,ERR_INVALID_ARG_TYPE:Lne,ERR_MISSING_ARGS:nLn,ERR_OUT_OF_RANGE:oLn},AbortError:eE}=qb(),{validateAbortSignal:M2,validateInteger:krr,validateObject:R2}=SK(),iLn=wc().Symbol("kWeak"),aLn=wc().Symbol("kResistStopPropagation"),{finished:sLn}=q1(),uLn=W9e(),{addAbortSignalNoValidate:lLn}=Ene(),{isWritable:cLn,isNodeStream:dLn}=XO(),{deprecate:fLn}=Ly(),{ArrayPrototypePush:pLn,Boolean:mLn,MathFloor:qrr,Number:hLn,NumberIsNaN:gLn,Promise:Brr,PromiseReject:Urr,PromiseResolve:yLn,PromisePrototypeThen:zrr,Symbol:Hrr}=wc(),c0e=Hrr("kEmpty"),Vrr=Hrr("kEof");function bLn(t,e){if(e!=null&&R2(e,"options"),e?.signal!=null&&M2(e.signal,"options.signal"),dLn(t)&&!cLn(t))throw new rLn("stream",t,"must be writable");let r=uLn(this,t);return e!=null&&e.signal&&lLn(e.signal,r),r}function d0e(t,e){if(typeof t!="function")throw new Lne("fn",["Function","AsyncFunction"],t);e!=null&&R2(e,"options"),e?.signal!=null&&M2(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=qrr(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=qrr(e.highWaterMark)),krr(r,"options.concurrency",1),krr(n,"options.highWaterMark",0),n+=r,async function*(){let i=Ly().AbortSignalAny([e?.signal].filter(mLn)),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 y(){try{for await(let g of a){if(d)return;if(i.aborted)throw new eE;try{if(g=t(g,u),g===c0e)continue;g=yLn(g)}catch(b){g=Urr(b)}f+=1,zrr(g,m,p),s.push(g),l&&(l(),l=null),!d&&(s.length>=n||f>=r)&&await new Brr(b=>{c=b})}s.push(Vrr)}catch(g){let b=Urr(g);zrr(b,m,p),s.push(b)}finally{d=!0,l&&(l(),l=null)}}y();try{for(;;){for(;s.length>0;){let g=await s[0];if(g===Vrr)return;if(i.aborted)throw new eE;g!==c0e&&(yield g),s.shift(),h()}await new Brr(g=>{l=g})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function _Ln(t=void 0){return t!=null&&R2(t,"options"),t?.signal!=null&&M2(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 eE({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function Wrr(t,e=void 0){for await(let r of K9e.call(this,t,e))return!0;return!1}async function vLn(t,e=void 0){if(typeof t!="function")throw new Lne("fn",["Function","AsyncFunction"],t);return!await Wrr.call(this,async(...r)=>!await t(...r),e)}async function wLn(t,e){for await(let r of K9e.call(this,t,e))return r}async function SLn(t,e){if(typeof t!="function")throw new Lne("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),c0e}for await(let n of d0e.call(this,r,e));}function K9e(t,e){if(typeof t!="function")throw new Lne("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:c0e}return d0e.call(this,r,e)}var J9e=class extends nLn{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function CLn(t,e,r){var n;if(typeof t!="function")throw new Lne("reducer",["Function","AsyncFunction"],t);r!=null&&R2(r,"options"),r?.signal!=null&&M2(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new eE(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await sLn(this.destroy(l)),l}let i=new tLn,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[iLn]:this,[aLn]:!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 eE;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new J9e}finally{i.abort()}return e}async function xLn(t){t!=null&&R2(t,"options"),t?.signal!=null&&M2(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 eE(void 0,{cause:t.signal.reason});pLn(e,n)}return e}function TLn(t,e){let r=d0e.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function Jrr(t){if(t=hLn(t),gLn(t))return 0;if(t<0)throw new oLn("number",">= 0",t);return t}function OLn(t,e=void 0){return e!=null&&R2(e,"options"),e?.signal!=null&&M2(e.signal,"options.signal"),t=Jrr(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new eE;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new eE;t--<=0&&(yield i)}}.call(this)}function ELn(t,e=void 0){return e!=null&&R2(e,"options"),e?.signal!=null&&M2(e.signal,"options.signal"),t=Jrr(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new eE;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new eE;if(t-- >0&&(yield i),t<=0)return}}.call(this)}G9e.exports.streamReturningOperators={asIndexedPairs:fLn(_Ln,"readable.asIndexedPairs will be removed in a future version."),drop:OLn,filter:K9e,flatMap:TLn,map:d0e,take:ELn,compose:bLn};G9e.exports.promiseReturningOperators={every:vLn,forEach:SLn,reduce:CLn,toArray:xLn,some:Wrr,find:wLn}});var X9e=S((Nva,Grr)=>{"use strict";var{ArrayPrototypePop:PLn,Promise:MLn}=wc(),{isIterable:RLn,isNodeStream:ILn,isWebStream:ALn}=XO(),{pipelineImpl:NLn}=s0e(),{finished:DLn}=q1();Z9e();function jLn(...t){return new MLn((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!ILn(i)&&!RLn(i)&&!ALn(i)){let a=PLn(t);n=a.signal,o=a.end}NLn(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}Grr.exports={finished:DLn,pipeline:jLn}});var Z9e=S((Dva,onr)=>{var{Buffer:$Ln}=IS(),{ObjectDefineProperty:z1,ObjectKeys:Yrr,ReflectApply:Qrr}=wc(),{promisify:{custom:enr}}=Ly(),{streamReturningOperators:Xrr,promiseReturningOperators:Zrr}=Krr(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:tnr}}=qb(),LLn=W9e(),{setDefaultHighWaterMark:FLn,getDefaultHighWaterMark:kLn}=Pne(),{pipeline:rnr}=s0e(),{destroyer:qLn}=C2(),nnr=q1(),Y9e=X9e(),Fne=XO(),Cl=onr.exports=VSe().Stream;Cl.isDestroyed=Fne.isDestroyed;Cl.isDisturbed=Fne.isDisturbed;Cl.isErrored=Fne.isErrored;Cl.isReadable=Fne.isReadable;Cl.isWritable=Fne.isWritable;Cl.Readable=Ine();for(let t of Yrr(Xrr)){let r=function(...n){if(new.target)throw tnr();return Cl.Readable.from(Qrr(e,this,n))};Q9e=r;let e=Xrr[t];z1(r,"name",{__proto__:null,value:e.name}),z1(r,"length",{__proto__:null,value:e.length}),z1(Cl.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var Q9e;for(let t of Yrr(Zrr)){let r=function(...o){if(new.target)throw tnr();return Qrr(e,this,o)};Q9e=r;let e=Zrr[t];z1(r,"name",{__proto__:null,value:e.name}),z1(r,"length",{__proto__:null,value:e.length}),z1(Cl.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var Q9e;Cl.Writable=n0e();Cl.Duplex=QO();Cl.Transform=N9e();Cl.PassThrough=j9e();Cl.pipeline=rnr;var{addAbortSignal:BLn}=Ene();Cl.addAbortSignal=BLn;Cl.finished=nnr;Cl.destroy=qLn;Cl.compose=LLn;Cl.setDefaultHighWaterMark=FLn;Cl.getDefaultHighWaterMark=kLn;z1(Cl,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Y9e}});z1(rnr,enr,{__proto__:null,enumerable:!0,get(){return Y9e.pipeline}});z1(nnr,enr,{__proto__:null,enumerable:!0,get(){return Y9e.finished}});Cl.Stream=Cl;Cl._isUint8Array=function(e){return e instanceof Uint8Array};Cl._uint8ArrayToBuffer=function(e){return $Ln.from(e.buffer,e.byteOffset,e.byteLength)}});var kne=S((jva,sd)=>{"use strict";var jm=Z9e(),ULn=X9e(),zLn=jm.Readable.destroy;sd.exports=jm.Readable;sd.exports._uint8ArrayToBuffer=jm._uint8ArrayToBuffer;sd.exports._isUint8Array=jm._isUint8Array;sd.exports.isDisturbed=jm.isDisturbed;sd.exports.isErrored=jm.isErrored;sd.exports.isReadable=jm.isReadable;sd.exports.Readable=jm.Readable;sd.exports.Writable=jm.Writable;sd.exports.Duplex=jm.Duplex;sd.exports.Transform=jm.Transform;sd.exports.PassThrough=jm.PassThrough;sd.exports.addAbortSignal=jm.addAbortSignal;sd.exports.finished=jm.finished;sd.exports.destroy=jm.destroy;sd.exports.destroy=zLn;sd.exports.pipeline=jm.pipeline;sd.exports.compose=jm.compose;Object.defineProperty(jm,"promises",{configurable:!0,enumerable:!0,get(){return ULn}});sd.exports.Stream=jm.Stream;sd.exports.default=sd.exports});var snr=S(qne=>{"use strict";Object.defineProperty(qne,"__esModule",{value:!0});qne.Headers=void 0;var inr;typeof globalThis.Headers<"u"?qne.Headers=inr=globalThis.Headers:qne.Headers=inr=class anr{constructor(e){if(this.headers=new Map,e)if(e instanceof anr)e.forEach((r,n)=>this.append(n,r));else if(Array.isArray(e))for(let[r,n]of e)if(typeof r=="string"&&typeof n=="string")this.append(r,n);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[r,n]of Object.entries(e))if(typeof n=="string")this.append(r,n);else throw new TypeError("Header values must be strings")}append(e,r){let n=e.toLowerCase(),o=this.headers.get(n)||[];this.headers.set(n,[...o,r])}delete(e){let r=e.toLowerCase();this.headers.delete(r)}get(e){let r=e.toLowerCase(),n=this.headers.get(r);return n?n.join(", "):null}has(e){let r=e.toLowerCase();return this.headers.has(r)}set(e,r){let n=e.toLowerCase();this.headers.set(n,[r])}forEach(e,r){let n=r?e.bind(r):e;this.headers.forEach((o,i)=>n(o.join(", "),i,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[e,r]of this.headers.entries())yield[e,r.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let e of this.headers.values())yield e.join(", ")}[Symbol.iterator](){return this.entries()}}});var e7e=S(I2=>{"use strict";Object.defineProperty(I2,"__esModule",{value:!0});I2.unknownRawResponse=I2.abortRawResponse=void 0;I2.toRawResponse=VLn;var unr=snr();I2.abortRawResponse={headers:new unr.Headers,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""};I2.unknownRawResponse={headers:new unr.Headers,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function VLn(t){return{headers:t.headers,redirected:t.redirected,status:t.status,statusText:t.statusText,type:t.type,url:t.url}}});var A2=S((Fva,lnr)=>{"use strict";lnr.exports=TypeError});var cnr=S(()=>{});var Vne=S((Bva,Rnr)=>{var c7e=typeof Map=="function"&&Map.prototype,t7e=Object.getOwnPropertyDescriptor&&c7e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,p0e=c7e&&t7e&&typeof t7e.get=="function"?t7e.get:null,dnr=c7e&&Map.prototype.forEach,d7e=typeof Set=="function"&&Set.prototype,r7e=Object.getOwnPropertyDescriptor&&d7e?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,m0e=d7e&&r7e&&typeof r7e.get=="function"?r7e.get:null,fnr=d7e&&Set.prototype.forEach,HLn=typeof WeakMap=="function"&&WeakMap.prototype,Une=HLn?WeakMap.prototype.has:null,WLn=typeof WeakSet=="function"&&WeakSet.prototype,zne=WLn?WeakSet.prototype.has:null,JLn=typeof WeakRef=="function"&&WeakRef.prototype,pnr=JLn?WeakRef.prototype.deref:null,KLn=Boolean.prototype.valueOf,GLn=Object.prototype.toString,XLn=Function.prototype.toString,ZLn=String.prototype.match,f7e=String.prototype.slice,ck=String.prototype.replace,YLn=String.prototype.toUpperCase,mnr=String.prototype.toLowerCase,Cnr=RegExp.prototype.test,hnr=Array.prototype.concat,tE=Array.prototype.join,QLn=Array.prototype.slice,gnr=Math.floor,i7e=typeof BigInt=="function"?BigInt.prototype.valueOf:null,n7e=Object.getOwnPropertySymbols,a7e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,DK=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ky=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===DK||!0)?Symbol.toStringTag:null,xnr=Object.prototype.propertyIsEnumerable,ynr=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function bnr(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Cnr.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-gnr(-t):gnr(t);if(n!==t){var o=String(n),i=f7e.call(e,o.length+1);return ck.call(o,r,"$&_")+"."+ck.call(ck.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ck.call(e,r,"$&_")}var s7e=cnr(),_nr=s7e.custom,vnr=Enr(_nr)?_nr:null,Tnr={__proto__:null,double:'"',single:"'"},eFn={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Rnr.exports=function t(e,r,n,o){var i=r||{};if(V1(i,"quoteStyle")&&!V1(Tnr,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(V1(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=V1(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(V1(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(V1(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 Mnr(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?bnr(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?bnr(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 u7e(e)?"[Array]":"[Object]";var d=bFn(i,n);if(typeof o>"u")o=[];else if(Pnr(o,e)>=0)return"[Circular]";function f(k,q,Z){if(q&&(o=QLn.call(o),o.push(q)),Z){var V={depth:i.depth};return V1(i,"quoteStyle")&&(V.quoteStyle=i.quoteStyle),t(k,V,n+1,o)}return t(k,i,n+1,o)}if(typeof e=="function"&&!wnr(e)){var p=lFn(e),m=f0e(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+tE.call(m,", ")+" }":"")}if(Enr(e)){var h=DK?ck.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):a7e.call(e);return typeof e=="object"&&!DK?Bne(h):h}if(hFn(e)){for(var y="<"+mnr.call(String(e.nodeName)),g=e.attributes||[],b=0;b<g.length;b++)y+=" "+g[b].name+"="+Onr(tFn(g[b].value),"double",i);return y+=">",e.childNodes&&e.childNodes.length&&(y+="..."),y+="</"+mnr.call(String(e.nodeName))+">",y}if(u7e(e)){if(e.length===0)return"[]";var _=f0e(e,f);return d&&!yFn(_)?"["+l7e(_,d)+"]":"[ "+tE.call(_,", ")+" ]"}if(nFn(e)){var w=f0e(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!xnr.call(e,"cause")?"{ ["+String(e)+"] "+tE.call(hnr.call("[cause]: "+f(e.cause),w),", ")+" }":w.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+tE.call(w,", ")+" }"}if(typeof e=="object"&&a){if(vnr&&typeof e[vnr]=="function"&&s7e)return s7e(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(cFn(e)){var T=[];return dnr&&dnr.call(e,function(k,q){T.push(f(q,e,!0)+" => "+f(k,e))}),Snr("Map",p0e.call(e),T,d)}if(pFn(e)){var O=[];return fnr&&fnr.call(e,function(k){O.push(f(k,e))}),Snr("Set",m0e.call(e),O,d)}if(dFn(e))return o7e("WeakMap");if(mFn(e))return o7e("WeakSet");if(fFn(e))return o7e("WeakRef");if(iFn(e))return Bne(f(Number(e)));if(sFn(e))return Bne(f(i7e.call(e)));if(aFn(e))return Bne(KLn.call(e));if(oFn(e))return Bne(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(!rFn(e)&&!wnr(e)){var E=f0e(e,f),P=ynr?ynr(e)===Object.prototype:e instanceof Object||e.constructor===Object,R=e instanceof Object?"":"null prototype",I=!P&&ky&&Object(e)===e&&ky in e?f7e.call(dk(e),8,-1):R?"Object":"",A=P||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",B=A+(I||R?"["+tE.call(hnr.call([],I||[],R||[]),": ")+"] ":"");return E.length===0?B+"{}":d?B+"{"+l7e(E,d)+"}":B+"{ "+tE.call(E,", ")+" }"}return String(e)};function Onr(t,e,r){var n=r.quoteStyle||e,o=Tnr[n];return o+t+o}function tFn(t){return ck.call(String(t),/"/g,"&quot;")}function u7e(t){return dk(t)==="[object Array]"&&(!ky||!(typeof t=="object"&&ky in t))}function rFn(t){return dk(t)==="[object Date]"&&(!ky||!(typeof t=="object"&&ky in t))}function wnr(t){return dk(t)==="[object RegExp]"&&(!ky||!(typeof t=="object"&&ky in t))}function nFn(t){return dk(t)==="[object Error]"&&(!ky||!(typeof t=="object"&&ky in t))}function oFn(t){return dk(t)==="[object String]"&&(!ky||!(typeof t=="object"&&ky in t))}function iFn(t){return dk(t)==="[object Number]"&&(!ky||!(typeof t=="object"&&ky in t))}function aFn(t){return dk(t)==="[object Boolean]"&&(!ky||!(typeof t=="object"&&ky in t))}function Enr(t){if(DK)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!a7e)return!1;try{return a7e.call(t),!0}catch{}return!1}function sFn(t){if(!t||typeof t!="object"||!i7e)return!1;try{return i7e.call(t),!0}catch{}return!1}var uFn=Object.prototype.hasOwnProperty||function(t){return t in this};function V1(t,e){return uFn.call(t,e)}function dk(t){return GLn.call(t)}function lFn(t){if(t.name)return t.name;var e=ZLn.call(XLn.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Pnr(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 cFn(t){if(!p0e||!t||typeof t!="object")return!1;try{p0e.call(t);try{m0e.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function dFn(t){if(!Une||!t||typeof t!="object")return!1;try{Une.call(t,Une);try{zne.call(t,zne)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function fFn(t){if(!pnr||!t||typeof t!="object")return!1;try{return pnr.call(t),!0}catch{}return!1}function pFn(t){if(!m0e||!t||typeof t!="object")return!1;try{m0e.call(t);try{p0e.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function mFn(t){if(!zne||!t||typeof t!="object")return!1;try{zne.call(t,zne);try{Une.call(t,Une)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function hFn(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function Mnr(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Mnr(f7e.call(t,0,e.maxStringLength),e)+n}var o=eFn[e.quoteStyle||"single"];o.lastIndex=0;var i=ck.call(ck.call(t,o,"\\$1"),/[\x00-\x1f]/g,gFn);return Onr(i,"single",e)}function gFn(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":"")+YLn.call(e.toString(16))}function Bne(t){return"Object("+t+")"}function o7e(t){return t+" { ? }"}function Snr(t,e,r,n){var o=n?l7e(r,n):tE.call(r,", ");return t+" ("+e+") {"+o+"}"}function yFn(t){for(var e=0;e<t.length;e++)if(Pnr(t[e],`
`)>=0)return!1;return!0}function bFn(t,e){var r;if(t.indent==="	")r="	";else if(typeof t.indent=="number"&&t.indent>0)r=tE.call(Array(t.indent+1)," ");else return null;return{base:r,prev:tE.call(Array(e+1),r)}}function l7e(t,e){if(t.length===0)return"";var r=`
`+e.prev+e.base;return r+tE.call(t,","+r)+`
`+e.prev}function f0e(t,e){var r=u7e(t),n=[];if(r){n.length=t.length;for(var o=0;o<t.length;o++)n[o]=V1(t,o)?e(t[o],t):""}var i=typeof n7e=="function"?n7e(t):[],a;if(DK){a={};for(var s=0;s<i.length;s++)a["$"+i[s]]=i[s]}for(var u in t)V1(t,u)&&(r&&String(Number(u))===u&&u<t.length||DK&&a["$"+u]instanceof Symbol||(Cnr.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if(typeof n7e=="function")for(var l=0;l<i.length;l++)xnr.call(t,i[l])&&n.push("["+e(i[l])+"]: "+e(t[i[l]],t));return n}});var Anr=S((Uva,Inr)=>{"use strict";var _Fn=Vne(),vFn=A2(),h0e=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},wFn=function(t,e){if(t){var r=h0e(t,e);return r&&r.value}},SFn=function(t,e,r){var n=h0e(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},CFn=function(t,e){return t?!!h0e(t,e):!1},xFn=function(t,e){if(t)return h0e(t,e,!0)};Inr.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new vFn("Side channel does not contain "+_Fn(n))},delete:function(n){var o=e&&e.next,i=xFn(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return wFn(e,n)},has:function(n){return CFn(e,n)},set:function(n,o){e||(e={next:void 0}),SFn(e,n,o)}};return r}});var p7e=S((zva,Nnr)=>{"use strict";Nnr.exports=Object});var jnr=S((Vva,Dnr)=>{"use strict";Dnr.exports=Error});var Lnr=S((Hva,$nr)=>{"use strict";$nr.exports=EvalError});var knr=S((Wva,Fnr)=>{"use strict";Fnr.exports=RangeError});var Bnr=S((Jva,qnr)=>{"use strict";qnr.exports=ReferenceError});var znr=S((Kva,Unr)=>{"use strict";Unr.exports=SyntaxError});var Hnr=S((Gva,Vnr)=>{"use strict";Vnr.exports=URIError});var Jnr=S((Xva,Wnr)=>{"use strict";Wnr.exports=Math.abs});var Gnr=S((Zva,Knr)=>{"use strict";Knr.exports=Math.floor});var Znr=S((Yva,Xnr)=>{"use strict";Xnr.exports=Math.max});var Qnr=S((Qva,Ynr)=>{"use strict";Ynr.exports=Math.min});var tor=S((ewa,eor)=>{"use strict";eor.exports=Math.pow});var nor=S((twa,ror)=>{"use strict";ror.exports=Math.round});var ior=S((rwa,oor)=>{"use strict";oor.exports=Number.isNaN||function(e){return e!==e}});var sor=S((nwa,aor)=>{"use strict";var TFn=ior();aor.exports=function(e){return TFn(e)||e===0?e:e<0?-1:1}});var lor=S((owa,uor)=>{"use strict";uor.exports=Object.getOwnPropertyDescriptor});var m7e=S((iwa,cor)=>{"use strict";var g0e=lor();if(g0e)try{g0e([],"length")}catch{g0e=null}cor.exports=g0e});var por=S((awa,dor)=>{"use strict";var y0e=Object.defineProperty||!1;if(y0e)try{y0e({},"a",{value:1})}catch{y0e=!1}dor.exports=y0e});var hor=S((swa,mor)=>{"use strict";mor.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 bor=S((uwa,yor)=>{"use strict";var gor=typeof Symbol<"u"&&Symbol,OFn=hor();yor.exports=function(){return typeof gor!="function"||typeof Symbol!="function"||typeof gor("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:OFn()}});var h7e=S((lwa,_or)=>{"use strict";_or.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var g7e=S((cwa,vor)=>{"use strict";var EFn=p7e();vor.exports=EFn.getPrototypeOf||null});var Cor=S((dwa,Sor)=>{"use strict";var PFn="Function.prototype.bind called on incompatible ",MFn=Object.prototype.toString,RFn=Math.max,IFn="[object Function]",wor=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},AFn=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},NFn=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};Sor.exports=function(e){var r=this;if(typeof r!="function"||MFn.apply(r)!==IFn)throw new TypeError(PFn+r);for(var n=AFn(arguments,1),o,i=function(){if(this instanceof o){var c=r.apply(this,wor(n,arguments));return Object(c)===c?c:this}return r.apply(e,wor(n,arguments))},a=RFn(0,r.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(o=Function("binder","return function ("+NFn(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 Hne=S((fwa,xor)=>{"use strict";var DFn=Cor();xor.exports=Function.prototype.bind||DFn});var b0e=S((pwa,Tor)=>{"use strict";Tor.exports=Function.prototype.call});var y7e=S((mwa,Oor)=>{"use strict";Oor.exports=Function.prototype.apply});var Por=S((hwa,Eor)=>{"use strict";Eor.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Ror=S((gwa,Mor)=>{"use strict";var jFn=Hne(),$Fn=y7e(),LFn=b0e(),FFn=Por();Mor.exports=FFn||jFn.call(LFn,$Fn)});var b7e=S((ywa,Ior)=>{"use strict";var kFn=Hne(),qFn=A2(),BFn=b0e(),UFn=Ror();Ior.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new qFn("a function is required");return UFn(kFn,BFn,e)}});var Lor=S((bwa,$or)=>{"use strict";var zFn=b7e(),Aor=m7e(),Dor;try{Dor=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var _7e=!!Dor&&Aor&&Aor(Object.prototype,"__proto__"),jor=Object,Nor=jor.getPrototypeOf;$or.exports=_7e&&typeof _7e.get=="function"?zFn([_7e.get]):typeof Nor=="function"?function(e){return Nor(e==null?e:jor(e))}:!1});var Uor=S((_wa,Bor)=>{"use strict";var For=h7e(),kor=g7e(),qor=Lor();Bor.exports=For?function(e){return For(e)}:kor?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return kor(e)}:qor?function(e){return qor(e)}:null});var Vor=S((vwa,zor)=>{"use strict";var VFn=Function.prototype.call,HFn=Object.prototype.hasOwnProperty,WFn=Hne();zor.exports=WFn.call(VFn,HFn)});var w0e=S((wwa,Xor)=>{"use strict";var Fi,JFn=p7e(),KFn=jnr(),GFn=Lnr(),XFn=knr(),ZFn=Bnr(),FK=znr(),LK=A2(),YFn=Hnr(),QFn=Jnr(),ekn=Gnr(),tkn=Znr(),rkn=Qnr(),nkn=tor(),okn=nor(),ikn=sor(),Kor=Function,v7e=function(t){try{return Kor('"use strict"; return ('+t+").constructor;")()}catch{}},Wne=m7e(),akn=por(),w7e=function(){throw new LK},skn=Wne?function(){try{return arguments.callee,w7e}catch{try{return Wne(arguments,"callee").get}catch{return w7e}}}():w7e,jK=bor()(),Ah=Uor(),ukn=g7e(),lkn=h7e(),Gor=y7e(),Jne=b0e(),$K={},ckn=typeof Uint8Array>"u"||!Ah?Fi:Ah(Uint8Array),N2={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Fi:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Fi:ArrayBuffer,"%ArrayIteratorPrototype%":jK&&Ah?Ah([][Symbol.iterator]()):Fi,"%AsyncFromSyncIteratorPrototype%":Fi,"%AsyncFunction%":$K,"%AsyncGenerator%":$K,"%AsyncGeneratorFunction%":$K,"%AsyncIteratorPrototype%":$K,"%Atomics%":typeof Atomics>"u"?Fi:Atomics,"%BigInt%":typeof BigInt>"u"?Fi:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Fi:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Fi:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Fi:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":KFn,"%eval%":eval,"%EvalError%":GFn,"%Float32Array%":typeof Float32Array>"u"?Fi:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Fi:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Fi:FinalizationRegistry,"%Function%":Kor,"%GeneratorFunction%":$K,"%Int8Array%":typeof Int8Array>"u"?Fi:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Fi:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Fi:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":jK&&Ah?Ah(Ah([][Symbol.iterator]())):Fi,"%JSON%":typeof JSON=="object"?JSON:Fi,"%Map%":typeof Map>"u"?Fi:Map,"%MapIteratorPrototype%":typeof Map>"u"||!jK||!Ah?Fi:Ah(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":JFn,"%Object.getOwnPropertyDescriptor%":Wne,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Fi:Promise,"%Proxy%":typeof Proxy>"u"?Fi:Proxy,"%RangeError%":XFn,"%ReferenceError%":ZFn,"%Reflect%":typeof Reflect>"u"?Fi:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Fi:Set,"%SetIteratorPrototype%":typeof Set>"u"||!jK||!Ah?Fi:Ah(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Fi:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":jK&&Ah?Ah(""[Symbol.iterator]()):Fi,"%Symbol%":jK?Symbol:Fi,"%SyntaxError%":FK,"%ThrowTypeError%":skn,"%TypedArray%":ckn,"%TypeError%":LK,"%Uint8Array%":typeof Uint8Array>"u"?Fi:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Fi:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Fi:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Fi:Uint32Array,"%URIError%":YFn,"%WeakMap%":typeof WeakMap>"u"?Fi:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Fi:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Fi:WeakSet,"%Function.prototype.call%":Jne,"%Function.prototype.apply%":Gor,"%Object.defineProperty%":akn,"%Object.getPrototypeOf%":ukn,"%Math.abs%":QFn,"%Math.floor%":ekn,"%Math.max%":tkn,"%Math.min%":rkn,"%Math.pow%":nkn,"%Math.round%":okn,"%Math.sign%":ikn,"%Reflect.getPrototypeOf%":lkn};if(Ah)try{null.error}catch(t){Hor=Ah(Ah(t)),N2["%Error.prototype%"]=Hor}var Hor,dkn=function t(e){var r;if(e==="%AsyncFunction%")r=v7e("async function () {}");else if(e==="%GeneratorFunction%")r=v7e("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=v7e("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&Ah&&(r=Ah(o.prototype))}return N2[e]=r,r},Wor={__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"]},Kne=Hne(),_0e=Vor(),fkn=Kne.call(Jne,Array.prototype.concat),pkn=Kne.call(Gor,Array.prototype.splice),Jor=Kne.call(Jne,String.prototype.replace),v0e=Kne.call(Jne,String.prototype.slice),mkn=Kne.call(Jne,RegExp.prototype.exec),hkn=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,gkn=/\\(\\)?/g,ykn=function(e){var r=v0e(e,0,1),n=v0e(e,-1);if(r==="%"&&n!=="%")throw new FK("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new FK("invalid intrinsic syntax, expected opening `%`");var o=[];return Jor(e,hkn,function(i,a,s,u){o[o.length]=s?Jor(u,gkn,"$1"):a||i}),o},bkn=function(e,r){var n=e,o;if(_0e(Wor,n)&&(o=Wor[n],n="%"+o[0]+"%"),_0e(N2,n)){var i=N2[n];if(i===$K&&(i=dkn(n)),typeof i>"u"&&!r)throw new LK("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new FK("intrinsic "+e+" does not exist!")};Xor.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new LK("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new LK('"allowMissing" argument must be a boolean');if(mkn(/^%?[^%]*%?$/,e)===null)throw new FK("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=ykn(e),o=n.length>0?n[0]:"",i=bkn("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],pkn(n,fkn([0,1],l)));for(var c=1,d=!0;c<n.length;c+=1){var f=n[c],p=v0e(f,0,1),m=v0e(f,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new FK("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(u=!0),o+="."+f,a="%"+o+"%",_0e(N2,a))s=N2[a];else if(s!=null){if(!(f in s)){if(!r)throw new LK("base intrinsic for "+e+" exists, but the property is not available.");return}if(Wne&&c+1>=n.length){var h=Wne(s,f);d=!!h,d&&"get"in h&&!("originalValue"in h.get)?s=h.get:s=s[f]}else d=_0e(s,f),s=s[f];d&&!u&&(N2[a]=s)}}return s}});var S7e=S((Swa,Qor)=>{"use strict";var Zor=w0e(),Yor=b7e(),_kn=Yor([Zor("%String.prototype.indexOf%")]);Qor.exports=function(e,r){var n=Zor(e,!!r);return typeof n=="function"&&_kn(e,".prototype.")>-1?Yor([n]):n}});var C7e=S((Cwa,tir)=>{"use strict";var vkn=w0e(),Gne=S7e(),wkn=Vne(),Skn=A2(),eir=vkn("%Map%",!0),Ckn=Gne("Map.prototype.get",!0),xkn=Gne("Map.prototype.set",!0),Tkn=Gne("Map.prototype.has",!0),Okn=Gne("Map.prototype.delete",!0),Ekn=Gne("Map.prototype.size",!0);tir.exports=!!eir&&function(){var e,r={assert:function(n){if(!r.has(n))throw new Skn("Side channel does not contain "+wkn(n))},delete:function(n){if(e){var o=Okn(e,n);return Ekn(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return Ckn(e,n)},has:function(n){return e?Tkn(e,n):!1},set:function(n,o){e||(e=new eir),xkn(e,n,o)}};return r}});var nir=S((xwa,rir)=>{"use strict";var Pkn=w0e(),C0e=S7e(),Mkn=Vne(),S0e=C7e(),Rkn=A2(),kK=Pkn("%WeakMap%",!0),Ikn=C0e("WeakMap.prototype.get",!0),Akn=C0e("WeakMap.prototype.set",!0),Nkn=C0e("WeakMap.prototype.has",!0),Dkn=C0e("WeakMap.prototype.delete",!0);rir.exports=kK?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new Rkn("Side channel does not contain "+Mkn(o))},delete:function(o){if(kK&&o&&(typeof o=="object"||typeof o=="function")){if(e)return Dkn(e,o)}else if(S0e&&r)return r.delete(o);return!1},get:function(o){return kK&&o&&(typeof o=="object"||typeof o=="function")&&e?Ikn(e,o):r&&r.get(o)},has:function(o){return kK&&o&&(typeof o=="object"||typeof o=="function")&&e?Nkn(e,o):!!r&&r.has(o)},set:function(o,i){kK&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new kK),Akn(e,o,i)):S0e&&(r||(r=S0e()),r.set(o,i))}};return n}:S0e});var x7e=S((Twa,oir)=>{"use strict";var jkn=A2(),$kn=Vne(),Lkn=Anr(),Fkn=C7e(),kkn=nir(),qkn=kkn||Fkn||Lkn;oir.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new jkn("Side channel does not contain "+$kn(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=qkn()),e.set(n,o)}};return r}});var x0e=S((Owa,iir)=>{"use strict";var Bkn=String.prototype.replace,Ukn=/%20/g,T7e={RFC1738:"RFC1738",RFC3986:"RFC3986"};iir.exports={default:T7e.RFC3986,formatters:{RFC1738:function(t){return Bkn.call(t,Ukn,"+")},RFC3986:function(t){return String(t)}},RFC1738:T7e.RFC1738,RFC3986:T7e.RFC3986}});var R7e=S((Ewa,uir)=>{"use strict";var zkn=x0e(),Vkn=x7e(),O7e=Object.prototype.hasOwnProperty,D2=Array.isArray,O0e=Vkn(),air=function(e,r){return O0e.set(e,r),e},T0e=function(e){return O0e.has(e)},P7e=function(e){return O0e.get(e)},sir=function(e,r){O0e.set(e,r)},rE=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Hkn=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(D2(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);r.obj[r.prop]=o}}},M7e=function(e,r){for(var n=r&&r.plainObjects?{__proto__:null}:{},o=0;o<e.length;++o)typeof e[o]<"u"&&(n[o]=e[o]);return n},Wkn=function t(e,r,n){if(!r)return e;if(typeof r!="object"&&typeof r!="function"){if(D2(e))e.push(r);else if(e&&typeof e=="object")if(T0e(e)){var o=P7e(e)+1;e[o]=r,sir(e,o)}else(n&&(n.plainObjects||n.allowPrototypes)||!O7e.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object"){if(T0e(r)){for(var i=Object.keys(r),a=n&&n.plainObjects?{__proto__:null,0:e}:{0:e},s=0;s<i.length;s++){var u=parseInt(i[s],10);a[u+1]=r[i[s]]}return air(a,P7e(r)+1)}return[e].concat(r)}var l=e;return D2(e)&&!D2(r)&&(l=M7e(e,n)),D2(e)&&D2(r)?(r.forEach(function(c,d){if(O7e.call(e,d)){var f=e[d];f&&typeof f=="object"&&c&&typeof c=="object"?e[d]=t(f,c,n):e.push(c)}else e[d]=c}),e):Object.keys(r).reduce(function(c,d){var f=r[d];return O7e.call(c,d)?c[d]=t(c[d],f,n):c[d]=f,c},l)},Jkn=function(e,r){return Object.keys(r).reduce(function(n,o){return n[o]=r[o],n},e)},Kkn=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}},E7e=1024,Gkn=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(p){return"%26%23"+parseInt(p.slice(2),16)+"%3B"});for(var s="",u=0;u<a.length;u+=E7e){for(var l=a.length>=E7e?a.slice(u,u+E7e):a,c=[],d=0;d<l.length;++d){var f=l.charCodeAt(d);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||i===zkn.RFC1738&&(f===40||f===41)){c[c.length]=l.charAt(d);continue}if(f<128){c[c.length]=rE[f];continue}if(f<2048){c[c.length]=rE[192|f>>6]+rE[128|f&63];continue}if(f<55296||f>=57344){c[c.length]=rE[224|f>>12]+rE[128|f>>6&63]+rE[128|f&63];continue}d+=1,f=65536+((f&1023)<<10|l.charCodeAt(d)&1023),c[c.length]=rE[240|f>>18]+rE[128|f>>12&63]+rE[128|f>>6&63]+rE[128|f&63]}s+=c.join("")}return s},Xkn=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 Hkn(r),e},Zkn=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Ykn=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Qkn=function(e,r,n,o){if(T0e(e)){var i=P7e(e)+1;return e[i]=r,sir(e,i),e}var a=[].concat(e,r);return a.length>n?air(M7e(a,{plainObjects:o}),a.length-1):a},eqn=function(e,r){if(D2(e)){for(var n=[],o=0;o<e.length;o+=1)n.push(r(e[o]));return n}return r(e)};uir.exports={arrayToObject:M7e,assign:Jkn,combine:Qkn,compact:Xkn,decode:Kkn,encode:Gkn,isBuffer:Ykn,isOverflow:T0e,isRegExp:Zkn,maybeMap:eqn,merge:Wkn}});var mir=S((Pwa,pir)=>{"use strict";var cir=x7e(),E0e=R7e(),Xne=x0e(),tqn=Object.prototype.hasOwnProperty,dir={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},nE=Array.isArray,rqn=Array.prototype.push,fir=function(t,e){rqn.apply(t,nE(e)?e:[e])},nqn=Date.prototype.toISOString,lir=Xne.default,$m={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:E0e.encode,encodeValuesOnly:!1,filter:void 0,format:lir,formatter:Xne.formatters[lir],indices:!1,serializeDate:function(e){return nqn.call(e)},skipNulls:!1,strictNullHandling:!1},oqn=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},I7e={},iqn=function t(e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,y,g,b){for(var _=e,w=b,T=0,O=!1;(w=w.get(I7e))!==void 0&&!O;){var E=w.get(e);if(T+=1,typeof E<"u"){if(E===T)throw new RangeError("Cyclic object value");O=!0}typeof w.get(I7e)>"u"&&(T=0)}if(typeof c=="function"?_=c(r,_):_ instanceof Date?_=p(_):n==="comma"&&nE(_)&&(_=E0e.maybeMap(_,function(re){return re instanceof Date?p(re):re})),_===null){if(a)return l&&!y?l(r,$m.encoder,g,"key",m):r;_=""}if(oqn(_)||E0e.isBuffer(_)){if(l){var P=y?r:l(r,$m.encoder,g,"key",m);return[h(P)+"="+h(l(_,$m.encoder,g,"value",m))]}return[h(r)+"="+h(String(_))]}var R=[];if(typeof _>"u")return R;var I;if(n==="comma"&&nE(_))y&&l&&(_=E0e.maybeMap(_,l)),I=[{value:_.length>0?_.join(",")||null:void 0}];else if(nE(c))I=c;else{var A=Object.keys(_);I=d?A.sort(d):A}var B=u?String(r).replace(/\./g,"%2E"):String(r),k=o&&nE(_)&&_.length===1?B+"[]":B;if(i&&nE(_)&&_.length===0)return k+"[]";for(var q=0;q<I.length;++q){var Z=I[q],V=typeof Z=="object"&&Z&&typeof Z.value<"u"?Z.value:_[Z];if(!(s&&V===null)){var Y=f&&u?String(Z).replace(/\./g,"%2E"):String(Z),X=nE(_)?typeof n=="function"?n(k,Y):k:k+(f?"."+Y:"["+Y+"]");b.set(e,T);var W=cir();W.set(I7e,b),fir(R,t(V,X,n,o,i,a,s,u,n==="comma"&&y&&nE(_)?null:l,c,d,f,p,m,h,y,g,W))}}return R},aqn=function(e){if(!e)return $m;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||$m.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=Xne.default;if(typeof e.format<"u"){if(!tqn.call(Xne.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var o=Xne.formatters[n],i=$m.filter;(typeof e.filter=="function"||nE(e.filter))&&(i=e.filter);var a;if(e.arrayFormat in dir?a=e.arrayFormat:"indices"in e?a=e.indices?"indices":"repeat":a=$m.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var s=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:$m.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:$m.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:$m.allowEmptyArrays,arrayFormat:a,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:$m.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?$m.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:$m.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:$m.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:$m.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:$m.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:$m.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:$m.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:$m.strictNullHandling}};pir.exports=function(t,e){var r=t,n=aqn(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):nE(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s=dir[n.arrayFormat],u=s==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);for(var l=cir(),c=0;c<o.length;++c){var d=o[c],f=r[d];n.skipNulls&&f===null||fir(a,iqn(f,d,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))}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 bir=S((Mwa,yir)=>{"use strict";var fk=R7e(),P0e=Object.prototype.hasOwnProperty,hir=Array.isArray,Lc={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:fk.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},sqn=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},gir=function(t,e,r){if(t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1)return t.split(",");if(e.throwOnLimitExceeded&&r>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return t},uqn="utf8=%26%2310003%3B",lqn="utf8=%E2%9C%93",cqn=function(e,r){var n={__proto__:null},o=r.ignoreQueryPrefix?e.replace(/^\?/,""):e;o=o.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var i=r.parameterLimit===1/0?void 0:r.parameterLimit,a=o.split(r.delimiter,r.throwOnLimitExceeded?i+1:i);if(r.throwOnLimitExceeded&&a.length>i)throw new RangeError("Parameter limit exceeded. Only "+i+" parameter"+(i===1?"":"s")+" allowed.");var s=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u<a.length;++u)a[u].indexOf("utf8=")===0&&(a[u]===lqn?l="utf-8":a[u]===uqn&&(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;if(f===-1?(p=r.decoder(c,Lc.decoder,l,"key"),m=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,f),Lc.decoder,l,"key"),p!==null&&(m=fk.maybeMap(gir(c.slice(f+1),r,hir(n[p])?n[p].length:0),function(y){return r.decoder(y,Lc.decoder,l,"value")}))),m&&r.interpretNumericEntities&&l==="iso-8859-1"&&(m=sqn(String(m))),c.indexOf("[]=")>-1&&(m=hir(m)?[m]:m),p!==null){var h=P0e.call(n,p);h&&r.duplicates==="combine"?n[p]=fk.combine(n[p],m,r.arrayLimit,r.plainObjects):(!h||r.duplicates==="last")&&(n[p]=m)}}return n},dqn=function(t,e,r,n){var o=0;if(t.length>0&&t[t.length-1]==="[]"){var i=t.slice(0,-1).join("");o=Array.isArray(e)&&e[i]?e[i].length:0}for(var a=n?e:gir(e,r,o),s=t.length-1;s>=0;--s){var u,l=t[s];if(l==="[]"&&r.parseArrays)fk.isOverflow(a)?u=a:u=r.allowEmptyArrays&&(a===""||r.strictNullHandling&&a===null)?[]:fk.combine([],a,r.arrayLimit,r.plainObjects);else{u=r.plainObjects?{__proto__:null}:{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,d=r.decodeDotInKeys?c.replace(/%2E/g,"."):c,f=parseInt(d,10);!r.parseArrays&&d===""?u={0:a}:!isNaN(f)&&l!==d&&String(f)===d&&f>=0&&r.parseArrays&&f<=r.arrayLimit?(u=[],u[f]=a):d!=="__proto__"&&(u[d]=a)}a=u}return a},fqn=function(e,r){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(r.depth<=0)return!r.plainObjects&&P0e.call(Object.prototype,n)&&!r.allowPrototypes?void 0:[n];var o=/(\[[^[\]]*])/,i=/(\[[^[\]]*])/g,a=o.exec(n),s=a?n.slice(0,a.index):n,u=[];if(s){if(!r.plainObjects&&P0e.call(Object.prototype,s)&&!r.allowPrototypes)return;u.push(s)}for(var l=0;(a=i.exec(n))!==null&&l<r.depth;){l+=1;var c=a[1].slice(1,-1);if(!r.plainObjects&&P0e.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(a[1])}if(a){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");u.push("["+n.slice(a.index)+"]")}return u},pqn=function(e,r,n,o){if(e){var i=fqn(e,n);if(i)return dqn(i,r,n,o)}},mqn=function(e){if(!e)return Lc;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&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");if(typeof e.throwOnLimitExceeded<"u"&&typeof e.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var r=typeof e.charset>"u"?Lc.charset:e.charset,n=typeof e.duplicates>"u"?Lc.duplicates:e.duplicates;if(n!=="combine"&&n!=="first"&&n!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var o=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:Lc.allowDots:!!e.allowDots;return{allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Lc.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Lc.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Lc.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Lc.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Lc.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Lc.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:Lc.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:Lc.decoder,delimiter:typeof e.delimiter=="string"||fk.isRegExp(e.delimiter)?e.delimiter:Lc.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Lc.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Lc.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Lc.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Lc.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:Lc.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Lc.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}};yir.exports=function(t,e){var r=mqn(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?{__proto__:null}:{};for(var n=typeof t=="string"?cqn(t,r):t,o=r.plainObjects?{__proto__:null}:{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],u=pqn(s,n[s],r,typeof t=="string");o=fk.merge(o,u,r)}return r.allowSparse===!0?o:fk.compact(o)}});var A7e=S((Rwa,_ir)=>{"use strict";var hqn=mir(),gqn=bir(),yqn=x0e();_ir.exports={formats:yqn,parse:gqn,stringify:hqn}});var vir=S(Zne=>{"use strict";var bqn=Zne&&Zne.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Zne,"__esModule",{value:!0});Zne.createRequestUrl=vqn;var _qn=bqn(A7e());function vqn(t,e){return Object.keys(e??{}).length>0?`${t}?${_qn.default.stringify(e,{arrayFormat:"repeat"})}`:t}});var wir=S(M0e=>{"use strict";Object.defineProperty(M0e,"__esModule",{value:!0});M0e.RUNTIME=void 0;M0e.RUNTIME=wqn();function wqn(){var t,e,r,n,o;return typeof window<"u"&&typeof window.document<"u"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis<"u"&&((t=globalThis?.navigator)===null||t===void 0?void 0:t.userAgent)==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof self?.importScripts=="function"&&(((e=self.constructor)===null||e===void 0?void 0:e.name)==="DedicatedWorkerGlobalScope"||((r=self.constructor)===null||r===void 0?void 0:r.name)==="ServiceWorkerGlobalScope"||((n=self.constructor)===null||n===void 0?void 0:n.name)==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u"?{type:"deno",version:Deno.version.deno}:typeof Bun<"u"&&typeof Bun.version<"u"?{type:"bun",version:Bun.version}:typeof process<"u"&&"version"in process&&!!process.version&&"versions"in process&&!!(!((o=process.versions)===null||o===void 0)&&o.node)?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:typeof navigator<"u"&&navigator?.product==="ReactNative"?{type:"react-native"}:{type:"unknown"}}});var qK=S(R0e=>{"use strict";Object.defineProperty(R0e,"__esModule",{value:!0});R0e.RUNTIME=void 0;var Sqn=wir();Object.defineProperty(R0e,"RUNTIME",{enumerable:!0,get:function(){return Sqn.RUNTIME}})});var N7e=S((BK,Sir)=>{"use strict";var Cqn=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},j2=Cqn();Sir.exports=BK=j2.fetch;j2.fetch&&(BK.default=j2.fetch.bind(j2));BK.Headers=j2.Headers;BK.Request=j2.Request;BK.Response=j2.Response});var xir=S(sx=>{"use strict";var xqn=sx&&sx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tqn=sx&&sx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cir=sx&&sx.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&xqn(r,e,n[o]);return Tqn(r,e),r}}(),Oqn=sx&&sx.__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(sx,"__esModule",{value:!0});sx.getFetchFn=Eqn;var I0e=qK();function Eqn(){return Oqn(this,void 0,void 0,function*(){return I0e.RUNTIME.type==="node"&&I0e.RUNTIME.parsedVersion!=null&&I0e.RUNTIME.parsedVersion>=18?fetch:I0e.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>Cir(N7e()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>Cir(N7e()))).default})}});var Tir=S(Yne=>{"use strict";var Pqn=Yne&&Yne.__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(Yne,"__esModule",{value:!0});Yne.getRequestBody=Rqn;var Mqn=h_e();function Rqn(t){return Pqn(this,arguments,void 0,function*({body:e,type:r}){return r.includes("json")?(0,Mqn.toJson)(e):e})}});var Oir=S(UK=>{"use strict";var ux=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.Node18UniversalStreamWrapper=void 0;var D7e=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=>ux(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",()=>ux(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>ux(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=>ux(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",()=>ux(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>ux(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 ux(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 ux(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 ux(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 ux(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:()=>ux(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.Node18UniversalStreamWrapper=D7e});var Eir=S(zK=>{"use strict";var Qne=zK&&zK.__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(zK,"__esModule",{value:!0});zK.UndiciStreamWrapper=void 0;var j7e=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 Qne(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 Qne(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 Qne(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 Qne(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:()=>Qne(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}}}};zK.UndiciStreamWrapper=j7e});var Pir=S(pk=>{"use strict";var A0e=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())})},Iqn=pk&&pk.__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(pk,"__esModule",{value:!0});pk.NodePre18StreamWrapper=void 0;var $7e=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 A0e(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(){return A0e(this,void 0,void 0,function*(){var e,r,n,o;let i=[],a=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");try{for(var s=!0,u=Iqn(this.readableStream),l;l=yield u.next(),e=l.done,!e;s=!0){o=l.value,s=!1;let d=o;i.push(a.encode(d))}}catch(d){r={error:d}}finally{try{!s&&!e&&(n=u.return)&&(yield n.call(u))}finally{if(r)throw r.error}}return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(i))})}json(){return A0e(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 A0e(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};pk.NodePre18StreamWrapper=$7e});var Mir=S(lx=>{"use strict";var Aqn=lx&&lx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Nqn=lx&&lx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L7e=lx&&lx.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Aqn(r,e,n[o]);return Nqn(r,e),r}}(),Dqn=lx&&lx.__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(lx,"__esModule",{value:!0});lx.chooseStreamWrapper=jqn;var N0e=qK();function jqn(t){return Dqn(this,void 0,void 0,function*(){return N0e.RUNTIME.type==="node"&&N0e.RUNTIME.parsedVersion!=null&&N0e.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>L7e(Oir()))).Node18UniversalStreamWrapper(t):N0e.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>L7e(Eir()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>L7e(Pir()))).NodePre18StreamWrapper(t)})}});var Rir=S(eoe=>{"use strict";var $qn=eoe&&eoe.__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(eoe,"__esModule",{value:!0});eoe.getResponseBody=Fqn;var Lqn=Mir();function Fqn(t,e){return $qn(this,void 0,void 0,function*(){if(t.body!=null&&e==="blob")return yield t.blob();if(t.body!=null&&e==="arrayBuffer")return yield t.arrayBuffer();if(t.body!=null&&e==="sse")return t.body;if(t.body!=null&&e==="streaming")return(0,Lqn.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}})}});var Iir=S(D0e=>{"use strict";Object.defineProperty(D0e,"__esModule",{value:!0});D0e.getTimeoutSignal=qqn;D0e.anySignal=Bqn;var kqn="timeout";function qqn(t){let e=new AbortController,r=setTimeout(()=>e.abort(kqn),t);return{signal:e.signal,abortId:r}}function Bqn(...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}});var Nir=S(VK=>{"use strict";var Uqn=VK&&VK.__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(VK,"__esModule",{value:!0});VK.makeRequest=void 0;var Air=Iir(),zqn=(t,e,r,n,o,i,a,s,u)=>Uqn(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:m}=(0,Air.getTimeoutSignal)(i);c=m,l.push(p)}a!=null&&l.push(a);let d=(0,Air.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});VK.makeRequest=zqn});var Dir=S(toe=>{"use strict";var Vqn=toe&&toe.__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(toe,"__esModule",{value:!0});toe.requestWithRetries=Xqn;var Hqn=1e3,Wqn=6e4,Jqn=2,Kqn=.2;function Gqn(t){let e=1+(Math.random()*2-1)*Kqn;return t*e}function Xqn(t){return Vqn(this,arguments,void 0,function*(e,r=Jqn){let n=yield e();for(let o=0;o<r&&([408,429].includes(n.status)||n.status>=500);++o){let i=Math.min(Hqn*Math.pow(2,o),Wqn),a=Gqn(i);yield new Promise(s=>setTimeout(s,a)),n=yield e()}return n})}});var Lir=S($2=>{"use strict";var jir=$2&&$2.__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($2,"__esModule",{value:!0});$2.fetcher=void 0;$2.fetcherImpl=$ir;var Zqn=h_e(),HK=e7e(),Yqn=vir(),Qqn=xir(),eBn=Tir(),tBn=Rir(),rBn=Nir(),nBn=Dir();function $ir(t){return jir(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,Yqn.createRequestUrl)(t.url,t.queryParameters),n=yield(0,eBn.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,Qqn.getFetchFn)();try{let i=yield(0,nBn.requestWithRetries)(()=>jir(this,void 0,void 0,function*(){return(0,rBn.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,tBn.getResponseBody)(i,t.responseType);return i.status>=200&&i.status<400?{ok:!0,body:a,headers:i.headers,rawResponse:(0,HK.toRawResponse)(i)}:{ok:!1,error:{reason:"status-code",statusCode:i.status,body:a},rawResponse:(0,HK.toRawResponse)(i)}}catch(i){return t.abortSignal!=null&&t.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:HK.abortRawResponse}:i instanceof Error&&i.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:HK.abortRawResponse}:i instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:i.message},rawResponse:HK.unknownRawResponse}:{ok:!1,error:{reason:"unknown",errorMessage:(0,Zqn.toJson)(i)},rawResponse:HK.unknownRawResponse}}})}$2.fetcher=$ir});var Fir=S(F7e=>{"use strict";Object.defineProperty(F7e,"__esModule",{value:!0});F7e.getHeader=oBn;function oBn(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}});var kir=S(WK=>{"use strict";var iBn=WK&&WK.__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(WK,"__esModule",{value:!0});WK.Supplier=void 0;WK.Supplier={get:t=>iBn(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var qir=S(JK=>{"use strict";var aBn=JK&&JK.__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(JK,"__esModule",{value:!0});JK.HttpResponsePromise=void 0;var k7e=class t extends Promise{constructor(e){super(r=>{r(void 0)}),this.innerPromise=e}static fromFunction(e,...r){return new t(e(...r))}static interceptFunction(e){return(...r)=>t.fromPromise(e(...r))}static fromPromise(e){return new t(e)}static fromExecutor(e){let r=new Promise(e);return new t(r)}static fromResult(e){let r=Promise.resolve(e);return new t(r)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:e})=>e)),this.unwrappedPromise}then(e,r){return this.unwrap().then(e,r)}catch(e){return this.unwrap().catch(e)}finally(e){return this.unwrap().finally(e)}withRawResponse(){return aBn(this,void 0,void 0,function*(){return yield this.innerPromise})}};JK.HttpResponsePromise=k7e});var Bir=S(qy=>{"use strict";Object.defineProperty(qy,"__esModule",{value:!0});qy.HttpResponsePromise=qy.unknownRawResponse=qy.toRawResponse=qy.abortRawResponse=qy.Supplier=qy.getHeader=qy.fetcher=void 0;var sBn=Lir();Object.defineProperty(qy,"fetcher",{enumerable:!0,get:function(){return sBn.fetcher}});var uBn=Fir();Object.defineProperty(qy,"getHeader",{enumerable:!0,get:function(){return uBn.getHeader}});var lBn=kir();Object.defineProperty(qy,"Supplier",{enumerable:!0,get:function(){return lBn.Supplier}});var q7e=e7e();Object.defineProperty(qy,"abortRawResponse",{enumerable:!0,get:function(){return q7e.abortRawResponse}});Object.defineProperty(qy,"toRawResponse",{enumerable:!0,get:function(){return q7e.toRawResponse}});Object.defineProperty(qy,"unknownRawResponse",{enumerable:!0,get:function(){return q7e.unknownRawResponse}});var cBn=qir();Object.defineProperty(qy,"HttpResponsePromise",{enumerable:!0,get:function(){return cBn.HttpResponsePromise}})});var Uir=S((B7e,U7e)=>{(function(t,e){typeof B7e=="object"&&typeof U7e<"u"?U7e.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:B7e,function(){"use strict";var t="3.7.7",e=t,r=typeof Buffer=="function",n=typeof TextDecoder=="function"?new TextDecoder:void 0,o=typeof TextEncoder=="function"?new TextEncoder:void 0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=Array.prototype.slice.call(i),s=function(L){var J={};return L.forEach(function(ne,D){return J[ne]=D}),J}(a),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,l=String.fromCharCode.bind(String),c=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(L){return new Uint8Array(Array.prototype.slice.call(L,0))},d=function(L){return L.replace(/=/g,"").replace(/[+\/]/g,function(J){return J=="+"?"-":"_"})},f=function(L){return L.replace(/[^A-Za-z0-9\+\/]/g,"")},p=function(L){for(var J,ne,D,N,z="",H=L.length%3,oe=0;oe<L.length;){if((ne=L.charCodeAt(oe++))>255||(D=L.charCodeAt(oe++))>255||(N=L.charCodeAt(oe++))>255)throw new TypeError("invalid character found");J=ne<<16|D<<8|N,z+=a[J>>18&63]+a[J>>12&63]+a[J>>6&63]+a[J&63]}return H?z.slice(0,H-3)+"===".substring(H):z},m=typeof btoa=="function"?function(L){return btoa(L)}:r?function(L){return Buffer.from(L,"binary").toString("base64")}:p,h=r?function(L){return Buffer.from(L).toString("base64")}:function(L){for(var J=4096,ne=[],D=0,N=L.length;D<N;D+=J)ne.push(l.apply(null,L.subarray(D,D+J)));return m(ne.join(""))},y=function(L,J){return J===void 0&&(J=!1),J?d(h(L)):h(L)},g=function(L){if(L.length<2){var J=L.charCodeAt(0);return J<128?L:J<2048?l(192|J>>>6)+l(128|J&63):l(224|J>>>12&15)+l(128|J>>>6&63)+l(128|J&63)}else{var J=65536+(L.charCodeAt(0)-55296)*1024+(L.charCodeAt(1)-56320);return l(240|J>>>18&7)+l(128|J>>>12&63)+l(128|J>>>6&63)+l(128|J&63)}},b=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,_=function(L){return L.replace(b,g)},w=r?function(L){return Buffer.from(L,"utf8").toString("base64")}:o?function(L){return h(o.encode(L))}:function(L){return m(_(L))},T=function(L,J){return J===void 0&&(J=!1),J?d(w(L)):w(L)},O=function(L){return T(L,!0)},E=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,P=function(L){switch(L.length){case 4:var J=(7&L.charCodeAt(0))<<18|(63&L.charCodeAt(1))<<12|(63&L.charCodeAt(2))<<6|63&L.charCodeAt(3),ne=J-65536;return l((ne>>>10)+55296)+l((ne&1023)+56320);case 3:return l((15&L.charCodeAt(0))<<12|(63&L.charCodeAt(1))<<6|63&L.charCodeAt(2));default:return l((31&L.charCodeAt(0))<<6|63&L.charCodeAt(1))}},R=function(L){return L.replace(E,P)},I=function(L){if(L=L.replace(/\s+/g,""),!u.test(L))throw new TypeError("malformed base64.");L+="==".slice(2-(L.length&3));for(var J,ne="",D,N,z=0;z<L.length;)J=s[L.charAt(z++)]<<18|s[L.charAt(z++)]<<12|(D=s[L.charAt(z++)])<<6|(N=s[L.charAt(z++)]),ne+=D===64?l(J>>16&255):N===64?l(J>>16&255,J>>8&255):l(J>>16&255,J>>8&255,J&255);return ne},A=typeof atob=="function"?function(L){return atob(f(L))}:r?function(L){return Buffer.from(L,"base64").toString("binary")}:I,B=r?function(L){return c(Buffer.from(L,"base64"))}:function(L){return c(A(L).split("").map(function(J){return J.charCodeAt(0)}))},k=function(L){return B(Z(L))},q=r?function(L){return Buffer.from(L,"base64").toString("utf8")}:n?function(L){return n.decode(B(L))}:function(L){return R(A(L))},Z=function(L){return f(L.replace(/[-_]/g,function(J){return J=="-"?"+":"/"}))},V=function(L){return q(Z(L))},Y=function(L){if(typeof L!="string")return!1;var J=L.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(J)||!/[^\s0-9a-zA-Z\-_]/.test(J)},X=function(L){return{value:L,enumerable:!1,writable:!0,configurable:!0}},W=function(){var L=function(J,ne){return Object.defineProperty(String.prototype,J,X(ne))};L("fromBase64",function(){return V(this)}),L("toBase64",function(J){return T(this,J)}),L("toBase64URI",function(){return T(this,!0)}),L("toBase64URL",function(){return T(this,!0)}),L("toUint8Array",function(){return k(this)})},re=function(){var L=function(J,ne){return Object.defineProperty(Uint8Array.prototype,J,X(ne))};L("toBase64",function(J){return y(this,J)}),L("toBase64URI",function(){return y(this,!0)}),L("toBase64URL",function(){return y(this,!0)})},ue=function(){W(),re()},le={version:t,VERSION:e,atob:A,atobPolyfill:I,btoa:m,btoaPolyfill:p,fromBase64:V,toBase64:T,encode:T,encodeURI:O,encodeURL:O,utob:_,btou:R,decode:V,isValid:Y,fromUint8Array:y,toUint8Array:k,extendString:W,extendUint8Array:re,extendBuiltins:ue};return le.Base64={},Object.keys(le).forEach(function(L){return le.Base64[L]=le[L]}),le})});var Vir=S(j0e=>{"use strict";Object.defineProperty(j0e,"__esModule",{value:!0});j0e.BasicAuth=void 0;var zir=Uir(),dBn=/^Basic /i;j0e.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${zir.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(dBn,""),r=zir.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 Hir=S($0e=>{"use strict";Object.defineProperty($0e,"__esModule",{value:!0});$0e.BearerToken=void 0;var fBn=/^Bearer /i;$0e.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(fBn,"").trim()}});var Wir=S(KK=>{"use strict";Object.defineProperty(KK,"__esModule",{value:!0});KK.BearerToken=KK.BasicAuth=void 0;var pBn=Vir();Object.defineProperty(KK,"BasicAuth",{enumerable:!0,get:function(){return pBn.BasicAuth}});var mBn=Hir();Object.defineProperty(KK,"BearerToken",{enumerable:!0,get:function(){return mBn.BearerToken}})});var V7e=S(_w=>{"use strict";var Jir=_w&&_w.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},Kir=_w&&_w.__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)}},cx=_w&&_w.__await||function(t){return this instanceof cx?(this.v=t,this):new cx(t)},Gir=_w&&_w.__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=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(y,g){i.push([p,h,y,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 cx?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])}};Object.defineProperty(_w,"__esModule",{value:!0});_w.Stream=void 0;_w.readableStreamAsyncIterable=Xir;var hBn=qK(),gBn="data:",z7e=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=gBn,this.messageTerminator=`
`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return Gir(this,arguments,function*(){var r,n,o,i;this.controller.signal;let a=Xir(this.stream),s="",u=!1;try{for(var l=!0,c=Kir(a),d;d=yield cx(c.next()),r=d.done,!r;l=!0){i=d.value,l=!1;let f=i;s+=this.decodeChunk(f);let p;for(;(p=s.indexOf(this.messageTerminator))>=0;){let m=s.slice(0,p+1);if(s=s.slice(p+this.messageTerminator.length),!m.trim())continue;if(!u&&this.prefix!=null){let y=m.indexOf(this.prefix);if(y===-1)continue;u=!0,m=m.slice(y+this.prefix.length)}if(this.streamTerminator!=null&&m.includes(this.streamTerminator))return yield cx(void 0);let h=yield cx(this.parse(JSON.parse(m)));yield yield cx(h),u=!1}}}catch(f){n={error:f}}finally{try{!l&&!r&&(o=c.return)&&(yield cx(o.call(c)))}finally{if(n)throw n.error}}})}[Symbol.asyncIterator](){return Gir(this,arguments,function*(){var r,n,o,i;try{for(var a=!0,s=Kir(this.iterMessages()),u;u=yield cx(s.next()),r=u.done,!r;a=!0)i=u.value,a=!1,yield yield cx(i)}catch(l){n={error:l}}finally{try{!a&&!r&&(o=s.return)&&(yield cx(o.call(s)))}finally{if(n)throw n.error}}})}decodeChunk(e){let r="";if(typeof TextDecoder<"u"){let n=new TextDecoder("utf8");r+=n.decode(e)}else hBn.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};_w.Stream=z7e;function Xir(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return Jir(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 Jir(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}});var Zir=S(L0e=>{"use strict";Object.defineProperty(L0e,"__esModule",{value:!0});L0e.Stream=void 0;var yBn=V7e();Object.defineProperty(L0e,"Stream",{enumerable:!0,get:function(){return yBn.Stream}})});var Yir=S(roe=>{"use strict";var bBn=roe&&roe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(roe,"__esModule",{value:!0});roe.encodeAsFormParameter=vBn;var _Bn=bBn(A7e());function vBn(t){let r=_Bn.default.stringify(t,{encode:!1}).split("&").map(n=>{let[o,i]=n.split("=");return[o,i]});return Object.fromEntries(r)}});var tar=S((tSa,ear)=>{"use strict";var H7e=Object.defineProperty,wBn=Object.getOwnPropertyDescriptor,SBn=Object.getOwnPropertyNames,CBn=Object.prototype.hasOwnProperty,xBn=(t,e)=>{for(var r in e)H7e(t,r,{get:e[r],enumerable:!0})},TBn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of SBn(e))!CBn.call(t,o)&&o!==r&&H7e(t,o,{get:()=>e[o],enumerable:!(n=wBn(e,o))||n.enumerable});return t},OBn=t=>TBn(H7e({},"__esModule",{value:!0}),t),Qir={};xBn(Qir,{Blob:()=>MBn,File:()=>RBn,FormData:()=>PBn});ear.exports=OBn(Qir);var EBn=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:PBn,Blob:MBn,File:RBn}=EBn});var mar=S((rSa,par)=>{"use strict";var K7e=Object.defineProperty,IBn=Object.getOwnPropertyDescriptor,ABn=Object.getOwnPropertyNames,NBn=Object.prototype.hasOwnProperty,DBn=(t,e)=>{for(var r in e)K7e(t,r,{get:e[r],enumerable:!0})},jBn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ABn(e))!NBn.call(t,o)&&o!==r&&K7e(t,o,{get:()=>e[o],enumerable:!(n=IBn(e,o))||n.enumerable});return t},$Bn=t=>jBn(K7e({},"__esModule",{value:!0}),t),G7e=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},Fc=(t,e,r)=>(G7e(t,e,"read from private field"),r?r.call(t):e.get(t)),oE=(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)},noe=(t,e,r,n)=>(G7e(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),W7e=(t,e,r)=>(G7e(t,e,"access private method"),r),uar={};DBn(uar,{FormDataEncoder:()=>VBn,isFile:()=>F2,isFormData:()=>dar});par.exports=$Bn(uar);var H1=t=>typeof t=="function",LBn=t=>H1(t[Symbol.asyncIterator]),rar=65536;function*lar(t){if(t.byteLength<=rar){yield t;return}let e=0;for(;e<t.byteLength;){let r=Math.min(t.byteLength-e,rar),n=t.buffer.slice(e,e+r);e+=n.byteLength,yield new Uint8Array(n)}}async function*FBn(t){let e=t.getReader();for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}async function*nar(t){for await(let e of t)yield*lar(e)}var kBn=t=>{if(LBn(t))return nar(t);if(H1(t.getReader))return nar(FBn(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},oar="abcdefghijklmnopqrstuvwxyz0123456789";function qBn(){let t=16,e="";for(;t--;)e+=oar[Math.random()*oar.length<<0];return e}var car=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==`
`||e===`
`&&n[r-1]!=="\r"?`\r
`:e),BBn=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function iar(t){if(BBn(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function aar(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var UBn=t=>new Proxy(t,{get:(e,r)=>aar(e,r),has:(e,r)=>aar(e,r)!==void 0}),dar=t=>!!(t&&H1(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&H1(t.append)&&H1(t.getAll)&&H1(t.entries)&&H1(t[Symbol.iterator])),sar=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),F2=t=>!!(t&&typeof t=="object"&&H1(t.constructor)&&t[Symbol.toStringTag]==="File"&&H1(t.stream)&&t.name!=null),zBn={enableAdditionalHeaders:!1},F0e={writable:!1,configurable:!1},mk,ooe,k0e,ioe,L2,aoe,soe,q0e,B0e,X7e,J7e,far,VBn=class{constructor(t,e,r){if(oE(this,B0e),oE(this,J7e),oE(this,mk,`\r
`),oE(this,ooe,void 0),oE(this,k0e,void 0),oE(this,ioe,"-".repeat(2)),oE(this,L2,new TextEncoder),oE(this,aoe,void 0),oE(this,soe,void 0),oE(this,q0e,void 0),!dar(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(iar(e)?r=e:n=e,n||(n=qBn()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!iar(r))throw new TypeError("Expected options argument to be an object.");noe(this,soe,Array.from(t.entries())),noe(this,q0e,{...zBn,...r}),noe(this,ooe,Fc(this,L2).encode(Fc(this,mk))),noe(this,k0e,Fc(this,ooe).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,noe(this,aoe,Fc(this,L2).encode(`${Fc(this,ioe)}${this.boundary}${Fc(this,ioe)}${Fc(this,mk).repeat(2)}`));let o={"Content-Type":this.contentType},i=W7e(this,J7e,far).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=UBn(Object.freeze(o)),Object.defineProperties(this,{boundary:F0e,contentType:F0e,contentLength:F0e,headers:F0e})}*values(){for(let[t,e]of Fc(this,soe)){let r=F2(e)?e:Fc(this,L2).encode(car(e));yield W7e(this,B0e,X7e).call(this,t,r),yield r,yield Fc(this,ooe)}yield Fc(this,aoe)}async*encode(){for(let t of this.values())F2(t)?yield*kBn(t.stream()):yield*lar(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};mk=new WeakMap;ooe=new WeakMap;k0e=new WeakMap;ioe=new WeakMap;L2=new WeakMap;aoe=new WeakMap;soe=new WeakMap;q0e=new WeakMap;B0e=new WeakSet;X7e=function(t,e){let r="";if(r+=`${Fc(this,ioe)}${this.boundary}${Fc(this,mk)}`,r+=`Content-Disposition: form-data; name="${sar(t)}"`,F2(e)&&(r+=`; filename="${sar(e.name)}"${Fc(this,mk)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),Fc(this,q0e).enableAdditionalHeaders===!0){let n=F2(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${Fc(this,mk)}Content-Length: ${n}`)}return Fc(this,L2).encode(`${r}${Fc(this,mk).repeat(2)}`)};J7e=new WeakSet;far=function(){let t=0;for(let[e,r]of Fc(this,soe)){let n=F2(r)?r:Fc(this,L2).encode(car(r)),o=F2(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=W7e(this,B0e,X7e).call(this,e,n).byteLength,t+=o,t+=Fc(this,k0e)}return String(t+Fc(this,aoe).byteLength)}});var gar=S((oSa,har)=>{"use strict";har.exports=typeof self=="object"?self.FormData:window.FormData});var yar=S(Ng=>{"use strict";var HBn=Ng&&Ng.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WBn=Ng&&Ng.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GK=Ng&&Ng.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&HBn(r,e,n[o]);return WBn(r,e),r}}(),hk=Ng&&Ng.__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(Ng,"__esModule",{value:!0});Ng.WebFormData=Ng.Node16FormData=Ng.Node18FormData=void 0;Ng.newFormData=JBn;var U0e=qK();function Z7e(t){return typeof t=="object"&&t!=null&&"name"in t}function JBn(){return hk(this,void 0,void 0,function*(){let t;return U0e.RUNTIME.type==="node"&&U0e.RUNTIME.parsedVersion!=null&&U0e.RUNTIME.parsedVersion>=18?t=new z0e:U0e.RUNTIME.type==="node"?t=new V0e:t=new H0e,yield t.setup(),t})}var z0e=class{setup(){return hk(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>GK(tar()))).FormData})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){return hk(this,void 0,void 0,function*(){var o,i;n==null&&Z7e(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>GK(kne()))).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 hk(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>GK(mar()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>GK(kne()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};Ng.Node18FormData=z0e;var V0e=class{setup(){return hk(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>GK(gar()))).default})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){return hk(this,void 0,void 0,function*(){var o,i;n==null&&Z7e(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>GK(kne()))).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():{}}}};Ng.Node16FormData=V0e;var H0e=class{setup(){return hk(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){return hk(this,void 0,void 0,function*(){var o;n==null&&Z7e(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};Ng.WebFormData=H0e});var bar=S(W1=>{"use strict";var KBn=W1&&W1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GBn=W1&&W1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KBn(e,t,r)};Object.defineProperty(W1,"__esModule",{value:!0});W1.encodeAsFormParameter=void 0;var XBn=Yir();Object.defineProperty(W1,"encodeAsFormParameter",{enumerable:!0,get:function(){return XBn.encodeAsFormParameter}});GBn(yar(),W1)});var Nh=S(W0e=>{"use strict";Object.defineProperty(W0e,"__esModule",{value:!0});W0e.SchemaType=void 0;W0e.SchemaType={BIGINT:"bigint",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",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"}});var Bb=S(Y7e=>{"use strict";Object.defineProperty(Y7e,"__esModule",{value:!0});Y7e.getErrorMessageForIncorrectType=ZBn;function ZBn(t,e){return`Expected ${e}. Received ${YBn(t)}.`}function YBn(t){if(Array.isArray(t))return"list";if(t===null)return"null";if(t instanceof BigInt)return"BigInt";switch(typeof t){case"string":return`"${t}"`;case"bigint":case"number":case"boolean":case"undefined":return`${t}`}return typeof t}});var iE=S(Q7e=>{"use strict";Object.defineProperty(Q7e,"__esModule",{value:!0});Q7e.maybeSkipValidation=QBn;function QBn(t){return Object.assign(Object.assign({},t),{json:_ar(t.json),parse:_ar(t.parse)})}function _ar(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 tXe=S(eXe=>{"use strict";Object.defineProperty(eXe,"__esModule",{value:!0});eXe.stringifyValidationError=eUn;function eUn(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}});var nXe=S(J0e=>{"use strict";Object.defineProperty(J0e,"__esModule",{value:!0});J0e.JsonError=void 0;var tUn=tXe(),rXe=class t extends Error{constructor(e){super(e.map(tUn.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};J0e.JsonError=rXe});var iXe=S(K0e=>{"use strict";Object.defineProperty(K0e,"__esModule",{value:!0});K0e.ParseError=void 0;var rUn=tXe(),oXe=class t extends Error{constructor(e){super(e.map(rUn.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};K0e.ParseError=oXe});var Tar=S(k2=>{"use strict";Object.defineProperty(k2,"__esModule",{value:!0});k2.getSchemaUtils=uoe;k2.nullable=war;k2.optional=Sar;k2.optionalNullable=Car;k2.transform=xar;var aXe=Nh(),nUn=nXe(),oUn=iXe();function uoe(t){return{nullable:()=>war(t),optional:()=>Sar(t),optionalNullable:()=>Car(t),transform:e=>xar(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new oUn.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new nUn.JsonError(n.errors)}}}function war(t){let e={parse:(r,n)=>r==null?{ok:!0,value:null}:t.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:t.json(r,n),getType:()=>aXe.SchemaType.NULLABLE};return Object.assign(Object.assign({},e),uoe(e))}function Sar(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:()=>aXe.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),uoe(e))}function Car(t){let e={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:t.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:t.json(r,n),getType:()=>aXe.SchemaType.OPTIONAL_NULLABLE};return Object.assign(Object.assign({},e),uoe(e))}function xar(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),uoe(r))}});var H_=S(e0=>{"use strict";Object.defineProperty(e0,"__esModule",{value:!0});e0.ParseError=e0.JsonError=e0.transform=e0.optional=e0.getSchemaUtils=void 0;var sXe=Tar();Object.defineProperty(e0,"getSchemaUtils",{enumerable:!0,get:function(){return sXe.getSchemaUtils}});Object.defineProperty(e0,"optional",{enumerable:!0,get:function(){return sXe.optional}});Object.defineProperty(e0,"transform",{enumerable:!0,get:function(){return sXe.transform}});var iUn=nXe();Object.defineProperty(e0,"JsonError",{enumerable:!0,get:function(){return iUn.JsonError}});var aUn=iXe();Object.defineProperty(e0,"ParseError",{enumerable:!0,get:function(){return aUn.ParseError}})});var Ear=S(uXe=>{"use strict";Object.defineProperty(uXe,"__esModule",{value:!0});uXe.bigint=cUn;var sUn=Nh(),Oar=Bb(),uUn=iE(),lUn=H_();function cUn(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e=="bigint"?{ok:!0,value:e}:typeof e=="number"?{ok:!0,value:BigInt(e)}:{ok:!1,errors:[{path:r,message:(0,Oar.getErrorMessageForIncorrectType)(e,"bigint | number")}]},json:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="bigint"?{ok:!1,errors:[{path:r,message:(0,Oar.getErrorMessageForIncorrectType)(e,"bigint")}]}:{ok:!0,value:e},getType:()=>sUn.SchemaType.BIGINT};return Object.assign(Object.assign({},(0,uUn.maybeSkipValidation)(t)),(0,lUn.getSchemaUtils)(t))}});var Par=S(G0e=>{"use strict";Object.defineProperty(G0e,"__esModule",{value:!0});G0e.bigint=void 0;var dUn=Ear();Object.defineProperty(G0e,"bigint",{enumerable:!0,get:function(){return dUn.bigint}})});var Mar=S(cXe=>{"use strict";Object.defineProperty(cXe,"__esModule",{value:!0});cXe.date=gUn;var fUn=Nh(),lXe=Bb(),pUn=iE(),mUn=H_(),hUn=/^([+-]?\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 gUn(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,lXe.getErrorMessageForIncorrectType)(e,"string")}]}:hUn.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,lXe.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,lXe.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>fUn.SchemaType.DATE};return Object.assign(Object.assign({},(0,pUn.maybeSkipValidation)(t)),(0,mUn.getSchemaUtils)(t))}});var Rar=S(X0e=>{"use strict";Object.defineProperty(X0e,"__esModule",{value:!0});X0e.date=void 0;var yUn=Mar();Object.defineProperty(X0e,"date",{enumerable:!0,get:function(){return yUn.date}})});var J1=S(dXe=>{"use strict";Object.defineProperty(dXe,"__esModule",{value:!0});dXe.createIdentitySchemaCreator=vUn;var bUn=H_(),_Un=iE();function vUn(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,_Un.maybeSkipValidation)(r)),(0,bUn.getSchemaUtils)(r))}}});var Aar=S(fXe=>{"use strict";Object.defineProperty(fXe,"__esModule",{value:!0});fXe.enum_=CUn;var wUn=Nh(),SUn=J1(),Iar=Bb();function CUn(t){let e=new Set(t);return(0,SUn.createIdentitySchemaCreator)(wUn.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,Iar.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,Iar.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}});var pXe=S(Z0e=>{"use strict";Object.defineProperty(Z0e,"__esModule",{value:!0});Z0e.enum_=void 0;var xUn=Aar();Object.defineProperty(Z0e,"enum_",{enumerable:!0,get:function(){return xUn.enum_}})});var mXe=S(loe=>{"use strict";Object.defineProperty(loe,"__esModule",{value:!0});loe.lazy=OUn;loe.constructLazyBaseSchema=Nar;loe.getMemoizedSchema=Y0e;var TUn=H_();function OUn(t){let e=Nar(t);return Object.assign(Object.assign({},e),(0,TUn.getSchemaUtils)(e))}function Nar(t){return{parse:(e,r)=>Y0e(t).parse(e,r),json:(e,r)=>Y0e(t).json(e,r),getType:()=>Y0e(t).getType()}}function Y0e(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}});var gXe=S(hXe=>{"use strict";Object.defineProperty(hXe,"__esModule",{value:!0});hXe.entries=EUn;function EUn(t){return Object.entries(t)}});var bXe=S(yXe=>{"use strict";Object.defineProperty(yXe,"__esModule",{value:!0});yXe.filterObject=PUn;function PUn(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}});var coe=S(_Xe=>{"use strict";Object.defineProperty(_Xe,"__esModule",{value:!0});_Xe.isPlainObject=MUn;function MUn(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}});var wXe=S(vXe=>{"use strict";Object.defineProperty(vXe,"__esModule",{value:!0});vXe.keys=RUn;function RUn(t){return Object.keys(t)}});var Dar=S(SXe=>{"use strict";Object.defineProperty(SXe,"__esModule",{value:!0});SXe.partition=IUn;function IUn(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}});var Lar=S(Q0e=>{"use strict";Object.defineProperty(Q0e,"__esModule",{value:!0});Q0e.getObjectLikeUtils=jar;Q0e.withParsedProperties=$ar;var AUn=bXe(),NUn=Bb(),DUn=coe(),jUn=H_();function jar(t){return{withParsedProperties:e=>$ar(t,e)}}function $ar(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,DUn.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,NUn.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,AUn.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,jUn.getSchemaUtils)(r)),jar(r))}});var doe=S(XK=>{"use strict";Object.defineProperty(XK,"__esModule",{value:!0});XK.withParsedProperties=XK.getObjectLikeUtils=void 0;var Far=Lar();Object.defineProperty(XK,"getObjectLikeUtils",{enumerable:!0,get:function(){return Far.getObjectLikeUtils}});Object.defineProperty(XK,"withParsedProperties",{enumerable:!0,get:function(){return Far.withParsedProperties}})});var CXe=S(eCe=>{"use strict";Object.defineProperty(eCe,"__esModule",{value:!0});eCe.property=$Un;eCe.isProperty=LUn;function $Un(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}function LUn(t){return t.isProperty}});var OXe=S(rCe=>{"use strict";Object.defineProperty(rCe,"__esModule",{value:!0});rCe.object=UUn;rCe.getObjectUtils=tCe;var q2=Nh(),kar=gXe(),qar=bXe(),FUn=Bb(),kUn=coe(),Var=wXe(),qUn=iE(),BUn=Dar(),xXe=doe(),TXe=H_(),foe=CXe();function UUn(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,foe.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,Var.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,kar.entries)(t)){let u=(0,foe.isProperty)(s)?s.rawKey:a,l=(0,foe.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,zar(l)&&i.push(u)}return Bar({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,kar.entries)(t)){let s=(0,foe.isProperty)(a)?a.valueSchema:a;zar(s)&&o.push(i)}return Bar({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,foe.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:()=>q2.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,qUn.maybeSkipValidation)(e)),(0,TXe.getSchemaUtils)(e)),(0,xXe.getObjectLikeUtils)(e)),tCe(e))}function Bar({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,kUn.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,FUn.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 tCe(t){return{extend:e=>{let r={_getParsedProperties:()=>[...t._getParsedProperties(),...e._getParsedProperties()],_getRawProperties:()=>[...t._getRawProperties(),...e._getRawProperties()],parse:(n,o)=>Uar({extensionKeys:e._getRawProperties(),value:n,transformBase:i=>t.parse(i,o),transformExtension:i=>e.parse(i,o)}),json:(n,o)=>Uar({extensionKeys:e._getParsedProperties(),value:n,transformBase:i=>t.json(i,o),transformExtension:i=>e.json(i,o)}),getType:()=>q2.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,TXe.getSchemaUtils)(r)),(0,xXe.getObjectLikeUtils)(r)),tCe(r))},passthrough:()=>{let e={_getParsedProperties:()=>t._getParsedProperties(),_getRawProperties:()=>t._getRawProperties(),parse:(r,n)=>{let o=t.parse(r,Object.assign(Object.assign({},n),{unrecognizedObjectKeys:"passthrough"}));return o.ok?{ok:!0,value:Object.assign(Object.assign({},r),o.value)}:o},json:(r,n)=>{let o=t.json(r,Object.assign(Object.assign({},n),{unrecognizedObjectKeys:"passthrough"}));return o.ok?{ok:!0,value:Object.assign(Object.assign({},r),o.value)}:o},getType:()=>q2.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,TXe.getSchemaUtils)(e)),(0,xXe.getObjectLikeUtils)(e)),tCe(e))}}}function Uar({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,BUn.partition)((0,Var.keys)(e),l=>o.has(l)),s=r((0,qar.filterObject)(e,a)),u=n((0,qar.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 zar(t){return!zUn(t)}function zUn(t){switch(t.getType()){case q2.SchemaType.ANY:case q2.SchemaType.UNKNOWN:case q2.SchemaType.OPTIONAL:case q2.SchemaType.OPTIONAL_NULLABLE:return!0;default:return!1}}});var Har=S(EXe=>{"use strict";Object.defineProperty(EXe,"__esModule",{value:!0});EXe.objectWithoutOptionalProperties=HUn;var VUn=OXe();function HUn(t){return(0,VUn.object)(t)}});var PXe=S(t0=>{"use strict";Object.defineProperty(t0,"__esModule",{value:!0});t0.property=t0.isProperty=t0.objectWithoutOptionalProperties=t0.object=t0.getObjectUtils=void 0;var War=OXe();Object.defineProperty(t0,"getObjectUtils",{enumerable:!0,get:function(){return War.getObjectUtils}});Object.defineProperty(t0,"object",{enumerable:!0,get:function(){return War.object}});var WUn=Har();Object.defineProperty(t0,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return WUn.objectWithoutOptionalProperties}});var Jar=CXe();Object.defineProperty(t0,"isProperty",{enumerable:!0,get:function(){return Jar.isProperty}});Object.defineProperty(t0,"property",{enumerable:!0,get:function(){return Jar.property}})});var Kar=S(RXe=>{"use strict";Object.defineProperty(RXe,"__esModule",{value:!0});RXe.lazyObject=XUn;var JUn=PXe(),KUn=doe(),GUn=H_(),MXe=mXe();function XUn(t){let e=Object.assign(Object.assign({},(0,MXe.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,MXe.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,MXe.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,GUn.getSchemaUtils)(e)),(0,KUn.getObjectLikeUtils)(e)),(0,JUn.getObjectUtils)(e))}});var Gar=S(ZK=>{"use strict";Object.defineProperty(ZK,"__esModule",{value:!0});ZK.lazyObject=ZK.lazy=void 0;var ZUn=mXe();Object.defineProperty(ZK,"lazy",{enumerable:!0,get:function(){return ZUn.lazy}});var YUn=Kar();Object.defineProperty(ZK,"lazyObject",{enumerable:!0,get:function(){return YUn.lazyObject}})});var Zar=S(IXe=>{"use strict";Object.defineProperty(IXe,"__esModule",{value:!0});IXe.list=nzn;var QUn=Nh(),ezn=Bb(),tzn=iE(),rzn=H_();function nzn(t){let e={parse:(r,n)=>Xar(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)=>Xar(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:()=>QUn.SchemaType.LIST};return Object.assign(Object.assign({},(0,tzn.maybeSkipValidation)(e)),(0,rzn.getSchemaUtils)(e))}function Xar(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,ezn.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var AXe=S(nCe=>{"use strict";Object.defineProperty(nCe,"__esModule",{value:!0});nCe.list=void 0;var ozn=Zar();Object.defineProperty(nCe,"list",{enumerable:!0,get:function(){return ozn.list}})});var Yar=S(NXe=>{"use strict";Object.defineProperty(NXe,"__esModule",{value:!0});NXe.stringLiteral=uzn;var izn=Nh(),azn=J1(),szn=Bb();function uzn(t){return(0,azn.createIdentitySchemaCreator)(izn.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,szn.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}});var Qar=S(DXe=>{"use strict";Object.defineProperty(DXe,"__esModule",{value:!0});DXe.booleanLiteral=fzn;var lzn=Nh(),czn=J1(),dzn=Bb();function fzn(t){return(0,czn.createIdentitySchemaCreator)(lzn.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,dzn.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}});var esr=S(YK=>{"use strict";Object.defineProperty(YK,"__esModule",{value:!0});YK.booleanLiteral=YK.stringLiteral=void 0;var pzn=Yar();Object.defineProperty(YK,"stringLiteral",{enumerable:!0,get:function(){return pzn.stringLiteral}});var mzn=Qar();Object.defineProperty(YK,"booleanLiteral",{enumerable:!0,get:function(){return mzn.booleanLiteral}})});var tsr=S(oCe=>{"use strict";Object.defineProperty(oCe,"__esModule",{value:!0});oCe.any=void 0;var hzn=Nh(),gzn=J1();oCe.any=(0,gzn.createIdentitySchemaCreator)(hzn.SchemaType.ANY,t=>({ok:!0,value:t}))});var rsr=S(iCe=>{"use strict";Object.defineProperty(iCe,"__esModule",{value:!0});iCe.boolean=void 0;var yzn=Nh(),bzn=J1(),_zn=Bb();iCe.boolean=(0,bzn.createIdentitySchemaCreator)(yzn.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,_zn.getErrorMessageForIncorrectType)(t,"boolean")}]})});var nsr=S(aCe=>{"use strict";Object.defineProperty(aCe,"__esModule",{value:!0});aCe.number=void 0;var vzn=Nh(),wzn=J1(),Szn=Bb();aCe.number=(0,wzn.createIdentitySchemaCreator)(vzn.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,Szn.getErrorMessageForIncorrectType)(t,"number")}]})});var osr=S(sCe=>{"use strict";Object.defineProperty(sCe,"__esModule",{value:!0});sCe.string=void 0;var Czn=Nh(),xzn=J1(),Tzn=Bb();sCe.string=(0,xzn.createIdentitySchemaCreator)(Czn.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,Tzn.getErrorMessageForIncorrectType)(t,"string")}]})});var isr=S(uCe=>{"use strict";Object.defineProperty(uCe,"__esModule",{value:!0});uCe.unknown=void 0;var Ozn=Nh(),Ezn=J1();uCe.unknown=(0,Ezn.createIdentitySchemaCreator)(Ozn.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var asr=S(r0=>{"use strict";Object.defineProperty(r0,"__esModule",{value:!0});r0.unknown=r0.string=r0.number=r0.boolean=r0.any=void 0;var Pzn=tsr();Object.defineProperty(r0,"any",{enumerable:!0,get:function(){return Pzn.any}});var Mzn=rsr();Object.defineProperty(r0,"boolean",{enumerable:!0,get:function(){return Mzn.boolean}});var Rzn=nsr();Object.defineProperty(r0,"number",{enumerable:!0,get:function(){return Rzn.number}});var Izn=osr();Object.defineProperty(r0,"string",{enumerable:!0,get:function(){return Izn.string}});var Azn=isr();Object.defineProperty(r0,"unknown",{enumerable:!0,get:function(){return Azn.unknown}})});var usr=S($Xe=>{"use strict";Object.defineProperty($Xe,"__esModule",{value:!0});$Xe.record=Fzn;var jXe=Nh(),Nzn=gXe(),Dzn=Bb(),jzn=coe(),$zn=iE(),Lzn=H_();function Fzn(t,e){let r={parse:(n,o)=>ssr({value:n,isKeyNumeric:t.getType()===jXe.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)=>ssr({value:n,isKeyNumeric:t.getType()===jXe.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:()=>jXe.SchemaType.RECORD};return Object.assign(Object.assign({},(0,$zn.maybeSkipValidation)(r)),(0,Lzn.getSchemaUtils)(r))}function ssr({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,jzn.isPlainObject)(t)?(0,Nzn.entries)(t).reduce((i,[a,s])=>{if(s===void 0)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,Dzn.getErrorMessageForIncorrectType)(t,"object")}]}}});var lsr=S(lCe=>{"use strict";Object.defineProperty(lCe,"__esModule",{value:!0});lCe.record=void 0;var kzn=usr();Object.defineProperty(lCe,"record",{enumerable:!0,get:function(){return kzn.record}})});var csr=S(LXe=>{"use strict";Object.defineProperty(LXe,"__esModule",{value:!0});LXe.set=Hzn;var qzn=Nh(),Bzn=Bb(),Uzn=iE(),zzn=AXe(),Vzn=H_();function Hzn(t){let e=(0,zzn.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,Bzn.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>qzn.SchemaType.SET};return Object.assign(Object.assign({},(0,Uzn.maybeSkipValidation)(r)),(0,Vzn.getSchemaUtils)(r))}});var dsr=S(cCe=>{"use strict";Object.defineProperty(cCe,"__esModule",{value:!0});cCe.set=void 0;var Wzn=csr();Object.defineProperty(cCe,"set",{enumerable:!0,get:function(){return Wzn.set}})});var psr=S(FXe=>{"use strict";Object.defineProperty(FXe,"__esModule",{value:!0});FXe.undiscriminatedUnion=Xzn;var Jzn=Nh(),Kzn=iE(),Gzn=H_();function Xzn(t){let e={parse:(r,n)=>fsr((o,i)=>o.parse(r,i),t,n),json:(r,n)=>fsr((o,i)=>o.json(r,i),t,n),getType:()=>Jzn.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,Kzn.maybeSkipValidation)(e)),(0,Gzn.getSchemaUtils)(e))}function fsr(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 msr=S(dCe=>{"use strict";Object.defineProperty(dCe,"__esModule",{value:!0});dCe.undiscriminatedUnion=void 0;var Zzn=psr();Object.defineProperty(dCe,"undiscriminatedUnion",{enumerable:!0,get:function(){return Zzn.undiscriminatedUnion}})});var hsr=S(kXe=>{"use strict";Object.defineProperty(kXe,"__esModule",{value:!0});kXe.discriminant=Yzn;function Yzn(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}});var ysr=S(poe=>{"use strict";var Qzn=poe&&poe.__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(poe,"__esModule",{value:!0});poe.union=u4n;var e4n=Nh(),t4n=Bb(),r4n=coe(),n4n=wXe(),o4n=iE(),i4n=pXe(),a4n=doe(),s4n=H_();function u4n(t,e){let r=typeof t=="string"?t:t.rawDiscriminant,n=typeof t=="string"?t:t.parsedDiscriminant,o=(0,i4n.enum_)((0,n4n.keys)(e)),i={parse:(a,s)=>gsr({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)=>gsr({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:()=>e4n.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,o4n.maybeSkipValidation)(i)),(0,s4n.getSchemaUtils)(i)),(0,a4n.getObjectLikeUtils)(i))}function gsr({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,r4n.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,t4n.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=Qzn(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 bsr=S(QK=>{"use strict";Object.defineProperty(QK,"__esModule",{value:!0});QK.union=QK.discriminant=void 0;var l4n=hsr();Object.defineProperty(QK,"discriminant",{enumerable:!0,get:function(){return l4n.discriminant}});var c4n=ysr();Object.defineProperty(QK,"union",{enumerable:!0,get:function(){return c4n.union}})});var _sr=S(Od=>{"use strict";var d4n=Od&&Od.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W_=Od&&Od.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&d4n(e,t,r)};Object.defineProperty(Od,"__esModule",{value:!0});W_(Par(),Od);W_(Rar(),Od);W_(pXe(),Od);W_(Gar(),Od);W_(AXe(),Od);W_(esr(),Od);W_(PXe(),Od);W_(doe(),Od);W_(asr(),Od);W_(lsr(),Od);W_(H_(),Od);W_(dsr(),Od);W_(msr(),Od);W_(bsr(),Od)});var vsr=S(B2=>{"use strict";var f4n=B2&&B2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p4n=B2&&B2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&f4n(e,t,r)};Object.defineProperty(B2,"__esModule",{value:!0});p4n(_sr(),B2)});var se=S(Dg=>{"use strict";var wsr=Dg&&Dg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m4n=Dg&&Dg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),moe=Dg&&Dg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&wsr(e,t,r)},h4n=Dg&&Dg.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wsr(r,e,n[o]);return m4n(r,e),r}}();Object.defineProperty(Dg,"__esModule",{value:!0});Dg.serialization=void 0;moe(Bir(),Dg);moe(qK(),Dg);moe(Wir(),Dg);moe(Zir(),Dg);moe(bar(),Dg);Dg.serialization=h4n(vsr())});var Csr=S(jg=>{"use strict";var hoe=jg&&jg.__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())})},goe=jg&&jg.__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)}},Vl=jg&&jg.__await||function(t){return this instanceof Vl?(this.v=t,this):new Vl(t)},yoe=jg&&jg.__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=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(y,g){i.push([p,h,y,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 Vl?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])}};Object.defineProperty(jg,"__esModule",{value:!0});jg.LineDecoder=jg.StreamUtils=void 0;jg._iterSSEMessages=Ssr;jg._decodeChunks=b4n;jg.readableStreamAsyncIterable=UXe;var e8=$c(),qXe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return yoe(this,arguments,function*(){var a,s,u,l;if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let c=!1;try{try{for(var d=!0,f=goe(Ssr(e,r)),p;p=yield Vl(f.next()),a=p.done,!a;d=!0){l=p.value,d=!1;let m=l;if(!c){if(m.data.startsWith("[DONE]")){c=!0;continue}if(m.event===null){let h;try{h=JSON.parse(m.data)}catch(y){throw console.error("Could not parse message into JSON:",m.data),console.error("From chunk:",m.raw),y}if(h&&h.error)throw new e8.CohereError({message:`Error: ${h.error}`});yield yield Vl(h)}else{let h;try{h=JSON.parse(m.data)}catch(y){throw console.error("Could not parse message into JSON:",m.data),console.error("From chunk:",m.raw),y}if(m.event=="error")throw new e8.CohereError({message:`Error: ${h.message}, ${h.error}`});yield yield Vl({event:m.event,data:h})}}}}catch(m){s={error:m}}finally{try{!d&&!a&&(u=f.return)&&(yield Vl(u.call(f)))}finally{if(s)throw s.error}}c=!0}catch(m){if(m instanceof Error&&m.name==="AbortError")return yield Vl(void 0);throw m}finally{c||r?.abort()}})}return new t(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return yoe(this,arguments,function*(){var s,u,l,c;let d=new gk,f=UXe(e);try{for(var p=!0,m=goe(f),h;h=yield Vl(m.next()),s=h.done,!s;p=!0){c=h.value,p=!1;let y=c;for(let g of d.decode(y))yield yield Vl(g)}}catch(y){u={error:y}}finally{try{!p&&!s&&(l=m.return)&&(yield Vl(l.call(m)))}finally{if(u)throw u.error}}for(let y of d.flush())yield yield Vl(y)})}function i(){return yoe(this,arguments,function*(){var s,u,l,c;if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let d=!1;try{try{for(var f=!0,p=goe(o()),m;m=yield Vl(p.next()),s=m.done,!s;f=!0){c=m.value,f=!1;let h=c;d||h&&(yield yield Vl(JSON.parse(h)))}}catch(h){u={error:h}}finally{try{!f&&!s&&(l=p.return)&&(yield Vl(l.call(p)))}finally{if(u)throw u.error}}d=!0}catch(h){if(h instanceof Error&&h.name==="AbortError")return yield Vl(void 0);throw h}finally{d||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 hoe(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return hoe(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(){return hoe(this,void 0,void 0,function*(){var o;yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};jg.StreamUtils=qXe;function Ssr(t,e){return yoe(this,arguments,function*(){var n,o,i,a;if(!t.body)throw e?.abort(),new e8.CohereError({message:"Attempted to iterate over a response with no body"});let s=new BXe,u=new gk,l=UXe(t.body);try{for(var c=!0,d=goe(g4n(l)),f;f=yield Vl(d.next()),n=f.done,!n;c=!0){a=f.value,c=!1;let p=a;for(let m of u.decode(p)){let h=s.decode(m);h&&(yield yield Vl(h))}}}catch(p){o={error:p}}finally{try{!c&&!n&&(i=d.return)&&(yield Vl(i.call(d)))}finally{if(o)throw o.error}}for(let p of u.flush()){let m=s.decode(p);m&&(yield yield Vl(m))}})}function g4n(t){return yoe(this,arguments,function*(){var r,n,o,i;let a=new Uint8Array;try{for(var s=!0,u=goe(t),l;l=yield Vl(u.next()),r=l.done,!r;s=!0){i=l.value,s=!1;let c=i;if(c==null)continue;let d=c instanceof ArrayBuffer?new Uint8Array(c):typeof c=="string"?new TextEncoder().encode(c):c,f=new Uint8Array(a.length+d.length);f.set(a),f.set(d,a.length),a=f;let p;for(;(p=y4n(a))!==-1;)yield yield Vl(a.slice(0,p)),a=a.slice(p)}}catch(c){n={error:c}}finally{try{!s&&!r&&(o=u.return)&&(yield Vl(o.call(u)))}finally{if(n)throw n.error}}a.length>0&&(yield yield Vl(a))})}function y4n(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 BXe=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]=_4n(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},gk=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 e8.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 e8.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new e8.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}};jg.LineDecoder=gk;gk.NEWLINE_CHARS=new Set([`
`,"\r"]);gk.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function b4n(t){let e=new gk,r=[];for(let n of t)r.push(...e.decode(n));return r}function _4n(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function UXe(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return hoe(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 hoe(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}});var _oe=S(aE=>{"use strict";var v4n=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]}),w4n=aE&&aE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S4n=aE&&aE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&v4n(r,e,n[o]);return w4n(r,e),r}}();Object.defineProperty(aE,"__esModule",{value:!0});aE.Document=void 0;var boe=S4n(se());aE.Document=boe.serialization.object({data:boe.serialization.record(boe.serialization.string(),boe.serialization.unknown()),id:boe.serialization.string().optional()})});var zXe=S(sE=>{"use strict";var C4n=sE&&sE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x4n=sE&&sE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T4n=sE&&sE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&C4n(r,e,n[o]);return x4n(r,e),r}}();Object.defineProperty(sE,"__esModule",{value:!0});sE.V2ChatStreamRequestDocumentsItem=void 0;var xsr=T4n(se()),O4n=_oe();sE.V2ChatStreamRequestDocumentsItem=xsr.serialization.undiscriminatedUnion([xsr.serialization.string(),O4n.Document])});var VXe=S(uE=>{"use strict";var E4n=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]}),P4n=uE&&uE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M4n=uE&&uE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&E4n(r,e,n[o]);return P4n(r,e),r}}();Object.defineProperty(uE,"__esModule",{value:!0});uE.V2ChatStreamRequestSafetyMode=void 0;var R4n=M4n(se());uE.V2ChatStreamRequestSafetyMode=R4n.serialization.enum_(["CONTEXTUAL","STRICT","OFF"])});var HXe=S(lE=>{"use strict";var I4n=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]}),A4n=lE&&lE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N4n=lE&&lE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&I4n(r,e,n[o]);return A4n(r,e),r}}();Object.defineProperty(lE,"__esModule",{value:!0});lE.V2ChatStreamRequestToolChoice=void 0;var D4n=N4n(se());lE.V2ChatStreamRequestToolChoice=D4n.serialization.enum_(["REQUIRED","NONE"])});var WXe=S(cE=>{"use strict";var j4n=cE&&cE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$4n=cE&&cE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L4n=cE&&cE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&j4n(r,e,n[o]);return $4n(r,e),r}}();Object.defineProperty(cE,"__esModule",{value:!0});cE.ChatMessageStartEventDeltaMessage=void 0;var Tsr=L4n(se());cE.ChatMessageStartEventDeltaMessage=Tsr.serialization.object({role:Tsr.serialization.stringLiteral("assistant").optional()})});var JXe=S(dE=>{"use strict";var F4n=dE&&dE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),k4n=dE&&dE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q4n=dE&&dE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&F4n(r,e,n[o]);return k4n(r,e),r}}();Object.defineProperty(dE,"__esModule",{value:!0});dE.ChatMessageStartEventDelta=void 0;var B4n=q4n(se()),U4n=WXe();dE.ChatMessageStartEventDelta=B4n.serialization.object({message:U4n.ChatMessageStartEventDeltaMessage.optional()})});var vw=S(fE=>{"use strict";var z4n=fE&&fE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V4n=fE&&fE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H4n=fE&&fE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&z4n(r,e,n[o]);return V4n(r,e),r}}();Object.defineProperty(fE,"__esModule",{value:!0});fE.ChatStreamEventType=void 0;var W4n=H4n(se());fE.ChatStreamEventType=W4n.serialization.object({})});var KXe=S(pE=>{"use strict";var J4n=pE&&pE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K4n=pE&&pE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G4n=pE&&pE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&J4n(r,e,n[o]);return K4n(r,e),r}}();Object.defineProperty(pE,"__esModule",{value:!0});pE.ChatMessageStartEvent=void 0;var Osr=G4n(se()),X4n=JXe(),Z4n=vw();pE.ChatMessageStartEvent=Osr.serialization.object({id:Osr.serialization.string().optional(),delta:X4n.ChatMessageStartEventDelta.optional()}).extend(Z4n.ChatStreamEventType)});var GXe=S(mE=>{"use strict";var Y4n=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]}),Q4n=mE&&mE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e2n=mE&&mE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Y4n(r,e,n[o]);return Q4n(r,e),r}}();Object.defineProperty(mE,"__esModule",{value:!0});mE.ChatContentStartEventDeltaMessageContentType=void 0;var t2n=e2n(se());mE.ChatContentStartEventDeltaMessageContentType=t2n.serialization.enum_(["text","thinking"])});var ZXe=S(hE=>{"use strict";var r2n=hE&&hE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n2n=hE&&hE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o2n=hE&&hE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&r2n(r,e,n[o]);return n2n(r,e),r}}();Object.defineProperty(hE,"__esModule",{value:!0});hE.ChatContentStartEventDeltaMessageContent=void 0;var XXe=o2n(se()),i2n=GXe();hE.ChatContentStartEventDeltaMessageContent=XXe.serialization.object({thinking:XXe.serialization.string().optional(),text:XXe.serialization.string().optional(),type:i2n.ChatContentStartEventDeltaMessageContentType.optional()})});var YXe=S(gE=>{"use strict";var a2n=gE&&gE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s2n=gE&&gE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u2n=gE&&gE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&a2n(r,e,n[o]);return s2n(r,e),r}}();Object.defineProperty(gE,"__esModule",{value:!0});gE.ChatContentStartEventDeltaMessage=void 0;var l2n=u2n(se()),c2n=ZXe();gE.ChatContentStartEventDeltaMessage=l2n.serialization.object({content:c2n.ChatContentStartEventDeltaMessageContent.optional()})});var QXe=S(yE=>{"use strict";var d2n=yE&&yE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f2n=yE&&yE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p2n=yE&&yE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&d2n(r,e,n[o]);return f2n(r,e),r}}();Object.defineProperty(yE,"__esModule",{value:!0});yE.ChatContentStartEventDelta=void 0;var m2n=p2n(se()),h2n=YXe();yE.ChatContentStartEventDelta=m2n.serialization.object({message:h2n.ChatContentStartEventDeltaMessage.optional()})});var eZe=S(bE=>{"use strict";var g2n=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]}),y2n=bE&&bE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b2n=bE&&bE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&g2n(r,e,n[o]);return y2n(r,e),r}}();Object.defineProperty(bE,"__esModule",{value:!0});bE.ChatContentStartEvent=void 0;var Esr=b2n(se()),_2n=QXe(),v2n=vw();bE.ChatContentStartEvent=Esr.serialization.object({index:Esr.serialization.number().optional(),delta:_2n.ChatContentStartEventDelta.optional()}).extend(v2n.ChatStreamEventType)});var rZe=S(_E=>{"use strict";var w2n=_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]}),S2n=_E&&_E.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C2n=_E&&_E.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&w2n(r,e,n[o]);return S2n(r,e),r}}();Object.defineProperty(_E,"__esModule",{value:!0});_E.ChatContentDeltaEventDeltaMessageContent=void 0;var tZe=C2n(se());_E.ChatContentDeltaEventDeltaMessageContent=tZe.serialization.object({thinking:tZe.serialization.string().optional(),text:tZe.serialization.string().optional()})});var nZe=S(vE=>{"use strict";var x2n=vE&&vE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T2n=vE&&vE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O2n=vE&&vE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&x2n(r,e,n[o]);return T2n(r,e),r}}();Object.defineProperty(vE,"__esModule",{value:!0});vE.ChatContentDeltaEventDeltaMessage=void 0;var E2n=O2n(se()),P2n=rZe();vE.ChatContentDeltaEventDeltaMessage=E2n.serialization.object({content:P2n.ChatContentDeltaEventDeltaMessageContent.optional()})});var oZe=S(wE=>{"use strict";var M2n=wE&&wE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R2n=wE&&wE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I2n=wE&&wE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&M2n(r,e,n[o]);return R2n(r,e),r}}();Object.defineProperty(wE,"__esModule",{value:!0});wE.ChatContentDeltaEventDelta=void 0;var A2n=I2n(se()),N2n=nZe();wE.ChatContentDeltaEventDelta=A2n.serialization.object({message:N2n.ChatContentDeltaEventDeltaMessage.optional()})});var fCe=S(SE=>{"use strict";var D2n=SE&&SE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),j2n=SE&&SE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$2n=SE&&SE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&D2n(r,e,n[o]);return j2n(r,e),r}}();Object.defineProperty(SE,"__esModule",{value:!0});SE.LogprobItem=void 0;var U2=$2n(se());SE.LogprobItem=U2.serialization.object({text:U2.serialization.string().optional(),tokenIds:U2.serialization.property("token_ids",U2.serialization.list(U2.serialization.number())),logprobs:U2.serialization.list(U2.serialization.number()).optional()})});var iZe=S(CE=>{"use strict";var L2n=CE&&CE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F2n=CE&&CE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k2n=CE&&CE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&L2n(r,e,n[o]);return F2n(r,e),r}}();Object.defineProperty(CE,"__esModule",{value:!0});CE.ChatContentDeltaEvent=void 0;var Psr=k2n(se()),q2n=oZe(),B2n=fCe(),U2n=vw();CE.ChatContentDeltaEvent=Psr.serialization.object({index:Psr.serialization.number().optional(),delta:q2n.ChatContentDeltaEventDelta.optional(),logprobs:B2n.LogprobItem.optional()}).extend(U2n.ChatStreamEventType)});var aZe=S(xE=>{"use strict";var z2n=xE&&xE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V2n=xE&&xE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H2n=xE&&xE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&z2n(r,e,n[o]);return V2n(r,e),r}}();Object.defineProperty(xE,"__esModule",{value:!0});xE.ChatContentEndEvent=void 0;var Msr=H2n(se()),W2n=vw();xE.ChatContentEndEvent=Msr.serialization.object({index:Msr.serialization.number().optional()}).extend(W2n.ChatStreamEventType)});var uZe=S(TE=>{"use strict";var J2n=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]}),K2n=TE&&TE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G2n=TE&&TE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&J2n(r,e,n[o]);return K2n(r,e),r}}();Object.defineProperty(TE,"__esModule",{value:!0});TE.ChatToolPlanDeltaEventDeltaMessage=void 0;var sZe=G2n(se());TE.ChatToolPlanDeltaEventDeltaMessage=sZe.serialization.object({toolPlan:sZe.serialization.property("tool_plan",sZe.serialization.string().optional())})});var lZe=S(OE=>{"use strict";var X2n=OE&&OE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z2n=OE&&OE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y2n=OE&&OE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&X2n(r,e,n[o]);return Z2n(r,e),r}}();Object.defineProperty(OE,"__esModule",{value:!0});OE.ChatToolPlanDeltaEventDelta=void 0;var Q2n=Y2n(se()),eVn=uZe();OE.ChatToolPlanDeltaEventDelta=Q2n.serialization.object({message:eVn.ChatToolPlanDeltaEventDeltaMessage.optional()})});var cZe=S(EE=>{"use strict";var tVn=EE&&EE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rVn=EE&&EE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nVn=EE&&EE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tVn(r,e,n[o]);return rVn(r,e),r}}();Object.defineProperty(EE,"__esModule",{value:!0});EE.ChatToolPlanDeltaEvent=void 0;var oVn=nVn(se()),iVn=lZe(),aVn=vw();EE.ChatToolPlanDeltaEvent=oVn.serialization.object({delta:iVn.ChatToolPlanDeltaEventDelta.optional()}).extend(aVn.ChatStreamEventType)});var fZe=S(PE=>{"use strict";var sVn=PE&&PE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uVn=PE&&PE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lVn=PE&&PE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sVn(r,e,n[o]);return uVn(r,e),r}}();Object.defineProperty(PE,"__esModule",{value:!0});PE.ToolCallV2Function=void 0;var dZe=lVn(se());PE.ToolCallV2Function=dZe.serialization.object({name:dZe.serialization.string().optional(),arguments:dZe.serialization.string().optional()})});var voe=S(ME=>{"use strict";var cVn=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]}),dVn=ME&&ME.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fVn=ME&&ME.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cVn(r,e,n[o]);return dVn(r,e),r}}();Object.defineProperty(ME,"__esModule",{value:!0});ME.ToolCallV2=void 0;var pZe=fVn(se()),pVn=fZe();ME.ToolCallV2=pZe.serialization.object({id:pZe.serialization.string().optional(),type:pZe.serialization.stringLiteral("function").optional(),function:pVn.ToolCallV2Function.optional()})});var mZe=S(RE=>{"use strict";var mVn=RE&&RE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hVn=RE&&RE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gVn=RE&&RE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mVn(r,e,n[o]);return hVn(r,e),r}}();Object.defineProperty(RE,"__esModule",{value:!0});RE.ChatToolCallStartEventDeltaMessage=void 0;var Rsr=gVn(se()),yVn=voe();RE.ChatToolCallStartEventDeltaMessage=Rsr.serialization.object({toolCalls:Rsr.serialization.property("tool_calls",yVn.ToolCallV2.optional())})});var hZe=S(IE=>{"use strict";var bVn=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]}),_Vn=IE&&IE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vVn=IE&&IE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bVn(r,e,n[o]);return _Vn(r,e),r}}();Object.defineProperty(IE,"__esModule",{value:!0});IE.ChatToolCallStartEventDelta=void 0;var wVn=vVn(se()),SVn=mZe();IE.ChatToolCallStartEventDelta=wVn.serialization.object({message:SVn.ChatToolCallStartEventDeltaMessage.optional()})});var gZe=S(AE=>{"use strict";var CVn=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]}),xVn=AE&&AE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TVn=AE&&AE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&CVn(r,e,n[o]);return xVn(r,e),r}}();Object.defineProperty(AE,"__esModule",{value:!0});AE.ChatToolCallStartEvent=void 0;var Isr=TVn(se()),OVn=hZe(),EVn=vw();AE.ChatToolCallStartEvent=Isr.serialization.object({index:Isr.serialization.number().optional(),delta:OVn.ChatToolCallStartEventDelta.optional()}).extend(EVn.ChatStreamEventType)});var yZe=S(NE=>{"use strict";var PVn=NE&&NE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MVn=NE&&NE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RVn=NE&&NE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&PVn(r,e,n[o]);return MVn(r,e),r}}();Object.defineProperty(NE,"__esModule",{value:!0});NE.ChatToolCallDeltaEventDeltaMessageToolCallsFunction=void 0;var Asr=RVn(se());NE.ChatToolCallDeltaEventDeltaMessageToolCallsFunction=Asr.serialization.object({arguments:Asr.serialization.string().optional()})});var bZe=S(DE=>{"use strict";var IVn=DE&&DE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AVn=DE&&DE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NVn=DE&&DE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IVn(r,e,n[o]);return AVn(r,e),r}}();Object.defineProperty(DE,"__esModule",{value:!0});DE.ChatToolCallDeltaEventDeltaMessageToolCalls=void 0;var DVn=NVn(se()),jVn=yZe();DE.ChatToolCallDeltaEventDeltaMessageToolCalls=DVn.serialization.object({function:jVn.ChatToolCallDeltaEventDeltaMessageToolCallsFunction.optional()})});var _Ze=S(jE=>{"use strict";var $Vn=jE&&jE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LVn=jE&&jE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FVn=jE&&jE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$Vn(r,e,n[o]);return LVn(r,e),r}}();Object.defineProperty(jE,"__esModule",{value:!0});jE.ChatToolCallDeltaEventDeltaMessage=void 0;var Nsr=FVn(se()),kVn=bZe();jE.ChatToolCallDeltaEventDeltaMessage=Nsr.serialization.object({toolCalls:Nsr.serialization.property("tool_calls",kVn.ChatToolCallDeltaEventDeltaMessageToolCalls.optional())})});var vZe=S($E=>{"use strict";var qVn=$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]}),BVn=$E&&$E.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UVn=$E&&$E.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qVn(r,e,n[o]);return BVn(r,e),r}}();Object.defineProperty($E,"__esModule",{value:!0});$E.ChatToolCallDeltaEventDelta=void 0;var zVn=UVn(se()),VVn=_Ze();$E.ChatToolCallDeltaEventDelta=zVn.serialization.object({message:VVn.ChatToolCallDeltaEventDeltaMessage.optional()})});var wZe=S(LE=>{"use strict";var HVn=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]}),WVn=LE&&LE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JVn=LE&&LE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&HVn(r,e,n[o]);return WVn(r,e),r}}();Object.defineProperty(LE,"__esModule",{value:!0});LE.ChatToolCallDeltaEvent=void 0;var Dsr=JVn(se()),KVn=vZe(),GVn=vw();LE.ChatToolCallDeltaEvent=Dsr.serialization.object({index:Dsr.serialization.number().optional(),delta:KVn.ChatToolCallDeltaEventDelta.optional()}).extend(GVn.ChatStreamEventType)});var SZe=S(FE=>{"use strict";var XVn=FE&&FE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZVn=FE&&FE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YVn=FE&&FE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XVn(r,e,n[o]);return ZVn(r,e),r}}();Object.defineProperty(FE,"__esModule",{value:!0});FE.ChatToolCallEndEvent=void 0;var jsr=YVn(se()),QVn=vw();FE.ChatToolCallEndEvent=jsr.serialization.object({index:jsr.serialization.number().optional()}).extend(QVn.ChatStreamEventType)});var CZe=S(kE=>{"use strict";var eHn=kE&&kE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tHn=kE&&kE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rHn=kE&&kE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eHn(r,e,n[o]);return tHn(r,e),r}}();Object.defineProperty(kE,"__esModule",{value:!0});kE.ChatToolSource=void 0;var t8=rHn(se());kE.ChatToolSource=t8.serialization.object({id:t8.serialization.string().optional(),toolOutput:t8.serialization.property("tool_output",t8.serialization.record(t8.serialization.string(),t8.serialization.unknown()).optional())})});var xZe=S(qE=>{"use strict";var nHn=qE&&qE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oHn=qE&&qE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iHn=qE&&qE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nHn(r,e,n[o]);return oHn(r,e),r}}();Object.defineProperty(qE,"__esModule",{value:!0});qE.ChatDocumentSource=void 0;var woe=iHn(se());qE.ChatDocumentSource=woe.serialization.object({id:woe.serialization.string().optional(),document:woe.serialization.record(woe.serialization.string(),woe.serialization.unknown()).optional()})});var TZe=S(BE=>{"use strict";var aHn=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]}),sHn=BE&&BE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uHn=BE&&BE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aHn(r,e,n[o]);return sHn(r,e),r}}();Object.defineProperty(BE,"__esModule",{value:!0});BE.Source=void 0;var lHn=uHn(se()),cHn=CZe(),dHn=xZe();BE.Source=lHn.serialization.union("type",{tool:cHn.ChatToolSource,document:dHn.ChatDocumentSource}).transform({transform:t=>t,untransform:t=>t})});var OZe=S(UE=>{"use strict";var fHn=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]}),pHn=UE&&UE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mHn=UE&&UE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fHn(r,e,n[o]);return pHn(r,e),r}}();Object.defineProperty(UE,"__esModule",{value:!0});UE.CitationType=void 0;var hHn=mHn(se());UE.CitationType=hHn.serialization.enum_(["TEXT_CONTENT","THINKING_CONTENT","PLAN"])});var Soe=S(zE=>{"use strict";var gHn=zE&&zE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yHn=zE&&zE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bHn=zE&&zE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gHn(r,e,n[o]);return yHn(r,e),r}}();Object.defineProperty(zE,"__esModule",{value:!0});zE.Citation=void 0;var z2=bHn(se()),_Hn=TZe(),vHn=OZe();zE.Citation=z2.serialization.object({start:z2.serialization.number().optional(),end:z2.serialization.number().optional(),text:z2.serialization.string().optional(),sources:z2.serialization.list(_Hn.Source).optional(),contentIndex:z2.serialization.property("content_index",z2.serialization.number().optional()),type:vHn.CitationType.optional()})});var EZe=S(VE=>{"use strict";var wHn=VE&&VE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SHn=VE&&VE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CHn=VE&&VE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wHn(r,e,n[o]);return SHn(r,e),r}}();Object.defineProperty(VE,"__esModule",{value:!0});VE.CitationStartEventDeltaMessage=void 0;var xHn=CHn(se()),THn=Soe();VE.CitationStartEventDeltaMessage=xHn.serialization.object({citations:THn.Citation.optional()})});var PZe=S(HE=>{"use strict";var OHn=HE&&HE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EHn=HE&&HE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PHn=HE&&HE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&OHn(r,e,n[o]);return EHn(r,e),r}}();Object.defineProperty(HE,"__esModule",{value:!0});HE.CitationStartEventDelta=void 0;var MHn=PHn(se()),RHn=EZe();HE.CitationStartEventDelta=MHn.serialization.object({message:RHn.CitationStartEventDeltaMessage.optional()})});var MZe=S(WE=>{"use strict";var IHn=WE&&WE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AHn=WE&&WE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NHn=WE&&WE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IHn(r,e,n[o]);return AHn(r,e),r}}();Object.defineProperty(WE,"__esModule",{value:!0});WE.CitationStartEvent=void 0;var $sr=NHn(se()),DHn=PZe(),jHn=vw();WE.CitationStartEvent=$sr.serialization.object({index:$sr.serialization.number().optional(),delta:DHn.CitationStartEventDelta.optional()}).extend(jHn.ChatStreamEventType)});var RZe=S(JE=>{"use strict";var $Hn=JE&&JE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LHn=JE&&JE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FHn=JE&&JE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$Hn(r,e,n[o]);return LHn(r,e),r}}();Object.defineProperty(JE,"__esModule",{value:!0});JE.CitationEndEvent=void 0;var Lsr=FHn(se()),kHn=vw();JE.CitationEndEvent=Lsr.serialization.object({index:Lsr.serialization.number().optional()}).extend(kHn.ChatStreamEventType)});var pCe=S(KE=>{"use strict";var qHn=KE&&KE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BHn=KE&&KE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UHn=KE&&KE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qHn(r,e,n[o]);return BHn(r,e),r}}();Object.defineProperty(KE,"__esModule",{value:!0});KE.ChatFinishReason=void 0;var zHn=UHn(se());KE.ChatFinishReason=zHn.serialization.enum_(["COMPLETE","STOP_SEQUENCE","MAX_TOKENS","TOOL_CALL","ERROR"])});var IZe=S(GE=>{"use strict";var VHn=GE&&GE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HHn=GE&&GE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WHn=GE&&GE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&VHn(r,e,n[o]);return HHn(r,e),r}}();Object.defineProperty(GE,"__esModule",{value:!0});GE.UsageBilledUnits=void 0;var yk=WHn(se());GE.UsageBilledUnits=yk.serialization.object({inputTokens:yk.serialization.property("input_tokens",yk.serialization.number().optional()),outputTokens:yk.serialization.property("output_tokens",yk.serialization.number().optional()),searchUnits:yk.serialization.property("search_units",yk.serialization.number().optional()),classifications:yk.serialization.number().optional()})});var AZe=S(XE=>{"use strict";var JHn=XE&&XE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KHn=XE&&XE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GHn=XE&&XE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&JHn(r,e,n[o]);return KHn(r,e),r}}();Object.defineProperty(XE,"__esModule",{value:!0});XE.UsageTokens=void 0;var Coe=GHn(se());XE.UsageTokens=Coe.serialization.object({inputTokens:Coe.serialization.property("input_tokens",Coe.serialization.number().optional()),outputTokens:Coe.serialization.property("output_tokens",Coe.serialization.number().optional())})});var mCe=S(ZE=>{"use strict";var XHn=ZE&&ZE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZHn=ZE&&ZE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YHn=ZE&&ZE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XHn(r,e,n[o]);return ZHn(r,e),r}}();Object.defineProperty(ZE,"__esModule",{value:!0});ZE.Usage=void 0;var Fsr=YHn(se()),QHn=IZe(),eWn=AZe();ZE.Usage=Fsr.serialization.object({billedUnits:Fsr.serialization.property("billed_units",QHn.UsageBilledUnits.optional()),tokens:eWn.UsageTokens.optional()})});var DZe=S(YE=>{"use strict";var tWn=YE&&YE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rWn=YE&&YE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nWn=YE&&YE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tWn(r,e,n[o]);return rWn(r,e),r}}();Object.defineProperty(YE,"__esModule",{value:!0});YE.ChatMessageEndEventDelta=void 0;var NZe=nWn(se()),oWn=pCe(),iWn=mCe();YE.ChatMessageEndEventDelta=NZe.serialization.object({error:NZe.serialization.string().optional(),finishReason:NZe.serialization.property("finish_reason",oWn.ChatFinishReason.optional()),usage:iWn.Usage.optional()})});var jZe=S(QE=>{"use strict";var aWn=QE&&QE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sWn=QE&&QE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uWn=QE&&QE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aWn(r,e,n[o]);return sWn(r,e),r}}();Object.defineProperty(QE,"__esModule",{value:!0});QE.ChatMessageEndEvent=void 0;var ksr=uWn(se()),lWn=DZe(),cWn=vw();QE.ChatMessageEndEvent=ksr.serialization.object({id:ksr.serialization.string().optional(),delta:lWn.ChatMessageEndEventDelta.optional()}).extend(cWn.ChatStreamEventType)});var dx=S(eP=>{"use strict";var dWn=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]}),fWn=eP&&eP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pWn=eP&&eP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dWn(r,e,n[o]);return fWn(r,e),r}}();Object.defineProperty(eP,"__esModule",{value:!0});eP.ChatStreamEvent=void 0;var mWn=pWn(se());eP.ChatStreamEvent=mWn.serialization.object({})});var hCe=S(tP=>{"use strict";var hWn=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]}),gWn=tP&&tP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yWn=tP&&tP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hWn(r,e,n[o]);return gWn(r,e),r}}();Object.defineProperty(tP,"__esModule",{value:!0});tP.ChatDebugEvent=void 0;var qsr=yWn(se()),bWn=dx();tP.ChatDebugEvent=qsr.serialization.object({prompt:qsr.serialization.string().optional()}).extend(bWn.ChatStreamEvent)});var Bsr=S(rP=>{"use strict";var _Wn=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]}),vWn=rP&&rP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wWn=rP&&rP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Wn(r,e,n[o]);return vWn(r,e),r}}();Object.defineProperty(rP,"__esModule",{value:!0});rP.V2ChatStreamResponse=void 0;var SWn=wWn(se()),CWn=KXe(),xWn=eZe(),TWn=iZe(),OWn=aZe(),EWn=cZe(),PWn=gZe(),MWn=wZe(),RWn=SZe(),IWn=MZe(),AWn=RZe(),NWn=jZe(),DWn=hCe();rP.V2ChatStreamResponse=SWn.serialization.union("type",{"message-start":CWn.ChatMessageStartEvent,"content-start":xWn.ChatContentStartEvent,"content-delta":TWn.ChatContentDeltaEvent,"content-end":OWn.ChatContentEndEvent,"tool-plan-delta":EWn.ChatToolPlanDeltaEvent,"tool-call-start":PWn.ChatToolCallStartEvent,"tool-call-delta":MWn.ChatToolCallDeltaEvent,"tool-call-end":RWn.ChatToolCallEndEvent,"citation-start":IWn.CitationStartEvent,"citation-end":AWn.CitationEndEvent,"message-end":NWn.ChatMessageEndEvent,debug:DWn.ChatDebugEvent}).transform({transform:t=>t,untransform:t=>t})});var $Ze=S(nP=>{"use strict";var jWn=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]}),$Wn=nP&&nP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LWn=nP&&nP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jWn(r,e,n[o]);return $Wn(r,e),r}}();Object.defineProperty(nP,"__esModule",{value:!0});nP.V2ChatRequestDocumentsItem=void 0;var Usr=LWn(se()),FWn=_oe();nP.V2ChatRequestDocumentsItem=Usr.serialization.undiscriminatedUnion([Usr.serialization.string(),FWn.Document])});var LZe=S(oP=>{"use strict";var kWn=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]}),qWn=oP&&oP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BWn=oP&&oP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kWn(r,e,n[o]);return qWn(r,e),r}}();Object.defineProperty(oP,"__esModule",{value:!0});oP.V2ChatRequestSafetyMode=void 0;var UWn=BWn(se());oP.V2ChatRequestSafetyMode=UWn.serialization.enum_(["CONTEXTUAL","STRICT","OFF"])});var FZe=S(iP=>{"use strict";var zWn=iP&&iP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VWn=iP&&iP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HWn=iP&&iP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zWn(r,e,n[o]);return VWn(r,e),r}}();Object.defineProperty(iP,"__esModule",{value:!0});iP.V2ChatRequestToolChoice=void 0;var WWn=HWn(se());iP.V2ChatRequestToolChoice=WWn.serialization.enum_(["REQUIRED","NONE"])});var V2=S(aP=>{"use strict";var JWn=aP&&aP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KWn=aP&&aP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GWn=aP&&aP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&JWn(r,e,n[o]);return KWn(r,e),r}}();Object.defineProperty(aP,"__esModule",{value:!0});aP.ChatTextContent=void 0;var zsr=GWn(se());aP.ChatTextContent=zsr.serialization.object({text:zsr.serialization.string()})});var gCe=S(sP=>{"use strict";var XWn=sP&&sP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZWn=sP&&sP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YWn=sP&&sP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XWn(r,e,n[o]);return ZWn(r,e),r}}();Object.defineProperty(sP,"__esModule",{value:!0});sP.ChatThinkingContent=void 0;var Vsr=YWn(se());sP.ChatThinkingContent=Vsr.serialization.object({thinking:Vsr.serialization.string()})});var kZe=S(uP=>{"use strict";var QWn=uP&&uP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e3n=uP&&uP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t3n=uP&&uP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&QWn(r,e,n[o]);return e3n(r,e),r}}();Object.defineProperty(uP,"__esModule",{value:!0});uP.AssistantMessageResponseContentItem=void 0;var r3n=t3n(se()),n3n=V2(),o3n=gCe();uP.AssistantMessageResponseContentItem=r3n.serialization.union("type",{text:n3n.ChatTextContent,thinking:o3n.ChatThinkingContent}).transform({transform:t=>t,untransform:t=>t})});var qZe=S(lP=>{"use strict";var i3n=lP&&lP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),a3n=lP&&lP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s3n=lP&&lP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&i3n(r,e,n[o]);return a3n(r,e),r}}();Object.defineProperty(lP,"__esModule",{value:!0});lP.AssistantMessageResponse=void 0;var bk=s3n(se()),u3n=voe(),l3n=kZe(),c3n=Soe();lP.AssistantMessageResponse=bk.serialization.object({role:bk.serialization.stringLiteral("assistant"),toolCalls:bk.serialization.property("tool_calls",bk.serialization.list(u3n.ToolCallV2).optional()),toolPlan:bk.serialization.property("tool_plan",bk.serialization.string().optional()),content:bk.serialization.list(l3n.AssistantMessageResponseContentItem).optional(),citations:bk.serialization.list(c3n.Citation).optional()})});var Hsr=S(cP=>{"use strict";var d3n=cP&&cP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f3n=cP&&cP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p3n=cP&&cP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&d3n(r,e,n[o]);return f3n(r,e),r}}();Object.defineProperty(cP,"__esModule",{value:!0});cP.V2ChatResponse=void 0;var yCe=p3n(se()),m3n=pCe(),h3n=qZe(),g3n=mCe(),y3n=fCe();cP.V2ChatResponse=yCe.serialization.object({id:yCe.serialization.string(),finishReason:yCe.serialization.property("finish_reason",m3n.ChatFinishReason),message:h3n.AssistantMessageResponse,usage:g3n.Usage.optional(),logprobs:yCe.serialization.list(y3n.LogprobItem).optional()})});var BZe=S(dP=>{"use strict";var b3n=dP&&dP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_3n=dP&&dP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v3n=dP&&dP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&b3n(r,e,n[o]);return _3n(r,e),r}}();Object.defineProperty(dP,"__esModule",{value:!0});dP.V2EmbedRequestTruncate=void 0;var w3n=v3n(se());dP.V2EmbedRequestTruncate=w3n.serialization.enum_(["NONE","START","END"])});var UZe=S(fP=>{"use strict";var S3n=fP&&fP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C3n=fP&&fP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x3n=fP&&fP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&S3n(r,e,n[o]);return C3n(r,e),r}}();Object.defineProperty(fP,"__esModule",{value:!0});fP.V2RerankResponseResultsItem=void 0;var bCe=x3n(se());fP.V2RerankResponseResultsItem=bCe.serialization.object({index:bCe.serialization.number(),relevanceScore:bCe.serialization.property("relevance_score",bCe.serialization.number())})});var zZe=S(pP=>{"use strict";var T3n=pP&&pP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O3n=pP&&pP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E3n=pP&&pP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T3n(r,e,n[o]);return O3n(r,e),r}}();Object.defineProperty(pP,"__esModule",{value:!0});pP.ApiMetaApiVersion=void 0;var r8=E3n(se());pP.ApiMetaApiVersion=r8.serialization.object({version:r8.serialization.string(),isDeprecated:r8.serialization.property("is_deprecated",r8.serialization.boolean().optional()),isExperimental:r8.serialization.property("is_experimental",r8.serialization.boolean().optional())})});var VZe=S(mP=>{"use strict";var P3n=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]}),M3n=mP&&mP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R3n=mP&&mP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&P3n(r,e,n[o]);return M3n(r,e),r}}();Object.defineProperty(mP,"__esModule",{value:!0});mP.ApiMetaBilledUnits=void 0;var K1=R3n(se());mP.ApiMetaBilledUnits=K1.serialization.object({images:K1.serialization.number().optional(),inputTokens:K1.serialization.property("input_tokens",K1.serialization.number().optional()),outputTokens:K1.serialization.property("output_tokens",K1.serialization.number().optional()),searchUnits:K1.serialization.property("search_units",K1.serialization.number().optional()),classifications:K1.serialization.number().optional()})});var HZe=S(hP=>{"use strict";var I3n=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]}),A3n=hP&&hP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N3n=hP&&hP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&I3n(r,e,n[o]);return A3n(r,e),r}}();Object.defineProperty(hP,"__esModule",{value:!0});hP.ApiMetaTokens=void 0;var xoe=N3n(se());hP.ApiMetaTokens=xoe.serialization.object({inputTokens:xoe.serialization.property("input_tokens",xoe.serialization.number().optional()),outputTokens:xoe.serialization.property("output_tokens",xoe.serialization.number().optional())})});var J_=S(gP=>{"use strict";var D3n=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]}),j3n=gP&&gP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$3n=gP&&gP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&D3n(r,e,n[o]);return j3n(r,e),r}}();Object.defineProperty(gP,"__esModule",{value:!0});gP.ApiMeta=void 0;var Toe=$3n(se()),L3n=zZe(),F3n=VZe(),k3n=HZe();gP.ApiMeta=Toe.serialization.object({apiVersion:Toe.serialization.property("api_version",L3n.ApiMetaApiVersion.optional()),billedUnits:Toe.serialization.property("billed_units",F3n.ApiMetaBilledUnits.optional()),tokens:k3n.ApiMetaTokens.optional(),warnings:Toe.serialization.list(Toe.serialization.string()).optional()})});var Wsr=S(yP=>{"use strict";var q3n=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]}),B3n=yP&&yP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U3n=yP&&yP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&q3n(r,e,n[o]);return B3n(r,e),r}}();Object.defineProperty(yP,"__esModule",{value:!0});yP.V2RerankResponse=void 0;var WZe=U3n(se()),z3n=UZe(),V3n=J_();yP.V2RerankResponse=WZe.serialization.object({id:WZe.serialization.string().optional(),results:WZe.serialization.list(z3n.V2RerankResponseResultsItem),meta:V3n.ApiMeta.optional()})});var JZe=S($g=>{"use strict";var H3n=$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]}),fx=$g&&$g.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&H3n(e,t,r)};Object.defineProperty($g,"__esModule",{value:!0});fx(zXe(),$g);fx(VXe(),$g);fx(HXe(),$g);fx(Bsr(),$g);fx($Ze(),$g);fx(LZe(),$g);fx(FZe(),$g);fx(Hsr(),$g);fx(BZe(),$g);fx(UZe(),$g);fx(Wsr(),$g)});var KZe=S(bP=>{"use strict";var W3n=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]}),J3n=bP&&bP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K3n=bP&&bP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&W3n(r,e,n[o]);return J3n(r,e),r}}();Object.defineProperty(bP,"__esModule",{value:!0});bP.ImageUrlDetail=void 0;var G3n=K3n(se());bP.ImageUrlDetail=G3n.serialization.enum_(["auto","low","high"])});var GZe=S(_P=>{"use strict";var X3n=_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]}),Z3n=_P&&_P.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y3n=_P&&_P.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&X3n(r,e,n[o]);return Z3n(r,e),r}}();Object.defineProperty(_P,"__esModule",{value:!0});_P.ImageUrl=void 0;var Jsr=Y3n(se()),Q3n=KZe();_P.ImageUrl=Jsr.serialization.object({url:Jsr.serialization.string(),detail:Q3n.ImageUrlDetail.optional()})});var XZe=S(vP=>{"use strict";var e6n=vP&&vP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t6n=vP&&vP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r6n=vP&&vP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&e6n(r,e,n[o]);return t6n(r,e),r}}();Object.defineProperty(vP,"__esModule",{value:!0});vP.ImageContent=void 0;var Ksr=r6n(se()),n6n=GZe();vP.ImageContent=Ksr.serialization.object({imageUrl:Ksr.serialization.property("image_url",n6n.ImageUrl)})});var ZZe=S(wP=>{"use strict";var o6n=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]}),i6n=wP&&wP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a6n=wP&&wP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&o6n(r,e,n[o]);return i6n(r,e),r}}();Object.defineProperty(wP,"__esModule",{value:!0});wP.Content=void 0;var s6n=a6n(se()),u6n=V2(),l6n=XZe();wP.Content=s6n.serialization.union("type",{text:u6n.ChatTextContent,image_url:l6n.ImageContent}).transform({transform:t=>t,untransform:t=>t})});var QZe=S(SP=>{"use strict";var c6n=SP&&SP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d6n=SP&&SP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f6n=SP&&SP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&c6n(r,e,n[o]);return d6n(r,e),r}}();Object.defineProperty(SP,"__esModule",{value:!0});SP.UserMessageV2Content=void 0;var YZe=f6n(se()),p6n=ZZe();SP.UserMessageV2Content=YZe.serialization.undiscriminatedUnion([YZe.serialization.string(),YZe.serialization.list(p6n.Content)])});var eYe=S(CP=>{"use strict";var m6n=CP&&CP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),h6n=CP&&CP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g6n=CP&&CP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&m6n(r,e,n[o]);return h6n(r,e),r}}();Object.defineProperty(CP,"__esModule",{value:!0});CP.UserMessageV2=void 0;var y6n=g6n(se()),b6n=QZe();CP.UserMessageV2=y6n.serialization.object({content:b6n.UserMessageV2Content})});var tYe=S(xP=>{"use strict";var _6n=xP&&xP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v6n=xP&&xP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w6n=xP&&xP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_6n(r,e,n[o]);return v6n(r,e),r}}();Object.defineProperty(xP,"__esModule",{value:!0});xP.AssistantMessageV2ContentItem=void 0;var S6n=w6n(se()),C6n=V2(),x6n=gCe();xP.AssistantMessageV2ContentItem=S6n.serialization.union("type",{text:C6n.ChatTextContent,thinking:x6n.ChatThinkingContent}).transform({transform:t=>t,untransform:t=>t})});var nYe=S(TP=>{"use strict";var T6n=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]}),O6n=TP&&TP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E6n=TP&&TP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T6n(r,e,n[o]);return O6n(r,e),r}}();Object.defineProperty(TP,"__esModule",{value:!0});TP.AssistantMessageV2Content=void 0;var rYe=E6n(se()),P6n=tYe();TP.AssistantMessageV2Content=rYe.serialization.undiscriminatedUnion([rYe.serialization.string(),rYe.serialization.list(P6n.AssistantMessageV2ContentItem)])});var oYe=S(OP=>{"use strict";var M6n=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]}),R6n=OP&&OP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I6n=OP&&OP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&M6n(r,e,n[o]);return R6n(r,e),r}}();Object.defineProperty(OP,"__esModule",{value:!0});OP.AssistantMessage=void 0;var n8=I6n(se()),A6n=voe(),N6n=nYe(),D6n=Soe();OP.AssistantMessage=n8.serialization.object({toolCalls:n8.serialization.property("tool_calls",n8.serialization.list(A6n.ToolCallV2).optional()),toolPlan:n8.serialization.property("tool_plan",n8.serialization.string().optional()),content:N6n.AssistantMessageV2Content.optional(),citations:n8.serialization.list(D6n.Citation).optional()})});var iYe=S(EP=>{"use strict";var j6n=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]}),$6n=EP&&EP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L6n=EP&&EP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&j6n(r,e,n[o]);return $6n(r,e),r}}();Object.defineProperty(EP,"__esModule",{value:!0});EP.SystemMessageV2ContentItem=void 0;var F6n=L6n(se()),k6n=V2();EP.SystemMessageV2ContentItem=F6n.serialization.union("type",{text:k6n.ChatTextContent}).transform({transform:t=>t,untransform:t=>t})});var sYe=S(PP=>{"use strict";var q6n=PP&&PP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B6n=PP&&PP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U6n=PP&&PP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&q6n(r,e,n[o]);return B6n(r,e),r}}();Object.defineProperty(PP,"__esModule",{value:!0});PP.SystemMessageV2Content=void 0;var aYe=U6n(se()),z6n=iYe();PP.SystemMessageV2Content=aYe.serialization.undiscriminatedUnion([aYe.serialization.string(),aYe.serialization.list(z6n.SystemMessageV2ContentItem)])});var uYe=S(MP=>{"use strict";var V6n=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]}),H6n=MP&&MP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W6n=MP&&MP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&V6n(r,e,n[o]);return H6n(r,e),r}}();Object.defineProperty(MP,"__esModule",{value:!0});MP.SystemMessageV2=void 0;var J6n=W6n(se()),K6n=sYe();MP.SystemMessageV2=J6n.serialization.object({content:K6n.SystemMessageV2Content})});var lYe=S(RP=>{"use strict";var G6n=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]}),X6n=RP&&RP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z6n=RP&&RP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&G6n(r,e,n[o]);return X6n(r,e),r}}();Object.defineProperty(RP,"__esModule",{value:!0});RP.DocumentContent=void 0;var Y6n=Z6n(se()),Q6n=_oe();RP.DocumentContent=Y6n.serialization.object({document:Q6n.Document})});var cYe=S(IP=>{"use strict";var eJn=IP&&IP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tJn=IP&&IP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rJn=IP&&IP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eJn(r,e,n[o]);return tJn(r,e),r}}();Object.defineProperty(IP,"__esModule",{value:!0});IP.ToolContent=void 0;var nJn=rJn(se()),oJn=V2(),iJn=lYe();IP.ToolContent=nJn.serialization.union("type",{text:oJn.ChatTextContent,document:iJn.DocumentContent}).transform({transform:t=>t,untransform:t=>t})});var fYe=S(AP=>{"use strict";var aJn=AP&&AP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sJn=AP&&AP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uJn=AP&&AP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aJn(r,e,n[o]);return sJn(r,e),r}}();Object.defineProperty(AP,"__esModule",{value:!0});AP.ToolMessageV2Content=void 0;var dYe=uJn(se()),lJn=cYe();AP.ToolMessageV2Content=dYe.serialization.undiscriminatedUnion([dYe.serialization.string(),dYe.serialization.list(lJn.ToolContent)])});var mYe=S(NP=>{"use strict";var cJn=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]}),dJn=NP&&NP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fJn=NP&&NP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cJn(r,e,n[o]);return dJn(r,e),r}}();Object.defineProperty(NP,"__esModule",{value:!0});NP.ToolMessageV2=void 0;var pYe=fJn(se()),pJn=fYe();NP.ToolMessageV2=pYe.serialization.object({toolCallId:pYe.serialization.property("tool_call_id",pYe.serialization.string()),content:pJn.ToolMessageV2Content})});var hYe=S(DP=>{"use strict";var mJn=DP&&DP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hJn=DP&&DP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gJn=DP&&DP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mJn(r,e,n[o]);return hJn(r,e),r}}();Object.defineProperty(DP,"__esModule",{value:!0});DP.ChatMessageV2=void 0;var yJn=gJn(se()),bJn=eYe(),_Jn=oYe(),vJn=uYe(),wJn=mYe();DP.ChatMessageV2=yJn.serialization.union("role",{user:bJn.UserMessageV2,assistant:_Jn.AssistantMessage,system:vJn.SystemMessageV2,tool:wJn.ToolMessageV2}).transform({transform:t=>t,untransform:t=>t})});var _Ce=S(jP=>{"use strict";var SJn=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]}),CJn=jP&&jP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xJn=jP&&jP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&SJn(r,e,n[o]);return CJn(r,e),r}}();Object.defineProperty(jP,"__esModule",{value:!0});jP.ChatMessages=void 0;var TJn=xJn(se()),OJn=hYe();jP.ChatMessages=TJn.serialization.list(OJn.ChatMessageV2)});var gYe=S($P=>{"use strict";var EJn=$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]}),PJn=$P&&$P.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MJn=$P&&$P.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&EJn(r,e,n[o]);return PJn(r,e),r}}();Object.defineProperty($P,"__esModule",{value:!0});$P.ToolV2Function=void 0;var o8=MJn(se());$P.ToolV2Function=o8.serialization.object({name:o8.serialization.string(),description:o8.serialization.string().optional(),parameters:o8.serialization.record(o8.serialization.string(),o8.serialization.unknown())})});var vCe=S(LP=>{"use strict";var RJn=LP&&LP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IJn=LP&&LP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AJn=LP&&LP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&RJn(r,e,n[o]);return IJn(r,e),r}}();Object.defineProperty(LP,"__esModule",{value:!0});LP.ToolV2=void 0;var Gsr=AJn(se()),NJn=gYe();LP.ToolV2=Gsr.serialization.object({type:Gsr.serialization.stringLiteral("function").optional(),function:NJn.ToolV2Function.optional()})});var yYe=S(FP=>{"use strict";var DJn=FP&&FP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jJn=FP&&FP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Jn=FP&&FP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&DJn(r,e,n[o]);return jJn(r,e),r}}();Object.defineProperty(FP,"__esModule",{value:!0});FP.CitationOptionsMode=void 0;var LJn=$Jn(se());FP.CitationOptionsMode=LJn.serialization.enum_(["FAST","ACCURATE","OFF"])});var wCe=S(kP=>{"use strict";var FJn=kP&&kP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kJn=kP&&kP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qJn=kP&&kP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&FJn(r,e,n[o]);return kJn(r,e),r}}();Object.defineProperty(kP,"__esModule",{value:!0});kP.CitationOptions=void 0;var BJn=qJn(se()),UJn=yYe();kP.CitationOptions=BJn.serialization.object({mode:UJn.CitationOptionsMode.optional()})});var bYe=S(qP=>{"use strict";var zJn=qP&&qP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VJn=qP&&qP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HJn=qP&&qP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zJn(r,e,n[o]);return VJn(r,e),r}}();Object.defineProperty(qP,"__esModule",{value:!0});qP.ChatTextResponseFormatV2=void 0;var WJn=HJn(se());qP.ChatTextResponseFormatV2=WJn.serialization.object({})});var _Ye=S(BP=>{"use strict";var JJn=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]}),KJn=BP&&BP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GJn=BP&&BP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&JJn(r,e,n[o]);return KJn(r,e),r}}();Object.defineProperty(BP,"__esModule",{value:!0});BP.JsonResponseFormatV2=void 0;var Ooe=GJn(se());BP.JsonResponseFormatV2=Ooe.serialization.object({jsonSchema:Ooe.serialization.property("json_schema",Ooe.serialization.record(Ooe.serialization.string(),Ooe.serialization.unknown()).optional())})});var SCe=S(UP=>{"use strict";var XJn=UP&&UP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZJn=UP&&UP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YJn=UP&&UP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XJn(r,e,n[o]);return ZJn(r,e),r}}();Object.defineProperty(UP,"__esModule",{value:!0});UP.ResponseFormatV2=void 0;var QJn=YJn(se()),e5n=bYe(),t5n=_Ye();UP.ResponseFormatV2=QJn.serialization.union("type",{text:e5n.ChatTextResponseFormatV2,json_object:t5n.JsonResponseFormatV2}).transform({transform:t=>t,untransform:t=>t})});var vYe=S(zP=>{"use strict";var r5n=zP&&zP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n5n=zP&&zP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o5n=zP&&zP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&r5n(r,e,n[o]);return n5n(r,e),r}}();Object.defineProperty(zP,"__esModule",{value:!0});zP.ThinkingType=void 0;var i5n=o5n(se());zP.ThinkingType=i5n.serialization.enum_(["enabled","disabled"])});var CCe=S(VP=>{"use strict";var a5n=VP&&VP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s5n=VP&&VP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u5n=VP&&VP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&a5n(r,e,n[o]);return s5n(r,e),r}}();Object.defineProperty(VP,"__esModule",{value:!0});VP.Thinking=void 0;var wYe=u5n(se()),l5n=vYe();VP.Thinking=wYe.serialization.object({type:l5n.ThinkingType,tokenBudget:wYe.serialization.property("token_budget",wYe.serialization.number().optional())})});var Xsr=S(HP=>{"use strict";var c5n=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]}),d5n=HP&&HP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f5n=HP&&HP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&c5n(r,e,n[o]);return d5n(r,e),r}}();Object.defineProperty(HP,"__esModule",{value:!0});HP.V2ChatStreamRequest=void 0;var Hl=f5n(se()),p5n=_Ce(),m5n=vCe(),h5n=zXe(),g5n=wCe(),y5n=SCe(),b5n=VXe(),_5n=HXe(),v5n=CCe();HP.V2ChatStreamRequest=Hl.serialization.object({model:Hl.serialization.string(),messages:p5n.ChatMessages,tools:Hl.serialization.list(m5n.ToolV2).optional(),strictTools:Hl.serialization.property("strict_tools",Hl.serialization.boolean().optional()),documents:Hl.serialization.list(h5n.V2ChatStreamRequestDocumentsItem).optional(),citationOptions:Hl.serialization.property("citation_options",g5n.CitationOptions.optional()),responseFormat:Hl.serialization.property("response_format",y5n.ResponseFormatV2.optional()),safetyMode:Hl.serialization.property("safety_mode",b5n.V2ChatStreamRequestSafetyMode.optional()),maxTokens:Hl.serialization.property("max_tokens",Hl.serialization.number().optional()),stopSequences:Hl.serialization.property("stop_sequences",Hl.serialization.list(Hl.serialization.string()).optional()),temperature:Hl.serialization.number().optional(),seed:Hl.serialization.number().optional(),frequencyPenalty:Hl.serialization.property("frequency_penalty",Hl.serialization.number().optional()),presencePenalty:Hl.serialization.property("presence_penalty",Hl.serialization.number().optional()),k:Hl.serialization.number().optional(),p:Hl.serialization.number().optional(),logprobs:Hl.serialization.boolean().optional(),toolChoice:Hl.serialization.property("tool_choice",_5n.V2ChatStreamRequestToolChoice.optional()),thinking:v5n.Thinking.optional()})});var Zsr=S(WP=>{"use strict";var w5n=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]}),S5n=WP&&WP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C5n=WP&&WP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&w5n(r,e,n[o]);return S5n(r,e),r}}();Object.defineProperty(WP,"__esModule",{value:!0});WP.V2ChatRequest=void 0;var Wl=C5n(se()),x5n=_Ce(),T5n=vCe(),O5n=$Ze(),E5n=wCe(),P5n=SCe(),M5n=LZe(),R5n=FZe(),I5n=CCe();WP.V2ChatRequest=Wl.serialization.object({model:Wl.serialization.string(),messages:x5n.ChatMessages,tools:Wl.serialization.list(T5n.ToolV2).optional(),strictTools:Wl.serialization.property("strict_tools",Wl.serialization.boolean().optional()),documents:Wl.serialization.list(O5n.V2ChatRequestDocumentsItem).optional(),citationOptions:Wl.serialization.property("citation_options",E5n.CitationOptions.optional()),responseFormat:Wl.serialization.property("response_format",P5n.ResponseFormatV2.optional()),safetyMode:Wl.serialization.property("safety_mode",M5n.V2ChatRequestSafetyMode.optional()),maxTokens:Wl.serialization.property("max_tokens",Wl.serialization.number().optional()),stopSequences:Wl.serialization.property("stop_sequences",Wl.serialization.list(Wl.serialization.string()).optional()),temperature:Wl.serialization.number().optional(),seed:Wl.serialization.number().optional(),frequencyPenalty:Wl.serialization.property("frequency_penalty",Wl.serialization.number().optional()),presencePenalty:Wl.serialization.property("presence_penalty",Wl.serialization.number().optional()),k:Wl.serialization.number().optional(),p:Wl.serialization.number().optional(),logprobs:Wl.serialization.boolean().optional(),toolChoice:Wl.serialization.property("tool_choice",R5n.V2ChatRequestToolChoice.optional()),thinking:I5n.Thinking.optional()})});var Eoe=S(JP=>{"use strict";var A5n=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]}),N5n=JP&&JP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D5n=JP&&JP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&A5n(r,e,n[o]);return N5n(r,e),r}}();Object.defineProperty(JP,"__esModule",{value:!0});JP.EmbedInputType=void 0;var j5n=D5n(se());JP.EmbedInputType=j5n.serialization.enum_(["search_document","search_query","classification","clustering","image"])});var SYe=S(KP=>{"use strict";var $5n=KP&&KP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L5n=KP&&KP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F5n=KP&&KP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$5n(r,e,n[o]);return L5n(r,e),r}}();Object.defineProperty(KP,"__esModule",{value:!0});KP.EmbedImageUrl=void 0;var Ysr=F5n(se());KP.EmbedImageUrl=Ysr.serialization.object({url:Ysr.serialization.string()})});var CYe=S(GP=>{"use strict";var k5n=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]}),q5n=GP&&GP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B5n=GP&&GP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&k5n(r,e,n[o]);return q5n(r,e),r}}();Object.defineProperty(GP,"__esModule",{value:!0});GP.EmbedImage=void 0;var Qsr=B5n(se()),U5n=SYe();GP.EmbedImage=Qsr.serialization.object({imageUrl:Qsr.serialization.property("image_url",U5n.EmbedImageUrl.optional())})});var xYe=S(XP=>{"use strict";var z5n=XP&&XP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V5n=XP&&XP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H5n=XP&&XP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&z5n(r,e,n[o]);return V5n(r,e),r}}();Object.defineProperty(XP,"__esModule",{value:!0});XP.EmbedText=void 0;var eur=H5n(se());XP.EmbedText=eur.serialization.object({text:eur.serialization.string().optional()})});var TYe=S(ZP=>{"use strict";var W5n=ZP&&ZP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J5n=ZP&&ZP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K5n=ZP&&ZP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&W5n(r,e,n[o]);return J5n(r,e),r}}();Object.defineProperty(ZP,"__esModule",{value:!0});ZP.EmbedContent=void 0;var G5n=K5n(se()),X5n=CYe(),Z5n=xYe();ZP.EmbedContent=G5n.serialization.union("type",{image_url:X5n.EmbedImage,text:Z5n.EmbedText}).transform({transform:t=>t,untransform:t=>t})});var OYe=S(YP=>{"use strict";var Y5n=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]}),Q5n=YP&&YP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eKn=YP&&YP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Y5n(r,e,n[o]);return Q5n(r,e),r}}();Object.defineProperty(YP,"__esModule",{value:!0});YP.EmbedInput=void 0;var tur=eKn(se()),tKn=TYe();YP.EmbedInput=tur.serialization.object({content:tur.serialization.list(tKn.EmbedContent)})});var Poe=S(QP=>{"use strict";var rKn=QP&&QP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nKn=QP&&QP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oKn=QP&&QP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rKn(r,e,n[o]);return nKn(r,e),r}}();Object.defineProperty(QP,"__esModule",{value:!0});QP.EmbeddingType=void 0;var iKn=oKn(se());QP.EmbeddingType=iKn.serialization.enum_(["float","int8","uint8","binary","ubinary","base64"])});var rur=S(eM=>{"use strict";var aKn=eM&&eM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sKn=eM&&eM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uKn=eM&&eM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aKn(r,e,n[o]);return sKn(r,e),r}}();Object.defineProperty(eM,"__esModule",{value:!0});eM.V2EmbedRequest=void 0;var K_=uKn(se()),lKn=Eoe(),cKn=OYe(),dKn=Poe(),fKn=BZe();eM.V2EmbedRequest=K_.serialization.object({texts:K_.serialization.list(K_.serialization.string()).optional(),images:K_.serialization.list(K_.serialization.string()).optional(),model:K_.serialization.string(),inputType:K_.serialization.property("input_type",lKn.EmbedInputType),inputs:K_.serialization.list(cKn.EmbedInput).optional(),maxTokens:K_.serialization.property("max_tokens",K_.serialization.number().optional()),outputDimension:K_.serialization.property("output_dimension",K_.serialization.number().optional()),embeddingTypes:K_.serialization.property("embedding_types",K_.serialization.list(dKn.EmbeddingType).optional()),truncate:fKn.V2EmbedRequestTruncate.optional()})});var nur=S(tM=>{"use strict";var pKn=tM&&tM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mKn=tM&&tM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hKn=tM&&tM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pKn(r,e,n[o]);return mKn(r,e),r}}();Object.defineProperty(tM,"__esModule",{value:!0});tM.V2RerankRequest=void 0;var G1=hKn(se());tM.V2RerankRequest=G1.serialization.object({model:G1.serialization.string(),query:G1.serialization.string(),documents:G1.serialization.list(G1.serialization.string()),topN:G1.serialization.property("top_n",G1.serialization.number().optional()),maxTokensPerDoc:G1.serialization.property("max_tokens_per_doc",G1.serialization.number().optional())})});var EYe=S(rM=>{"use strict";Object.defineProperty(rM,"__esModule",{value:!0});rM.V2RerankRequest=rM.V2EmbedRequest=rM.V2ChatRequest=rM.V2ChatStreamRequest=void 0;var gKn=Xsr();Object.defineProperty(rM,"V2ChatStreamRequest",{enumerable:!0,get:function(){return gKn.V2ChatStreamRequest}});var yKn=Zsr();Object.defineProperty(rM,"V2ChatRequest",{enumerable:!0,get:function(){return yKn.V2ChatRequest}});var bKn=rur();Object.defineProperty(rM,"V2EmbedRequest",{enumerable:!0,get:function(){return bKn.V2EmbedRequest}});var _Kn=nur();Object.defineProperty(rM,"V2RerankRequest",{enumerable:!0,get:function(){return _Kn.V2RerankRequest}})});var our=S(H2=>{"use strict";var vKn=H2&&H2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wKn=H2&&H2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vKn(e,t,r)};Object.defineProperty(H2,"__esModule",{value:!0});wKn(EYe(),H2)});var aur=S(_k=>{"use strict";var SKn=_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]}),iur=_k&&_k.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&SKn(e,t,r)};Object.defineProperty(_k,"__esModule",{value:!0});iur(JZe(),_k);iur(our(),_k)});var PYe=S(nM=>{"use strict";var CKn=nM&&nM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xKn=nM&&nM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TKn=nM&&nM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&CKn(r,e,n[o]);return xKn(r,e),r}}();Object.defineProperty(nM,"__esModule",{value:!0});nM.CreateEmbedJobRequestTruncate=void 0;var OKn=TKn(se());nM.CreateEmbedJobRequestTruncate=OKn.serialization.enum_(["START","END"])});var MYe=S(W2=>{"use strict";var EKn=W2&&W2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PKn=W2&&W2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&EKn(e,t,r)};Object.defineProperty(W2,"__esModule",{value:!0});PKn(PYe(),W2)});var sur=S(oM=>{"use strict";var MKn=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]}),RKn=oM&&oM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IKn=oM&&oM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&MKn(r,e,n[o]);return RKn(r,e),r}}();Object.defineProperty(oM,"__esModule",{value:!0});oM.CreateEmbedJobRequest=void 0;var vk=IKn(se()),AKn=Eoe(),NKn=Poe(),DKn=PYe();oM.CreateEmbedJobRequest=vk.serialization.object({model:vk.serialization.string(),datasetId:vk.serialization.property("dataset_id",vk.serialization.string()),inputType:vk.serialization.property("input_type",AKn.EmbedInputType),name:vk.serialization.string().optional(),embeddingTypes:vk.serialization.property("embedding_types",vk.serialization.list(NKn.EmbeddingType).optional()),truncate:DKn.CreateEmbedJobRequestTruncate.optional()})});var RYe=S(xCe=>{"use strict";Object.defineProperty(xCe,"__esModule",{value:!0});xCe.CreateEmbedJobRequest=void 0;var jKn=sur();Object.defineProperty(xCe,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return jKn.CreateEmbedJobRequest}})});var uur=S(J2=>{"use strict";var $Kn=J2&&J2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LKn=J2&&J2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$Kn(e,t,r)};Object.defineProperty(J2,"__esModule",{value:!0});LKn(RYe(),J2)});var cur=S(wk=>{"use strict";var FKn=wk&&wk.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lur=wk&&wk.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&FKn(e,t,r)};Object.defineProperty(wk,"__esModule",{value:!0});lur(MYe(),wk);lur(uur(),wk)});var IYe=S(iM=>{"use strict";var kKn=iM&&iM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qKn=iM&&iM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BKn=iM&&iM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kKn(r,e,n[o]);return qKn(r,e),r}}();Object.defineProperty(iM,"__esModule",{value:!0});iM.DatasetType=void 0;var UKn=BKn(se());iM.DatasetType=UKn.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 AYe=S(aM=>{"use strict";var zKn=aM&&aM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VKn=aM&&aM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HKn=aM&&aM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zKn(r,e,n[o]);return VKn(r,e),r}}();Object.defineProperty(aM,"__esModule",{value:!0});aM.DatasetValidationStatus=void 0;var WKn=HKn(se());aM.DatasetValidationStatus=WKn.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var NYe=S(sM=>{"use strict";var JKn=sM&&sM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KKn=sM&&sM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GKn=sM&&sM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&JKn(r,e,n[o]);return KKn(r,e),r}}();Object.defineProperty(sM,"__esModule",{value:!0});sM.DatasetPart=void 0;var ww=GKn(se());sM.DatasetPart=ww.serialization.object({id:ww.serialization.string(),name:ww.serialization.string(),url:ww.serialization.string().optional(),index:ww.serialization.number().optional(),sizeBytes:ww.serialization.property("size_bytes",ww.serialization.number().optional()),numRows:ww.serialization.property("num_rows",ww.serialization.number().optional()),originalUrl:ww.serialization.property("original_url",ww.serialization.string().optional()),samples:ww.serialization.list(ww.serialization.string()).optional()})});var TCe=S(uM=>{"use strict";var XKn=uM&&uM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZKn=uM&&uM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YKn=uM&&uM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XKn(r,e,n[o]);return ZKn(r,e),r}}();Object.defineProperty(uM,"__esModule",{value:!0});uM.Dataset=void 0;var Cc=YKn(se()),QKn=IYe(),e8n=AYe(),t8n=NYe();uM.Dataset=Cc.serialization.object({id:Cc.serialization.string(),name:Cc.serialization.string(),createdAt:Cc.serialization.property("created_at",Cc.serialization.date()),updatedAt:Cc.serialization.property("updated_at",Cc.serialization.date()),datasetType:Cc.serialization.property("dataset_type",QKn.DatasetType),validationStatus:Cc.serialization.property("validation_status",e8n.DatasetValidationStatus),validationError:Cc.serialization.property("validation_error",Cc.serialization.string().optional()),schema:Cc.serialization.string().optional(),requiredFields:Cc.serialization.property("required_fields",Cc.serialization.list(Cc.serialization.string()).optional()),preserveFields:Cc.serialization.property("preserve_fields",Cc.serialization.list(Cc.serialization.string()).optional()),datasetParts:Cc.serialization.property("dataset_parts",Cc.serialization.list(t8n.DatasetPart).optional()),validationWarnings:Cc.serialization.property("validation_warnings",Cc.serialization.list(Cc.serialization.string()).optional())})});var fur=S(lM=>{"use strict";var r8n=lM&&lM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n8n=lM&&lM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o8n=lM&&lM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&r8n(r,e,n[o]);return n8n(r,e),r}}();Object.defineProperty(lM,"__esModule",{value:!0});lM.DatasetsListResponse=void 0;var dur=o8n(se()),i8n=TCe();lM.DatasetsListResponse=dur.serialization.object({datasets:dur.serialization.list(i8n.Dataset).optional()})});var mur=S(cM=>{"use strict";var a8n=cM&&cM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s8n=cM&&cM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u8n=cM&&cM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&a8n(r,e,n[o]);return s8n(r,e),r}}();Object.defineProperty(cM,"__esModule",{value:!0});cM.DatasetsCreateResponse=void 0;var pur=u8n(se());cM.DatasetsCreateResponse=pur.serialization.object({id:pur.serialization.string().optional()})});var hur=S(dM=>{"use strict";var l8n=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]}),c8n=dM&&dM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d8n=dM&&dM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&l8n(r,e,n[o]);return c8n(r,e),r}}();Object.defineProperty(dM,"__esModule",{value:!0});dM.DatasetsGetUsageResponse=void 0;var DYe=d8n(se());dM.DatasetsGetUsageResponse=DYe.serialization.object({organizationUsage:DYe.serialization.property("organization_usage",DYe.serialization.number().optional())})});var gur=S(fM=>{"use strict";var f8n=fM&&fM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p8n=fM&&fM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m8n=fM&&fM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&f8n(r,e,n[o]);return p8n(r,e),r}}();Object.defineProperty(fM,"__esModule",{value:!0});fM.DatasetsGetResponse=void 0;var h8n=m8n(se()),g8n=TCe();fM.DatasetsGetResponse=h8n.serialization.object({dataset:g8n.Dataset})});var jYe=S(pM=>{"use strict";var y8n=pM&&pM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OCe=pM&&pM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&y8n(e,t,r)};Object.defineProperty(pM,"__esModule",{value:!0});OCe(fur(),pM);OCe(mur(),pM);OCe(hur(),pM);OCe(gur(),pM)});var yur=S(mM=>{"use strict";var b8n=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]}),_8n=mM&&mM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v8n=mM&&mM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&b8n(r,e,n[o]);return _8n(r,e),r}}();Object.defineProperty(mM,"__esModule",{value:!0});mM.Response=void 0;var $Ye=v8n(se());mM.Response=$Ye.serialization.record($Ye.serialization.string(),$Ye.serialization.unknown())});var bur=S(hM=>{"use strict";var w8n=hM&&hM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),S8n=hM&&hM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C8n=hM&&hM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&w8n(r,e,n[o]);return S8n(r,e),r}}();Object.defineProperty(hM,"__esModule",{value:!0});hM.delete=void 0;hM.delete=C8n(yur())});var vur=S(Sk=>{"use strict";var x8n=Sk&&Sk.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_ur=Sk&&Sk.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&x8n(e,t,r)};Object.defineProperty(Sk,"__esModule",{value:!0});_ur(jYe(),Sk);_ur(bur(),Sk)});var LYe=S(gM=>{"use strict";var T8n=gM&&gM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O8n=gM&&gM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E8n=gM&&gM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T8n(r,e,n[o]);return O8n(r,e),r}}();Object.defineProperty(gM,"__esModule",{value:!0});gM.BaseType=void 0;var P8n=E8n(se());gM.BaseType=P8n.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var FYe=S(yM=>{"use strict";var M8n=yM&&yM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R8n=yM&&yM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I8n=yM&&yM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&M8n(r,e,n[o]);return R8n(r,e),r}}();Object.defineProperty(yM,"__esModule",{value:!0});yM.Strategy=void 0;var A8n=I8n(se());yM.Strategy=A8n.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var kYe=S(bM=>{"use strict";var N8n=bM&&bM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),D8n=bM&&bM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j8n=bM&&bM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&N8n(r,e,n[o]);return D8n(r,e),r}}();Object.defineProperty(bM,"__esModule",{value:!0});bM.BaseModel=void 0;var ECe=j8n(se()),$8n=LYe(),L8n=FYe();bM.BaseModel=ECe.serialization.object({name:ECe.serialization.string().optional(),version:ECe.serialization.string().optional(),baseType:ECe.serialization.property("base_type",$8n.BaseType),strategy:L8n.Strategy.optional()})});var qYe=S(_M=>{"use strict";var F8n=_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]}),k8n=_M&&_M.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q8n=_M&&_M.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&F8n(r,e,n[o]);return k8n(r,e),r}}();Object.defineProperty(_M,"__esModule",{value:!0});_M.LoraTargetModules=void 0;var B8n=q8n(se());_M.LoraTargetModules=B8n.serialization.enum_(["LORA_TARGET_MODULES_UNSPECIFIED","LORA_TARGET_MODULES_QV","LORA_TARGET_MODULES_QKVO","LORA_TARGET_MODULES_QKVO_FFN"])});var BYe=S(vM=>{"use strict";var U8n=vM&&vM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z8n=vM&&vM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V8n=vM&&vM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&U8n(r,e,n[o]);return z8n(r,e),r}}();Object.defineProperty(vM,"__esModule",{value:!0});vM.Hyperparameters=void 0;var By=V8n(se()),H8n=qYe();vM.Hyperparameters=By.serialization.object({earlyStoppingPatience:By.serialization.property("early_stopping_patience",By.serialization.number().optional()),earlyStoppingThreshold:By.serialization.property("early_stopping_threshold",By.serialization.number().optional()),trainBatchSize:By.serialization.property("train_batch_size",By.serialization.number().optional()),trainEpochs:By.serialization.property("train_epochs",By.serialization.number().optional()),learningRate:By.serialization.property("learning_rate",By.serialization.number().optional()),loraAlpha:By.serialization.property("lora_alpha",By.serialization.number().optional()),loraRank:By.serialization.property("lora_rank",By.serialization.number().optional()),loraTargetModules:By.serialization.property("lora_target_modules",H8n.LoraTargetModules.optional())})});var UYe=S(wM=>{"use strict";var W8n=wM&&wM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J8n=wM&&wM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K8n=wM&&wM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&W8n(r,e,n[o]);return J8n(r,e),r}}();Object.defineProperty(wM,"__esModule",{value:!0});wM.WandbConfig=void 0;var Moe=K8n(se());wM.WandbConfig=Moe.serialization.object({project:Moe.serialization.string(),apiKey:Moe.serialization.property("api_key",Moe.serialization.string()),entity:Moe.serialization.string().optional()})});var PCe=S(SM=>{"use strict";var G8n=SM&&SM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X8n=SM&&SM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z8n=SM&&SM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&G8n(r,e,n[o]);return X8n(r,e),r}}();Object.defineProperty(SM,"__esModule",{value:!0});SM.Settings=void 0;var i8=Z8n(se()),Y8n=kYe(),Q8n=BYe(),eGn=UYe();SM.Settings=i8.serialization.object({baseModel:i8.serialization.property("base_model",Y8n.BaseModel),datasetId:i8.serialization.property("dataset_id",i8.serialization.string()),hyperparameters:Q8n.Hyperparameters.optional(),multiLabel:i8.serialization.property("multi_label",i8.serialization.boolean().optional()),wandb:eGn.WandbConfig.optional()})});var Roe=S(CM=>{"use strict";var tGn=CM&&CM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rGn=CM&&CM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nGn=CM&&CM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tGn(r,e,n[o]);return rGn(r,e),r}}();Object.defineProperty(CM,"__esModule",{value:!0});CM.Status=void 0;var oGn=nGn(se());CM.Status=oGn.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var a8=S(xM=>{"use strict";var iGn=xM&&xM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aGn=xM&&xM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sGn=xM&&xM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&iGn(r,e,n[o]);return aGn(r,e),r}}();Object.defineProperty(xM,"__esModule",{value:!0});xM.FinetunedModel=void 0;var Ub=sGn(se()),uGn=PCe(),lGn=Roe();xM.FinetunedModel=Ub.serialization.object({id:Ub.serialization.string().optional(),name:Ub.serialization.string(),creatorId:Ub.serialization.property("creator_id",Ub.serialization.string().optional()),organizationId:Ub.serialization.property("organization_id",Ub.serialization.string().optional()),settings:uGn.Settings,status:lGn.Status.optional(),createdAt:Ub.serialization.property("created_at",Ub.serialization.date().optional()),updatedAt:Ub.serialization.property("updated_at",Ub.serialization.date().optional()),completedAt:Ub.serialization.property("completed_at",Ub.serialization.date().optional()),lastUsed:Ub.serialization.property("last_used",Ub.serialization.date().optional())})});var wur=S(TM=>{"use strict";var cGn=TM&&TM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dGn=TM&&TM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fGn=TM&&TM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cGn(r,e,n[o]);return dGn(r,e),r}}();Object.defineProperty(TM,"__esModule",{value:!0});TM.ListFinetunedModelsResponse=void 0;var K2=fGn(se()),pGn=a8();TM.ListFinetunedModelsResponse=K2.serialization.object({finetunedModels:K2.serialization.property("finetuned_models",K2.serialization.list(pGn.FinetunedModel).optional()),nextPageToken:K2.serialization.property("next_page_token",K2.serialization.string().optional()),totalSize:K2.serialization.property("total_size",K2.serialization.number().optional())})});var Cur=S(OM=>{"use strict";var mGn=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]}),hGn=OM&&OM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gGn=OM&&OM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mGn(r,e,n[o]);return hGn(r,e),r}}();Object.defineProperty(OM,"__esModule",{value:!0});OM.CreateFinetunedModelResponse=void 0;var Sur=gGn(se()),yGn=a8();OM.CreateFinetunedModelResponse=Sur.serialization.object({finetunedModel:Sur.serialization.property("finetuned_model",yGn.FinetunedModel.optional())})});var Tur=S(EM=>{"use strict";var bGn=EM&&EM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Gn=EM&&EM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vGn=EM&&EM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bGn(r,e,n[o]);return _Gn(r,e),r}}();Object.defineProperty(EM,"__esModule",{value:!0});EM.GetFinetunedModelResponse=void 0;var xur=vGn(se()),wGn=a8();EM.GetFinetunedModelResponse=xur.serialization.object({finetunedModel:xur.serialization.property("finetuned_model",wGn.FinetunedModel.optional())})});var Our=S(PM=>{"use strict";var SGn=PM&&PM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CGn=PM&&PM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xGn=PM&&PM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&SGn(r,e,n[o]);return CGn(r,e),r}}();Object.defineProperty(PM,"__esModule",{value:!0});PM.DeleteFinetunedModelResponse=void 0;var zYe=xGn(se());PM.DeleteFinetunedModelResponse=zYe.serialization.record(zYe.serialization.string(),zYe.serialization.unknown())});var Pur=S(MM=>{"use strict";var TGn=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]}),OGn=MM&&MM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EGn=MM&&MM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TGn(r,e,n[o]);return OGn(r,e),r}}();Object.defineProperty(MM,"__esModule",{value:!0});MM.UpdateFinetunedModelResponse=void 0;var Eur=EGn(se()),PGn=a8();MM.UpdateFinetunedModelResponse=Eur.serialization.object({finetunedModel:Eur.serialization.property("finetuned_model",PGn.FinetunedModel.optional())})});var VYe=S(RM=>{"use strict";var MGn=RM&&RM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RGn=RM&&RM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IGn=RM&&RM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&MGn(r,e,n[o]);return RGn(r,e),r}}();Object.defineProperty(RM,"__esModule",{value:!0});RM.Event=void 0;var Ioe=IGn(se()),AGn=Roe();RM.Event=Ioe.serialization.object({userId:Ioe.serialization.property("user_id",Ioe.serialization.string().optional()),status:AGn.Status.optional(),createdAt:Ioe.serialization.property("created_at",Ioe.serialization.date().optional())})});var Mur=S(IM=>{"use strict";var NGn=IM&&IM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DGn=IM&&IM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jGn=IM&&IM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&NGn(r,e,n[o]);return DGn(r,e),r}}();Object.defineProperty(IM,"__esModule",{value:!0});IM.ListEventsResponse=void 0;var s8=jGn(se()),$Gn=VYe();IM.ListEventsResponse=s8.serialization.object({events:s8.serialization.list($Gn.Event).optional(),nextPageToken:s8.serialization.property("next_page_token",s8.serialization.string().optional()),totalSize:s8.serialization.property("total_size",s8.serialization.number().optional())})});var HYe=S(AM=>{"use strict";var LGn=AM&&AM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FGn=AM&&AM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kGn=AM&&AM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LGn(r,e,n[o]);return FGn(r,e),r}}();Object.defineProperty(AM,"__esModule",{value:!0});AM.TrainingStepMetrics=void 0;var Ck=kGn(se());AM.TrainingStepMetrics=Ck.serialization.object({createdAt:Ck.serialization.property("created_at",Ck.serialization.date().optional()),stepNumber:Ck.serialization.property("step_number",Ck.serialization.number().optional()),metrics:Ck.serialization.record(Ck.serialization.string(),Ck.serialization.number()).optional()})});var Rur=S(NM=>{"use strict";var qGn=NM&&NM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BGn=NM&&NM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UGn=NM&&NM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qGn(r,e,n[o]);return BGn(r,e),r}}();Object.defineProperty(NM,"__esModule",{value:!0});NM.ListTrainingStepMetricsResponse=void 0;var Aoe=UGn(se()),zGn=HYe();NM.ListTrainingStepMetricsResponse=Aoe.serialization.object({stepMetrics:Aoe.serialization.property("step_metrics",Aoe.serialization.list(zGn.TrainingStepMetrics).optional()),nextPageToken:Aoe.serialization.property("next_page_token",Aoe.serialization.string().optional())})});var WYe=S(Jl=>{"use strict";var VGn=Jl&&Jl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Dh=Jl&&Jl.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&VGn(e,t,r)};Object.defineProperty(Jl,"__esModule",{value:!0});Dh(LYe(),Jl);Dh(FYe(),Jl);Dh(kYe(),Jl);Dh(qYe(),Jl);Dh(BYe(),Jl);Dh(UYe(),Jl);Dh(PCe(),Jl);Dh(Roe(),Jl);Dh(a8(),Jl);Dh(wur(),Jl);Dh(Cur(),Jl);Dh(Tur(),Jl);Dh(Our(),Jl);Dh(Pur(),Jl);Dh(VYe(),Jl);Dh(Mur(),Jl);Dh(HYe(),Jl);Dh(Rur(),Jl)});var Iur=S(G2=>{"use strict";var HGn=G2&&G2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WGn=G2&&G2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&HGn(e,t,r)};Object.defineProperty(G2,"__esModule",{value:!0});WGn(WYe(),G2)});var Nur=S(Sw=>{"use strict";var Aur=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]}),JGn=Sw&&Sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KGn=Sw&&Sw.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Aur(r,e,n[o]);return JGn(r,e),r}}(),GGn=Sw&&Sw.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Aur(e,t,r)};Object.defineProperty(Sw,"__esModule",{value:!0});Sw.finetuning=void 0;Sw.finetuning=KGn(Iur());GGn(WYe(),Sw)});var jur=S(DM=>{"use strict";var XGn=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]}),ZGn=DM&&DM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YGn=DM&&DM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XGn(r,e,n[o]);return ZGn(r,e),r}}();Object.defineProperty(DM,"__esModule",{value:!0});DM.FinetuningUpdateFinetunedModelRequest=void 0;var Dur=YGn(se()),QGn=PCe(),e9n=Roe();DM.FinetuningUpdateFinetunedModelRequest=Dur.serialization.object({name:Dur.serialization.string(),settings:QGn.Settings,status:e9n.Status.optional()})});var JYe=S(MCe=>{"use strict";Object.defineProperty(MCe,"__esModule",{value:!0});MCe.FinetuningUpdateFinetunedModelRequest=void 0;var t9n=jur();Object.defineProperty(MCe,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return t9n.FinetuningUpdateFinetunedModelRequest}})});var $ur=S(X2=>{"use strict";var r9n=X2&&X2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n9n=X2&&X2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&r9n(e,t,r)};Object.defineProperty(X2,"__esModule",{value:!0});n9n(JYe(),X2)});var Fur=S(xk=>{"use strict";var o9n=xk&&xk.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lur=xk&&xk.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&o9n(e,t,r)};Object.defineProperty(xk,"__esModule",{value:!0});Lur(Nur(),xk);Lur($ur(),xk)});var RCe=S($M=>{"use strict";var i9n=$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]}),a9n=$M&&$M.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s9n=$M&&$M.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&i9n(r,e,n[o]);return a9n(r,e),r}}();Object.defineProperty($M,"__esModule",{value:!0});$M.CreateConnectorOAuth=void 0;var jM=s9n(se());$M.CreateConnectorOAuth=jM.serialization.object({clientId:jM.serialization.property("client_id",jM.serialization.string().optional()),clientSecret:jM.serialization.property("client_secret",jM.serialization.string().optional()),authorizeUrl:jM.serialization.property("authorize_url",jM.serialization.string().optional()),tokenUrl:jM.serialization.property("token_url",jM.serialization.string().optional()),scope:jM.serialization.string().optional()})});var KYe=S(LM=>{"use strict";var u9n=LM&&LM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),l9n=LM&&LM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c9n=LM&&LM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&u9n(r,e,n[o]);return l9n(r,e),r}}();Object.defineProperty(LM,"__esModule",{value:!0});LM.AuthTokenType=void 0;var d9n=c9n(se());LM.AuthTokenType=d9n.serialization.enum_(["bearer","basic","noscheme"])});var ICe=S(FM=>{"use strict";var f9n=FM&&FM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p9n=FM&&FM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m9n=FM&&FM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&f9n(r,e,n[o]);return p9n(r,e),r}}();Object.defineProperty(FM,"__esModule",{value:!0});FM.CreateConnectorServiceAuth=void 0;var kur=m9n(se()),h9n=KYe();FM.CreateConnectorServiceAuth=kur.serialization.object({type:h9n.AuthTokenType,token:kur.serialization.string()})});var qur=S(qM=>{"use strict";var g9n=qM&&qM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y9n=qM&&qM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b9n=qM&&qM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&g9n(r,e,n[o]);return y9n(r,e),r}}();Object.defineProperty(qM,"__esModule",{value:!0});qM.CreateConnectorRequest=void 0;var kM=b9n(se()),_9n=RCe(),v9n=ICe();qM.CreateConnectorRequest=kM.serialization.object({name:kM.serialization.string(),description:kM.serialization.string().optional(),url:kM.serialization.string(),excludes:kM.serialization.list(kM.serialization.string()).optional(),oauth:_9n.CreateConnectorOAuth.optional(),active:kM.serialization.boolean().optional(),continueOnFailure:kM.serialization.property("continue_on_failure",kM.serialization.boolean().optional()),serviceAuth:kM.serialization.property("service_auth",v9n.CreateConnectorServiceAuth.optional())})});var Bur=S(BM=>{"use strict";var w9n=BM&&BM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),S9n=BM&&BM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C9n=BM&&BM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&w9n(r,e,n[o]);return S9n(r,e),r}}();Object.defineProperty(BM,"__esModule",{value:!0});BM.UpdateConnectorRequest=void 0;var X1=C9n(se()),x9n=RCe(),T9n=ICe();BM.UpdateConnectorRequest=X1.serialization.object({name:X1.serialization.string().optional(),url:X1.serialization.string().optional(),excludes:X1.serialization.list(X1.serialization.string()).optional(),oauth:x9n.CreateConnectorOAuth.optional(),active:X1.serialization.boolean().optional(),continueOnFailure:X1.serialization.property("continue_on_failure",X1.serialization.boolean().optional()),serviceAuth:X1.serialization.property("service_auth",T9n.CreateConnectorServiceAuth.optional())})});var GYe=S(u8=>{"use strict";Object.defineProperty(u8,"__esModule",{value:!0});u8.UpdateConnectorRequest=u8.CreateConnectorRequest=void 0;var O9n=qur();Object.defineProperty(u8,"CreateConnectorRequest",{enumerable:!0,get:function(){return O9n.CreateConnectorRequest}});var E9n=Bur();Object.defineProperty(u8,"UpdateConnectorRequest",{enumerable:!0,get:function(){return E9n.UpdateConnectorRequest}})});var Uur=S(Z2=>{"use strict";var P9n=Z2&&Z2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M9n=Z2&&Z2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&P9n(e,t,r)};Object.defineProperty(Z2,"__esModule",{value:!0});M9n(GYe(),Z2)});var zur=S(Y2=>{"use strict";var R9n=Y2&&Y2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),I9n=Y2&&Y2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&R9n(e,t,r)};Object.defineProperty(Y2,"__esModule",{value:!0});I9n(Uur(),Y2)});var Hur=S(Lu=>{"use strict";var Vur=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]}),A9n=Lu&&Lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Noe=Lu&&Lu.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Vur(r,e,n[o]);return A9n(r,e),r}}(),Q2=Lu&&Lu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Vur(e,t,r)};Object.defineProperty(Lu,"__esModule",{value:!0});Lu.connectors=Lu.finetuning=Lu.datasets=Lu.embedJobs=Lu.v2=void 0;Lu.v2=Noe(aur());Q2(JZe(),Lu);Lu.embedJobs=Noe(cur());Q2(MYe(),Lu);Lu.datasets=Noe(vur());Q2(jYe(),Lu);Lu.finetuning=Noe(Fur());Q2(EYe(),Lu);Q2(RYe(),Lu);Lu.connectors=Noe(zur());Q2(GYe(),Lu);Q2(JYe(),Lu)});var XYe=S(UM=>{"use strict";var N9n=UM&&UM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),D9n=UM&&UM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j9n=UM&&UM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&N9n(r,e,n[o]);return D9n(r,e),r}}();Object.defineProperty(UM,"__esModule",{value:!0});UM.ChatStreamRequestPromptTruncation=void 0;var $9n=j9n(se());UM.ChatStreamRequestPromptTruncation=$9n.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var ZYe=S(zM=>{"use strict";var L9n=zM&&zM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F9n=zM&&zM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k9n=zM&&zM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&L9n(r,e,n[o]);return F9n(r,e),r}}();Object.defineProperty(zM,"__esModule",{value:!0});zM.ChatStreamRequestCitationQuality=void 0;var q9n=k9n(se());zM.ChatStreamRequestCitationQuality=q9n.serialization.enum_(["fast","accurate","off"])});var YYe=S(VM=>{"use strict";var B9n=VM&&VM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),U9n=VM&&VM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z9n=VM&&VM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&B9n(r,e,n[o]);return U9n(r,e),r}}();Object.defineProperty(VM,"__esModule",{value:!0});VM.ChatStreamRequestSafetyMode=void 0;var V9n=z9n(se());VM.ChatStreamRequestSafetyMode=V9n.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var eQe=S(HM=>{"use strict";var H9n=HM&&HM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W9n=HM&&HM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J9n=HM&&HM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&H9n(r,e,n[o]);return W9n(r,e),r}}();Object.defineProperty(HM,"__esModule",{value:!0});HM.ChatStreamStartEvent=void 0;var QYe=J9n(se()),K9n=dx();HM.ChatStreamStartEvent=QYe.serialization.object({generationId:QYe.serialization.property("generation_id",QYe.serialization.string())}).extend(K9n.ChatStreamEvent)});var Doe=S(WM=>{"use strict";var G9n=WM&&WM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X9n=WM&&WM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z9n=WM&&WM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&G9n(r,e,n[o]);return X9n(r,e),r}}();Object.defineProperty(WM,"__esModule",{value:!0});WM.ChatSearchQuery=void 0;var ACe=Z9n(se());WM.ChatSearchQuery=ACe.serialization.object({text:ACe.serialization.string(),generationId:ACe.serialization.property("generation_id",ACe.serialization.string())})});var rQe=S(JM=>{"use strict";var Y9n=JM&&JM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q9n=JM&&JM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e7n=JM&&JM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Y9n(r,e,n[o]);return Q9n(r,e),r}}();Object.defineProperty(JM,"__esModule",{value:!0});JM.ChatSearchQueriesGenerationEvent=void 0;var tQe=e7n(se()),t7n=Doe(),r7n=dx();JM.ChatSearchQueriesGenerationEvent=tQe.serialization.object({searchQueries:tQe.serialization.property("search_queries",tQe.serialization.list(t7n.ChatSearchQuery))}).extend(r7n.ChatStreamEvent)});var nQe=S(KM=>{"use strict";var n7n=KM&&KM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o7n=KM&&KM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i7n=KM&&KM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&n7n(r,e,n[o]);return o7n(r,e),r}}();Object.defineProperty(KM,"__esModule",{value:!0});KM.ChatSearchResultConnector=void 0;var Wur=i7n(se());KM.ChatSearchResultConnector=Wur.serialization.object({id:Wur.serialization.string()})});var NCe=S(GM=>{"use strict";var a7n=GM&&GM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s7n=GM&&GM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u7n=GM&&GM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&a7n(r,e,n[o]);return s7n(r,e),r}}();Object.defineProperty(GM,"__esModule",{value:!0});GM.ChatSearchResult=void 0;var Z1=u7n(se()),l7n=Doe(),c7n=nQe();GM.ChatSearchResult=Z1.serialization.object({searchQuery:Z1.serialization.property("search_query",l7n.ChatSearchQuery.optional()),connector:c7n.ChatSearchResultConnector,documentIds:Z1.serialization.property("document_ids",Z1.serialization.list(Z1.serialization.string())),errorMessage:Z1.serialization.property("error_message",Z1.serialization.string().optional()),continueOnFailure:Z1.serialization.property("continue_on_failure",Z1.serialization.boolean().optional())})});var l8=S(XM=>{"use strict";var d7n=XM&&XM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f7n=XM&&XM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p7n=XM&&XM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&d7n(r,e,n[o]);return f7n(r,e),r}}();Object.defineProperty(XM,"__esModule",{value:!0});XM.ChatDocument=void 0;var oQe=p7n(se());XM.ChatDocument=oQe.serialization.record(oQe.serialization.string(),oQe.serialization.string())});var iQe=S(ZM=>{"use strict";var m7n=ZM&&ZM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),h7n=ZM&&ZM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g7n=ZM&&ZM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&m7n(r,e,n[o]);return h7n(r,e),r}}();Object.defineProperty(ZM,"__esModule",{value:!0});ZM.ChatSearchResultsEvent=void 0;var DCe=g7n(se()),y7n=NCe(),b7n=l8(),_7n=dx();ZM.ChatSearchResultsEvent=DCe.serialization.object({searchResults:DCe.serialization.property("search_results",DCe.serialization.list(y7n.ChatSearchResult).optional()),documents:DCe.serialization.list(b7n.ChatDocument).optional()}).extend(_7n.ChatStreamEvent)});var aQe=S(YM=>{"use strict";var v7n=YM&&YM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),w7n=YM&&YM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S7n=YM&&YM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&v7n(r,e,n[o]);return w7n(r,e),r}}();Object.defineProperty(YM,"__esModule",{value:!0});YM.ChatTextGenerationEvent=void 0;var Jur=S7n(se()),C7n=dx();YM.ChatTextGenerationEvent=Jur.serialization.object({text:Jur.serialization.string()}).extend(C7n.ChatStreamEvent)});var sQe=S(QM=>{"use strict";var x7n=QM&&QM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T7n=QM&&QM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O7n=QM&&QM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&x7n(r,e,n[o]);return T7n(r,e),r}}();Object.defineProperty(QM,"__esModule",{value:!0});QM.ChatCitationType=void 0;var E7n=O7n(se());QM.ChatCitationType=E7n.serialization.enum_(["TEXT_CONTENT","PLAN"])});var jCe=S(eR=>{"use strict";var P7n=eR&&eR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M7n=eR&&eR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R7n=eR&&eR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&P7n(r,e,n[o]);return M7n(r,e),r}}();Object.defineProperty(eR,"__esModule",{value:!0});eR.ChatCitation=void 0;var eV=R7n(se()),I7n=sQe();eR.ChatCitation=eV.serialization.object({start:eV.serialization.number(),end:eV.serialization.number(),text:eV.serialization.string(),documentIds:eV.serialization.property("document_ids",eV.serialization.list(eV.serialization.string())),type:I7n.ChatCitationType.optional()})});var uQe=S(tR=>{"use strict";var A7n=tR&&tR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),N7n=tR&&tR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D7n=tR&&tR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&A7n(r,e,n[o]);return N7n(r,e),r}}();Object.defineProperty(tR,"__esModule",{value:!0});tR.ChatCitationGenerationEvent=void 0;var Kur=D7n(se()),j7n=jCe(),$7n=dx();tR.ChatCitationGenerationEvent=Kur.serialization.object({citations:Kur.serialization.list(j7n.ChatCitation)}).extend($7n.ChatStreamEvent)});var c8=S(rR=>{"use strict";var L7n=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]}),F7n=rR&&rR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k7n=rR&&rR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&L7n(r,e,n[o]);return F7n(r,e),r}}();Object.defineProperty(rR,"__esModule",{value:!0});rR.ToolCall=void 0;var joe=k7n(se());rR.ToolCall=joe.serialization.object({name:joe.serialization.string(),parameters:joe.serialization.record(joe.serialization.string(),joe.serialization.unknown())})});var lQe=S(nR=>{"use strict";var q7n=nR&&nR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B7n=nR&&nR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U7n=nR&&nR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&q7n(r,e,n[o]);return B7n(r,e),r}}();Object.defineProperty(nR,"__esModule",{value:!0});nR.ChatToolCallsGenerationEvent=void 0;var $Ce=U7n(se()),z7n=c8(),V7n=dx();nR.ChatToolCallsGenerationEvent=$Ce.serialization.object({text:$Ce.serialization.string().optional(),toolCalls:$Ce.serialization.property("tool_calls",$Ce.serialization.list(z7n.ToolCall))}).extend(V7n.ChatStreamEvent)});var cQe=S(oR=>{"use strict";var H7n=oR&&oR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W7n=oR&&oR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J7n=oR&&oR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&H7n(r,e,n[o]);return W7n(r,e),r}}();Object.defineProperty(oR,"__esModule",{value:!0});oR.ChatStreamEndEventFinishReason=void 0;var K7n=J7n(se());oR.ChatStreamEndEventFinishReason=K7n.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var d8=S(iR=>{"use strict";var G7n=iR&&iR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X7n=iR&&iR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z7n=iR&&iR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&G7n(r,e,n[o]);return X7n(r,e),r}}();Object.defineProperty(iR,"__esModule",{value:!0});iR.FinishReason=void 0;var Y7n=Z7n(se());iR.FinishReason=Y7n.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var dQe=S(aR=>{"use strict";var Q7n=aR&&aR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eXn=aR&&aR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tXn=aR&&aR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Q7n(r,e,n[o]);return eXn(r,e),r}}();Object.defineProperty(aR,"__esModule",{value:!0});aR.ChatMessage=void 0;var LCe=tXn(se()),rXn=c8();aR.ChatMessage=LCe.serialization.object({message:LCe.serialization.string(),toolCalls:LCe.serialization.property("tool_calls",LCe.serialization.list(rXn.ToolCall).optional())})});var Loe=S(sR=>{"use strict";var nXn=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]}),oXn=sR&&sR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iXn=sR&&sR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nXn(r,e,n[o]);return oXn(r,e),r}}();Object.defineProperty(sR,"__esModule",{value:!0});sR.ToolResult=void 0;var $oe=iXn(se()),aXn=c8();sR.ToolResult=$oe.serialization.object({call:aXn.ToolCall,outputs:$oe.serialization.list($oe.serialization.record($oe.serialization.string(),$oe.serialization.unknown()))})});var pQe=S(uR=>{"use strict";var sXn=uR&&uR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uXn=uR&&uR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lXn=uR&&uR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sXn(r,e,n[o]);return uXn(r,e),r}}();Object.defineProperty(uR,"__esModule",{value:!0});uR.ChatToolMessage=void 0;var fQe=lXn(se()),cXn=Loe();uR.ChatToolMessage=fQe.serialization.object({toolResults:fQe.serialization.property("tool_results",fQe.serialization.list(cXn.ToolResult).optional())})});var Foe=S(lR=>{"use strict";var dXn=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]}),fXn=lR&&lR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pXn=lR&&lR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dXn(r,e,n[o]);return fXn(r,e),r}}();Object.defineProperty(lR,"__esModule",{value:!0});lR.Message=void 0;var mXn=pXn(se()),mQe=dQe(),hXn=pQe();lR.Message=mXn.serialization.union("role",{CHATBOT:mQe.ChatMessage,SYSTEM:mQe.ChatMessage,USER:mQe.ChatMessage,TOOL:hXn.ChatToolMessage}).transform({transform:t=>t,untransform:t=>t})});var hQe=S(cR=>{"use strict";var gXn=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]}),yXn=cR&&cR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bXn=cR&&cR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gXn(r,e,n[o]);return yXn(r,e),r}}();Object.defineProperty(cR,"__esModule",{value:!0});cR.NonStreamedChatResponse=void 0;var Lm=bXn(se()),_Xn=jCe(),vXn=l8(),wXn=Doe(),SXn=NCe(),CXn=d8(),xXn=c8(),TXn=Foe(),OXn=J_();cR.NonStreamedChatResponse=Lm.serialization.object({text:Lm.serialization.string(),generationId:Lm.serialization.property("generation_id",Lm.serialization.string().optional()),responseId:Lm.serialization.property("response_id",Lm.serialization.string().optional()),citations:Lm.serialization.list(_Xn.ChatCitation).optional(),documents:Lm.serialization.list(vXn.ChatDocument).optional(),isSearchRequired:Lm.serialization.property("is_search_required",Lm.serialization.boolean().optional()),searchQueries:Lm.serialization.property("search_queries",Lm.serialization.list(wXn.ChatSearchQuery).optional()),searchResults:Lm.serialization.property("search_results",Lm.serialization.list(SXn.ChatSearchResult).optional()),finishReason:Lm.serialization.property("finish_reason",CXn.FinishReason.optional()),toolCalls:Lm.serialization.property("tool_calls",Lm.serialization.list(xXn.ToolCall).optional()),chatHistory:Lm.serialization.property("chat_history",Lm.serialization.list(TXn.Message).optional()),meta:OXn.ApiMeta.optional()})});var gQe=S(dR=>{"use strict";var EXn=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]}),PXn=dR&&dR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MXn=dR&&dR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&EXn(r,e,n[o]);return PXn(r,e),r}}();Object.defineProperty(dR,"__esModule",{value:!0});dR.ChatStreamEndEvent=void 0;var Gur=MXn(se()),RXn=cQe(),IXn=hQe(),AXn=dx();dR.ChatStreamEndEvent=Gur.serialization.object({finishReason:Gur.serialization.property("finish_reason",RXn.ChatStreamEndEventFinishReason),response:IXn.NonStreamedChatResponse}).extend(AXn.ChatStreamEvent)});var yQe=S(fR=>{"use strict";var NXn=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]}),DXn=fR&&fR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jXn=fR&&fR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&NXn(r,e,n[o]);return DXn(r,e),r}}();Object.defineProperty(fR,"__esModule",{value:!0});fR.ToolCallDelta=void 0;var koe=jXn(se());fR.ToolCallDelta=koe.serialization.object({name:koe.serialization.string().optional(),index:koe.serialization.number().optional(),parameters:koe.serialization.string().optional(),text:koe.serialization.string().optional()})});var _Qe=S(pR=>{"use strict";var $Xn=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]}),LXn=pR&&pR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FXn=pR&&pR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$Xn(r,e,n[o]);return LXn(r,e),r}}();Object.defineProperty(pR,"__esModule",{value:!0});pR.ChatToolCallsChunkEvent=void 0;var bQe=FXn(se()),kXn=yQe(),qXn=dx();pR.ChatToolCallsChunkEvent=bQe.serialization.object({toolCallDelta:bQe.serialization.property("tool_call_delta",kXn.ToolCallDelta),text:bQe.serialization.string().optional()}).extend(qXn.ChatStreamEvent)});var Zur=S(mR=>{"use strict";var BXn=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]}),UXn=mR&&mR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zXn=mR&&mR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&BXn(r,e,n[o]);return UXn(r,e),r}}();Object.defineProperty(mR,"__esModule",{value:!0});mR.StreamedChatResponse=void 0;var Xur=zXn(se()),VXn=eQe(),HXn=rQe(),WXn=iQe(),JXn=aQe(),KXn=uQe(),GXn=lQe(),XXn=gQe(),ZXn=_Qe(),YXn=hCe();mR.StreamedChatResponse=Xur.serialization.union(Xur.serialization.discriminant("eventType","event_type"),{"stream-start":VXn.ChatStreamStartEvent,"search-queries-generation":HXn.ChatSearchQueriesGenerationEvent,"search-results":WXn.ChatSearchResultsEvent,"text-generation":JXn.ChatTextGenerationEvent,"citation-generation":KXn.ChatCitationGenerationEvent,"tool-calls-generation":GXn.ChatToolCallsGenerationEvent,"stream-end":XXn.ChatStreamEndEvent,"tool-calls-chunk":ZXn.ChatToolCallsChunkEvent,debug:YXn.ChatDebugEvent}).transform({transform:t=>t,untransform:t=>t})});var vQe=S(hR=>{"use strict";var QXn=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]}),eZn=hR&&hR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tZn=hR&&hR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&QXn(r,e,n[o]);return eZn(r,e),r}}();Object.defineProperty(hR,"__esModule",{value:!0});hR.ChatRequestPromptTruncation=void 0;var rZn=tZn(se());hR.ChatRequestPromptTruncation=rZn.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var wQe=S(gR=>{"use strict";var nZn=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]}),oZn=gR&&gR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iZn=gR&&gR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nZn(r,e,n[o]);return oZn(r,e),r}}();Object.defineProperty(gR,"__esModule",{value:!0});gR.ChatRequestCitationQuality=void 0;var aZn=iZn(se());gR.ChatRequestCitationQuality=aZn.serialization.enum_(["fast","accurate","off"])});var SQe=S(yR=>{"use strict";var sZn=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]}),uZn=yR&&yR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lZn=yR&&yR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sZn(r,e,n[o]);return uZn(r,e),r}}();Object.defineProperty(yR,"__esModule",{value:!0});yR.ChatRequestSafetyMode=void 0;var cZn=lZn(se());yR.ChatRequestSafetyMode=cZn.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var CQe=S(bR=>{"use strict";var dZn=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]}),fZn=bR&&bR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pZn=bR&&bR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dZn(r,e,n[o]);return fZn(r,e),r}}();Object.defineProperty(bR,"__esModule",{value:!0});bR.GenerateStreamRequestTruncate=void 0;var mZn=pZn(se());bR.GenerateStreamRequestTruncate=mZn.serialization.enum_(["NONE","START","END"])});var xQe=S(_R=>{"use strict";var hZn=_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]}),gZn=_R&&_R.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yZn=_R&&_R.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hZn(r,e,n[o]);return gZn(r,e),r}}();Object.defineProperty(_R,"__esModule",{value:!0});_R.GenerateStreamRequestReturnLikelihoods=void 0;var bZn=yZn(se());_R.GenerateStreamRequestReturnLikelihoods=bZn.serialization.enum_(["GENERATION","ALL","NONE"])});var qoe=S(vR=>{"use strict";var _Zn=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]}),vZn=vR&&vR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wZn=vR&&vR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Zn(r,e,n[o]);return vZn(r,e),r}}();Object.defineProperty(vR,"__esModule",{value:!0});vR.GenerateStreamEvent=void 0;var SZn=wZn(se());vR.GenerateStreamEvent=SZn.serialization.object({})});var TQe=S(wR=>{"use strict";var CZn=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]}),xZn=wR&&wR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TZn=wR&&wR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&CZn(r,e,n[o]);return xZn(r,e),r}}();Object.defineProperty(wR,"__esModule",{value:!0});wR.GenerateStreamText=void 0;var Boe=TZn(se()),OZn=qoe();wR.GenerateStreamText=Boe.serialization.object({text:Boe.serialization.string(),index:Boe.serialization.number().optional(),isFinished:Boe.serialization.property("is_finished",Boe.serialization.boolean())}).extend(OZn.GenerateStreamEvent)});var OQe=S(SR=>{"use strict";var EZn=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]}),PZn=SR&&SR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MZn=SR&&SR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&EZn(r,e,n[o]);return PZn(r,e),r}}();Object.defineProperty(SR,"__esModule",{value:!0});SR.SingleGenerationInStream=void 0;var Uoe=MZn(se()),RZn=d8();SR.SingleGenerationInStream=Uoe.serialization.object({id:Uoe.serialization.string(),text:Uoe.serialization.string(),index:Uoe.serialization.number().optional(),finishReason:Uoe.serialization.property("finish_reason",RZn.FinishReason)})});var EQe=S(CR=>{"use strict";var IZn=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]}),AZn=CR&&CR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NZn=CR&&CR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IZn(r,e,n[o]);return AZn(r,e),r}}();Object.defineProperty(CR,"__esModule",{value:!0});CR.GenerateStreamEndResponse=void 0;var FCe=NZn(se()),DZn=OQe();CR.GenerateStreamEndResponse=FCe.serialization.object({id:FCe.serialization.string(),prompt:FCe.serialization.string().optional(),generations:FCe.serialization.list(DZn.SingleGenerationInStream).optional()})});var PQe=S(xR=>{"use strict";var jZn=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]}),$Zn=xR&&xR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LZn=xR&&xR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jZn(r,e,n[o]);return $Zn(r,e),r}}();Object.defineProperty(xR,"__esModule",{value:!0});xR.GenerateStreamEnd=void 0;var kCe=LZn(se()),FZn=d8(),kZn=EQe(),qZn=qoe();xR.GenerateStreamEnd=kCe.serialization.object({isFinished:kCe.serialization.property("is_finished",kCe.serialization.boolean()),finishReason:kCe.serialization.property("finish_reason",FZn.FinishReason.optional()),response:kZn.GenerateStreamEndResponse}).extend(qZn.GenerateStreamEvent)});var MQe=S(TR=>{"use strict";var BZn=TR&&TR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UZn=TR&&TR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zZn=TR&&TR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&BZn(r,e,n[o]);return UZn(r,e),r}}();Object.defineProperty(TR,"__esModule",{value:!0});TR.GenerateStreamError=void 0;var f8=zZn(se()),VZn=d8(),HZn=qoe();TR.GenerateStreamError=f8.serialization.object({index:f8.serialization.number().optional(),isFinished:f8.serialization.property("is_finished",f8.serialization.boolean()),finishReason:f8.serialization.property("finish_reason",VZn.FinishReason),err:f8.serialization.string()}).extend(HZn.GenerateStreamEvent)});var Qur=S(OR=>{"use strict";var WZn=OR&&OR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JZn=OR&&OR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KZn=OR&&OR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&WZn(r,e,n[o]);return JZn(r,e),r}}();Object.defineProperty(OR,"__esModule",{value:!0});OR.GenerateStreamedResponse=void 0;var Yur=KZn(se()),GZn=TQe(),XZn=PQe(),ZZn=MQe();OR.GenerateStreamedResponse=Yur.serialization.union(Yur.serialization.discriminant("eventType","event_type"),{"text-generation":GZn.GenerateStreamText,"stream-end":XZn.GenerateStreamEnd,"stream-error":ZZn.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var RQe=S(ER=>{"use strict";var YZn=ER&&ER.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QZn=ER&&ER.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eYn=ER&&ER.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&YZn(r,e,n[o]);return QZn(r,e),r}}();Object.defineProperty(ER,"__esModule",{value:!0});ER.GenerateRequestTruncate=void 0;var tYn=eYn(se());ER.GenerateRequestTruncate=tYn.serialization.enum_(["NONE","START","END"])});var IQe=S(PR=>{"use strict";var rYn=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]}),nYn=PR&&PR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oYn=PR&&PR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rYn(r,e,n[o]);return nYn(r,e),r}}();Object.defineProperty(PR,"__esModule",{value:!0});PR.GenerateRequestReturnLikelihoods=void 0;var iYn=oYn(se());PR.GenerateRequestReturnLikelihoods=iYn.serialization.enum_(["GENERATION","ALL","NONE"])});var NQe=S(MR=>{"use strict";var aYn=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]}),sYn=MR&&MR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uYn=MR&&MR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aYn(r,e,n[o]);return sYn(r,e),r}}();Object.defineProperty(MR,"__esModule",{value:!0});MR.SingleGenerationTokenLikelihoodsItem=void 0;var AQe=uYn(se());MR.SingleGenerationTokenLikelihoodsItem=AQe.serialization.object({token:AQe.serialization.string(),likelihood:AQe.serialization.number()})});var DQe=S(RR=>{"use strict";var lYn=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]}),cYn=RR&&RR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dYn=RR&&RR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&lYn(r,e,n[o]);return cYn(r,e),r}}();Object.defineProperty(RR,"__esModule",{value:!0});RR.SingleGeneration=void 0;var tV=dYn(se()),fYn=NQe();RR.SingleGeneration=tV.serialization.object({id:tV.serialization.string(),text:tV.serialization.string(),index:tV.serialization.number().optional(),likelihood:tV.serialization.number().optional(),tokenLikelihoods:tV.serialization.property("token_likelihoods",tV.serialization.list(fYn.SingleGenerationTokenLikelihoodsItem).optional())})});var elr=S(IR=>{"use strict";var pYn=IR&&IR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mYn=IR&&IR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hYn=IR&&IR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pYn(r,e,n[o]);return mYn(r,e),r}}();Object.defineProperty(IR,"__esModule",{value:!0});IR.Generation=void 0;var qCe=hYn(se()),gYn=DQe(),yYn=J_();IR.Generation=qCe.serialization.object({id:qCe.serialization.string(),prompt:qCe.serialization.string().optional(),generations:qCe.serialization.list(gYn.SingleGeneration),meta:yYn.ApiMeta.optional()})});var jQe=S(AR=>{"use strict";var bYn=AR&&AR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Yn=AR&&AR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vYn=AR&&AR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bYn(r,e,n[o]);return _Yn(r,e),r}}();Object.defineProperty(AR,"__esModule",{value:!0});AR.EmbedRequestTruncate=void 0;var wYn=vYn(se());AR.EmbedRequestTruncate=wYn.serialization.enum_(["NONE","START","END"])});var BCe=S(NR=>{"use strict";var SYn=NR&&NR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CYn=NR&&NR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xYn=NR&&NR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&SYn(r,e,n[o]);return CYn(r,e),r}}();Object.defineProperty(NR,"__esModule",{value:!0});NR.Image=void 0;var p8=xYn(se());NR.Image=p8.serialization.object({width:p8.serialization.number(),height:p8.serialization.number(),format:p8.serialization.string(),bitDepth:p8.serialization.property("bit_depth",p8.serialization.number())})});var $Qe=S(DR=>{"use strict";var TYn=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]}),OYn=DR&&DR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EYn=DR&&DR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TYn(r,e,n[o]);return OYn(r,e),r}}();Object.defineProperty(DR,"__esModule",{value:!0});DR.EmbedFloatsResponse=void 0;var Tk=EYn(se()),PYn=BCe(),MYn=J_();DR.EmbedFloatsResponse=Tk.serialization.object({id:Tk.serialization.string(),embeddings:Tk.serialization.list(Tk.serialization.list(Tk.serialization.number())),texts:Tk.serialization.list(Tk.serialization.string()),images:Tk.serialization.list(PYn.Image).optional(),meta:MYn.ApiMeta.optional()})});var LQe=S(jR=>{"use strict";var RYn=jR&&jR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IYn=jR&&jR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AYn=jR&&jR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&RYn(r,e,n[o]);return IYn(r,e),r}}();Object.defineProperty(jR,"__esModule",{value:!0});jR.EmbedByTypeResponseEmbeddings=void 0;var jh=AYn(se());jR.EmbedByTypeResponseEmbeddings=jh.serialization.object({float:jh.serialization.list(jh.serialization.list(jh.serialization.number())).optional(),int8:jh.serialization.list(jh.serialization.list(jh.serialization.number())).optional(),uint8:jh.serialization.list(jh.serialization.list(jh.serialization.number())).optional(),binary:jh.serialization.list(jh.serialization.list(jh.serialization.number())).optional(),ubinary:jh.serialization.list(jh.serialization.list(jh.serialization.number())).optional(),base64:jh.serialization.list(jh.serialization.string()).optional()})});var FQe=S($R=>{"use strict";var NYn=$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]}),DYn=$R&&$R.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jYn=$R&&$R.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&NYn(r,e,n[o]);return DYn(r,e),r}}();Object.defineProperty($R,"__esModule",{value:!0});$R.EmbedByTypeResponse=void 0;var zoe=jYn(se()),$Yn=LQe(),LYn=BCe(),FYn=J_();$R.EmbedByTypeResponse=zoe.serialization.object({id:zoe.serialization.string(),embeddings:$Yn.EmbedByTypeResponseEmbeddings,texts:zoe.serialization.list(zoe.serialization.string()).optional(),images:zoe.serialization.list(LYn.Image).optional(),meta:FYn.ApiMeta.optional()})});var rlr=S(LR=>{"use strict";var kYn=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]}),qYn=LR&&LR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BYn=LR&&LR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kYn(r,e,n[o]);return qYn(r,e),r}}();Object.defineProperty(LR,"__esModule",{value:!0});LR.EmbedResponse=void 0;var tlr=BYn(se()),UYn=$Qe(),zYn=FQe();LR.EmbedResponse=tlr.serialization.union(tlr.serialization.discriminant("responseType","response_type"),{embeddings_floats:UYn.EmbedFloatsResponse,embeddings_by_type:zYn.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var qQe=S(FR=>{"use strict";var VYn=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]}),HYn=FR&&FR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WYn=FR&&FR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&VYn(r,e,n[o]);return HYn(r,e),r}}();Object.defineProperty(FR,"__esModule",{value:!0});FR.RerankDocument=void 0;var kQe=WYn(se());FR.RerankDocument=kQe.serialization.record(kQe.serialization.string(),kQe.serialization.string())});var BQe=S(kR=>{"use strict";var JYn=kR&&kR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KYn=kR&&kR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GYn=kR&&kR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&JYn(r,e,n[o]);return KYn(r,e),r}}();Object.defineProperty(kR,"__esModule",{value:!0});kR.RerankRequestDocumentsItem=void 0;var nlr=GYn(se()),XYn=qQe();kR.RerankRequestDocumentsItem=nlr.serialization.undiscriminatedUnion([nlr.serialization.string(),XYn.RerankDocument])});var UQe=S(qR=>{"use strict";var ZYn=qR&&qR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YYn=qR&&qR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QYn=qR&&qR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ZYn(r,e,n[o]);return YYn(r,e),r}}();Object.defineProperty(qR,"__esModule",{value:!0});qR.RerankResponseResultsItemDocument=void 0;var olr=QYn(se());qR.RerankResponseResultsItemDocument=olr.serialization.object({text:olr.serialization.string()})});var zQe=S(BR=>{"use strict";var eQn=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]}),tQn=BR&&BR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rQn=BR&&BR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eQn(r,e,n[o]);return tQn(r,e),r}}();Object.defineProperty(BR,"__esModule",{value:!0});BR.RerankResponseResultsItem=void 0;var UCe=rQn(se()),nQn=UQe();BR.RerankResponseResultsItem=UCe.serialization.object({document:nQn.RerankResponseResultsItemDocument.optional(),index:UCe.serialization.number(),relevanceScore:UCe.serialization.property("relevance_score",UCe.serialization.number())})});var ilr=S(UR=>{"use strict";var oQn=UR&&UR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iQn=UR&&UR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aQn=UR&&UR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&oQn(r,e,n[o]);return iQn(r,e),r}}();Object.defineProperty(UR,"__esModule",{value:!0});UR.RerankResponse=void 0;var VQe=aQn(se()),sQn=zQe(),uQn=J_();UR.RerankResponse=VQe.serialization.object({id:VQe.serialization.string().optional(),results:VQe.serialization.list(sQn.RerankResponseResultsItem),meta:uQn.ApiMeta.optional()})});var HQe=S(zR=>{"use strict";var lQn=zR&&zR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cQn=zR&&zR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dQn=zR&&zR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&lQn(r,e,n[o]);return cQn(r,e),r}}();Object.defineProperty(zR,"__esModule",{value:!0});zR.ClassifyRequestTruncate=void 0;var fQn=dQn(se());zR.ClassifyRequestTruncate=fQn.serialization.enum_(["NONE","START","END"])});var WQe=S(VR=>{"use strict";var pQn=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]}),mQn=VR&&VR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hQn=VR&&VR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pQn(r,e,n[o]);return mQn(r,e),r}}();Object.defineProperty(VR,"__esModule",{value:!0});VR.ClassifyResponseClassificationsItemLabelsValue=void 0;var alr=hQn(se());VR.ClassifyResponseClassificationsItemLabelsValue=alr.serialization.object({confidence:alr.serialization.number().optional()})});var JQe=S(HR=>{"use strict";var gQn=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]}),yQn=HR&&HR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bQn=HR&&HR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gQn(r,e,n[o]);return yQn(r,e),r}}();Object.defineProperty(HR,"__esModule",{value:!0});HR.ClassifyResponseClassificationsItemClassificationType=void 0;var _Qn=bQn(se());HR.ClassifyResponseClassificationsItemClassificationType=_Qn.serialization.enum_(["single-label","multi-label"])});var KQe=S(WR=>{"use strict";var vQn=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]}),wQn=WR&&WR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SQn=WR&&WR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vQn(r,e,n[o]);return wQn(r,e),r}}();Object.defineProperty(WR,"__esModule",{value:!0});WR.ClassifyResponseClassificationsItem=void 0;var n0=SQn(se()),CQn=WQe(),xQn=JQe();WR.ClassifyResponseClassificationsItem=n0.serialization.object({id:n0.serialization.string(),input:n0.serialization.string().optional(),prediction:n0.serialization.string().optional(),predictions:n0.serialization.list(n0.serialization.string()),confidence:n0.serialization.number().optional(),confidences:n0.serialization.list(n0.serialization.number()),labels:n0.serialization.record(n0.serialization.string(),CQn.ClassifyResponseClassificationsItemLabelsValue),classificationType:n0.serialization.property("classification_type",xQn.ClassifyResponseClassificationsItemClassificationType)})});var slr=S(JR=>{"use strict";var TQn=JR&&JR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OQn=JR&&JR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EQn=JR&&JR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TQn(r,e,n[o]);return OQn(r,e),r}}();Object.defineProperty(JR,"__esModule",{value:!0});JR.ClassifyResponse=void 0;var GQe=EQn(se()),PQn=KQe(),MQn=J_();JR.ClassifyResponse=GQe.serialization.object({id:GQe.serialization.string(),classifications:GQe.serialization.list(PQn.ClassifyResponseClassificationsItem),meta:MQn.ApiMeta.optional()})});var XQe=S(KR=>{"use strict";var RQn=KR&&KR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IQn=KR&&KR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AQn=KR&&KR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&RQn(r,e,n[o]);return IQn(r,e),r}}();Object.defineProperty(KR,"__esModule",{value:!0});KR.SummarizeRequestLength=void 0;var NQn=AQn(se());KR.SummarizeRequestLength=NQn.serialization.enum_(["short","medium","long"])});var ZQe=S(GR=>{"use strict";var DQn=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]}),jQn=GR&&GR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Qn=GR&&GR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&DQn(r,e,n[o]);return jQn(r,e),r}}();Object.defineProperty(GR,"__esModule",{value:!0});GR.SummarizeRequestFormat=void 0;var LQn=$Qn(se());GR.SummarizeRequestFormat=LQn.serialization.enum_(["paragraph","bullets"])});var YQe=S(XR=>{"use strict";var FQn=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]}),kQn=XR&&XR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qQn=XR&&XR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&FQn(r,e,n[o]);return kQn(r,e),r}}();Object.defineProperty(XR,"__esModule",{value:!0});XR.SummarizeRequestExtractiveness=void 0;var BQn=qQn(se());XR.SummarizeRequestExtractiveness=BQn.serialization.enum_(["low","medium","high"])});var ulr=S(ZR=>{"use strict";var UQn=ZR&&ZR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zQn=ZR&&ZR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VQn=ZR&&ZR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&UQn(r,e,n[o]);return zQn(r,e),r}}();Object.defineProperty(ZR,"__esModule",{value:!0});ZR.SummarizeResponse=void 0;var QQe=VQn(se()),HQn=J_();ZR.SummarizeResponse=QQe.serialization.object({id:QQe.serialization.string().optional(),summary:QQe.serialization.string().optional(),meta:HQn.ApiMeta.optional()})});var llr=S(YR=>{"use strict";var WQn=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]}),JQn=YR&&YR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KQn=YR&&YR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&WQn(r,e,n[o]);return JQn(r,e),r}}();Object.defineProperty(YR,"__esModule",{value:!0});YR.TokenizeResponse=void 0;var m8=KQn(se()),GQn=J_();YR.TokenizeResponse=m8.serialization.object({tokens:m8.serialization.list(m8.serialization.number()),tokenStrings:m8.serialization.property("token_strings",m8.serialization.list(m8.serialization.string())),meta:GQn.ApiMeta.optional()})});var dlr=S(QR=>{"use strict";var XQn=QR&&QR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZQn=QR&&QR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YQn=QR&&QR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XQn(r,e,n[o]);return ZQn(r,e),r}}();Object.defineProperty(QR,"__esModule",{value:!0});QR.DetokenizeResponse=void 0;var clr=YQn(se()),QQn=J_();QR.DetokenizeResponse=clr.serialization.object({text:clr.serialization.string(),meta:QQn.ApiMeta.optional()})});var flr=S(eI=>{"use strict";var eeo=eI&&eI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),teo=eI&&eI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),reo=eI&&eI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eeo(r,e,n[o]);return teo(r,e),r}}();Object.defineProperty(eI,"__esModule",{value:!0});eI.CheckApiKeyResponse=void 0;var h8=reo(se());eI.CheckApiKeyResponse=h8.serialization.object({valid:h8.serialization.boolean(),organizationId:h8.serialization.property("organization_id",h8.serialization.string().optional()),ownerId:h8.serialization.property("owner_id",h8.serialization.string().optional())})});var zCe=S(tI=>{"use strict";var neo=tI&&tI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oeo=tI&&tI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ieo=tI&&tI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&neo(r,e,n[o]);return oeo(r,e),r}}();Object.defineProperty(tI,"__esModule",{value:!0});tI.ChatConnector=void 0;var Y1=ieo(se());tI.ChatConnector=Y1.serialization.object({id:Y1.serialization.string(),userAccessToken:Y1.serialization.property("user_access_token",Y1.serialization.string().optional()),continueOnFailure:Y1.serialization.property("continue_on_failure",Y1.serialization.boolean().optional()),options:Y1.serialization.record(Y1.serialization.string(),Y1.serialization.unknown()).optional()})});var eet=S(rI=>{"use strict";var aeo=rI&&rI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),seo=rI&&rI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ueo=rI&&rI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aeo(r,e,n[o]);return seo(r,e),r}}();Object.defineProperty(rI,"__esModule",{value:!0});rI.ToolParameterDefinitionsValue=void 0;var VCe=ueo(se());rI.ToolParameterDefinitionsValue=VCe.serialization.object({description:VCe.serialization.string().optional(),type:VCe.serialization.string(),required:VCe.serialization.boolean().optional()})});var HCe=S(nI=>{"use strict";var leo=nI&&nI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ceo=nI&&nI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),deo=nI&&nI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&leo(r,e,n[o]);return ceo(r,e),r}}();Object.defineProperty(nI,"__esModule",{value:!0});nI.Tool=void 0;var g8=deo(se()),feo=eet();nI.Tool=g8.serialization.object({name:g8.serialization.string(),description:g8.serialization.string(),parameterDefinitions:g8.serialization.property("parameter_definitions",g8.serialization.record(g8.serialization.string(),feo.ToolParameterDefinitionsValue).optional())})});var tet=S(oI=>{"use strict";var peo=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]}),meo=oI&&oI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),heo=oI&&oI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&peo(r,e,n[o]);return meo(r,e),r}}();Object.defineProperty(oI,"__esModule",{value:!0});oI.ChatTextResponseFormat=void 0;var geo=heo(se());oI.ChatTextResponseFormat=geo.serialization.object({})});var ret=S(iI=>{"use strict";var yeo=iI&&iI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),beo=iI&&iI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_eo=iI&&iI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yeo(r,e,n[o]);return beo(r,e),r}}();Object.defineProperty(iI,"__esModule",{value:!0});iI.JsonResponseFormat=void 0;var WCe=_eo(se());iI.JsonResponseFormat=WCe.serialization.object({schema:WCe.serialization.record(WCe.serialization.string(),WCe.serialization.unknown()).optional()})});var JCe=S(aI=>{"use strict";var veo=aI&&aI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),weo=aI&&aI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Seo=aI&&aI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&veo(r,e,n[o]);return weo(r,e),r}}();Object.defineProperty(aI,"__esModule",{value:!0});aI.ResponseFormat=void 0;var Ceo=Seo(se()),xeo=tet(),Teo=ret();aI.ResponseFormat=Ceo.serialization.union("type",{text:xeo.ChatTextResponseFormat,json_object:Teo.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var net=S(sI=>{"use strict";var Oeo=sI&&sI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Eeo=sI&&sI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Peo=sI&&sI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Oeo(r,e,n[o]);return Eeo(r,e),r}}();Object.defineProperty(sI,"__esModule",{value:!0});sI.EmbedJobStatus=void 0;var Meo=Peo(se());sI.EmbedJobStatus=Meo.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var oet=S(uI=>{"use strict";var Reo=uI&&uI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ieo=uI&&uI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Aeo=uI&&uI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Reo(r,e,n[o]);return Ieo(r,e),r}}();Object.defineProperty(uI,"__esModule",{value:!0});uI.EmbedJobTruncate=void 0;var Neo=Aeo(se());uI.EmbedJobTruncate=Neo.serialization.enum_(["START","END"])});var iet=S(lI=>{"use strict";var Deo=lI&&lI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jeo=lI&&lI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$eo=lI&&lI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Deo(r,e,n[o]);return jeo(r,e),r}}();Object.defineProperty(lI,"__esModule",{value:!0});lI.EmbedJob=void 0;var px=$eo(se()),Leo=net(),Feo=oet(),keo=J_();lI.EmbedJob=px.serialization.object({jobId:px.serialization.property("job_id",px.serialization.string()),name:px.serialization.string().optional(),status:Leo.EmbedJobStatus,createdAt:px.serialization.property("created_at",px.serialization.date()),inputDatasetId:px.serialization.property("input_dataset_id",px.serialization.string()),outputDatasetId:px.serialization.property("output_dataset_id",px.serialization.string().optional()),model:px.serialization.string(),truncate:Feo.EmbedJobTruncate,meta:keo.ApiMeta.optional()})});var plr=S(cI=>{"use strict";var qeo=cI&&cI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Beo=cI&&cI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ueo=cI&&cI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qeo(r,e,n[o]);return Beo(r,e),r}}();Object.defineProperty(cI,"__esModule",{value:!0});cI.ListEmbedJobResponse=void 0;var aet=Ueo(se()),zeo=iet();cI.ListEmbedJobResponse=aet.serialization.object({embedJobs:aet.serialization.property("embed_jobs",aet.serialization.list(zeo.EmbedJob).optional())})});var mlr=S(dI=>{"use strict";var Veo=dI&&dI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Heo=dI&&dI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Weo=dI&&dI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Veo(r,e,n[o]);return Heo(r,e),r}}();Object.defineProperty(dI,"__esModule",{value:!0});dI.CreateEmbedJobResponse=void 0;var set=Weo(se()),Jeo=J_();dI.CreateEmbedJobResponse=set.serialization.object({jobId:set.serialization.property("job_id",set.serialization.string()),meta:Jeo.ApiMeta.optional()})});var cet=S(fI=>{"use strict";var Keo=fI&&fI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Geo=fI&&fI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xeo=fI&&fI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Keo(r,e,n[o]);return Geo(r,e),r}}();Object.defineProperty(fI,"__esModule",{value:!0});fI.ClassifyExample=void 0;var uet=Xeo(se());fI.ClassifyExample=uet.serialization.object({text:uet.serialization.string().optional(),label:uet.serialization.string().optional()})});var hlr=S(pI=>{"use strict";var Zeo=pI&&pI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yeo=pI&&pI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qeo=pI&&pI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Zeo(r,e,n[o]);return Yeo(r,e),r}}();Object.defineProperty(pI,"__esModule",{value:!0});pI.ParseInfo=void 0;var det=Qeo(se());pI.ParseInfo=det.serialization.object({separator:det.serialization.string().optional(),delimiter:det.serialization.string().optional()})});var glr=S(mI=>{"use strict";var eto=mI&&mI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tto=mI&&mI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rto=mI&&mI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eto(r,e,n[o]);return tto(r,e),r}}();Object.defineProperty(mI,"__esModule",{value:!0});mI.RerankerDataMetrics=void 0;var Cw=rto(se());mI.RerankerDataMetrics=Cw.serialization.object({numTrainQueries:Cw.serialization.property("num_train_queries",Cw.serialization.number().optional()),numTrainRelevantPassages:Cw.serialization.property("num_train_relevant_passages",Cw.serialization.number().optional()),numTrainHardNegatives:Cw.serialization.property("num_train_hard_negatives",Cw.serialization.number().optional()),numEvalQueries:Cw.serialization.property("num_eval_queries",Cw.serialization.number().optional()),numEvalRelevantPassages:Cw.serialization.property("num_eval_relevant_passages",Cw.serialization.number().optional()),numEvalHardNegatives:Cw.serialization.property("num_eval_hard_negatives",Cw.serialization.number().optional())})});var ylr=S(hI=>{"use strict";var nto=hI&&hI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oto=hI&&hI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ito=hI&&hI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nto(r,e,n[o]);return oto(r,e),r}}();Object.defineProperty(hI,"__esModule",{value:!0});hI.ChatDataMetrics=void 0;var y8=ito(se());hI.ChatDataMetrics=y8.serialization.object({numTrainTurns:y8.serialization.property("num_train_turns",y8.serialization.number().optional()),numEvalTurns:y8.serialization.property("num_eval_turns",y8.serialization.number().optional()),preamble:y8.serialization.string().optional()})});var fet=S(gI=>{"use strict";var ato=gI&&gI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sto=gI&&gI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uto=gI&&gI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ato(r,e,n[o]);return sto(r,e),r}}();Object.defineProperty(gI,"__esModule",{value:!0});gI.LabelMetric=void 0;var b8=uto(se());gI.LabelMetric=b8.serialization.object({totalExamples:b8.serialization.property("total_examples",b8.serialization.number().optional()),label:b8.serialization.string().optional(),samples:b8.serialization.list(b8.serialization.string()).optional()})});var blr=S(yI=>{"use strict";var lto=yI&&yI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cto=yI&&yI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dto=yI&&yI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&lto(r,e,n[o]);return cto(r,e),r}}();Object.defineProperty(yI,"__esModule",{value:!0});yI.ClassifyDataMetrics=void 0;var pet=dto(se()),fto=fet();yI.ClassifyDataMetrics=pet.serialization.object({labelMetrics:pet.serialization.property("label_metrics",pet.serialization.list(fto.LabelMetric).optional())})});var met=S(bI=>{"use strict";var pto=bI&&bI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mto=bI&&bI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hto=bI&&bI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pto(r,e,n[o]);return mto(r,e),r}}();Object.defineProperty(bI,"__esModule",{value:!0});bI.FinetuneDatasetMetrics=void 0;var xw=hto(se());bI.FinetuneDatasetMetrics=xw.serialization.object({trainableTokenCount:xw.serialization.property("trainable_token_count",xw.serialization.number().optional()),totalExamples:xw.serialization.property("total_examples",xw.serialization.number().optional()),trainExamples:xw.serialization.property("train_examples",xw.serialization.number().optional()),trainSizeBytes:xw.serialization.property("train_size_bytes",xw.serialization.number().optional()),evalExamples:xw.serialization.property("eval_examples",xw.serialization.number().optional()),evalSizeBytes:xw.serialization.property("eval_size_bytes",xw.serialization.number().optional())})});var vlr=S(_I=>{"use strict";var gto=_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]}),yto=_I&&_I.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bto=_I&&_I.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gto(r,e,n[o]);return yto(r,e),r}}();Object.defineProperty(_I,"__esModule",{value:!0});_I.Metrics=void 0;var _lr=bto(se()),_to=met();_I.Metrics=_lr.serialization.object({finetuneDatasetMetrics:_lr.serialization.property("finetune_dataset_metrics",_to.FinetuneDatasetMetrics.optional())})});var het=S(wI=>{"use strict";var vto=wI&&wI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wto=wI&&wI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sto=wI&&wI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vto(r,e,n[o]);return wto(r,e),r}}();Object.defineProperty(wI,"__esModule",{value:!0});wI.ConnectorOAuth=void 0;var vI=Sto(se());wI.ConnectorOAuth=vI.serialization.object({clientId:vI.serialization.property("client_id",vI.serialization.string().optional()),clientSecret:vI.serialization.property("client_secret",vI.serialization.string().optional()),authorizeUrl:vI.serialization.property("authorize_url",vI.serialization.string()),tokenUrl:vI.serialization.property("token_url",vI.serialization.string()),scope:vI.serialization.string().optional()})});var get=S(SI=>{"use strict";var Cto=SI&&SI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xto=SI&&SI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tto=SI&&SI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Cto(r,e,n[o]);return xto(r,e),r}}();Object.defineProperty(SI,"__esModule",{value:!0});SI.ConnectorAuthStatus=void 0;var Oto=Tto(se());SI.ConnectorAuthStatus=Oto.serialization.enum_(["valid","expired"])});var _8=S(CI=>{"use strict";var Eto=CI&&CI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pto=CI&&CI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mto=CI&&CI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Eto(r,e,n[o]);return Pto(r,e),r}}();Object.defineProperty(CI,"__esModule",{value:!0});CI.Connector=void 0;var Fm=Mto(se()),Rto=het(),Ito=get();CI.Connector=Fm.serialization.object({id:Fm.serialization.string(),organizationId:Fm.serialization.property("organization_id",Fm.serialization.string().optional()),name:Fm.serialization.string(),description:Fm.serialization.string().optional(),url:Fm.serialization.string().optional(),createdAt:Fm.serialization.property("created_at",Fm.serialization.date()),updatedAt:Fm.serialization.property("updated_at",Fm.serialization.date()),excludes:Fm.serialization.list(Fm.serialization.string()).optional(),authType:Fm.serialization.property("auth_type",Fm.serialization.string().optional()),oauth:Rto.ConnectorOAuth.optional(),authStatus:Fm.serialization.property("auth_status",Ito.ConnectorAuthStatus.optional()),active:Fm.serialization.boolean().optional(),continueOnFailure:Fm.serialization.property("continue_on_failure",Fm.serialization.boolean().optional())})});var wlr=S(xI=>{"use strict";var Ato=xI&&xI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Nto=xI&&xI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dto=xI&&xI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Ato(r,e,n[o]);return Nto(r,e),r}}();Object.defineProperty(xI,"__esModule",{value:!0});xI.ListConnectorsResponse=void 0;var KCe=Dto(se()),jto=_8();xI.ListConnectorsResponse=KCe.serialization.object({connectors:KCe.serialization.list(jto.Connector),totalCount:KCe.serialization.property("total_count",KCe.serialization.number().optional())})});var Slr=S(TI=>{"use strict";var $to=TI&&TI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lto=TI&&TI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fto=TI&&TI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$to(r,e,n[o]);return Lto(r,e),r}}();Object.defineProperty(TI,"__esModule",{value:!0});TI.CreateConnectorResponse=void 0;var kto=Fto(se()),qto=_8();TI.CreateConnectorResponse=kto.serialization.object({connector:qto.Connector})});var Clr=S(OI=>{"use strict";var Bto=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]}),Uto=OI&&OI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zto=OI&&OI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Bto(r,e,n[o]);return Uto(r,e),r}}();Object.defineProperty(OI,"__esModule",{value:!0});OI.GetConnectorResponse=void 0;var Vto=zto(se()),Hto=_8();OI.GetConnectorResponse=Vto.serialization.object({connector:Hto.Connector})});var xlr=S(EI=>{"use strict";var Wto=EI&&EI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jto=EI&&EI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kto=EI&&EI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Wto(r,e,n[o]);return Jto(r,e),r}}();Object.defineProperty(EI,"__esModule",{value:!0});EI.DeleteConnectorResponse=void 0;var yet=Kto(se());EI.DeleteConnectorResponse=yet.serialization.record(yet.serialization.string(),yet.serialization.unknown())});var Tlr=S(PI=>{"use strict";var Gto=PI&&PI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xto=PI&&PI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zto=PI&&PI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Gto(r,e,n[o]);return Xto(r,e),r}}();Object.defineProperty(PI,"__esModule",{value:!0});PI.UpdateConnectorResponse=void 0;var Yto=Zto(se()),Qto=_8();PI.UpdateConnectorResponse=Yto.serialization.object({connector:Qto.Connector})});var Olr=S(MI=>{"use strict";var ero=MI&&MI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tro=MI&&MI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rro=MI&&MI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ero(r,e,n[o]);return tro(r,e),r}}();Object.defineProperty(MI,"__esModule",{value:!0});MI.OAuthAuthorizeResponse=void 0;var bet=rro(se());MI.OAuthAuthorizeResponse=bet.serialization.object({redirectUrl:bet.serialization.property("redirect_url",bet.serialization.string().optional())})});var _et=S(RI=>{"use strict";var nro=RI&&RI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oro=RI&&RI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iro=RI&&RI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nro(r,e,n[o]);return oro(r,e),r}}();Object.defineProperty(RI,"__esModule",{value:!0});RI.CompatibleEndpoint=void 0;var aro=iro(se());RI.CompatibleEndpoint=aro.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var vet=S(II=>{"use strict";var sro=II&&II.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uro=II&&II.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lro=II&&II.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sro(r,e,n[o]);return uro(r,e),r}}();Object.defineProperty(II,"__esModule",{value:!0});II.GetModelResponse=void 0;var Uy=lro(se()),Elr=_et();II.GetModelResponse=Uy.serialization.object({name:Uy.serialization.string().optional(),isDeprecated:Uy.serialization.property("is_deprecated",Uy.serialization.boolean().optional()),endpoints:Uy.serialization.list(Elr.CompatibleEndpoint).optional(),finetuned:Uy.serialization.boolean().optional(),contextLength:Uy.serialization.property("context_length",Uy.serialization.number().optional()),tokenizerUrl:Uy.serialization.property("tokenizer_url",Uy.serialization.string().optional()),supportsVision:Uy.serialization.property("supports_vision",Uy.serialization.boolean().optional()),defaultEndpoints:Uy.serialization.property("default_endpoints",Uy.serialization.list(Elr.CompatibleEndpoint).optional()),features:Uy.serialization.list(Uy.serialization.string()).optional()})});var Plr=S(AI=>{"use strict";var cro=AI&&AI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dro=AI&&AI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fro=AI&&AI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cro(r,e,n[o]);return dro(r,e),r}}();Object.defineProperty(AI,"__esModule",{value:!0});AI.ListModelsResponse=void 0;var GCe=fro(se()),pro=vet();AI.ListModelsResponse=GCe.serialization.object({models:GCe.serialization.list(pro.GetModelResponse),nextPageToken:GCe.serialization.property("next_page_token",GCe.serialization.string().optional())})});var Mlr=S(ge=>{"use strict";var mro=ge&&ge.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ve=ge&&ge.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mro(e,t,r)};Object.defineProperty(ge,"__esModule",{value:!0});ve(XYe(),ge);ve(ZYe(),ge);ve(YYe(),ge);ve(Zur(),ge);ve(vQe(),ge);ve(wQe(),ge);ve(SQe(),ge);ve(hQe(),ge);ve(CQe(),ge);ve(xQe(),ge);ve(Qur(),ge);ve(RQe(),ge);ve(IQe(),ge);ve(elr(),ge);ve(jQe(),ge);ve(rlr(),ge);ve(BQe(),ge);ve(UQe(),ge);ve(zQe(),ge);ve(ilr(),ge);ve(HQe(),ge);ve(WQe(),ge);ve(JQe(),ge);ve(KQe(),ge);ve(slr(),ge);ve(XQe(),ge);ve(ZQe(),ge);ve(YQe(),ge);ve(ulr(),ge);ve(llr(),ge);ve(dlr(),ge);ve(flr(),ge);ve(c8(),ge);ve(dQe(),ge);ve(Loe(),ge);ve(pQe(),ge);ve(Foe(),ge);ve(zCe(),ge);ve(l8(),ge);ve(eet(),ge);ve(HCe(),ge);ve(tet(),ge);ve(ret(),ge);ve(JCe(),ge);ve(sQe(),ge);ve(jCe(),ge);ve(Doe(),ge);ve(nQe(),ge);ve(NCe(),ge);ve(d8(),ge);ve(zZe(),ge);ve(VZe(),ge);ve(HZe(),ge);ve(J_(),ge);ve(dx(),ge);ve(eQe(),ge);ve(rQe(),ge);ve(iQe(),ge);ve(aQe(),ge);ve(uQe(),ge);ve(lQe(),ge);ve(cQe(),ge);ve(gQe(),ge);ve(yQe(),ge);ve(_Qe(),ge);ve(hCe(),ge);ve(V2(),ge);ve(KZe(),ge);ve(GZe(),ge);ve(XZe(),ge);ve(ZZe(),ge);ve(QZe(),ge);ve(eYe(),ge);ve(fZe(),ge);ve(voe(),ge);ve(gCe(),ge);ve(CZe(),ge);ve(xZe(),ge);ve(TZe(),ge);ve(OZe(),ge);ve(Soe(),ge);ve(tYe(),ge);ve(nYe(),ge);ve(oYe(),ge);ve(iYe(),ge);ve(sYe(),ge);ve(uYe(),ge);ve(_oe(),ge);ve(lYe(),ge);ve(cYe(),ge);ve(fYe(),ge);ve(mYe(),ge);ve(hYe(),ge);ve(_Ce(),ge);ve(gYe(),ge);ve(vCe(),ge);ve(yYe(),ge);ve(wCe(),ge);ve(bYe(),ge);ve(_Ye(),ge);ve(SCe(),ge);ve(vYe(),ge);ve(CCe(),ge);ve(pCe(),ge);ve(kZe(),ge);ve(qZe(),ge);ve(IZe(),ge);ve(AZe(),ge);ve(mCe(),ge);ve(fCe(),ge);ve(vw(),ge);ve(WXe(),ge);ve(JXe(),ge);ve(KXe(),ge);ve(GXe(),ge);ve(ZXe(),ge);ve(YXe(),ge);ve(QXe(),ge);ve(eZe(),ge);ve(rZe(),ge);ve(nZe(),ge);ve(oZe(),ge);ve(iZe(),ge);ve(aZe(),ge);ve(uZe(),ge);ve(lZe(),ge);ve(cZe(),ge);ve(mZe(),ge);ve(hZe(),ge);ve(gZe(),ge);ve(yZe(),ge);ve(bZe(),ge);ve(_Ze(),ge);ve(vZe(),ge);ve(wZe(),ge);ve(SZe(),ge);ve(EZe(),ge);ve(PZe(),ge);ve(MZe(),ge);ve(RZe(),ge);ve(DZe(),ge);ve(jZe(),ge);ve(NQe(),ge);ve(DQe(),ge);ve(qoe(),ge);ve(TQe(),ge);ve(OQe(),ge);ve(EQe(),ge);ve(PQe(),ge);ve(MQe(),ge);ve(Eoe(),ge);ve(Poe(),ge);ve(BCe(),ge);ve($Qe(),ge);ve(LQe(),ge);ve(FQe(),ge);ve(SYe(),ge);ve(CYe(),ge);ve(xYe(),ge);ve(TYe(),ge);ve(OYe(),ge);ve(net(),ge);ve(oet(),ge);ve(iet(),ge);ve(plr(),ge);ve(mlr(),ge);ve(qQe(),ge);ve(cet(),ge);ve(AYe(),ge);ve(IYe(),ge);ve(NYe(),ge);ve(hlr(),ge);ve(glr(),ge);ve(ylr(),ge);ve(fet(),ge);ve(blr(),ge);ve(met(),ge);ve(vlr(),ge);ve(TCe(),ge);ve(het(),ge);ve(get(),ge);ve(_8(),ge);ve(wlr(),ge);ve(RCe(),ge);ve(KYe(),ge);ve(ICe(),ge);ve(Slr(),ge);ve(Clr(),ge);ve(xlr(),ge);ve(Tlr(),ge);ve(Olr(),ge);ve(_et(),ge);ve(vet(),ge);ve(Plr(),ge)});var Rlr=S(NI=>{"use strict";var hro=NI&&NI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gro=NI&&NI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yro=NI&&NI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hro(r,e,n[o]);return gro(r,e),r}}();Object.defineProperty(NI,"__esModule",{value:!0});NI.ChatStreamRequest=void 0;var Oi=yro(se()),bro=Foe(),_ro=XYe(),vro=zCe(),wro=l8(),Sro=ZYe(),Cro=HCe(),xro=Loe(),Tro=JCe(),Oro=YYe();NI.ChatStreamRequest=Oi.serialization.object({message:Oi.serialization.string(),model:Oi.serialization.string().optional(),preamble:Oi.serialization.string().optional(),chatHistory:Oi.serialization.property("chat_history",Oi.serialization.list(bro.Message).optional()),conversationId:Oi.serialization.property("conversation_id",Oi.serialization.string().optional()),promptTruncation:Oi.serialization.property("prompt_truncation",_ro.ChatStreamRequestPromptTruncation.optional()),connectors:Oi.serialization.list(vro.ChatConnector).optional(),searchQueriesOnly:Oi.serialization.property("search_queries_only",Oi.serialization.boolean().optional()),documents:Oi.serialization.list(wro.ChatDocument).optional(),citationQuality:Oi.serialization.property("citation_quality",Sro.ChatStreamRequestCitationQuality.optional()),temperature:Oi.serialization.number().optional(),maxTokens:Oi.serialization.property("max_tokens",Oi.serialization.number().optional()),maxInputTokens:Oi.serialization.property("max_input_tokens",Oi.serialization.number().optional()),k:Oi.serialization.number().optional(),p:Oi.serialization.number().optional(),seed:Oi.serialization.number().optional(),stopSequences:Oi.serialization.property("stop_sequences",Oi.serialization.list(Oi.serialization.string()).optional()),frequencyPenalty:Oi.serialization.property("frequency_penalty",Oi.serialization.number().optional()),presencePenalty:Oi.serialization.property("presence_penalty",Oi.serialization.number().optional()),rawPrompting:Oi.serialization.property("raw_prompting",Oi.serialization.boolean().optional()),tools:Oi.serialization.list(Cro.Tool).optional(),toolResults:Oi.serialization.property("tool_results",Oi.serialization.list(xro.ToolResult).optional()),forceSingleStep:Oi.serialization.property("force_single_step",Oi.serialization.boolean().optional()),responseFormat:Oi.serialization.property("response_format",Tro.ResponseFormat.optional()),safetyMode:Oi.serialization.property("safety_mode",Oro.ChatStreamRequestSafetyMode.optional())})});var Ilr=S(DI=>{"use strict";var Ero=DI&&DI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pro=DI&&DI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mro=DI&&DI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Ero(r,e,n[o]);return Pro(r,e),r}}();Object.defineProperty(DI,"__esModule",{value:!0});DI.ChatRequest=void 0;var Ei=Mro(se()),Rro=Foe(),Iro=vQe(),Aro=zCe(),Nro=l8(),Dro=wQe(),jro=HCe(),$ro=Loe(),Lro=JCe(),Fro=SQe();DI.ChatRequest=Ei.serialization.object({message:Ei.serialization.string(),model:Ei.serialization.string().optional(),preamble:Ei.serialization.string().optional(),chatHistory:Ei.serialization.property("chat_history",Ei.serialization.list(Rro.Message).optional()),conversationId:Ei.serialization.property("conversation_id",Ei.serialization.string().optional()),promptTruncation:Ei.serialization.property("prompt_truncation",Iro.ChatRequestPromptTruncation.optional()),connectors:Ei.serialization.list(Aro.ChatConnector).optional(),searchQueriesOnly:Ei.serialization.property("search_queries_only",Ei.serialization.boolean().optional()),documents:Ei.serialization.list(Nro.ChatDocument).optional(),citationQuality:Ei.serialization.property("citation_quality",Dro.ChatRequestCitationQuality.optional()),temperature:Ei.serialization.number().optional(),maxTokens:Ei.serialization.property("max_tokens",Ei.serialization.number().optional()),maxInputTokens:Ei.serialization.property("max_input_tokens",Ei.serialization.number().optional()),k:Ei.serialization.number().optional(),p:Ei.serialization.number().optional(),seed:Ei.serialization.number().optional(),stopSequences:Ei.serialization.property("stop_sequences",Ei.serialization.list(Ei.serialization.string()).optional()),frequencyPenalty:Ei.serialization.property("frequency_penalty",Ei.serialization.number().optional()),presencePenalty:Ei.serialization.property("presence_penalty",Ei.serialization.number().optional()),rawPrompting:Ei.serialization.property("raw_prompting",Ei.serialization.boolean().optional()),tools:Ei.serialization.list(jro.Tool).optional(),toolResults:Ei.serialization.property("tool_results",Ei.serialization.list($ro.ToolResult).optional()),forceSingleStep:Ei.serialization.property("force_single_step",Ei.serialization.boolean().optional()),responseFormat:Ei.serialization.property("response_format",Lro.ResponseFormat.optional()),safetyMode:Ei.serialization.property("safety_mode",Fro.ChatRequestSafetyMode.optional())})});var Alr=S(jI=>{"use strict";var kro=jI&&jI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qro=jI&&jI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bro=jI&&jI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kro(r,e,n[o]);return qro(r,e),r}}();Object.defineProperty(jI,"__esModule",{value:!0});jI.GenerateStreamRequest=void 0;var xl=Bro(se()),Uro=CQe(),zro=xQe();jI.GenerateStreamRequest=xl.serialization.object({prompt:xl.serialization.string(),model:xl.serialization.string().optional(),numGenerations:xl.serialization.property("num_generations",xl.serialization.number().optional()),maxTokens:xl.serialization.property("max_tokens",xl.serialization.number().optional()),truncate:Uro.GenerateStreamRequestTruncate.optional(),temperature:xl.serialization.number().optional(),seed:xl.serialization.number().optional(),preset:xl.serialization.string().optional(),endSequences:xl.serialization.property("end_sequences",xl.serialization.list(xl.serialization.string()).optional()),stopSequences:xl.serialization.property("stop_sequences",xl.serialization.list(xl.serialization.string()).optional()),k:xl.serialization.number().optional(),p:xl.serialization.number().optional(),frequencyPenalty:xl.serialization.property("frequency_penalty",xl.serialization.number().optional()),presencePenalty:xl.serialization.property("presence_penalty",xl.serialization.number().optional()),returnLikelihoods:xl.serialization.property("return_likelihoods",zro.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:xl.serialization.property("raw_prompting",xl.serialization.boolean().optional())})});var Nlr=S($I=>{"use strict";var Vro=$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]}),Hro=$I&&$I.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wro=$I&&$I.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Vro(r,e,n[o]);return Hro(r,e),r}}();Object.defineProperty($I,"__esModule",{value:!0});$I.GenerateRequest=void 0;var Tl=Wro(se()),Jro=RQe(),Kro=IQe();$I.GenerateRequest=Tl.serialization.object({prompt:Tl.serialization.string(),model:Tl.serialization.string().optional(),numGenerations:Tl.serialization.property("num_generations",Tl.serialization.number().optional()),maxTokens:Tl.serialization.property("max_tokens",Tl.serialization.number().optional()),truncate:Jro.GenerateRequestTruncate.optional(),temperature:Tl.serialization.number().optional(),seed:Tl.serialization.number().optional(),preset:Tl.serialization.string().optional(),endSequences:Tl.serialization.property("end_sequences",Tl.serialization.list(Tl.serialization.string()).optional()),stopSequences:Tl.serialization.property("stop_sequences",Tl.serialization.list(Tl.serialization.string()).optional()),k:Tl.serialization.number().optional(),p:Tl.serialization.number().optional(),frequencyPenalty:Tl.serialization.property("frequency_penalty",Tl.serialization.number().optional()),presencePenalty:Tl.serialization.property("presence_penalty",Tl.serialization.number().optional()),returnLikelihoods:Tl.serialization.property("return_likelihoods",Kro.GenerateRequestReturnLikelihoods.optional()),rawPrompting:Tl.serialization.property("raw_prompting",Tl.serialization.boolean().optional())})});var Dlr=S(LI=>{"use strict";var Gro=LI&&LI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xro=LI&&LI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zro=LI&&LI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Gro(r,e,n[o]);return Xro(r,e),r}}();Object.defineProperty(LI,"__esModule",{value:!0});LI.EmbedRequest=void 0;var Q1=Zro(se()),Yro=Eoe(),Qro=Poe(),eno=jQe();LI.EmbedRequest=Q1.serialization.object({texts:Q1.serialization.list(Q1.serialization.string()).optional(),images:Q1.serialization.list(Q1.serialization.string()).optional(),model:Q1.serialization.string().optional(),inputType:Q1.serialization.property("input_type",Yro.EmbedInputType.optional()),embeddingTypes:Q1.serialization.property("embedding_types",Q1.serialization.list(Qro.EmbeddingType).optional()),truncate:eno.EmbedRequestTruncate.optional()})});var jlr=S(FI=>{"use strict";var tno=FI&&FI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rno=FI&&FI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nno=FI&&FI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tno(r,e,n[o]);return rno(r,e),r}}();Object.defineProperty(FI,"__esModule",{value:!0});FI.RerankRequest=void 0;var Tw=nno(se()),ono=BQe();FI.RerankRequest=Tw.serialization.object({model:Tw.serialization.string().optional(),query:Tw.serialization.string(),documents:Tw.serialization.list(ono.RerankRequestDocumentsItem),topN:Tw.serialization.property("top_n",Tw.serialization.number().optional()),rankFields:Tw.serialization.property("rank_fields",Tw.serialization.list(Tw.serialization.string()).optional()),returnDocuments:Tw.serialization.property("return_documents",Tw.serialization.boolean().optional()),maxChunksPerDoc:Tw.serialization.property("max_chunks_per_doc",Tw.serialization.number().optional())})});var $lr=S(kI=>{"use strict";var ino=kI&&kI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ano=kI&&kI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sno=kI&&kI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ino(r,e,n[o]);return ano(r,e),r}}();Object.defineProperty(kI,"__esModule",{value:!0});kI.ClassifyRequest=void 0;var v8=sno(se()),uno=cet(),lno=HQe();kI.ClassifyRequest=v8.serialization.object({inputs:v8.serialization.list(v8.serialization.string()),examples:v8.serialization.list(uno.ClassifyExample).optional(),model:v8.serialization.string().optional(),preset:v8.serialization.string().optional(),truncate:lno.ClassifyRequestTruncate.optional()})});var Llr=S(qI=>{"use strict";var cno=qI&&qI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dno=qI&&qI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fno=qI&&qI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cno(r,e,n[o]);return dno(r,e),r}}();Object.defineProperty(qI,"__esModule",{value:!0});qI.SummarizeRequest=void 0;var w8=fno(se()),pno=XQe(),mno=ZQe(),hno=YQe();qI.SummarizeRequest=w8.serialization.object({text:w8.serialization.string(),length:pno.SummarizeRequestLength.optional(),format:mno.SummarizeRequestFormat.optional(),model:w8.serialization.string().optional(),extractiveness:hno.SummarizeRequestExtractiveness.optional(),temperature:w8.serialization.number().optional(),additionalCommand:w8.serialization.property("additional_command",w8.serialization.string().optional())})});var Flr=S(BI=>{"use strict";var gno=BI&&BI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yno=BI&&BI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bno=BI&&BI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gno(r,e,n[o]);return yno(r,e),r}}();Object.defineProperty(BI,"__esModule",{value:!0});BI.TokenizeRequest=void 0;var wet=bno(se());BI.TokenizeRequest=wet.serialization.object({text:wet.serialization.string(),model:wet.serialization.string()})});var klr=S(UI=>{"use strict";var _no=UI&&UI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vno=UI&&UI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wno=UI&&UI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_no(r,e,n[o]);return vno(r,e),r}}();Object.defineProperty(UI,"__esModule",{value:!0});UI.DetokenizeRequest=void 0;var XCe=wno(se());UI.DetokenizeRequest=XCe.serialization.object({tokens:XCe.serialization.list(XCe.serialization.number()),model:XCe.serialization.string()})});var qlr=S(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.DetokenizeRequest=kc.TokenizeRequest=kc.SummarizeRequest=kc.ClassifyRequest=kc.RerankRequest=kc.EmbedRequest=kc.GenerateRequest=kc.GenerateStreamRequest=kc.ChatRequest=kc.ChatStreamRequest=void 0;var Sno=Rlr();Object.defineProperty(kc,"ChatStreamRequest",{enumerable:!0,get:function(){return Sno.ChatStreamRequest}});var Cno=Ilr();Object.defineProperty(kc,"ChatRequest",{enumerable:!0,get:function(){return Cno.ChatRequest}});var xno=Alr();Object.defineProperty(kc,"GenerateStreamRequest",{enumerable:!0,get:function(){return xno.GenerateStreamRequest}});var Tno=Nlr();Object.defineProperty(kc,"GenerateRequest",{enumerable:!0,get:function(){return Tno.GenerateRequest}});var Ono=Dlr();Object.defineProperty(kc,"EmbedRequest",{enumerable:!0,get:function(){return Ono.EmbedRequest}});var Eno=jlr();Object.defineProperty(kc,"RerankRequest",{enumerable:!0,get:function(){return Eno.RerankRequest}});var Pno=$lr();Object.defineProperty(kc,"ClassifyRequest",{enumerable:!0,get:function(){return Pno.ClassifyRequest}});var Mno=Llr();Object.defineProperty(kc,"SummarizeRequest",{enumerable:!0,get:function(){return Mno.SummarizeRequest}});var Rno=Flr();Object.defineProperty(kc,"TokenizeRequest",{enumerable:!0,get:function(){return Rno.TokenizeRequest}});var Ino=klr();Object.defineProperty(kc,"DetokenizeRequest",{enumerable:!0,get:function(){return Ino.DetokenizeRequest}})});var Blr=S(rV=>{"use strict";var Ano=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]}),Nno=rV&&rV.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ano(e,t,r)};Object.defineProperty(rV,"__esModule",{value:!0});Nno(qlr(),rV)});var tD=S(eD=>{"use strict";var Dno=eD&&eD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cet=eD&&eD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Dno(e,t,r)};Object.defineProperty(eD,"__esModule",{value:!0});Cet(Hur(),eD);Cet(Mlr(),eD);Cet(Blr(),eD)});var xet=S(lu=>{"use strict";var jno=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]}),$no=lu&&lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lno=lu&&lu.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jno(r,e,n[o]);return $no(r,e),r}}(),ZCe=lu&&lu.__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())})},Fno=lu&&lu.__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(lu,"__esModule",{value:!0});lu.fetchOverride=lu.parseAWSEvent=lu.getAuthHeaders=lu.getUrl=lu.mapResponseFromBedrock=void 0;var kno=x5e(),qno=(gQt(),wpe(hQt)),Bno=xGe(),Uno=XQt(),zno=kne(),Vno=se(),Hno=V7e(),Wno=Csr(),o0=Lno(tD()),Jno=(t,e)=>ZCe(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),Kno={1:{chat:o0.StreamedChatResponse,generate:o0.GenerateStreamedResponse},2:{chat:o0.V2ChatStreamResponse,generate:o0.GenerateStreamedResponse}},Gno={1:{chat:o0.NonStreamedChatResponse,embed:o0.EmbedResponse,generate:o0.Generation,rerank:o0.RerankResponse},2:{chat:o0.V2ChatResponse,embed:o0.EmbedByTypeResponse,generate:o0.Generation,rerank:o0.V2RerankResponse}},Xno=(t,e,r,n)=>ZCe(void 0,void 0,void 0,function*(){let o=t?Kno[r][e]:Gno[r][e],i={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},a=yield o.parseOrThrow(n,i);return o.jsonOrThrow(a,i)});lu.mapResponseFromBedrock=Xno;var Zno=(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]};lu.getUrl=Zno;var Yno=(t,e,r,n,o,i)=>ZCe(void 0,void 0,void 0,function*(){let a=(0,qno.fromNodeProviderChain)(),s=yield Jno(()=>{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 Uno.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:kno.Sha256});delete r.connection,r.host=t.hostname;let l=new Bno.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});lu.getAuthHeaders=Yno;var Qno=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}}};lu.parseAWSEvent=Qno;var eoo=t=>({v1:1,v2:2})[t]||1,too=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>ZCe(void 0,void 0,void 0,function*(){var a,s,u,l;let c=i.url.split("/"),d=c.pop(),f=eoo(c.pop()),p=i.body;console.assert(p.model,"model is required");let m=!!p.stream,h=(0,lu.getUrl)(t,e,p.model,m);d==="rerank"&&(p.api_version=f),delete p.stream,delete p.model,delete i.headers.Authorization,i.headers.Host=new URL(h).hostname;let y=yield(0,lu.getAuthHeaders)(new URL(h),i.method,i.headers,JSON.stringify(p),t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o});i.url=h,i.headers=y;let g=yield(0,Vno.fetcher)(i);if(!g.ok)return g;try{if(m){let T=(0,Hno.readableStreamAsyncIterable)(g.body),O=new Wno.LineDecoder,E=new zno.PassThrough;try{for(var b=!0,_=Fno(T),w;w=yield _.next(),a=w.done,!a;b=!0){l=w.value,b=!1;let P=l;for(let R of O.decode(P)){let I=(0,lu.parseAWSEvent)(R);if(I){let A=yield(0,lu.mapResponseFromBedrock)(m,d,f,I);E.push(JSON.stringify(A)+`
`)}}}}catch(P){s={error:P}}finally{try{!b&&!a&&(u=_.return)&&(yield u.call(_))}finally{if(s)throw s.error}}for(let P of O.flush()){let R=(0,lu.parseAWSEvent)(P);if(R){let I=yield(0,lu.mapResponseFromBedrock)(m,d,f,R);E.push(JSON.stringify(I)+`
`)}}return E.end(),{ok:!0,body:E,rawResponse:g.rawResponse}}else{let T=yield g.body;return{ok:!0,body:yield(0,lu.mapResponseFromBedrock)(m,d,f,T),rawResponse:g.rawResponse}}}catch(T){throw T}});lu.fetchOverride=too});var rD=S(YCe=>{"use strict";Object.defineProperty(YCe,"__esModule",{value:!0});YCe.CohereEnvironment=void 0;YCe.CohereEnvironment={Production:"https://api.cohere.com"}});var Ok=S((Ulr,QCe)=>{(function(t,e,r){typeof QCe<"u"&&QCe.exports?QCe.exports=r():typeof define=="function"&&define.amd?define(r):e[t]=r()})("urljoin",Ulr,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 Oet=S(G_=>{"use strict";var roo=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]}),noo=G_&&G_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Voe=G_&&G_.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&roo(r,e,n[o]);return noo(r,e),r}}(),S8=G_&&G_.__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())})},ooo=G_&&G_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(G_,"__esModule",{value:!0});G_.V2=void 0;var exe=Voe(rD()),ia=Voe(se()),Vn=Voe(E1()),Ek=Voe(tD()),txe=ooo(Ok()),Lg=Voe($c()),Tet=class{constructor(e={}){this._options=e}chatStream(e,r){return ia.HttpResponsePromise.fromPromise(this.__chatStream(e,r))}__chatStream(e,r){return S8(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ia.fetcher)({url:(0,txe.default)((i=(o=yield ia.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ia.Supplier.get(this._options.environment))!==null&&i!==void 0?i:exe.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ia.Supplier.get(this._options.clientName))!=null?yield ia.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ia.RUNTIME.type,"X-Fern-Runtime-Version":ia.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Ek.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(a.ok)return{data:new ia.Stream({stream:a.body,parse:s=>S8(this,void 0,void 0,function*(){return Ek.V2ChatStreamResponse.parseOrThrow(s,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]})}),signal:r?.abortSignal,eventShape:{type:"sse",streamTerminator:"[DONE]"}}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Vn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Vn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Vn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Vn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Vn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Vn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Vn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Vn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Vn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Vn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Vn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Vn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Lg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Lg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Lg.CohereTimeoutError("Timeout exceeded when calling POST /v2/chat.");case"unknown":throw new Lg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}chat(e,r){return ia.HttpResponsePromise.fromPromise(this.__chat(e,r))}__chat(e,r){return S8(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ia.fetcher)({url:(0,txe.default)((i=(o=yield ia.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ia.Supplier.get(this._options.environment))!==null&&i!==void 0?i:exe.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ia.Supplier.get(this._options.clientName))!=null?yield ia.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ia.RUNTIME.type,"X-Fern-Runtime-Version":ia.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Ek.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(a.ok)return{data:Ek.V2ChatResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Vn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Vn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Vn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Vn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Vn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Vn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Vn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Vn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Vn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Vn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Vn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Vn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Lg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Lg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Lg.CohereTimeoutError("Timeout exceeded when calling POST /v2/chat.");case"unknown":throw new Lg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}embed(e,r){return ia.HttpResponsePromise.fromPromise(this.__embed(e,r))}__embed(e,r){return S8(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ia.fetcher)({url:(0,txe.default)((i=(o=yield ia.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ia.Supplier.get(this._options.environment))!==null&&i!==void 0?i:exe.CohereEnvironment.Production,"v2/embed"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ia.Supplier.get(this._options.clientName))!=null?yield ia.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ia.RUNTIME.type,"X-Fern-Runtime-Version":ia.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Ek.V2EmbedRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:Ek.EmbedByTypeResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Vn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Vn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Vn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Vn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Vn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Vn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Vn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Vn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Vn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Vn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Vn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Vn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Lg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Lg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Lg.CohereTimeoutError("Timeout exceeded when calling POST /v2/embed.");case"unknown":throw new Lg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}rerank(e,r){return ia.HttpResponsePromise.fromPromise(this.__rerank(e,r))}__rerank(e,r){return S8(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ia.fetcher)({url:(0,txe.default)((i=(o=yield ia.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ia.Supplier.get(this._options.environment))!==null&&i!==void 0?i:exe.CohereEnvironment.Production,"v2/rerank"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ia.Supplier.get(this._options.clientName))!=null?yield ia.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ia.RUNTIME.type,"X-Fern-Runtime-Version":ia.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Ek.V2RerankRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:Ek.V2RerankResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Vn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Vn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Vn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Vn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Vn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Vn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Vn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Vn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Vn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Vn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Vn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Vn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Lg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Lg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Lg.CohereTimeoutError("Timeout exceeded when calling POST /v2/rerank.");case"unknown":throw new Lg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}_getAuthorizationHeader(){return S8(this,void 0,void 0,function*(){var e;let r=(e=yield ia.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Lg.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};G_.V2=Tet});var zlr=S(X_=>{"use strict";var ioo=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]}),aoo=X_&&X_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Woe=X_&&X_.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ioo(r,e,n[o]);return aoo(r,e),r}}(),Hoe=X_&&X_.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},soo=X_&&X_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(X_,"__esModule",{value:!0});X_.EmbedJobs=void 0;var rxe=Woe(rD()),as=Woe(se()),Hn=Woe(E1()),nxe=soo(Ok()),oxe=Woe(tD()),Fg=Woe($c()),Eet=class{constructor(e={}){this._options=e}list(e){return as.HttpResponsePromise.fromPromise(this.__list(e))}__list(e){return Hoe(this,void 0,void 0,function*(){var r,n,o;let i=yield((r=this._options.fetcher)!==null&&r!==void 0?r:as.fetcher)({url:(0,nxe.default)((o=(n=yield as.Supplier.get(this._options.baseUrl))!==null&&n!==void 0?n:yield as.Supplier.get(this._options.environment))!==null&&o!==void 0?o:rxe.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield as.Supplier.get(this._options.clientName))!=null?yield as.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":as.RUNTIME.type,"X-Fern-Runtime-Version":as.RUNTIME.version},e?.headers),contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(i.ok)return{data:oxe.ListEmbedJobResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Hn.BadRequestError(i.error.body,i.rawResponse);case 401:throw new Hn.UnauthorizedError(i.error.body,i.rawResponse);case 403:throw new Hn.ForbiddenError(i.error.body,i.rawResponse);case 404:throw new Hn.NotFoundError(i.error.body,i.rawResponse);case 422:throw new Hn.UnprocessableEntityError(i.error.body,i.rawResponse);case 429:throw new Hn.TooManyRequestsError(i.error.body,i.rawResponse);case 498:throw new Hn.InvalidTokenError(i.error.body,i.rawResponse);case 499:throw new Hn.ClientClosedRequestError(i.error.body,i.rawResponse);case 500:throw new Hn.InternalServerError(i.error.body,i.rawResponse);case 501:throw new Hn.NotImplementedError(i.error.body,i.rawResponse);case 503:throw new Hn.ServiceUnavailableError(i.error.body,i.rawResponse);case 504:throw new Hn.GatewayTimeoutError(i.error.body,i.rawResponse);default:throw new Fg.CohereError({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new Fg.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new Fg.CohereTimeoutError("Timeout exceeded when calling GET /v1/embed-jobs.");case"unknown":throw new Fg.CohereError({message:i.error.errorMessage,rawResponse:i.rawResponse})}})}create(e,r){return as.HttpResponsePromise.fromPromise(this.__create(e,r))}__create(e,r){return Hoe(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:as.fetcher)({url:(0,nxe.default)((i=(o=yield as.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield as.Supplier.get(this._options.environment))!==null&&i!==void 0?i:rxe.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield as.Supplier.get(this._options.clientName))!=null?yield as.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":as.RUNTIME.type,"X-Fern-Runtime-Version":as.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:oxe.CreateEmbedJobRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:oxe.CreateEmbedJobResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Hn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Hn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Hn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Hn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Hn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Hn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Hn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Hn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Hn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Hn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Hn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Hn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Fg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Fg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Fg.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed-jobs.");case"unknown":throw new Fg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}get(e,r){return as.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return Hoe(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:as.fetcher)({url:(0,nxe.default)((i=(o=yield as.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield as.Supplier.get(this._options.environment))!==null&&i!==void 0?i:rxe.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield as.Supplier.get(this._options.clientName))!=null?yield as.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":as.RUNTIME.type,"X-Fern-Runtime-Version":as.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:oxe.EmbedJob.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Hn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Hn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Hn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Hn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Hn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Hn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Hn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Hn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Hn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Hn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Hn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Hn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Fg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Fg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Fg.CohereTimeoutError("Timeout exceeded when calling GET /v1/embed-jobs/{id}.");case"unknown":throw new Fg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}cancel(e,r){return as.HttpResponsePromise.fromPromise(this.__cancel(e,r))}__cancel(e,r){return Hoe(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:as.fetcher)({url:(0,nxe.default)((i=(o=yield as.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield as.Supplier.get(this._options.environment))!==null&&i!==void 0?i:rxe.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}/cancel`),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield as.Supplier.get(this._options.clientName))!=null?yield as.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":as.RUNTIME.type,"X-Fern-Runtime-Version":as.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Hn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Hn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Hn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Hn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Hn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Hn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Hn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Hn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Hn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Hn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Hn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Hn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Fg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Fg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Fg.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed-jobs/{id}/cancel.");case"unknown":throw new Fg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}_getAuthorizationHeader(){return Hoe(this,void 0,void 0,function*(){var e;let r=(e=yield as.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Fg.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};X_.EmbedJobs=Eet});var Vlr=S(Z_=>{"use strict";var uoo=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]}),loo=Z_&&Z_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Goe=Z_&&Z_.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&uoo(r,e,n[o]);return loo(r,e),r}}(),C8=Z_&&Z_.__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())})},coo=Z_&&Z_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Z_,"__esModule",{value:!0});Z_.Datasets=void 0;var Joe=Goe(rD()),Zo=Goe(se()),qr=Goe(E1()),nV=Goe(tD()),Koe=coo(Ok()),ud=Goe($c()),Pet=class{constructor(e={}){this._options=e}list(e={},r){return Zo.HttpResponsePromise.fromPromise(this.__list(e,r))}__list(){return C8(this,arguments,void 0,function*(e={},r){var n,o,i;let{datasetType:a,before:s,after:u,limit:l,offset:c,validationStatus:d}=e,f={};a!=null&&(f.datasetType=a),s!=null&&(f.before=s.toISOString()),u!=null&&(f.after=u.toISOString()),l!=null&&(f.limit=l.toString()),c!=null&&(f.offset=c.toString()),d!=null&&(f.validationStatus=nV.DatasetValidationStatus.jsonOrThrow(d,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}));let p=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Zo.fetcher)({url:(0,Koe.default)((i=(o=yield Zo.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Zo.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Joe.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Zo.Supplier.get(this._options.clientName))!=null?yield Zo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Zo.RUNTIME.type,"X-Fern-Runtime-Version":Zo.RUNTIME.version},r?.headers),contentType:"application/json",queryParameters:f,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(p.ok)return{data:nV.DatasetsListResponse.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new qr.BadRequestError(p.error.body,p.rawResponse);case 401:throw new qr.UnauthorizedError(p.error.body,p.rawResponse);case 403:throw new qr.ForbiddenError(p.error.body,p.rawResponse);case 404:throw new qr.NotFoundError(p.error.body,p.rawResponse);case 422:throw new qr.UnprocessableEntityError(p.error.body,p.rawResponse);case 429:throw new qr.TooManyRequestsError(p.error.body,p.rawResponse);case 498:throw new qr.InvalidTokenError(p.error.body,p.rawResponse);case 499:throw new qr.ClientClosedRequestError(p.error.body,p.rawResponse);case 500:throw new qr.InternalServerError(p.error.body,p.rawResponse);case 501:throw new qr.NotImplementedError(p.error.body,p.rawResponse);case 503:throw new qr.ServiceUnavailableError(p.error.body,p.rawResponse);case 504:throw new qr.GatewayTimeoutError(p.error.body,p.rawResponse);default:throw new ud.CohereError({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new ud.CohereError({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new ud.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets.");case"unknown":throw new ud.CohereError({message:p.error.errorMessage,rawResponse:p.rawResponse})}})}create(e,r,n,o){return Zo.HttpResponsePromise.fromPromise(this.__create(e,r,n,o))}__create(e,r,n,o){return C8(this,void 0,void 0,function*(){var i,a,s;let u={};u.name=n.name,u.type=nV.DatasetType.jsonOrThrow(n.type,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),n.keepOriginalFile!=null&&(u.keep_original_file=n.keepOriginalFile.toString()),n.skipMalformedInput!=null&&(u.skip_malformed_input=n.skipMalformedInput.toString()),n.keepFields!=null&&(Array.isArray(n.keepFields)?u.keep_fields=n.keepFields.map(f=>f):u.keep_fields=n.keepFields),n.optionalFields!=null&&(Array.isArray(n.optionalFields)?u.optional_fields=n.optionalFields.map(f=>f):u.optional_fields=n.optionalFields),n.textSeparator!=null&&(u.text_separator=n.textSeparator),n.csvDelimiter!=null&&(u.csv_delimiter=n.csvDelimiter);let l=yield Zo.newFormData();yield l.appendFile("data",e),r!=null&&(yield l.appendFile("eval_data",r));let c=yield l.getRequest(),d=yield((i=this._options.fetcher)!==null&&i!==void 0?i:Zo.fetcher)({url:(0,Koe.default)((s=(a=yield Zo.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield Zo.Supplier.get(this._options.environment))!==null&&s!==void 0?s:Joe.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign(Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Zo.Supplier.get(this._options.clientName))!=null?yield Zo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Zo.RUNTIME.type,"X-Fern-Runtime-Version":Zo.RUNTIME.version},c.headers),o?.headers),queryParameters:u,requestType:"file",duplex:c.duplex,body:c.body,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:3e5,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(d.ok)return{data:nV.DatasetsCreateResponse.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new qr.BadRequestError(d.error.body,d.rawResponse);case 401:throw new qr.UnauthorizedError(d.error.body,d.rawResponse);case 403:throw new qr.ForbiddenError(d.error.body,d.rawResponse);case 404:throw new qr.NotFoundError(d.error.body,d.rawResponse);case 422:throw new qr.UnprocessableEntityError(d.error.body,d.rawResponse);case 429:throw new qr.TooManyRequestsError(d.error.body,d.rawResponse);case 498:throw new qr.InvalidTokenError(d.error.body,d.rawResponse);case 499:throw new qr.ClientClosedRequestError(d.error.body,d.rawResponse);case 500:throw new qr.InternalServerError(d.error.body,d.rawResponse);case 501:throw new qr.NotImplementedError(d.error.body,d.rawResponse);case 503:throw new qr.ServiceUnavailableError(d.error.body,d.rawResponse);case 504:throw new qr.GatewayTimeoutError(d.error.body,d.rawResponse);default:throw new ud.CohereError({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new ud.CohereError({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ud.CohereTimeoutError("Timeout exceeded when calling POST /v1/datasets.");case"unknown":throw new ud.CohereError({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}getUsage(e){return Zo.HttpResponsePromise.fromPromise(this.__getUsage(e))}__getUsage(e){return C8(this,void 0,void 0,function*(){var r,n,o;let i=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Zo.fetcher)({url:(0,Koe.default)((o=(n=yield Zo.Supplier.get(this._options.baseUrl))!==null&&n!==void 0?n:yield Zo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Joe.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Zo.Supplier.get(this._options.clientName))!=null?yield Zo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Zo.RUNTIME.type,"X-Fern-Runtime-Version":Zo.RUNTIME.version},e?.headers),contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(i.ok)return{data:nV.DatasetsGetUsageResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new qr.BadRequestError(i.error.body,i.rawResponse);case 401:throw new qr.UnauthorizedError(i.error.body,i.rawResponse);case 403:throw new qr.ForbiddenError(i.error.body,i.rawResponse);case 404:throw new qr.NotFoundError(i.error.body,i.rawResponse);case 422:throw new qr.UnprocessableEntityError(i.error.body,i.rawResponse);case 429:throw new qr.TooManyRequestsError(i.error.body,i.rawResponse);case 498:throw new qr.InvalidTokenError(i.error.body,i.rawResponse);case 499:throw new qr.ClientClosedRequestError(i.error.body,i.rawResponse);case 500:throw new qr.InternalServerError(i.error.body,i.rawResponse);case 501:throw new qr.NotImplementedError(i.error.body,i.rawResponse);case 503:throw new qr.ServiceUnavailableError(i.error.body,i.rawResponse);case 504:throw new qr.GatewayTimeoutError(i.error.body,i.rawResponse);default:throw new ud.CohereError({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new ud.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new ud.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets/usage.");case"unknown":throw new ud.CohereError({message:i.error.errorMessage,rawResponse:i.rawResponse})}})}get(e,r){return Zo.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return C8(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Zo.fetcher)({url:(0,Koe.default)((i=(o=yield Zo.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Zo.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Joe.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Zo.Supplier.get(this._options.clientName))!=null?yield Zo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Zo.RUNTIME.type,"X-Fern-Runtime-Version":Zo.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:nV.DatasetsGetResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new qr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new qr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new qr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new qr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new qr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new qr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new qr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new qr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new qr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new qr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new qr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new qr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new ud.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new ud.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new ud.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets/{id}.");case"unknown":throw new ud.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}delete(e,r){return Zo.HttpResponsePromise.fromPromise(this.__delete(e,r))}__delete(e,r){return C8(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Zo.fetcher)({url:(0,Koe.default)((i=(o=yield Zo.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Zo.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Joe.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"DELETE",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Zo.Supplier.get(this._options.clientName))!=null?yield Zo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Zo.RUNTIME.type,"X-Fern-Runtime-Version":Zo.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:nV.datasets.delete.Response.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new qr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new qr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new qr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new qr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new qr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new qr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new qr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new qr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new qr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new qr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new qr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new qr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new ud.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new ud.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new ud.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/datasets/{id}.");case"unknown":throw new ud.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}_getAuthorizationHeader(){return C8(this,void 0,void 0,function*(){var e;let r=(e=yield Zo.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new ud.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};Z_.Datasets=Pet});var Hlr=S(Y_=>{"use strict";var doo=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]}),foo=Y_&&Y_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xoe=Y_&&Y_.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&doo(r,e,n[o]);return foo(r,e),r}}(),oV=Y_&&Y_.__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())})},poo=Y_&&Y_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Y_,"__esModule",{value:!0});Y_.Connectors=void 0;var x8=Xoe(rD()),qn=Xoe(se()),lr=Xoe(E1()),T8=poo(Ok()),Pk=Xoe(tD()),Ol=Xoe($c()),Met=class{constructor(e={}){this._options=e}list(e={},r){return qn.HttpResponsePromise.fromPromise(this.__list(e,r))}__list(){return oV(this,arguments,void 0,function*(e={},r){var n,o,i;let{limit:a,offset:s}=e,u={};a!=null&&(u.limit=a.toString()),s!=null&&(u.offset=s.toString());let l=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qn.fetcher)({url:(0,T8.default)((i=(o=yield qn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield qn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:x8.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qn.Supplier.get(this._options.clientName))!=null?yield qn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":qn.RUNTIME.type,"X-Fern-Runtime-Version":qn.RUNTIME.version},r?.headers),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{data:Pk.ListConnectorsResponse.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new lr.BadRequestError(l.error.body,l.rawResponse);case 401:throw new lr.UnauthorizedError(l.error.body,l.rawResponse);case 403:throw new lr.ForbiddenError(l.error.body,l.rawResponse);case 404:throw new lr.NotFoundError(l.error.body,l.rawResponse);case 422:throw new lr.UnprocessableEntityError(l.error.body,l.rawResponse);case 429:throw new lr.TooManyRequestsError(l.error.body,l.rawResponse);case 498:throw new lr.InvalidTokenError(l.error.body,l.rawResponse);case 499:throw new lr.ClientClosedRequestError(l.error.body,l.rawResponse);case 500:throw new lr.InternalServerError(l.error.body,l.rawResponse);case 501:throw new lr.NotImplementedError(l.error.body,l.rawResponse);case 503:throw new lr.ServiceUnavailableError(l.error.body,l.rawResponse);case 504:throw new lr.GatewayTimeoutError(l.error.body,l.rawResponse);default:throw new Ol.CohereError({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new Ol.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new Ol.CohereTimeoutError("Timeout exceeded when calling GET /v1/connectors.");case"unknown":throw new Ol.CohereError({message:l.error.errorMessage,rawResponse:l.rawResponse})}})}create(e,r){return qn.HttpResponsePromise.fromPromise(this.__create(e,r))}__create(e,r){return oV(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qn.fetcher)({url:(0,T8.default)((i=(o=yield qn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield qn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:x8.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qn.Supplier.get(this._options.clientName))!=null?yield qn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":qn.RUNTIME.type,"X-Fern-Runtime-Version":qn.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Pk.CreateConnectorRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:Pk.CreateConnectorResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new lr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new lr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new lr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new lr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new lr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new lr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new lr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new lr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new lr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new lr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new lr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new lr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Ol.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Ol.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Ol.CohereTimeoutError("Timeout exceeded when calling POST /v1/connectors.");case"unknown":throw new Ol.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}get(e,r){return qn.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return oV(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qn.fetcher)({url:(0,T8.default)((i=(o=yield qn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield qn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:x8.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qn.Supplier.get(this._options.clientName))!=null?yield qn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":qn.RUNTIME.type,"X-Fern-Runtime-Version":qn.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:Pk.GetConnectorResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new lr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new lr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new lr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new lr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new lr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new lr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new lr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new lr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new lr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new lr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new lr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new lr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Ol.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Ol.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Ol.CohereTimeoutError("Timeout exceeded when calling GET /v1/connectors/{id}.");case"unknown":throw new Ol.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}delete(e,r){return qn.HttpResponsePromise.fromPromise(this.__delete(e,r))}__delete(e,r){return oV(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qn.fetcher)({url:(0,T8.default)((i=(o=yield qn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield qn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:x8.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"DELETE",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qn.Supplier.get(this._options.clientName))!=null?yield qn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":qn.RUNTIME.type,"X-Fern-Runtime-Version":qn.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:Pk.DeleteConnectorResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new lr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new lr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new lr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new lr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new lr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new lr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new lr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new lr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new lr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new lr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new lr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new lr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Ol.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Ol.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Ol.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/connectors/{id}.");case"unknown":throw new Ol.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}update(e,r={},n){return qn.HttpResponsePromise.fromPromise(this.__update(e,r,n))}__update(e){return oV(this,arguments,void 0,function*(r,n={},o){var i,a,s;let u=yield((i=this._options.fetcher)!==null&&i!==void 0?i:qn.fetcher)({url:(0,T8.default)((s=(a=yield qn.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield qn.Supplier.get(this._options.environment))!==null&&s!==void 0?s:x8.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(r)}`),method:"PATCH",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qn.Supplier.get(this._options.clientName))!=null?yield qn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":qn.RUNTIME.type,"X-Fern-Runtime-Version":qn.RUNTIME.version},o?.headers),contentType:"application/json",requestType:"json",body:Pk.UpdateConnectorRequest.jsonOrThrow(n,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:3e5,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Pk.UpdateConnectorResponse.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new lr.BadRequestError(u.error.body,u.rawResponse);case 401:throw new lr.UnauthorizedError(u.error.body,u.rawResponse);case 403:throw new lr.ForbiddenError(u.error.body,u.rawResponse);case 404:throw new lr.NotFoundError(u.error.body,u.rawResponse);case 422:throw new lr.UnprocessableEntityError(u.error.body,u.rawResponse);case 429:throw new lr.TooManyRequestsError(u.error.body,u.rawResponse);case 498:throw new lr.InvalidTokenError(u.error.body,u.rawResponse);case 499:throw new lr.ClientClosedRequestError(u.error.body,u.rawResponse);case 500:throw new lr.InternalServerError(u.error.body,u.rawResponse);case 501:throw new lr.NotImplementedError(u.error.body,u.rawResponse);case 503:throw new lr.ServiceUnavailableError(u.error.body,u.rawResponse);case 504:throw new lr.GatewayTimeoutError(u.error.body,u.rawResponse);default:throw new Ol.CohereError({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new Ol.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new Ol.CohereTimeoutError("Timeout exceeded when calling PATCH /v1/connectors/{id}.");case"unknown":throw new Ol.CohereError({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}oAuthAuthorize(e,r={},n){return qn.HttpResponsePromise.fromPromise(this.__oAuthAuthorize(e,r,n))}__oAuthAuthorize(e){return oV(this,arguments,void 0,function*(r,n={},o){var i,a,s;let{afterTokenRedirect:u}=n,l={};u!=null&&(l.after_token_redirect=u);let c=yield((i=this._options.fetcher)!==null&&i!==void 0?i:qn.fetcher)({url:(0,T8.default)((s=(a=yield qn.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield qn.Supplier.get(this._options.environment))!==null&&s!==void 0?s:x8.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(r)}/oauth/authorize`),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qn.Supplier.get(this._options.clientName))!=null?yield qn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":qn.RUNTIME.type,"X-Fern-Runtime-Version":qn.RUNTIME.version},o?.headers),contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:3e5,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(c.ok)return{data:Pk.OAuthAuthorizeResponse.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new lr.BadRequestError(c.error.body,c.rawResponse);case 401:throw new lr.UnauthorizedError(c.error.body,c.rawResponse);case 403:throw new lr.ForbiddenError(c.error.body,c.rawResponse);case 404:throw new lr.NotFoundError(c.error.body,c.rawResponse);case 422:throw new lr.UnprocessableEntityError(c.error.body,c.rawResponse);case 429:throw new lr.TooManyRequestsError(c.error.body,c.rawResponse);case 498:throw new lr.InvalidTokenError(c.error.body,c.rawResponse);case 499:throw new lr.ClientClosedRequestError(c.error.body,c.rawResponse);case 500:throw new lr.InternalServerError(c.error.body,c.rawResponse);case 501:throw new lr.NotImplementedError(c.error.body,c.rawResponse);case 503:throw new lr.ServiceUnavailableError(c.error.body,c.rawResponse);case 504:throw new lr.GatewayTimeoutError(c.error.body,c.rawResponse);default:throw new Ol.CohereError({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new Ol.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new Ol.CohereTimeoutError("Timeout exceeded when calling POST /v1/connectors/{id}/oauth/authorize.");case"unknown":throw new Ol.CohereError({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}_getAuthorizationHeader(){return oV(this,void 0,void 0,function*(){var e;let r=(e=yield qn.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Ol.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};Y_.Connectors=Met});var Klr=S(Q_=>{"use strict";var moo=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]}),hoo=Q_&&Q_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zoe=Q_&&Q_.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&moo(r,e,n[o]);return hoo(r,e),r}}(),Ret=Q_&&Q_.__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())})},goo=Q_&&Q_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Q_,"__esModule",{value:!0});Q_.Models=void 0;var Wlr=Zoe(rD()),kg=Zoe(se()),Kl=Zoe(E1()),Jlr=goo(Ok()),Iet=Zoe(tD()),nD=Zoe($c()),Aet=class{constructor(e={}){this._options=e}get(e,r){return kg.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return Ret(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:kg.fetcher)({url:(0,Jlr.default)((i=(o=yield kg.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield kg.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Wlr.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield kg.Supplier.get(this._options.clientName))!=null?yield kg.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":kg.RUNTIME.type,"X-Fern-Runtime-Version":kg.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:Iet.GetModelResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Kl.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Kl.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Kl.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Kl.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Kl.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Kl.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Kl.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Kl.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Kl.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Kl.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Kl.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Kl.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new nD.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new nD.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new nD.CohereTimeoutError("Timeout exceeded when calling GET /v1/models/{model}.");case"unknown":throw new nD.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}list(e={},r){return kg.HttpResponsePromise.fromPromise(this.__list(e,r))}__list(){return Ret(this,arguments,void 0,function*(e={},r){var n,o,i;let{pageSize:a,pageToken:s,endpoint:u,defaultOnly:l}=e,c={};a!=null&&(c.page_size=a.toString()),s!=null&&(c.page_token=s),u!=null&&(c.endpoint=Iet.CompatibleEndpoint.jsonOrThrow(u,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),l!=null&&(c.default_only=l.toString());let d=yield((n=this._options.fetcher)!==null&&n!==void 0?n:kg.fetcher)({url:(0,Jlr.default)((i=(o=yield kg.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield kg.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Wlr.CohereEnvironment.Production,"v1/models"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield kg.Supplier.get(this._options.clientName))!=null?yield kg.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":kg.RUNTIME.type,"X-Fern-Runtime-Version":kg.RUNTIME.version},r?.headers),contentType:"application/json",queryParameters:c,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(d.ok)return{data:Iet.ListModelsResponse.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new Kl.BadRequestError(d.error.body,d.rawResponse);case 401:throw new Kl.UnauthorizedError(d.error.body,d.rawResponse);case 403:throw new Kl.ForbiddenError(d.error.body,d.rawResponse);case 404:throw new Kl.NotFoundError(d.error.body,d.rawResponse);case 422:throw new Kl.UnprocessableEntityError(d.error.body,d.rawResponse);case 429:throw new Kl.TooManyRequestsError(d.error.body,d.rawResponse);case 498:throw new Kl.InvalidTokenError(d.error.body,d.rawResponse);case 499:throw new Kl.ClientClosedRequestError(d.error.body,d.rawResponse);case 500:throw new Kl.InternalServerError(d.error.body,d.rawResponse);case 501:throw new Kl.NotImplementedError(d.error.body,d.rawResponse);case 503:throw new Kl.ServiceUnavailableError(d.error.body,d.rawResponse);case 504:throw new Kl.GatewayTimeoutError(d.error.body,d.rawResponse);default:throw new nD.CohereError({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new nD.CohereError({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new nD.CohereTimeoutError("Timeout exceeded when calling GET /v1/models.");case"unknown":throw new nD.CohereError({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}_getAuthorizationHeader(){return Ret(this,void 0,void 0,function*(){var e;let r=(e=yield kg.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new nD.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};Q_.Models=Aet});var Glr=S(ev=>{"use strict";var yoo=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]}),boo=ev&&ev.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yoe=ev&&ev.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yoo(r,e,n[o]);return boo(r,e),r}}(),Mk=ev&&ev.__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())})},_oo=ev&&ev.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ev,"__esModule",{value:!0});ev.Finetuning=void 0;var iV=Yoe(rD()),Xr=Yoe(se()),Yo=Yoe(E1()),aV=_oo(Ok()),oD=Yoe(tD()),cu=Yoe($c()),Net=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){return Xr.HttpResponsePromise.fromPromise(this.__listFinetunedModels(e,r))}__listFinetunedModels(){return Mk(this,arguments,void 0,function*(e={},r){var n,o,i;let{pageSize:a,pageToken:s,orderBy:u}=e,l={};a!=null&&(l.page_size=a.toString()),s!=null&&(l.page_token=s),u!=null&&(l.order_by=u);let c=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xr.fetcher)({url:(0,aV.default)((i=(o=yield Xr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Xr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:iV.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.RUNTIME.version},r?.headers),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{data:oD.finetuning.ListFinetunedModelsResponse.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new Yo.BadRequestError(c.error.body,c.rawResponse);case 401:throw new Yo.UnauthorizedError(c.error.body,c.rawResponse);case 403:throw new Yo.ForbiddenError(c.error.body,c.rawResponse);case 404:throw new Yo.NotFoundError(c.error.body,c.rawResponse);case 500:throw new Yo.InternalServerError(c.error.body,c.rawResponse);case 503:throw new Yo.ServiceUnavailableError(c.error.body,c.rawResponse);default:throw new cu.CohereError({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new cu.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new cu.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models.");case"unknown":throw new cu.CohereError({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}createFinetunedModel(e,r){return Xr.HttpResponsePromise.fromPromise(this.__createFinetunedModel(e,r))}__createFinetunedModel(e,r){return Mk(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xr.fetcher)({url:(0,aV.default)((i=(o=yield Xr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Xr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:iV.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:oD.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(a.ok)return{data:oD.finetuning.CreateFinetunedModelResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Yo.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Yo.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Yo.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Yo.NotFoundError(a.error.body,a.rawResponse);case 500:throw new Yo.InternalServerError(a.error.body,a.rawResponse);case 503:throw new Yo.ServiceUnavailableError(a.error.body,a.rawResponse);default:throw new cu.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new cu.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new cu.CohereTimeoutError("Timeout exceeded when calling POST /v1/finetuning/finetuned-models.");case"unknown":throw new cu.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}getFinetunedModel(e,r){return Xr.HttpResponsePromise.fromPromise(this.__getFinetunedModel(e,r))}__getFinetunedModel(e,r){return Mk(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xr.fetcher)({url:(0,aV.default)((i=(o=yield Xr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Xr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:iV.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:oD.finetuning.GetFinetunedModelResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Yo.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Yo.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Yo.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Yo.NotFoundError(a.error.body,a.rawResponse);case 500:throw new Yo.InternalServerError(a.error.body,a.rawResponse);case 503:throw new Yo.ServiceUnavailableError(a.error.body,a.rawResponse);default:throw new cu.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new cu.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new cu.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{id}.");case"unknown":throw new cu.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}deleteFinetunedModel(e,r){return Xr.HttpResponsePromise.fromPromise(this.__deleteFinetunedModel(e,r))}__deleteFinetunedModel(e,r){return Mk(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xr.fetcher)({url:(0,aV.default)((i=(o=yield Xr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Xr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:iV.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"DELETE",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:oD.finetuning.DeleteFinetunedModelResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Yo.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Yo.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Yo.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Yo.NotFoundError(a.error.body,a.rawResponse);case 500:throw new Yo.InternalServerError(a.error.body,a.rawResponse);case 503:throw new Yo.ServiceUnavailableError(a.error.body,a.rawResponse);default:throw new cu.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new cu.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new cu.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/finetuning/finetuned-models/{id}.");case"unknown":throw new cu.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}updateFinetunedModel(e,r,n){return Xr.HttpResponsePromise.fromPromise(this.__updateFinetunedModel(e,r,n))}__updateFinetunedModel(e,r,n){return Mk(this,void 0,void 0,function*(){var o,i,a;let s=yield((o=this._options.fetcher)!==null&&o!==void 0?o:Xr.fetcher)({url:(0,aV.default)((a=(i=yield Xr.Supplier.get(this._options.baseUrl))!==null&&i!==void 0?i:yield Xr.Supplier.get(this._options.environment))!==null&&a!==void 0?a:iV.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"PATCH",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.RUNTIME.version},n?.headers),contentType:"application/json",requestType:"json",body:oD.FinetuningUpdateFinetunedModelRequest.jsonOrThrow(r,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(s.ok)return{data:oD.finetuning.UpdateFinetunedModelResponse.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new Yo.BadRequestError(s.error.body,s.rawResponse);case 401:throw new Yo.UnauthorizedError(s.error.body,s.rawResponse);case 403:throw new Yo.ForbiddenError(s.error.body,s.rawResponse);case 404:throw new Yo.NotFoundError(s.error.body,s.rawResponse);case 500:throw new Yo.InternalServerError(s.error.body,s.rawResponse);case 503:throw new Yo.ServiceUnavailableError(s.error.body,s.rawResponse);default:throw new cu.CohereError({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new cu.CohereError({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new cu.CohereTimeoutError("Timeout exceeded when calling PATCH /v1/finetuning/finetuned-models/{id}.");case"unknown":throw new cu.CohereError({message:s.error.errorMessage,rawResponse:s.rawResponse})}})}listEvents(e,r={},n){return Xr.HttpResponsePromise.fromPromise(this.__listEvents(e,r,n))}__listEvents(e){return Mk(this,arguments,void 0,function*(r,n={},o){var i,a,s;let{pageSize:u,pageToken:l,orderBy:c}=n,d={};u!=null&&(d.page_size=u.toString()),l!=null&&(d.page_token=l),c!=null&&(d.order_by=c);let f=yield((i=this._options.fetcher)!==null&&i!==void 0?i:Xr.fetcher)({url:(0,aV.default)((s=(a=yield Xr.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield Xr.Supplier.get(this._options.environment))!==null&&s!==void 0?s:iV.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(r)}/events`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.RUNTIME.version},o?.headers),contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:3e5,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(f.ok)return{data:oD.finetuning.ListEventsResponse.parseOrThrow(f.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new Yo.BadRequestError(f.error.body,f.rawResponse);case 401:throw new Yo.UnauthorizedError(f.error.body,f.rawResponse);case 403:throw new Yo.ForbiddenError(f.error.body,f.rawResponse);case 404:throw new Yo.NotFoundError(f.error.body,f.rawResponse);case 500:throw new Yo.InternalServerError(f.error.body,f.rawResponse);case 503:throw new Yo.ServiceUnavailableError(f.error.body,f.rawResponse);default:throw new cu.CohereError({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new cu.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new cu.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{finetuned_model_id}/events.");case"unknown":throw new cu.CohereError({message:f.error.errorMessage,rawResponse:f.rawResponse})}})}listTrainingStepMetrics(e,r={},n){return Xr.HttpResponsePromise.fromPromise(this.__listTrainingStepMetrics(e,r,n))}__listTrainingStepMetrics(e){return Mk(this,arguments,void 0,function*(r,n={},o){var i,a,s;let{pageSize:u,pageToken:l}=n,c={};u!=null&&(c.page_size=u.toString()),l!=null&&(c.page_token=l);let d=yield((i=this._options.fetcher)!==null&&i!==void 0?i:Xr.fetcher)({url:(0,aV.default)((s=(a=yield Xr.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield Xr.Supplier.get(this._options.environment))!==null&&s!==void 0?s:iV.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(r)}/training-step-metrics`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xr.Supplier.get(this._options.clientName))!=null?yield Xr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Xr.RUNTIME.type,"X-Fern-Runtime-Version":Xr.RUNTIME.version},o?.headers),contentType:"application/json",queryParameters:c,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:3e5,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(d.ok)return{data:oD.finetuning.ListTrainingStepMetricsResponse.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new Yo.BadRequestError(d.error.body,d.rawResponse);case 401:throw new Yo.UnauthorizedError(d.error.body,d.rawResponse);case 403:throw new Yo.ForbiddenError(d.error.body,d.rawResponse);case 404:throw new Yo.NotFoundError(d.error.body,d.rawResponse);case 500:throw new Yo.InternalServerError(d.error.body,d.rawResponse);case 503:throw new Yo.ServiceUnavailableError(d.error.body,d.rawResponse);default:throw new cu.CohereError({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new cu.CohereError({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new cu.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{finetuned_model_id}/training-step-metrics.");case"unknown":throw new cu.CohereError({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}_getAuthorizationHeader(){return Mk(this,void 0,void 0,function*(){var e;let r=(e=yield Xr.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new cu.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};ev.Finetuning=Net});var ixe=S(zy=>{"use strict";var voo=zy&&zy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),woo=zy&&zy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qoe=zy&&zy.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&voo(r,e,n[o]);return woo(r,e),r}}(),tv=zy&&zy.__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())})},Xlr=zy&&zy.__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},Soo=zy&&zy.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zy,"__esModule",{value:!0});zy.CohereClient=void 0;var mx=Qoe(rD()),mt=Qoe(se()),je=Qoe(E1()),ld=Qoe(tD()),hx=Soo(Ok()),$o=Qoe($c()),Coo=Oet(),xoo=zlr(),Too=Vlr(),Ooo=Hlr(),Eoo=Klr(),Poo=Glr(),Det=class{constructor(e={}){this._options=e}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new Coo.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new xoo.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new Too.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new Ooo.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new Eoo.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new Poo.Finetuning(this._options)}chatStream(e,r){return mt.HttpResponsePromise.fromPromise(this.__chatStream(e,r))}__chatStream(e,r){return tv(this,void 0,void 0,function*(){var n,o,i;let{accepts:a}=e,s=Xlr(e,["accepts"]),u=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mt.fetcher)({url:(0,hx.default)((i=(o=yield mt.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield mt.Supplier.get(this._options.environment))!==null&&i!==void 0?i:mx.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mt.Supplier.get(this._options.clientName))!=null?yield mt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":mt.RUNTIME.type,"X-Fern-Runtime-Version":mt.RUNTIME.version,Accepts:a??void 0},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},ld.ChatStreamRequest.jsonOrThrow(s,{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(u.ok)return{data:new mt.Stream({stream:u.body,parse:l=>tv(this,void 0,void 0,function*(){return ld.StreamedChatResponse.parseOrThrow(l,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]})}),signal:r?.abortSignal,eventShape:{type:"json",messageTerminator:`
`}}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new je.BadRequestError(u.error.body,u.rawResponse);case 401:throw new je.UnauthorizedError(u.error.body,u.rawResponse);case 403:throw new je.ForbiddenError(u.error.body,u.rawResponse);case 404:throw new je.NotFoundError(u.error.body,u.rawResponse);case 422:throw new je.UnprocessableEntityError(u.error.body,u.rawResponse);case 429:throw new je.TooManyRequestsError(u.error.body,u.rawResponse);case 498:throw new je.InvalidTokenError(u.error.body,u.rawResponse);case 499:throw new je.ClientClosedRequestError(u.error.body,u.rawResponse);case 500:throw new je.InternalServerError(u.error.body,u.rawResponse);case 501:throw new je.NotImplementedError(u.error.body,u.rawResponse);case 503:throw new je.ServiceUnavailableError(u.error.body,u.rawResponse);case 504:throw new je.GatewayTimeoutError(u.error.body,u.rawResponse);default:throw new $o.CohereError({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new $o.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new $o.CohereTimeoutError("Timeout exceeded when calling POST /v1/chat.");case"unknown":throw new $o.CohereError({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}chat(e,r){return mt.HttpResponsePromise.fromPromise(this.__chat(e,r))}__chat(e,r){return tv(this,void 0,void 0,function*(){var n,o,i;let{accepts:a}=e,s=Xlr(e,["accepts"]),u=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mt.fetcher)({url:(0,hx.default)((i=(o=yield mt.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield mt.Supplier.get(this._options.environment))!==null&&i!==void 0?i:mx.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mt.Supplier.get(this._options.clientName))!=null?yield mt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":mt.RUNTIME.type,"X-Fern-Runtime-Version":mt.RUNTIME.version,Accepts:a??void 0},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},ld.ChatRequest.jsonOrThrow(s,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!1}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(u.ok)return{data:ld.NonStreamedChatResponse.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new je.BadRequestError(u.error.body,u.rawResponse);case 401:throw new je.UnauthorizedError(u.error.body,u.rawResponse);case 403:throw new je.ForbiddenError(u.error.body,u.rawResponse);case 404:throw new je.NotFoundError(u.error.body,u.rawResponse);case 422:throw new je.UnprocessableEntityError(u.error.body,u.rawResponse);case 429:throw new je.TooManyRequestsError(u.error.body,u.rawResponse);case 498:throw new je.InvalidTokenError(u.error.body,u.rawResponse);case 499:throw new je.ClientClosedRequestError(u.error.body,u.rawResponse);case 500:throw new je.InternalServerError(u.error.body,u.rawResponse);case 501:throw new je.NotImplementedError(u.error.body,u.rawResponse);case 503:throw new je.ServiceUnavailableError(u.error.body,u.rawResponse);case 504:throw new je.GatewayTimeoutError(u.error.body,u.rawResponse);default:throw new $o.CohereError({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new $o.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new $o.CohereTimeoutError("Timeout exceeded when calling POST /v1/chat.");case"unknown":throw new $o.CohereError({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}generateStream(e,r){return mt.HttpResponsePromise.fromPromise(this.__generateStream(e,r))}__generateStream(e,r){return tv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mt.fetcher)({url:(0,hx.default)((i=(o=yield mt.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield mt.Supplier.get(this._options.environment))!==null&&i!==void 0?i:mx.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mt.Supplier.get(this._options.clientName))!=null?yield mt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":mt.RUNTIME.type,"X-Fern-Runtime-Version":mt.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},ld.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(a.ok)return{data:new mt.Stream({stream:a.body,parse:s=>tv(this,void 0,void 0,function*(){return ld.GenerateStreamedResponse.parseOrThrow(s,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]})}),signal:r?.abortSignal,eventShape:{type:"json",messageTerminator:`
`}}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new je.BadRequestError(a.error.body,a.rawResponse);case 401:throw new je.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new je.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new je.NotFoundError(a.error.body,a.rawResponse);case 422:throw new je.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new je.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new je.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new je.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new je.InternalServerError(a.error.body,a.rawResponse);case 501:throw new je.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new je.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new je.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new $o.CohereTimeoutError("Timeout exceeded when calling POST /v1/generate.");case"unknown":throw new $o.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}generate(e,r){return mt.HttpResponsePromise.fromPromise(this.__generate(e,r))}__generate(e,r){return tv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mt.fetcher)({url:(0,hx.default)((i=(o=yield mt.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield mt.Supplier.get(this._options.environment))!==null&&i!==void 0?i:mx.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mt.Supplier.get(this._options.clientName))!=null?yield mt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":mt.RUNTIME.type,"X-Fern-Runtime-Version":mt.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},ld.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(a.ok)return{data:ld.Generation.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new je.BadRequestError(a.error.body,a.rawResponse);case 401:throw new je.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new je.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new je.NotFoundError(a.error.body,a.rawResponse);case 422:throw new je.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new je.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new je.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new je.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new je.InternalServerError(a.error.body,a.rawResponse);case 501:throw new je.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new je.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new je.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new $o.CohereTimeoutError("Timeout exceeded when calling POST /v1/generate.");case"unknown":throw new $o.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}embed(e={},r){return mt.HttpResponsePromise.fromPromise(this.__embed(e,r))}__embed(){return tv(this,arguments,void 0,function*(e={},r){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mt.fetcher)({url:(0,hx.default)((i=(o=yield mt.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield mt.Supplier.get(this._options.environment))!==null&&i!==void 0?i:mx.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mt.Supplier.get(this._options.clientName))!=null?yield mt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":mt.RUNTIME.type,"X-Fern-Runtime-Version":mt.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:ld.EmbedRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:ld.EmbedResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new je.BadRequestError(a.error.body,a.rawResponse);case 401:throw new je.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new je.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new je.NotFoundError(a.error.body,a.rawResponse);case 422:throw new je.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new je.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new je.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new je.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new je.InternalServerError(a.error.body,a.rawResponse);case 501:throw new je.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new je.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new je.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new $o.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed.");case"unknown":throw new $o.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}rerank(e,r){return mt.HttpResponsePromise.fromPromise(this.__rerank(e,r))}__rerank(e,r){return tv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mt.fetcher)({url:(0,hx.default)((i=(o=yield mt.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield mt.Supplier.get(this._options.environment))!==null&&i!==void 0?i:mx.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mt.Supplier.get(this._options.clientName))!=null?yield mt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":mt.RUNTIME.type,"X-Fern-Runtime-Version":mt.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:ld.RerankRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:ld.RerankResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new je.BadRequestError(a.error.body,a.rawResponse);case 401:throw new je.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new je.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new je.NotFoundError(a.error.body,a.rawResponse);case 422:throw new je.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new je.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new je.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new je.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new je.InternalServerError(a.error.body,a.rawResponse);case 501:throw new je.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new je.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new je.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new $o.CohereTimeoutError("Timeout exceeded when calling POST /v1/rerank.");case"unknown":throw new $o.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}classify(e,r){return mt.HttpResponsePromise.fromPromise(this.__classify(e,r))}__classify(e,r){return tv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mt.fetcher)({url:(0,hx.default)((i=(o=yield mt.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield mt.Supplier.get(this._options.environment))!==null&&i!==void 0?i:mx.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mt.Supplier.get(this._options.clientName))!=null?yield mt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":mt.RUNTIME.type,"X-Fern-Runtime-Version":mt.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:ld.ClassifyRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:ld.ClassifyResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new je.BadRequestError(a.error.body,a.rawResponse);case 401:throw new je.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new je.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new je.NotFoundError(a.error.body,a.rawResponse);case 422:throw new je.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new je.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new je.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new je.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new je.InternalServerError(a.error.body,a.rawResponse);case 501:throw new je.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new je.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new je.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new $o.CohereTimeoutError("Timeout exceeded when calling POST /v1/classify.");case"unknown":throw new $o.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}summarize(e,r){return mt.HttpResponsePromise.fromPromise(this.__summarize(e,r))}__summarize(e,r){return tv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mt.fetcher)({url:(0,hx.default)((i=(o=yield mt.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield mt.Supplier.get(this._options.environment))!==null&&i!==void 0?i:mx.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mt.Supplier.get(this._options.clientName))!=null?yield mt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":mt.RUNTIME.type,"X-Fern-Runtime-Version":mt.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:ld.SummarizeRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:ld.SummarizeResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new je.BadRequestError(a.error.body,a.rawResponse);case 401:throw new je.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new je.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new je.NotFoundError(a.error.body,a.rawResponse);case 422:throw new je.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new je.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new je.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new je.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new je.InternalServerError(a.error.body,a.rawResponse);case 501:throw new je.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new je.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new je.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new $o.CohereTimeoutError("Timeout exceeded when calling POST /v1/summarize.");case"unknown":throw new $o.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}tokenize(e,r){return mt.HttpResponsePromise.fromPromise(this.__tokenize(e,r))}__tokenize(e,r){return tv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mt.fetcher)({url:(0,hx.default)((i=(o=yield mt.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield mt.Supplier.get(this._options.environment))!==null&&i!==void 0?i:mx.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mt.Supplier.get(this._options.clientName))!=null?yield mt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":mt.RUNTIME.type,"X-Fern-Runtime-Version":mt.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:ld.TokenizeRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:ld.TokenizeResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new je.BadRequestError(a.error.body,a.rawResponse);case 401:throw new je.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new je.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new je.NotFoundError(a.error.body,a.rawResponse);case 422:throw new je.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new je.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new je.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new je.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new je.InternalServerError(a.error.body,a.rawResponse);case 501:throw new je.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new je.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new je.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new $o.CohereTimeoutError("Timeout exceeded when calling POST /v1/tokenize.");case"unknown":throw new $o.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}detokenize(e,r){return mt.HttpResponsePromise.fromPromise(this.__detokenize(e,r))}__detokenize(e,r){return tv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:mt.fetcher)({url:(0,hx.default)((i=(o=yield mt.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield mt.Supplier.get(this._options.environment))!==null&&i!==void 0?i:mx.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mt.Supplier.get(this._options.clientName))!=null?yield mt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":mt.RUNTIME.type,"X-Fern-Runtime-Version":mt.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:ld.DetokenizeRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:ld.DetokenizeResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new je.BadRequestError(a.error.body,a.rawResponse);case 401:throw new je.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new je.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new je.NotFoundError(a.error.body,a.rawResponse);case 422:throw new je.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new je.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new je.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new je.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new je.InternalServerError(a.error.body,a.rawResponse);case 501:throw new je.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new je.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new je.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new $o.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new $o.CohereTimeoutError("Timeout exceeded when calling POST /v1/detokenize.");case"unknown":throw new $o.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}checkApiKey(e){return mt.HttpResponsePromise.fromPromise(this.__checkApiKey(e))}__checkApiKey(e){return tv(this,void 0,void 0,function*(){var r,n,o;let i=yield((r=this._options.fetcher)!==null&&r!==void 0?r:mt.fetcher)({url:(0,hx.default)((o=(n=yield mt.Supplier.get(this._options.baseUrl))!==null&&n!==void 0?n:yield mt.Supplier.get(this._options.environment))!==null&&o!==void 0?o:mx.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield mt.Supplier.get(this._options.clientName))!=null?yield mt.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":mt.RUNTIME.type,"X-Fern-Runtime-Version":mt.RUNTIME.version},e?.headers),contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(i.ok)return{data:ld.CheckApiKeyResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new je.BadRequestError(i.error.body,i.rawResponse);case 401:throw new je.UnauthorizedError(i.error.body,i.rawResponse);case 403:throw new je.ForbiddenError(i.error.body,i.rawResponse);case 404:throw new je.NotFoundError(i.error.body,i.rawResponse);case 422:throw new je.UnprocessableEntityError(i.error.body,i.rawResponse);case 429:throw new je.TooManyRequestsError(i.error.body,i.rawResponse);case 498:throw new je.InvalidTokenError(i.error.body,i.rawResponse);case 499:throw new je.ClientClosedRequestError(i.error.body,i.rawResponse);case 500:throw new je.InternalServerError(i.error.body,i.rawResponse);case 501:throw new je.NotImplementedError(i.error.body,i.rawResponse);case 503:throw new je.ServiceUnavailableError(i.error.body,i.rawResponse);case 504:throw new je.GatewayTimeoutError(i.error.body,i.rawResponse);default:throw new $o.CohereError({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new $o.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new $o.CohereTimeoutError("Timeout exceeded when calling POST /v1/check-api-key.");case"unknown":throw new $o.CohereError({message:i.error.errorMessage,rawResponse:i.rawResponse})}})}_getAuthorizationHeader(){return tv(this,void 0,void 0,function*(){var e;let r=(e=yield mt.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new $o.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};zy.CohereClient=Det});var $et=S(axe=>{"use strict";Object.defineProperty(axe,"__esModule",{value:!0});axe.CohereClientV2=void 0;var Moo=Oet(),Roo=ixe(),jet=class{constructor(e){this._options=e,this.client=new Roo.CohereClient(this._options),this.clientV2=new Moo.V2(this._options),this.chat=this.clientV2.chat.bind(this.clientV2),this.chatStream=this.clientV2.chatStream.bind(this.clientV2),this.embed=this.clientV2.embed.bind(this.clientV2),this.rerank=this.clientV2.rerank.bind(this.clientV2),this.generateStream=this.client.generateStream.bind(this.clientV2),this.generate=this.client.generate.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}};axe.CohereClientV2=jet});var ket=S(O8=>{"use strict";Object.defineProperty(O8,"__esModule",{value:!0});O8.AwsClientV2=O8.AwsClient=void 0;var Ioo=ixe(),Aoo=$et(),Let=class extends Ioo.CohereClient{constructor(e){e.token="n/a",super(e)}};O8.AwsClient=Let;var Fet=class extends Aoo.CohereClientV2{constructor(e){e.token="n/a",super(e)}};O8.AwsClientV2=Fet});var Qlr=S(E8=>{"use strict";Object.defineProperty(E8,"__esModule",{value:!0});E8.BedrockClientV2=E8.BedrockClient=void 0;var Zlr=xet(),Ylr=ket(),qet=class extends Ylr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,Zlr.fetchOverride)("bedrock",e)}))}};E8.BedrockClient=qet;var Bet=class extends Ylr.AwsClientV2{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,Zlr.fetchOverride)("bedrock",e)}))}};E8.BedrockClientV2=Bet});var ecr=S(sxe=>{"use strict";Object.defineProperty(sxe,"__esModule",{value:!0});sxe.CustomClient=void 0;var Noo=ixe(),Uet=class extends Noo.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}};sxe.CustomClient=Uet});var ncr=S(P8=>{"use strict";Object.defineProperty(P8,"__esModule",{value:!0});P8.SagemakerClientV2=P8.SagemakerClient=void 0;var tcr=ket(),rcr=xet(),zet=class extends tcr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,rcr.fetchOverride)("sagemaker",e)}))}};P8.SagemakerClient=zet;var Vet=class extends tcr.AwsClientV2{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,rcr.fetchOverride)("sagemaker",e)}))}};P8.SagemakerClientV2=Vet});var scr=S(vu=>{"use strict";var Doo=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]}),joo=vu&&vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$oo=vu&&vu.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Doo(r,e,n[o]);return joo(r,e),r}}();Object.defineProperty(vu,"__esModule",{value:!0});vu.SagemakerClientV2=vu.SagemakerClient=vu.CohereTimeoutError=vu.CohereError=vu.CohereEnvironment=vu.CohereClient=vu.CohereClientV2=vu.BedrockClientV2=vu.BedrockClient=vu.Cohere=void 0;vu.Cohere=$oo(E1());var ocr=Qlr();Object.defineProperty(vu,"BedrockClient",{enumerable:!0,get:function(){return ocr.BedrockClient}});Object.defineProperty(vu,"BedrockClientV2",{enumerable:!0,get:function(){return ocr.BedrockClientV2}});var Loo=$et();Object.defineProperty(vu,"CohereClientV2",{enumerable:!0,get:function(){return Loo.CohereClientV2}});var Foo=ecr();Object.defineProperty(vu,"CohereClient",{enumerable:!0,get:function(){return Foo.CustomClient}});var koo=rD();Object.defineProperty(vu,"CohereEnvironment",{enumerable:!0,get:function(){return koo.CohereEnvironment}});var icr=$c();Object.defineProperty(vu,"CohereError",{enumerable:!0,get:function(){return icr.CohereError}});Object.defineProperty(vu,"CohereTimeoutError",{enumerable:!0,get:function(){return icr.CohereTimeoutError}});var acr=ncr();Object.defineProperty(vu,"SagemakerClient",{enumerable:!0,get:function(){return acr.SagemakerClient}});Object.defineProperty(vu,"SagemakerClientV2",{enumerable:!0,get:function(){return acr.SagemakerClientV2}})});function M8(t){if(t?.client)return t.client;let e=t?.apiKey??un("COHERE_API_KEY");if(!e)throw new Error("COHERE_API_KEY must be set");return new ucr.CohereClient({token:e})}var ucr,eie=v(()=>{ucr=$(scr(),1);su()});function yx(t,e){e?($h[0]=$h[16]=$h[1]=$h[2]=$h[3]=$h[4]=$h[5]=$h[6]=$h[7]=$h[8]=$h[9]=$h[10]=$h[11]=$h[12]=$h[13]=$h[14]=$h[15]=0,this.blocks=$h):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}var Ir,qoo,gx,uxe,$h,Het,Wet=v(()=>{Ir="0123456789abcdef".split(""),qoo=[-2147483648,8388608,32768,128],gx=[24,16,8,0],uxe=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],$h=[];yx.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if(r!=="string"){if(r==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);e=!0}for(var n,o=0,i,a=t.length,s=this.blocks;o<a;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,this.block=s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),e)for(i=this.start;o<a&&i<64;++o)s[i>>>2]|=t[o]<<gx[i++&3];else for(i=this.start;o<a&&i<64;++o)n=t.charCodeAt(o),n<128?s[i>>>2]|=n<<gx[i++&3]:n<2048?(s[i>>>2]|=(192|n>>>6)<<gx[i++&3],s[i>>>2]|=(128|n&63)<<gx[i++&3]):n<55296||n>=57344?(s[i>>>2]|=(224|n>>>12)<<gx[i++&3],s[i>>>2]|=(128|n>>>6&63)<<gx[i++&3],s[i>>>2]|=(128|n&63)<<gx[i++&3]):(n=65536+((n&1023)<<10|t.charCodeAt(++o)&1023),s[i>>>2]|=(240|n>>>18)<<gx[i++&3],s[i>>>2]|=(128|n>>>12&63)<<gx[i++&3],s[i>>>2]|=(128|n>>>6&63)<<gx[i++&3],s[i>>>2]|=(128|n&63)<<gx[i++&3]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=s[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};yx.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=qoo[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()}};yx.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=this.blocks,l,c,d,f,p,m,h,y,g,b,_;for(l=16;l<64;++l)p=u[l-15],c=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=u[l-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,u[l]=u[l-16]+c+u[l-7]+d<<0;for(_=e&r,l=0;l<64;l+=4)this.first?(this.is224?(y=300032,p=u[0]-1413257819,s=p-150054599<<0,n=p+24177077<<0):(y=704751109,p=u[0]-210244248,s=p-1521486534<<0,n=p+143694565<<0),this.first=!1):(c=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),y=t&e,f=y^t&r^_,h=o&i^~o&a,p=s+d+h+uxe[l]+u[l],m=c+f,s=n+p<<0,n=p+m<<0),c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),g=n&t,f=g^n&e^y,h=a&s^~a&o,p=i+d+h+uxe[l+1]+u[l+1],m=c+f,a=r+p<<0,r=p+m<<0,c=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),b=r&n,f=b^r&t^g,h=i&a^~i&s,p=o+d+h+uxe[l+2]+u[l+2],m=c+f,i=e+p<<0,e=p+m<<0,c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),_=e&r,f=_^e&n^b,h=i&a^~i&s,p=o+d+h+uxe[l+3]+u[l+3],m=c+f,o=t+p<<0,t=p+m<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0,this.h5=this.h5+i<<0,this.h6=this.h6+a<<0,this.h7=this.h7+s<<0};yx.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=Ir[t>>>28&15]+Ir[t>>>24&15]+Ir[t>>>20&15]+Ir[t>>>16&15]+Ir[t>>>12&15]+Ir[t>>>8&15]+Ir[t>>>4&15]+Ir[t&15]+Ir[e>>>28&15]+Ir[e>>>24&15]+Ir[e>>>20&15]+Ir[e>>>16&15]+Ir[e>>>12&15]+Ir[e>>>8&15]+Ir[e>>>4&15]+Ir[e&15]+Ir[r>>>28&15]+Ir[r>>>24&15]+Ir[r>>>20&15]+Ir[r>>>16&15]+Ir[r>>>12&15]+Ir[r>>>8&15]+Ir[r>>>4&15]+Ir[r&15]+Ir[n>>>28&15]+Ir[n>>>24&15]+Ir[n>>>20&15]+Ir[n>>>16&15]+Ir[n>>>12&15]+Ir[n>>>8&15]+Ir[n>>>4&15]+Ir[n&15]+Ir[o>>>28&15]+Ir[o>>>24&15]+Ir[o>>>20&15]+Ir[o>>>16&15]+Ir[o>>>12&15]+Ir[o>>>8&15]+Ir[o>>>4&15]+Ir[o&15]+Ir[i>>>28&15]+Ir[i>>>24&15]+Ir[i>>>20&15]+Ir[i>>>16&15]+Ir[i>>>12&15]+Ir[i>>>8&15]+Ir[i>>>4&15]+Ir[i&15]+Ir[a>>>28&15]+Ir[a>>>24&15]+Ir[a>>>20&15]+Ir[a>>>16&15]+Ir[a>>>12&15]+Ir[a>>>8&15]+Ir[a>>>4&15]+Ir[a&15];return this.is224||(u+=Ir[s>>>28&15]+Ir[s>>>24&15]+Ir[s>>>20&15]+Ir[s>>>16&15]+Ir[s>>>12&15]+Ir[s>>>8&15]+Ir[s>>>4&15]+Ir[s&15]),u};yx.prototype.toString=yx.prototype.hex;yx.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=[t>>>24&255,t>>>16&255,t>>>8&255,t&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255];return this.is224||u.push(s>>>24&255,s>>>16&255,s>>>8&255,s&255),u};yx.prototype.array=yx.prototype.digest;yx.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};Het=(...t)=>new yx(!1,!0).update(t.join("")).hex()});var lcr=v(()=>{zo();Wet()});var Boo,Uoo,zoo,ccr,fcr=v(()=>{zo();Wet();lcr();TC();Boo=(...t)=>Het(t.join("_")),Uoo=class{constructor(){x(this,"keyEncoder",Boo)}makeDefaultKeyEncoder(t){this.keyEncoder=t}},zoo=new Map,ccr=class dcr extends Uoo{constructor(r){super();x(this,"cache");this.cache=r??new Map}lookup(r,n){return Promise.resolve(this.cache.get(this.keyEncoder(r,n))??null)}async update(r,n,o){this.cache.set(this.keyEncoder(r,n),o)}static global(){return new dcr(zoo)}}});function Joo(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 Koo(t,e){return t.length===1?[e.get(t.join(","))]:Joo(t,e).map(r=>e.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function Goo(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function Ket(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 pcr,Voo,Hoo,Woo,Jet,lxe,mcr=v(()=>{pcr=$(a3e(),1),Voo=Object.defineProperty,Hoo=(t,e,r)=>e in t?Voo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Woo=(t,e,r)=>(Hoo(t,typeof e!="symbol"?e+"":e,r),r);Jet=class{constructor(t,e){x(this,"specialTokens");x(this,"inverseSpecialTokens");x(this,"patStr");x(this,"textEncoder",new TextEncoder);x(this,"textDecoder",new TextDecoder("utf-8"));x(this,"rankMap",new Map);x(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=pcr.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=Jet.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=Jet.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(...Koo(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)}},lxe=Jet;Woo(lxe,"specialTokenRegex",t=>new RegExp(t.map(e=>Goo(e)).join("|"),"g"))});var hcr=v(()=>{mcr()});async function gcr(t){return t in cxe||(cxe[t]=Xoo.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new lxe(e)).catch(e=>{throw delete cxe[t],e})),await cxe[t]}async function ycr(t){return gcr(Ket(t))}var cxe,Xoo,Get=v(()=>{zo();Iz();hcr();cxe={},Xoo=new IC({})});function i0(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 Zoo,Yoo,tie,sV,rv=v(()=>{zo();TC();fcr();Iz();_g();Hee();Get();Zoo=t=>t.startsWith("gpt-5")?"gpt-5":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;Yoo=()=>!1,tie=class extends Ti{constructor(e){super(e);x(this,"verbose");x(this,"callbacks");x(this,"tags");x(this,"metadata");this.verbose=e.verbose??Yoo(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{},this._addVersion("@langchain/core","1.1.29")}get lc_attributes(){return{callbacks:void 0,verbose:void 0}}_addVersion(e,r){let n=this.metadata?.versions;this.metadata={...this.metadata,versions:{...typeof n=="object"&&n!==null?n:{},[e]:r}}}},sV=class extends tie{constructor({callbacks:e,callbackManager:r,...n}){let{cache:o,...i}=n;super({callbacks:e??r,...i});x(this,"caller");x(this,"cache");x(this,"_encoding");typeof o=="object"?this.cache=o:o?this.cache=ccr.global():this.cache=void 0,this.caller=new IC(n??{})}get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}async getNumTokens(e){let r;typeof e=="string"?r=e:r=e.map(o=>typeof o=="string"?o:o.type==="text"&&"text"in o?o.text:"").join("");let n=Math.ceil(r.length/4);if(!this._encoding)try{this._encoding=await ycr("modelName"in this?Zoo(this.modelName):"gpt2")}catch(o){console.warn("Failed to calculate number of tokens, falling back to approximate count",o)}if(this._encoding)try{n=this._encoding.encode(r).length}catch(o){console.warn("Failed to calculate number of tokens, falling back to approximate count",o)}return n}static _convertInputToPromptValue(e){return typeof e=="string"?new sge(e):Array.isArray(e)?new uge(e.map(OC)):e}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:e,...r}){let n={...this._identifyingParams(),...r,_type:this._llmType(),_model:this._modelType()};return Object.entries(n).filter(([o,i])=>i!==void 0).map(([o,i])=>`${o}:${JSON.stringify(i)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(e){throw new Error("Use .toJSON() instead")}get profile(){return{}}}});function Xet(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function Zet(t){return t!==void 0&&Ti.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function Yet(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(Hi(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 zb(t){return Yet(t)||Zet(t)||Xet(t)}var Qet=v(()=>{zN();_g()});function Qoo(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:Ii(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function Rk(t,e){let r=typeof e=="number"?void 0:e,n;return zb(t)?n={type:"function",function:Qoo(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var iD=v(()=>{zo();Sy();Qet()});function dxe(t){let e=t.constructor;return new e({...t,content:t.contentBlocks,response_metadata:{...t.response_metadata,output_version:"v1"}})}var bcr,_cr=v(()=>{bcr=t=>t()});function ett(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];(OQ(i)||EQ(i))&&n===r&&(n=new r.constructor({...n,content:[...r.content.slice(0,o),kBe(i),...r.content.slice(o+1)]}))}e.push(n)}return e}var Vy,aD=v(()=>{zo();F6();PQ();my();mS();TC();su();AQ();BL();XT();xm();zN();Sy();_g();ra();rv();age();_cr();Vy=class uV extends sV{constructor(r){super(r);x(this,"lc_namespace",["langchain","chat_models",this._llmType()]);x(this,"disableStreaming",!1);x(this,"outputVersion");this.outputVersion=bcr(()=>{let n=r.outputVersion??un("LC_OUTPUT_VERSION");return n&&["v0","v1"].includes(n)?n:"v0"})}get callKeys(){return[...super.callKeys,"outputVersion"]}_separateRunnableConfigFromCallOptionsCompat(r){let[n,o]=super._separateRunnableConfigFromCallOptions(r);return o.signal=n.signal,[n,o]}async invoke(r,n){let o=uV._convertInputToPromptValue(r);return(await this.generatePrompt([o],n,n?.callbacks)).generations[0][0].message}async*_streamResponseChunks(r,n,o){throw new Error("Not implemented.")}async*_streamIterator(r,n){if(this._streamResponseChunks===uV.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(r,n);else{let o=uV._convertInputToPromptValue(r).toChatMessages(),[i,a]=this._separateRunnableConfigFromCallOptionsCompat(n),s={...i.metadata,...this.getLsParams(a)},u=await Cm.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=a.outputVersion??this.outputVersion,d=await u?.handleChatModelStart(this.toJSON(),[ett(o)],i.runId,void 0,l,void 0,void 0,i.runName),f,p;try{for await(let m of this._streamResponseChunks(o,a,d?.[0])){if(a.signal?.throwIfAborted(),m.message.id==null){let h=d?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}m.message.response_metadata={...m.generationInfo,...m.message.response_metadata},c==="v1"?yield dxe(m.message):yield m.message,f?f=f.concat(m):f=m,Ipe(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}})}a.signal?.throwIfAborted()}catch(m){throw await Promise.all((d??[]).map(h=>h?.handleLLMError(m))),m}await Promise.all((d??[]).map(m=>m?.handleLLMEnd({generations:[[f]],llmOutput:p})))}}getLsParams(r){let n=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:r.stop,ls_provider:n}}async _generateUncached(r,n,o,i){let a=r.map(f=>f.map(OC)),s;if(i!==void 0&&i.length===a.length)s=i;else{let f={...o.metadata,...this.getLsParams(n)},p=await Cm.configure(o.callbacks,this.callbacks,o.tags,this.tags,f,this.metadata,{verbose:this.verbose}),m={options:n,invocation_params:this?.invocationParams(n),batch_size:1};s=await p?.handleChatModelStart(this.toJSON(),a.map(ett),o.runId,void 0,m,void 0,void 0,o.runName)}let u=n.outputVersion??this.outputVersion,l=[],c=[];if(s?.[0].handlers.find(uUe)&&!this.disableStreaming&&a.length===1&&this._streamResponseChunks!==uV.prototype._streamResponseChunks)try{let f=await this._streamResponseChunks(a[0],n,s?.[0]),p,m;for await(let h of f){if(n.signal?.aborted){let y=p?.message;throw new jBe("Model invocation was aborted.",y)}if(h.message.id==null){let y=s?.at(0)?.runId;y!=null&&h.message._updateId(`run-${y}`)}p===void 0?p=h:p=RC(p,h),Ipe(h.message)&&h.message.usage_metadata!==void 0&&(m={tokenUsage:{promptTokens:h.message.usage_metadata.input_tokens,completionTokens:h.message.usage_metadata.output_tokens,totalTokens:h.message.usage_metadata.total_tokens}})}if(n.signal?.aborted){let h=p?.message;throw new jBe("Model invocation was aborted.",h)}if(p===void 0)throw new Error("Received empty response from chat model call.");l.push([p]),await s?.[0].handleLLMEnd({generations:l,llmOutput:m})}catch(f){throw await s?.[0].handleLLMError(f),f}else{let f=await Promise.allSettled(a.map(async(p,m)=>{let h=await this._generate(p,{...n,promptIndex:m},s?.[m]);if(u==="v1")for(let y of h.generations)y.message=dxe(y.message);return h}));await Promise.all(f.map(async(p,m)=>{if(p.status==="fulfilled"){let h=p.value;for(let y of h.generations){if(y.message.id==null){let g=s?.at(0)?.runId;g!=null&&y.message._updateId(`run-${g}`)}y.message.response_metadata={...y.generationInfo,...y.message.response_metadata}}return h.generations.length===1&&(h.generations[0].message.response_metadata={...h.llmOutput,...h.generations[0].message.response_metadata}),l[m]=h.generations,c[m]=h.llmOutput,s?.[m]?.handleLLMEnd({generations:[h.generations],llmOutput:h.llmOutput})}else return await s?.[m]?.handleLLMError(p.reason),Promise.reject(p.reason)}))}let d={generations:l,llmOutput:c.length?this._combineLLMOutput?.(...c):void 0};return Object.defineProperty(d,Z6,{value:s?{runIds:s?.map(f=>f.runId)}:void 0,configurable:!0}),d}async _generateCached({messages:r,cache:n,llmStringKey:o,parsedOptions:i,handledOptions:a}){let s=r.map(g=>g.map(OC)),u={...a.metadata,...this.getLsParams(i)},l=await Cm.configure(a.callbacks,this.callbacks,a.tags,this.tags,u,this.metadata,{verbose:this.verbose}),c={options:i,invocation_params:this?.invocationParams(i),batch_size:1},d=await l?.handleChatModelStart(this.toJSON(),s.map(ett),a.runId,void 0,c,void 0,void 0,a.runName),f=[],p=(await Promise.allSettled(s.map(async(g,b)=>{let _=uV._convertInputToPromptValue(g).toString(),w=await n.lookup(_,o);return w==null&&f.push(b),w}))).map((g,b)=>({result:g,runManager:d?.[b]})).filter(({result:g})=>g.status==="fulfilled"&&g.value!=null||g.status==="rejected"),m=i.outputVersion??this.outputVersion,h=[];await Promise.all(p.map(async({result:g,runManager:b},_)=>{if(g.status==="fulfilled"){let w=g.value;return h[_]=w.map(T=>("message"in T&&pS(T.message)&&mc(T.message)&&(T.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},m==="v1"&&(T.message=dxe(T.message))),T.generationInfo={...T.generationInfo,tokenUsage:{}},T)),w.length&&await b?.handleLLMNewToken(w[0].text),b?.handleLLMEnd({generations:[w]},void 0,void 0,void 0,{cached:!0})}else return await b?.handleLLMError(g.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(g.reason)}));let y={generations:h,missingPromptIndices:f,startedRunManagers:d};return Object.defineProperty(y,Z6,{value:d?{runIds:d?.map(g=>g.runId)}:void 0,configurable:!0}),y}async generate(r,n,o){let i;Array.isArray(n)?i={stop:n}:i=n;let a=r.map(h=>h.map(OC)),[s,u]=this._separateRunnableConfigFromCallOptionsCompat(i);if(s.callbacks=s.callbacks??o,!this.cache)return this._generateUncached(a,u,s);let{cache:l}=this,c=this._getSerializedCacheKeyParametersForCall(u),{generations:d,missingPromptIndices:f,startedRunManagers:p}=await this._generateCached({messages:a,cache:l,llmStringKey:c,parsedOptions:u,handledOptions:s}),m={};if(f.length>0){let h=await this._generateUncached(f.map(y=>a[y]),u,s,p!==void 0?f.map(y=>p?.[y]):void 0);await Promise.all(h.generations.map(async(y,g)=>{let b=f[g];d[b]=y;let _=uV._convertInputToPromptValue(a[b]).toString();return l.update(_,c,y)})),m=h.llmOutput??{}}return{generations:d,llmOutput:m}}invocationParams(r){return{}}_modelType(){return"base_chat_model"}async generatePrompt(r,n,o){let i=r.map(a=>a.toChatMessages());return this.generate(i,n,o)}withStructuredOutput(r,n){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(n?.strict)throw new Error('"strict" mode is not supported for this model by default.');let o=r,i=n?.name,a=Kz(o)??"A function available to call.",s=n?.method,u=n?.includeRaw;if(s==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let l=i??"extract",c;Hi(o)?c=[{type:"function",function:{name:l,description:a,parameters:Ii(o)}}]:("name"in o&&(l=o.name),c=[{type:"function",function:{name:l,description:a,parameters:o}}]);let d=this.bindTools(c),f=YN.from(y=>{if(!Hr.isInstance(y))throw new Error("Input is not an AIMessageChunk.");if(!y.tool_calls||y.tool_calls.length===0)throw new Error("No tool calls found in the response.");let g=y.tool_calls.find(b=>b.name===l);if(!g)throw new Error(`No tool call found with name ${l}.`);return g.args});if(!u)return d.pipe(f).withConfig({runName:"StructuredOutput"});let p=pl.assign({parsed:(y,g)=>f.invoke(y.raw,g)}),m=pl.assign({parsed:()=>null}),h=p.withFallbacks({fallbacks:[m]});return gc.from([{raw:d},h]).withConfig({runName:"StructuredOutputRunnable"})}}});function vcr(t,e=0){return(qg[t[e+0]]+qg[t[e+1]]+qg[t[e+2]]+qg[t[e+3]]+"-"+qg[t[e+4]]+qg[t[e+5]]+"-"+qg[t[e+6]]+qg[t[e+7]]+"-"+qg[t[e+8]]+qg[t[e+9]]+"-"+qg[t[e+10]]+qg[t[e+11]]+qg[t[e+12]]+qg[t[e+13]]+qg[t[e+14]]+qg[t[e+15]]).toLowerCase()}var qg,fxe,wcr=v(()=>{qg=[];for(fxe=0;fxe<256;++fxe)qg.push((fxe+256).toString(16).slice(1))});function ttt(){if(!pxe&&(pxe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!pxe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pxe(eio)}var pxe,eio,Scr=v(()=>{eio=new Uint8Array(16)});var tio,rtt,Ccr=v(()=>{tio=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),rtt={randomUUID:tio}});function rio(t,e,r){if(rtt.randomUUID&&!e&&!t)return rtt.randomUUID();t=t||{};var n=t.random||(t.rng||ttt)();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 vcr(n)}var ntt,xcr=v(()=>{Ccr();Scr();wcr();ntt=rio});var Tcr=v(()=>{xcr()});var nv=v(()=>{zo();zN()});function Ocr(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 mxe(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=>mc(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 oio(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function Ecr(t){return t._getType()==="tool"}function Pcr(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 iio(t){if(t){if(t.every(oio))return t;if(t.every(i0))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:Pcr(e.function.parameters)}));if(t.every(zb))return t.map(e=>{let r=Hi(e.schema)?Ii(e.schema):e.schema;return{name:e.name,description:e.description??"",parameterDefinitions:Pcr(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var ott,Mcr=v(()=>{eie();ra();rv();iD();aD();xm();Tcr();nv();Sy();ott=class extends Vy{constructor(e){super(e??{});x(this,"lc_serializable",!0);x(this,"client");x(this,"model","command-r-plus");x(this,"temperature",.3);x(this,"streaming",!1);x(this,"streamUsage",!0);this.client=M8(e),this.model=e?.model??this.model,this.temperature=e?.temperature??this.temperature,this.streaming=e?.streaming??this.streaming,this.streamUsage=e?.streamUsage??this.streamUsage}static lc_name(){return"ChatCohere"}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.withConfig({tools:iio(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(!(mc(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=mxe(c,s);i.push(d),s=[]}}else i.push(mxe(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=mxe(c,s);i.push(d),s=[]}}else i.push(mxe(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(Ecr(o)){let i=o,a=n.filter(s=>mc(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:Ocr(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!Ecr(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>mc(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:Ocr(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:ntt().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 uo({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 Mi({text:a.text,message:new Hr({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new Mi({text:"",message:new Hr({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 Mi({text:"",message:new Hr({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 rie=v(()=>{zo();AQ();BL();XT();xm();rv()});var Icr=v(()=>{eie();rie()});var bx,lV=v(()=>{zo();Iz();bx=class{constructor(t){x(this,"caller");this.caller=new IC(t??{})}}});var _x,Ik=v(()=>{zo();_x=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e);return r[i]=(r[i]||[]).concat([n]),r},[])});var itt,Acr=v(()=>{eie();lV();Ik();itt=class extends bx{constructor(e){let r={maxConcurrency:2,...e};super(r);x(this,"model");x(this,"batchSize",48);x(this,"embeddingTypes",["float"]);x(this,"client");if(this.client=M8(r),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=_x(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 Ncr=v(()=>{zo()});var Dcr=v(()=>{eie();Ncr()});var att=v(()=>{Mcr();Icr();Acr();Dcr()});function sD(t){if(typeof t=="object"&&t!==null){let e={...t};"additionalProperties"in e&&delete e.additionalProperties,"$schema"in e&&delete e.$schema,"strict"in e&&delete e.strict;for(let r in e)r in e&&(Array.isArray(e[r])?e[r]=e[r].map(sD):typeof e[r]=="object"&&e[r]!==null&&(e[r]=sD(e[r])));return e}return t}function nie(t){let{$schema:e,...r}=sD(Hi(t)?Ii(t):t);return r}function jcr(t){let{$schema:e,...r}=sD(t);return r}var hxe=v(()=>{nv();Sy()});function cV(t,e,r=[]){if(t==null||typeof t!="object")return;let n=t;if(Array.isArray(n.enum)&&n.enum.some(o=>o==="")){let o=r.length?` at path "${r.join(".")}"`:"",i=e?` in tool "${e}"`:"";throw new Error(`Invalid enum: empty string not allowed${i}${o}. Gemini API rejects empty strings in enums.`)}if(n.type==="object"&&n.properties&&typeof n.properties=="object")for(let[o,i]of Object.entries(n.properties))cV(i,e,[...r,o]);n.items&&cV(n.items,e,[...r,"[]"]);for(let o of["anyOf","oneOf","allOf"]){let i=n[o];Array.isArray(i)&&i.forEach((a,s)=>cV(a,e,[...r,`${o}[${s}]`]))}n.additionalProperties&&typeof n.additionalProperties=="object"&&cV(n.additionalProperties,e,[...r,"additionalProperties"])}var $cr=v(()=>{});function uio(t){return hy.isInstance(t)?t.role:t.type}function lio(t){switch(t){case"supervisor":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 cio(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};if("mimeType"in t&&"fileUri"in t)return{fileData:{mimeType:t.mimeType,fileUri:t.fileUri}};throw new Error("Invalid media content")}function dio(t,e){return e.map(r=>mc(r)?r.tool_calls??[]:[]).flat().find(r=>r.id===t.tool_call_id)?.name}function fio(t){return{providerName:"Google Gemini",fromStandardTextBlock(e){return{text:e.text}},fromStandardImageBlock(e){if(!t)throw new Error("This model does not support images");if(e.source_type==="url"){let r=bb({dataUrl:e.url});return r?{inlineData:{mimeType:r.mime_type,data:r.data}}:{fileData:{mimeType:e.mime_type??"",fileUri:e.url}}}if(e.source_type==="base64")return{inlineData:{mimeType:e.mime_type??"",data:e.data}};throw new Error(`Unsupported source type: ${e.source_type}`)},fromStandardAudioBlock(e){if(!t)throw new Error("This model does not support audio");if(e.source_type==="url"){let r=bb({dataUrl:e.url});return r?{inlineData:{mimeType:r.mime_type,data:r.data}}:{fileData:{mimeType:e.mime_type??"",fileUri:e.url}}}if(e.source_type==="base64")return{inlineData:{mimeType:e.mime_type??"",data:e.data}};throw new Error(`Unsupported source type: ${e.source_type}`)},fromStandardFileBlock(e){if(!t)throw new Error("This model does not support files");if(e.source_type==="text")return{text:e.text};if(e.source_type==="url"){let r=bb({dataUrl:e.url});return r?{inlineData:{mimeType:r.mime_type,data:r.data}}:{fileData:{mimeType:e.mime_type??"",fileUri:e.url}}}if(e.source_type==="base64")return{inlineData:{mimeType:e.mime_type??"",data:e.data}};throw new Error(`Unsupported source type: ${e.source_type}`)}}}function Lcr(t,e){if(py(t))return AN(t,fio(e));if(t.type==="text")return{text:t.text};if(t.type==="executableCode")return{executableCode:t.executableCode};if(t.type==="codeExecutionResult")return{codeExecutionResult:t.codeExecutionResult};if(t.type==="image_url"){if(!e)throw new Error("This model does not support images");let r;if(typeof t.image_url=="string")r=t.image_url;else if(typeof t.image_url=="object"&&"url"in t.image_url)r=t.image_url.url;else throw new Error("Please provide image as base64 encoded data URL");let[n,o]=r.split(",");if(!n.startsWith("data:"))throw new Error("Please provide image as base64 encoded data URL");let[i,a]=n.replace(/^data:/,"").split(";");if(a!=="base64")throw new Error("Please provide image as base64 encoded data URL");return{inlineData:{data:o,mimeType:i}}}else{if(t.type==="media")return cio(t);if(t.type==="tool_use")return{functionCall:{name:t.name,args:t.input}};if(t.type==="tool_call")return{functionCall:{name:t.name,args:t.args}};if(t.type?.includes("/")&&t.type.split("/").length===2&&"data"in t&&typeof t.data=="string")return{inlineData:{mimeType:t.type,data:t.data}};if("functionCall"in t)return;throw"type"in t?new Error(`Unknown content type ${t.type}`):new Error(`Unknown content ${JSON.stringify(t)}`)}}function pio(t,e,r,n){if(YBe(t)){let s=t.name??dio(t,r);if(s===void 0)throw new Error(`Google requires a tool name for each tool call response, and we could not infer a called tool name for ToolMessage "${t.id}" from your passed messages. Please populate a "name" field on that ToolMessage explicitly.`);let u=Array.isArray(t.content)?t.content.map(l=>Lcr(l,e)).filter(l=>l!==void 0):t.content;return t.status==="error"?[{functionResponse:{name:s,response:{error:{details:u}}}}]:[{functionResponse:{name:s,response:{result:u}}}]}let o=[],i=[];typeof t.content=="string"&&t.content&&i.push({text:t.content}),Array.isArray(t.content)&&i.push(...t.content.map(s=>Lcr(s,e)).filter(s=>s!==void 0));let a=t.additional_kwargs?.[stt];return mc(t)&&t.tool_calls?.length&&(o=t.tool_calls.map(s=>{let u=sio(()=>{if(s.id){let l=a?.[s.id];if(l)return l}return n?.includes("gemini-3")?aio:""});return{functionCall:{name:s.name,args:s.args},...u?{thoughtSignature:u}:{}}})),[...i,...o]}function utt(t,e,r=!1,n){return t.reduce((o,i,a)=>{if(!pS(i))throw new Error("Unsupported message input");let s=uio(i);if(s==="system"&&a!==0)throw new Error("System message should be the first one");let u=lio(s),l=o.content[o.content.length];if(!o.mergeWithPreviousContent&&l&&l.role===u)throw new Error("Google Generative AI requires alternate messages between authors");let c=pio(i,e,t.slice(0,a),n);if(o.mergeWithPreviousContent){let p=o.content[o.content.length-1];if(!p)throw new Error("There was a problem parsing your system message. Please try a prompt without one.");return p.parts.push(...c),{mergeWithPreviousContent:!1,content:o.content}}let d=u;(d==="function"||d==="system"&&!r)&&(d="user");let f={role:d,parts:c};return{mergeWithPreviousContent:s==="system"&&!r,content:[...o.content,f]}},{content:[],mergeWithPreviousContent:!1}).content}function Fcr(t,e){if(!t.candidates||t.candidates.length===0||!t.candidates[0])return{generations:[],llmOutput:{filters:t.promptFeedback}};let[r]=t.candidates,{content:n,...o}=r,i=n.parts?.reduce((c,d)=>("functionCall"in d&&d.functionCall&&c.push({...d,id:"id"in d.functionCall&&typeof d.functionCall.id=="string"?d.functionCall.id:gu()}),c),[]),a,s=n?.parts;Array.isArray(s)&&s.length===1&&"text"in s[0]&&s[0].text&&!s[0].thought?a=s[0].text:Array.isArray(s)&&s.length>0?a=s.map(c=>c.thought&&"text"in c&&c.text?{type:"thinking",thinking:c.text,...c.thoughtSignature?{signature:c.thoughtSignature}:{}}:"text"in c?{type:"text",text:c.text}:"inlineData"in c?{type:"inlineData",inlineData:c.inlineData}:"functionCall"in c?{type:"functionCall",functionCall:c.functionCall}:"functionResponse"in c?{type:"functionResponse",functionResponse:c.functionResponse}:"fileData"in c?{type:"fileData",fileData:c.fileData}:"executableCode"in c?{type:"executableCode",executableCode:c.executableCode}:"codeExecutionResult"in c?{type:"codeExecutionResult",codeExecutionResult:c.codeExecutionResult}:c):a=[];let u=i?.reduce((c,d)=>("thoughtSignature"in d&&typeof d.thoughtSignature=="string"&&(c[d.id]=d.thoughtSignature),c),{}),l="";return typeof a=="string"?l=a:Array.isArray(a)&&a.length>0&&(l=a.find(c=>"text"in c)?.text??l),{generations:[{text:l,message:new uo({content:a??"",tool_calls:i?.map(c=>({type:"tool_call",id:c.id,name:c.functionCall.name,args:c.functionCall.args})),additional_kwargs:{...o,[stt]:u},usage_metadata:e?.usageMetadata}),generationInfo:o}],llmOutput:{tokenUsage:{promptTokens:e?.usageMetadata?.input_tokens,completionTokens:e?.usageMetadata?.output_tokens,totalTokens:e?.usageMetadata?.total_tokens}}}}function kcr(t,e){if(!t.candidates||t.candidates.length===0)return null;let[r]=t.candidates,{content:n,...o}=r,i=n.parts?.reduce((d,f)=>("functionCall"in f&&f.functionCall&&d.push({...f,id:"id"in f.functionCall&&typeof f.functionCall.id=="string"?f.functionCall.id:gu()}),d),[]),a,s=n?.parts;Array.isArray(s)&&s.every(d=>"text"in d&&!d.thought)?a=s.map(d=>d.text).join(""):Array.isArray(s)?a=s.map(d=>d.thought&&"text"in d&&d.text?{type:"thinking",thinking:d.text,...d.thoughtSignature?{signature:d.thoughtSignature}:{}}:"text"in d?{type:"text",text:d.text}:"inlineData"in d?{type:"inlineData",inlineData:d.inlineData}:"functionCall"in d?{type:"functionCall",functionCall:d.functionCall}:"functionResponse"in d?{type:"functionResponse",functionResponse:d.functionResponse}:"fileData"in d?{type:"fileData",fileData:d.fileData}:"executableCode"in d?{type:"executableCode",executableCode:d.executableCode}:"codeExecutionResult"in d?{type:"codeExecutionResult",codeExecutionResult:d.codeExecutionResult}:d):a=[];let u="";a&&typeof a=="string"?u=a:Array.isArray(a)&&(u=a.find(d=>"text"in d)?.text??"");let l=[];i&&l.push(...i.map(d=>({type:"tool_call_chunk",id:d.id,name:d.functionCall.name,args:JSON.stringify(d.functionCall.args)})));let c=i?.reduce((d,f)=>("thoughtSignature"in f&&typeof f.thoughtSignature=="string"&&(d[f.id]=f.thoughtSignature),d),{});return new Mi({text:u,message:new Hr({content:a||"",name:n?n.role:void 0,tool_call_chunks:l,additional_kwargs:{[stt]:c},response_metadata:{model_provider:"google-genai"},usage_metadata:e.usageMetadata}),generationInfo:o})}function qcr(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(zb(e)){let r=nie(e.schema);return r.type==="object"&&"properties"in r&&Object.keys(r.properties).length===0?{name:e.name,description:e.description}:(cV(r,e.name),{name:e.name,description:e.description,parameters:r})}if(i0(e)){let r=jcr(e.function.parameters);return cV(r,e.function.name),{name:e.function.name,description:e.function.description??"A function available to call.",parameters:r}}return e})}]}function ltt(t,e){let r={input_tokens:t?.promptTokenCount??0,output_tokens:t?.candidatesTokenCount??0,total_tokens:t?.totalTokenCount??0};if(t?.cachedContentTokenCount&&(r.input_token_details??(r.input_token_details={}),r.input_token_details.cache_read=t.cachedContentTokenCount),e==="gemini-3-pro-preview"){let n=Math.max(0,t?.promptTokenCount??-2e5),o=Math.max(0,t?.cachedContentTokenCount??-2e5);n&&(r.input_token_details={...r.input_token_details,over_200k:n}),o&&(r.input_token_details={...r.input_token_details,cache_read_over_200k:o})}return r}var stt,aio,sio,ctt=v(()=>{hxe();$cr();ra();xm();iD();rv();y_();stt="__gemini_function_call_thought_signatures__",aio="ErYCCrMCAdHtim9kOoOkrPiCNVsmlpMIKd7ZMxgiFbVQOkgp7nlLcDMzVsZwIzvuT7nQROivoXA72ccC2lSDvR0Gh7dkWaGuj7ctv6t7ZceHnecx0QYa+ix8tYpRfjhyWozQ49lWiws6+YGjCt10KRTyWsZ2h6O7iHTYJwKIRwGUHRKy/qK/6kFxJm5ML00gLq4D8s5Z6DBpp2ZlR+uF4G8jJgeWQgyHWVdx2wGYElaceVAc66tZdPQRdOHpWtgYSI1YdaXgVI8KHY3/EfNc2YqqMIulvkDBAnuMhkAjV9xmBa54Tq+ih3Im4+r3DzqhGqYdsSkhS0kZMwte4Hjs65dZzCw9lANxIqYi1DJ639WNPYihp/DCJCos7o+/EeSPJaio5sgWDyUnMGkY1atsJZ+m7pj7DD5tvQ==",sio=t=>t()});var dtt,Bcr=v(()=>{nv();nO();dtt=class extends gJ{constructor(e){super(e);x(this,"lc_namespace",["langchain","google_genai","output_parsers"]);x(this,"returnId",!1);x(this,"keyName");x(this,"returnSingle",!1);x(this,"zodSchema");this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}static lc_name(){return"GoogleGenerativeAIToolsOutputParser"}async _validateResult(e){if(this.zodSchema===void 0)return e;let r=await Wz(this.zodSchema,e);if(r.success)return r.data;throw new CS(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error.issues)}`,JSON.stringify(e,null,2))}async parseResult(e){let r=e.flatMap(o=>{let{message:i}=o;return!("tool_calls"in i)||!Array.isArray(i.tool_calls)?[]:i.tool_calls});if(r[0]===void 0)throw new Error("No parseable tool calls provided to GoogleGenerativeAIToolsOutputParser.");let[n]=r;return await this._validateResult(n.args)}}});function bio(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${yio}/${gio}`),e.join(" ")}async function _io(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",bio(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 zI(`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 zI(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new zI(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function vio(t,e,r,n,o,i){let a=new ftt(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},xio(i)),{method:"POST",headers:await _io(a),body:o})}}async function sie(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await vio(t,e,r,n,o,i);return wio(s,u,a)}async function wio(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){Sio(o,t)}return n.ok||await Cio(n,t),n}function Sio(t,e){let r=t;throw r.name==="AbortError"?(r=new bxe(`Request aborted when fetching ${e.toString()}: ${t.message}`),r.stack=t.stack):t instanceof yxe||t instanceof zI||(r=new Lh(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function Cio(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 yxe(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function xio(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 mtt(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.`),gxe(t.candidates[0]))throw new Ak(`${Nk(t)}`,t);return Tio(t)}else if(t.promptFeedback)throw new Ak(`Text not available. ${Nk(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.`),gxe(t.candidates[0]))throw new Ak(`${Nk(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),Xcr(t)[0]}else if(t.promptFeedback)throw new Ak(`Function call not available. ${Nk(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.`),gxe(t.candidates[0]))throw new Ak(`${Nk(t)}`,t);return Xcr(t)}else if(t.promptFeedback)throw new Ak(`Function call not available. ${Nk(t)}`,t)},t}function Tio(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 Xcr(t){var e,r,n,o;let i=[];if(!((r=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||r===void 0)&&r.parts)for(let a of(o=(n=t.candidates)===null||n===void 0?void 0:n[0].content)===null||o===void 0?void 0:o.parts)a.functionCall&&i.push(a.functionCall);if(i.length>0)return i}function gxe(t){return!!t.finishReason&&Oio.includes(t.finishReason)}function Nk(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];gxe(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function iie(t){return this instanceof iie?(this.v=t,this):new iie(t)}function Eio(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 iie?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 Pio(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=Iio(e),[n,o]=r.tee();return{stream:Rio(n),response:Mio(o)}}async function Mio(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return mtt(Aio(e));e.push(o)}}function Rio(t){return Eio(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield iie(r.read());if(o)break;yield yield iie(mtt(n))}})}function Iio(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 Lh("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match(Zcr),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new Lh(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match(Zcr)}return i()}).catch(a=>{let s=a;throw s.stack=a.stack,s.name==="AbortError"?s=new bxe("Request aborted when reading from the stream"):s=new Lh("Error reading from the stream"),s})}}})}function Aio(t){let e=t[t.length-1],r={promptFeedback:e?.promptFeedback};for(let n of t){if(n.candidates){let o=0;for(let i of n.candidates)if(r.candidates||(r.candidates=[]),r.candidates[o]||(r.candidates[o]={index:o}),r.candidates[o].citationMetadata=i.citationMetadata,r.candidates[o].groundingMetadata=i.groundingMetadata,r.candidates[o].finishReason=i.finishReason,r.candidates[o].finishMessage=i.finishMessage,r.candidates[o].safetyRatings=i.safetyRatings,i.content&&i.content.parts){r.candidates[o].content||(r.candidates[o].content={role:i.content.role||"user",parts:[]});let a={};for(let s of i.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[o].content.parts.push(a)}o++}n.usageMetadata&&(r.usageMetadata=n.usageMetadata)}return r}async function rdr(t,e,r,n){let o=await sie(e,mV.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return Pio(o)}async function ndr(t,e,r,n){let i=await(await sie(e,mV.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:mtt(i)}}function odr(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 aie(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 Nio(e)}function Nio(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 Lh("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 Lh("No content is provided for sending chat message.");return n?e:r}function Dio(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 zI("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=aie(t);n.contents=[i]}return{generateContentRequest:n}}function Ycr(t){let e;return t.contents?e=t:e={contents:[aie(t)]},t.systemInstruction&&(e.systemInstruction=odr(t.systemInstruction)),e}function jio(t){return typeof t=="string"||Array.isArray(t)?{content:aie(t)}:t}function Lio(t){let e=!1;for(let r of t){let{role:n,parts:o}=r;if(!e&&n!=="user")throw new Lh(`First content should be with role 'user', got ${n}`);if(!Hcr.includes(n))throw new Lh(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(Hcr)}`);if(!Array.isArray(o))throw new Lh("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new Lh("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 Qcr)u in s&&(i[u]+=1);let a=$io[n];for(let s of Qcr)if(!a.includes(s)&&i[s]>0)throw new Lh(`Content with role '${n}' can't contain '${s}' part`);e=!0}}function edr(t){var e;if(t.candidates===void 0||t.candidates.length===0)return!1;let r=(e=t.candidates[0])===null||e===void 0?void 0:e.content;if(r===void 0||r.parts===void 0||r.parts.length===0)return!1;for(let n of r.parts)if(n===void 0||Object.keys(n).length===0||n.text!==void 0&&n.text==="")return!1;return!0}async function Fio(t,e,r,n){return(await sie(e,mV.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function kio(t,e,r,n){return(await sie(e,mV.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function qio(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await sie(e,mV.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var Ucr,zcr,Vcr,Hcr,dV,fV,Wcr,Jcr,oie,Kcr,pV,Gcr,Lh,Ak,yxe,zI,bxe,mio,hio,gio,yio,mV,ftt,Oio,Zcr,Qcr,$io,tdr,ptt,_xe,hV,uie=v(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(Ucr||(Ucr={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(zcr||(zcr={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(Vcr||(Vcr={}));Hcr=["user","model","function","system"];(function(t){t.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",t.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",t.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",t.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",t.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",t.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY"})(dV||(dV={}));(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"})(fV||(fV={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(Wcr||(Wcr={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(Jcr||(Jcr={}));(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.BLOCKLIST="BLOCKLIST",t.PROHIBITED_CONTENT="PROHIBITED_CONTENT",t.SPII="SPII",t.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",t.OTHER="OTHER"})(oie||(oie={}));(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"})(Kcr||(Kcr={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(pV||(pV={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(Gcr||(Gcr={}));Lh=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},Ak=class extends Lh{constructor(e,r){super(e),this.response=r}},yxe=class extends Lh{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},zI=class extends Lh{},bxe=class extends Lh{};mio="https://generativelanguage.googleapis.com",hio="v1beta",gio="0.24.1",yio="genai-js";(function(t){t.GENERATE_CONTENT="generateContent",t.STREAM_GENERATE_CONTENT="streamGenerateContent",t.COUNT_TOKENS="countTokens",t.EMBED_CONTENT="embedContent",t.BATCH_EMBED_CONTENTS="batchEmbedContents"})(mV||(mV={}));ftt=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)||hio,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||mio}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};Oio=[oie.RECITATION,oie.SAFETY,oie.LANGUAGE];Zcr=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;Qcr=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],$io={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};tdr="SILENT_ERROR",ptt=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&&(Lio(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=aie(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(()=>ndr(this._apiKey,this.model,c,d)).then(p=>{var m;if(edr(p.response)){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=Nk(p.response);h&&console.warn(`sendMessage() was unsuccessful. ${h}. Inspect response object for details.`)}f=p}).catch(p=>{throw this._sendPromise=Promise.resolve(),p}),await this._sendPromise,f}async sendMessageStream(e,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=aie(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=rdr(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(tdr)}).then(p=>p.response).then(p=>{if(edr(p)){this._history.push(l);let m=Object.assign({},p.candidates[0].content);m.role||(m.role="model"),this._history.push(m)}else{let m=Nk(p);m&&console.warn(`sendMessageStream() was unsuccessful. ${m}. Inspect response object for details.`)}}).catch(p=>{p.message!==tdr&&console.error(p)}),f}};_xe=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=odr(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=Ycr(e),i=Object.assign(Object.assign({},this._requestOptions),r);return ndr(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=Ycr(e),i=Object.assign(Object.assign({},this._requestOptions),r);return rdr(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 ptt(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=Dio(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 Fio(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=jio(e),o=Object.assign(Object.assign({},this._requestOptions),r);return kio(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return qio(this.apiKey,this.model,e,n)}};hV=class{constructor(e){this.apiKey=e}getGenerativeModel(e,r){if(!e.model)throw new Lh("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new _xe(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new zI("Cached content must contain a `name` field.");if(!e.model)throw new zI("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 zI(`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 _xe(this.apiKey,i,n)}}});function htt(t,e){let r=Bio(t);return{tools:r,toolConfig:zio(r,e)}}function Bio(t){let e=[],r=[];return t.forEach(n=>{if(zb(n)){let[o]=qcr([n]);o.functionDeclarations&&e.push(...o.functionDeclarations)}else if(i0(n)){let{functionDeclarations:o}=Uio(n);if(o)e.push(...o);else throw new Error("Failed to convert OpenAI structured tool to GenerativeAI tool")}else r.push(n)}),r.find(n=>"functionDeclarations"in n)?r.map(n=>{if(e?.length>0&&"functionDeclarations"in n){let o={functionDeclarations:[...n.functionDeclarations||[],...e]};return e=[],o}return n}):[...r,...e.length>0?[{functionDeclarations:e}]:[]]}function Uio(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:sD(t.function.parameters)}]}}function zio(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:pV.ANY,auto:pV.AUTO,none:pV.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:pV.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var idr=v(()=>{hxe();ctt();uie();iD();rv()});var adr,sdr=v(()=>{adr={"gemini-embedding-001":{maxInputTokens:2048,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:3072,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-2.5-flash-lite-preview-09-2025":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-pro-preview-06-05":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-flash-preview-04-17":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-2.5-flash-preview-09-2025":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-pro-preview-05-06":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-flash-preview-05-20":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-flash":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-live-2.5-flash":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:8e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!0,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-3-flash-preview":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-live-2.5-flash-preview-native-audio":{maxInputTokens:131072,imageInputs:!1,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!0,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-2.5-flash-lite":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-flash-preview-tts":{maxInputTokens:8e3,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16e3,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!0,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-flash-latest":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-flash-lite-preview-06-17":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-2.5-flash-image":{maxInputTokens:32768,imageInputs:!0,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!0,imageOutputs:!0,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-2.5-pro-preview-tts":{maxInputTokens:8e3,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16e3,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!0,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-2.5-flash-image-preview":{maxInputTokens:32768,imageInputs:!0,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!0,imageOutputs:!0,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-1.5-flash-8b":{maxInputTokens:1e6,imageInputs:!0,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-3-pro-preview":{maxInputTokens:1e6,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:64e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.0-flash-lite":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-1.5-flash":{maxInputTokens:1e6,imageInputs:!0,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-flash-lite-latest":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-pro":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.0-flash":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-1.5-pro":{maxInputTokens:1e6,imageInputs:!0,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1}}});var gtt,udr=v(()=>{hxe();ctt();Bcr();idr();sdr();uie();su();aD();Qv();nv();nO();gtt=class extends Vy{constructor(e,r){let n=typeof e=="string"?{...r??{},model:e}:e;super(n);x(this,"lc_serializable",!0);x(this,"lc_namespace",["langchain","chat_models","google_genai"]);x(this,"model");x(this,"temperature");x(this,"maxOutputTokens");x(this,"topP");x(this,"topK");x(this,"stopSequences",[]);x(this,"safetySettings");x(this,"apiKey");x(this,"streaming",!1);x(this,"json");x(this,"streamUsage",!0);x(this,"convertSystemMessageToHumanContent");x(this,"thinkingConfig");x(this,"client");if(this._addVersion("@langchain/google-genai","2.1.23"),this.model=n.model.replace(/^models\//,""),this.maxOutputTokens=n.maxOutputTokens??this.maxOutputTokens,this.maxOutputTokens&&this.maxOutputTokens<0)throw new Error("`maxOutputTokens` must be a positive integer");if(this.temperature=n.temperature??this.temperature,this.temperature&&(this.temperature<0||this.temperature>2))throw new Error("`temperature` must be in the range of [0.0,2.0]");if(this.topP=n.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=n.topK??this.topK,this.topK&&this.topK<0)throw new Error("`topK` must be a positive integer");if(this.stopSequences=n.stopSequences??this.stopSequences,this.apiKey=n.apiKey??un("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=n.safetySettings??this.safetySettings,this.safetySettings&&this.safetySettings.length>0&&new Set(this.safetySettings.map(o=>o.category)).size!==this.safetySettings.length)throw new Error("The categories in `safetySettings` array must be unique");this.streaming=n.streaming??this.streaming,this.json=n.json,this.thinkingConfig=n.thinkingConfig??this.thinkingConfig,this.client=new hV(this.apiKey).getGenerativeModel({model:this.model,safetySettings:this.safetySettings,generationConfig:{stopSequences:this.stopSequences,maxOutputTokens:this.maxOutputTokens,temperature:this.temperature,topP:this.topP,topK:this.topK,...this.json?{responseMimeType:"application/json"}:{},...this.thinkingConfig?{thinkingConfig:this.thinkingConfig}:{}}},{apiVersion:n.apiVersion,baseUrl:n.baseUrl,customHeaders:n.customHeaders}),this.streamUsage=n.streamUsage??this.streamUsage}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")||this.model.startsWith("gemma-3-")&&!this.model.startsWith("gemma-3-1b")||this.model.startsWith("gemini-3")}useCachedContent(e,r,n){this.apiKey&&(this.client=new hV(this.apiKey).getGenerativeModelFromCachedContent(e,r,n))}get useSystemInstruction(){return typeof this.convertSystemMessageToHumanContent=="boolean"?!this.convertSystemMessageToHumanContent:this.computeUseSystemInstruction}get computeUseSystemInstruction(){return this.model==="gemini-1.0-pro-001"||this.model.startsWith("gemini-pro-vision")||this.model.startsWith("gemini-1.0-pro-vision")?!1:this.model!=="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.withConfig({tools:htt(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?htt(e.tools,{toolChoice:e.tool_choice,allowedFunctionNames:e.allowedFunctionNames}):void 0;return e?.responseSchema?(this.client.generationConfig.responseSchema=e.responseSchema,this.client.generationConfig.responseMimeType="application/json"):(this.client.generationConfig.responseSchema=void 0,this.client.generationConfig.responseMimeType=this.json?"application/json":void 0),{...r?.tools?{tools:r.tools}:{},...r?.toolConfig?{toolConfig:r.toolConfig}:{}}}async _generate(e,r,n){r.signal?.throwIfAborted();let o=utt(e,this._isMultimodalModel,this.useSystemInstruction,this.model),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 p of d){let m=p.generationInfo?.completion??0;f[m]===void 0?f[m]=p:f[m]=f[m].concat(p)}return{generations:f.filter(p=>p!==void 0),llmOutput:{estimatedTokenUsage:c}}}let s=await this.completionWithRetry({...a,contents:i}),u;"usageMetadata"in s.response&&(u=ltt(s.response.usageMetadata,this.model));let l=Fcr(s.response,{usageMetadata:u});return l.generations?.length>0&&await n?.handleLLMNewToken(l.generations[0]?.text??""),l}async*_streamResponseChunks(e,r,n){let o=utt(e,this._isMultimodalModel,this.useSystemInstruction,this.model),i=o;if(o[0].role==="system"){let[p]=o;this.client.systemInstruction=p,i=o.slice(1)}let a={...this.invocationParams(r),contents:i},s=await this.caller.callWithOptions({signal:r?.signal},async()=>{let{stream:p}=await this.client.generateContentStream(a,{signal:r?.signal});return p}),u,l=0,c=0,d=0,f=0;for await(let p of s){if(r.signal?.aborted)return;if("usageMetadata"in p&&p.usageMetadata!==void 0&&this.streamUsage!==!1&&r.streamUsage!==!1){u=ltt(p.usageMetadata,this.model);let h=p.usageMetadata.promptTokenCount??0;u.input_tokens=Math.max(0,h-l),l=h;let y=p.usageMetadata.candidatesTokenCount??0;u.output_tokens=Math.max(0,y-c),c=y;let g=p.usageMetadata.totalTokenCount??0;u.total_tokens=Math.max(0,g-d),d=g}let m=kcr(p,{usageMetadata:u,index:f});f+=1,m&&(yield m,await n?.handleLLMNewToken(m.text??""))}}async completionWithRetry(e,r){return this.caller.callWithOptions({signal:r?.signal},async()=>{try{return await this.client.generateContent(e,{signal:r?.signal})}catch(n){throw n.message?.includes("400 Bad Request")&&(n.status=400),n}})}get profile(){return adr[this.model]??{}}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw;if(i==="jsonMode")throw new Error('ChatGoogleGenerativeAI only supports "jsonSchema" or "functionCalling" as a method.');let s,u;if(i==="functionCalling"){let f=o??"extract",p;if(Hi(n)){let m=nie(n);p=[{functionDeclarations:[{name:f,description:m.description??"A function available to call.",parameters:m}]}],u=new dtt({returnSingle:!0,keyName:f,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(m=n,m.parameters=sD(n.parameters),f=n.name):m={name:f,description:n.description??"",parameters:sD(n)},p=[{functionDeclarations:[m]}],u=new dtt({returnSingle:!0,keyName:f})}s=this.bindTools(p).withConfig({allowedFunctionNames:[f]})}else{let f=nie(n);s=this.withConfig({responseSchema:f}),u=new ew}if(!a)return s.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let l=pl.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=pl.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return gc.from([{raw:s},d]).withConfig({runName:"StructuredOutputRunnable"})}}});var ytt,ldr=v(()=>{uie();su();lV();Ik();ytt=class extends bx{constructor(e){super(e??{});x(this,"apiKey");x(this,"modelName","embedding-001");x(this,"model","embedding-001");x(this,"taskType");x(this,"title");x(this,"stripNewLines",!0);x(this,"maxBatchSize",100);x(this,"client");if(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??un("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 hV(this.apiKey).getGenerativeModel({model:this.model},{baseUrl:e?.baseUrl})}_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=_x(e,this.maxBatchSize),n=r.map(o=>({requests:o.map(i=>this._convertToContent(i))}));return(await Promise.allSettled(n.map(o=>this.client.batchEmbedContents(o)))).flatMap((o,i)=>o.status==="fulfilled"?o.value.embeddings.map(a=>a.values||[]):Array(r[i].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 btt=v(()=>{udr();ldr()});function cdr(t,e=0){return(Bg[t[e+0]]+Bg[t[e+1]]+Bg[t[e+2]]+Bg[t[e+3]]+"-"+Bg[t[e+4]]+Bg[t[e+5]]+"-"+Bg[t[e+6]]+Bg[t[e+7]]+"-"+Bg[t[e+8]]+Bg[t[e+9]]+"-"+Bg[t[e+10]]+Bg[t[e+11]]+Bg[t[e+12]]+Bg[t[e+13]]+Bg[t[e+14]]+Bg[t[e+15]]).toLowerCase()}var Bg,vxe,ddr=v(()=>{Bg=[];for(vxe=0;vxe<256;++vxe)Bg.push((vxe+256).toString(16).slice(1))});function _tt(){if(!wxe&&(wxe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!wxe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return wxe(Vio)}var wxe,Vio,fdr=v(()=>{Vio=new Uint8Array(16)});var Hio,vtt,pdr=v(()=>{Hio=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vtt={randomUUID:Hio}});function Wio(t,e,r){if(vtt.randomUUID&&!e&&!t)return vtt.randomUUID();t=t||{};var n=t.random||(t.rng||_tt)();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 cdr(n)}var wtt,mdr=v(()=>{pdr();fdr();ddr();wtt=Wio});var hdr=v(()=>{mdr()});function ydr(t,e){return new Hr({content:t.content??"",additional_kwargs:t.thinking&&t.thinking!==""?{reasoning_content:t.thinking}:{},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:wtt()})),response_metadata:{...e?.responseMetadata,model_provider:"ollama"},usage_metadata:e?.usageMetadata})}function gdr(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function Jio(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 Kio(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:[gdr(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[gdr(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function Gio(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 Xio(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function bdr(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return Kio(e);if(e._getType()==="ai")return Jio(e);if(e._getType()==="system")return Gio(e);if(e._getType()==="tool")return Xio(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var _dr=v(()=>{ra();hdr()});function Zio(t){return t&&DataView.prototype.isPrototypeOf(t)}function R8(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 Ctt(t){return typeof t!="string"&&(t=String(t)),t}function xtt(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return Vb.iterable&&(e[Symbol.iterator]=function(){return e}),e}function km(t){this.map={},t instanceof km?t.forEach(function(e,r){this.append(r,e)},this):Array.isArray(t)?t.forEach(function(e){if(e.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function Stt(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function Cdr(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function Yio(t){var e=new FileReader,r=Cdr(e);return e.readAsArrayBuffer(t),r}function Qio(t){var e=new FileReader,r=Cdr(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function eao(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 wdr(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function xdr(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:Vb.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:Vb.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:Vb.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():Vb.arrayBuffer&&Vb.blob&&Zio(t)?(this._bodyArrayBuffer=wdr(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Vb.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||Sdr(t))?this._bodyArrayBuffer=wdr(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):Vb.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},Vb.blob&&(this.blob=function(){var t=Stt(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=Stt(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(Vb.blob)return this.blob().then(Yio);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var t=Stt(this);if(t)return t;if(this._bodyBlob)return Qio(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(eao(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},Vb.formData&&(this.formData=function(){return this.text().then(nao)}),this.json=function(){return this.text().then(JSON.parse)},this}function rao(t){var e=t.toUpperCase();return tao.indexOf(e)>-1?e:t}function yV(t,e){if(!(this instanceof yV))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 yV){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new km(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 km(e.headers)),this.method=rao(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in Ug){var i=new AbortController;return i.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var o=/\?/;this.url+=(o.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}function nao(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 oao(t){var e=new km,r=t.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(`
`)===0?n.substr(1,n.length):n}).forEach(function(n){var o=n.split(":"),i=o.shift().trim();if(i){var a=o.join(":").trim();try{e.append(i,a)}catch(s){console.warn("Response "+s.message)}}}),e}function VI(t,e){if(!(this instanceof VI))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 km(e.headers),this.url=e.url||"",this._initBody(t)}function Tdr(t,e){return new Promise(function(r,n){var o=new yV(t,e);if(o.signal&&o.signal.aborted)return n(new gV("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:oao(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 VI(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 gV("Aborted","AbortError"))},0)};function s(l){try{return l===""&&Ug.location.href?Ug.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&&(Vb.blob?i.responseType="blob":Vb.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof km||Ug.Headers&&e.headers instanceof Ug.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(R8(l)),i.setRequestHeader(l,Ctt(e.headers[l]))}),o.headers.forEach(function(l,c){u.indexOf(c)===-1&&i.setRequestHeader(c,l)})}else o.headers.forEach(function(l,c){i.setRequestHeader(c,l)});o.signal&&(o.signal.addEventListener("abort",a),i.onreadystatechange=function(){i.readyState===4&&o.signal.removeEventListener("abort",a)}),i.send(typeof o._bodyInit>"u"?null:o._bodyInit)})}var Ug,Vb,vdr,Sdr,tao,iao,gV,Odr=v(()=>{Ug=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},Vb={searchParams:"URLSearchParams"in Ug,iterable:"Symbol"in Ug&&"iterator"in Symbol,blob:"FileReader"in Ug&&"Blob"in Ug&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in Ug,arrayBuffer:"ArrayBuffer"in Ug};Vb.arrayBuffer&&(vdr=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Sdr=ArrayBuffer.isView||function(t){return t&&vdr.indexOf(Object.prototype.toString.call(t))>-1});km.prototype.append=function(t,e){t=R8(t),e=Ctt(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};km.prototype.delete=function(t){delete this.map[R8(t)]};km.prototype.get=function(t){return t=R8(t),this.has(t)?this.map[t]:null};km.prototype.has=function(t){return this.map.hasOwnProperty(R8(t))};km.prototype.set=function(t,e){this.map[R8(t)]=Ctt(e)};km.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};km.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),xtt(t)};km.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),xtt(t)};km.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),xtt(t)};Vb.iterable&&(km.prototype[Symbol.iterator]=km.prototype.entries);tao=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];yV.prototype.clone=function(){return new yV(this,{body:this._bodyInit})};xdr.call(yV.prototype);xdr.call(VI.prototype);VI.prototype.clone=function(){return new VI(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new km(this.headers),url:this.url})};VI.error=function(){var t=new VI(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};iao=[301,302,303,307,308];VI.redirect=function(t,e){if(iao.indexOf(e)===-1)throw new RangeError("Invalid status code");return new VI(null,{status:e,headers:{location:t}})};gV=Ug.DOMException;try{new gV}catch{gV=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},gV.prototype=Object.create(Error.prototype),gV.prototype.constructor=gV}Tdr.polyfill=!0;Ug.fetch||(Ug.fetch=Tdr,Ug.Headers=km,Ug.Request=yV,Ug.Response=VI)});function lao(){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 cao(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 Edr,Pdr,aao,sao,uao,Ttt,Ptt,Mtt,Rtt,dao,Itt,Ott,Dk,fao,pao,mao,hao,gao,Ett,I8,uIa,Sxe=v(()=>{Odr();Edr="11434",Pdr=`http://127.0.0.1:${Edr}`,aao="0.6.3",sao=Object.defineProperty,uao=(t,e,r)=>e in t?sao(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ttt=(t,e,r)=>(uao(t,typeof e!="symbol"?e+"":e,r),r),Ptt=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)}},Mtt=class{constructor(e,r,n){Ttt(this,"abortController"),Ttt(this,"itr"),Ttt(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.")}},Rtt=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 Ptt(e,t.status)};dao=(t,e)=>t[e],Itt=async(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${aao} (${lao()})`};r.headers=cao(r.headers);try{let i=new URL(e);if(i.protocol==="https:"&&i.hostname==="ollama.com"){let a=typeof process=="object"&&process!==null&&typeof process.env=="object"&&process.env!==null?dao(process.env,"OLLAMA_API_KEY"):void 0;!(r.headers.authorization||r.headers.Authorization)&&a&&(r.headers.Authorization=`Bearer ${a}`)}}catch(i){console.error("error parsing url",i)}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)},Ott=async(t,e,r)=>{let n=await Itt(t,e,{headers:r?.headers});return await Rtt(n),n},Dk=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await Itt(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await Rtt(a),a},fao=async(t,e,r,n)=>{let o=await Itt(t,e,{method:"DELETE",body:JSON.stringify(r),headers:n?.headers});return await Rtt(o),o},pao=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,{stream:!0});let a=r.split(`
`);r=a.pop()??"";for(let s of a)try{yield JSON.parse(s)}catch{console.warn("invalid json: ",s)}}r+=e.decode();for(let o of r.split(`
`).filter(i=>i!==""))try{yield JSON.parse(o)}catch{console.warn("invalid json: ",o)}},mao=t=>{if(!t)return Pdr;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=Edr);let o="";r.username&&(o=r.username,r.password&&(o+=`:${r.password}`),o+="@");let i=`${r.protocol}//${o}${r.hostname}:${n}${r.pathname}`;return i.endsWith("/")&&(i=i.slice(0,-1)),i},hao=Object.defineProperty,gao=(t,e,r)=>e in t?hao(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ett=(t,e,r)=>(gao(t,typeof e!="symbol"?e+"":e,r),r),I8=class{constructor(e){Ett(this,"config"),Ett(this,"fetch"),Ett(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=mao(e?.host??Pdr)),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 Dk(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=pao(a.body),u=new Mtt(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await Dk(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 fao(this.fetch,`${this.config.host}/api/delete`,{name:e.model},{headers:this.config.headers}),{status:"success"}}async copy(e){return await Dk(this.fetch,`${this.config.host}/api/copy`,{...e},{headers:this.config.headers}),{status:"success"}}async list(){return await(await Ott(this.fetch,`${this.config.host}/api/tags`,{headers:this.config.headers})).json()}async show(e){return await(await Dk(this.fetch,`${this.config.host}/api/show`,{...e},{headers:this.config.headers})).json()}async embed(e){return await(await Dk(this.fetch,`${this.config.host}/api/embed`,{...e},{headers:this.config.headers})).json()}async embeddings(e){return await(await Dk(this.fetch,`${this.config.host}/api/embeddings`,{...e},{headers:this.config.headers})).json()}async ps(){return await(await Ott(this.fetch,`${this.config.host}/api/ps`,{headers:this.config.headers})).json()}async version(){return await(await Ott(this.fetch,`${this.config.host}/api/version`,{headers:this.config.headers})).json()}async webSearch(e){if(!e.query||e.query.length===0)throw new Error("Query is required");return await(await Dk(this.fetch,"https://ollama.com/api/web_search",{...e},{headers:this.config.headers})).json()}async webFetch(e){if(!e.url||e.url.length===0)throw new Error("URL is required");return await(await Dk(this.fetch,"https://ollama.com/api/web_fetch",{...e},{headers:this.config.headers})).json()}},uIa=new I8});function HI(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=L6(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new CS([`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 bV(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 vx(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var Mdr,Ow,Rdr=v(()=>{CQ();mS();zN();yJ();ZL();cWe();Mdr=class extends _J{constructor(e){super(e);x(this,"returnId",!1);x(this,"lc_namespace",["langchain","output_parsers","openai_tools"]);x(this,"lc_serializable",!0);this.returnId=e?.returnId??this.returnId}static lc_name(){return"JsonOutputToolsParser"}_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(mc(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(a=>HI(a,{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}},Ow=class extends Mdr{constructor(e){super(e);x(this,"lc_namespace",["langchain","output_parsers","openai_tools"]);x(this,"lc_serializable",!0);x(this,"returnId",!1);x(this,"keyName");x(this,"returnSingle",!1);x(this,"zodSchema");this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}static lc_name(){return"JsonOutputKeyToolsParser"}async _validateResult(e){if(this.zodSchema===void 0)return e;let r=await Wz(this.zodSchema,e);if(r.success)return r.data;throw new CS(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error?.issues)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){let r=(await super.parsePartialResult(e)).filter(o=>o.type===this.keyName),n=r;if(r.length)return this.returnId||(n=r.map(o=>o.args)),this.returnSingle?n[0]:n}async parseResult(e){let r=(await super.parsePartialResult(e,!1)).filter(o=>o.type===this.keyName),n=r;if(r.length)return this.returnId||(n=r.map(o=>o.args)),this.returnSingle?this._validateResult(n[0]):await Promise.all(n.map(o=>this._validateResult(o)))}}});var _V=v(()=>{zo();Rdr()});var Att,Idr=v(()=>{_dr();ra();aD();Sxe();xm();Qv();iD();XT();nO();_V();su();nv();Sy();Att=class extends Vy{constructor(e){super(e??{});x(this,"model","llama3");x(this,"numa");x(this,"numCtx");x(this,"numBatch");x(this,"numGpu");x(this,"mainGpu");x(this,"lowVram");x(this,"f16Kv");x(this,"logitsAll");x(this,"vocabOnly");x(this,"useMmap");x(this,"useMlock");x(this,"embeddingOnly");x(this,"numThread");x(this,"numKeep");x(this,"seed");x(this,"numPredict");x(this,"topK");x(this,"topP");x(this,"tfsZ");x(this,"typicalP");x(this,"repeatLastN");x(this,"temperature");x(this,"repeatPenalty");x(this,"presencePenalty");x(this,"frequencyPenalty");x(this,"mirostat");x(this,"mirostatTau");x(this,"mirostatEta");x(this,"penalizeNewline");x(this,"streaming");x(this,"format");x(this,"keepAlive");x(this,"client");x(this,"checkOrPullModel",!1);x(this,"baseUrl","http://127.0.0.1:11434");x(this,"think");this.baseUrl=e?.baseUrl??un("OLLAMA_BASE_URL")??this.baseUrl,this.client=new I8({fetch:e?.fetch,host:this.baseUrl,headers:e?.headers}),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.think=e?.think,this.checkOrPullModel=e?.checkOrPullModel??this.checkOrPullModel}static lc_name(){return"ChatOllama"}_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.withConfig({tools:e.map(n=>Rk(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){return{model:this.model,format:e?.format??this.format,keep_alive:this.keepAlive,think:this.think,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=>Rk(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){r.signal?.throwIfAborted(),this.checkOrPullModel&&(await this.checkModelExistsOnMachine(this.model)||await this.pull(this.model,{logProgress:!0}));let o;for await(let a of this._streamResponseChunks(e,r,n))o?o=RC(o,a.message):o=a.message;let i=new uo({id:o?.id,content:o?.content??"",additional_kwargs:o?.additional_kwargs,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=bdr(e),a={input_tokens:0,output_tokens:0,total_tokens:0},s=await this.client.chat({...o,messages:i,stream:!0}),u;for await(let l of s){if(r.signal?.aborted){this.client.abort();return}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;let f=this.think?c.thinking??c.content??"":c.content??"",p=new Mi({text:f,message:ydr(c)});yield p,await n?.handleLLMNewToken(f,void 0,void 0,void 0,void 0,{chunk:p})}yield new Mi({text:"",message:new Hr({content:"",response_metadata:{...u,model_provider:"ollama"},usage_metadata:a})})}withStructuredOutput(e,r){let n,o,{schema:i,name:a,includeRaw:s}={...r,schema:e},u=r?.method??"jsonSchema";if(u==="functionCalling"){let f=a??"extract";if(Hi(i)){let p=Ii(i);n=this.bindTools([{type:"function",function:{name:f,description:p.description,parameters:p}}]).withConfig({ls_structured_output_format:{kwargs:{method:u},schema:p}}),o=new Ow({returnSingle:!0,keyName:f,zodSchema:i})}else{let p;typeof i.name=="string"&&typeof i.parameters=="object"&&i.parameters!=null?(p=i,f=i.name):p={name:f,description:i.description??"",parameters:i},n=this.bindTools([{type:"function",function:p}]).withConfig({ls_structured_output_format:{kwargs:{method:u},schema:i}}),o=new Ow({returnSingle:!0,keyName:f})}}else if(u==="jsonMode"){o=Hi(i)?jC.fromZodSchema(i):new ew;let f=Ii(i);n=this.withConfig({format:"json",ls_structured_output_format:{kwargs:{method:u},schema:f}})}else if(u==="jsonSchema"){o=Hi(i)?jC.fromZodSchema(i):new ew;let f=Ii(i);n=this.withConfig({format:f,ls_structured_output_format:{kwargs:{method:u},schema:f}})}else throw new TypeError(`Unrecognized structured output method '${u}'. Expected one of 'functionCalling', 'jsonMode', or 'jsonSchema'`);if(!s)return n.pipe(o).withConfig({runName:"ChatOllamaStructuredOutput"});let l=pl.assign({parsed:(f,p)=>o.invoke(f.raw,p)}),c=pl.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return gc.from([{raw:n},d]).withConfig({runName:"StructuredOutputRunnable"})}}});var Ntt,Adr=v(()=>{Sxe();su();lV();Ntt=class extends bx{constructor(e){super({maxConcurrency:1,...e});x(this,"model","mxbai-embed-large");x(this,"baseUrl","http://localhost:11434");x(this,"dimensions");x(this,"keepAlive");x(this,"requestOptions");x(this,"client");x(this,"truncate",!1);this.baseUrl=e?.baseUrl??un("OLLAMA_BASE_URL")??this.baseUrl,this.client=new I8({fetch:e?.fetch,host:this.baseUrl,headers:e?.headers?new Headers(e.headers):void 0}),this.model=e?.model??this.model,this.dimensions=e?.dimensions,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,dimensions:this.dimensions,keep_alive:this.keepAlive,options:this.requestOptions,truncate:this.truncate}))).embeddings}}});var Ndr=v(()=>{Sxe();xm();su();rie()});var Dtt=v(()=>{Idr();Adr();Ndr()});function lie(t,e){return t.lc_error_code=e,t.message=`${t.message}

Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/
`,t}var Ddr=v(()=>{});function Zr(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 Pe(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var a0=v(()=>{});var jtt,$tt=v(()=>{jtt=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return jtt=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))}});function cie(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var die,Cxe=v(()=>{die=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)}});var Kt,qm,qc,jk,WI,A8,N8,D8,j8,$8,L8,F8,k8,q8,B8,JI,KI=v(()=>{Cxe();Kt=class extends Error{},qm=class t extends Kt{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("x-request-id"),this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new jk({message:n,cause:die(r)});let i=r?.error;return e===400?new A8(e,i,n,o):e===401?new N8(e,i,n,o):e===403?new D8(e,i,n,o):e===404?new j8(e,i,n,o):e===409?new $8(e,i,n,o):e===422?new L8(e,i,n,o):e===429?new F8(e,i,n,o):e>=500?new k8(e,i,n,o):new t(e,i,n,o)}},qc=class extends qm{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},jk=class extends qm{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},WI=class extends jk{constructor({message:e}={}){super({message:e??"Request timed out."})}},A8=class extends qm{},N8=class extends qm{},D8=class extends qm{},j8=class extends qm{},$8=class extends qm{},L8=class extends qm{},F8=class extends qm{},k8=class extends qm{},q8=class extends Kt{constructor(){super("Could not parse response content as the length limit was reached")}},B8=class extends Kt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},JI=class extends Error{constructor(e){super(e)}}});function Ftt(t){return typeof t!="object"?{}:t??{}}function $dr(t){if(!t)return!0;for(let e in t)return!1;return!0}function Ldr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function U8(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var bao,jdr,Hy,Ltt,Fdr,kdr,uD=v(()=>{KI();bao=/^[a-z][a-z0-9+.-]*:/i,jdr=t=>bao.test(t),Hy=t=>(Hy=Array.isArray,Hy(t)),Ltt=Hy;Fdr=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Kt(`${t} must be an integer`);if(e<0)throw new Kt(`${t} must be a positive integer`);return e},kdr=t=>{try{return JSON.parse(t)}catch{return}}});var GI,z8=v(()=>{GI=t=>new Promise(e=>setTimeout(e,t))});var $k,ktt=v(()=>{$k="6.16.0"});function _ao(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}function wao(){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 zdr,vao,qdr,Bdr,Udr,Vdr,qtt=v(()=>{ktt();zdr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";vao=()=>{let t=_ao();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$k,"X-Stainless-OS":Bdr(Deno.build.os),"X-Stainless-Arch":qdr(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":$k,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$k,"X-Stainless-OS":Bdr(globalThis.process.platform??"unknown"),"X-Stainless-Arch":qdr(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=wao();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$k,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$k,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};qdr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Bdr=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"),Vdr=()=>Udr??(Udr=vao())});function Hdr(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Btt(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function xxe(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return Btt({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function Utt(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Wdr(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var fie=v(()=>{});var Jdr,Kdr=v(()=>{Jdr=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});var Txe,ztt,Oxe,Vtt,Exe=v(()=>{Txe="RFC3986",ztt=t=>String(t),Oxe={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:ztt},Vtt="RFC1738"});function Xdr(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function Wtt(t,e){if(Hy(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var Pxe,XI,Htt,Gdr,Zdr=v(()=>{Exe();uD();Pxe=(t,e)=>(Pxe=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Pxe(t,e)),XI=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),Htt=1024,Gdr=(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+=Htt){let u=i.length>=Htt?i.slice(s,s+Htt):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===Vtt&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=XI[d];continue}if(d<2048){l[l.length]=XI[192|d>>6]+XI[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=XI[224|d>>12]+XI[128|d>>6&63]+XI[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=XI[240|d>>18]+XI[128|d>>12&63]+XI[128|d>>6&63]+XI[128|d&63]}a+=l.join("")}return a}});function xao(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function tfr(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,y,g){let b=t,_=g,w=0,T=!1;for(;(_=_.get(Jtt))!==void 0&&!T;){let I=_.get(t);if(w+=1,typeof I<"u"){if(I===w)throw new RangeError("Cyclic object value");T=!0}typeof _.get(Jtt)>"u"&&(w=0)}if(typeof l=="function"?b=l(e,b):b instanceof Date?b=f?.(b):r==="comma"&&Hy(b)&&(b=Wtt(b,function(I){return I instanceof Date?f?.(I):I})),b===null){if(i)return u&&!h?u(e,Bm.encoder,y,"key",p):e;b=""}if(xao(b)||Xdr(b)){if(u){let I=h?e:u(e,Bm.encoder,y,"key",p);return[m?.(I)+"="+m?.(u(b,Bm.encoder,y,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let O=[];if(typeof b>"u")return O;let E;if(r==="comma"&&Hy(b))h&&u&&(b=Wtt(b,u)),E=[{value:b.length>0?b.join(",")||null:void 0}];else if(Hy(l))E=l;else{let I=Object.keys(b);E=c?I.sort(c):I}let P=s?String(e).replace(/\./g,"%2E"):String(e),R=n&&Hy(b)&&b.length===1?P+"[]":P;if(o&&Hy(b)&&b.length===0)return R+"[]";for(let I=0;I<E.length;++I){let A=E[I],B=typeof A=="object"&&typeof A.value<"u"?A.value:b[A];if(a&&B===null)continue;let k=d&&s?A.replace(/\./g,"%2E"):A,q=Hy(b)?typeof r=="function"?r(R,k):R:R+(d?"."+k:"["+k+"]");g.set(t,w);let Z=new WeakMap;Z.set(Jtt,g),efr(O,tfr(B,q,r,n,o,i,a,s,r==="comma"&&h&&Hy(b)?null:u,l,c,d,f,p,m,h,y,Z))}return O}function Tao(t=Bm){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||Bm.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=Txe;if(typeof t.format<"u"){if(!Pxe(Oxe,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=Oxe[r],o=Bm.filter;(typeof t.filter=="function"||Hy(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in Qdr?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=Bm.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:Bm.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Bm.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Bm.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Bm.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Bm.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Bm.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Bm.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Bm.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Bm.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Bm.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Bm.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Bm.strictNullHandling}}function Ktt(t,e={}){let r=t,n=Tao(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Hy(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=Qdr[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||efr(a,tfr(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 Qdr,efr,Ydr,Bm,Jtt,rfr=v(()=>{Zdr();Exe();uD();Qdr={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},efr=function(t,e){Array.prototype.push.apply(t,Hy(e)?e:[e])},Bm={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Gdr,encodeValuesOnly:!1,format:Txe,formatter:ztt,indices:!1,serializeDate(t){return(Ydr??(Ydr=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};Jtt={}});var nfr=v(()=>{Exe();rfr()});function afr(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}function V8(t){let e;return(ofr??(e=new globalThis.TextEncoder,ofr=e.encode.bind(e)))(t)}function Gtt(t){let e;return(ifr??(e=new globalThis.TextDecoder,ifr=e.decode.bind(e)))(t)}var ofr,ifr,Mxe=v(()=>{});function Eao(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 sfr(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var Ew,Pw,vV,ufr=v(()=>{a0();Mxe();vV=class{constructor(){Ew.set(this,void 0),Pw.set(this,void 0),Zr(this,Ew,new Uint8Array,"f"),Zr(this,Pw,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?V8(e):e;Zr(this,Ew,afr([Pe(this,Ew,"f"),r]),"f");let n=[],o;for(;(o=Eao(Pe(this,Ew,"f"),Pe(this,Pw,"f")))!=null;){if(o.carriage&&Pe(this,Pw,"f")==null){Zr(this,Pw,o.index,"f");continue}if(Pe(this,Pw,"f")!=null&&(o.index!==Pe(this,Pw,"f")+1||o.carriage)){n.push(Gtt(Pe(this,Ew,"f").subarray(0,Pe(this,Pw,"f")-1))),Zr(this,Ew,Pe(this,Ew,"f").subarray(Pe(this,Pw,"f")),"f"),Zr(this,Pw,null,"f");continue}let i=Pe(this,Pw,"f")!==null?o.preceding-1:o.preceding,a=Gtt(Pe(this,Ew,"f").subarray(0,i));n.push(a),Zr(this,Ew,Pe(this,Ew,"f").subarray(o.index),"f"),Zr(this,Pw,null,"f")}return n}flush(){return Pe(this,Ew,"f").length?this.decode(`
`):[]}};Ew=new WeakMap,Pw=new WeakMap;vV.NEWLINE_CHARS=new Set([`
`,"\r"]);vV.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function pie(){}function Rxe(t,e,r){return!e||Ixe[t]>Ixe[r]?pie:e[t].bind(e)}function cd(t){let e=t.logger,r=t.logLevel??"off";if(!e)return Pao;let n=lfr.get(e);if(n&&n[0]===r)return n[1];let o={error:Rxe("error",e,r),warn:Rxe("warn",e,r),info:Rxe("info",e,r),debug:Rxe("debug",e,r)};return lfr.set(e,[r,o]),o}var Ixe,Xtt,Pao,lfr,lD,mie=v(()=>{uD();Ixe={off:0,error:200,warn:300,info:400,debug:500},Xtt=(t,e,r)=>{if(t){if(Ldr(Ixe,t))return t;cd(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Ixe))}`)}};Pao={error:pie,warn:pie,info:pie,debug:pie},lfr=new WeakMap;lD=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t)});async function*Mao(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new Kt("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new Kt("Attempted to iterate over a response with no body");let r=new Ztt,n=new vV,o=Utt(t.body);for await(let i of Rao(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*Rao(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"?V8(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=sfr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function Iao(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var hie,ZI,Ztt,Ytt=v(()=>{a0();KI();fie();ufr();fie();Cxe();Mxe();mie();KI();ZI=class t{constructor(e,r,n){this.iterator=e,hie.set(this,void 0),this.controller=r,Zr(this,hie,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?cd(n):console;async function*a(){if(o)throw new Kt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of Mao(e,r))if(!s){if(u.data.startsWith("[DONE]")){s=!0;continue}if(u.event===null||!u.event.startsWith("thread.")){let l;try{l=JSON.parse(u.data)}catch(c){throw i.error("Could not parse message into JSON:",u.data),i.error("From chunk:",u.raw),c}if(l&&l.error)throw new qm(void 0,l.error,void 0,e.headers);yield l}else{let l;try{l=JSON.parse(u.data)}catch(c){throw console.error("Could not parse message into JSON:",u.data),console.error("From chunk:",u.raw),c}if(u.event=="error")throw new qm(void 0,l.error,l.message,void 0);yield{event:u.event,data:l}}}s=!0}catch(u){if(cie(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*i(){let s=new vV,u=Utt(e);for await(let l of u)for(let c of s.decode(l))yield c;for(let l of s.flush())yield l}async function*a(){if(o)throw new Kt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of i())s||u&&(yield JSON.parse(u));s=!0}catch(u){if(cie(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}[(hie=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller,Pe(this,hie,"f")),new t(()=>o(r),this.controller,Pe(this,hie,"f"))]}toReadableStream(){let e=this,r;return Btt({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:i}=await r.next();if(i)return n.close();let a=V8(JSON.stringify(o)+`
`);n.enqueue(a)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};Ztt=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]=Iao(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function Axe(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,a=await(async()=>{if(e.options.stream)return cd(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):ZI.fromSSEResponse(r,e.controller,t);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let u=r.headers.get("content-type")?.split(";")[0]?.trim();if(u?.includes("application/json")||u?.endsWith("+json")){let d=await r.json();return Qtt(d,r)}return await r.text()})();return cd(t).debug(`[${n}] response parsed`,lD({retryOfRequestLogID:o,url:r.url,status:r.status,body:a,durationMs:Date.now()-i})),a}function Qtt(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 ert=v(()=>{Ytt();mie()});var gie,wV,Nxe=v(()=>{a0();ert();wV=class t extends Promise{constructor(e,r,n=Axe){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,gie.set(this,void 0),Zr(this,gie,e,"f")}_thenUnwrap(e){return new t(Pe(this,gie,"f"),this.responsePromise,async(r,n)=>Qtt(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(Pe(this,gie,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};gie=new WeakMap});var Dxe,yie,bie,YI,ui,cD,Fu=v(()=>{a0();KI();ert();Nxe();uD();yie=class{constructor(e,r,n,o){Dxe.set(this,void 0),Zr(this,Dxe,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new Kt("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await Pe(this,Dxe,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Dxe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},bie=class extends wV{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await Axe(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},YI=class extends yie{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},ui=class extends yie{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),r=e[e.length-1]?.id;return r?{...this.options,query:{...Ftt(this.options.query),after:r}}:null}},cD=class extends yie{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1,this.last_id=n.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.last_id;return e?{...this.options,query:{...Ftt(this.options.query),after:e}}:null}}});function H8(t,e,r){return nrt(),new File(t,e??"unknown_file",r)}function _ie(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}function Nao(t){let e=typeof t=="function"?t:t.fetch,r=cfr.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new o(i).text()}catch{return!0}})();return cfr.set(e,n),n}var nrt,jxe,ort,Mw,cfr,dfr,ffr,Dao,trt,rrt,QI=v(()=>{fie();nrt=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};jxe=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",ort=async(t,e)=>trt(t.body)?{...t,body:await dfr(t.body,e)}:t,Mw=async(t,e)=>({...t,body:await dfr(t.body,e)}),cfr=new WeakMap;dfr=async(t,e)=>{if(!await Nao(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>rrt(r,n,o))),r},ffr=t=>t instanceof Blob&&"name"in t,Dao=t=>typeof t=="object"&&t!==null&&(t instanceof Response||jxe(t)||ffr(t)),trt=t=>{if(Dao(t))return!0;if(Array.isArray(t))return t.some(trt);if(t&&typeof t=="object"){for(let e in t)if(trt(t[e]))return!0}return!1},rrt=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response)t.append(e,H8([await r.blob()],_ie(r)));else if(jxe(r))t.append(e,H8([await new Response(xxe(r)).blob()],_ie(r)));else if(ffr(r))t.append(e,r,_ie(r));else if(Array.isArray(r))await Promise.all(r.map(n=>rrt(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>rrt(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}}});async function vie(t,e,r){if(nrt(),t=await t,jao(t))return t instanceof File?t:H8([await t.arrayBuffer()],t.name);if($ao(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),H8(await irt(o),e,r)}let n=await irt(t);if(e||(e=_ie(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return H8(n,e,r)}async function irt(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(pfr(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(jxe(t))for await(let r of t)e.push(...await irt(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${Lao(t)}`)}return e}function Lao(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var pfr,jao,$ao,mfr=v(()=>{QI();QI();pfr=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",jao=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&pfr(t),$ao=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function"});var art=v(()=>{mfr()});var Ke,Jr=v(()=>{Ke=class{constructor(e){this._client=e}}});function gfr(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var hfr,kao,ke,ss=v(()=>{KI();hfr=Object.freeze(Object.create(null)),kao=(t=gfr)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],a=r.reduce((c,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=n[f],m=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??hfr)??hfr)?.toString)&&(m=p+"",i.push({start:c.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),c+d+(f===n.length?"":m)},""),s=a.split(/[?#]/,1)[0],u=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;for(;(l=u.exec(s))!==null;)i.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can't be safely passed as a path parameter`});if(i.sort((c,d)=>c.start-d.start),i.length>0){let c=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-c),h="^".repeat(p.length);return c=p.start+p.length,f+m+h},"");throw new Kt(`Path parameters result in path with invalid segments:
${i.map(f=>f.error).join(`
`)}
${a}
${d}`)}return a},ke=kao(gfr)});var SV,$xe=v(()=>{Jr();Fu();ss();SV=class extends Ke{list(e,r={},n){return this._client.getAPIList(ke`/chat/completions/${e}/messages`,ui,{query:r,...n})}}});var wx=v(()=>{KI()});function wie(t){return t!==void 0&&"function"in t&&t.function!==void 0}function yfr(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function Sie(t){return t?.$brand==="auto-parseable-response-format"}function CV(t){return t?.$brand==="auto-parseable-tool"}function bfr(t,e){return!e||!srt(e)?{...t,choices:t.choices.map(r=>(vfr(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:Cie(t,e)}function Cie(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new q8;if(n.finish_reason==="content_filter")throw new B8;return vfr(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>zao(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?Uao(e,n.message.content):null}}});return{...t,choices:r}}function Uao(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 zao(t,e){let r=t.tools?.find(n=>wie(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:CV(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function _fr(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>wie(n)&&n.function?.name===e.function.name);return wie(r)&&(CV(r)||r?.function.strict||!1)}function srt(t){return Sie(t.response_format)?!0:t.tools?.some(e=>CV(e)||e.type==="function"&&e.function.strict===!0)??!1}function vfr(t){for(let e of t||[])if(e.type!=="function")throw new Kt(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function wfr(t){for(let e of t??[]){if(e.type!=="function")throw new Kt(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new Kt(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var W8=v(()=>{wx()});var J8,urt,lrt=v(()=>{J8=t=>t?.role==="assistant",urt=t=>t?.role==="tool"});var crt,Lxe,Fxe,xie,Tie,kxe,Oie,dD,Eie,qxe,Bxe,K8,Sfr,Lk,Uxe=v(()=>{a0();wx();Lk=class{constructor(){crt.add(this),this.controller=new AbortController,Lxe.set(this,void 0),Fxe.set(this,()=>{}),xie.set(this,()=>{}),Tie.set(this,void 0),kxe.set(this,()=>{}),Oie.set(this,()=>{}),dD.set(this,{}),Eie.set(this,!1),qxe.set(this,!1),Bxe.set(this,!1),K8.set(this,!1),Zr(this,Lxe,new Promise((e,r)=>{Zr(this,Fxe,e,"f"),Zr(this,xie,r,"f")}),"f"),Zr(this,Tie,new Promise((e,r)=>{Zr(this,kxe,e,"f"),Zr(this,Oie,r,"f")}),"f"),Pe(this,Lxe,"f").catch(()=>{}),Pe(this,Tie,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},Pe(this,crt,"m",Sfr).bind(this))},0)}_connected(){this.ended||(Pe(this,Fxe,"f").call(this),this._emit("connect"))}get ended(){return Pe(this,Eie,"f")}get errored(){return Pe(this,qxe,"f")}get aborted(){return Pe(this,Bxe,"f")}abort(){this.controller.abort()}on(e,r){return(Pe(this,dD,"f")[e]||(Pe(this,dD,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Pe(this,dD,"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(Pe(this,dD,"f")[e]||(Pe(this,dD,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Zr(this,K8,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Zr(this,K8,!0,"f"),await Pe(this,Tie,"f")}_emit(e,...r){if(Pe(this,Eie,"f"))return;e==="end"&&(Zr(this,Eie,!0,"f"),Pe(this,kxe,"f").call(this));let n=Pe(this,dD,"f")[e];if(n&&(Pe(this,dD,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Pe(this,K8,"f")&&!n?.length&&Promise.reject(o),Pe(this,xie,"f").call(this,o),Pe(this,Oie,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Pe(this,K8,"f")&&!n?.length&&Promise.reject(o),Pe(this,xie,"f").call(this,o),Pe(this,Oie,"f").call(this,o),this._emit("end")}}_emitFinal(){}};Lxe=new WeakMap,Fxe=new WeakMap,xie=new WeakMap,Tie=new WeakMap,kxe=new WeakMap,Oie=new WeakMap,dD=new WeakMap,Eie=new WeakMap,qxe=new WeakMap,Bxe=new WeakMap,K8=new WeakMap,crt=new WeakSet,Sfr=function(e){if(Zr(this,qxe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new qc),e instanceof qc)return Zr(this,Bxe,!0,"f"),this._emit("abort",e);if(e instanceof Kt)return this._emit("error",e);if(e instanceof Error){let r=new Kt(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Kt(String(e)))}});function Cfr(t){return typeof t.parse=="function"}var drt=v(()=>{});var Hb,frt,zxe,prt,mrt,hrt,xfr,Tfr,Vao,G8,grt=v(()=>{a0();wx();W8();lrt();Uxe();drt();Vao=10,G8=class extends Lk{constructor(){super(...arguments),Hb.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),urt(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(J8(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionToolCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new Kt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),Pe(this,Hb,"m",frt).call(this)}async finalMessage(){return await this.done(),Pe(this,Hb,"m",zxe).call(this)}async finalFunctionToolCall(){return await this.done(),Pe(this,Hb,"m",prt).call(this)}async finalFunctionToolCallResult(){return await this.done(),Pe(this,Hb,"m",mrt).call(this)}async totalUsage(){return await this.done(),Pe(this,Hb,"m",hrt).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=Pe(this,Hb,"m",zxe).call(this);r&&this._emit("finalMessage",r);let n=Pe(this,Hb,"m",frt).call(this);n&&this._emit("finalContent",n);let o=Pe(this,Hb,"m",prt).call(this);o&&this._emit("finalFunctionToolCall",o);let i=Pe(this,Hb,"m",mrt).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",Pe(this,Hb,"m",hrt).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Pe(this,Hb,"m",xfr).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(Cie(i,r))}async _runChatCompletion(e,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,r,n)}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i.type==="function"&&i?.function?.name,{maxChatCompletions:l=Vao}=n||{},c=r.tools.map(p=>{if(CV(p)){if(!p.$callback)throw new Kt("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 Kt("missing message in ChatCompletion response");if(!h.tool_calls?.length)return;for(let y of h.tool_calls){if(y.type!=="function")continue;let g=y.id,{name:b,arguments:_}=y.function,w=d[b];if(w){if(u&&u!==b){let P=`Invalid tool_call: ${JSON.stringify(b)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:g,content:P});continue}}else{let P=`Invalid tool_call: ${JSON.stringify(b)}. Available options are: ${Object.keys(d).map(R=>JSON.stringify(R)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:P});continue}let T;try{T=Cfr(w)?await w.parse(_):_}catch(P){let R=P instanceof Error?P.message:String(P);this._addMessage({role:o,tool_call_id:g,content:R});continue}let O=await w.function(T,this),E=Pe(this,Hb,"m",Tfr).call(this,O);if(this._addMessage({role:o,tool_call_id:g,content:E}),u)return}}}};Hb=new WeakSet,frt=function(){return Pe(this,Hb,"m",zxe).call(this).content??null},zxe=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(J8(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new Kt("stream ended without producing a ChatCompletionMessage with role=assistant")},prt=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(J8(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},mrt=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(urt(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}},hrt=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},xfr=function(e){if(e.n!=null&&e.n>1)throw new Kt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},Tfr=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var Pie,yrt=v(()=>{grt();lrt();Pie=class t extends G8{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),J8(e)&&e.content&&this._emit("content",e.content)}}});function Hao(t,e=Fh.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return Wao(t.trim(),e)}var Fh,brt,_rt,Wao,vrt,Ofr=v(()=>{Fh={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},brt=class extends Error{},_rt=class extends Error{};Wao=(t,e)=>{let r=t.length,n=0,o=f=>{throw new brt(`${f} at position ${n}`)},i=f=>{throw new _rt(`${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"||Fh.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Fh.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Fh.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Fh.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Fh.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||Fh.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(Fh.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&&Fh.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(Fh.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Fh.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(Fh.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&Fh.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Fh.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&&!(Fh.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Fh.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()},vrt=t=>Hao(t,Fh.ALL^Fh.NUM)});var wrt=v(()=>{Ytt()});function Jao(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 Kt(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:y,...g}=l,b=l.role;if(!b)throw new Kt(`missing role for choice ${d}`);if(h){let{arguments:_,name:w}=h;if(_==null)throw new Kt(`missing function_call.arguments for choice ${d}`);if(!w)throw new Kt(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:_,name:w},role:b,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return y?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:b,content:m,refusal:l.refusal??null,tool_calls:y.map((_,w)=>{let{function:T,type:O,id:E,...P}=_,{arguments:R,name:I,...A}=T||{};if(E==null)throw new Kt(`missing choices[${d}].tool_calls[${w}].id
${Wxe(t)}`);if(O==null)throw new Kt(`missing choices[${d}].tool_calls[${w}].type
${Wxe(t)}`);if(I==null)throw new Kt(`missing choices[${d}].tool_calls[${w}].function.name
${Wxe(t)}`);if(R==null)throw new Kt(`missing choices[${d}].tool_calls[${w}].function.arguments
${Wxe(t)}`);return{...P,id:E,type:O,function:{...A,name:I,arguments:R}}})}}:{...p,message:{...g,content:m,role:b,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return bfr(u,e)}function Wxe(t){return JSON.stringify(t)}var Um,fD,X8,Fk,Srt,Vxe,Crt,xrt,Trt,Hxe,Ort,Efr,xV,Jxe=v(()=>{a0();Ofr();wx();W8();wrt();grt();xV=class t extends G8{constructor(e){super(),Um.add(this),fD.set(this,void 0),X8.set(this,void 0),Fk.set(this,void 0),Zr(this,fD,e,"f"),Zr(this,X8,[],"f")}get currentChatCompletionSnapshot(){return Pe(this,Fk,"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())),Pe(this,Um,"m",Srt).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)Pe(this,Um,"m",Crt).call(this,a);if(i.controller.signal?.aborted)throw new qc;return this._addChatCompletion(Pe(this,Um,"m",Hxe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Pe(this,Um,"m",Srt).call(this),this._connected();let o=ZI.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(Pe(this,Um,"m",Hxe).call(this)),Pe(this,Um,"m",Crt).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new qc;return this._addChatCompletion(Pe(this,Um,"m",Hxe).call(this))}[(fD=new WeakMap,X8=new WeakMap,Fk=new WeakMap,Um=new WeakSet,Srt=function(){this.ended||Zr(this,Fk,void 0,"f")},Vxe=function(r){let n=Pe(this,X8,"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},Pe(this,X8,"f")[r.index]=n,n)},Crt=function(r){if(this.ended)return;let n=Pe(this,Um,"m",Efr).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=Pe(this,Um,"m",Vxe).call(this,i);i.finish_reason&&(Pe(this,Um,"m",Trt).call(this,i),a.current_tool_call_index!=null&&Pe(this,Um,"m",xrt).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(Pe(this,Um,"m",Trt).call(this,i),a.current_tool_call_index!=null&&Pe(this,Um,"m",xrt).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))}}},xrt=function(r,n){if(Pe(this,Um,"m",Vxe).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=Pe(this,fD,"f")?.tools?.find(s=>wie(s)&&s.function.name===i.function.name);this._emit("tool_calls.function.arguments.done",{name:i.function.name,index:n,arguments:i.function.arguments,parsed_arguments:CV(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Trt=function(r){let n=Pe(this,Um,"m",Vxe).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=Pe(this,Um,"m",Ort).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}))},Hxe=function(){if(this.ended)throw new Kt("stream has ended, this shouldn't happen");let r=Pe(this,Fk,"f");if(!r)throw new Kt("request ended without sending any chunks");return Zr(this,Fk,void 0,"f"),Zr(this,X8,[],"f"),Jao(r,Pe(this,fD,"f"))},Ort=function(){let r=Pe(this,fD,"f")?.response_format;return Sie(r)?r:null},Efr=function(r){var n,o,i,a;let s=Pe(this,Fk,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=Zr(this,Fk,{...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:O,refusal:E,...P}=p;Object.assign(h.logprobs,P),O&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...O)),E&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...E))}if(d&&(h.finish_reason=d,Pe(this,fD,"f")&&srt(Pe(this,fD,"f")))){if(d==="length")throw new q8;if(d==="content_filter")throw new B8}if(Object.assign(h,m),!c)continue;let{content:y,refusal:g,function_call:b,role:_,tool_calls:w,...T}=c;if(Object.assign(h.message,T),g&&(h.message.refusal=(h.message.refusal||"")+g),_&&(h.message.role=_),b&&(h.message.function_call?(b.name&&(h.message.function_call.name=b.name),b.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=b.arguments)):h.message.function_call=b),y&&(h.message.content=(h.message.content||"")+y,!h.message.refusal&&Pe(this,Um,"m",Ort).call(this)&&(h.message.parsed=vrt(h.message.content))),w){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:O,id:E,type:P,function:R,...I}of w){let A=(a=h.message.tool_calls)[O]??(a[O]={});Object.assign(A,I),E&&(A.id=E),P&&(A.type=P),R&&(A.function??(A.function={name:R.name??"",arguments:""})),R?.name&&(A.function.name=R.name),R?.arguments&&(A.function.arguments+=R.arguments,_fr(Pe(this,fD,"f"),A)&&(A.function.parsed_arguments=vrt(A.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 ZI(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var Mie,Ert=v(()=>{Jxe();Mie=class t extends xV{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runTools(e,r,n){let o=new t(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}}});var pD,Rie=v(()=>{Jr();$xe();$xe();Fu();ss();yrt();Ert();Jxe();W8();Ert();drt();Jxe();yrt();pD=class extends Ke{constructor(){super(...arguments),this.messages=new SV(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(ke`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(ke`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",ui,{query:e,...r})}delete(e,r){return this._client.delete(ke`/chat/completions/${e}`,r)}parse(e,r){return wfr(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>Cie(n,e))}runTools(e,r){return e.stream?Mie.runTools(this._client,e,r):Pie.runTools(this._client,e,r)}stream(e,r){return xV.createChatCompletion(this._client,e,r)}};pD.Messages=SV});var kk,Prt=v(()=>{Jr();Rie();Rie();kk=class extends Ke{constructor(){super(...arguments),this.completions=new pD(this._client)}};kk.Completions=pD});var Pfr=v(()=>{Rie();Rie();$xe()});var Mfr=v(()=>{Prt();Pfr()});var Rfr=v(()=>{});function*Gao(t){if(!t)return;if(Ifr in t){let{values:n,nulls:o}=t;yield*n.entries();for(let i of o)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():Ltt(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=Ltt(n[1])?n[1]:[n[1]],a=!1;for(let s of i)s!==void 0&&(e&&!a&&(a=!0,yield[o,null]),yield[o,s])}}var Ifr,gt,Gl=v(()=>{uD();Ifr=Symbol("brand.privateNullableHeaders");gt=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,a]of Gao(n)){let s=i.toLowerCase();o.has(s)||(e.delete(i),o.add(s)),a===null?(e.delete(i),r.add(s)):(e.append(i,a),r.delete(s))}}return{[Ifr]:!0,values:e,nulls:r}}});var Z8,Mrt=v(()=>{Jr();Gl();Z8=class extends Ke{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:gt([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}}});var Y8,Rrt=v(()=>{Jr();QI();Y8=class extends Ke{create(e,r){return this._client.post("/audio/transcriptions",Mw({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}}});var Q8,Irt=v(()=>{Jr();QI();Q8=class extends Ke{create(e,r){return this._client.post("/audio/translations",Mw({body:e,...r,__metadata:{model:e.model}},this._client))}}});var eA,Art=v(()=>{Jr();Mrt();Mrt();Rrt();Rrt();Irt();Irt();eA=class extends Ke{constructor(){super(...arguments),this.transcriptions=new Y8(this._client),this.translations=new Q8(this._client),this.speech=new Z8(this._client)}};eA.Transcriptions=Y8;eA.Translations=Q8;eA.Speech=Z8});var TV,Nrt=v(()=>{Jr();Fu();ss();TV=class extends Ke{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(ke`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",ui,{query:e,...r})}cancel(e,r){return this._client.post(ke`/batches/${e}/cancel`,r)}}});var eG,Drt=v(()=>{Jr();Fu();Gl();ss();eG=class extends Ke{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(ke`/assistants/${e}`,{...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(ke`/assistants/${e}`,{body:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",ui,{query:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(ke`/assistants/${e}`,{...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var tG,jrt=v(()=>{Jr();Gl();tG=class extends Ke{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var rG,$rt=v(()=>{Jr();Gl();rG=class extends Ke{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var qk,Lrt=v(()=>{Jr();jrt();jrt();$rt();$rt();qk=class extends Ke{constructor(){super(...arguments),this.sessions=new tG(this._client),this.transcriptionSessions=new rG(this._client)}};qk.Sessions=tG;qk.TranscriptionSessions=rG});var nG,Frt=v(()=>{Jr();Gl();ss();nG=class extends Ke{create(e,r){return this._client.post("/chatkit/sessions",{body:e,...r,headers:gt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}cancel(e,r){return this._client.post(ke`/chatkit/sessions/${e}/cancel`,{...r,headers:gt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}}});var oG,krt=v(()=>{Jr();Fu();Gl();ss();oG=class extends Ke{retrieve(e,r){return this._client.get(ke`/chatkit/threads/${e}`,{...r,headers:gt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}list(e={},r){return this._client.getAPIList("/chatkit/threads",cD,{query:e,...r,headers:gt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}delete(e,r){return this._client.delete(ke`/chatkit/threads/${e}`,{...r,headers:gt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}listItems(e,r={},n){return this._client.getAPIList(ke`/chatkit/threads/${e}/items`,cD,{query:r,...n,headers:gt([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers])})}}});var Bk,qrt=v(()=>{Jr();Frt();Frt();krt();krt();Bk=class extends Ke{constructor(){super(...arguments),this.sessions=new nG(this._client),this.threads=new oG(this._client)}};Bk.Sessions=nG;Bk.Threads=oG});var iG,Brt=v(()=>{Jr();Fu();Gl();ss();iG=class extends Ke{create(e,r,n){return this._client.post(ke`/threads/${e}/messages`,{body:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(ke`/threads/${o}/messages/${e}`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(ke`/threads/${o}/messages/${e}`,{body:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(ke`/threads/${e}/messages`,ui,{query:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(ke`/threads/${o}/messages/${e}`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var aG,Urt=v(()=>{Jr();Fu();Gl();ss();aG=class extends Ke{retrieve(e,r,n){let{thread_id:o,run_id:i,...a}=r;return this._client.get(ke`/threads/${o}/runs/${i}/steps/${e}`,{query:a,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r,n){let{thread_id:o,...i}=r;return this._client.getAPIList(ke`/threads/${o}/runs/${e}/steps`,ui,{query:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var Afr,Nfr=v(()=>{KI();Mxe();Afr=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=e.charCodeAt(o);return Array.from(new Float32Array(n.buffer))}}});var Sx,zrt=v(()=>{Sx=t=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()}});var Iie=v(()=>{uD();Nfr();zrt();mie();$tt();z8()});var zg,EV,Vrt,tA,Kxe,Cx,PV,sG,OV,Zxe,Rw,Gxe,Xxe,Die,Aie,Nie,Dfr,jfr,$fr,Lfr,Ffr,kfr,qfr,mD,Hrt=v(()=>{a0();wrt();wx();Uxe();Iie();mD=class extends Lk{constructor(){super(...arguments),zg.add(this),Vrt.set(this,[]),tA.set(this,{}),Kxe.set(this,{}),Cx.set(this,void 0),PV.set(this,void 0),sG.set(this,void 0),OV.set(this,void 0),Zxe.set(this,void 0),Rw.set(this,void 0),Gxe.set(this,void 0),Xxe.set(this,void 0),Die.set(this,void 0)}[(Vrt=new WeakMap,tA=new WeakMap,Kxe=new WeakMap,Cx=new WeakMap,PV=new WeakMap,sG=new WeakMap,OV=new WeakMap,Zxe=new WeakMap,Rw=new WeakMap,Gxe=new WeakMap,Xxe=new WeakMap,Die=new WeakMap,zg=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 EV;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=ZI.fromReadableStream(e,this.controller);for await(let i of o)Pe(this,zg,"m",Aie).call(this,i);if(o.controller.signal?.aborted)throw new qc;return this._addRun(Pe(this,zg,"m",Nie).call(this))}toReadableStream(){return new ZI(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new EV;return i._run(()=>i._runToolAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let a={...n,stream:!0},s=await e.submitToolOutputs(r,a,{...o,signal:this.controller.signal});this._connected();for await(let u of s)Pe(this,zg,"m",Aie).call(this,u);if(s.controller.signal?.aborted)throw new qc;return this._addRun(Pe(this,zg,"m",Nie).call(this))}static createThreadAssistantStream(e,r,n){let o=new EV;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 EV;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return Pe(this,Gxe,"f")}currentRun(){return Pe(this,Xxe,"f")}currentMessageSnapshot(){return Pe(this,Cx,"f")}currentRunStepSnapshot(){return Pe(this,Die,"f")}async finalRunSteps(){return await this.done(),Object.values(Pe(this,tA,"f"))}async finalMessages(){return await this.done(),Object.values(Pe(this,Kxe,"f"))}async finalRun(){if(await this.done(),!Pe(this,PV,"f"))throw Error("Final run was not received.");return Pe(this,PV,"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)Pe(this,zg,"m",Aie).call(this,s);if(a.controller.signal?.aborted)throw new qc;return this._addRun(Pe(this,zg,"m",Nie).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)Pe(this,zg,"m",Aie).call(this,u);if(s.controller.signal?.aborted)throw new qc;return this._addRun(Pe(this,zg,"m",Nie).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(U8(i)&&U8(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(!U8(a))throw new Error(`Expected array delta entry to be an object but got: ${a}`);let s=a.index;if(s==null)throw console.error(a),new Error("Expected array delta entry to have an `index` property");if(typeof s!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${s}`);let u=i[s];u==null?i.push(a):i[s]=this.accumulateDelta(u,a)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${o}, accValue: ${i}`);e[n]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,r,n){return await this._createThreadAssistantStream(r,e,n)}async _runAssistantStream(e,r,n,o){return await this._createAssistantStream(r,e,n,o)}async _runToolAssistantStream(e,r,n,o){return await this._createToolAssistantStream(r,e,n,o)}};EV=mD,Aie=function(e){if(!this.ended)switch(Zr(this,Gxe,e,"f"),Pe(this,zg,"m",$fr).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":Pe(this,zg,"m",qfr).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":Pe(this,zg,"m",jfr).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":Pe(this,zg,"m",Dfr).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},Nie=function(){if(this.ended)throw new Kt("stream has ended, this shouldn't happen");if(!Pe(this,PV,"f"))throw Error("Final run has not been received");return Pe(this,PV,"f")},Dfr=function(e){let[r,n]=Pe(this,zg,"m",Ffr).call(this,e,Pe(this,Cx,"f"));Zr(this,Cx,r,"f"),Pe(this,Kxe,"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!=Pe(this,sG,"f")){if(Pe(this,OV,"f"))switch(Pe(this,OV,"f").type){case"text":this._emit("textDone",Pe(this,OV,"f").text,Pe(this,Cx,"f"));break;case"image_file":this._emit("imageFileDone",Pe(this,OV,"f").image_file,Pe(this,Cx,"f"));break}Zr(this,sG,o.index,"f")}Zr(this,OV,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(Pe(this,sG,"f")!==void 0){let o=e.data.content[Pe(this,sG,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,Pe(this,Cx,"f"));break;case"text":this._emit("textDone",o.text,Pe(this,Cx,"f"));break}}Pe(this,Cx,"f")&&this._emit("messageDone",e.data),Zr(this,Cx,void 0,"f")}},jfr=function(e){let r=Pe(this,zg,"m",Lfr).call(this,e);switch(Zr(this,Die,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==Pe(this,Zxe,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(Pe(this,Rw,"f")&&this._emit("toolCallDone",Pe(this,Rw,"f")),Zr(this,Zxe,i.index,"f"),Zr(this,Rw,r.step_details.tool_calls[i.index],"f"),Pe(this,Rw,"f")&&this._emit("toolCallCreated",Pe(this,Rw,"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":Zr(this,Die,void 0,"f"),e.data.step_details.type=="tool_calls"&&Pe(this,Rw,"f")&&(this._emit("toolCallDone",Pe(this,Rw,"f")),Zr(this,Rw,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},$fr=function(e){Pe(this,Vrt,"f").push(e),this._emit("event",e)},Lfr=function(e){switch(e.event){case"thread.run.step.created":return Pe(this,tA,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=Pe(this,tA,"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=EV.accumulateDelta(r,n.delta);Pe(this,tA,"f")[e.data.id]=o}return Pe(this,tA,"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":Pe(this,tA,"f")[e.data.id]=e.data;break}if(Pe(this,tA,"f")[e.data.id])return Pe(this,tA,"f")[e.data.id];throw new Error("No snapshot available")},Ffr=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]=Pe(this,zg,"m",kfr).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")},kfr=function(e,r){return EV.accumulateDelta(r,e)},qfr=function(e){switch(Zr(this,Xxe,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":Zr(this,PV,e.data,"f"),Pe(this,Rw,"f")&&(this._emit("toolCallDone",Pe(this,Rw,"f")),Zr(this,Rw,void 0,"f"));break;case"thread.run.cancelling":break}}});var MV,Wrt=v(()=>{Jr();Urt();Urt();Fu();Gl();Hrt();z8();ss();MV=class extends Ke{constructor(){super(...arguments),this.steps=new aG(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(ke`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(ke`/threads/${o}/runs/${e}`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(ke`/threads/${o}/runs/${e}`,{body:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(ke`/threads/${e}/runs`,ui,{query:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(ke`/threads/${o}/runs/${e}/cancel`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(o.id,{thread_id:e},n)}createAndStream(e,r,n){return mD.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o=gt([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:a}=await this.retrieve(e,r,{...n,headers:{...n?.headers,...o}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=a.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await GI(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return mD.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post(ke`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}async submitToolOutputsAndPoll(e,r,n){let o=await this.submitToolOutputs(e,r,n);return await this.poll(o.id,r,n)}submitToolOutputsStream(e,r,n){return mD.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};MV.Steps=aG});var Uk,Jrt=v(()=>{Jr();Brt();Brt();Wrt();Wrt();Gl();Hrt();ss();Uk=class extends Ke{constructor(){super(...arguments),this.runs=new MV(this._client),this.messages=new iG(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(ke`/threads/${e}`,{...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(ke`/threads/${e}`,{body:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete(ke`/threads/${e}`,{...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:e.stream??!1})}async createAndRunPoll(e,r){let n=await this.createAndRun(e,r);return await this.runs.poll(n.id,{thread_id:n.thread_id},r)}createAndRunStream(e,r){return mD.createThreadAssistantStream(e,this._client.beta.threads,r)}};Uk.Runs=MV;Uk.Messages=iG});var xx,Krt=v(()=>{Jr();Drt();Drt();Lrt();Lrt();qrt();qrt();Jrt();Jrt();xx=class extends Ke{constructor(){super(...arguments),this.realtime=new qk(this._client),this.chatkit=new Bk(this._client),this.assistants=new eG(this._client),this.threads=new Uk(this._client)}};xx.Realtime=qk;xx.ChatKit=Bk;xx.Assistants=eG;xx.Threads=Uk});var RV,Grt=v(()=>{Jr();RV=class extends Ke{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var uG,Xrt=v(()=>{Jr();Gl();ss();uG=class extends Ke{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(ke`/containers/${o}/files/${e}/content`,{...n,headers:gt([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}}});var IV,Zrt=v(()=>{Jr();Xrt();Xrt();Fu();Gl();QI();ss();IV=class extends Ke{constructor(){super(...arguments),this.content=new uG(this._client)}create(e,r,n){return this._client.post(ke`/containers/${e}/files`,Mw({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(ke`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList(ke`/containers/${e}/files`,ui,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(ke`/containers/${o}/files/${e}`,{...n,headers:gt([{Accept:"*/*"},n?.headers])})}};IV.Content=uG});var zk,Yrt=v(()=>{Jr();Zrt();Zrt();Fu();Gl();ss();zk=class extends Ke{constructor(){super(...arguments),this.files=new IV(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get(ke`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",ui,{query:e,...r})}delete(e,r){return this._client.delete(ke`/containers/${e}`,{...r,headers:gt([{Accept:"*/*"},r?.headers])})}};zk.Files=IV});var lG,Qrt=v(()=>{Jr();Fu();ss();lG=class extends Ke{create(e,r,n){let{include:o,...i}=r;return this._client.post(ke`/conversations/${e}/items`,{query:{include:o},body:i,...n})}retrieve(e,r,n){let{conversation_id:o,...i}=r;return this._client.get(ke`/conversations/${o}/items/${e}`,{query:i,...n})}list(e,r={},n){return this._client.getAPIList(ke`/conversations/${e}/items`,cD,{query:r,...n})}delete(e,r,n){let{conversation_id:o}=r;return this._client.delete(ke`/conversations/${o}/items/${e}`,n)}}});var Vk,ent=v(()=>{Jr();Qrt();Qrt();ss();Vk=class extends Ke{constructor(){super(...arguments),this.items=new lG(this._client)}create(e={},r){return this._client.post("/conversations",{body:e,...r})}retrieve(e,r){return this._client.get(ke`/conversations/${e}`,r)}update(e,r,n){return this._client.post(ke`/conversations/${e}`,{body:r,...n})}delete(e,r){return this._client.delete(ke`/conversations/${e}`,r)}};Vk.Items=lG});var AV,tnt=v(()=>{Jr();Iie();AV=class extends Ke{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&cd(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(cd(this._client).debug("embeddings/decoding base64 embeddings from base64"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=Afr(u)}),a)))}}});var cG,rnt=v(()=>{Jr();Fu();ss();cG=class extends Ke{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get(ke`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList(ke`/evals/${o}/runs/${e}/output_items`,ui,{query:i,...n})}}});var NV,nnt=v(()=>{Jr();rnt();rnt();Fu();ss();NV=class extends Ke{constructor(){super(...arguments),this.outputItems=new cG(this._client)}create(e,r,n){return this._client.post(ke`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(ke`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList(ke`/evals/${e}/runs`,ui,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(ke`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(ke`/evals/${o}/runs/${e}`,n)}};NV.OutputItems=cG});var Hk,ont=v(()=>{Jr();nnt();nnt();Fu();ss();Hk=class extends Ke{constructor(){super(...arguments),this.runs=new NV(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(ke`/evals/${e}`,r)}update(e,r,n){return this._client.post(ke`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",ui,{query:e,...r})}delete(e,r){return this._client.delete(ke`/evals/${e}`,r)}};Hk.Runs=NV});var DV,int=v(()=>{Jr();Fu();Gl();z8();wx();QI();ss();DV=class extends Ke{create(e,r){return this._client.post("/files",Mw({body:e,...r},this._client))}retrieve(e,r){return this._client.get(ke`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",ui,{query:e,...r})}delete(e,r){return this._client.delete(ke`/files/${e}`,r)}content(e,r){return this._client.get(ke`/files/${e}/content`,{...r,headers:gt([{Accept:"application/binary"},r?.headers]),__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:n=30*60*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),a=await this.retrieve(e);for(;!a.status||!o.has(a.status);)if(await GI(r),a=await this.retrieve(e),Date.now()-i>n)throw new WI({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}}});var dG,ant=v(()=>{Jr();dG=class extends Ke{}});var fG,snt=v(()=>{Jr();fG=class extends Ke{run(e,r){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...r})}validate(e,r){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...r})}}});var jV,unt=v(()=>{Jr();snt();snt();jV=class extends Ke{constructor(){super(...arguments),this.graders=new fG(this._client)}};jV.Graders=fG});var pG,lnt=v(()=>{Jr();Fu();ss();pG=class extends Ke{create(e,r,n){return this._client.getAPIList(ke`/fine_tuning/checkpoints/${e}/permissions`,YI,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get(ke`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(ke`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}}});var $V,cnt=v(()=>{Jr();lnt();lnt();$V=class extends Ke{constructor(){super(...arguments),this.permissions=new pG(this._client)}};$V.Permissions=pG});var mG,dnt=v(()=>{Jr();Fu();ss();mG=class extends Ke{list(e,r={},n){return this._client.getAPIList(ke`/fine_tuning/jobs/${e}/checkpoints`,ui,{query:r,...n})}}});var LV,fnt=v(()=>{Jr();dnt();dnt();Fu();ss();LV=class extends Ke{constructor(){super(...arguments),this.checkpoints=new mG(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(ke`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",ui,{query:e,...r})}cancel(e,r){return this._client.post(ke`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList(ke`/fine_tuning/jobs/${e}/events`,ui,{query:r,...n})}pause(e,r){return this._client.post(ke`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post(ke`/fine_tuning/jobs/${e}/resume`,r)}};LV.Checkpoints=mG});var Tx,pnt=v(()=>{Jr();ant();ant();unt();unt();cnt();cnt();fnt();fnt();Tx=class extends Ke{constructor(){super(...arguments),this.methods=new dG(this._client),this.jobs=new LV(this._client),this.checkpoints=new $V(this._client),this.alpha=new jV(this._client)}};Tx.Methods=dG;Tx.Jobs=LV;Tx.Checkpoints=$V;Tx.Alpha=jV});var hG,mnt=v(()=>{Jr();hG=class extends Ke{}});var Wk,hnt=v(()=>{Jr();mnt();mnt();Wk=class extends Ke{constructor(){super(...arguments),this.graderModels=new hG(this._client)}};Wk.GraderModels=hG});var FV,gnt=v(()=>{Jr();QI();FV=class extends Ke{createVariation(e,r){return this._client.post("/images/variations",Mw({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",Mw({body:e,...r,stream:e.stream??!1},this._client))}generate(e,r){return this._client.post("/images/generations",{body:e,...r,stream:e.stream??!1})}}});var kV,ynt=v(()=>{Jr();Fu();ss();kV=class extends Ke{retrieve(e,r){return this._client.get(ke`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",YI,e)}delete(e,r){return this._client.delete(ke`/models/${e}`,r)}}});var qV,bnt=v(()=>{Jr();qV=class extends Ke{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});var gG,_nt=v(()=>{Jr();Gl();ss();gG=class extends Ke{accept(e,r,n){return this._client.post(ke`/realtime/calls/${e}/accept`,{body:r,...n,headers:gt([{Accept:"*/*"},n?.headers])})}hangup(e,r){return this._client.post(ke`/realtime/calls/${e}/hangup`,{...r,headers:gt([{Accept:"*/*"},r?.headers])})}refer(e,r,n){return this._client.post(ke`/realtime/calls/${e}/refer`,{body:r,...n,headers:gt([{Accept:"*/*"},n?.headers])})}reject(e,r={},n){return this._client.post(ke`/realtime/calls/${e}/reject`,{body:r,...n,headers:gt([{Accept:"*/*"},n?.headers])})}}});var yG,vnt=v(()=>{Jr();yG=class extends Ke{create(e,r){return this._client.post("/realtime/client_secrets",{body:e,...r})}}});var hD,wnt=v(()=>{Jr();_nt();_nt();vnt();vnt();hD=class extends Ke{constructor(){super(...arguments),this.clientSecrets=new yG(this._client),this.calls=new gG(this._client)}};hD.ClientSecrets=yG;hD.Calls=gG});function Bfr(t,e){return!e||!Oso(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)}:Snt(t,e)}function Snt(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:Mso(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:Tso(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||Yxe(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 Tso(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function Oso(t){return!!Sie(t.text?.format)}function Eso(t){return t?.$brand==="auto-parseable-tool"}function Pso(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function Mso(t,e){let r=Pso(t.tools??[],e.name);return{...e,...e,parsed_arguments:Eso(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function Yxe(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 Qxe=v(()=>{wx();W8()});function Rso(t,e){return Bfr(t,e)}var bG,eTe,Jk,tTe,Ufr,zfr,Vfr,Hfr,rTe,Wfr=v(()=>{a0();wx();Uxe();Qxe();rTe=class t extends Lk{constructor(e){super(),bG.add(this),eTe.set(this,void 0),Jk.set(this,void 0),tTe.set(this,void 0),Zr(this,eTe,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createOrRetrieveResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createOrRetrieveResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Pe(this,bG,"m",Ufr).call(this);let i,a=null;"response_id"in r?(i=await e.responses.retrieve(r.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),a=r.starting_after??null):i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(let s of i)Pe(this,bG,"m",zfr).call(this,s,a);if(i.controller.signal?.aborted)throw new qc;return Pe(this,bG,"m",Vfr).call(this)}[(eTe=new WeakMap,Jk=new WeakMap,tTe=new WeakMap,bG=new WeakSet,Ufr=function(){this.ended||Zr(this,Jk,void 0,"f")},zfr=function(r,n){if(this.ended)return;let o=(a,s)=>{(n==null||s.sequence_number>n)&&this._emit(a,s)},i=Pe(this,bG,"m",Hfr).call(this,r);switch(o("event",r),r.type){case"response.output_text.delta":{let a=i.output[r.output_index];if(!a)throw new Kt(`missing output at index ${r.output_index}`);if(a.type==="message"){let s=a.content[r.content_index];if(!s)throw new Kt(`missing content at index ${r.content_index}`);if(s.type!=="output_text")throw new Kt(`expected content to be 'output_text', got ${s.type}`);o("response.output_text.delta",{...r,snapshot:s.text})}break}case"response.function_call_arguments.delta":{let a=i.output[r.output_index];if(!a)throw new Kt(`missing output at index ${r.output_index}`);a.type==="function_call"&&o("response.function_call_arguments.delta",{...r,snapshot:a.arguments});break}default:o(r.type,r);break}},Vfr=function(){if(this.ended)throw new Kt("stream has ended, this shouldn't happen");let r=Pe(this,Jk,"f");if(!r)throw new Kt("request ended without sending any events");Zr(this,Jk,void 0,"f");let n=Rso(r,Pe(this,eTe,"f"));return Zr(this,tTe,n,"f"),n},Hfr=function(r){let n=Pe(this,Jk,"f");if(!n){if(r.type!=="response.created")throw new Kt(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=Zr(this,Jk,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 Kt(`missing output at index ${r.output_index}`);let i=o.type,a=r.part;i==="message"&&a.type!=="reasoning_text"?o.content.push(a):i==="reasoning"&&a.type==="reasoning_text"&&(o.content||(o.content=[]),o.content.push(a));break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new Kt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new Kt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new Kt(`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 Kt(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.reasoning_text.delta":{let o=n.output[r.output_index];if(!o)throw new Kt(`missing output at index ${r.output_index}`);if(o.type==="reasoning"){let i=o.content?.[r.content_index];if(!i)throw new Kt(`missing content at index ${r.content_index}`);if(i.type!=="reasoning_text")throw new Kt(`expected content to be 'reasoning_text', got ${i.type}`);i.text+=r.delta}break}case"response.completed":{Zr(this,Jk,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=Pe(this,tTe,"f");if(!e)throw new Kt("stream ended without producing a ChatCompletion");return e}}});var _G,Cnt=v(()=>{Jr();Fu();ss();_G=class extends Ke{list(e,r={},n){return this._client.getAPIList(ke`/responses/${e}/input_items`,ui,{query:r,...n})}}});var vG,xnt=v(()=>{Jr();vG=class extends Ke{count(e={},r){return this._client.post("/responses/input_tokens",{body:e,...r})}}});var gD,Tnt=v(()=>{Qxe();Wfr();Jr();Cnt();Cnt();xnt();xnt();Gl();ss();gD=class extends Ke{constructor(){super(...arguments),this.inputItems=new _G(this._client),this.inputTokens=new vG(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"&&Yxe(n),n))}retrieve(e,r={},n){return this._client.get(ke`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&Yxe(o),o))}delete(e,r){return this._client.delete(ke`/responses/${e}`,{...r,headers:gt([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>Snt(n,e))}stream(e,r){return rTe.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(ke`/responses/${e}/cancel`,r)}compact(e,r){return this._client.post("/responses/compact",{body:e,...r})}};gD.InputItems=_G;gD.InputTokens=vG});var wG,Ont=v(()=>{Jr();QI();ss();wG=class extends Ke{create(e,r,n){return this._client.post(ke`/uploads/${e}/parts`,Mw({body:r,...n},this._client))}}});var Kk,Ent=v(()=>{Jr();Ont();Ont();ss();Kk=class extends Ke{constructor(){super(...arguments),this.parts=new wG(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(ke`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(ke`/uploads/${e}/complete`,{body:r,...n})}};Kk.Parts=wG});var Jfr,Kfr=v(()=>{Jfr=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 SG,Pnt=v(()=>{Jr();Fu();Gl();z8();Kfr();ss();SG=class extends Ke{create(e,r,n){return this._client.post(ke`/vector_stores/${e}/file_batches`,{body:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(ke`/vector_stores/${o}/file_batches/${e}`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{vector_store_id:o}=r;return this._client.post(ke`/vector_stores/${o}/file_batches/${e}/cancel`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r);return await this.poll(e,o.id,n)}listFiles(e,r,n){let{vector_store_id:o,...i}=r;return this._client.getAPIList(ke`/vector_stores/${o}/file_batches/${e}/files`,ui,{query:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async poll(e,r,n){let o=gt([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:a}=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse();switch(i.status){case"in_progress":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=a.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await GI(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 Jfr(d),await this.createAndPoll(e,{file_ids:l})}}});var CG,Mnt=v(()=>{Jr();Fu();Gl();Iie();ss();CG=class extends Ke{create(e,r,n){return this._client.post(ke`/vector_stores/${e}/files`,{body:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(ke`/vector_stores/${o}/files/${e}`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{vector_store_id:o,...i}=r;return this._client.post(ke`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(ke`/vector_stores/${e}/files`,ui,{query:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{vector_store_id:o}=r;return this._client.delete(ke`/vector_stores/${o}/files/${e}`,{...n,headers:gt([{"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=gt([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse(),a=i.data;switch(a.status){case"in_progress":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=i.response.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await GI(s);break;case"failed":case"completed":return a}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}content(e,r,n){let{vector_store_id:o}=r;return this._client.getAPIList(ke`/vector_stores/${o}/files/${e}/content`,YI,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var yD,Rnt=v(()=>{Jr();Pnt();Pnt();Mnt();Mnt();Fu();Gl();ss();yD=class extends Ke{constructor(){super(...arguments),this.files=new CG(this._client),this.fileBatches=new SG(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(ke`/vector_stores/${e}`,{...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(ke`/vector_stores/${e}`,{body:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",ui,{query:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(ke`/vector_stores/${e}`,{...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList(ke`/vector_stores/${e}/search`,YI,{body:r,method:"post",...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};yD.Files=CG;yD.FileBatches=SG});var BV,Int=v(()=>{Jr();Fu();Gl();QI();ss();BV=class extends Ke{create(e,r){return this._client.post("/videos",ort({body:e,...r},this._client))}retrieve(e,r){return this._client.get(ke`/videos/${e}`,r)}list(e={},r){return this._client.getAPIList("/videos",cD,{query:e,...r})}delete(e,r){return this._client.delete(ke`/videos/${e}`,r)}downloadContent(e,r={},n){return this._client.get(ke`/videos/${e}/content`,{query:r,...n,headers:gt([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}remix(e,r,n){return this._client.post(ke`/videos/${e}/remix`,ort({body:r,...n},this._client))}}});var xG,Gfr,nTe,UV,Ant=v(()=>{a0();wx();Jr();Gl();UV=class extends Ke{constructor(){super(...arguments),xG.add(this)}async unwrap(e,r,n=this._client.webhookSecret,o=300){return await this.verifySignature(e,r,n,o),JSON.parse(e)}async verifySignature(e,r,n=this._client.webhookSecret,o=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");Pe(this,xG,"m",Gfr).call(this,n);let i=gt([r]).values,a=Pe(this,xG,"m",nTe).call(this,i,"webhook-signature"),s=Pe(this,xG,"m",nTe).call(this,i,"webhook-timestamp"),u=Pe(this,xG,"m",nTe).call(this,i,"webhook-id"),l=parseInt(s,10);if(isNaN(l))throw new JI("Invalid webhook timestamp format");let c=Math.floor(Date.now()/1e3);if(c-l>o)throw new JI("Webhook timestamp is too old");if(l>c+o)throw new JI("Webhook timestamp is too new");let d=a.split(" ").map(h=>h.startsWith("v1,")?h.substring(3):h),f=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),p=u?`${u}.${s}.${e}`:`${s}.${e}`,m=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let h of d)try{let y=Buffer.from(h,"base64");if(await crypto.subtle.verify("HMAC",m,y,new TextEncoder().encode(p)))return}catch{continue}throw new JI("The given webhook signature does not match the expected signature")}};xG=new WeakSet,Gfr=function(e){if(typeof e!="string"||e.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},nTe=function(e,r){if(!e)throw new Error("Headers are required");let n=e.get(r);if(n==null)throw new Error(`Missing required header: ${r}`);return n}});var Xfr=v(()=>{Mfr();Rfr();Art();Nrt();Krt();Grt();Yrt();ent();tnt();ont();int();pnt();hnt();gnt();ynt();bnt();wnt();Tnt();Ent();Rnt();Int();Ant()});var Nnt,Dnt,oTe,Zfr,Tn,iTe=v(()=>{a0();$tt();uD();z8();Cxe();qtt();fie();Kdr();nfr();ktt();KI();Fu();art();Xfr();Nxe();Nrt();Grt();tnt();int();gnt();ynt();bnt();Int();Ant();Art();Krt();Prt();Yrt();ent();ont();pnt();hnt();wnt();Tnt();Ent();Rnt();qtt();Gl();zrt();mie();uD();Tn=class{constructor({baseURL:e=Sx("OPENAI_BASE_URL"),apiKey:r=Sx("OPENAI_API_KEY"),organization:n=Sx("OPENAI_ORG_ID")??null,project:o=Sx("OPENAI_PROJECT_ID")??null,webhookSecret:i=Sx("OPENAI_WEBHOOK_SECRET")??null,...a}={}){if(Nnt.add(this),oTe.set(this,void 0),this.completions=new RV(this),this.chat=new kk(this),this.embeddings=new AV(this),this.files=new DV(this),this.images=new FV(this),this.audio=new eA(this),this.moderations=new qV(this),this.models=new kV(this),this.fineTuning=new Tx(this),this.graders=new Wk(this),this.vectorStores=new yD(this),this.webhooks=new UV(this),this.beta=new xx(this),this.batches=new TV(this),this.uploads=new Kk(this),this.responses=new gD(this),this.realtime=new hD(this),this.conversations=new Vk(this),this.evals=new Hk(this),this.containers=new zk(this),this.videos=new BV(this),r===void 0)throw new Kt("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");let s={apiKey:r,organization:n,project:o,webhookSecret:i,...a,baseURL:e||"https://api.openai.com/v1"};if(!s.dangerouslyAllowBrowser&&zdr())throw new Kt(`It looks like you're running in a browser-like environment.

This is disabled by default, as it risks exposing your secret API credentials to attackers.
If you understand the risks and have appropriate mitigations in place,
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,

new OpenAI({ apiKey, dangerouslyAllowBrowser: true });

https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
`);this.baseURL=s.baseURL,this.timeout=s.timeout??Dnt.DEFAULT_TIMEOUT,this.logger=s.logger??console;let u="warn";this.logLevel=u,this.logLevel=Xtt(s.logLevel,"ClientOptions.logLevel",this)??Xtt(Sx("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??u,this.fetchOptions=s.fetchOptions,this.maxRetries=s.maxRetries??2,this.fetch=s.fetch??Hdr(),Zr(this,oTe,Jdr,"f"),this._options=s,this.apiKey=typeof r=="string"?r:"Missing Key",this.organization=n,this.project=o,this.webhookSecret=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return gt([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return Ktt(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${$k}`}defaultIdempotencyKey(){return`stainless-node-retry-${jtt()}`}makeStatusError(e,r,n,o){return qm.generate(e,r,n,o)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(n){throw n instanceof Kt?n:new Kt(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new Kt(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let o=!Pe(this,Nnt,"m",Zfr).call(this)&&n||this.baseURL,i=jdr(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return $dr(a)||(r={...a,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}async prepareOptions(e){await this._callApiKey()}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(o=>({method:e,path:r,...o})))}request(e,r=null){return new wV(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,i=o.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(o);let{req:a,url:s,timeout:u}=await this.buildRequest(o,{retryCount:i-r});await this.prepareRequest(a,{url:s,options:o});let l="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),c=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if(cd(this).debug(`[${l}] sending request`,lD({retryOfRequestLogID:n,method:o.method,url:s,options:o,headers:a.headers})),o.signal?.aborted)throw new qc;let f=new AbortController,p=await this.fetchWithTimeout(s,a,u,f).catch(die),m=Date.now();if(p instanceof globalThis.Error){let g=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new qc;let b=cie(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return cd(this).info(`[${l}] connection ${b?"timed out":"failed"} - ${g}`),cd(this).debug(`[${l}] connection ${b?"timed out":"failed"} (${g})`,lD({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??l);throw cd(this).info(`[${l}] connection ${b?"timed out":"failed"} - error; no more retries left`),cd(this).debug(`[${l}] connection ${b?"timed out":"failed"} (error; no more retries left)`,lD({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),b?new WI:new jk({cause:p})}let h=[...p.headers.entries()].filter(([g])=>g==="x-request-id").map(([g,b])=>", "+g+": "+JSON.stringify(b)).join(""),y=`[${l}${c}${h}] ${a.method} ${s} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let g=await this.shouldRetry(p);if(r&&g){let E=`retrying, ${r} attempts remaining`;return await Wdr(p.body),cd(this).info(`${y} - ${E}`),cd(this).debug(`[${l}] response error (${E})`,lD({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??l,p.headers)}let b=g?"error; no more retries left":"error; not retryable";cd(this).info(`${y} - ${b}`);let _=await p.text().catch(E=>die(E).message),w=kdr(_),T=w?void 0:_;throw cd(this).debug(`[${l}] response error (${b})`,lD({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:T,durationMs:Date.now()-d})),this.makeStatusError(p.status,w,T,p.headers)}return cd(this).info(y),cd(this).debug(`[${l}] response start`,lD({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),{response:p,options:o,controller:f,requestLogID:l,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new bie(this,n,e)}async fetchWithTimeout(e,r,n,o){let{signal:i,method:a,...s}=r||{};i&&i.addEventListener("abort",()=>o.abort());let u=setTimeout(()=>o.abort(),n),l=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body=="object"&&s.body!==null&&Symbol.asyncIterator in s.body,c={signal:o.signal,...l?{duplex:"half"}:{},method:"GET",...s};a&&(c.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,c)}finally{clearTimeout(u)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,o){let i,a=o?.get("retry-after-ms");if(a){let u=parseFloat(a);Number.isNaN(u)||(i=u)}let s=o?.get("retry-after");if(s&&!i){let u=parseFloat(s);Number.isNaN(u)?i=Date.parse(s)-Date.now():i=u*1e3}if(!(i&&0<=i&&i<60*1e3)){let u=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,u)}return await GI(i),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:a,defaultBaseURL:s}=n,u=this.buildURL(i,a,s);"timeout"in n&&Fdr("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:l,body:c}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:l,retryCount:r});return{req:{method:o,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&c instanceof globalThis.ReadableStream&&{duplex:"half"},...c&&{body:c},...this.fetchOptions??{},...n.fetchOptions??{}},url:u,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let a=gt([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...Vdr(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=gt([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:xxe(e)}:Pe(this,oTe,"f").call(this,{body:e,headers:n})}};Dnt=Tn,oTe=new WeakMap,Nnt=new WeakSet,Zfr=function(){return this.baseURL!=="https://api.openai.com/v1"};Tn.OpenAI=Dnt;Tn.DEFAULT_TIMEOUT=6e5;Tn.OpenAIError=Kt;Tn.APIError=qm;Tn.APIConnectionError=jk;Tn.APIConnectionTimeoutError=WI;Tn.APIUserAbortError=qc;Tn.NotFoundError=j8;Tn.ConflictError=$8;Tn.RateLimitError=F8;Tn.BadRequestError=A8;Tn.AuthenticationError=N8;Tn.InternalServerError=k8;Tn.PermissionDeniedError=D8;Tn.UnprocessableEntityError=L8;Tn.InvalidWebhookSignatureError=JI;Tn.toFile=vie;Tn.Completions=RV;Tn.Chat=kk;Tn.Embeddings=AV;Tn.Files=DV;Tn.Images=FV;Tn.Audio=eA;Tn.Moderations=qV;Tn.Models=kV;Tn.FineTuning=Tx;Tn.Graders=Wk;Tn.VectorStores=yD;Tn.Webhooks=UV;Tn.Beta=xx;Tn.Batches=TV;Tn.Uploads=Kk;Tn.Responses=gD;Tn.Realtime=hD;Tn.Conversations=Vk;Tn.Evals=Hk;Tn.Containers=zk;Tn.Videos=BV});var zV,Lso,Yfr=v(()=>{Gl();wx();Iie();iTe();zV=class extends Tn{constructor({baseURL:e=Sx("OPENAI_BASE_URL"),apiKey:r=Sx("AZURE_OPENAI_API_KEY"),apiVersion:n=Sx("OPENAI_API_VERSION"),endpoint:o,deployment:i,azureADTokenProvider:a,dangerouslyAllowBrowser:s,...u}={}){if(!n)throw new Kt("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 Kt("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(a&&r)throw new Kt("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(u.defaultQuery={...u.defaultQuery,"api-version":n},e){if(o)throw new Kt("baseURL and endpoint are mutually exclusive")}else{if(o||(o=process.env.AZURE_OPENAI_ENDPOINT),!o)throw new Kt("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");e=`${o}/openai`}super({apiKey:a??r,baseURL:e,...u,...s!==void 0?{dangerouslyAllowBrowser:s}:{}}),this.apiVersion="",this.apiVersion=n,this.deploymentName=i}async buildRequest(e,r={}){if(Lso.has(e.path)&&e.method==="post"&&e.body!==void 0){if(!U8(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 authHeaders(e){return typeof this._options.apiKey=="string"?gt([{"api-key":this.apiKey}]):super.authHeaders(e)}},Lso=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"])});var rA=v(()=>{iTe();art();Nxe();iTe();Fu();KI();Yfr()});function s0(t){if(!t||typeof t!="object")return t;let e;return t.constructor.name===WI.name&&"message"in t&&typeof t.message=="string"?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===qc.name&&"message"in t&&typeof t.message=="string"?(e=new Error(t.message),e.name="AbortError"):"status"in t&&t.status===400&&"message"in t&&typeof t.message=="string"&&t.message.includes("tool_calls")?e=lie(t,"INVALID_TOOL_RESULTS"):"status"in t&&t.status===401?e=lie(t,"MODEL_AUTHENTICATION"):"status"in t&&t.status===429?e=lie(t,"MODEL_RATE_LIMIT"):"status"in t&&t.status===404?e=lie(t,"MODEL_NOT_FOUND"):e=t,e}var Gk=v(()=>{Ddr();rA()});function _D(t){return t?!!(/^o\d/.test(t??"")||t.startsWith("gpt-5")&&!t.startsWith("gpt-5-chat")):!1}function Fso(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 TG(t){let e=t.metadata?.filename??t.metadata?.name??t.metadata?.title;if(!e)throw new Error("a filename or name or title is needed via meta-data for OpenAI when working with multimodal blocks");return e}function vD(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(!hy.isInstance(t))throw new Error("Invalid generic chat message");return Fso(t);default:throw new Error(`Unknown message type: ${e}`)}}function Qfr(t){return t.includes("gpt-5.2-pro")}var bD,Xk=v(()=>{ra();bD=t=>t()});function nA(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}function jnt(t){return typeof Headers<"u"&&t!==null&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Headers]"}function epr(t){let e=bD(()=>{if(jnt(t))return t;if(Array.isArray(t))return new Headers(t);if(typeof t=="object"&&t!==null&&"values"in t&&jnt(t.values))return t.values;if(typeof t=="object"&&t!==null){let r=Object.entries(t).filter(([,n])=>typeof n=="string").map(([n,o])=>[n,o]);return new Headers(r)}return new Headers});return Object.fromEntries(e.entries())}function tpr(){let t=sUe();return(t==="node"||t==="deno")&&(t=`(${t}/${process.version}; ${process.platform}; ${process.arch})`),t}function oA(t,e=!1,r="1.0.0"){let n=epr(t),o=tpr(),i=`langchainjs${e?"-azure":""}-openai`;return{...n,"User-Agent":n["User-Agent"]?`${i}/${r} (${o})${n["User-Agent"]}`:`${i}/${r} (${o})`}}var Zk=v(()=>{Xk();su()});function rpr(t,e){let r;return zb(t)?r=Rk(t):r=t,e?.strict!==void 0&&(r.function.strict=e.strict),r}function kso(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function npr(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(opr(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function opr(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}: ${aTe(o,e)},`):r.push(`${n}?: ${aTe(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function aTe(t,e){if(kso(t))return t.anyOf.map(r=>aTe(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["{",opr(t,e+2),"}"].join(`
`);case"array":return t.items?`${aTe(t.items,e)}[]`:"any[]";default:return""}}function sTe(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 OG(t){return"type"in t&&t.type!=="function"}function ipr(t){return typeof t=="object"&&t!==null&&"extras"in t&&typeof t.extras=="object"&&t.extras!==null&&"providerToolDefinition"in t.extras&&typeof t.extras.providerToolDefinition=="object"&&t.extras.providerToolDefinition!==null}function apr(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function VV(t){return typeof t=="object"&&t!==null&&"metadata"in t&&typeof t.metadata=="object"&&t.metadata!==null&&"customTool"in t.metadata&&typeof t.metadata.customTool=="object"&&t.metadata.customTool!==null}function uTe(t){return"type"in t&&t.type==="custom"&&"custom"in t&&typeof t.custom=="object"&&t.custom!==null}function spr(t){if(t.type==="custom_tool_call")return{...t,type:"tool_call",call_id:t.id,id:t.call_id,name:t.name,isCustomTool:!0,args:{input:t.input}}}function upr(t){if(t.type==="computer_call")return{...t,type:"tool_call",call_id:t.id,id:t.call_id,name:"computer_use",isComputerTool:!0,args:{action:t.action}}}function lpr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="tool_call"&&"isComputerTool"in t&&t.isComputerTool===!0}function cpr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="tool_call"&&"isCustomTool"in t&&t.isCustomTool===!0}function dpr(t){let e=()=>{if(t.custom.format){if(t.custom.format.type==="grammar")return{type:"grammar",definition:t.custom.format.grammar.definition,syntax:t.custom.format.grammar.syntax};if(t.custom.format.type==="text")return{type:"text"}}};return{type:"custom",name:t.custom.name,description:t.custom.description,format:e()}}function fpr(t){let e=()=>{if(t.format){if(t.format.type==="grammar")return{type:"grammar",grammar:{definition:t.format.definition,syntax:t.format.syntax}};if(t.format.type==="text")return{type:"text"}}};return{type:"custom",custom:{name:t.name,description:t.description,format:e()}}}var EG=v(()=>{iD();nv();Sy()});var $nt=v(()=>{_y()});var pTe={};En(pTe,{ZodISODate:()=>cTe,ZodISODateTime:()=>lTe,ZodISODuration:()=>fTe,ZodISOTime:()=>dTe,date:()=>Fnt,datetime:()=>Lnt,duration:()=>qnt,time:()=>knt});function Lnt(t){return OVe(lTe,t)}function Fnt(t){return EVe(cTe,t)}function knt(t){return PVe(dTe,t)}function qnt(t){return MVe(fTe,t)}var lTe,cTe,dTe,fTe,mTe=v(()=>{_y();hTe();lTe=Te("ZodISODateTime",(t,e)=>{M2e.init(t,e),Qu.init(t,e)});cTe=Te("ZodISODate",(t,e)=>{R2e.init(t,e),Qu.init(t,e)});dTe=Te("ZodISOTime",(t,e)=>{I2e.init(t,e),Qu.init(t,e)});fTe=Te("ZodISODuration",(t,e)=>{A2e.init(t,e),Qu.init(t,e)})});var mpr,Bso,PG,Bnt=v(()=>{_y();_y();mpr=(t,e)=>{uee.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>cee(t,r)},flatten:{value:r=>lee(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},Bso=Te("ZodError",mpr),PG=Te("ZodError",mpr,{Parent:Error})});var Unt,znt,Vnt,Hnt,Wnt=v(()=>{_y();Bnt();Unt=Zme(PG),znt=Yme(PG),Vnt=Qme(PG),Hnt=ehe(PG)});function Jnt(t){return CVe($ie,t)}function zso(t){return hhe(Xnt,t)}function Vso(t){return _ee(gTe,t)}function Hso(t){return ghe(wD,t)}function Wso(t){return yhe(wD,t)}function Jso(t){return bhe(wD,t)}function Kso(t){return _he(wD,t)}function Gso(t){return vhe(Znt,t)}function Xso(t){return whe(Ynt,t)}function Zso(t){return She(Qnt,t)}function Yso(t){return Che(eot,t)}function Qso(t){return xhe(tot,t)}function euo(t){return The(rot,t)}function tuo(t){return Ohe(not,t)}function ruo(t){return Ehe(oot,t)}function nuo(t){return Phe(iot,t)}function ouo(t){return Mhe(aot,t)}function iuo(t){return Rhe(sot,t)}function auo(t){return Ihe(uot,t)}function suo(t){return Ahe(lot,t)}function uuo(t){return Nhe(cot,t)}function luo(t){return Dhe(dot,t)}function cuo(t){return jhe(fot,t)}function duo(t,e,r={}){return sHe(hpr,t,e,r)}function gpr(t){return RVe(Lie,t)}function Knt(t){return AVe(MG,t)}function fuo(t){return NVe(MG,t)}function puo(t){return DVe(MG,t)}function muo(t){return jVe(MG,t)}function huo(t){return $Ve(MG,t)}function ypr(t){return LVe(Fie,t)}function guo(t){return kVe(kie,t)}function yuo(t){return BVe(pot,t)}function buo(t){return UVe(pot,t)}function _uo(t){return zVe(bpr,t)}function vuo(t){return VVe(_pr,t)}function wpr(t){return HVe(vpr,t)}function wuo(){return WVe(Spr)}function yTe(){return Bz(Cpr)}function wTe(t){return vee(xpr,t)}function Suo(t){return JVe(Tpr,t)}function Cuo(t){return KVe(STe,t)}function mot(t,e){return Nee(Opr,t,e)}function xuo(t){let e=t._zod.def.shape;return $pr(Object.keys(e))}function Tuo(t,e){let r={type:"object",get shape(){return Ft.assignProp(this,"shape",{...t}),this.shape},...Ft.normalizeParams(e)};return new CTe(r)}function Ouo(t,e){return new CTe({type:"object",get shape(){return Ft.assignProp(this,"shape",{...t}),this.shape},catchall:wTe(),...Ft.normalizeParams(e)})}function Euo(t,e){return new CTe({type:"object",get shape(){return Ft.assignProp(this,"shape",{...t}),this.shape},catchall:yTe(),...Ft.normalizeParams(e)})}function xTe(t,e){return new hot({type:"union",options:t,...Ft.normalizeParams(e)})}function Puo(t,e,r){return new Epr({type:"union",options:e,discriminator:t,...Ft.normalizeParams(r)})}function Mpr(t,e){return new Ppr({type:"intersection",left:t,right:e})}function Muo(t,e,r){let n=e instanceof lo,o=n?r:e,i=n?e:null;return new Rpr({type:"tuple",items:t,rest:i,...Ft.normalizeParams(o)})}function Ipr(t,e,r){return new got({type:"record",keyType:t,valueType:e,...Ft.normalizeParams(r)})}function Ruo(t,e,r){return new got({type:"record",keyType:xTe([t,wTe()]),valueType:e,...Ft.normalizeParams(r)})}function Iuo(t,e,r){return new Apr({type:"map",keyType:t,valueType:e,...Ft.normalizeParams(r)})}function Auo(t,e){return new Npr({type:"set",valueType:t,...Ft.normalizeParams(e)})}function Dpr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new jie({type:"enum",entries:r,...Ft.normalizeParams(e)})}function Nuo(t,e){return new jie({type:"enum",entries:t,...Ft.normalizeParams(e)})}function $pr(t,e){return new jpr({type:"literal",values:Array.isArray(t)?t:[t],...Ft.normalizeParams(e)})}function Duo(t){return nHe(Lpr,t)}function bot(t){return new yot({type:"transform",transform:t})}function bTe(t){return new _ot({type:"optional",innerType:t})}function _Te(t){return new Fpr({type:"nullable",innerType:t})}function juo(t){return bTe(_Te(t))}function qpr(t,e){return new kpr({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function Upr(t,e){return new Bpr({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function zpr(t,e){return new vot({type:"nonoptional",innerType:t,...Ft.normalizeParams(e)})}function $uo(t){return new Vpr({type:"success",innerType:t})}function Wpr(t,e){return new Hpr({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}function Luo(t){return XVe(Jpr,t)}function vTe(t,e){return new wot({type:"pipe",in:t,out:e})}function Gpr(t){return new Kpr({type:"readonly",innerType:t})}function Fuo(t,e){return new Xpr({type:"template_literal",parts:t,...Ft.normalizeParams(e)})}function Ypr(t){return new Zpr({type:"lazy",getter:t})}function kuo(t){return new Qpr({type:"promise",innerType:t})}function emr(t){let e=new hc({check:"custom"});return e._zod.check=t,e}function quo(t,e){return oHe(TTe,t??(()=>!0),e)}function tmr(t,e={}){return iHe(TTe,t,e)}function rmr(t){let e=emr(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ft.issue(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(Ft.issue(o))}},t(r.value,r)));return e}function Buo(t,e={error:`Input not instance of ${t.name}`}){let r=new TTe({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...Ft.normalizeParams(e)});return r._zod.bag.Class=t,r}function zuo(t){let e=Ypr(()=>xTe([Jnt(t),gpr(),ypr(),wpr(),mot(e),Ipr(Jnt(),e)]));return e}function Vuo(t,e){return vTe(bot(t),e)}var wi,Gnt,$ie,Qu,Xnt,gTe,wD,Znt,Ynt,Qnt,eot,tot,rot,not,oot,iot,aot,sot,uot,lot,cot,dot,fot,hpr,Lie,MG,Fie,kie,pot,bpr,_pr,vpr,Spr,Cpr,xpr,Tpr,STe,Opr,CTe,hot,Epr,Ppr,Rpr,got,Apr,Npr,jie,jpr,Lpr,yot,_ot,Fpr,kpr,Bpr,vot,Vpr,Hpr,Jpr,wot,Kpr,Xpr,Zpr,Qpr,TTe,Uuo,hTe=v(()=>{_y();_y();$nt();mTe();Wnt();wi=Te("ZodType",(t,e)=>(lo.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>wd(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>Unt(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Vnt(t,r,n),t.parseAsync=async(r,n)=>znt(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Hnt(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(tmr(r,n)),t.superRefine=r=>t.check(rmr(r)),t.overwrite=r=>t.check(BN(r)),t.optional=()=>bTe(t),t.nullable=()=>_Te(t),t.nullish=()=>bTe(_Te(t)),t.nonoptional=r=>zpr(t,r),t.array=()=>mot(t),t.or=r=>xTe([t,r]),t.and=r=>Mpr(t,r),t.transform=r=>vTe(t,bot(r)),t.default=r=>qpr(t,r),t.prefault=r=>Upr(t,r),t.catch=r=>Wpr(t,r),t.pipe=r=>vTe(t,r),t.readonly=()=>Gpr(t),t.describe=r=>{let n=t.clone();return xh.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return xh.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return xh.get(t);let n=t.clone();return xh.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Gnt=Te("_ZodString",(t,e)=>{Fz.init(t,e),wi.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(See(...n)),t.includes=(...n)=>t.check(Tee(...n)),t.startsWith=(...n)=>t.check(Oee(...n)),t.endsWith=(...n)=>t.check(Eee(...n)),t.min=(...n)=>t.check(VL(...n)),t.max=(...n)=>t.check(iJ(...n)),t.length=(...n)=>t.check(aJ(...n)),t.nonempty=(...n)=>t.check(VL(1,...n)),t.lowercase=n=>t.check(Cee(n)),t.uppercase=n=>t.check(xee(n)),t.trim=()=>t.check(Ree()),t.normalize=(...n)=>t.check(Mee(...n)),t.toLowerCase=()=>t.check(Iee()),t.toUpperCase=()=>t.check(Aee())}),$ie=Te("ZodString",(t,e)=>{Fz.init(t,e),Gnt.init(t,e),t.email=r=>t.check(hhe(Xnt,r)),t.url=r=>t.check(vhe(Znt,r)),t.jwt=r=>t.check(jhe(fot,r)),t.emoji=r=>t.check(whe(Ynt,r)),t.guid=r=>t.check(_ee(gTe,r)),t.uuid=r=>t.check(ghe(wD,r)),t.uuidv4=r=>t.check(yhe(wD,r)),t.uuidv6=r=>t.check(bhe(wD,r)),t.uuidv7=r=>t.check(_he(wD,r)),t.nanoid=r=>t.check(She(Qnt,r)),t.guid=r=>t.check(_ee(gTe,r)),t.cuid=r=>t.check(Che(eot,r)),t.cuid2=r=>t.check(xhe(tot,r)),t.ulid=r=>t.check(The(rot,r)),t.base64=r=>t.check(Ahe(lot,r)),t.base64url=r=>t.check(Nhe(cot,r)),t.xid=r=>t.check(Ohe(not,r)),t.ksuid=r=>t.check(Ehe(oot,r)),t.ipv4=r=>t.check(Phe(iot,r)),t.ipv6=r=>t.check(Mhe(aot,r)),t.cidrv4=r=>t.check(Rhe(sot,r)),t.cidrv6=r=>t.check(Ihe(uot,r)),t.e164=r=>t.check(Dhe(dot,r)),t.datetime=r=>t.check(Lnt(r)),t.date=r=>t.check(Fnt(r)),t.time=r=>t.check(knt(r)),t.duration=r=>t.check(qnt(r))});Qu=Te("ZodStringFormat",(t,e)=>{Nu.init(t,e),Gnt.init(t,e)}),Xnt=Te("ZodEmail",(t,e)=>{v2e.init(t,e),Qu.init(t,e)});gTe=Te("ZodGUID",(t,e)=>{b2e.init(t,e),Qu.init(t,e)});wD=Te("ZodUUID",(t,e)=>{_2e.init(t,e),Qu.init(t,e)});Znt=Te("ZodURL",(t,e)=>{w2e.init(t,e),Qu.init(t,e)});Ynt=Te("ZodEmoji",(t,e)=>{S2e.init(t,e),Qu.init(t,e)});Qnt=Te("ZodNanoID",(t,e)=>{C2e.init(t,e),Qu.init(t,e)});eot=Te("ZodCUID",(t,e)=>{x2e.init(t,e),Qu.init(t,e)});tot=Te("ZodCUID2",(t,e)=>{T2e.init(t,e),Qu.init(t,e)});rot=Te("ZodULID",(t,e)=>{O2e.init(t,e),Qu.init(t,e)});not=Te("ZodXID",(t,e)=>{E2e.init(t,e),Qu.init(t,e)});oot=Te("ZodKSUID",(t,e)=>{P2e.init(t,e),Qu.init(t,e)});iot=Te("ZodIPv4",(t,e)=>{N2e.init(t,e),Qu.init(t,e)});aot=Te("ZodIPv6",(t,e)=>{D2e.init(t,e),Qu.init(t,e)});sot=Te("ZodCIDRv4",(t,e)=>{j2e.init(t,e),Qu.init(t,e)});uot=Te("ZodCIDRv6",(t,e)=>{$2e.init(t,e),Qu.init(t,e)});lot=Te("ZodBase64",(t,e)=>{F2e.init(t,e),Qu.init(t,e)});cot=Te("ZodBase64URL",(t,e)=>{k2e.init(t,e),Qu.init(t,e)});dot=Te("ZodE164",(t,e)=>{q2e.init(t,e),Qu.init(t,e)});fot=Te("ZodJWT",(t,e)=>{B2e.init(t,e),Qu.init(t,e)});hpr=Te("ZodCustomStringFormat",(t,e)=>{U2e.init(t,e),Qu.init(t,e)});Lie=Te("ZodNumber",(t,e)=>{lhe.init(t,e),wi.init(t,e),t.gt=(n,o)=>t.check(qN(n,o)),t.gte=(n,o)=>t.check(E_(n,o)),t.min=(n,o)=>t.check(E_(n,o)),t.lt=(n,o)=>t.check(kN(n,o)),t.lte=(n,o)=>t.check(bS(n,o)),t.max=(n,o)=>t.check(bS(n,o)),t.int=n=>t.check(Knt(n)),t.safe=n=>t.check(Knt(n)),t.positive=n=>t.check(qN(0,n)),t.nonnegative=n=>t.check(E_(0,n)),t.negative=n=>t.check(kN(0,n)),t.nonpositive=n=>t.check(bS(0,n)),t.multipleOf=(n,o)=>t.check(Uz(n,o)),t.step=(n,o)=>t.check(Uz(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});MG=Te("ZodNumberFormat",(t,e)=>{z2e.init(t,e),Lie.init(t,e)});Fie=Te("ZodBoolean",(t,e)=>{fee.init(t,e),wi.init(t,e)});kie=Te("ZodBigInt",(t,e)=>{che.init(t,e),wi.init(t,e),t.gte=(n,o)=>t.check(E_(n,o)),t.min=(n,o)=>t.check(E_(n,o)),t.gt=(n,o)=>t.check(qN(n,o)),t.gte=(n,o)=>t.check(E_(n,o)),t.min=(n,o)=>t.check(E_(n,o)),t.lt=(n,o)=>t.check(kN(n,o)),t.lte=(n,o)=>t.check(bS(n,o)),t.max=(n,o)=>t.check(bS(n,o)),t.positive=n=>t.check(qN(BigInt(0),n)),t.negative=n=>t.check(kN(BigInt(0),n)),t.nonpositive=n=>t.check(bS(BigInt(0),n)),t.nonnegative=n=>t.check(E_(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(Uz(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});pot=Te("ZodBigIntFormat",(t,e)=>{V2e.init(t,e),kie.init(t,e)});bpr=Te("ZodSymbol",(t,e)=>{H2e.init(t,e),wi.init(t,e)});_pr=Te("ZodUndefined",(t,e)=>{W2e.init(t,e),wi.init(t,e)});vpr=Te("ZodNull",(t,e)=>{J2e.init(t,e),wi.init(t,e)});Spr=Te("ZodAny",(t,e)=>{K2e.init(t,e),wi.init(t,e)});Cpr=Te("ZodUnknown",(t,e)=>{kz.init(t,e),wi.init(t,e)});xpr=Te("ZodNever",(t,e)=>{pee.init(t,e),wi.init(t,e)});Tpr=Te("ZodVoid",(t,e)=>{G2e.init(t,e),wi.init(t,e)});STe=Te("ZodDate",(t,e)=>{X2e.init(t,e),wi.init(t,e),t.min=(n,o)=>t.check(E_(n,o)),t.max=(n,o)=>t.check(bS(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});Opr=Te("ZodArray",(t,e)=>{mee.init(t,e),wi.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(VL(r,n)),t.nonempty=r=>t.check(VL(1,r)),t.max=(r,n)=>t.check(iJ(r,n)),t.length=(r,n)=>t.check(aJ(r,n)),t.unwrap=()=>t.element});CTe=Te("ZodObject",(t,e)=>{Z2e.init(t,e),wi.init(t,e),Ft.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Dpr(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:yTe()}),t.loose=()=>t.clone({...t._zod.def,catchall:yTe()}),t.strict=()=>t.clone({...t._zod.def,catchall:wTe()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>Ft.extend(t,r),t.merge=r=>Ft.merge(t,r),t.pick=r=>Ft.pick(t,r),t.omit=r=>Ft.omit(t,r),t.partial=(...r)=>Ft.partial(_ot,t,r[0]),t.required=(...r)=>Ft.required(vot,t,r[0])});hot=Te("ZodUnion",(t,e)=>{dhe.init(t,e),wi.init(t,e),t.options=e.options});Epr=Te("ZodDiscriminatedUnion",(t,e)=>{hot.init(t,e),Y2e.init(t,e)});Ppr=Te("ZodIntersection",(t,e)=>{Q2e.init(t,e),wi.init(t,e)});Rpr=Te("ZodTuple",(t,e)=>{qz.init(t,e),wi.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});got=Te("ZodRecord",(t,e)=>{eVe.init(t,e),wi.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});Apr=Te("ZodMap",(t,e)=>{tVe.init(t,e),wi.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});Npr=Te("ZodSet",(t,e)=>{rVe.init(t,e),wi.init(t,e),t.min=(...r)=>t.check(zz(...r)),t.nonempty=r=>t.check(zz(1,r)),t.max=(...r)=>t.check(oJ(...r)),t.size=(...r)=>t.check(wee(...r))});jie=Te("ZodEnum",(t,e)=>{nVe.init(t,e),wi.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new jie({...e,checks:[],...Ft.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new jie({...e,checks:[],...Ft.normalizeParams(o),entries:i})}});jpr=Te("ZodLiteral",(t,e)=>{oVe.init(t,e),wi.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});Lpr=Te("ZodFile",(t,e)=>{iVe.init(t,e),wi.init(t,e),t.min=(r,n)=>t.check(zz(r,n)),t.max=(r,n)=>t.check(oJ(r,n)),t.mime=(r,n)=>t.check(Pee(Array.isArray(r)?r:[r],n))});yot=Te("ZodTransform",(t,e)=>{hee.init(t,e),wi.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=i=>{if(typeof i=="string")r.issues.push(Ft.issue(i,r.value,e));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!0),r.issues.push(Ft.issue(a))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});_ot=Te("ZodOptional",(t,e)=>{fhe.init(t,e),wi.init(t,e),t.unwrap=()=>t._zod.def.innerType});Fpr=Te("ZodNullable",(t,e)=>{aVe.init(t,e),wi.init(t,e),t.unwrap=()=>t._zod.def.innerType});kpr=Te("ZodDefault",(t,e)=>{sVe.init(t,e),wi.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});Bpr=Te("ZodPrefault",(t,e)=>{uVe.init(t,e),wi.init(t,e),t.unwrap=()=>t._zod.def.innerType});vot=Te("ZodNonOptional",(t,e)=>{lVe.init(t,e),wi.init(t,e),t.unwrap=()=>t._zod.def.innerType});Vpr=Te("ZodSuccess",(t,e)=>{cVe.init(t,e),wi.init(t,e),t.unwrap=()=>t._zod.def.innerType});Hpr=Te("ZodCatch",(t,e)=>{dVe.init(t,e),wi.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});Jpr=Te("ZodNaN",(t,e)=>{fVe.init(t,e),wi.init(t,e)});wot=Te("ZodPipe",(t,e)=>{gee.init(t,e),wi.init(t,e),t.in=e.in,t.out=e.out});Kpr=Te("ZodReadonly",(t,e)=>{pVe.init(t,e),wi.init(t,e)});Xpr=Te("ZodTemplateLiteral",(t,e)=>{mVe.init(t,e),wi.init(t,e)});Zpr=Te("ZodLazy",(t,e)=>{gVe.init(t,e),wi.init(t,e),t.unwrap=()=>t._zod.def.getter()});Qpr=Te("ZodPromise",(t,e)=>{hVe.init(t,e),wi.init(t,e),t.unwrap=()=>t._zod.def.innerType});TTe=Te("ZodCustom",(t,e)=>{yVe.init(t,e),wi.init(t,e)});Uuo=(...t)=>aHe({Pipe:wot,Boolean:Fie,String:$ie,Transform:yot},...t)});function Wuo(t){vd({customError:t})}function Juo(){return vd().customError}var Huo,nmr=v(()=>{_y();Huo={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"}});var Sot={};En(Sot,{bigint:()=>Zuo,boolean:()=>Xuo,date:()=>Yuo,number:()=>Guo,string:()=>Kuo});function Kuo(t){return xVe($ie,t)}function Guo(t){return IVe(Lie,t)}function Xuo(t){return FVe(Fie,t)}function Zuo(t){return qVe(kie,t)}function Yuo(t){return GVe(STe,t)}var omr=v(()=>{_y();hTe()});var Zt={};En(Zt,{$brand:()=>o4e,$input:()=>wVe,$output:()=>vVe,NEVER:()=>n4e,TimePrecision:()=>TVe,ZodAny:()=>Spr,ZodArray:()=>Opr,ZodBase64:()=>lot,ZodBase64URL:()=>cot,ZodBigInt:()=>kie,ZodBigIntFormat:()=>pot,ZodBoolean:()=>Fie,ZodCIDRv4:()=>sot,ZodCIDRv6:()=>uot,ZodCUID:()=>eot,ZodCUID2:()=>tot,ZodCatch:()=>Hpr,ZodCustom:()=>TTe,ZodCustomStringFormat:()=>hpr,ZodDate:()=>STe,ZodDefault:()=>kpr,ZodDiscriminatedUnion:()=>Epr,ZodE164:()=>dot,ZodEmail:()=>Xnt,ZodEmoji:()=>Ynt,ZodEnum:()=>jie,ZodError:()=>Bso,ZodFile:()=>Lpr,ZodGUID:()=>gTe,ZodIPv4:()=>iot,ZodIPv6:()=>aot,ZodISODate:()=>cTe,ZodISODateTime:()=>lTe,ZodISODuration:()=>fTe,ZodISOTime:()=>dTe,ZodIntersection:()=>Ppr,ZodIssueCode:()=>Huo,ZodJWT:()=>fot,ZodKSUID:()=>oot,ZodLazy:()=>Zpr,ZodLiteral:()=>jpr,ZodMap:()=>Apr,ZodNaN:()=>Jpr,ZodNanoID:()=>Qnt,ZodNever:()=>xpr,ZodNonOptional:()=>vot,ZodNull:()=>vpr,ZodNullable:()=>Fpr,ZodNumber:()=>Lie,ZodNumberFormat:()=>MG,ZodObject:()=>CTe,ZodOptional:()=>_ot,ZodPipe:()=>wot,ZodPrefault:()=>Bpr,ZodPromise:()=>Qpr,ZodReadonly:()=>Kpr,ZodRealError:()=>PG,ZodRecord:()=>got,ZodSet:()=>Npr,ZodString:()=>$ie,ZodStringFormat:()=>Qu,ZodSuccess:()=>Vpr,ZodSymbol:()=>bpr,ZodTemplateLiteral:()=>Xpr,ZodTransform:()=>yot,ZodTuple:()=>Rpr,ZodType:()=>wi,ZodULID:()=>rot,ZodURL:()=>Znt,ZodUUID:()=>wD,ZodUndefined:()=>_pr,ZodUnion:()=>hot,ZodUnknown:()=>Cpr,ZodVoid:()=>Tpr,ZodXID:()=>not,_ZodString:()=>Gnt,_default:()=>qpr,any:()=>wuo,array:()=>mot,base64:()=>suo,base64url:()=>uuo,bigint:()=>guo,boolean:()=>ypr,catch:()=>Wpr,check:()=>emr,cidrv4:()=>iuo,cidrv6:()=>auo,clone:()=>wd,coerce:()=>Sot,config:()=>vd,core:()=>UN,cuid:()=>Yso,cuid2:()=>Qso,custom:()=>quo,date:()=>Cuo,discriminatedUnion:()=>Puo,e164:()=>luo,email:()=>zso,emoji:()=>Xso,endsWith:()=>Eee,enum:()=>Dpr,file:()=>Duo,flattenError:()=>lee,float32:()=>fuo,float64:()=>puo,formatError:()=>cee,function:()=>lHe,getErrorMap:()=>Juo,globalRegistry:()=>xh,gt:()=>qN,gte:()=>E_,guid:()=>Vso,includes:()=>Tee,instanceof:()=>Buo,int:()=>Knt,int32:()=>muo,int64:()=>yuo,intersection:()=>Mpr,ipv4:()=>nuo,ipv6:()=>ouo,iso:()=>pTe,json:()=>zuo,jwt:()=>cuo,keyof:()=>xuo,ksuid:()=>ruo,lazy:()=>Ypr,length:()=>aJ,literal:()=>$pr,locales:()=>bee,looseObject:()=>Euo,lowercase:()=>Cee,lt:()=>kN,lte:()=>bS,map:()=>Iuo,maxLength:()=>iJ,maxSize:()=>oJ,mime:()=>Pee,minLength:()=>VL,minSize:()=>zz,multipleOf:()=>Uz,nan:()=>Luo,nanoid:()=>Zso,nativeEnum:()=>Nuo,negative:()=>YVe,never:()=>wTe,nonnegative:()=>eHe,nonoptional:()=>zpr,nonpositive:()=>QVe,normalize:()=>Mee,null:()=>wpr,nullable:()=>_Te,nullish:()=>juo,number:()=>gpr,object:()=>Tuo,optional:()=>bTe,overwrite:()=>BN,parse:()=>Unt,parseAsync:()=>znt,partialRecord:()=>Ruo,pipe:()=>vTe,positive:()=>ZVe,prefault:()=>Upr,preprocess:()=>Vuo,prettifyError:()=>y4e,promise:()=>kuo,property:()=>tHe,readonly:()=>Gpr,record:()=>Ipr,refine:()=>tmr,regex:()=>See,regexes:()=>Lz,registry:()=>mhe,safeParse:()=>Vnt,safeParseAsync:()=>Hnt,set:()=>Auo,setErrorMap:()=>Wuo,size:()=>wee,startsWith:()=>Oee,strictObject:()=>Ouo,string:()=>Jnt,stringFormat:()=>duo,stringbool:()=>Uuo,success:()=>$uo,superRefine:()=>rmr,symbol:()=>_uo,templateLiteral:()=>Fuo,toJSONSchema:()=>HL,toLowerCase:()=>Iee,toUpperCase:()=>Aee,transform:()=>bot,treeifyError:()=>g4e,trim:()=>Ree,tuple:()=>Muo,uint32:()=>huo,uint64:()=>buo,ulid:()=>euo,undefined:()=>vuo,union:()=>xTe,unknown:()=>yTe,uppercase:()=>xee,url:()=>Gso,uuid:()=>Hso,uuidv4:()=>Wso,uuidv6:()=>Jso,uuidv7:()=>Kso,void:()=>Suo,xid:()=>tuo});var Cot=v(()=>{_y();hTe();$nt();Bnt();Wnt();nmr();_y();bVe();_y();_Ve();mTe();mTe();omr();vd(phe())});var imr=v(()=>{Cot();Cot()});var HV=v(()=>{imr()});var smr,amr,umr,OTe=v(()=>{smr=Symbol("Let zodToJsonSchema decide on which parser to use"),amr={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"},umr=t=>typeof t=="string"?{...amr,basePath:["#"],definitions:{},name:t}:{...amr,basePath:["#"],definitions:{},...t}});function lmr(t){if(!t)return!0;for(let e in t)return!1;return!0}var qie,xot=v(()=>{qie=t=>"_def"in t?t._def:t});var cmr,Tot=v(()=>{OTe();xot();cmr=t=>{let e=umr(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])=>[qie(o),{def:qie(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function Oot(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Ki(t,e,r,n,o){t[e]=r,Oot(t,e,n,o)}var Yk=v(()=>{});function dmr(){return{}}var Eot=v(()=>{});function fmr(t,e){let r={type:"array"};return t.type?._def?.typeName!==Ne.ZodAny&&(r.items=Dn(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Ki(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Ki(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Ki(r,"minItems",t.exactLength.value,t.exactLength.message,e),Ki(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var Pot=v(()=>{rO();Yk();Ed()});function pmr(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?Ki(r,"minimum",n.value,n.message,e):Ki(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Ki(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Ki(r,"maximum",n.value,n.message,e):Ki(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Ki(r,"maximum",n.value,n.message,e));break;case"multipleOf":Ki(r,"multipleOf",n.value,n.message,e);break}return r}var Mot=v(()=>{Yk()});function mmr(){return{type:"boolean"}}var Rot=v(()=>{});function hmr(t,e){return Dn(t.type._def,e)}var Iot=v(()=>{Ed()});var gmr,Aot=v(()=>{Ed();gmr=(t,e)=>Dn(t.innerType._def,e)});function Not(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>Not(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 elo(t,e)}}var elo,Dot=v(()=>{Yk();elo=(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":Ki(r,"minimum",n.value,n.message,e);break;case"max":Ki(r,"maximum",n.value,n.message,e);break}return r}});function ymr(t,e){return{...Dn(t.innerType._def,e),default:t.defaultValue()}}var jot=v(()=>{Ed()});function bmr(t,e,r){return e.effectStrategy==="input"?Dn(t.schema._def,e,r):{}}var $ot=v(()=>{Ed()});function _mr(t){return{type:"string",enum:[...t.values]}}var Lot=v(()=>{});function vmr(t,e){let r=[Dn(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Dn(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(tlo(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 tlo,Fot=v(()=>{Ed();tlo=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function wmr(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 kot=v(()=>{});function ETe(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?rlo(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":Ki(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":Ki(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":Ox(r,"email",o.message,e);break;case"format:idn-email":Ox(r,"idn-email",o.message,e);break;case"pattern:zod":Ex(r,WV.email,o.message,e);break}break;case"url":Ox(r,"uri",o.message,e);break;case"uuid":Ox(r,"uuid",o.message,e);break;case"regex":Ex(r,o.regex,o.message,e);break;case"cuid":Ex(r,WV.cuid,o.message,e);break;case"cuid2":Ex(r,WV.cuid2,o.message,e);break;case"startsWith":Ex(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":Ex(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":Ox(r,"date-time",o.message,e);break;case"date":Ox(r,"date",o.message,e);break;case"time":Ox(r,"time",o.message,e);break;case"duration":Ox(r,"duration",o.message,e);break;case"length":Ki(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),Ki(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{Ex(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&Ox(r,"ipv4",o.message,e),o.version!=="v4"&&Ox(r,"ipv6",o.message,e);break}case"emoji":Ex(r,WV.emoji,o.message,e);break;case"ulid":{Ex(r,WV.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Ox(r,"binary",o.message,e);break}case"contentEncoding:base64":{Ki(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{Ex(r,WV.base64,o.message,e);break}}break}case"nanoid":Ex(r,WV.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var qot,WV,rlo,Ox,Ex,Smr,PTe=v(()=>{Yk();WV={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:()=>(qot===void 0&&(qot=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),qot),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}$/};rlo=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),Ox=(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}}})):Ki(t,"format",e,r,n)},Ex=(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:Smr(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Ki(t,"pattern",Smr(e,n),r,n)},Smr=(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===Ne.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:Dn(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Dn(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===Ne.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(ETe(t.keyType._def,e)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===Ne.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}var RTe=v(()=>{rO();Ed();PTe()});function Cmr(t,e){if(e.mapStrategy==="record")return MTe(t,e);let r=Dn(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=Dn(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 Bot=v(()=>{Ed();RTe()});function xmr(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 Uot=v(()=>{});function Tmr(){return{not:{}}}var zot=v(()=>{});function Omr(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Vot=v(()=>{});function Pmr(t,e){if(e.target==="openApi3")return Emr(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Bie&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=Bie[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 Emr(t,e)}var Bie,Emr,ITe=v(()=>{Ed();Bie={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};Emr=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Dn(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 Mmr(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:Bie[t.innerType._def.typeName],nullable:!0}:{type:[Bie[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Dn(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Dn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var Hot=v(()=>{Ed();ITe()});function Rmr(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",Oot(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Ki(r,"minimum",n.value,n.message,e):Ki(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Ki(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Ki(r,"maximum",n.value,n.message,e):Ki(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Ki(r,"maximum",n.value,n.message,e));break;case"multipleOf":Ki(r,"multipleOf",n.value,n.message,e);break}return r}var Wot=v(()=>{Yk()});function nlo(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":Dn(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":Dn(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function Imr(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=Dn(i._def,{...e,currentPath:a,propertyPath:a});if(s===void 0)return n;if(e.openaiStrictMode&&i.isOptional()&&!i.isNullable()&&typeof i._def?.defaultValue>"u")throw new Error(`Zod field at \`${a.join("/")}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required`);return{properties:{...n.properties,[o]:s},required:i.isOptional()&&!e.openaiStrictMode?n.required:[...n.required,o]}},{properties:{},required:[]}),additionalProperties:nlo(t,e)};return r.required.length||delete r.required,r}var Jot=v(()=>{Ed()});var Amr,Kot=v(()=>{Ed();Amr=(t,e)=>{if(e.propertyPath&&e.currentPath.slice(0,e.propertyPath.length).toString()===e.propertyPath.toString())return Dn(t.innerType._def,{...e,currentPath:e.currentPath});let r=Dn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var Nmr,Got=v(()=>{Ed();Nmr=(t,e)=>{if(e.pipeStrategy==="input")return Dn(t.in._def,e);if(e.pipeStrategy==="output")return Dn(t.out._def,e);let r=Dn(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Dn(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function Dmr(t,e){return Dn(t.type._def,e)}var Xot=v(()=>{Ed()});function jmr(t,e){let n={type:"array",uniqueItems:!0,items:Dn(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Ki(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Ki(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var Zot=v(()=>{Yk();Ed()});function $mr(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Dn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Dn(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Dn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var Yot=v(()=>{Ed()});function Lmr(){return{not:{}}}var Qot=v(()=>{});function Fmr(){return{}}var eit=v(()=>{});var kmr,tit=v(()=>{Ed();kmr=(t,e)=>Dn(t.innerType._def,e)});function Dn(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==smr)return a}if(n&&!r){let a=olo(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=alo(t,t.typeName,e,r);return i&&slo(t,e,i),o.jsonSchema=i,i}var olo,ilo,alo,slo,Ed=v(()=>{rO();Eot();Pot();Mot();Rot();Iot();Aot();Dot();jot();$ot();Lot();Fot();kot();Bot();Uot();zot();Vot();Hot();Wot();Jot();Kot();Got();Xot();RTe();Zot();PTe();Yot();Qot();ITe();eit();tit();OTe();olo=(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:ilo(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}},ilo=(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("/")},alo=(t,e,r,n)=>{switch(e){case Ne.ZodString:return ETe(t,r);case Ne.ZodNumber:return Rmr(t,r);case Ne.ZodObject:return Imr(t,r);case Ne.ZodBigInt:return pmr(t,r);case Ne.ZodBoolean:return mmr();case Ne.ZodDate:return Not(t,r);case Ne.ZodUndefined:return Lmr();case Ne.ZodNull:return Omr(r);case Ne.ZodArray:return fmr(t,r);case Ne.ZodUnion:case Ne.ZodDiscriminatedUnion:return Pmr(t,r);case Ne.ZodIntersection:return vmr(t,r);case Ne.ZodTuple:return $mr(t,r);case Ne.ZodRecord:return MTe(t,r);case Ne.ZodLiteral:return wmr(t,r);case Ne.ZodEnum:return _mr(t);case Ne.ZodNativeEnum:return xmr(t);case Ne.ZodNullable:return Mmr(t,r);case Ne.ZodOptional:return Amr(t,r);case Ne.ZodMap:return Cmr(t,r);case Ne.ZodSet:return jmr(t,r);case Ne.ZodLazy:return Dn(t.getter()._def,r);case Ne.ZodPromise:return Dmr(t,r);case Ne.ZodNaN:case Ne.ZodNever:return Tmr();case Ne.ZodEffects:return bmr(t,r,n);case Ne.ZodAny:return dmr();case Ne.ZodUnknown:return Fmr();case Ne.ZodDefault:return ymr(t,r);case Ne.ZodBranded:return hmr(t,r);case Ne.ZodReadonly:return kmr(t,r);case Ne.ZodCatch:return gmr(t,r);case Ne.ZodPipeline:return Nmr(t,r);case Ne.ZodFunction:case Ne.ZodVoid:case Ne.ZodSymbol:return;default:return(o=>{})(e)}},slo=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var rit,nit=v(()=>{Ed();Tot();xot();rit=(t,e)=>{let r=cmr(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=Dn(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(lmr(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]=Dn(qie(p),{...r,currentPath:[...r.basePath,r.definitionPath,f]},!0)??{},l.add(f)}return u})(),s=n===void 0?a?{...o,[r.definitionPath]:a}:o:r.nameStrategy==="duplicate-ref"?{...o,...a||r.seenRefs.size?{[r.definitionPath]:{...a,...r.seenRefs.size?{[n]:o}:void 0}}:void 0}:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...a,[n]:o}};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),s}});var qmr=v(()=>{OTe();Tot();Yk();Ed();Eot();Pot();Mot();Rot();Iot();Aot();Dot();jot();$ot();Lot();Fot();kot();Bot();Uot();zot();Vot();Hot();Wot();Jot();Kot();Got();Xot();tit();RTe();Zot();PTe();Yot();Qot();ITe();eit();nit();nit()});function Bmr(t){if(t.type!=="object")throw new Error(`Root schema must have type: 'object' but got type: ${t.type?`'${t.type}'`:"undefined"}`);let e=structuredClone(t);return SD(e,[],e)}function oit(t){if(typeof t=="boolean")return!1;if(t.type==="null")return!0;for(let e of t.oneOf??[])if(oit(e))return!0;for(let e of t.anyOf??[])if(oit(e))return!0;return!1}function SD(t,e,r){if(typeof t=="boolean")throw new TypeError(`Expected object schema but got boolean; path=${e.join("/")}`);if(!JV(t))throw new TypeError(`Expected ${JSON.stringify(t)} to be an object; path=${e.join("/")}`);let n=t.$defs;if(JV(n))for(let[f,p]of Object.entries(n))SD(p,[...e,"$defs",f],r);let o=t.definitions;if(JV(o))for(let[f,p]of Object.entries(o))SD(p,[...e,"definitions",f],r);t.type==="object"&&!("additionalProperties"in t)&&(t.additionalProperties=!1);let a=t.required??[],s=t.properties;if(JV(s)){for(let[f,p]of Object.entries(s))if(!oit(p)&&!a.includes(f))throw new Error(`Zod field at \`${[...e,"properties",f].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`);t.required=Object.keys(s),t.properties=Object.fromEntries(Object.entries(s).map(([f,p])=>[f,SD(p,[...e,"properties",f],r)]))}let u=t.items;JV(u)&&(t.items=SD(u,[...e,"items"],r));let l=t.anyOf;Array.isArray(l)&&(t.anyOf=l.map((f,p)=>SD(f,[...e,"anyOf",String(p)],r)));let c=t.allOf;if(Array.isArray(c))if(c.length===1){let f=SD(c[0],[...e,"allOf","0"],r);Object.assign(t,f),delete t.allOf}else t.allOf=c.map((f,p)=>SD(f,[...e,"allOf",String(p)],r));t.default===null&&delete t.default;let d=t.$ref;if(d&&llo(t,1)){if(typeof d!="string")throw new TypeError(`Received non-string $ref - ${d}; path=${e.join("/")}`);let f=ulo(r,d);if(typeof f=="boolean")throw new Error(`Expected \`$ref: ${d}\` to resolve to an object schema but got boolean`);if(!JV(f))throw new Error(`Expected \`$ref: ${d}\` to resolve to an object but got ${JSON.stringify(f)}`);return Object.assign(t,{...f,...t}),delete t.$ref,SD(t,e,r)}return t}function ulo(t,e){if(!e.startsWith("#/"))throw new Error(`Unexpected $ref format ${JSON.stringify(e)}; Does not start with #/`);let r=e.slice(2).split("/"),n=t;for(let o of r){if(!JV(n))throw new Error(`encountered non-object entry while resolving ${e} - ${JSON.stringify(n)}`);let i=n[o];if(i===void 0)throw new Error(`Key ${o} not found while resolving ${e}`);n=i}return n}function JV(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function llo(t,e){let r=0;for(let n in t)if(r++,r>e)return!0;return!1}var Umr=v(()=>{});function clo(t,e){return rit(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function dlo(t){return Bmr(HL(t,{target:"draft-7"}))}function flo(t){return"_zod"in t}function zmr(t,e,r){return yfr({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:flo(t)?dlo(t):clo(t,{name:e})}},n=>t.parse(JSON.parse(n)))}var Vmr=v(()=>{HV();W8();qmr();Qxe();Umr()});function Wmr(t,e){if(typeof e<"u"&&!Hmr.includes(e))throw new Error(`Invalid method: ${e}. Supported methods are: ${Hmr.join(", ")}`);let r=!t.startsWith("gpt-3")&&!t.startsWith("gpt-4-")&&t!=="gpt-4";if(r&&!e)return"jsonSchema";if(!r&&e==="jsonSchema")throw new Error(`JSON Schema is not supported for model "${t}". Please use a different method, e.g. "functionCalling" or "jsonMode".`);return e??"functionCalling"}function plo(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function Jmr(t,e,r){if(Zv(t))return zmr(t,e,r);if(vy(t))return plo({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:Ii(t,{cycles:"ref",reused:"ref",override(n){n.jsonSchema.title=e}})}},n=>Dz(t,JSON.parse(n)));throw new Error("Unsupported schema response format")}function Kmr(t,e){if(e&&typeof e=="object"&&"images"in e&&Array.isArray(e.images)){let r=e.images.filter(n=>typeof n?.image_url?.url=="string").map(n=>({type:"image",url:n.image_url.url}));return[{type:"text",text:t},...r]}return t}var Hmr,iit=v(()=>{nv();Sy();_y();Vmr();Hmr=["jsonSchema","functionCalling","jsonMode"]});var mlo,Gmr,Xmr=v(()=>{mlo={"gpt-4.1-nano":{maxInputTokens:1047576,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"text-embedding-3-small":{maxInputTokens:8191,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1536,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o1-pro":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o-2024-05-13":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:4096,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o-2024-08-06":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4.1-mini":{maxInputTokens:1047576,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o3-deep-research":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-3.5-turbo":{maxInputTokens:16385,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:4096,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1,imageUrlInputs:!1,pdfToolMessage:!1,imageToolMessage:!1,toolChoice:!0},"text-embedding-3-large":{maxInputTokens:8191,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:3072,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4-turbo":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:4096,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o1-preview":{maxInputTokens:128e3,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o3-mini":{maxInputTokens:2e5,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"codex-mini-latest":{maxInputTokens:2e5,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-nano":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-codex":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4.1":{maxInputTokens:1047576,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o4-mini":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},o1:{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-mini":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o1-mini":{maxInputTokens:128e3,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"text-embedding-ada-002":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1536,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o3-pro":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o-2024-11-20":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},o3:{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o4-mini-deep-research":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-chat-latest":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o-mini":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-pro":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:272e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0}},Gmr=mlo});var KV,Uie=v(()=>{Gk();EG();Xk();Zk();iit();Xmr();rA();nv();Sy();su();aD();rv();Qv();nO();_V();KV=class extends Vy{constructor(e){super(e??{});x(this,"temperature");x(this,"topP");x(this,"frequencyPenalty");x(this,"presencePenalty");x(this,"n");x(this,"logitBias");x(this,"model","gpt-3.5-turbo");x(this,"modelKwargs");x(this,"stop");x(this,"stopSequences");x(this,"user");x(this,"timeout");x(this,"streaming",!1);x(this,"streamUsage",!0);x(this,"maxTokens");x(this,"logprobs");x(this,"topLogprobs");x(this,"apiKey");x(this,"organization");x(this,"__includeRawResponse");x(this,"client");x(this,"clientConfig");x(this,"supportsStrictToolCalling");x(this,"audio");x(this,"modalities");x(this,"reasoning");x(this,"zdrEnabled");x(this,"service_tier");x(this,"promptCacheKey");x(this,"promptCacheRetention");x(this,"verbosity");x(this,"defaultOptions");x(this,"lc_serializable",!0);let r=typeof e?.configuration?.apiKey=="string"||typeof e?.configuration?.apiKey=="function"?e?.configuration?.apiKey:void 0;this.apiKey=e?.apiKey??r??un("OPENAI_API_KEY"),this.organization=e?.configuration?.organization??un("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoning=e?.reasoning,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.promptCacheKey=e?.promptCacheKey??this.promptCacheKey,this.promptCacheRetention=e?.promptCacheRetention??this.promptCacheRetention,this.verbosity=e?.verbosity??this.verbosity,this.disableStreaming=e?.disableStreaming===!0,this.streaming=e?.streaming===!0,this.disableStreaming&&(this.streaming=!1),e?.streaming===!1&&(this.disableStreaming=!0),this.streamUsage=e?.streamUsage??this.streamUsage,this.disableStreaming&&(this.streamUsage=!1),this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling),e?.service_tier!==void 0&&(this.service_tier=e.service_tier),this.zdrEnabled=e?.zdrEnabled??!1}_llmType(){return"openai"}static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning","service_tier"]}get lc_secrets(){return{apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{apiKey:"openai_api_key",modelName:"model"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","model","modelName","modelKwargs","stop","stopSequences","timeout","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming","zdrEnabled","reasoning","promptCacheKey","promptCacheRetention","verbosity"]}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}identifyingParams(){return this._identifyingParams()}_getReasoningParams(e){if(!_D(this.model))return;let r;return this.reasoning!==void 0&&(r={...r,...this.reasoning}),e?.reasoning!==void 0&&(r={...r,...e.reasoning}),r}_getResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&Hi(e.json_schema.schema)?Jmr(e.json_schema.schema,e.json_schema.name,{description:e.json_schema.description}):e}_combineCallOptions(e){return{...this.defaultOptions,...e??{}}}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=nA(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,i.defaultHeaders=oA(i.defaultHeaders),this.client=new Tn(i)}return{...this.clientConfig,...e}}_convertChatOpenAIToolToCompletionsTool(e,r){return VV(e)?fpr(e.metadata.customTool):i0(e)?r?.strict!==void 0?{...e,function:{...e.function,strict:r.strict}}:e:rpr(e,r)}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.withConfig({tools:e.map(o=>OG(o)||VV(o)?o:ipr(o)?o.extras.providerToolDefinition:this._convertChatOpenAIToolToCompletionsTool(o,{strict:n})),...r})}async stream(e,r){return super.stream(e,this._combineCallOptions(r))}async invoke(e,r){return super.invoke(e,this._combineCallOptions(r))}_combineLLMOutput(...e){return e.reduce((r,n)=>(n&&n.tokenUsage&&(r.tokenUsage.completionTokens+=n.tokenUsage.completionTokens??0,r.tokenUsage.promptTokens+=n.tokenUsage.promptTokens??0,r.tokenUsage.totalTokens+=n.tokenUsage.totalTokens??0),r),{tokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}async getNumTokensFromMessages(e){let r=0,n=0,o=0;this.model==="gpt-3.5-turbo-0301"?(n=4,o=-1):(n=3,o=1);let i=await Promise.all(e.map(async a=>{let s=await this.getNumTokens(a.content),u=await this.getNumTokens(vD(a)),l=a.name!==void 0?o+await this.getNumTokens(a.name):0,c=s+n+u+l,d=a;if(d._getType()==="function"&&(c-=2),d.additional_kwargs?.function_call&&(c+=3),d?.additional_kwargs.function_call?.name&&(c+=await this.getNumTokens(d.additional_kwargs.function_call?.name)),d.additional_kwargs.function_call?.arguments)try{c+=await this.getNumTokens(JSON.stringify(JSON.parse(d.additional_kwargs.function_call?.arguments)))}catch(f){console.error("Error parsing function arguments",f,JSON.stringify(d.additional_kwargs.function_call)),c+=await this.getNumTokens(d.additional_kwargs.function_call?.arguments)}return r+=c,c}));return r+=3,{totalCount:r,countPerMessage:i}}async _getNumTokensFromGenerations(e){return(await Promise.all(e.map(async n=>n.message.additional_kwargs?.function_call?(await this.getNumTokensFromMessages([n.message])).countPerMessage[0]:await this.getNumTokens(n.message.content)))).reduce((n,o)=>n+o,0)}async _getEstimatedTokenCountFromPrompt(e,r,n){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(r&&n!=="auto"){let i=npr(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 moderateContent(e,r){let n=this._getClientOptions(r?.options),o=r?.model??"omni-moderation-latest",i={input:e,model:o};return this.caller.call(async()=>{try{return await this.client.moderations.create(i,n)}catch(a){throw s0(a)}})}get profile(){return Gmr[this.model]??{}}_getStructuredOutputMethod(e){let r={...e};if(!this.model.startsWith("gpt-3")&&!this.model.startsWith("gpt-4-")&&this.model!=="gpt-4"){if(r?.method===void 0)return"jsonSchema"}else r.method==="jsonSchema"&&console.warn(`[WARNING]: JSON Schema is not supported for model "${this.model}". Falling back to tool calling.`);return r.method}withStructuredOutput(e,r){let n,o,{schema:i,name:a,includeRaw:s}={...r,schema:e};if(r?.strict!==void 0&&r.method==="jsonMode")throw new Error("Argument `strict` is only supported for `method` = 'function_calling'");let u=Wmr(this.model,r?.method);if(u==="jsonMode"){Hi(i)?o=jC.fromZodSchema(i):o=new ew;let f=Ii(i);n=this.withConfig({outputVersion:"v0",response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"json_mode"},schema:{title:a??"extract",...f}}})}else if(u==="jsonSchema"){let f={name:a??"extract",description:Kz(i),schema:i,strict:r?.strict},p=Ii(f.schema);if(n=this.withConfig({outputVersion:"v0",response_format:{type:"json_schema",json_schema:f},ls_structured_output_format:{kwargs:{method:"json_schema"},schema:{title:f.name,description:f.description,...p}}}),Hi(i)){let m=jC.fromZodSchema(i);o=YN.from(h=>"parsed"in h.additional_kwargs?h.additional_kwargs.parsed:m)}else o=new ew}else{let f=a??"extract";if(Hi(i)){let p=Ii(i);n=this.withConfig({outputVersion:"v0",tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:f}},ls_structured_output_format:{kwargs:{method:"function_calling"},schema:{title:f,...p}},...r?.strict!==void 0?{strict:r.strict}:{}}),o=new Ow({returnSingle:!0,keyName:f,zodSchema:i})}else{let p;typeof i.name=="string"&&typeof i.parameters=="object"&&i.parameters!=null?(p=i,f=i.name):(f=i.title??f,p={name:f,description:i.description??"",parameters:i});let m=Ii(i);n=this.withConfig({outputVersion:"v0",tools:[{type:"function",function:p}],tool_choice:{type:"function",function:{name:f}},ls_structured_output_format:{kwargs:{method:"function_calling"},schema:{title:f,...m}},...r?.strict!==void 0?{strict:r.strict}:{}}),o=new Ow({returnSingle:!0,keyName:f})}}if(!s)return n.pipe(o);let l=pl.assign({parsed:(f,p)=>o.invoke(f.raw,p)}),c=pl.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return gc.from([{raw:n},d])}}});var ATe,ait,sit,Zmr,Ymr,zie,RG=v(()=>{Xk();iit();ra();_V();ATe={providerName:"ChatOpenAI",fromStandardTextBlock(t){return{type:"text",text:t.text}},fromStandardImageBlock(t){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url,...t.metadata?.detail?{detail:t.metadata.detail}:{}}};if(t.source_type==="base64")return{type:"image_url",image_url:{url:`data:${t.mime_type??""};base64,${t.data}`,...t.metadata?.detail?{detail:t.metadata.detail}:{}}};throw new Error(`Image content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)},fromStandardAudioBlock(t){if(t.source_type==="url"){let e=bb({dataUrl:t.url});if(!e)throw new Error(`URL audio blocks with source_type ${t.source_type} must be formatted as a data URL for ChatOpenAI`);let r=e.mime_type||t.mime_type||"",n;try{n=Ope(r)}catch{throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`)}if(n.type!=="audio"||n.subtype!=="wav"&&n.subtype!=="mp3")throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`);return{type:"input_audio",input_audio:{format:n.subtype,data:e.data}}}if(t.source_type==="base64"){let e;try{e=Ope(t.mime_type??"")}catch{throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`)}if(e.type!=="audio"||e.subtype!=="wav"&&e.subtype!=="mp3")throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`);return{type:"input_audio",input_audio:{format:e.subtype,data:t.data}}}throw new Error(`Audio content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)},fromStandardFileBlock(t){if(t.source_type==="url"){let e=bb({dataUrl:t.url}),r=TG(t);if(!e)throw new Error(`URL file blocks with source_type ${t.source_type} must be formatted as a data URL for ChatOpenAI`);return{type:"file",file:{file_data:t.url,...t.metadata?.filename||t.metadata?.name?{filename:r}:{}}}}if(t.source_type==="base64"){let e=TG(t);return{type:"file",file:{file_data:`data:${t.mime_type??""};base64,${t.data}`,...t.metadata?.filename||t.metadata?.name||t.metadata?.title?{filename:e}:{}}}}if(t.source_type==="id")return{type:"file",file:{file_id:t.id}};throw new Error(`File content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)}},ait=({message:t,rawResponse:e,includeRawResponse:r})=>{let n=t.tool_calls;switch(t.role){case"assistant":{let o=[],i=[];for(let l of n??[])try{o.push(HI(l,{returnId:!0}))}catch(c){i.push(vx(l,c.message))}let a={function_call:t.function_call,tool_calls:n};r!==void 0&&(a.__raw_response=e);let s={model_provider:"openai",model_name:e.model,...e.system_fingerprint?{usage:{...e.usage},system_fingerprint:e.system_fingerprint}:{}};t.audio&&(a.audio=t.audio);let u=Kmr(t.content||"",e.choices?.[0]?.message);return new uo({content:u,tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:e.id})}default:return new hy(t.content||"",t.role??"unknown")}},sit=({delta:t,rawResponse:e,includeRawResponse:r,defaultRole:n})=>{let o=t.role??n,i=t.content??"",a;t.function_call?a={function_call:t.function_call}:t.tool_calls?a={tool_calls:t.tool_calls}:a={},r&&(a.__raw_response=e),t.audio&&(a.audio={...t.audio,index:e.choices[0].index});let s={model_provider:"openai",usage:{...e.usage}};if(o==="user")return new BT({content:i,response_metadata:s});if(o==="assistant"){let u=[];if(Array.isArray(t.tool_calls))for(let l of t.tool_calls)u.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new Hr({content:i,tool_call_chunks:u,additional_kwargs:a,id:e.id,response_metadata:s})}else return o==="system"?new UT({content:i,response_metadata:s}):o==="developer"?new UT({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new qT({content:i,additional_kwargs:a,name:t.name,response_metadata:s}):o==="tool"?new $L({content:i,additional_kwargs:a,tool_call_id:t.tool_call_id,response_metadata:s}):new kT({content:i,role:o,response_metadata:s})},Zmr=t=>{if(t.type==="image"){if(t.url)return{type:"image_url",image_url:{url:t.url}};if(t.data)return{type:"image_url",image_url:{url:`data:${t.mimeType};base64,${t.data}`}}}if(t.type==="audio"&&t.data){let e=oUe(()=>{let[,r]=t.mimeType.split("/");return r==="wav"||r==="mp3"?r:"wav"});return{type:"input_audio",input_audio:{data:t.data.toString(),format:e}}}if(t.type==="file"){if(t.data){let e=TG(t);return{type:"file",file:{file_data:`data:${t.mimeType};base64,${t.data}`,filename:e}}}if(t.fileId)return{type:"file",file:{file_id:t.fileId}}}},Ymr=({message:t,model:e})=>{let r=vD(t);if(r==="system"&&_D(e)&&(r="developer"),r==="developer")return{role:"developer",content:t.contentBlocks.filter(o=>o.type==="text")};if(r==="system")return{role:"system",content:t.contentBlocks.filter(o=>o.type==="text")};if(r==="assistant")return{role:"assistant",content:t.contentBlocks.filter(o=>o.type==="text")};if(r==="tool"&&Kv.isInstance(t))return{role:"tool",tool_call_id:t.tool_call_id,content:t.contentBlocks.filter(o=>o.type==="text")};if(r==="function")return{role:"function",name:t.name??"",content:t.contentBlocks.filter(o=>o.type==="text").join("")};function*n(o){for(let i of o){i.type==="text"&&(yield{type:"text",text:i.text});let a=Zmr(i);a&&(yield a)}}return{role:"user",content:Array.from(n(t.contentBlocks))}},zie=({messages:t,model:e})=>t.flatMap(r=>{if("output_version"in r.response_metadata&&r.response_metadata?.output_version==="v1")return Ymr({message:r});let n=vD(r);n==="system"&&_D(e)&&(n="developer");let o=typeof r.content=="string"?r.content:r.content.map(a=>py(a)?AN(a,ATe):a),i={role:n,content:o};if(r.name!=null&&(i.name=r.name),r.additional_kwargs.function_call!=null&&(i.function_call=r.additional_kwargs.function_call),uo.isInstance(r)&&r.tool_calls?.length?i.tool_calls=r.tool_calls.map(bV):(r.additional_kwargs.tool_calls!=null&&(i.tool_calls=r.additional_kwargs.tool_calls),Kv.isInstance(r)&&r.tool_call_id!=null&&(i.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let a={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[i,a]}return i})});var iA,NTe=v(()=>{Gk();EG();Xk();Uie();RG();ra();xm();iA=class extends KV{invocationParams(t,e){let r;t?.strict!==void 0?r=t.strict:this.supportsStrictToolCalling!==void 0&&(r=this.supportsStrictToolCalling);let n={};t?.stream_options!==void 0?n={stream_options:t.stream_options}:this.streamUsage&&(this.streaming||e?.streaming)&&(n={stream_options:{include_usage:!0}});let o={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:t?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:t?.functions,function_call:t?.function_call,tools:t?.tools?.length?t.tools.map(a=>this._convertChatOpenAIToolToCompletionsTool(a,{strict:r})):void 0,tool_choice:sTe(t?.tool_choice),response_format:this._getResponseFormat(t?.response_format),seed:t?.seed,...n,parallel_tool_calls:t?.parallel_tool_calls,...this.audio||t?.audio?{audio:this.audio||t?.audio}:{},...this.modalities||t?.modalities?{modalities:this.modalities||t?.modalities}:{},...this.modelKwargs,prompt_cache_key:t?.promptCacheKey??this.promptCacheKey,prompt_cache_retention:t?.promptCacheRetention??this.promptCacheRetention,verbosity:t?.verbosity??this.verbosity};t?.prediction!==void 0&&(o.prediction=t.prediction),this.service_tier!==void 0&&(o.service_tier=this.service_tier),t?.service_tier!==void 0&&(o.service_tier=t.service_tier);let i=this._getReasoningParams(t);return i!==void 0&&i.effort!==void 0&&(o.reasoning_effort=i.effort),_D(o.model)?o.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens:o.max_tokens=this.maxTokens===-1?void 0:this.maxTokens,o}async _generate(t,e,r){let n={},o=this.invocationParams(e),i=zie({messages:t,model:this.model});if(o.stream){let a=this._streamResponseChunks(t,e,r),s={};for await(let p of a){p.message.response_metadata={...p.generationInfo,...p.message.response_metadata};let m=p.generationInfo?.completion??0;s[m]===void 0?s[m]=p:s[m]=s[m].concat(p)}let u=Object.entries(s).sort(([p],[m])=>parseInt(p,10)-parseInt(m,10)).map(([p,m])=>m),{functions:l,function_call:c}=this.invocationParams(e),d=await this._getEstimatedTokenCountFromPrompt(t,l,c),f=await this._getNumTokensFromGenerations(u);return n.input_tokens=d,n.output_tokens=f,n.total_tokens=d+f,{generations:u,llmOutput:{estimatedTokenUsage:{promptTokens:n.input_tokens,completionTokens:n.output_tokens,totalTokens:n.total_tokens}}}}else{let a=await this.completionWithRetry({...o,stream:!1,messages:i},{signal:e?.signal,...e?.options}),{completion_tokens:s,prompt_tokens:u,total_tokens:l,prompt_tokens_details:c,completion_tokens_details:d}=a?.usage??{};s&&(n.output_tokens=(n.output_tokens??0)+s),u&&(n.input_tokens=(n.input_tokens??0)+u),l&&(n.total_tokens=(n.total_tokens??0)+l),(c?.audio_tokens!==null||c?.cached_tokens!==null)&&(n.input_token_details={...c?.audio_tokens!==null&&{audio:c?.audio_tokens},...c?.cached_tokens!==null&&{cache_read:c?.cached_tokens}}),(d?.audio_tokens!==null||d?.reasoning_tokens!==null)&&(n.output_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.reasoning_tokens!==null&&{reasoning:d?.reasoning_tokens}});let f=[];for(let p of a?.choices??[]){let h={text:p.message?.content??"",message:this._convertCompletionsMessageToBaseMessage(p.message??{role:"assistant"},a)};h.generationInfo={...p.finish_reason?{finish_reason:p.finish_reason}:{},...p.logprobs?{logprobs:p.logprobs}:{}},mc(h.message)&&(h.message.usage_metadata=n),h.message=new uo(Object.fromEntries(Object.entries(h.message).filter(([y])=>!y.startsWith("lc_")))),f.push(h)}return{generations:f,llmOutput:{tokenUsage:{promptTokens:n.input_tokens,completionTokens:n.output_tokens,totalTokens:n.total_tokens}}}}}async*_streamResponseChunks(t,e,r){let n=zie({messages:t,model:this.model}),o={...this.invocationParams(e,{streaming:!0}),messages:n,stream:!0},i,a=await this.completionWithRetry(o,e),s;for await(let u of a){let l=u?.choices?.[0];if(u.usage&&(s=u.usage),!l)continue;let{delta:c}=l;if(!c)continue;let d=this._convertCompletionsDeltaToBaseMessageChunk(c,u,i);i=c.role??i;let f={prompt:e.promptIndex??0,completion:l.index??0};if(typeof d.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let p={...f};l.finish_reason!=null&&(p.finish_reason=l.finish_reason,p.system_fingerprint=u.system_fingerprint,p.model_name=u.model,p.service_tier=u.service_tier),this.logprobs&&(p.logprobs=l.logprobs);let m=new Mi({message:d,text:d.content,generationInfo:p});yield m,await r?.handleLLMNewToken(m.text??"",f,void 0,void 0,void 0,{chunk:m})}if(s){let u={...s.prompt_tokens_details?.audio_tokens!==null&&{audio:s.prompt_tokens_details?.audio_tokens},...s.prompt_tokens_details?.cached_tokens!==null&&{cache_read:s.prompt_tokens_details?.cached_tokens}},l={...s.completion_tokens_details?.audio_tokens!==null&&{audio:s.completion_tokens_details?.audio_tokens},...s.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:s.completion_tokens_details?.reasoning_tokens}};yield new Mi({message:new Hr({content:"",response_metadata:{usage:{...s}},usage_metadata:{input_tokens:s.prompt_tokens,output_tokens:s.completion_tokens,total_tokens:s.total_tokens,...Object.keys(u).length>0&&{input_token_details:u},...Object.keys(l).length>0&&{output_token_details:l}}}),text:""})}if(e.signal?.aborted)throw new Error("AbortError")}async completionWithRetry(t,e){let r=this._getClientOptions(e),n=t.response_format&&t.response_format.type==="json_schema";return this.caller.call(async()=>{try{return n&&!t.stream?await this.client.chat.completions.parse(t,r):await this.client.chat.completions.create(t,r)}catch(o){throw s0(o)}})}_convertCompletionsDeltaToBaseMessageChunk(t,e,r){return sit({delta:t,rawResponse:e,includeRawResponse:this.__includeRawResponse,defaultRole:r})}_convertCompletionsMessageToBaseMessage(t,e){return ait({message:t,rawResponse:e,includeRawResponse:this.__includeRawResponse})}}});var DTe=v(()=>{Zk();rA();su()});var uit=v(()=>{NTe();DTe()});var IG,lit,jTe,ohr,cit,ihr,$Te,LTe=v(()=>{EG();Xk();RG();ra();xm();_V();IG="__openai_function_call_ids__",lit=t=>{let e={...t?.input_tokens_details?.cached_tokens!=null&&{cache_read:t?.input_tokens_details?.cached_tokens}},r={...t?.output_tokens_details?.reasoning_tokens!=null&&{reasoning:t?.output_tokens_details?.reasoning_tokens}};return{input_tokens:t?.input_tokens??0,output_tokens:t?.output_tokens??0,total_tokens:t?.total_tokens??0,input_token_details:e,output_token_details:r}},jTe=t=>{if(t.error){let s=new Error(t.error.message);throw s.name=t.error.code,s}let e,r=[],n=[],o=[],i={model_provider:"openai",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,service_tier:t.service_tier,model_name:t.model},a={};for(let s of t.output)if(s.type==="message")e=s.id,r.push(...s.content.flatMap(u=>u.type==="output_text"?("parsed"in u&&u.parsed!=null&&(a.parsed=u.parsed),{type:"text",text:u.text,annotations:u.annotations}):u.type==="refusal"?(a.refusal=u.refusal,[]):u));else if(s.type==="function_call"){let u={function:{name:s.name,arguments:s.arguments},id:s.call_id};try{n.push(HI(u,{returnId:!0}))}catch(l){let c;typeof l=="object"&&l!=null&&"message"in l&&typeof l.message=="string"&&(c=l.message),o.push(vx(u,c))}a[IG]??(a[IG]={}),s.id&&(a[IG][s.call_id]=s.id)}else if(s.type==="reasoning")a.reasoning=s;else if(s.type==="custom_tool_call"){let u=spr(s);u?n.push(u):o.push(vx(s,"Malformed custom tool call"))}else if(s.type==="computer_call"){let u=upr(s);u?n.push(u):o.push(vx(s,"Malformed computer call"))}else a.tool_outputs??(a.tool_outputs=[]),a.tool_outputs.push(s);return new uo({id:e,content:r,tool_calls:n,invalid_tool_calls:o,usage_metadata:lit(t.usage),additional_kwargs:a,response_metadata:i})},ohr=t=>{let e=(t.summary.length>1?t.summary.reduce((r,n)=>{let o=r[r.length-1];return o.index===n.index?o.text+=n.text:r.push(n),r},[{...t.summary[0]}]):t.summary).map(r=>Object.fromEntries(Object.entries(r).filter(([n])=>n!=="index")));return{...t,summary:e}},cit=t=>{let e=[],r={},n,o=[],i={model_provider:"openai"},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.call_id,index:t.output_index}),a[IG]={[t.item.call_id]:t.item.id};else if(t.type==="response.output_item.done"&&t.item.type==="computer_call")o.push({type:"tool_call_chunk",name:"computer_use",args:JSON.stringify({action:t.item.action}),id:t.item.call_id,index:t.output_index}),a.tool_outputs=[t.item];else if(t.type==="response.output_item.done"&&["web_search_call","file_search_call","code_interpreter_call","mcp_call","mcp_list_tools","mcp_approval_request","image_generation_call","custom_tool_call"].includes(t.item.type))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=jTe(t.response);n=lit(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"||t.type==="response.custom_tool_call_input.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 if(t.type==="response.output_item.added"&&"item"in t&&t.item.type==="reasoning"){let u=t.item.summary?t.item.summary.map((l,c)=>({...l,index:c})):void 0;a.reasoning={id:t.item.id,type:t.item.type,...u?{summary:u}:{}}}else if(t.type==="response.reasoning_summary_part.added")a.reasoning={type:"reasoning",summary:[{...t.part,index:t.summary_index}]};else if(t.type==="response.reasoning_summary_text.delta")a.reasoning={type:"reasoning",summary:[{text:t.delta,type:"summary_text",index:t.summary_index}]};else return t.type==="response.image_generation_call.partial_image",null;return new Mi({text:e.map(u=>u.text).join(""),message:new Hr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})},ihr=t=>{let e=uo.isInstance(t)&&t.response_metadata?.model_provider==="openai";function*r(){let n=bD(()=>{try{let g=vD(t);return g==="system"||g==="developer"||g==="assistant"||g==="user"?g:"assistant"}catch{return"assistant"}}),o,i=new Set,a=new Set,s=new Map,u=new Map;function*l(){if(!o)return;let g=o.content;(typeof g=="string"&&g.length>0||Array.isArray(g)&&g.length>0)&&(yield o),o=void 0}let c=g=>{o||(o={type:"message",role:n,content:[]}),typeof o.content=="string"?o.content=o.content.length>0?[{type:"input_text",text:o.content},...g]:[...g]:o.content.push(...g)},d=g=>{if(typeof g=="string")return g;try{return JSON.stringify(g??{})}catch{return"{}"}},f=g=>{let b=bD(()=>{let _=g.metadata?.detail;return _==="low"||_==="high"||_==="auto"?_:"auto"});if(g.fileId)return{type:"input_image",detail:b,file_id:g.fileId};if(g.url)return{type:"input_image",detail:b,image_url:g.url};if(g.data){let _=typeof g.data=="string"?g.data:Buffer.from(g.data).toString("base64"),w=g.mimeType??"image/png";return{type:"input_image",detail:b,image_url:`data:${w};base64,${_}`}}},p=g=>{let b=TG(g);if(g.fileId&&typeof b=="string")return{type:"input_file",file_id:g.fileId,...b?{filename:b}:{}};if(g.url&&typeof b=="string")return{type:"input_file",file_url:g.url,...b?{filename:b}:{}};if(g.data&&typeof b=="string"){let _=typeof g.data=="string"?g.data:Buffer.from(g.data).toString("base64");return{type:"input_file",file_data:`data:${g.mimeType??"application/octet-stream"};base64,${_}`,...b?{filename:b}:{}}}},m=g=>{let b=bD(()=>{if(Array.isArray(g.summary)){let O=g.summary?.map(E=>E?.text).filter(E=>typeof E=="string")??[];if(O.length>0)return O}return g.reasoning?[g.reasoning]:[]}),_=b.length>0?b.map(T=>({type:"summary_text",text:T})):[{type:"summary_text",text:""}],w={type:"reasoning",id:g.id??"",summary:_};return g.reasoning&&(w.content=[{type:"reasoning_text",text:g.reasoning}]),w},h=g=>({type:"function_call",name:g.name??"",call_id:g.id??"",arguments:d(g.args)}),y=g=>{let b=d(g.output),_=g.status==="success"?"completed":g.status==="error"?"incomplete":void 0;return{type:"function_call_output",call_id:g.toolCallId??"",output:b,..._?{status:_}:{}}};for(let g of t.contentBlocks)if(g.type==="text")c([{type:"input_text",text:g.text}]);else if(g.type!=="invalid_tool_call"){if(g.type==="reasoning")yield*l(),yield m(g);else if(g.type==="tool_call"){yield*l();let b=g.id??"";b&&(i.add(b),s.delete(b)),yield h(g)}else if(g.type==="tool_call_chunk"){if(g.id){let b=s.get(g.id)??{name:g.name,args:[]};g.name&&(b.name=g.name),g.args&&b.args.push(g.args),s.set(g.id,b)}}else if(g.type==="server_tool_call"){yield*l();let b=g.id??"";b&&(a.add(b),u.delete(b)),yield h(g)}else if(g.type==="server_tool_call_chunk"){if(g.id){let b=u.get(g.id)??{name:g.name,args:[]};g.name&&(b.name=g.name),g.args&&b.args.push(g.args),u.set(g.id,b)}}else if(g.type==="server_tool_call_result")yield*l(),yield y(g);else if(g.type!=="audio")if(g.type==="file"){let b=p(g);b&&c([b])}else if(g.type==="image"){let b=f(g);b&&c([b])}else if(g.type==="video"){let b=p(g);b&&c([b])}else g.type==="text-plain"?g.text&&c([{type:"input_text",text:g.text}]):g.type==="non_standard"&&e&&(yield*l(),yield g.value)}yield*l();for(let[g,b]of s){if(!g||i.has(g))continue;let _=b.args.join("");!b.name&&!_||(yield{type:"function_call",call_id:g,name:b.name??"",arguments:_})}for(let[g,b]of u){if(!g||a.has(g))continue;let _=b.args.join("");!b.name&&!_||(yield{type:"function_call",call_id:g,name:b.name??"",arguments:_})}}return Array.from(r())},$Te=({messages:t,zdrEnabled:e,model:r})=>t.flatMap(n=>{let o=n.response_metadata;if(o?.output_version==="v1")return ihr(n);let i=n.additional_kwargs,a=vD(n);if(a==="system"&&_D(r)&&(a="developer"),a==="function")throw new Error("Function messages are not supported in Responses API");if(a==="tool"){let s=n;if(i?.type==="computer_call_output")return{type:"computer_call_output",output:(()=>{if(typeof s.content=="string")return{type:"input_image",image_url:s.content};if(Array.isArray(s.content)){let c=s.content.find(p=>p.type==="input_image");if(c)return c;let d=s.content.find(p=>p.type==="computer_screenshot");if(d)return d;let f=s.content.find(p=>p.type==="image_url");if(f)return{type:"input_image",image_url:typeof f.image_url=="string"?f.image_url:f.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:s.tool_call_id};if(s.additional_kwargs?.customTool)return{type:"custom_tool_call_output",call_id:s.tool_call_id,output:s.content};let u=Array.isArray(s.content)&&s.content.every(l=>typeof l=="object"&&l!==null&&"type"in l&&(l.type==="input_file"||l.type==="input_image"||l.type==="input_text"));return{type:"function_call_output",call_id:s.tool_call_id,id:s.id?.startsWith("fc_")?s.id:void 0,output:u?s.content:typeof s.content!="string"?JSON.stringify(s.content):s.content}}if(a==="assistant"){if(!e&&o?.output!=null&&Array.isArray(o?.output)&&o?.output.length>0&&o?.output.every(f=>"type"in f))return o?.output;let s=[];if(i?.reasoning&&!e){let f=ohr(i.reasoning);s.push(f)}let{content:u}=n;i?.refusal&&(typeof u=="string"&&(u=[{type:"output_text",text:u,annotations:[]}]),u=[...u,{type:"refusal",refusal:i.refusal}]),(typeof u=="string"||u.length>0)&&s.push({type:"message",role:"assistant",...n.id&&!e&&n.id.startsWith("msg_")?{id:n.id}:{},content:bD(()=>typeof u=="string"?u:u.flatMap(f=>f.type==="text"?{type:"output_text",text:f.text,annotations:f.annotations??[]}:f.type==="output_text"||f.type==="refusal"?f:[]))});let l=i?.[IG];uo.isInstance(n)&&n.tool_calls?.length?s.push(...n.tool_calls.map(f=>cpr(f)?{type:"custom_tool_call",id:f.call_id,call_id:f.id??"",input:f.args.input,name:f.name}:lpr(f)?{type:"computer_call",id:f.call_id,call_id:f.id??"",action:f.args.action}:{type:"function_call",name:f.name,arguments:JSON.stringify(f.args),call_id:f.id,...e?{}:{id:l?.[f.id]}})):i?.tool_calls&&s.push(...i.tool_calls.map(f=>({type:"function_call",name:f.function.name,call_id:f.id,arguments:f.function.arguments,...e?{}:{id:l?.[f.id]}})));let c=o?.output?.length?o?.output:i.tool_outputs,d=["computer_call","mcp_call","code_interpreter_call","image_generation_call"];if(c!=null){let p=c?.filter(m=>d.includes(m.type));p.length>0&&s.push(...p)}return s}if(a==="user"||a==="system"||a==="developer"){if(typeof n.content=="string")return{type:"message",role:a,content:n.content};let s=[],u=n.content.flatMap(l=>{if(l.type==="mcp_approval_response"&&s.push({type:"mcp_approval_response",approval_request_id:l.approval_request_id,approve:l.approve}),py(l))return AN(l,ATe);if(l.type==="text")return{type:"input_text",text:l.text};if(l.type==="image_url"){let c=bD(()=>{if(typeof l.image_url=="string")return l.image_url;if(typeof l.image_url=="object"&&l.image_url!==null&&"url"in l.image_url)return l.image_url.url}),d=bD(()=>{if(typeof l.image_url=="string")return"auto";if(typeof l.image_url=="object"&&l.image_url!==null&&"detail"in l.image_url)return l.image_url.detail});return{type:"input_image",image_url:c,detail:d}}return l.type==="input_text"||l.type==="input_image"||l.type==="input_file"?l:[]});return u.length>0&&s.push({type:"message",role:a,content:u}),s}return console.warn(`Unsupported role found when converting to OpenAI Responses API: ${a}`),[]})});var FTe,kTe=v(()=>{Gk();EG();Uie();LTe();rv();FTe=class extends KV{invocationParams(t){let e;t?.strict!==void 0&&(e=t.strict),e===void 0&&this.supportsStrictToolCalling!==void 0&&(e=this.supportsStrictToolCalling);let r={model:this.model,temperature:this.temperature,top_p:this.topP,user:this.user,stream:this.streaming,previous_response_id:t?.previous_response_id,truncation:t?.truncation,include:t?.include,tools:t?.tools?.length?this._reduceChatOpenAITools(t.tools,{stream:this.streaming,strict:e}):void 0,tool_choice:apr(t?.tool_choice)?t?.tool_choice:(()=>{let o=sTe(t?.tool_choice);if(typeof o=="object"&&"type"in o){if(o.type==="function")return{type:"function",name:o.function.name};if(o.type==="allowed_tools")return{type:"allowed_tools",mode:o.allowed_tools.mode,tools:o.allowed_tools.tools};if(o.type==="custom")return{type:"custom",name:o.custom.name}}})(),text:(()=>{if(t?.text)return t.text;let o=this._getResponseFormat(t?.response_format);return o?.type==="json_schema"?o.json_schema.schema!=null?{format:{type:"json_schema",schema:o.json_schema.schema,description:o.json_schema.description,name:o.json_schema.name,strict:o.json_schema.strict},verbosity:t?.verbosity}:void 0:{format:o,verbosity:t?.verbosity}})(),parallel_tool_calls:t?.parallel_tool_calls,max_output_tokens:this.maxTokens===-1?void 0:this.maxTokens,prompt_cache_key:t?.promptCacheKey??this.promptCacheKey,prompt_cache_retention:t?.promptCacheRetention??this.promptCacheRetention,...this.zdrEnabled?{store:!1}:{},...this.modelKwargs},n=this._getReasoningParams(t);return n!==void 0&&(r.reasoning=n),r}async _generate(t,e,r){let n=this.invocationParams(e);if(n.stream){let o=this._streamResponseChunks(t,e,r),i;for await(let a of o)a.message.response_metadata={...a.generationInfo,...a.message.response_metadata},i=i?.concat(a)??a;return{generations:i?[i]:[],llmOutput:{estimatedTokenUsage:i?.message?.usage_metadata}}}else{let o=await this.completionWithRetry({input:$Te({messages:t,zdrEnabled:this.zdrEnabled??!1,model:this.model}),...n,stream:!1},{signal:e?.signal,...e?.options});return{generations:[{text:o.output_text,message:jTe(o)}],llmOutput:{id:o.id,estimatedTokenUsage:o.usage?{promptTokens:o.usage.input_tokens,completionTokens:o.usage.output_tokens,totalTokens:o.usage.total_tokens}:void 0}}}}async*_streamResponseChunks(t,e,r){let n=await this.completionWithRetry({...this.invocationParams(e),input:$Te({messages:t,zdrEnabled:this.zdrEnabled??!1,model:this.model}),stream:!0},e);for await(let o of n){let i=cit(o);i!=null&&(yield i,await r?.handleLLMNewToken(i.text||"",{prompt:e.promptIndex??0,completion:0},void 0,void 0,void 0,{chunk:i}))}}async completionWithRetry(t,e){return this.caller.call(async()=>{let r=this._getClientOptions(e);try{return t.text?.format?.type==="json_schema"&&!t.stream?await this.client.responses.parse(t,r):await this.client.responses.create(t,r)}catch(n){throw s0(n)}})}_reduceChatOpenAITools(t,e){let r=[];for(let n of t)if(OG(n))n.type==="image_generation"&&e?.stream&&(n.partial_images=1),r.push(n);else if(VV(n)){let o=n.metadata.customTool;r.push({type:"custom",name:o.name,description:o.description,format:o.format})}else i0(n)?r.push({type:"function",name:n.function.name,parameters:n.function.parameters,description:n.function.description,strict:e?.strict??null}):uTe(n)&&r.push(dpr(n));return r}}});var dit=v(()=>{DTe();kTe()});var Px,fit=v(()=>{EG();Xk();Uie();NTe();kTe();Px=class ahr extends KV{constructor(r){super(r);x(this,"useResponsesApi",!1);x(this,"responses");x(this,"completions");this.fields=r,this.useResponsesApi=r?.useResponsesApi??!1,this.responses=r?.responses??new FTe(r),this.completions=r?.completions??new iA(r)}get lc_serializable_keys(){return[...super.lc_serializable_keys,"useResponsesApi"]}get callKeys(){return[...super.callKeys,"useResponsesApi"]}_useResponsesApi(r){let n=r?.tools?.some(OG),o=r?.previous_response_id!=null||r?.text!=null||r?.truncation!=null||r?.include!=null||r?.reasoning?.summary!=null||this.reasoning?.summary!=null,i=r?.tools?.some(uTe)||r?.tools?.some(VV);return this.useResponsesApi||n||o||i||Qfr(this.model)}getLsParams(r){let n=this._combineCallOptions(r);return this._useResponsesApi(r)?this.responses.getLsParams(n):this.completions.getLsParams(n)}invocationParams(r){let n=this._combineCallOptions(r);return this._useResponsesApi(r)?this.responses.invocationParams(n):this.completions.invocationParams(n)}async _generate(r,n,o){return this._useResponsesApi(n)?this.responses._generate(r,n):this.completions._generate(r,n,o)}async*_streamResponseChunks(r,n,o){if(this._useResponsesApi(n)){yield*this.responses._streamResponseChunks(r,this._combineCallOptions(n),o);return}yield*this.completions._streamResponseChunks(r,this._combineCallOptions(n),o)}withConfig(r){let n=new ahr(this.fields);return n.defaultOptions={...this.defaultOptions,...r},n}}});var shr=v(()=>{DTe();uit();dit();fit()});var pit=v(()=>{Gk();Zk();rA();xm();su();rv();rie();Ik()});var uhr=v(()=>{Zk();pit();rA();su()});var Qk,mit=v(()=>{Gk();Zk();rA();su();Ik();lV();Qk=class extends bx{constructor(e){let r={maxConcurrency:2,...e};super(r);x(this,"model","text-embedding-ada-002");x(this,"modelName");x(this,"batchSize",512);x(this,"stripNewLines",!0);x(this,"dimensions");x(this,"timeout");x(this,"organization");x(this,"encodingFormat");x(this,"client");x(this,"clientConfig");x(this,"apiKey");let n=r?.apiKey??r?.openAIApiKey??un("OPENAI_API_KEY");this.organization=r?.configuration?.organization??un("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.encodingFormat=r?.encodingFormat,this.clientConfig={apiKey:n,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration}}async embedDocuments(e){let r=_x(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.encodingFormat&&(s.encoding_format=this.encodingFormat),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),this.encodingFormat&&(r.encoding_format=this.encodingFormat);let{data:n}=await this.embeddingWithRetry(r);return n[0].embedding}async embeddingWithRetry(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=nA(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,i.defaultHeaders=oA(i.defaultHeaders),this.client=new Tn(i)}let r={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw s0(n)}})}}});var hit,lhr=v(()=>{Gk();Zk();mit();rA();su();hit=class extends Qk{constructor(e){super(e);x(this,"azureOpenAIApiVersion");x(this,"azureOpenAIApiKey");x(this,"azureADTokenProvider");x(this,"azureOpenAIApiInstanceName");x(this,"azureOpenAIApiDeploymentName");x(this,"azureOpenAIBasePath");this.batchSize=e?.batchSize??1,this.azureOpenAIApiKey=e?.azureOpenAIApiKey??(typeof e?.apiKey=="string"?e?.apiKey:void 0)??un("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=e?.azureOpenAIApiVersion??e?.openAIApiVersion??un("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=e?.azureOpenAIBasePath??un("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=e?.azureOpenAIApiInstanceName??un("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(e?.azureOpenAIApiEmbeddingsDeploymentName||e?.azureOpenAIApiDeploymentName)??(un("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||un("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=nA(n),{apiKey:i,...a}=this.clientConfig,s={...a,baseURL:o,timeout:this.timeout,maxRetries:0};this.azureADTokenProvider||(s.apiKey=n.azureOpenAIApiKey),s.baseURL||delete s.baseURL,s.defaultHeaders=oA(s.defaultHeaders,!0,"2.0.0"),this.client=new zV({apiVersion:this.azureOpenAIApiVersion,azureADTokenProvider:this.azureADTokenProvider,deployment:this.azureOpenAIApiDeploymentName,...s})}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 s0(n)}})}}});function AG(t,e){let r=$ee(e.schema),n=zee(e.schema);if(!e.schema||r||n)return new fhr({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(a,s,u)=>new Promise((l,c)=>{let d=Nc(u,{callbacks:s?.getChild()});yg.runWithConfig(x_(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 _lo({...e,description:i,schema:o,func:async(a,s,u)=>new Promise((l,c)=>{let d,f=()=>{u?.signal&&d&&u.signal.removeEventListener("abort",d)};u?.signal&&(d=()=>{f(),c(UL(u.signal))},u.signal.addEventListener("abort",d,{once:!0}));let p=Nc(u,{callbacks:s?.getChild()});yg.runWithConfig(x_(p),async()=>{try{let m=await t(a,p);if(u?.signal?.aborted){f();return}f(),l(m)}catch(m){f(),c(m)}})})})}function vlo(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!XBe(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new Kv({status:"success",content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new Kv({status:"success",content:wlo(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function wlo(t){try{return JSON.stringify(t)??""}catch{return`${t}`}}var chr,dhr,fhr,_lo,eq=v(()=>{zo();xpe();k6();BL();Oz();Ez();GT();G6();zN();Sy();iWe();rv();Qet();rO();rge();HV();chr=class extends tie{constructor(e){super(e??{});x(this,"extras");x(this,"returnDirect",!1);x(this,"verboseParsingErrors",!1);x(this,"responseFormat","content");x(this,"defaultConfig");this.verboseParsingErrors=e?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=e?.responseFormat??this.responseFormat,this.defaultConfig=e?.defaultConfig??this.defaultConfig,this.metadata=e?.metadata??this.metadata,this.extras=e?.extras??this.extras}get lc_namespace(){return["langchain","tools"]}async invoke(e,r){let n,o=vi(K6(this.defaultConfig,r));return NL(e)?(n=e.args,o={...o,toolCall:e}):n=e,this.call(n,o)}async call(e,r,n){let o=NL(e)?e.args:e,i;if(Hi(this.schema))try{i=await Jz(this.schema,o)}catch(m){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
Details: ${m.message}`),fHe(m)&&(h=`${h}

${Zt.prettifyError(m)}`),new xQ(h,JSON.stringify(e))}else{let m=fl(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(y=>`${y.keywordLocation}: ${y.error}`).join(`
`)}`),new xQ(h,JSON.stringify(e))}i=o}let a=qL(r),s=Cm.configure(a.callbacks,this.callbacks,a.tags||n,this.tags,a.metadata,this.metadata,{verbose:this.verbose}),u;NL(e)&&(u=e.id),!u&&nCt(a)&&(u=a.toolCall.id);let l=await s?.handleToolStart(this.toJSON(),typeof e=="string"?e:JSON.stringify(e),a.runId,void 0,void 0,void 0,a.runName,u);delete a.runId;let c;try{let m=await this._call(i,l,a);c=ZIt(m)?await YIt(m,async h=>{try{await l?.handleToolEvent(h)}catch(y){await l?.handleToolError(y)}}):m}catch(m){throw await l?.handleToolError(m),m}let d,f;if(this.responseFormat==="content_and_artifact")if(Array.isArray(c)&&c.length===2)[d,f]=c;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.
Result: ${JSON.stringify(c)}`);else d=c;let p=vlo({content:d,artifact:f,toolCallId:u,name:this.name,metadata:this.metadata});return await l?.handleToolEnd(p),p}},dhr=class extends chr{constructor(e){super(e);x(this,"schema",Ae.object({input:Ae.string().optional()}).transform(e=>e.input))}call(e,r){let n=typeof e=="string"||e==null?{input:e}:e;return super.call(n,r)}},fhr=class extends dhr{constructor(e){super(e);x(this,"name");x(this,"description");x(this,"func");this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect}static lc_name(){return"DynamicTool"}async call(e,r){let n=qL(r);return n.runName===void 0&&(n.runName=this.name),super.call(e,n)}_call(e,r,n){return this.func(e,r,n)}},_lo=class extends chr{constructor(e){super(e);x(this,"description");x(this,"func");x(this,"schema");this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect,this.schema=e.schema}static lc_name(){return"DynamicStructuredTool"}async call(e,r,n){let o=qL(r);return o.runName===void 0&&(o.runName=this.name),super.call(e,o,n)}_call(e,r,n){return this.func(e,r,n)}}});var git=v(()=>{rA();su();eq()});var phr=v(()=>{});var mhr=v(()=>{});var hhr=v(()=>{});var ghr=v(()=>{});var yhr=v(()=>{});var Slo,Clo,xlo,Tlo,Olo,Elo,Plo,Mlo,Rlo,Ilo,F4a,bhr=v(()=>{ra();eq();HV();Slo=Zt.object({type:Zt.literal("screenshot")}),Clo=Zt.object({type:Zt.literal("click"),x:Zt.number(),y:Zt.number(),button:Zt.enum(["left","right","wheel","back","forward"]).default("left")}),xlo=Zt.object({type:Zt.literal("double_click"),x:Zt.number(),y:Zt.number(),button:Zt.enum(["left","right","wheel","back","forward"]).default("left")}),Tlo=Zt.object({type:Zt.literal("drag"),path:Zt.array(Zt.object({x:Zt.number(),y:Zt.number()}))}),Olo=Zt.object({type:Zt.literal("keypress"),keys:Zt.array(Zt.string())}),Elo=Zt.object({type:Zt.literal("move"),x:Zt.number(),y:Zt.number()}),Plo=Zt.object({type:Zt.literal("scroll"),x:Zt.number(),y:Zt.number(),scroll_x:Zt.number(),scroll_y:Zt.number()}),Mlo=Zt.object({type:Zt.literal("type"),text:Zt.string()}),Rlo=Zt.object({type:Zt.literal("wait"),duration:Zt.number().optional()}),Ilo=Zt.discriminatedUnion("type",[Slo,Clo,xlo,Tlo,Olo,Elo,Plo,Mlo,Rlo]),F4a=Zt.object({action:Ilo})});var Alo,U4a,_hr=v(()=>{eq();HV();Alo=Zt.object({type:Zt.literal("exec"),command:Zt.array(Zt.string()),env:Zt.record(Zt.string(),Zt.string()).optional(),working_directory:Zt.string().optional(),timeout_ms:Zt.number().optional(),user:Zt.string().optional()}),U4a=Zt.discriminatedUnion("type",[Alo])});var W4a,vhr=v(()=>{eq();HV();W4a=Zt.object({commands:Zt.array(Zt.string()).describe("Array of shell commands to execute"),timeout_ms:Zt.number().optional().describe("Optional timeout in milliseconds for the commands"),max_output_length:Zt.number().optional().describe("Optional maximum number of characters to return from each command")})});var Nlo,Dlo,jlo,X4a,whr=v(()=>{eq();HV();Nlo=Zt.object({type:Zt.literal("create_file"),path:Zt.string(),diff:Zt.string()}),Dlo=Zt.object({type:Zt.literal("update_file"),path:Zt.string(),diff:Zt.string()}),jlo=Zt.object({type:Zt.literal("delete_file"),path:Zt.string()}),X4a=Zt.discriminatedUnion("type",[Nlo,Dlo,jlo])});var Shr=v(()=>{git();phr();mhr();hhr();ghr();yhr();bhr();_hr();vhr();whr()});var Chr=v(()=>{Qv();eq();Ez()});var xhr=v(()=>{RG()});var Thr=v(()=>{RG();LTe()});var CD=v(()=>{Gk();Xk();Zk();Uie();RG();NTe();uit();LTe();kTe();dit();fit();shr();pit();uhr();mit();lhr();git();Shr();Chr();xhr();Thr();rA()});var Ehr=S((mVa,Ohr)=>{Ohr.exports={createRequire:function(t){return typeof require<"u"?require:function(r){throw new Error('Dynamic require of "'+r+'" is not supported in this environment')}}}});var $lo,Llo,Phr,Mhr=v(()=>{$lo=$(Ehr(),1),Llo=Object.defineProperty,Phr=(t,e)=>{for(var r in e)Llo(t,r,{get:e[r],enumerable:!0})}});var Flo,yit,Rhr=v(()=>{Mhr();su();lV();Ik();Flo={};Phr(Flo,{JinaEmbeddings:()=>yit});yit=class extends bx{constructor(e){let r={maxConcurrency:2,...e};super(r);x(this,"model","jina-clip-v2");x(this,"batchSize",24);x(this,"baseUrl","https://api.jina.ai/v1/embeddings");x(this,"stripNewLines",!0);x(this,"dimensions",1024);x(this,"apiKey");x(this,"normalized",!0);let n=r?.apiKey||un("JINA_API_KEY")||un("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=_x(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 qTe,Ihr=v(()=>{Rhr();qTe=class extends yit{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}}});var GV,Ahr=v(()=>{CD();GV=class extends Qk{constructor(e){super(e),this.customConfig=e}async embedQuery(e){return(await this.callEmbeddingAPI([e]))[0]}async embedDocuments(e){return await this.callEmbeddingAPI(e)}async callEmbeddingAPI(e){let r={model:this.customConfig.modelName,input:e,encoding_format:"float"},o=`${this.customConfig.configuration?.baseURL||"https://api.openai.com/v1"}/embeddings`,i=this.customConfig.apiKey,s=await(this.customConfig.configuration?.fetch||fetch)(o,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json",...this.customConfig.headers||{}},body:JSON.stringify(r)});if(!s.ok){let l=await s.text();throw new Error(`Embedding API request failed: ${s.status} ${s.statusText} - ${l}`)}let u=await s.json();if(!u.data||!Array.isArray(u.data))throw new Error("Invalid API response format: missing or invalid data array");return u.data.map(l=>{if(!l.embedding||!Array.isArray(l.embedding))throw new Error("Invalid API response format: missing or invalid embedding array");return l.embedding})}}});var BTe,klo,dd,XV=v(()=>{gr();BC();OS();Qe();Dt();att();btt();Dtt();CD();BTe=require("obsidian");aA();Ihr();Ahr();klo={"copilot-plus":GV,"copilot-plus-jina":qTe,openai:Qk,cohereai:itt,google:ytt,"azure openai":hit,ollama:Ntt,"lm-studio":GV,"3rd party (openai-format)":Qk,siliconflow:GV,openrouterai:GV},dd=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>ee().plusLicenseKey,"copilot-plus-jina":()=>ee().plusLicenseKey,openai:()=>ee().openAIApiKey,cohereai:()=>ee().cohereApiKey,google:()=>ee().googleApiKey,"azure openai":()=>ee().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key",siliconflow:()=>ee().siliconflowApiKey,openrouterai:()=>ee().openRouterAiApiKey};this.initialize(),ml(()=>this.initialize())}initialize(){let e=ee().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let r=klo[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(kC).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=no(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=no(r);return e===n})[0]}async getEmbeddingsAPI(){let r=ee().embeddingModelKey;if(!t.modelMap.hasOwnProperty(r))throw new qo(`No embedding model found for: ${r}`);let n=this.getCustomModel(r);if(n.plusExclusive&&!ee().isPlusUser)throw new BTe.Notice("Plus-only model, please consider upgrading to Plus to access it."),new qo("Plus-only model selected but user is not on Plus plan");if(n.believerExclusive){let s=await Xl.getInstance().validateLicenseKey();if(!s.plan||s.plan.toLowerCase()!=="believer")throw new BTe.Notice("Believer-only model, please consider upgrading to Believer to access it."),new qo("Believer-only model selected but user is not on Believer plan")}let o=t.modelMap[r];if(!o.hasApiKey)throw new qo(`API key is not provided for the embedding model: ${r}`);let i=await this.getEmbeddingConfig(n);try{return t.embeddingModel=new o.EmbeddingConstructor(i),t.embeddingModel}catch(a){throw new qo(`Error creating embedding model: ${r}. ${a.message}`)}}async getEmbeddingConfig(e){let r=ee(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await kn(r.plusLicenseKey),timeout:1e4,batchSize:ee().embeddingBatchSize,configuration:{baseURL:i1,fetch:e.enableCors?hl:void 0}},"copilot-plus-jina":{model:n,apiKey:await kn(r.plusLicenseKey),timeout:1e4,batchSize:ee().embeddingBatchSize,dimensions:e.dimensions,baseUrl:i1+"/embeddings",configuration:{fetch:e.enableCors?hl:void 0}},openai:{modelName:n,apiKey:await kn(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:ee().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?hl:void 0}},cohereai:{model:n,apiKey:await kn(e.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await kn(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await kn(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 kn(e.apiKey||"default-key")}`}},"lm-studio":{modelName:n,openAIApiKey:await kn(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?hl:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await kn(e.apiKey||""),batchSize:ee().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?hl:void 0,dangerouslyAllowBrowser:!0}},siliconflow:{modelName:n,apiKey:await kn(e.apiKey||r.siliconflowApiKey),batchSize:ee().embeddingBatchSize,configuration:{baseURL:e.baseUrl||qC.siliconflow.host,fetch:e.enableCors?hl:void 0}},openrouterai:{modelName:n,apiKey:await kn(e.apiKey||r.openRouterAiApiKey),batchSize:ee().embeddingBatchSize,configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?hl:void 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 BTe.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: `+Wr(n)+`
with CORS Error: `+Wr(o);throw new Error(i)}}}}});function Mx(t){return(t.miyoServerUrl||"").trim()}function kh(t){return!t.enableMiyo||!bit()?!1:!Vie.Platform.isMobile||!!Mx(t)}function tq(t){return t.vault.getName()}function UTe(t,e){let r=t.vault.adapter;if(r instanceof Vie.FileSystemAdapter)return r.getFullPath(e);let n=r;return typeof n.getFullPath=="function"?n.getFullPath(e):e}function NG(t,e){let r=qlo(t);if(!r)return e;let n=Nhr(r),o=Nhr(e),i=`${n}/`;return o.startsWith(i)?o.slice(i.length):e}function qlo(t){let e=t.vault.adapter;if(e instanceof Vie.FileSystemAdapter)return e.getBasePath();let r=e;if(typeof r.getBasePath=="function")return r.getBasePath();if(typeof r.basePath=="string")return r.basePath}function Nhr(t){return t.replace(/\\/g,"/").replace(/\/+$/,"")}var Vie,u0=v(()=>{id();Vie=require("obsidian")});var Dhr,zTe,jhr=v(()=>{Xe();Qe();Dt();Dhr=require("obsidian"),zTe=class t{constructor(){this.cachedBaseUrl=null}static getInstance(){return t.instance||(t.instance=new t),t.instance}async resolveBaseUrl(e={}){let r=(e.overrideUrl||"").trim();if(r.length>0)return this.normalizeBaseUrl(r);if(this.cachedBaseUrl&&!e.forceRefresh)return this.cachedBaseUrl;if(!Dhr.Platform.isDesktopApp)return null;let n=await this.readServiceConfig();if(n==="missing"){let i=this.getDefaultBaseUrl();return this.cachedBaseUrl=null,ee().debug&&F(`Miyo service discovery file missing; using fallback ${i}`),i}if(!n)return this.cachedBaseUrl=null,null;let o=this.normalizeBaseUrl(`http://${n.host}:${n.port}`);return this.cachedBaseUrl=o,o}normalizeBaseUrl(e){return e.trim().replace(/\/+$/,"")}getDefaultBaseUrl(){return this.normalizeBaseUrl("http://127.0.0.1:8742")}getServiceFilePaths(){let e=this.getNodeRequire();if(!e)return[];let r=e("os"),n=e("process"),o=e("path"),i=r.homedir(),a=r.platform(),s=n.env||{};if(a==="win32"){let u=(s.LOCALAPPDATA||"").trim(),l=(s.APPDATA||"").trim();return[u,o.join(i,"AppData","Local"),l,o.join(i,"AppData","Roaming")].filter((d,f,p)=>d.length>0&&p.indexOf(d)===f).map(d=>o.join(d,"Miyo","service.json"))}return a==="linux"?[o.join(i,".config","Miyo","service.json")]:a==="darwin"?[o.join(i,"Library","Application Support","Miyo","service.json")]:(Ce(`Miyo service discovery unsupported platform: ${a}`),[])}async readServiceConfig(){let e=this.getServiceFilePaths();if(e.length===0)return null;let r=this.getNodeRequire();if(!r)return null;let n=r("fs"),o=!1;for(let i of e)try{let a=await n.promises.readFile(i,"utf8"),s=JSON.parse(a);return!s.host||typeof s.host!="string"?(Ce("Miyo service discovery missing host"),null):typeof s.port!="number"||Number.isNaN(s.port)?(Ce("Miyo service discovery missing port"),null):(ee().debug&&F(`Miyo service discovery resolved host=${s.host} port=${s.port}`),s)}catch(a){if(this.isMissingFileError(a)){o=!0;continue}return ee().debug&&Ce(`Miyo service discovery failed: ${Wr(a)}`),null}return o?"missing":null}isMissingFileError(e){return e?.code==="ENOENT"}getNodeRequire(){let e=globalThis?.require;return typeof e=="function"?e:null}}});var $hr,l0,DG=v(()=>{BC();Xe();jhr();Qe();Dt();$hr=require("obsidian"),l0=class{constructor(){this.discovery=zTe.getInstance()}async resolveBaseUrl(e){let r=await this.discovery.resolveBaseUrl({overrideUrl:e});if(!r)throw new Error("Miyo base URL not available");return r}async isBackendAvailable(e){try{let r=await this.resolveBaseUrl(e),n=await this.requestJson(r,"/v0/health",{method:"GET"});return n?.status!=="ok"?(Ce(`Miyo health check failed: status="${n?.status??"unknown"}"`),!1):!0}catch(r){return Ce(`Miyo backend availability check failed: ${Wr(r)}`),!1}}async getFolder(e,r){return this.requestJson(e,"/v0/folder",{method:"GET",query:{path:r}})}async scanFolder(e,r,n=!1){return this.requestJson(e,"/v0/scan",{method:"POST",body:{path:r,force:n}})}async listFolderFiles(e,r){return this.requestJson(e,"/v0/folder/files",{method:"GET",query:{folder_name:r.folderName,title:r.title,file_path:r.filePath,mtime_after:r.mtimeAfter,mtime_before:r.mtimeBefore,offset:r.offset,limit:r.limit,order_by:r.orderBy}})}async getDocumentsByPath(e,r,n){return this.requestJson(e,"/v0/folder/documents",{method:"GET",query:{path:n,folder_name:r}})}async search(e,r,n,o,i){let a={query:n,...r?{folder_name:r}:{},limit:o,...i&&i.length>0?{filters:i}:{}};return ee().debug&&F("Miyo search request:",{baseUrl:e,payload:a}),this.requestJson(e,"/v0/search",{method:"POST",body:a})}async searchRelated(e,r,n){let o={file_path:r,...n?.folderName?{folder_name:n.folderName}:{},...typeof n?.limit=="number"?{limit:n.limit}:{},...n?.filters&&n.filters.length>0?{filters:n.filters}:{}};return this.requestJson(e,"/v0/search/related",{method:"POST",body:o})}async parseDoc(e,r,n){return this.requestJson(e,"/v0/parse-doc",{method:"POST",body:{folder_name:r,path:n}})}async buildHeaders(){let e=ee(),r={},n=e.plusLicenseKey?await kn(e.plusLicenseKey):"";return n&&(r.Authorization=`Bearer ${n}`),r}async requestJson(e,r,n){let o=new URL(r,e);n.query&&Object.entries(n.query).forEach(([l,c])=>{c!=null&&o.searchParams.set(l,String(c))});let i=n.body?JSON.stringify(n.body):void 0,a=await this.buildHeaders();F("Miyo request:",{method:n.method,url:o.toString(),hasBody:!!i,hasAuthorizationHeader:!!a.Authorization,...ee().debug&&n.method==="POST"?{postBody:n.body}:{}});let s=await(0,$hr.requestUrl)({url:o.toString(),method:n.method,headers:a,contentType:i?"application/json":void 0,body:i,throw:!1});if(s.status>=400){let c=this.parseResponseJson(s.json,s.text)?.detail||s.text||"";throw Ce(`Miyo request failed (${s.status}): ${c}`),new Error(c?`Miyo request failed with status ${s.status}: ${c}`:`Miyo request failed with status ${s.status}`)}let u=this.parseResponseJson(s.json,s.text);return ee().debug&&F(`Miyo request ${n.method} ${o.toString()} succeeded`),u}parseResponseJson(e,r){if(typeof e=="string")try{return JSON.parse(e)}catch(n){return ie(`Failed to parse Miyo JSON response: ${Wr(n)}`),{}}if(e!=null)return e;if(r)try{return JSON.parse(r)}catch(n){return ie(`Failed to parse Miyo text response: ${Wr(n)}`),{}}return{}}}});var Lhr,VTe,Fhr=v(()=>{Lhr=require("obsidian");Xe();DG();u0();Qe();VTe=class{constructor(e){this.app=e;this.client=new l0}async initialize(e){try{let r=await this.getBaseUrl();await this.client.getFolder(r,this.getFolderName())}catch(r){Ce(`Miyo backend initialization failed: ${r}`),new Lhr.Notice("Failed to initialize Miyo backend. Check Miyo service discovery or folder setup.")}}async clearIndex(e){Ce("Miyo clearIndex requested from Copilot, but folder lifecycle is managed in Miyo.")}requiresEmbeddings(){return!1}async upsert(e){F(`Skipping direct Miyo upsert for ${e.path}; Miyo manages indexing itself.`)}async upsertBatch(e){return e.length>0&&F(`Skipping direct Miyo batch upsert for ${e.length} documents.`),0}async removeByPath(e){F(`Skipping direct Miyo delete for ${e}; Miyo manages file lifecycle itself.`)}async getIndexedFiles(){let e=await this.getAllIndexedFiles();return Array.from(new Set(e.map(r=>this.toVaultPath(r.path)))).sort()}async getLatestFileMtime(){return(await this.getAllIndexedFiles()).reduce((r,n)=>Math.max(r,n.mtime??0),0)}async isIndexEmpty(){return(await this.getAllIndexedFiles()).length===0}async hasIndex(e){return(await this.getDocumentsByPath(e)).length>0}async getDocumentsByPath(e){let r=await this.getBaseUrl(),n=UTe(this.app,e);return((await this.client.getDocumentsByPath(r,this.getFolderName(),n)).documents??[]).map(a=>this.fromMiyoDocument(e,a))}async checkAndHandleEmbeddingModelChange(e){return!1}async save(){}async checkIndexIntegrity(){}async garbageCollect(){return F("Skipping Miyo garbage collection; folder lifecycle is managed in Miyo."),0}markFileMissingEmbeddings(e){}clearFilesMissingEmbeddings(){}getFilesMissingEmbeddings(){return[]}markUnsavedChanges(){}onunload(){}isRemoteBackend(){return!0}async requestIndexRefresh(e=!1){let r=await this.getBaseUrl();await this.client.scanFolder(r,this.getFolderName(),e)}async getBaseUrl(){let e=Mx(ee());return this.client.resolveBaseUrl(e)}getFolderName(){return tq(this.app)}async getAllIndexedFiles(){let e=await this.getBaseUrl(),r=200,n=0,o=null,i=[];do{let a=await this.client.listFolderFiles(e,{folderName:this.getFolderName(),offset:n,limit:r}),s=a.files??[];if(i.push(...s),o===null&&(o=a.total??s.length),n+=s.length,s.length===0)break}while(n<o);return i}toVaultPath(e){return NG(this.app,e)}fromMiyoDocument(e,r){let n=r.path?this.toVaultPath(r.path):e,o=r.chunk_text??"",i={...r.metadata??{}};return!i.chunkId&&r.chunk_index!==void 0&&(i.chunkId=`${n}#${r.chunk_index}`),r.chunk_index!==void 0&&i.chunkIndex===void 0&&(i.chunkIndex=r.chunk_index),{id:r.id,title:r.title??"",content:o,embedding:[],path:n,embeddingModel:r.embedding_model??"",created_at:typeof r.created_at=="number"?r.created_at:0,ctime:r.ctime??0,mtime:r.mtime??0,tags:r.tags??[],extension:r.extension??"",nchars:r.nchars??o.length,metadata:i}}}});function Bhr(t){return t!==void 0&&Hie.includes(t)?khr[t]:void 0}var khr,qhr,Hie,HTe=v(()=>{khr={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"},qhr={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},Hie=Object.keys(khr)});function ku(t,e){if(e.length<_it)Array.prototype.push.apply(t,e);else{let r=e.length;for(let n=0;n<r;n+=_it)Array.prototype.push.apply(t,e.slice(n,n+_it))}}function Whr(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 zlo(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Vlo(){return typeof process<"u"&&process.release&&process.release.name==="node"}function Hhr(){return BigInt(Math.floor(performance.now()*1e6))}function ZV(t){return typeof t=="number"&&(t=BigInt(t)),t<Uhr?`${t}ns`:t<zhr?`${t/Uhr}\u03BCs`:t<Vhr?`${t/zhr}ms`:`${t/Vhr}s`}function Rx(){return zlo()?Hhr():Vlo()||typeof process<"u"&&typeof process?.hrtime?.bigint=="function"?process.hrtime.bigint():typeof performance<"u"?Hhr():BigInt(0)}function Wie(){return`${Blo}-${Ulo++}`}function jG(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 Jhr(t,e){return e[1]===t[1]?t[0]-e[0]:e[1]-t[1]}function $G(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 WTe(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 LG(t,e){return WTe(t,[e])[e]}function vit(t,e){let r=Hlo[e];if(r===void 0)throw new Error(Vr("INVALID_DISTANCE_SUFFIX",t).message);return t*r}function JTe(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 Pd(t){return t?.constructor?.name==="AsyncFunction"}var Blo,Ulo,Uhr,zhr,Vhr,_it,Hlo,fd=v(()=>{qh();Blo=Date.now().toString().slice(5),Ulo=0,Uhr=BigInt(1e3),zhr=BigInt(1e6),Vhr=BigInt(1e9),_it=65535;Hlo={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344}});function Vr(t,...e){let r=new Error(Whr(Jlo[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}var Wlo,Jlo,qh=v(()=>{HTe();fd();Wlo=Hie.join(`
 - `),Jlo={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:
 - ${Wlo}`,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 Khr(t){return{raw:Number(t),formatted:ZV(t)}}function Ghr(t){if(t.id){if(typeof t.id!="string")throw Vr("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return Wie()}function wit(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(xD(n)){let i=Cit(n);if(!Array.isArray(o)||o.length!==i)throw Vr("INVALID_INPUT_VECTOR",r,i,o.length);continue}if(FG(n)){if(!Array.isArray(o))return r;let i=Sit(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=wit(o,n);if(i)return r+"."+i;continue}if(typeof o!==n)return r}}}function Xhr(t){return t==="geopoint"}function xD(t){return typeof t=="string"&&/^vector\[\d+\]$/.test(t)}function FG(t){return typeof t=="string"&&Klo[t]}function Sit(t){return Glo[t]}function Cit(t){let e=Number(t.slice(7,-1));switch(!0){case isNaN(e):throw Vr("INVALID_VECTOR_VALUE",t);case e<=0:throw Vr("INVALID_VECTOR_SIZE",t);default:return e}}var Klo,Glo,Jie=v(()=>{qh();fd();fd();Klo={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},Glo={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"}});function Zhr(){return{idToInternalId:new Map,internalIdToId:[],save:Xlo,load:Zlo}}function Xlo(t){return{internalIdToId:t.internalIdToId}}function Zlo(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 du(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?du(t,e.toString()):e}function c0(t,e){if(t.internalIdToId.length<e)throw new Error(`Invalid internalId ${e}`);return t.internalIdToId[e-1]}var d0=v(()=>{});function Qlo(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function eco(t,e){let r=du(t.sharedInternalDocumentStore,e);return t.docs[r]}function tco(t,e){let r=e.length,n=Array.from({length:r});for(let o=0;o<r;o++){let i=du(t.sharedInternalDocumentStore,e[o]);n[o]=t.docs[i]}return n}function rco(t){return t.docs}function nco(t,e,r){let n=du(t.sharedInternalDocumentStore,e);return typeof t.docs[n]<"u"?!1:(t.docs[n]=r,t.count++,!0)}function oco(t,e){let r=du(t.sharedInternalDocumentStore,e);return typeof t.docs[r]>"u"?!1:(delete t.docs[r],t.count--,!0)}function ico(t){return t.count}function aco(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function sco(t){return{docs:t.docs,count:t.count}}function Yhr(){return{create:Qlo,get:eco,getMultiple:tco,getAll:rco,store:nco,remove:oco,count:ico,load:aco,save:sco}}var xit=v(()=>{d0()});function egr(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),Vr("PLUGIN_CRASHED")}return r}var Qhr,tgr=v(()=>{qh();Qhr=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"]});function Ix(t,e,r,n){if(t.some(Pd))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function YV(t,e,r){if(t.some(Pd))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function kG(t,e,r,n,o){if(t.some(Pd))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function qG(t,e,r,n){if(t.some(Pd))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function ngr(t,e){if(t.some(Pd))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}var rgr,Tit,rq=v(()=>{fd();rgr=["tokenizer","index","documentsStore","sorter"],Tit=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"]});function Oit(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(f0(t.l),f0(t.r))+1,e.h=Math.max(f0(e.l),f0(e.r))+1,e}function Eit(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(f0(t.l),f0(t.r))+1,e.h=Math.max(f0(e.l),f0(e.r))+1,e}function igr(t,e,r){let n=[];function o(i){i!==null&&(e<i.k&&o(i.l),i.k>=e&&i.k<=r&&ku(n,i.v),r>i.k&&o(i.r))}return o(t.root),n}function Pit(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&&ku(n,i.v),!r&&i.k>e&&ku(n,i.v),o.push(i.r),o.push(i.l))}return n}function Mit(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&&ku(n,i.v),!r&&i.k<e&&ku(n,i.v),o.push(i.r),o.push(i.l))}return n}function agr(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 sgr(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}function ugr(t,e,r,n=500){function o(i,a,s){if(i===null)return ogr++,{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 ogr%n===0?lco(i,a):i}t.root=o(t.root,e,r)}function lco(t,e){t.h=1+Math.max(f0(t.l),f0(t.r));let r=f0(t.l)-f0(t.r);return r>1&&e<t.l.k?Eit(t):r<-1&&e>t.r.k?Oit(t):r>1&&e>t.l.k?(t.l=Oit(t.l),Eit(t)):r<-1&&e<t.r.k?(t.r=Eit(t.r),Oit(t)):t}function f0(t){return t!==null?t.h:-1}function lgr(t,e){let r=agr(t.root,e);return r===null?null:r.v}function cco(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 cgr(t,e,r){let n=agr(t.root,r);if(n){if(n.v.length===1){cco(t,r);return}n.v.splice(n.v.indexOf(e),1)}}var ogr,dgr=v(()=>{fd();ogr=0});function fgr(){return{numberToDocumentId:new Map}}function pgr(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function mgr(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 hgr(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&&ku(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&&ku(i,u)}return i}}throw new Error("Invalid operation")}function ggr(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 $G(i)}}throw new Error("Invalid operation")}var ygr=v(()=>{fd()});function dco(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 Rit(t,e,r){let n=dco(t,e,r);return{distance:n,isBounded:n>=0}}var Iit=v(()=>{});function BG(t,e){t.w=e.w+t.s}function KTe(t,e){t.d.push(e)}function fco(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function Nit(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(jG(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&Rit(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),jG(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))Nit(t.c[i],e,r,n,o);return e}function bgr(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 QV(t=!1,e="",r=""){return new Ait(r,e,t)}function _gr(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=bgr(u,a),d=c.length;if(u===a){KTe(s,r),s.e=!0;return}let f=u[d];if(d<l&&d===a.length){let p=QV(!0,a,i);p.c[f]=s;let m=p.c[f];m.s=u.substring(d),m.k=f,t.c[i]=p,BG(p,t),BG(m,p),KTe(p,r);return}if(d<l&&d<a.length){let p=QV(!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],y=QV(!0,e.substring(o+d),h);KTe(y,r),p.c[h]=y,BG(p,t),BG(y,p),BG(m,p);return}o+=l-1,t=s}else{let u=QV(!0,a,i);KTe(u,r),t.c[i]=u,BG(u,t);return}}}function Kie(t,e,r,n,o,i){if(!(n<0)){if(t.w.startsWith(e)){Nit(t,i,e,!1,0);return}if(t.e){let{w:a,d:s}=t;if(a&&(Rit(e,a,o).isBounded&&(i[a]=[]),jG(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&&Kie(t.c[e[r]],e,r+1,n,o,i),Kie(t,e,r+1,n-1,o,i);for(let a in t.c)Kie(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&Kie(t.c[a],e,r+1,n-1,o,i)}}}function Dit(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,Kie(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=bgr(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 Nit(t,i,e,r,n),i}}function vgr(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||fco(t,r)}else return!1}return!0}var Ait,wgr=v(()=>{Iit();fd();Ait=class{constructor(e,r,n){x(this,"k");x(this,"s");x(this,"c",{});x(this,"d",[]);x(this,"e");x(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 Sgr(){return{root:null}}function Cgr(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 xgr(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 Tgr(t,e,r,n=!0,o="asc",i=!1){let a=i?Pgr:Egr,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 Ogr(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=mco(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=pco(e);if(n){let u=o?Pgr:Egr;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 pco(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 mco(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 Egr(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 Pgr(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,y,g=1e3,b,_,w,T,O;do{let B=Math.sin(h),k=Math.cos(h);w=Math.sqrt(m*B*(m*B)+(f*p-d*m*k)*(f*p-d*m*k)),T=d*p+f*m*k,O=Math.atan2(w,T),b=f*m*B/w,_=1-b*b;let q=T-2*d*p/_,Z=n/16*_*(4+n*(4-3*_));y=h,h=u+(1-Z)*n*b*(O+Z*w*(q+Z*T*(-1+2*q*q)))}while(Math.abs(h-y)>1e-12&&--g>0);let E=_*(6378137*6378137-o*o)/(o*o),P=1+E/16384*(4096+E*(-768+E*(320-175*E))),R=E/1024*(256+E*(-128+E*(74-47*E))),I=R*w*(T-2*d*p/_+R/4*(T*(-1+2*w*w)-R/6*O*(-3+4*w*w)*(-3+4*O*O)));return o*P*(O-I)}var Mgr=v(()=>{});function GTe(t,e,r=0,n){if(e===0)throw Vr("INVALID_BOOST_VALUE");let o=new Map,i=t.length;for(let h=0;h<i;h++){let y=t[h],g=y.length;for(let b=0;b<g;b++){let[_,w]=y[b],T=w*e,O=o.get(_)?.[0];O!==void 0?o.set(_,[O*1.5+T,(o?.get(_)?.[1]||0)+1]):o.set(_,[T,1])}}let a=[];for(let h of o.entries())a.push([h[0],h[1][0]]);let s=a.sort((h,y)=>y[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,y)=>h[2]>y[2]?-1:h[2]<y[2]?1:h[1]>y[1]?-1:h[1]<y[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 jit(t,e,r,n,o,{k:i,b:a,d:s}){return Math.log(1+(r-e+.5)/(e+.5))*(s+t*(i+1))/(t+i*(1-a+a*n/o))}var Gie=v(()=>{qh()});function $it(t,e){let r=0;for(let n=0;n<e;n++)r+=t[n]*t[n];return Math.sqrt(r)}function XTe(t,e,r,n=.8){let o=$it(t,r),i=[];for(let[a,[s,u]]of Object.entries(e)){let l=0;for(let d=0;d<r;d++)l+=t[d]*u[d];let c=l/(o*s);c>=n&&i.push([a,c])}return i.sort((a,s)=>s[1]-a[1])}var ZTe=v(()=>{});function hco(t,e,r,n,o){let i=du(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 gco(t,e,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=du(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 yco(t,e,r,n){let o=du(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 bco(t,e,r){t.tokenOccurrences[e][r]--}function _co(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=du(e.sharedInternalDocumentStore,i[p]),h=l?.[m]?.[n]??0,y=jit(h,c,t.docsCount,s[m],a,t.params.relevance);d.push([m,y])}return d}function Igr(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)){Igr(t,e,a,n,s);continue}if(xD(a))n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a,n.vectorIndexes[s]={size:Cit(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:sgr(0,[]),isArray:u};break;case"string":case"string[]":n.indexes[s]={type:"Radix",node:QV(),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:fgr(),isArray:u};break;case"geopoint":n.indexes[s]={type:"BKD",node:Sgr(),isArray:u};break;default:throw Vr("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,s)}n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a}}return n}function vco(t,e,r,n,o,i,a,s){return u=>{let l=du(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;ugr(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),_gr(d,p,l);break}case"Flat":{pgr(d,u,l);break}case"BKD":{Cgr(d,u,[l]);break}}}}function wco(t,e,r,n,o,i,a,s,u,l){if(xD(i))return Sco(e,r,o,n);let c=vco(t,e,r,n,a,s,u,l);if(!FG(i))return c(o);let d=o,f=d.length;for(let p=0;p<f;p++)c(d[p])}function Sco(t,e,r,n){r instanceof Float32Array||(r=new Float32Array(r));let o=t.vectorIndexes[e].size,i=$it(r,o);t.vectorIndexes[e].vectors[n]=[i,r]}function Rgr(t,e,r,n,o,i,a,s,u){let l=du(e.sharedInternalDocumentStore,n);if(xD(i))return delete e.vectorIndexes[r].vectors[n],!0;let{type:c,node:d}=e.indexes[r];switch(c){case"AVL":return cgr(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),vgr(d,p,l);return!0}case"Flat":return mgr(d,l,o),!0;case"BKD":return xgr(d,o,l),!1}}function Cco(t,e,r,n,o,i,a,s,u){if(!FG(i))return Rgr(t,e,r,n,o,i,a,s,u);let l=Sit(i),c=o,d=c.length;for(let f=0;f<d;f++)Rgr(t,e,r,n,c[f],l,a,s,u);return!0}function xco(t,e,r,n){if(!(r in e.tokenOccurrences))return[];let{node:o,type:i}=e.indexes[r];if(i!=="Radix")throw Vr("WRONG_SEARCH_PROPERTY_TYPE",r);let{exact:a,tolerance:s}=t.params,u=Dit(o,{term:n,exact:a,tolerance:s}),l=new Set;for(let c in u)if(jG(u,c))for(let f of u[c])l.add(f);return t.index.calculateResultScores(t,e,r,n,Array.from(l))}function Tco(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 Vr("UNKNOWN_FILTER_PROPERTY",i);let{node:s,type:u,isArray:l}=e.indexes[i];if(u==="Bool"){let f=s[a.toString()];ku(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:y=!1}=a[d],g=vit(f,m),b=Tgr(s.root,p,g,h,void 0,y);ku(o[i],b.flatMap(({docIDs:_})=>_))}else{let{coordinates:f,inside:p=!0,highPrecision:m=!1}=a[d],h=Ogr(s.root,f,p,void 0,m);ku(o[i],h.flatMap(({docIDs:y})=>y))}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=Dit(s,{term:p,exact:!0});ku(o[i],Object.values(m).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw Vr("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?ggr:hgr;ku(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=Pit(s,f,!1);break}case"gte":{p=Pit(s,f,!0);break}case"lt":{p=Mit(s,f,!1);break}case"lte":{p=Mit(s,f,!0);break}case"eq":{p=lgr(s,f)??[];break}case"between":{let[m,h]=f;p=igr(s,m,h);break}}ku(o[i],p)}}return $G(Object.values(o))}function Oco(t){return t.searchableProperties}function Eco(t){return t.searchablePropertiesWithTypes}function Agr(t){let e=QV(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]=Agr(t.c[r]);return e}function Pco(t){return{numberToDocumentId:new Map(t)}}function Mco(t){return Array.from(t.numberToDocumentId.entries())}function Rco(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:Agr(p),isArray:h};break;case"Flat":c[f]={type:"Flat",node:Pco(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 Ico(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:Mco(p),isArray:m}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function Ngr(){return{create:Igr,insert:wco,remove:Cco,insertDocumentScoreParameters:hco,insertTokenScoreParameters:gco,removeDocumentScoreParameters:yco,removeTokenScoreParameters:bco,calculateResultScores:_co,search:xco,searchByWhereClause:Tco,getSearchableProperties:Oco,getSearchablePropertiesWithTypes:Eco,load:Rco,save:Ico}}var Lit=v(()=>{qh();dgr();ygr();wgr();Mgr();fd();Gie();ZTe();Jie();d0()});function Dgr(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=Dgr(t,e,s,n,u);ku(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!xD(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 Vr("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function Nco(t,e,r,n){return n?.enabled!==!1?Dgr(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function Dco(t,e,r,n){if(!t.enabled)return;t.isSorted=!1;let o=du(t.sharedInternalDocumentStore,r),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&Fit(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function jgr(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)Fco(t,r);t.isSorted=!0}function jco(t,e,r){return e[1].localeCompare(r[1],Bhr(t))}function $co(t,e){return t[1]-e[1]}function Lco(t,e){return e[1]?-1:1}function Fco(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=jco.bind(null,t.language);break;case"number":n=$co.bind(null);break;case"boolean":n=Lco.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 kco(t){let e=Object.keys(t.sorts);for(let r of e)Fit(t,r)}function Fit(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 qco(t,e,r){if(!t.enabled)return;let n=t.sorts[e],o=du(t.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function Bco(t,e,r){if(!t.enabled)throw Vr("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw Vr("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return Fit(t,n),jgr(t),e.sort((a,s)=>{let u=i.docs.get(du(t.sharedInternalDocumentStore,a[0])),l=i.docs.get(du(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 Uco(t){return t.enabled?t.sortableProperties:[]}function zco(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function Vco(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 Hco(t){if(!t.enabled)return{enabled:!1};kco(t),jgr(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 $gr(){return{create:Nco,insert:Dco,remove:qco,save:Hco,load:Vco,sortBy:Bco,getSortableProperties:Uco,getSortablePropertiesWithTypes:zco}}var kit=v(()=>{qh();Jie();d0();fd();HTe()});function Kco(t){return t<192||t>383?t:Jco[t-192]||t}function Lgr(t){let e=[];for(let r=0;r<t.length;r++)e[r]=Kco(t.charCodeAt(r));return String.fromCharCode(...e)}var Jco,Fgr=v(()=>{Jco=[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 qgr(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(qit),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(kgr),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+sA+QTe+"[^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(kgr),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(qit),e&&n.test(e)&&(t=e+Gco[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(qit),e&&n.test(e)&&(t=e+Xco[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(YTe),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(YTe),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(YTe),o=new RegExp(Yco),i=new RegExp("^"+sA+QTe+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(YTe),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}var Gco,Xco,Zco,QTe,sA,Xie,qit,Yco,YTe,kgr,Bgr=v(()=>{Gco={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"},Xco={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},Zco="[^aeiou]",QTe="[aeiouy]",sA=Zco+"[^aeiouy]*",Xie=QTe+"[aeiou]*",qit="^("+sA+")?"+Xie+sA,Yco="^("+sA+")?"+Xie+sA+"("+Xie+")?$",YTe="^("+sA+")?"+Xie+sA+Xie+sA,kgr="^("+sA+")?"+QTe});function Bit(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=Lgr(e),this.normalizationCache.set(r,e),e)}function Qco(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function Ugr(t,e,r){if(e&&e!==this.language)throw Vr("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=qhr[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=Qco(n);return this.allowDuplicates?o:Array.from(new Set(o))}function Uit(t={}){if(!t.language)t.language="english";else if(!Hie.includes(t.language))throw Vr("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw Vr("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=qgr;else throw Vr("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 Vr("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw Vr("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw Vr("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:Ugr,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:Bit,normalizationCache:new Map};return n.tokenize=Ugr.bind(n),n.normalizeToken=Bit,n}var eOe=v(()=>{qh();Fgr();HTe();Bgr()});function tdo(t){let e={formatElapsedTime:Khr,getDocumentIndexId:Ghr,getDocumentProperties:WTe,validateSchema:wit};for(let r of Tit){let n=r;if(t[n]){if(typeof t[n]!="function")throw Vr("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!rgr.includes(r)&&!Tit.includes(r))throw Vr("UNSUPPORTED_COMPONENT",r)}function UG({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=Wie());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=Uit(a):a=Uit({language:r??"english"}),n.tokenizer&&r)throw Vr("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=Zhr();s||(s=Ngr()),l||(l=$gr()),u||(u=Yhr()),tdo(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:rdo()};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 Qhr)h[g]=(h[g]??[]).concat(egr(h,g));let y=h.afterCreate;return y&&ngr(y,h),h}function rdo(){return"{{VERSION}}"}var zgr=v(()=>{Jie();xit();tgr();rq();Lit();d0();kit();eOe();qh();fd()});var Vgr=v(()=>{});var zit=v(()=>{Jie();xit();Lit();eOe();kit();d0()});var tOe,Vit,Hit,Wit=v(()=>{tOe="fulltext",Vit="hybrid",Hit="vector"});var nq,oq,Jit=v(()=>{Wit();nq=Symbol("orama.insertions"),oq=Symbol("orama.removals")});function Kit(t){typeof t[nq]!="number"&&(queueMicrotask(()=>{t[nq]=void 0}),t[nq]=0),t[nq]>1e3?(Hgr("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[nq]=-1):t[nq]>=0&&t[nq]++}function Git(t){typeof t[oq]!="number"&&(queueMicrotask(()=>{t[oq]=void 0}),t[oq]=0),t[oq]>1e3?(Hgr("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[oq]=-1):t[oq]>=0&&t[oq]++}var Hgr,Xit=v(()=>{Jit();Hgr=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)}});function Zie(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw Vr("SCHEMA_VALIDATION_FAILURE",i);return Pd(t.index.beforeInsert)||Pd(t.index.insert)||Pd(t.index.afterInsert)?ado(t,e,r,n,o):sdo(t,e,r,n,o)}async function ado(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Vr("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Vr("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await Ix(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];Wgr(m,h,f,p)}return await udo(t,s,l,d,u,r,e,o),n||await Ix(t.afterInsert,t,s,e),Kit(t),s}function sdo(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Vr("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Vr("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||Ix(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];Wgr(m,h,f,p)}return ldo(t,s,l,d,u,r,e,o),n||Ix(t.afterInsert,t,s,e),Kit(t),s}function Wgr(t,e,r,n){if(!(Xhr(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(xD(e)&&Array.isArray(n))&&!(FG(e)&&Array.isArray(n))&&!(odo.has(e)&&ido.has(t))&&t!==e)throw Vr("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function udo(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 ldo(t,e,r,n,o,i,a,s){for(let c of r){let d=n[c];if(typeof d>"u")continue;let f=t.index.getSearchablePropertiesWithTypes(t.data.index)[c];t.index.beforeInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o),t.index.insert(t.index,t.data.index,c,e,d,f,i,t.tokenizer,o,s),t.index.afterInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o)}let u=t.sorter.getSortableProperties(t.data.sorting),l=t.getDocumentProperties(a,u);for(let c of u){let d=l[c];if(typeof d>"u")continue;let f=t.sorter.getSortablePropertiesWithTypes(t.data.sorting)[c];t.sorter.insert(t.data.sorting,c,e,d,f,i)}}var odo,ido,Zit=v(()=>{zit();fd();rq();Xit();qh();odo=new Set(["enum","enum[]"]),ido=new Set(["string","number"])});function eH(t,e,r,n){return Pd(t.index.beforeRemove)||Pd(t.index.remove)||Pd(t.index.afterRemove)?cdo(t,e,r,n):ddo(t,e,r,n)}async function cdo(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=c0(t.internalDocumentIDStore,du(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await Ix(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 y=f[h];if(typeof y>"u")continue;let g=d[h];await t.index.beforeRemove?.(t.data.index,h,u,y,g,r,t.tokenizer,l),await t.index.remove(t.index,t.data.index,h,e,y,g,r,t.tokenizer,l)||(o=!1),await t.index.afterRemove?.(t.data.index,h,u,y,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 Ix(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),Git(t),o}function ddo(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=c0(t.internalDocumentIDStore,du(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||Ix(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 y=f[h];if(typeof y>"u")continue;let g=d[h];t.index.beforeRemove?.(t.data.index,h,u,y,g,r,t.tokenizer,l),t.index.remove(t.index,t.data.index,h,e,y,g,r,t.tokenizer,l)||(o=!1),t.index.afterRemove?.(t.data.index,h,u,y,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||Ix(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),Git(t),o}function Yie(t,e,r,n,o){return Pd(t.index.beforeRemove)||Pd(t.index.remove)||Pd(t.index.afterRemove)||Pd(t.beforeRemoveMultiple)||Pd(t.afterRemoveMultiple)?fdo(t,e,r,n,o):pdo(t,e,r,n,o)}async function fdo(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>c0(t.internalDocumentIDStore,du(t.internalDocumentIDStore,s)));return o||await YV(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 eH(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await YV(t.afterRemoveMultiple,t,a),i}function pdo(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>c0(t.internalDocumentIDStore,du(t.internalDocumentIDStore,l)));o||YV(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)eH(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||YV(t.afterRemoveMultiple,t,a),i}var Yit=v(()=>{rq();d0();Xit();fd()});function mdo(t,e){return t[1]-e[1]}function hdo(t,e){return e[1]-t[1]}function gdo(t="desc"){return t.toLowerCase()==="asc"?mdo:hdo}function zG(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(".")?LG(c,d):c[d],p=s[d],m=n[d].values;switch(p){case"number":{let h=r[d].ranges;Jgr(h,m)(f);break}case"number[]":{let h=new Set,y=r[d].ranges,g=Jgr(y,m,h);for(let b of f)g(b);break}case"boolean":case"enum":case"string":{Kgr(m,p)(f);break}case"boolean[]":case"enum[]":case"string[]":{let g=Kgr(m,p==="boolean[]"?"boolean":"string",new Set);for(let b of f)g(b);break}default:throw Vr("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=gdo(d.sort);c.values=Object.fromEntries(Object.entries(c.values).sort(f).slice(d.offset??0,d.limit??10))}}return n}function Jgr(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 Kgr(t,e,r){let n=e==="boolean"?"false":"";return o=>{let i=o?.toString()??n;r?.has(i)||(t[i]=(t[i]??0)+1,r?.add(i))}}var rOe=v(()=>{qh();fd()});function VG(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 nOe=v(()=>{});function HG(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 b=n[g];if(typeof i[b]>"u")throw Vr("UNKNOWN_GROUP_BY_PROPERTY",b);if(!Ggr.includes(i[b]))throw Vr("INVALID_GROUP_BY_PROPERTY",b,Ggr.join(", "),i[b])}let a=e.map(([g])=>c0(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 b=n[g],_={property:b,perValue:{}},w=new Set;for(let T=0;T<u;T++){let O=s[T],E=LG(O,b);if(typeof E>"u")continue;let P=typeof E!="boolean"?E:""+E,R=_.perValue[P]??{indexes:[],count:0};R.count>=l||(R.indexes.push(T),R.count++,_.perValue[P]=R,w.add(E))}c.push(Array.from(w)),d[b]=_}let f=Xgr(c),p=f.length,m=[];for(let g=0;g<p;g++){let b=f[g],_=b.length,w={values:[],indexes:[]},T=[];for(let O=0;O<_;O++){let E=b[O],P=n[O];T.push(d[P].perValue[typeof E!="boolean"?E:""+E].indexes),w.values.push(E)}w.indexes=$G(T).sort((O,E)=>O-E),w.indexes.length!==0&&m.push(w)}let h=m.length,y=Array.from({length:h});for(let g=0;g<h;g++){let b=m[g],_=r.reduce||ydo,w=b.indexes.map(P=>({id:a[P],score:e[P][1],document:s[P]})),T=_.reducer.bind(null,b.values),O=_.getInitialValue(b.indexes.length),E=w.reduce(T,O);y[g]={values:b.values,result:E}}return y}function Xgr(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=Xgr(t,e+1),o=[];for(let i of r)for(let a of n){let s=[i];ku(s,a),o.push(s)}return o}var ydo,Ggr,oOe=v(()=>{qh();fd();d0();ydo={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},Ggr=["string","number","boolean"]});function Zgr(t,e,r){let n=Rx(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(iOe,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,y=e.preflight===!0,{index:g,docs:b}=t.data,_=t.tokenizer.tokenize(d??"",r),w=t.caches.propertiesToSearch;if(!w){let B=t.index.getSearchablePropertiesWithTypes(g);w=t.index.getSearchableProperties(g),w=w.filter(k=>B[k].startsWith("string")),t.caches.propertiesToSearch=w}if(f&&f!=="*"){for(let B of f)if(!w.includes(B))throw Vr("UNKNOWN_INDEX",B,w.join(", "));w=w.filter(B=>f.includes(B))}let T=tH(t.tokenizer,t.index,t.documentsStore,r,e,w,_,t.documentsStore.count(b),n),O=Object.keys(e.where??{}).length>0,E=[];O&&(E=t.index.searchByWhereClause(T,g,e.where));let P=_.length;if(P||f?.length){let B=w.length;for(let k=0;k<B;k++){let q=w[k],Z=T.indexMap[q];if(P!==0)for(let W=0;W<P;W++){let re=_[W],ue=t.index.search(T,g,q,re);ku(Z[re],ue)}else{Z[""]=[];let W=t.index.search(T,g,q,"");ku(Z[""],W)}let V=Object.values(Z);T.docsIntersection[q]=GTe(V,e?.boost?.[q]??1,p,P);let Y=T.docsIntersection[q],X=Y.length;for(let W=0;W<X;W++){let[re,ue]=Y[W],le=T.uniqueDocsIDs[re];le?T.uniqueDocsIDs[re]=le+ue+.5:T.uniqueDocsIDs[re]=ue}}}else _.length===0&&d?T.uniqueDocsIDs={}:T.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(B=>[B,0]));let R=Object.entries(T.uniqueDocsIDs).map(([B,k])=>[+B,k]);if(O&&(R=VG(E,R)),e.sortBy)if(typeof e.sortBy=="function"){let B=R.map(([Z])=>Z),q=t.documentsStore.getMultiple(t.data.docs,B).map((Z,V)=>[R[V][0],R[V][1],Z]);q.sort(e.sortBy),R=q.map(([Z,V])=>[Z,V])}else R=t.sorter.sortBy(t.data.sorting,R,e.sortBy).map(([B,k])=>[du(t.internalDocumentIDStore,B),k]);else R=R.sort(Jhr);let I;y||(I=m?Qgr(t,R,c,l,m):aOe(t,R,c,l));let A={elapsed:{formatted:"",raw:0},hits:[],count:R.length};if(typeof I<"u"&&(A.hits=I.filter(Boolean),h||JTe(A,s)),u){let B=zG(t,R,e.facets);A.facets=B}return e.groupBy&&(A.groups=HG(t,R,e.groupBy)),A.elapsed=t.formatElapsedTime(Rx()-T.timeStart),A}async function a(){t.beforeSearch&&await qG(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await kG(t.afterSearch,t,e,r,s),s}return o?a():i()}var Ygr=v(()=>{Gie();rOe();nOe();oOe();rq();d0();qh();fd();rH()});function Qit(t,e,r="english"){let n=Rx(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw Vr("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:y,docs:g}=t.data;if(s?.value.length!==f)throw s?.property===void 0||s?.value.length===void 0?Vr("INVALID_INPUT_VECTOR","undefined",f,"undefined"):Vr("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let b=XTe(s.value,p,f,e.similarity).map(([B,k])=>[du(t.internalDocumentIDStore,B),k]),_=t.caches.propertiesToSearch;if(!_){let B=t.index.getSearchablePropertiesWithTypes(y);_=t.index.getSearchableProperties(y),_=_.filter(k=>B[k].startsWith("string")),t.caches.propertiesToSearch=_}let w=[],T=tH(t.tokenizer,t.index,t.documentsStore,r,e,_,w,t.documentsStore.count(g),n),O=[];h&&(O=t.index.searchByWhereClause(T,y,e.where),b=VG(O,b));let E=[];m&&(E=zG(t,b,e.facets));let P=Array.from({length:u});for(let B=0;B<u;B++){let k=b[B+l];if(!k)break;let q=t.data.docs.docs[k[0]];if(q){c||(q[s.property]=null);let Z={id:c0(t.internalDocumentIDStore,k[0]),score:k[1],document:q};P[B]=Z}}let R=[];e.groupBy&&(R=HG(t,b,e.groupBy));let A=Rx()-n;return{count:b.length,hits:P.filter(Boolean),elapsed:{raw:Number(A),formatted:ZV(A)},...E?{facets:E}:{},...R?{groups:R}:{}}}async function a(){t.beforeSearch&&await qG(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await kG(t.afterSearch,t,e,r,s),s}return o?a():i()}var eat=v(()=>{rH();fd();rOe();qh();ZTe();nOe();oOe();d0();rq()});function tyr(t,e,r){let n=Rx(),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=bdo(t,e,r),f=_do(t,e),{index:p,docs:m}=t.data,h=e.hybridWeights,y=wdo(d,f,e.term??"",h),g=t.tokenizer.tokenize(e.term??"",r),b=t.caches.propertiesToSearch;if(!b){let A=t.index.getSearchablePropertiesWithTypes(p);b=t.index.getSearchableProperties(p),b=b.filter(B=>A[B].startsWith("string")),t.caches.propertiesToSearch=b}if(e.properties&&e.properties!=="*"){for(let A of e.properties)if(!b.includes(A))throw Vr("UNKNOWN_INDEX",A,b.join(", "));b=b.filter(A=>e.properties.includes(A))}let _=tH(t.tokenizer,t.index,t.documentsStore,r,e,b,g,t.documentsStore.count(m),n),w=Object.keys(e.where??{}).length>0,T=[];w&&(T=t.index.searchByWhereClause(_,p,e.where),y=VG(T,y));let O;c&&(O=zG(t,y,e.facets));let E;e.groupBy&&(E=HG(t,y,e.groupBy));let P=aOe(t,y,s,u).filter(Boolean),R=Rx(),I={count:y.length,elapsed:{raw:Number(R-n),formatted:ZV(R-n)},hits:P,...O?{facets:O}:{},...E?{groups:E}:{}};if(!l){let A=Object.keys(t.data.index.vectorIndexes);JTe(I,A)}return I}async function a(){t.beforeSearch&&await qG(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await kG(t.afterSearch,t,e,r,s),s}return o?a():i()}function bdo(t,e,r){let n=Rx();e.relevance=Object.assign(iOe,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 y of i)if(!m.has(y))throw Vr("UNKNOWN_INDEX",y,c.join(", "));c=c.filter(y=>h.has(y))}let d=tH(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 y=c[h];if(f!==0)for(let T=0;T<f;T++){let O=l[T],E=t.index.search(d,s,y,O);ku(d.indexMap[y][O],E)}else{let T=[];d.indexMap[y][""]=T;let O=t.index.search(d,s,y,"");ku(T,O)}let g=d.indexMap[y],b=Object.values(g);d.docsIntersection[y]=GTe(b,e?.boost?.[y]??1,a,f);let _=d.docsIntersection[y],w=_.length;for(let T=0;T<w;T++){let[O,E]=_[T],P=d.uniqueDocsIDs[O];d.uniqueDocsIDs[O]=P?P+E+.5:E}}}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 ryr(p)}function _do(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 Vr("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw Vr("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=XTe(r.value,i,o,e.similarity).map(([s,u])=>[du(t.internalDocumentIDStore,s),u]);return ryr(a)}function tat([,t]){return t}function ryr(t){let e=Math.max.apply(Math,t.map(tat));return t.map(([r,n])=>[r,n/e])}function eyr(t,e){return t/e}function vdo(t,e){return(r,n)=>r*t+n*e}function wdo(t,e,r,n){let o=Math.max.apply(Math,t.map(tat)),i=Math.max.apply(Math,e.map(tat)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:Sdo(r),l=new Map,c=t.length,d=vdo(s,u);for(let p=0;p<c;p++){let[m,h]=t[p],y=eyr(h,o),g=d(y,0);l.set(m,g)}let f=e.length;for(let p=0;p<f;p++){let[m,h]=e[p],y=eyr(h,i),g=l.get(m)??0;l.set(m,g+d(0,y))}return[...l].sort((p,m)=>m[1]-p[1])}function Sdo(t){return{text:.5,vector:.5}}var nyr=v(()=>{fd();nOe();Gie();qh();rH();rOe();oOe();ZTe();d0();rH();rq()});function tH(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 ov(t,e,r){let n=e.mode??tOe;if(n===tOe)return Zgr(t,e,r);if(n===Hit)return Qit(t,e);if(n===Vit)return tyr(t,e);throw Vr("INVALID_SEARCH_MODE",n)}function Qgr(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),y=LG(h,o);if(!(typeof y>"u"||a.has(y))&&(a.set(y,!0),c++,!(c<=r)&&(s.push({id:c0(t.internalDocumentIDStore,p),score:m,document:h}),u.add(p),c>=r+n)))break}return s}function aOe(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:c0(t.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}var iOe,rH=v(()=>{d0();qh();fd();Wit();Ygr();eat();nyr();iOe={k:1.2,b:.75,d:.5}});function sOe(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 rat(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 oyr=v(()=>{});var iyr=v(()=>{rq();qh();Zit();Yit();fd()});var ayr=v(()=>{qh();rH()});var syr=v(()=>{Iit();fd();Gie();eOe()});var uOe=v(()=>{zgr();Vgr();Zit();Yit();rH();eat();oyr();iyr();ayr();Jit();zit();syr()});function Odo(t,e){let r=uyr(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function uyr(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var a6a,s6a,xdo,Tdo,nat,Edo,nH,oat=v(()=>{a6a=new Error("timeout while waiting for mutex to become available"),s6a=new Error("mutex already locked"),xdo=new Error("request for lock canceled"),Tdo=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())})},nat=class{constructor(e,r=xdo){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=uyr(this._queue,s=>r<=s.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return Tdo(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]=[]),Odo(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}};Edo=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())})},nH=class{constructor(e){this._semaphore=new nat(1,e)}acquire(){return Edo(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 lyr=S(()=>{});var ki=S((lOe,cyr)=>{(function(t,e){typeof lOe=="object"?cyr.exports=lOe=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(lOe,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=lyr()}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(b){var _;return g.prototype=b,_=new g,g.prototype=null,_}}(),a={},s=a.lib={},u=s.Base=function(){return{extend:function(g){var b=i(this);return g&&b.mixIn(g),(!b.hasOwnProperty("init")||this.init===b.init)&&(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var b in g)g.hasOwnProperty(b)&&(this[b]=g[b]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=s.WordArray=u.extend({init:function(g,b){g=this.words=g||[],b!=r?this.sigBytes=b:this.sigBytes=g.length*4},toString:function(g){return(g||d).stringify(this)},concat:function(g){var b=this.words,_=g.words,w=this.sigBytes,T=g.sigBytes;if(this.clamp(),w%4)for(var O=0;O<T;O++){var E=_[O>>>2]>>>24-O%4*8&255;b[w+O>>>2]|=E<<24-(w+O)%4*8}else for(var P=0;P<T;P+=4)b[w+P>>>2]=_[P>>>2];return this.sigBytes+=T,this},clamp:function(){var g=this.words,b=this.sigBytes;g[b>>>2]&=4294967295<<32-b%4*8,g.length=e.ceil(b/4)},clone:function(){var g=u.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var b=[],_=0;_<g;_+=4)b.push(o());return new l.init(b,g)}}),c=a.enc={},d=c.Hex={stringify:function(g){for(var b=g.words,_=g.sigBytes,w=[],T=0;T<_;T++){var O=b[T>>>2]>>>24-T%4*8&255;w.push((O>>>4).toString(16)),w.push((O&15).toString(16))}return w.join("")},parse:function(g){for(var b=g.length,_=[],w=0;w<b;w+=2)_[w>>>3]|=parseInt(g.substr(w,2),16)<<24-w%8*4;return new l.init(_,b/2)}},f=c.Latin1={stringify:function(g){for(var b=g.words,_=g.sigBytes,w=[],T=0;T<_;T++){var O=b[T>>>2]>>>24-T%4*8&255;w.push(String.fromCharCode(O))}return w.join("")},parse:function(g){for(var b=g.length,_=[],w=0;w<b;w++)_[w>>>2]|=(g.charCodeAt(w)&255)<<24-w%4*8;return new l.init(_,b)}},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 b,_=this._data,w=_.words,T=_.sigBytes,O=this.blockSize,E=O*4,P=T/E;g?P=e.ceil(P):P=e.max((P|0)-this._minBufferSize,0);var R=P*O,I=e.min(R*4,T);if(R){for(var A=0;A<R;A+=O)this._doProcessBlock(w,A);b=w.splice(0,R),_.sigBytes-=I}return new l.init(b,I)},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 b=this._doFinalize();return b},blockSize:512/32,_createHelper:function(g){return function(b,_){return new g.init(_).finalize(b)}},_createHmacHelper:function(g){return function(b,_){return new y.HMAC.init(g,_).finalize(b)}}}),y=a.algo={};return a}(Math);return t})});var Qie=S((cOe,dyr)=>{(function(t,e){typeof cOe=="object"?dyr.exports=cOe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(cOe,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 pyr=S((dOe,fyr)=>{(function(t,e){typeof dOe=="object"?fyr.exports=dOe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(dOe,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 hyr=S((fOe,myr)=>{(function(t,e){typeof fOe=="object"?myr.exports=fOe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(fOe,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 iq=S((pOe,gyr)=>{(function(t,e){typeof pOe=="object"?gyr.exports=pOe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(pOe,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,y=p<<16|m<<8|h,g=0;g<4&&f+g*.75<l;g++)d.push(c.charAt(y>>>6*(3-g)&63));var b=c.charAt(64);if(b)for(;d.length%4;)d.push(b);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 byr=S((mOe,yyr)=>{(function(t,e){typeof mOe=="object"?yyr.exports=mOe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(mOe,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,y=l[p+2>>>2]>>>24-(p+2)%4*8&255,g=m<<16|h<<8|y,b=0;b<4&&p+b*.75<c;b++)f.push(d.charAt(g>>>6*(3-b)&63));var _=d.charAt(64);if(_)for(;f.length%4;)f.push(_);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 aq=S((hOe,_yr)=>{(function(t,e){typeof hOe=="object"?_yr.exports=hOe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(hOe,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 y=m+h,g=p[y];p[y]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var b=this._hash.words,_=p[m+0],w=p[m+1],T=p[m+2],O=p[m+3],E=p[m+4],P=p[m+5],R=p[m+6],I=p[m+7],A=p[m+8],B=p[m+9],k=p[m+10],q=p[m+11],Z=p[m+12],V=p[m+13],Y=p[m+14],X=p[m+15],W=b[0],re=b[1],ue=b[2],le=b[3];W=l(W,re,ue,le,_,7,s[0]),le=l(le,W,re,ue,w,12,s[1]),ue=l(ue,le,W,re,T,17,s[2]),re=l(re,ue,le,W,O,22,s[3]),W=l(W,re,ue,le,E,7,s[4]),le=l(le,W,re,ue,P,12,s[5]),ue=l(ue,le,W,re,R,17,s[6]),re=l(re,ue,le,W,I,22,s[7]),W=l(W,re,ue,le,A,7,s[8]),le=l(le,W,re,ue,B,12,s[9]),ue=l(ue,le,W,re,k,17,s[10]),re=l(re,ue,le,W,q,22,s[11]),W=l(W,re,ue,le,Z,7,s[12]),le=l(le,W,re,ue,V,12,s[13]),ue=l(ue,le,W,re,Y,17,s[14]),re=l(re,ue,le,W,X,22,s[15]),W=c(W,re,ue,le,w,5,s[16]),le=c(le,W,re,ue,R,9,s[17]),ue=c(ue,le,W,re,q,14,s[18]),re=c(re,ue,le,W,_,20,s[19]),W=c(W,re,ue,le,P,5,s[20]),le=c(le,W,re,ue,k,9,s[21]),ue=c(ue,le,W,re,X,14,s[22]),re=c(re,ue,le,W,E,20,s[23]),W=c(W,re,ue,le,B,5,s[24]),le=c(le,W,re,ue,Y,9,s[25]),ue=c(ue,le,W,re,O,14,s[26]),re=c(re,ue,le,W,A,20,s[27]),W=c(W,re,ue,le,V,5,s[28]),le=c(le,W,re,ue,T,9,s[29]),ue=c(ue,le,W,re,I,14,s[30]),re=c(re,ue,le,W,Z,20,s[31]),W=d(W,re,ue,le,P,4,s[32]),le=d(le,W,re,ue,A,11,s[33]),ue=d(ue,le,W,re,q,16,s[34]),re=d(re,ue,le,W,Y,23,s[35]),W=d(W,re,ue,le,w,4,s[36]),le=d(le,W,re,ue,E,11,s[37]),ue=d(ue,le,W,re,I,16,s[38]),re=d(re,ue,le,W,k,23,s[39]),W=d(W,re,ue,le,V,4,s[40]),le=d(le,W,re,ue,_,11,s[41]),ue=d(ue,le,W,re,O,16,s[42]),re=d(re,ue,le,W,R,23,s[43]),W=d(W,re,ue,le,B,4,s[44]),le=d(le,W,re,ue,Z,11,s[45]),ue=d(ue,le,W,re,X,16,s[46]),re=d(re,ue,le,W,T,23,s[47]),W=f(W,re,ue,le,_,6,s[48]),le=f(le,W,re,ue,I,10,s[49]),ue=f(ue,le,W,re,Y,15,s[50]),re=f(re,ue,le,W,P,21,s[51]),W=f(W,re,ue,le,Z,6,s[52]),le=f(le,W,re,ue,O,10,s[53]),ue=f(ue,le,W,re,k,15,s[54]),re=f(re,ue,le,W,w,21,s[55]),W=f(W,re,ue,le,A,6,s[56]),le=f(le,W,re,ue,X,10,s[57]),ue=f(ue,le,W,re,R,15,s[58]),re=f(re,ue,le,W,V,21,s[59]),W=f(W,re,ue,le,E,6,s[60]),le=f(le,W,re,ue,q,10,s[61]),ue=f(ue,le,W,re,T,15,s[62]),re=f(re,ue,le,W,B,21,s[63]),b[0]=b[0]+W|0,b[1]=b[1]+re|0,b[2]=b[2]+ue|0,b[3]=b[3]+le|0},_doFinalize:function(){var p=this._data,m=p.words,h=this._nDataBytes*8,y=p.sigBytes*8;m[y>>>5]|=128<<24-y%32;var g=e.floor(h/4294967296),b=h;m[(y+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,m[(y+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,p.sigBytes=(m.length+1)*4,this._process();for(var _=this._hash,w=_.words,T=0;T<4;T++){var O=w[T];w[T]=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360}return _},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});function l(p,m,h,y,g,b,_){var w=p+(m&h|~m&y)+g+_;return(w<<b|w>>>32-b)+m}function c(p,m,h,y,g,b,_){var w=p+(m&y|h&~y)+g+_;return(w<<b|w>>>32-b)+m}function d(p,m,h,y,g,b,_){var w=p+(m^h^y)+g+_;return(w<<b|w>>>32-b)+m}function f(p,m,h,y,g,b,_){var w=p+(h^(m|~y))+g+_;return(w<<b|w>>>32-b)+m}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),t.MD5})});var iat=S((gOe,vyr)=>{(function(t,e){typeof gOe=="object"?vyr.exports=gOe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(gOe,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=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],y=0;y<80;y++){if(y<16)a[y]=u[l+y]|0;else{var g=a[y-3]^a[y-8]^a[y-14]^a[y-16];a[y]=g<<1|g>>>31}var b=(d<<5|d>>>27)+h+a[y];y<20?b+=(f&p|~f&m)+1518500249:y<40?b+=(f^p^m)+1859775393:y<60?b+=(f&p|f&m|p&m)-1894007588:b+=(f^p^m)-899497514,h=m,m=p,p=f<<30|f>>>2,f=d,d=b}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 bOe=S((yOe,wyr)=>{(function(t,e){typeof yOe=="object"?wyr.exports=yOe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(yOe,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 y=e.sqrt(h),g=2;g<=y;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],y=p[2],g=p[3],b=p[4],_=p[5],w=p[6],T=p[7],O=0;O<64;O++){if(O<16)l[O]=d[f+O]|0;else{var E=l[O-15],P=(E<<25|E>>>7)^(E<<14|E>>>18)^E>>>3,R=l[O-2],I=(R<<15|R>>>17)^(R<<13|R>>>19)^R>>>10;l[O]=P+l[O-7]+I+l[O-16]}var A=b&_^~b&w,B=m&h^m&y^h&y,k=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),q=(b<<26|b>>>6)^(b<<21|b>>>11)^(b<<7|b>>>25),Z=T+q+A+u[O]+l[O],V=k+B;T=w,w=_,_=b,b=g+Z|0,g=y,y=h,h=m,m=Z+V|0}p[0]=p[0]+m|0,p[1]=p[1]+h|0,p[2]=p[2]+y|0,p[3]=p[3]+g|0,p[4]=p[4]+b|0,p[5]=p[5]+_|0,p[6]=p[6]+w|0,p[7]=p[7]+T|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 Cyr=S((_Oe,Syr)=>{(function(t,e,r){typeof _Oe=="object"?Syr.exports=_Oe=e(ki(),bOe()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(_Oe,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 aat=S((vOe,xyr)=>{(function(t,e,r){typeof vOe=="object"?xyr.exports=vOe=e(ki(),Qie()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(vOe,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],y=m[1],g=m[2],b=m[3],_=m[4],w=m[5],T=m[6],O=m[7],E=h.high,P=h.low,R=y.high,I=y.low,A=g.high,B=g.low,k=b.high,q=b.low,Z=_.high,V=_.low,Y=w.high,X=w.low,W=T.high,re=T.low,ue=O.high,le=O.low,L=E,J=P,ne=R,D=I,N=A,z=B,H=k,oe=q,Q=Z,de=V,fe=Y,De=X,st=W,Le=re,Bt=ue,Pt=le,Nt=0;Nt<80;Nt++){var $e,Fr,ft=c[Nt];if(Nt<16)Fr=ft.high=f[p+Nt*2]|0,$e=ft.low=f[p+Nt*2+1]|0;else{var Ve=c[Nt-15],Rt=Ve.high,ze=Ve.low,He=(Rt>>>1|ze<<31)^(Rt>>>8|ze<<24)^Rt>>>7,We=(ze>>>1|Rt<<31)^(ze>>>8|Rt<<24)^(ze>>>7|Rt<<25),Jt=c[Nt-2],so=Jt.high,au=Jt.low,An=(so>>>19|au<<13)^(so<<3|au>>>29)^so>>>6,_i=(au>>>19|so<<13)^(au<<3|so>>>29)^(au>>>6|so<<26),Nl=c[Nt-7],Vi=Nl.high,g_=Nl.low,mg=c[Nt-16],cS=mg.high,ji=mg.low;$e=We+g_,Fr=He+Vi+($e>>>0<We>>>0?1:0),$e=$e+_i,Fr=Fr+An+($e>>>0<_i>>>0?1:0),$e=$e+ji,Fr=Fr+cS+($e>>>0<ji>>>0?1:0),ft.high=Fr,ft.low=$e}var LT=Q&fe^~Q&st,SC=de&De^~de&Le,dS=L&ne^L&N^ne&N,Xs=J&D^J&z^D&z,Dl=(L>>>28|J<<4)^(L<<30|J>>>2)^(L<<25|J>>>7),Iu=(J>>>28|L<<4)^(J<<30|L>>>2)^(J<<25|L>>>7),wm=(Q>>>14|de<<18)^(Q>>>18|de<<14)^(Q<<23|de>>>9),_d=(de>>>14|Q<<18)^(de>>>18|Q<<14)^(de<<23|Q>>>9),sl=l[Nt],nt=sl.high,Nr=sl.low,Ue=Pt+_d,Ee=Bt+wm+(Ue>>>0<Pt>>>0?1:0),Ue=Ue+SC,Ee=Ee+LT+(Ue>>>0<SC>>>0?1:0),Ue=Ue+Nr,Ee=Ee+nt+(Ue>>>0<Nr>>>0?1:0),Ue=Ue+$e,Ee=Ee+Fr+(Ue>>>0<$e>>>0?1:0),Mt=Iu+Xs,Yt=Dl+dS+(Mt>>>0<Iu>>>0?1:0);Bt=st,Pt=Le,st=fe,Le=De,fe=Q,De=de,de=oe+Ue|0,Q=H+Ee+(de>>>0<oe>>>0?1:0)|0,H=N,oe=z,N=ne,z=D,ne=L,D=J,J=Ue+Mt|0,L=Ee+Yt+(J>>>0<Ue>>>0?1:0)|0}P=h.low=P+J,h.high=E+L+(P>>>0<J>>>0?1:0),I=y.low=I+D,y.high=R+ne+(I>>>0<D>>>0?1:0),B=g.low=B+z,g.high=A+N+(B>>>0<z>>>0?1:0),q=b.low=q+oe,b.high=k+H+(q>>>0<oe>>>0?1:0),V=_.low=V+de,_.high=Z+Q+(V>>>0<de>>>0?1:0),X=w.low=X+De,w.high=Y+fe+(X>>>0<De>>>0?1:0),re=T.low=re+Le,T.high=W+st+(re>>>0<Le>>>0?1:0),le=O.low=le+Pt,O.high=ue+Bt+(le>>>0<Pt>>>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 y=this._hash.toX32();return y},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 Oyr=S((wOe,Tyr)=>{(function(t,e,r){typeof wOe=="object"?Tyr.exports=wOe=e(ki(),Qie(),aat()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(wOe,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 Pyr=S((SOe,Eyr)=>{(function(t,e,r){typeof SOe=="object"?Eyr.exports=SOe=e(ki(),Qie()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(SOe,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,y=0;y<24;y++){l[m+5*h]=(y+1)*(y+2)/2%64;var g=h%5,b=(2*m+3*h)%5;m=g,h=b}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 _=1,w=0;w<24;w++){for(var T=0,O=0,E=0;E<7;E++){if(_&1){var P=(1<<E)-1;P<32?O^=1<<P:T^=1<<P-32}_&128?_=_<<1^113:_<<=1}d[w]=s.create(T,O)}})();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 y=this._state,g=this.blockSize/2,b=0;b<g;b++){var _=m[h+2*b],w=m[h+2*b+1];_=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,w=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360;var T=y[b];T.high^=w,T.low^=_}for(var O=0;O<24;O++){for(var E=0;E<5;E++){for(var P=0,R=0,I=0;I<5;I++){var T=y[E+5*I];P^=T.high,R^=T.low}var A=f[E];A.high=P,A.low=R}for(var E=0;E<5;E++)for(var B=f[(E+4)%5],k=f[(E+1)%5],q=k.high,Z=k.low,P=B.high^(q<<1|Z>>>31),R=B.low^(Z<<1|q>>>31),I=0;I<5;I++){var T=y[E+5*I];T.high^=P,T.low^=R}for(var V=1;V<25;V++){var P,R,T=y[V],Y=T.high,X=T.low,W=l[V];W<32?(P=Y<<W|X>>>32-W,R=X<<W|Y>>>32-W):(P=X<<W-32|Y>>>64-W,R=Y<<W-32|X>>>64-W);var re=f[c[V]];re.high=P,re.low=R}var ue=f[0],le=y[0];ue.high=le.high,ue.low=le.low;for(var E=0;E<5;E++)for(var I=0;I<5;I++){var V=E+5*I,T=y[V],L=f[V],J=f[(E+1)%5+5*I],ne=f[(E+2)%5+5*I];T.high=L.high^~J.high&ne.high,T.low=L.low^~J.low&ne.low}var T=y[0],D=d[O];T.high^=D.high,T.low^=D.low}},_doFinalize:function(){var m=this._data,h=m.words,y=this._nDataBytes*8,g=m.sigBytes*8,b=this.blockSize*32;h[g>>>5]|=1<<24-g%32,h[(e.ceil((g+1)/b)*b>>>5)-1]|=128,m.sigBytes=h.length*4,this._process();for(var _=this._state,w=this.cfg.outputLength/8,T=w/8,O=[],E=0;E<T;E++){var P=_[E],R=P.high,I=P.low;R=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,I=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,O.push(I),O.push(R)}return new o.init(O,w)},clone:function(){for(var m=i.clone.call(this),h=m._state=this._state.slice(0),y=0;y<25;y++)h[y]=h[y].clone();return m}});r.SHA3=i._createHelper(p),r.HmacSHA3=i._createHmacHelper(p)}(Math),t.SHA3})});var Ryr=S((COe,Myr)=>{(function(t,e){typeof COe=="object"?Myr.exports=COe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(COe,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(w,T){for(var O=0;O<16;O++){var E=T+O,P=w[E];w[E]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360}var R=this._hash.words,I=d.words,A=f.words,B=s.words,k=u.words,q=l.words,Z=c.words,V,Y,X,W,re,ue,le,L,J,ne;ue=V=R[0],le=Y=R[1],L=X=R[2],J=W=R[3],ne=re=R[4];for(var D,O=0;O<80;O+=1)D=V+w[T+B[O]]|0,O<16?D+=m(Y,X,W)+I[0]:O<32?D+=h(Y,X,W)+I[1]:O<48?D+=y(Y,X,W)+I[2]:O<64?D+=g(Y,X,W)+I[3]:D+=b(Y,X,W)+I[4],D=D|0,D=_(D,q[O]),D=D+re|0,V=re,re=W,W=_(X,10),X=Y,Y=D,D=ue+w[T+k[O]]|0,O<16?D+=b(le,L,J)+A[0]:O<32?D+=g(le,L,J)+A[1]:O<48?D+=y(le,L,J)+A[2]:O<64?D+=h(le,L,J)+A[3]:D+=m(le,L,J)+A[4],D=D|0,D=_(D,Z[O]),D=D+ne|0,ue=ne,ne=J,J=_(L,10),L=le,le=D;D=R[1]+X+J|0,R[1]=R[2]+W+ne|0,R[2]=R[3]+re+ue|0,R[3]=R[4]+V+le|0,R[4]=R[0]+Y+L|0,R[0]=D},_doFinalize:function(){var w=this._data,T=w.words,O=this._nDataBytes*8,E=w.sigBytes*8;T[E>>>5]|=128<<24-E%32,T[(E+64>>>9<<4)+14]=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,w.sigBytes=(T.length+1)*4,this._process();for(var P=this._hash,R=P.words,I=0;I<5;I++){var A=R[I];R[I]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}return P},clone:function(){var w=i.clone.call(this);return w._hash=this._hash.clone(),w}});function m(w,T,O){return w^T^O}function h(w,T,O){return w&T|~w&O}function y(w,T,O){return(w|~T)^O}function g(w,T,O){return w&O|T&~O}function b(w,T,O){return w^(T|~O)}function _(w,T){return w<<T|w>>>32-T}r.RIPEMD160=i._createHelper(p),r.HmacRIPEMD160=i._createHmacHelper(p)}(Math),t.RIPEMD160})});var TOe=S((xOe,Iyr)=>{(function(t,e){typeof xOe=="object"?Iyr.exports=xOe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(xOe,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,y=0;y<c;y++)m[y]^=1549556828,h[y]^=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 Nyr=S((OOe,Ayr)=>{(function(t,e,r){typeof OOe=="object"?Ayr.exports=OOe=e(ki(),bOe(),TOe()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(OOe,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,y=m.words,g=d.keySize,b=d.iterations;h.length<g;){var _=f.update(c).finalize(m);f.reset();for(var w=_.words,T=w.length,O=_,E=1;E<b;E++){O=f.finalize(O),f.reset();for(var P=O.words,R=0;R<T;R++)w[R]^=P[R]}p.concat(_),y[0]++}return p.sigBytes=g*4,p}});e.PBKDF2=function(l,c,d){return u.create(d).compute(l,c)}}(),t.PBKDF2})});var TD=S((EOe,Dyr)=>{(function(t,e,r){typeof EOe=="object"?Dyr.exports=EOe=e(ki(),iat(),TOe()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(EOe,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,y=d.iterations;m.length<h;){c&&f.update(c),c=f.update(u).finalize(l),f.reset();for(var g=1;g<y;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 zm=S((POe,jyr)=>{(function(t,e,r){typeof POe=="object"?jyr.exports=POe=e(ki(),TD()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(POe,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(A,B){return this.create(this._ENC_XFORM_MODE,A,B)},createDecryptor:function(A,B){return this.create(this._DEC_XFORM_MODE,A,B)},init:function(A,B,k){this.cfg=this.cfg.extend(k),this._xformMode=A,this._key=B,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(A){return this._append(A),this._process()},finalize:function(A){A&&this._append(A);var B=this._doFinalize();return B},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function A(B){return typeof B=="string"?I:E}return function(B){return{encrypt:function(k,q,Z){return A(q).encrypt(B,k,q,Z)},decrypt:function(k,q,Z){return A(q).decrypt(B,k,q,Z)}}}}()}),p=n.StreamCipher=f.extend({_doFinalize:function(){var A=this._process(!0);return A},blockSize:1}),m=r.mode={},h=n.BlockCipherMode=o.extend({createEncryptor:function(A,B){return this.Encryptor.create(A,B)},createDecryptor:function(A,B){return this.Decryptor.create(A,B)},init:function(A,B){this._cipher=A,this._iv=B}}),y=m.CBC=function(){var A=h.extend();A.Encryptor=A.extend({processBlock:function(k,q){var Z=this._cipher,V=Z.blockSize;B.call(this,k,q,V),Z.encryptBlock(k,q),this._prevBlock=k.slice(q,q+V)}}),A.Decryptor=A.extend({processBlock:function(k,q){var Z=this._cipher,V=Z.blockSize,Y=k.slice(q,q+V);Z.decryptBlock(k,q),B.call(this,k,q,V),this._prevBlock=Y}});function B(k,q,Z){var V,Y=this._iv;Y?(V=Y,this._iv=e):V=this._prevBlock;for(var X=0;X<Z;X++)k[q+X]^=V[X]}return A}(),g=r.pad={},b=g.Pkcs7={pad:function(A,B){for(var k=B*4,q=k-A.sigBytes%k,Z=q<<24|q<<16|q<<8|q,V=[],Y=0;Y<q;Y+=4)V.push(Z);var X=i.create(V,q);A.concat(X)},unpad:function(A){var B=A.words[A.sigBytes-1>>>2]&255;A.sigBytes-=B}},_=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:y,padding:b}),reset:function(){var A;f.reset.call(this);var B=this.cfg,k=B.iv,q=B.mode;this._xformMode==this._ENC_XFORM_MODE?A=q.createEncryptor:(A=q.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==A?this._mode.init(this,k&&k.words):(this._mode=A.call(q,this,k&&k.words),this._mode.__creator=A)},_doProcessBlock:function(A,B){this._mode.processBlock(A,B)},_doFinalize:function(){var A,B=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(B.pad(this._data,this.blockSize),A=this._process(!0)):(A=this._process(!0),B.unpad(A)),A},blockSize:128/32}),w=n.CipherParams=o.extend({init:function(A){this.mixIn(A)},toString:function(A){return(A||this.formatter).stringify(this)}}),T=r.format={},O=T.OpenSSL={stringify:function(A){var B,k=A.ciphertext,q=A.salt;return q?B=i.create([1398893684,1701076831]).concat(q).concat(k):B=k,B.toString(l)},parse:function(A){var B,k=l.parse(A),q=k.words;return q[0]==1398893684&&q[1]==1701076831&&(B=i.create(q.slice(2,4)),q.splice(0,4),k.sigBytes-=16),w.create({ciphertext:k,salt:B})}},E=n.SerializableCipher=o.extend({cfg:o.extend({format:O}),encrypt:function(A,B,k,q){q=this.cfg.extend(q);var Z=A.createEncryptor(k,q),V=Z.finalize(B),Y=Z.cfg;return w.create({ciphertext:V,key:k,iv:Y.iv,algorithm:A,mode:Y.mode,padding:Y.padding,blockSize:A.blockSize,formatter:q.format})},decrypt:function(A,B,k,q){q=this.cfg.extend(q),B=this._parse(B,q.format);var Z=A.createDecryptor(k,q).finalize(B.ciphertext);return Z},_parse:function(A,B){return typeof A=="string"?B.parse(A,this):A}}),P=r.kdf={},R=P.OpenSSL={execute:function(A,B,k,q,Z){if(q||(q=i.random(64/8)),Z)var V=d.create({keySize:B+k,hasher:Z}).compute(A,q);else var V=d.create({keySize:B+k}).compute(A,q);var Y=i.create(V.words.slice(B),k*4);return V.sigBytes=B*4,w.create({key:V,iv:Y,salt:q})}},I=n.PasswordBasedCipher=E.extend({cfg:E.cfg.extend({kdf:R}),encrypt:function(A,B,k,q){q=this.cfg.extend(q);var Z=q.kdf.execute(k,A.keySize,A.ivSize,q.salt,q.hasher);q.iv=Z.iv;var V=E.encrypt.call(this,A,B,Z.key,q);return V.mixIn(Z),V},decrypt:function(A,B,k,q){q=this.cfg.extend(q),B=this._parse(B,q.format);var Z=q.kdf.execute(k,A.keySize,A.ivSize,B.salt,q.hasher);q.iv=Z.iv;var V=E.decrypt.call(this,A,B,Z.key,q);return V}})}()})});var Lyr=S((MOe,$yr)=>{(function(t,e,r){typeof MOe=="object"?$yr.exports=MOe=e(ki(),zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(MOe,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 kyr=S((ROe,Fyr)=>{(function(t,e,r){typeof ROe=="object"?Fyr.exports=ROe=e(ki(),zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(ROe,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 Byr=S((IOe,qyr)=>{(function(t,e,r){typeof IOe=="object"?qyr.exports=IOe=e(ki(),zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(IOe,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 zyr=S((AOe,Uyr)=>{(function(t,e,r){typeof AOe=="object"?Uyr.exports=AOe=e(ki(),zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(AOe,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 Hyr=S((NOe,Vyr)=>{(function(t,e,r){typeof NOe=="object"?Vyr.exports=NOe=e(ki(),zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(NOe,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 Jyr=S((DOe,Wyr)=>{(function(t,e,r){typeof DOe=="object"?Wyr.exports=DOe=e(ki(),zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(DOe,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 Gyr=S((jOe,Kyr)=>{(function(t,e,r){typeof jOe=="object"?Kyr.exports=jOe=e(ki(),zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(jOe,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 Zyr=S(($Oe,Xyr)=>{(function(t,e,r){typeof $Oe=="object"?Xyr.exports=$Oe=e(ki(),zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})($Oe,function(t){return t.pad.Iso97971={pad:function(e,r){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,r)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971})});var Qyr=S((LOe,Yyr)=>{(function(t,e,r){typeof LOe=="object"?Yyr.exports=LOe=e(ki(),zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(LOe,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 tbr=S((FOe,ebr)=>{(function(t,e,r){typeof FOe=="object"?ebr.exports=FOe=e(ki(),zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(FOe,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var nbr=S((kOe,rbr)=>{(function(t,e,r){typeof kOe=="object"?rbr.exports=kOe=e(ki(),zm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(kOe,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 ibr=S((qOe,obr)=>{(function(t,e,r){typeof qOe=="object"?obr.exports=qOe=e(ki(),iq(),aq(),TD(),zm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(qOe,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=[],b=0;b<256;b++)b<128?g[b]=b<<1:g[b]=b<<1^283;for(var _=0,w=0,b=0;b<256;b++){var T=w^w<<1^w<<2^w<<3^w<<4;T=T>>>8^T&255^99,i[_]=T,a[T]=_;var O=g[_],E=g[O],P=g[E],R=g[T]*257^T*16843008;s[_]=R<<24|R>>>8,u[_]=R<<16|R>>>16,l[_]=R<<8|R>>>24,c[_]=R;var R=P*16843009^E*65537^O*257^_*16843008;d[T]=R<<24|R>>>8,f[T]=R<<16|R>>>16,p[T]=R<<8|R>>>24,m[T]=R,_?(_=O^g[g[g[P^O]]],w^=g[g[w]]):_=w=1}})();var h=[0,1,2,4,8,16,32,64,128,27,54],y=o.AES=n.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var b=this._keyPriorReset=this._key,_=b.words,w=b.sigBytes/4,T=this._nRounds=w+6,O=(T+1)*4,E=this._keySchedule=[],P=0;P<O;P++)P<w?E[P]=_[P]:(g=E[P-1],P%w?w>6&&P%w==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[P/w|0]<<24),E[P]=E[P-w]^g);for(var R=this._invKeySchedule=[],I=0;I<O;I++){var P=O-I;if(I%4)var g=E[P];else var g=E[P-4];I<4||P<=4?R[I]=g:R[I]=d[i[g>>>24]]^f[i[g>>>16&255]]^p[i[g>>>8&255]]^m[i[g&255]]}}},encryptBlock:function(g,b){this._doCryptBlock(g,b,this._keySchedule,s,u,l,c,i)},decryptBlock:function(g,b){var _=g[b+1];g[b+1]=g[b+3],g[b+3]=_,this._doCryptBlock(g,b,this._invKeySchedule,d,f,p,m,a);var _=g[b+1];g[b+1]=g[b+3],g[b+3]=_},_doCryptBlock:function(g,b,_,w,T,O,E,P){for(var R=this._nRounds,I=g[b]^_[0],A=g[b+1]^_[1],B=g[b+2]^_[2],k=g[b+3]^_[3],q=4,Z=1;Z<R;Z++){var V=w[I>>>24]^T[A>>>16&255]^O[B>>>8&255]^E[k&255]^_[q++],Y=w[A>>>24]^T[B>>>16&255]^O[k>>>8&255]^E[I&255]^_[q++],X=w[B>>>24]^T[k>>>16&255]^O[I>>>8&255]^E[A&255]^_[q++],W=w[k>>>24]^T[I>>>16&255]^O[A>>>8&255]^E[B&255]^_[q++];I=V,A=Y,B=X,k=W}var V=(P[I>>>24]<<24|P[A>>>16&255]<<16|P[B>>>8&255]<<8|P[k&255])^_[q++],Y=(P[A>>>24]<<24|P[B>>>16&255]<<16|P[k>>>8&255]<<8|P[I&255])^_[q++],X=(P[B>>>24]<<24|P[k>>>16&255]<<16|P[I>>>8&255]<<8|P[A&255])^_[q++],W=(P[k>>>24]<<24|P[I>>>16&255]<<16|P[A>>>8&255]<<8|P[B&255])^_[q++];g[b]=V,g[b+1]=Y,g[b+2]=X,g[b+3]=W},keySize:256/32});e.AES=n._createHelper(y)}(),t.AES})});var sbr=S((BOe,abr)=>{(function(t,e,r){typeof BOe=="object"?abr.exports=BOe=e(ki(),iq(),aq(),TD(),zm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(BOe,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,y=h.words,g=[],b=0;b<56;b++){var _=a[b]-1;g[b]=y[_>>>5]>>>31-_%32&1}for(var w=this._subKeys=[],T=0;T<16;T++){for(var O=w[T]=[],E=u[T],b=0;b<24;b++)O[b/6|0]|=g[(s[b]-1+E)%28]<<31-b%6,O[4+(b/6|0)]|=g[28+(s[b+24]-1+E)%28]<<31-b%6;O[0]=O[0]<<1|O[0]>>>31;for(var b=1;b<7;b++)O[b]=O[b]>>>(b-1)*4+3;O[7]=O[7]<<5|O[7]>>>27}for(var P=this._invSubKeys=[],b=0;b<16;b++)P[b]=w[15-b]},encryptBlock:function(h,y){this._doCryptBlock(h,y,this._subKeys)},decryptBlock:function(h,y){this._doCryptBlock(h,y,this._invSubKeys)},_doCryptBlock:function(h,y,g){this._lBlock=h[y],this._rBlock=h[y+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 b=0;b<16;b++){for(var _=g[b],w=this._lBlock,T=this._rBlock,O=0,E=0;E<8;E++)O|=l[E][((T^_[E])&c[E])>>>0];this._lBlock=T,this._rBlock=w^O}var P=this._lBlock;this._lBlock=this._rBlock,this._rBlock=P,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[y]=this._lBlock,h[y+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(h,y){var g=(this._lBlock>>>h^this._rBlock)&y;this._rBlock^=g,this._lBlock^=g<<h}function p(h,y){var g=(this._rBlock>>>h^this._lBlock)&y;this._lBlock^=g,this._rBlock^=g<<h}e.DES=o._createHelper(d);var m=i.TripleDES=o.extend({_doReset:function(){var h=this._key,y=h.words;if(y.length!==2&&y.length!==4&&y.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var g=y.slice(0,2),b=y.length<4?y.slice(0,2):y.slice(2,4),_=y.length<6?y.slice(0,2):y.slice(4,6);this._des1=d.createEncryptor(n.create(g)),this._des2=d.createEncryptor(n.create(b)),this._des3=d.createEncryptor(n.create(_))},encryptBlock:function(h,y){this._des1.encryptBlock(h,y),this._des2.decryptBlock(h,y),this._des3.encryptBlock(h,y)},decryptBlock:function(h,y){this._des3.decryptBlock(h,y),this._des2.encryptBlock(h,y),this._des1.decryptBlock(h,y)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=o._createHelper(m)}(),t.TripleDES})});var lbr=S((UOe,ubr)=>{(function(t,e,r){typeof UOe=="object"?ubr.exports=UOe=e(ki(),iq(),aq(),TD(),zm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(UOe,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 y=d[f];d[f]=d[p],d[p]=y}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 dbr=S((zOe,cbr)=>{(function(t,e,r){typeof zOe=="object"?cbr.exports=zOe=e(ki(),iq(),aq(),TD(),zm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(zOe,function(t){return function(){var e=t,r=e.lib,n=r.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,y=h[0],g=h[1],b=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,_=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,w=b>>>16|_&4294901760,T=_<<16|b&65535;m[0]^=b,m[1]^=w,m[2]^=_,m[3]^=T,m[4]^=b,m[5]^=w,m[6]^=_,m[7]^=T;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,y=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=y^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 pbr=S((VOe,fbr)=>{(function(t,e,r){typeof VOe=="object"?fbr.exports=VOe=e(ki(),iq(),aq(),TD(),zm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(VOe,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],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,y=h[0],g=h[1],b=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,_=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,w=b>>>16|_&4294901760,T=_<<16|b&65535;p[0]^=b,p[1]^=w,p[2]^=_,p[3]^=T,p[4]^=b,p[5]^=w,p[6]^=_,p[7]^=T;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,y=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=y^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 hbr=S((HOe,mbr)=>{(function(t,e,r){typeof HOe=="object"?mbr.exports=HOe=e(ki(),iq(),aq(),TD(),zm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(HOe,function(t){return function(){var e=t,r=e.lib,n=r.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 y=h>>24&255,g=h>>16&255,b=h>>8&255,_=h&255,w=m.sbox[0][y]+m.sbox[1][g];return w=w^m.sbox[2][b],w=w+m.sbox[3][_],w}function c(m,h,y){let g=h,b=y,_;for(let w=0;w<i;++w)g=g^m.pbox[w],b=l(m,g)^b,_=g,g=b,b=_;return _=g,g=b,b=_,b=b^m.pbox[i],g=g^m.pbox[i+1],{left:g,right:b}}function d(m,h,y){let g=h,b=y,_;for(let w=i+1;w>1;--w)g=g^m.pbox[w],b=l(m,g)^b,_=g,g=b,b=_;return _=g,g=b,b=_,b=b^m.pbox[1],g=g^m.pbox[0],{left:g,right:b}}function f(m,h,y){for(let T=0;T<4;T++){m.sbox[T]=[];for(let O=0;O<256;O++)m.sbox[T][O]=s[T][O]}let g=0;for(let T=0;T<i+2;T++)m.pbox[T]=a[T]^h[g],g++,g>=y&&(g=0);let b=0,_=0,w=0;for(let T=0;T<i+2;T+=2)w=c(m,b,_),b=w.left,_=w.right,m.pbox[T]=b,m.pbox[T+1]=_;for(let T=0;T<4;T++)for(let O=0;O<256;O+=2)w=c(m,b,_),b=w.left,_=w.right,m.sbox[T][O]=b,m.sbox[T][O+1]=_;return!0}var p=o.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var m=this._keyPriorReset=this._key,h=m.words,y=m.sigBytes/4;f(u,h,y)}},encryptBlock:function(m,h){var y=c(u,m[h],m[h+1]);m[h]=y.left,m[h+1]=y.right},decryptBlock:function(m,h){var y=d(u,m[h],m[h+1]);m[h]=y.left,m[h+1]=y.right},blockSize:64/32,keySize:128/32,ivSize:64/32});e.Blowfish=n._createHelper(p)}(),t.Blowfish})});var oH=S((WOe,gbr)=>{(function(t,e,r){typeof WOe=="object"?gbr.exports=WOe=e(ki(),Qie(),pyr(),hyr(),iq(),byr(),aq(),iat(),bOe(),Cyr(),aat(),Oyr(),Pyr(),Ryr(),TOe(),Nyr(),TD(),zm(),Lyr(),kyr(),Byr(),zyr(),Hyr(),Jyr(),Gyr(),Zyr(),Qyr(),tbr(),nbr(),ibr(),sbr(),lbr(),dbr(),pbr(),hbr()):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)})(WOe,function(t){return t})});var sat,Pdo,JOe,ybr=v(()=>{OS();Qe();uOe();sat="copilot-index-chunk-",Pdo=".json",JOe=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${sat}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${sat}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${Pdo}`}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,[]);ee().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,ee().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),ee().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 rat(e),n=ee().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(ee().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)),ee().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)),ee().debug&&console.log(`Saved partition ${l+1}/${n}`)}ee().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new qo(`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 qo("Invalid legacy database format");let l=await UG({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await sOe(l,u),l}let r=await this.loadMetadata(),n=await UG({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 qo("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++):ee().debug&&console.warn(`Document ${u} not found in any chunk`)}return o.docs.docs=a,o.docs.count=Object.keys(a).length,o.internalDocumentIDStore.internalIdToId=Object.values(a).map(u=>u.id),o.index.vectorIndexes.embedding.vectors=Object.assign({},...i.map(u=>u.index?.vectorIndexes?.embedding?.vectors||{})),await sOe(n,o),n}catch(e){throw console.error("Error loading database:",e),new qo(`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}/${sat}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new qo(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(ee().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 qo("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new qo("Invalid metadata file: missing schema");return r}async saveMetadata(e){let r=this.getMetadataPath();await this.ensureDirectoryExists(r),await this.app.vault.adapter.write(r,JSON.stringify(e))}}});var wbr={};En(wbr,{categorizePatterns:()=>iH,createPatternSettingsValue:()=>sq,extractAppIgnoreSettings:()=>dat,getAllQAMarkdownContent:()=>cat,getDecodedPatterns:()=>uA,getExtensionPattern:()=>fat,getFilePattern:()=>WG,getInternalExcludePaths:()=>_br,getMatchingPatterns:()=>Zl,getTagPattern:()=>eae,getVectorLength:()=>lat,isInternalExcludedFile:()=>tae,isInternalExcludedPath:()=>vbr,previewPatternValue:()=>Ido,shouldIndexFile:()=>fu});async function lat(t){if(!t)throw new qo("Embedding instance not found.");try{let r=await t.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new qo("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${dd.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new qo("Failed to determine embedding vector length. Please check your Copilot settings to make sure you have a working embedding model.")}}async function cat(t){let e="",{inclusions:r,exclusions:n}=Zl(),o=t.vault.getMarkdownFiles().filter(i=>fu(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function uA(t){let e=[];return e.push(...t.split(",").map(r=>{let n=r.trim();try{return decodeURIComponent(n)}catch{return n}}).filter(r=>r.length>0)),e}function Mdo(){return ee().qaExclusions?uA(ee().qaExclusions):[]}function Rdo(){return ee().qaInclusions?uA(ee().qaInclusions):[]}function Zl(t){let e=t?.inclusions?uA(t.inclusions):t?.isProject?[]:Rdo(),r=t?.exclusions?uA(t.exclusions):t?.isProject?[]:Mdo();return{inclusions:e.length>0?iH(e):null,exclusions:r.length>0?iH(r):null}}function fu(t,e,r,n){return!(tae(t)||r&&bbr(t.path,r)||e&&!bbr(t.path,e)||n&&!e)}function iH(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 Ido(t){return uA(t).join(", ")}function sq({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function Ado(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof uat.TFile){let n=sO(r);if(e.some(o=>n.some(i=>i.toLowerCase()===DJ(o).toLowerCase())))return!0}return!1}function Ndo(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 Ddo(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 jdo(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof uat.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function bbr(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return Ado(t,r??[])||Ndo(t,n??[])||Ddo(t,o??[])||jdo(t,i??[])}function dat(t){let e=[];try{if(typeof t.vault.getConfig=="function"){let r=t.vault.getConfig("userIgnoreFilters");r&&Array.isArray(r)&&r.forEach(n=>{typeof n=="string"&&e.push(n.endsWith("/")?n.slice(0,-1):n)})}}catch(r){console.warn("Error getting userIgnoreFilters from Obsidian config",r)}return e}function eae(t){return`#${t}`}function WG(t){return`[[${t.basename}]]`}function fat(t){return`*.${t}`}function _br(){return[Em.getLogPath()]}function vbr(t){return new Set(_br()).has(t)}function tae(t){return vbr(t.path)}var uat,Wb=v(()=>{OS();XV();Qe();h4();Dt();uat=require("obsidian")});var xbr={};En(xbr,{DBOperations:()=>uq});var Cbr,lA,Sbr,uq,KOe=v(()=>{XV();OS();Xe();Qe();Dt();uOe();oat();Cbr=$(oH()),lA=require("obsidian");ybr();Wb();Sbr=25,uq=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new nH;ml(async()=>{let r=ee();lA.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):lA.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await dd.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(F("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await dd.getInstance().getEmbeddingsAPI()),F("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new qo("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new JOe(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),lA.Platform.isMobile&&ee().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new qo("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),F("Loaded existing chunked semantic index database from disk."),this.oramaDb}catch(n){ie("Failed to load existing semantic index database, creating new one:",n)}let r=await this.createNewDb(e);return this.oramaDb=r,r}catch(r){ie("Error initializing semantic index database:",r),new lA.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(lA.Platform.isMobile&&ee().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await dd.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new qo("Semantic index database not found.")}catch(e){throw ie("Failed to initialize database during save:",e),new qo("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,ee().debug&&F("Semantic index database saved successfully at:",this.dbPath)}catch(e){throw ie("Error saving semantic index database:",e),e}}}async clearIndex(e){try{this.oramaDb||await this.initializeDB(e),await this.chunkedStorage?.clearStorage(),await new Promise(r=>setTimeout(r,100)),this.oramaDb=await this.createNewDb(e),await this.saveDB(),new lA.Notice("Local Copilot index cleared successfully."),F("Local Copilot index cleared successfully, new instance created.")}catch(r){throw ie("Error clearing the local Copilot index:",r),new lA.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new qo("Semantic index database not found.");try{let r=await ov(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await Yie(this.oramaDb,r.hits.map(n=>n.id),500),ee().debug&&F(`Deleted document from local Copilot index: ${e}`)),this.markUnsavedChanges()}catch(r){ie("Error deleting document from local Copilotindex:",r)}}getDb(){return this.oramaDb||console.warn("Database not initialized. Some features may be limited."),this.oramaDb}async getIsIndexLoaded(){return this.isIndexLoaded}async waitForInitialization(){await this.initializationPromise}onunload(){this.hasUnsavedChanges&&this.saveDB()}getCurrentDbPath(){return this.dbPath}async getDbPath(){let e=this.app.vault.getRoot().path,r;if(ee().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),F("Created directory:",r))}return r}getVaultIdentifier(){let e=this.app.vault.getName();return(0,Cbr.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new qo("Embedding instance not found.");let r=await lat(e);if(!r||r===0)throw new qo("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await UG({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return F(`Created new semantic index database for ${this.dbPath}. Embedding model: ${dd.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 t.getAllDocuments(e)).filter(i=>i.path===r).map(i=>({document:i,score:1})):void 0}static async getDocsByEmbedding(e,r,n){return(await ov(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 ov(e,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return r.hits.length>0?r.hits[0].document.mtime:0}catch(r){return ie("Error getting latest file mtime from VectorDB:",r),0}}createDynamicSchema(e){return{id:"string",title:"string",path:"string",content:"string",embedding:`vector[${e}]`,embeddingModel:"string",created_at:"number",ctime:"number",mtime:"number",tags:"string[]",extension:"string",nchars:"number"}}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,ee().numPartitions),o=await ov(r,{term:e.id,properties:["id"],limit:1});o.hits.length>0&&await eH(r,o.hits[0].id);try{return await Zie(r,e),F(`${o.hits.length>0?"Updated":"Inserted"} document ${e.id} in partition ${n}`),this.markUnsavedChanges(),e}catch(i){if(ie(`Failed to ${o.hits.length>0?"update":"insert"} document ${e.id}:`,i),o.hits.length>0)try{await Zie(r,o.hits[0].document)}catch(a){ie("Failed to restore previous document version:",a)}return}}catch(n){ie(`Error upserting document ${e.id}:`,n);return}})}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let e=await ov(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return e.hits.length>0?e.hits[0].document.mtime:0}catch(e){return ie("Error getting latest file mtime from VectorDB:",e),0}}async checkAndHandleEmbeddingModelChange(e){if(!this.oramaDb){F("Semantic index database not loaded in memory. Checking for existing index...");try{await this.initializeDB(e)}catch(o){throw ie("Failed to initialize database:",o),new qo("Failed to initialize semantic index database. Please check your embedding model settings.")}if(!this.oramaDb)return F("No existing index found. Will create new index."),!1}let r=await ov(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=dd.getModelName(e);if(!hNt(n,o))return new lA.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),F(`Detected change in embedding model from "${n}" to "${o}". Rebuilding Copilot index from scratch.`),this.oramaDb=await this.createNewDb(e),await this.saveDB(),!0}else F("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await ov(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){F("Semantic index database not found during garbage collection. Attempting to initialize...");try{let e=await dd.getInstance().getEmbeddingsAPI();if(!e)throw new qo("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new qo("Failed to initialize database after attempt.")}catch(e){throw ie("Failed to initialize database during garbage collection:",e),new qo("Failed to initialize database. Please check your embedding model settings.")}}try{let e=this.app.vault.getMarkdownFiles(),r=new Set(e.map(u=>u.path)),{inclusions:n,exclusions:o}=Zl(),i=new Set(e.filter(u=>fu(u,n,o)).map(u=>u.path)),s=(await t.getAllDocuments(this.oramaDb)).filter(u=>!r.has(u.path)||!i.has(u.path));return s.length===0?0:(F("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(s.map(u=>u.path))).join(", ")),s.length===1?await eH(this.oramaDb,s[0].id):await Yie(this.oramaDb,s.map(u=>u.id),500),await this.saveDB(),s.length)}catch(e){throw ie("Error garbage collecting the Copilot index:",e),new qo("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new qo("Semantic index database not found.");try{let e=await t.getAllDocuments(this.oramaDb),r=new Set;return e.forEach(n=>{r.add(n.path)}),Array.from(r).sort()}catch(e){throw ie("Error getting indexed files:",e),new qo("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await ov(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw ie("Error checking if database is empty:",e),new qo("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 qo("Semantic index database not found.");let r={};for(let n of e){let o=await t.getDocsByPath(this.oramaDb,n);o&&o.length>0&&(r[n]=o.map(i=>({id:i.document.id,title:i.document.title,path:i.document.path,content:i.document.content,metadata:i.document.metadata,embedding:i.document.embedding,embeddingModel:i.document.embeddingModel,tags:i.document.tags,extension:i.document.extension,nchars:i.document.nchars})))}return r}markFileMissingEmbeddings(e){this.filesWithoutEmbeddings.add(e)}clearFilesMissingEmbeddings(){this.filesWithoutEmbeddings.clear()}getFilesMissingEmbeddings(){return Array.from(this.filesWithoutEmbeddings)}isFileMissingEmbeddings(e){return this.filesWithoutEmbeddings.has(e)}async checkIndexIntegrity(){if(!this.oramaDb)throw new qo("Orama database not found.");try{let e=await this.getIndexedFiles(),r=[];for(let n=0;n<e.length;n+=1){let o=e[n];await this.hasEmbeddings(o)||(r.push(o),this.filesWithoutEmbeddings.add(o)),(n+1)%Sbr===0&&await this.yieldToEventLoop()}e.length%Sbr!==0&&await this.yieldToEventLoop(),r.length>0?F(`Integrity check: ${r.length} file(s) missing embeddings, marked for re-indexing:`,r.join(", ")):F("Index integrity check completed. All documents have embeddings.")}catch(e){throw ie("Error checking index integrity:",e),new qo("Failed to check index integrity.")}}async yieldToEventLoop(){await new Promise(e=>{if(typeof window<"u"){let r=window;if(r.requestIdleCallback){r.requestIdleCallback(()=>e());return}}setTimeout(e,0)})}}});var GOe,Tbr=v(()=>{KOe();GOe=class{constructor(e){this.dbOps=new uq(e)}async initialize(e){await this.dbOps.initializeDB(e)}async clearIndex(e){await this.dbOps.clearIndex(e)}requiresEmbeddings(){return!0}async upsert(e){return this.dbOps.upsert(e)}async upsertBatch(e){let r=0;for(let n of e)await this.dbOps.upsert(n)&&(r+=1);return r}async removeByPath(e){await this.dbOps.removeDocs(e)}async getIndexedFiles(){return this.dbOps.getIndexedFiles()}async getLatestFileMtime(){return this.dbOps.getLatestFileMtime()}async isIndexEmpty(){return this.dbOps.isIndexEmpty()}async hasIndex(e){return this.dbOps.hasIndex(e)}async getDocumentsByPath(e){let r=this.dbOps.getDb();if(!r)throw new Error("Database is not loaded. Please restart the plugin.");let n=await uq.getDocsByPath(r,e);return n?n.map(o=>o.document):[]}async checkAndHandleEmbeddingModelChange(e){if(!e)throw new Error("Embedding instance is required to check Orama embedding model changes.");return this.dbOps.checkAndHandleEmbeddingModelChange(e)}async save(){await this.dbOps.saveDB()}async checkIndexIntegrity(){await this.dbOps.checkIndexIntegrity()}async garbageCollect(){return this.dbOps.garbageCollect()}markFileMissingEmbeddings(e){this.dbOps.markFileMissingEmbeddings(e)}clearFilesMissingEmbeddings(){this.dbOps.clearFilesMissingEmbeddings()}getFilesMissingEmbeddings(){return this.dbOps.getFilesMissingEmbeddings()}markUnsavedChanges(){this.dbOps.markUnsavedChanges()}onunload(){this.dbOps.onunload()}isRemoteBackend(){return!1}getDb(){return this.dbOps.getDb()}async reinitializeForIndexSyncChange(e){let r=await this.dbOps.getDbPath();this.dbOps.getCurrentDbPath()!==r&&await this.dbOps.initializeDB(e)}getDbOperations(){return this.dbOps}}});var JG,$do,rae,Obr=v(()=>{na();rd();Xe();Qe();JG=require("obsidian");Wb();$do=5e3,rae=class{constructor(e,r,n){this.app=e;this.indexOps=r;this.indexBackend=n;this.debounceTimer=null;this.lastActiveFile=null;this.lastActiveFileMtime=null;this.listenersActive=!1;this.handleActiveLeafChange=async e=>{if(!this.shouldHandleEvents()||JG.Platform.isMobile&&ee().disableIndexOnMobile&&!this.indexBackend.isRemoteBackend()||UC()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof JG.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}=Zl(),u=fu(n,a,s),l=o!==null&&n.stat.mtime>o;u&&l&&this.debouncedReindexFile(n)}};this.debouncedReindexFile=e=>{this.shouldHandleEvents()&&(this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{ee().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},$do))};this.handleFileDelete=async e=>{this.shouldHandleEvents()&&e instanceof JG.TFile&&await this.indexBackend.removeByPath(e.path)};this.syncEventListeners(),ml(()=>{this.syncEventListeners()})}shouldHandleEvents(){return ee().enableSemanticSearchV3?!(this.indexBackend.isRemoteBackend()&&!this.indexBackend.requiresEmbeddings()):!1}syncEventListeners(){let e=this.shouldHandleEvents();e&&!this.listenersActive?(F("Copilot Plus: Initializing semantic index event listeners"),this.app.workspace.on("active-leaf-change",this.handleActiveLeafChange),this.app.vault.on("delete",this.handleFileDelete),this.listenersActive=!0):!e&&this.listenersActive&&this.teardownEventListeners()}teardownEventListeners(){this.listenersActive&&(this.app.workspace.off("active-leaf-change",this.handleActiveLeafChange),this.app.vault.off("delete",this.handleFileDelete),this.debounceTimer!==null&&(window.clearTimeout(this.debounceTimer),this.debounceTimer=null),this.lastActiveFile=null,this.lastActiveFileMtime=null,this.listenersActive=!1)}cleanup(){this.teardownEventListeners()}unload(){this.teardownEventListeners()}}});function mat(t){return pat.add(t),()=>{pat.delete(t)}}function nae(){pat.forEach(t=>t())}var pat,hat=v(()=>{pat=new Set});var XOe,Ebr=v(()=>{XOe=class{constructor(e){this.lastRequestTime=0;this.requestsPerMin=e}setRequestsPerMin(e){this.requestsPerMin=e}getRequestsPerMin(){return this.requestsPerMin}async wait(){let r=Date.now()-this.lastRequestTime,n=Math.max(0,6e4/this.requestsPerMin-r);n>0&&await new Promise(o=>setTimeout(o,n)),this.lastRequestTime=Date.now()}}});var Yl,gat=v(()=>{Yl=class{constructor(t){x(this,"pageContent");x(this,"metadata");x(this,"id");this.pageContent=t.pageContent!==void 0?t.pageContent.toString():"",this.metadata=t.metadata??{},this.id=t.id}}});var yat,Pbr=v(()=>{_g();yat=class extends Ti{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","documents","transformers"])}invoke(e,r){return this.transformDocuments(e)}}});var OD=v(()=>{zo();gat();Pbr()});var Mbr,_at,Rbr=v(()=>{OD();Get();Mbr=class extends yat{constructor(e){super(e);x(this,"lc_namespace",["langchain","document_transformers","text_splitters"]);x(this,"chunkSize",1e3);x(this,"chunkOverlap",200);x(this,"keepSeparator",!1);x(this,"lengthFunction");if(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,y=c.indexOf(m,p+1);if(f===null){let w=this.numberOfNewLines(c,0,y);d+=w}else{let w=p+await this.lengthFunction(f);if(w<y){let T=this.numberOfNewLines(c,w,y);d+=T}else if(w>y){let T=this.numberOfNewLines(c,y,w);d-=T}s&&(h+=a)}let g=this.numberOfNewLines(m),b=o[l].loc&&typeof o[l].loc=="object"?{...o[l].loc}:{};b.lines={from:d,to:d+g};let _={...o[l],loc:b};h+=m,u.push(new Yl({pageContent:h,metadata:_})),d+=g,f=m,p=y}}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}},_at=class bat extends Mbr{constructor(r){super(r);x(this,"separators",[`

`,`
`," ",""]);this.separators=r?.separators??this.separators,this.keepSeparator=r?.keepSeparator??!0}static lc_name(){return"RecursiveCharacterTextSplitter"}async _splitText(r,n){let o=[],i=n[n.length-1],a;for(let c=0;c<n.length;c+=1){let d=n[c];if(d===""){i=d;break}if(r.includes(d)){i=d,a=n.slice(c+1);break}}let s=this.splitOnSeparator(r,i),u=[],l=this.keepSeparator?"":i;for(let c of s)if(await this.lengthFunction(c)<this.chunkSize)u.push(c);else{if(u.length){let d=await this.mergeSplits(u,l);o.push(...d),u=[]}if(!a)o.push(c);else{let d=await this._splitText(c,a);o.push(...d)}}if(u.length){let c=await this.mergeSplits(u,l);o.push(...c)}return o}async splitText(r){return this._splitText(r,this.separators)}static fromLanguage(r,n){return new bat({...n,separators:bat.getSeparatorsForLanguage(r)})}static getSeparatorsForLanguage(r){if(r==="cpp")return[`
class `,`
void `,`
int `,`
float `,`
double `,`
if `,`
for `,`
while `,`
switch `,`
case `,`

`,`
`," ",""];if(r==="go")return[`
func `,`
var `,`
const `,`
type `,`
if `,`
for `,`
switch `,`
case `,`

`,`
`," ",""];if(r==="java")return[`
class `,`
public `,`
protected `,`
private `,`
static `,`
if `,`
for `,`
while `,`
switch `,`
case `,`

`,`
`," ",""];if(r==="js")return[`
function `,`
const `,`
let `,`
var `,`
class `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
default `,`

`,`
`," ",""];if(r==="php")return[`
function `,`
class `,`
if `,`
foreach `,`
while `,`
do `,`
switch `,`
case `,`

`,`
`," ",""];if(r==="proto")return[`
message `,`
service `,`
enum `,`
option `,`
import `,`
syntax `,`

`,`
`," ",""];if(r==="python")return[`
class `,`
def `,`
	def `,`

`,`
`," ",""];if(r==="rst")return[`
===
`,`
---
`,`
***
`,`
.. `,`

`,`
`," ",""];if(r==="ruby")return[`
def `,`
class `,`
if `,`
unless `,`
while `,`
for `,`
do `,`
begin `,`
rescue `,`

`,`
`," ",""];if(r==="rust")return[`
fn `,`
const `,`
let `,`
if `,`
while `,`
for `,`
loop `,`
match `,`
const `,`

`,`
`," ",""];if(r==="scala")return[`
class `,`
object `,`
def `,`
val `,`
var `,`
if `,`
for `,`
while `,`
match `,`
case `,`

`,`
`," ",""];if(r==="swift")return[`
func `,`
class `,`
struct `,`
enum `,`
if `,`
for `,`
while `,`
do `,`
switch `,`
case `,`

`,`
`," ",""];if(r==="markdown")return[`
## `,`
### `,`
#### `,`
##### `,`
###### `,"```\n\n",`

***

`,`

---

`,`

___

`,`

`,`
`," ",""];if(r==="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(r==="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(r==="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 ${r} is not supported.`)}}});var Ibr=v(()=>{Rbr()});var KG,aH,vat=v(()=>{Xe();Qe();KG=class KG{constructor(){this.bytesUsed=0;let e=ee(),r=Math.min(1e3,Math.max(20,e.lexicalSearchRamLimit||100));this.maxBytes=r*KG.MB_TO_BYTES,this.candidateLimit=Math.min(KG.DEFAULT_CANDIDATE_LIMIT,Math.floor(r*5))}getMaxBytes(){return this.maxBytes}getCandidateLimit(){return this.candidateLimit}getBytesUsed(){return this.bytesUsed}canAddContent(e){return this.bytesUsed+e<=this.maxBytes}addBytes(e){this.bytesUsed+=e}reset(){let e=this.bytesUsed;this.bytesUsed=0,F(`MemoryManager: Reset memory tracking (was using ${e} bytes, max: ${this.maxBytes} bytes)`)}getUsagePercent(){return Math.round(this.bytesUsed/this.maxBytes*100)}static getByteSize(e){return new TextEncoder().encode(e).length}};KG.DEFAULT_CANDIDATE_LIMIT=500,KG.MB_TO_BYTES=1024*1024;aH=KG});function lq(t){return wat||(wat=new Sat(t)),wat}var YOe,ZOe,Sat,wat,oae=v(()=>{Xe();gr();YOe=require("obsidian");Ibr();vat();ZOe={maxChars:jge,overlap:0,maxBytesTotal:10*1024*1024},Sat=class{constructor(e){this.app=e;this.cache=new Map;this.memoryUsage=0}getCacheKey(e,r){return`${e}:${r.maxChars}:${r.overlap}`}createSplitter(e){return _at.fromLanguage("markdown",{chunkSize:e.maxChars,chunkOverlap:e.overlap,separators:[`

`,`
`,". "," ",""],keepSeparator:!1})}async getChunks(e,r={}){try{if(!Array.isArray(e))return Ce("ChunkManager: Invalid notePaths provided"),[];if(e.length===0)return[];e.length>1e3&&(Ce("ChunkManager: Too many note paths, limiting to 1000"),e=e.slice(0,1e3));let n=e.filter(u=>!(!u||typeof u!="string"||u.startsWith("/")||u.startsWith("../")||u.includes("/../")||u.endsWith("/..")));if(n.length===0)return Ce("ChunkManager: No valid note paths provided"),[];let o={...ZOe,...r},i=[],a=0,s=0;for(let u of n){let l=this.getCacheKey(u,o),c=this.cache.get(l);if(c&&c.length>0){let d=this.app.vault.getAbstractFileByPath(u);if(d&&d instanceof YOe.TFile&&d.stat.mtime>c[0].mtime){let f=this.calculateChunkBytes(c);this.cache.delete(l),this.memoryUsage-=f,c=void 0}}if(!c&&(c=await this.generateChunksForNote(u,o),c.length>0)){let d=this.calculateChunkBytes(c);this.memoryUsage+d<=o.maxBytesTotal?(this.cache.set(l,c),this.memoryUsage+=d):(a+=1,s+=d)}i.push(...c)}if(a>0){let u=(s/1024/1024).toFixed(1);F(`ChunkManager: Cache budget reached, skipped caching ${a} notes (${u}MB total)`)}return F(`ChunkManager: Retrieved ${i.length} chunks from ${n.length} notes (${this.formatMemoryUsage()})`),i}catch(n){return Ce("ChunkManager: Failed to get chunks",n),[]}}async getChunkText(e){return(await this.ensureChunkExists(e))?.content||""}async ensureChunkExists(e){let[r]=e.split("#"),o=(await this.getValidatedChunks(r)).find(i=>i.id===e);return o||Ce(`ChunkManager: Chunk ${e} not found after regeneration`),o||null}async getValidatedChunks(e){let r;for(let[o,i]of this.cache.entries())if(o.startsWith(e+":")){r=i;break}if(!r&&(F(`ChunkManager: Cache miss for ${e}, regenerating...`),r=await this.regenerateChunks(e),!r||r.length===0))return Ce(`ChunkManager: Failed to regenerate chunks for ${e}`),[];let n=this.app.vault.getAbstractFileByPath(e);return n&&n instanceof YOe.TFile&&r.length>0&&n.stat.mtime>r[0].mtime&&(F(`ChunkManager: File ${e} modified, regenerating chunks`),r=await this.regenerateChunks(e),!r||r.length===0)?(Ce(`ChunkManager: Failed to regenerate chunks after modification for ${e}`),[]):r}getChunkTextSync(e){let[r]=e.split("#");for(let[n,o]of this.cache.entries())if(n.startsWith(r+":")){let i=o.find(a=>a.id===e);if(i)return i.content}return Ce(`ChunkManager: Chunk not in cache: ${e} (use async getChunkText for auto-regeneration)`),""}async regenerateChunks(e){try{let r=await this.generateChunksForNote(e,ZOe),n=this.getCacheKey(e,ZOe);if(r.length>0){let o=this.calculateChunkBytes(r);if(this.memoryUsage+o<=ZOe.maxBytesTotal){let i=this.cache.get(n);i&&(this.memoryUsage-=this.calculateChunkBytes(i)),this.cache.set(n,r),this.memoryUsage+=o}else F(`ChunkManager: Cannot cache regenerated chunks for ${e}, would exceed memory budget`)}return r}catch(r){return Ce(`ChunkManager: Failed to regenerate chunks for ${e}`,r),[]}}clearCache(){this.cache.clear(),this.memoryUsage=0,F("ChunkManager: Cache cleared")}async generateChunksForNote(e,r){try{let n=this.app.vault.getAbstractFileByPath(e);if(!n||!(n instanceof YOe.TFile))return[];let o=await this.safeReadFile(n);if(!o?.trim())return[];let i=this.app.metadataCache.getFileCache(n),a=(i?.headings||[]).slice().sort((p,m)=>p.position.start.offset-m.position.start.offset),s=[],u=0,l=this.findFrontmatterEnd(o,i?.frontmatter),c=o.substring(l),d=a.length>0?a[0].heading:"";if(`

NOTE TITLE: [[${n.basename}]]

NOTE BLOCK CONTENT:

`.length+c.length<=r.maxChars){let p=await this.processContentSection(c,d,n,u,r);return s.push(...p),s}if(a.length===0){let p=await this.processContentSection(c,"",n,u,r);return s.push(...p),s}for(let p=0;p<a.length;p++){let m=a[p],h=a[p+1],y=p===0?l:m.position.start.offset,g=h?.position.start.offset||o.length,b=o.substring(y,g),_=await this.processContentSection(b,m.heading,n,u,r);s.push(..._),u+=_.length}return s}catch(n){return Ce(`ChunkManager: Failed to chunk note ${e}`,n),[]}}async processContentSection(e,r,n,o,i){let a=n.basename,s=[],u=`

NOTE TITLE: [[${a}]]

NOTE BLOCK CONTENT:

`,l=u+e;if(l.length<=i.maxChars){let c=this.generateChunkId(n.path,o),d=this.calculateContentHash(l);s.push({id:c,notePath:n.path,chunkIndex:o,content:l,contentHash:d,title:a,heading:r,mtime:n.stat.mtime})}else try{let d=await this.createSplitter(i).createDocuments([e],[],{chunkHeader:u,appendChunkOverlapHeader:i.overlap>0});this.coalesceTinySplitChunks(d.map(p=>p.pageContent),u,i.maxChars).forEach((p,m)=>{let h=o+m,y=this.generateChunkId(n.path,h),g=this.calculateContentHash(p);s.push({id:y,notePath:n.path,chunkIndex:h,content:p,contentHash:g,title:a,heading:r,mtime:n.stat.mtime})})}catch(c){Ce(`ChunkManager: Failed to split section in ${n.path}`,c);let d=this.generateChunkId(n.path,o),f=this.calculateContentHash(l);s.push({id:d,notePath:n.path,chunkIndex:o,content:l,contentHash:f,title:a,heading:r,mtime:n.stat.mtime})}return s}coalesceTinySplitChunks(e,r,n){if(e.length<=1)return e;let o=[...e],i=0;for(;i<o.length-1;){if(this.isTinyStructuralChunk(o[i],r)){let a=this.mergeChunkContents(o[i],o[i+1],r);if(a.length<=n){o.splice(i,2,a);continue}}i++}if(o.length>1){let a=o.length-1;if(this.isTinyStructuralChunk(o[a],r)){let s=this.mergeChunkContents(o[a-1],o[a],r);s.length<=n&&o.splice(a-1,2,s)}}return o}isTinyStructuralChunk(e,r){let n=this.stripChunkHeader(e,r).trim();if(!n)return!0;let o=n.split(/\r?\n/).map(i=>i.trim()).filter(Boolean);return o.length===1&&/^#{1,6}\s+\S+/.test(o[0])}mergeChunkContents(e,r,n){let o=this.stripChunkHeader(e,n).replace(/\s+$/,""),i=this.stripChunkHeader(r,n).replace(/^\s+/,"");return`${n}${o}${o&&i?`

`:""}${i}`}stripChunkHeader(e,r){return e.startsWith(r)?e.slice(r.length):e}calculateChunkBytes(e){return e.reduce((r,n)=>r+aH.getByteSize(n.content),0)}async safeReadFile(e){try{return(await this.app.vault.cachedRead(e))?.trim()||""}catch(r){return Ce(`ChunkManager: Failed to read ${e.path}`,r),""}}generateChunkId(e,r){return`${e}#${r}`}calculateContentHash(e){let r=e.length.toString(16),n=e.slice(0,32).replace(/\s/g,"").substring(0,8);return r+n}formatMemoryUsage(){return`${(this.memoryUsage/1024/1024).toFixed(1)}MB`}findFrontmatterEnd(e,r){if(!r||!e.startsWith("---"))return 0;let n=e.match(/\n---(\r?\n|$)/);return n&&n.index!==void 0?n.index+n[0].length:0}},wat=null});var Abr,QOe,iae,Nbr=v(()=>{na();XV();Xe();Ebr();oae();Qe();Dt();Abr=$(oH()),QOe=require("obsidian");Wb();iae=class{constructor(e,r,n){this.app=e;this.indexBackend=r;this.embeddingsManager=n;this.state={isIndexingPaused:!1,isIndexingCancelled:!1,indexedCount:0,totalFilesToIndex:0,processedFiles:new Set};this.refreshRuntimeIndexingConfig(),this.chunkManager=lq(e),ml(async()=>{this.refreshRuntimeIndexingConfig()})}refreshRuntimeIndexingConfig(){let e=ee();this.rateLimiter=new XOe(e.embeddingRequestsPerMin),this.embeddingBatchSize=Math.max(1,e.embeddingBatchSize),this.checkpointInterval=8*this.embeddingBatchSize}async indexVaultToVectorStore(e,r){if(!ee().enableSemanticSearchV3)return Ce("indexVaultToVectorStore called with semantic search disabled, skipping."),0;let n=[];x3e();try{let o=this.indexBackend.requiresEmbeddings(),i=o?await this.embeddingsManager.getEmbeddingsAPI():void 0;if(o&&!i)return ie("Embedding instance not found."),C3e({isActive:!1,isPaused:!1,isCancelled:!1,indexedCount:0,totalFiles:0,errors:["Embedding model not available. Please check your Copilot settings to make sure you have a working embedding model."],completionStatus:"error"}),0;(o?await this.indexBackend.checkAndHandleEmbeddingModelChange(i):!1)&&(e=!0),e?(await this.indexBackend.clearIndex(i),this.indexBackend.clearFilesMissingEmbeddings()):await this.indexBackend.garbageCollect();let s=await this.getFilesToIndex(e);if(s.length===0)return r?.userInitiated&&Sg({completionStatus:"success"}),0;this.initializeIndexingState(s.length),this.indexBackend.clearFilesMissingEmbeddings();let u=o&&i?dd.getModelName(i):"",l=await this.prepareAllChunks(s,u);if(l.length===0)return x3e(),0;if(this.state.isIndexingCancelled||QJ().isCancelled)return Sg({isActive:!1,completionStatus:"cancelled"}),0;let c=new Set(l.map(f=>f.fileInfo.path)).size;this.state.totalFilesToIndex=c,Sg({totalFiles:c});let d=0;for(;d<l.length&&!(this.state.isIndexingCancelled||QJ().isCancelled);){await this.handlePause();let f=l.slice(d,d+this.embeddingBatchSize);try{let p=[];if(o&&i){await this.rateLimiter.wait();let y=await i.embedDocuments(f.map(g=>g.content));if(!y||y.length!==f.length)throw new Error(`Embedding model returned ${y?.length??0} embeddings for ${f.length} documents`);for(let g=0;g<f.length;g++){let b=f[g],_=y[g];if(!_||!Array.isArray(_)||_.length===0){ie(`Invalid embedding for document ${b.fileInfo.path}: ${_}`),this.indexBackend.markFileMissingEmbeddings(b.fileInfo.path);continue}p.push({doc:{...b.fileInfo,id:this.getDocHash(b.content),content:b.content,embedding:_,created_at:Date.now(),nchars:b.content.length},filePath:b.fileInfo.path})}}else for(let y of f)p.push({doc:{...y.fileInfo,id:this.getDocHash(y.content),content:y.content,embedding:[],created_at:Date.now(),nchars:y.content.length},filePath:y.fileInfo.path});if(p.length>0)try{await this.indexBackend.upsertBatch(p.map(y=>y.doc)),p.forEach(y=>this.state.processedFiles.add(y.filePath))}catch(y){ie("Batch upsert failed; falling back to per-document upserts.",y);for(let g of p)try{await this.indexBackend.upsert(g.doc),this.state.processedFiles.add(g.filePath)}catch(b){this.handleError(b,{filePath:g.filePath,errors:n}),o&&this.indexBackend.markFileMissingEmbeddings(g.filePath)}}this.state.indexedCount=this.state.processedFiles.size,p1t(this.state.indexedCount);let m=Math.floor((this.state.indexedCount-f.length)/this.checkpointInterval);Math.floor(this.state.indexedCount/this.checkpointInterval)>m&&(await this.indexBackend.save(),console.log("Copilot index checkpoint save completed."))}catch(p){if(this.handleError(p,{filePath:f?.[0]?.fileInfo?.path,errors:n,batch:f}),this.isRateLimitError(p))break}d+=f.length}return this.finalizeIndexing(n),setTimeout(()=>{this.indexBackend.save().then(()=>{F("Copilot index final save completed."),this.indexBackend.checkIndexIntegrity().catch(f=>{ie("Background integrity check failed:",f)})}).catch(f=>{ie("Background save failed:",f)})},100),this.state.indexedCount}catch(o){return this.handleError(o),Sg({isActive:!1,completionStatus:"error",errors:[o instanceof Error?o.message:String(o)]}),0}}async prepareAllChunks(e,r){let n=[];for(let i=0;i<e.length;i+=1e3){let s=e.slice(i,i+1e3).map(l=>l.path),u=await this.chunkManager.getChunks(s);for(let l of u){let c=this.app.vault.getAbstractFileByPath(l.notePath);if(!c||!(c instanceof QOe.TFile))continue;let d=this.app.metadataCache.getFileCache(c),f={title:l.title,path:l.notePath,embeddingModel:r,ctime:c.stat.ctime,mtime:l.mtime,tags:d?.tags?.map(p=>p.tag)??[],extension:c.extension,metadata:{...d?.frontmatter??{},created:vg(new Date(c.stat.ctime)).display,modified:vg(new Date(l.mtime)).display,chunkId:l.id,heading:l.heading}};if(l.content.trim()){let p=`METADATA:${JSON.stringify(f.metadata)}

`,m=l.content.indexOf("NOTE BLOCK CONTENT:"),h=m>0?l.content.slice(0,m)+p+l.content.slice(m):l.content;n.push({content:h,chunkId:l.id,fileInfo:f})}}}return n}getDocHash(e){return(0,Abr.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=Zl(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>fu(c,r,n));let i=new Set(await this.indexBackend.getIndexedFiles()),a=await this.indexBackend.getLatestFileMtime(),s=new Set(this.indexBackend.getFilesMissingEmbeddings()),u=new Set,l=new Set;for(let c of o){if(!fu(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 F([`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},C3e({isActive:!0,isPaused:!1,isCancelled:!1,indexedCount:0,totalFiles:e,errors:[],completionStatus:"none"})}async handlePause(){let e=QJ();if(this.state.isIndexingPaused=e.isPaused,this.state.isIndexingCancelled=e.isCancelled,this.state.isIndexingPaused){for(;this.state.isIndexingPaused&&!this.state.isIndexingCancelled;){await new Promise(n=>setTimeout(n,100));let r=QJ();this.state.isIndexingPaused=r.isPaused,this.state.isIndexingCancelled=r.isCancelled}if(!this.state.isIndexingCancelled){this.refreshRuntimeIndexingConfig();let r=await this.getFilesToIndex();if(r.length===0){F("No files to index after filter change, stopping indexing"),this.cancelIndexing();return}let n=Math.max(this.state.indexedCount+r.length,1);this.state.totalFilesToIndex=n,Sg({totalFiles:n})}}}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.isStringLengthError(e)){new QOe.Notice("Vault is too large for 1 partition, please increase the number of partitions in your Copilot QA settings!",1e4);return}}isRateLimitError(e){return e?.message?.includes?.("rate limit")||!1}finalizeIndexing(e){if(m1t(),this.state.isIndexingCancelled||QJ().isCancelled){Sg({isActive:!1,completionStatus:"cancelled",errors:e});return}Sg({isActive:!1,completionStatus:e.length>0?"error":"success",errors:e,indexedCount:this.state.indexedCount})}async reindexFile(e){try{let r=this.indexBackend.requiresEmbeddings(),n=r?await this.embeddingsManager.getEmbeddingsAPI():void 0;if(r&&!n)return;if(await this.indexBackend.removeByPath(e.path),r&&n&&await this.indexBackend.checkAndHandleEmbeddingModelChange(n)){await this.indexVaultToVectorStore(!0);return}let o=r&&n?dd.getModelName(n):"",i=await this.prepareAllChunks([e],o);if(i.length===0)return;if(r&&n){let a=await n.embedDocuments(i.map(s=>s.content));for(let s=0;s<i.length;s++){let u=i[s];await this.indexBackend.upsert({...u.fileInfo,id:this.getDocHash(u.content),content:u.content,embedding:a[s],created_at:Date.now(),nchars:u.content.length})}}else for(let a of i)await this.indexBackend.upsert({...a.fileInfo,id:this.getDocHash(a.content),content:a.content,embedding:[],created_at:Date.now(),nchars:a.content.length});this.indexBackend.markUnsavedChanges(),ee().debug&&console.log(`Reindexed file: ${e.path}`)}catch(r){this.handleError(r,{filePath:e.path})}}async cancelIndexing(){F("Indexing cancelled by user"),this.state.isIndexingCancelled=!0,Sg({isCancelled:!0,isActive:!1,completionStatus:"cancelled"}),await new Promise(e=>setTimeout(e,100))}}});var Bc={};En(Bc,{default:()=>p0});var aae,p0,El=v(()=>{na();OS();Xe();XV();u0();Qe();aae=require("obsidian");Fhr();Tbr();Obr();hat();Nbr();p0=class t{constructor(){this.embeddingsManager=dd.getInstance(),this.oramaBackend=new GOe(app),this.miyoBackend=new VTe(app),this.activeBackendKey=this.getBackendKey(ee()),this.indexBackend=this.activeBackendKey==="miyo"?this.miyoBackend:this.oramaBackend,this.indexOps=new iae(app,this.indexBackend,this.embeddingsManager),this.eventHandler=new rae(app,this.indexOps,this.indexBackend),this.initializationPromise=this.initialize(),this.setupSettingsSubscription()}static getInstance(){return t.instance||(t.instance=new t),t.instance}setupSettingsSubscription(){this.lastKnownSettings={...ee()};let e=async()=>{let r=ee(),n=this.lastKnownSettings;if(this.lastKnownSettings={...r},r.enableIndexSync!==n?.enableIndexSync&&this.activeBackendKey==="orama"){let o=await this.embeddingsManager.getEmbeddingsAPI();await this.oramaBackend.reinitializeForIndexSyncChange(o)}await this.refreshBackend(r,n)};ml(()=>{this.initializationPromise=e()})}async initialize(){if(ee().enableSemanticSearchV3)try{let r=3;for(;r>0;)try{let n=this.indexBackend.requiresEmbeddings()?await this.embeddingsManager.getEmbeddingsAPI():void 0;await this.indexBackend.initialize(n);break}catch(n){if(n instanceof qo&&n.message.includes("Vault adapter not available")&&(r--,r>0)){await new Promise(o=>setTimeout(o,100));continue}new aae.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:",n);break}}catch(r){console.error("Failed to initialize vector store:",r)}}async waitForInitialization(){await this.initializationPromise}async indexVaultToVectorStore(e,r){if(await this.waitForInitialization(),!ee().enableSemanticSearchV3)return Ce("indexVaultToVectorStore called with semantic search disabled, skipping."),0;if(this.activeBackendKey==="miyo")return await this.miyoBackend.requestIndexRefresh(!!e),nae(),0;if(aae.Platform.isMobile&&ee().disableIndexOnMobile&&!this.indexBackend.isRemoteBackend())return new aae.Notice("Indexing is disabled on mobile devices"),0;let n=await this.indexOps.indexVaultToVectorStore(e,r);return nae(),n}async clearIndex(){await this.waitForInitialization();let e=this.indexBackend.requiresEmbeddings()?await this.embeddingsManager.getEmbeddingsAPI():void 0;await this.indexBackend.clearIndex(e),nae()}async garbageCollectVectorStore(){return await this.waitForInitialization(),this.indexBackend.garbageCollect()}async getIndexedFiles(){return await this.waitForInitialization(),this.indexBackend.getIndexedFiles()}async isIndexEmpty(){return await this.waitForInitialization(),await this.indexBackend.isIndexEmpty()}async hasIndex(e){return await this.waitForInitialization(),this.indexBackend.hasIndex(e)}async getDocumentsByPath(e){return await this.waitForInitialization(),this.indexBackend.getDocumentsByPath(e)}pauseIndexing(){Sg({isPaused:!0})}resumeIndexing(){Sg({isPaused:!1})}async cancelIndexing(){await this.indexOps.cancelIndexing()}shouldUseMiyo(e){return kh(e)}getBackendKey(e){return this.shouldUseMiyo(e)?"miyo":"orama"}async refreshBackend(e,r){let n=this.getBackendKey(e);if(n!==this.activeBackendKey){if(this.activeBackendKey=n,this.indexBackend=n==="miyo"?this.miyoBackend:this.oramaBackend,this.indexOps=new iae(app,this.indexBackend,this.embeddingsManager),this.eventHandler.cleanup(),this.eventHandler=new rae(app,this.indexOps,this.indexBackend),ee().debug&&F(`VectorStoreManager: switched backend to ${n}`),e.enableSemanticSearchV3){let o=this.indexBackend.requiresEmbeddings()?await this.embeddingsManager.getEmbeddingsAPI():void 0;await this.indexBackend.initialize(o)}r&&e.enableSemanticSearchV3&&e.enableMiyo!==r.enableMiyo&&F("VectorStoreManager: Miyo backend toggled; reindex recommended.")}}onunload(){this.eventHandler.cleanup(),this.indexBackend.onunload()}async getDb(){await this.waitForInitialization();let e=this.oramaBackend.getDb();if(!e)throw new Error("Database is not loaded. Please restart the plugin.");return e}async reindexFile(e){await this.waitForInitialization(),this.activeBackendKey!=="miyo"&&(await this.indexOps.reindexFile(e),nae())}}});function bit(){let t=ee();return t.selfHostModeValidatedAt==null?!1:t.selfHostValidationCount>=GG?!0:Date.now()-t.selfHostModeValidatedAt<uae}function Wy(){return ee().enableSelfHostMode?bit():!1}function VJe(t){return t.split("|")[1]==="copilot-plus"}function Dbr(){let t=ee();return Wy()?!0:t.isPlusUser===!0}function XG(){let t=kr();return t.plusLicenseKey&&t.enableSelfHostMode&&t.selfHostModeValidatedAt!=null&&(t.selfHostValidationCount>=GG||Date.now()-t.selfHostModeValidatedAt<uae)?!0:t.isPlusUser}async function m0(t){return Wy()?!0:ee().plusLicenseKey?(await Xl.getInstance().validateLicenseKey(t)).isValid:(Mat(),!1)}async function Eat(){if(!ee().plusLicenseKey)return!1;let r=(await Xl.getInstance().validateLicenseKey()).plan?.toLowerCase();return r!=null&&Fdo.includes(r)}function jbr(){let t=kr(),[e,r]=Cat.default.useState(void 0);return Cat.default.useEffect(()=>{if(!t.plusLicenseKey){t.enableSelfHostMode&&Re("enableSelfHostMode",!1),r(!1);return}Eat().then(n=>{!n&&t.enableSelfHostMode&&Re("enableSelfHostMode",!1),r(n)}).catch(()=>{if(t.selfHostValidationCount>=GG){r(!0);return}if(t.selfHostModeValidatedAt!=null&&Date.now()-t.selfHostModeValidatedAt<uae){r(!0);return}r(!1)})},[t.plusLicenseKey,t.enableSelfHostMode,t.selfHostModeValidatedAt,t.selfHostValidationCount]),e}async function $br(){let t=ee();if(t.selfHostValidationCount>=GG)return Re("selfHostModeValidatedAt",Date.now()),F("Self-host mode re-enabled (permanently validated)"),!0;if(t.selfHostModeValidatedAt!=null&&Date.now()-t.selfHostModeValidatedAt<uae)return F("Self-host mode re-enabled (within grace period)"),!0;if(!await Eat())return F("Self-host mode requires an eligible plan (Believer, Supporter)"),new sae.Notice("Self-host mode is only available for Believer and Supporter plan subscribers."),!1;let r=Math.max(t.selfHostValidationCount||0,1);return Re("selfHostModeValidatedAt",Date.now()),Re("selfHostValidationCount",r),F(`Self-host mode validation successful (${r}/3)`),!0}async function Lbr(){let t=ee();if(!(!t.enableSelfHostMode&&!t.enableMiyo)){if(t.selfHostValidationCount>=GG){F("Self-host mode permanently validated, skipping refresh");return}try{if(await Eat()){let r=Date.now();if(r-(t.selfHostModeValidatedAt||0)>=uae){let i=(t.selfHostValidationCount||0)+1;Re("selfHostModeValidatedAt",r),Re("selfHostValidationCount",i),i>=GG?(F("Self-host mode permanently validated (3/3)"),new sae.Notice("Self-host mode is now permanently enabled!")):F(`Self-host mode validation refreshed (${i}/3)`)}else F("Self-host mode validated (waiting for 15-day interval to increment count)")}else Re("enableSelfHostMode",!1),Re("enableMiyo",!1),Re("selfHostModeValidatedAt",null),Re("selfHostValidationCount",0),F("Self-host mode disabled - user is no longer on an eligible plan"),new sae.Notice("Self-host mode has been disabled. An eligible plan is required.")}catch(e){F("Could not refresh self-host mode validation (offline?):",e)}}}function Fbr(){let t=Ldo,e=Oat,r=ee().embeddingModelKey;F("applyPlusSettings: Changing embedding model",{from:r,to:e,changed:r!==e}),a1t(t),S4("copilot_plus"),A_({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e?(F("applyPlusSettings: Embedding model changed, triggering indexing"),Promise.resolve().then(()=>(El(),Bc)).then(async n=>{await n.default.getInstance().indexVaultToVectorStore()}).catch(n=>{ie("Failed to trigger indexing after Plus settings applied:",n),new sae.Notice("Failed to update Copilot index. Please try force reindexing from the command palette.")})):F("applyPlusSettings: No embedding model change, skipping indexing")}function Pat(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function V4(t){window.open(Pat(t),"_blank")}function kbr(){Re("isPlusUser",!0)}function Mat(){let t=ee().isPlusUser;Re("isPlusUser",!1),t&&new Cbe(app).open()}var sae,Cat,xat,Ldo,Tat,Oat,o5a,i5a,uae,GG,Fdo,id=v(()=>{na();rd();kFt();gr();aA();Xe();Qe();sae=require("obsidian"),Cat=$(K()),xat="copilot-plus-flash",Ldo=xat+"|"+"copilot-plus",Tat="copilot-plus-small",Oat=Tat+"|"+"copilot-plus",o5a=Do.defaultModelKey,i5a=Do.embeddingModelKey,uae=15*24*60*60*1e3,GG=3,Fdo=["believer","supporter"]});function cq(t){let e=new Uint8Array(t),r="";for(let n=0;n<e.byteLength;n++)r+=String.fromCharCode(e[n]);return globalThis.btoa(r)}var eEe=v(()=>{});var Xl,aA=v(()=>{gr();BC();OS();Xe();id();Qe();Dt();eEe();Xl=class t{constructor(){this.pluginVersion="Unknown"}static getInstance(){return t.instance||(t.instance=new t),t.instance}checkLicenseKey(){if(!ee().plusLicenseKey)throw new y4("Copilot Plus license key not found. Please enter your license key in the settings.")}setPluginVersion(e){this.pluginVersion=e}async makeRequest(e,r,n="POST",o=!1,i=!1){i||this.checkLicenseKey(),r.user_id=ee().userId;let a=new URL(`${ZWe}${e}`);n==="GET"&&Object.entries(r).forEach(([c,d])=>{a.searchParams.append(c,d)});let s={"Content-Type":"application/json","X-Client-Version":this.pluginVersion};o||(s.Authorization=`Bearer ${await kn(ee().plusLicenseKey)}`);let u=await Rge(a.toString(),{method:n,headers:s,...n==="POST"&&{body:JSON.stringify(r)}}),l=await u.json();if(!u.ok)try{let c=l.detail,d=new Error(c.reason);return d.name=c.error,{data:null,error:d}}catch{return{data:null,error:new Error("Unknown error")}}return F(`[API ${e} request]:`,l),{data:l}}async makeFormDataRequest(e,r,n=!1){n||this.checkLicenseKey(),r.append("user_id",ee().userId);let o=new URL(`${ZWe}${e}`);try{let i=await fetch(o.toString(),{method:"POST",headers:{Authorization:`Bearer ${await kn(ee().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 F(`[API ${e} form-data request]:`,a),{data:a}}catch(i){return{data:null,error:i instanceof Error?i:new Error(String(i))}}}async validateLicenseKey(e){let r={license_key:await kn(ee().plusLicenseKey)};if(e&&typeof e=="object"){let i=Object.fromEntries(Object.entries(e).filter(([s,u])=>u!=null)),a=new Set(["license_key","user_id"]);for(let s of a)s in i&&delete i[s];Object.assign(r,i)}let{data:n,error:o}=await this.makeRequest("/license",r,"POST",!0,!0);return o?o.message==="Invalid license key"?(Mat(),{isValid:!1}):{isValid:void 0}:(kbr(),{isValid:!0,plan:n?.plan})}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=cq(e),{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 twitter4llm(e){let{data:r,error:n}=await this.makeRequest("/twitter4llm",{url:e});if(n)throw n;if(!r)throw new Error("No data returned from twitter4llm");return r}}});var YG=S((_5a,zbr)=>{var kdo="Expected a function",Bbr=NaN,qdo="[object Symbol]",Bdo=/^\s+|\s+$/g,Udo=/^[-+]0x[0-9a-f]+$/i,zdo=/^0b[01]+$/i,Vdo=/^0o[0-7]+$/i,Hdo=parseInt,Wdo=typeof window=="object"&&window&&window.Object===Object&&window,Jdo=typeof self=="object"&&self&&self.Object===Object&&self,Kdo=Wdo||Jdo||Function("return this")(),Gdo=Object.prototype,Xdo=Gdo.toString,Zdo=Math.max,Ydo=Math.min,Rat=function(){return Kdo.Date.now()};function Qdo(t,e,r){var n,o,i,a,s,u,l=0,c=!1,d=!1,f=!0;if(typeof t!="function")throw new TypeError(kdo);e=Ubr(e)||0,Iat(r)&&(c=!!r.leading,d="maxWait"in r,i=d?Zdo(Ubr(r.maxWait)||0,e):i,f="trailing"in r?!!r.trailing:f);function p(O){var E=n,P=o;return n=o=void 0,l=O,a=t.apply(P,E),a}function m(O){return l=O,s=setTimeout(g,e),c?p(O):a}function h(O){var E=O-u,P=O-l,R=e-E;return d?Ydo(R,i-P):R}function y(O){var E=O-u,P=O-l;return u===void 0||E>=e||E<0||d&&P>=i}function g(){var O=Rat();if(y(O))return b(O);s=setTimeout(g,h(O))}function b(O){return s=void 0,f&&n?p(O):(n=o=void 0,a)}function _(){s!==void 0&&clearTimeout(s),l=0,n=u=o=s=void 0}function w(){return s===void 0?a:b(Rat())}function T(){var O=Rat(),E=y(O);if(n=arguments,o=this,u=O,E){if(s===void 0)return m(u);if(d)return s=setTimeout(g,e),p(u)}return s===void 0&&(s=setTimeout(g,e)),a}return T.cancel=_,T.flush=w,T}function Iat(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function efo(t){return!!t&&typeof t=="object"}function tfo(t){return typeof t=="symbol"||efo(t)&&Xdo.call(t)==qdo}function Ubr(t){if(typeof t=="number")return t;if(tfo(t))return Bbr;if(Iat(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Iat(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(Bdo,"");var r=zdo.test(t);return r||Vdo.test(t)?Hdo(t.slice(2),r?2:8):Udo.test(t)?Bbr:+t}zbr.exports=Qdo});var r_r={};En(r_r,{createToolCallMarker:()=>ffo,decodeResultFromMarker:()=>$at,decodeToolCallMarkerResults:()=>cfo,ensureEncodedToolCallMarkerResults:()=>dfo,parseToolCallMarkers:()=>Lat,updateToolCallMarker:()=>pfo});function jat(t){try{return`ENC:${encodeURIComponent(t)}`}catch{return t}}function $at(t){if(typeof t!="string"||!t.startsWith("ENC:"))return t;try{return decodeURIComponent(t.slice(4))}catch{return t}}function lfo(t){return`Tool '${t}' ${ufo}`}function cfo(t){return!t||typeof t!="string"?t:t.replace(/<!--TOOL_CALL_END:([^:]+):(ENC:[\s\S]*?)-->/g,(e,r,n)=>{let o=$at(n)||n;return`<!--TOOL_CALL_END:${r}:${o}-->`})}function dfo(t){return!t||typeof t!="string"?t:t.replace(/<!--TOOL_CALL_END:([^:]+):([\s\S]*?)-->/g,(e,r,n)=>{if(n.startsWith("ENC:"))return e;let o=jat(n);return`<!--TOOL_CALL_END:${r}:${o}-->`})}function Dat(t,e=0,r=""){let n=[],o=/<errorChunk>([\s\S]*?)<\/errorChunk>/g,i=0,a;for(;(a=o.exec(t))!==null;){a.index>i&&n.push({type:"text",content:t.slice(i,a.index)});let[s,u]=a,l=e+a.index,c=r?`${r}-error-${l}`:`error-${l}`;n.push({type:"error",content:u,error:{id:c,errorContent:u,startIndex:l,endIndex:e+a.index+s.length}}),i=a.index+s.length}return i<t.length&&n.push({type:"text",content:t.slice(i)}),n.length===0&&n.push({type:"text",content:t}),n}function Lat(t,e){let r=[],n=/<!--TOOL_CALL_START:([^:]+):([^:]+):([^:]+):([^:]+):([^:]*):([^:]+)-->([\s\S]*?)<!--TOOL_CALL_END:\1:([\s\S]*?)-->/g,o=0,i;for(;(i=n.exec(t))!==null;){if(i.index>o){let _=t.slice(o,i.index);Dat(_,o,e).forEach(T=>{T.type==="text"&&T.content.trim()?r.push({type:"text",content:T.content}):T.type==="error"&&T.error&&r.push({type:"error",content:T.content,error:T.error})})}let[a,s,u,l,c,d,f,p,m]=i,y=$at(typeof m=="string"?m:""),b=(typeof y=="string"?y.length:0)>5e3?lfo(u):y??void 0;r.push({type:"toolCall",content:p,toolCall:{id:s,toolName:u,displayName:l,emoji:c,confirmationMessage:d||void 0,isExecuting:f==="true",result:b,startIndex:i.index,endIndex:i.index+a.length}}),o=i.index+a.length}if(o<t.length){let a=t.slice(o);Dat(a,o,e).forEach(u=>{u.type==="text"&&u.content.trim()?r.push({type:"text",content:u.content}):u.type==="error"&&u.error&&r.push({type:"error",content:u.content,error:u.error})})}return r.length===0&&Dat(t,0,e).forEach(s=>{s.type==="text"?r.push({type:"text",content:s.content}):s.type==="error"&&s.error&&r.push({type:"error",content:s.content,error:s.error})}),{segments:r}}function ffo(t,e,r,n,o="",i=!0,a="",s=""){let u=s&&jat(s);return`<!--TOOL_CALL_START:${t}:${e}:${r}:${n}:${o}:${i}-->${a}<!--TOOL_CALL_END:${t}:${u}-->`}function pfo(t,e,r){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(<!--TOOL_CALL_START:${n}:[^:]+:[^:]+:[^:]+:[^:]*:)true(-->[\\s\\S]*?<!--TOOL_CALL_END:${n}:)[\\s\\S]*?-->`,"g"),i=jat(r);return t.replace(o,`$1false$2${i}-->`)}var ufo,Fat=v(()=>{ufo=`Result omitted to keep the UI responsive (payload exceeded ${5e3.toLocaleString()} characters).`});var fA,o9=v(()=>{zo();BL();GT();_g();fA=class extends Ti{constructor(e){super(e);x(this,"callbacks");x(this,"tags");x(this,"metadata");x(this,"verbose");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){let n=vi(qL(r)),o=await(await Cm.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 i=await this._getRelevantDocuments(e,o);return await o?.handleRetrieverEnd(i),i}catch(i){throw await o?.handleRetrieverError(i),i}}}});var wfo,f_r,p_r,Hg,fae,i9,Sfo,m_r,pae,gEe,Hat,Bat,Cfo,h_r,g_r,Kat,Gat,y_r,xfo,mae,Uat,Tfo,Ofo,Efo,Pfo,zat,u_r,Mfo,Wat,Jat,Vat,Rfo,l_r,c_r,d_r,mEe,hEe,b_r,Ifo,__r=v(()=>{wfo="ENTRIES",f_r="KEYS",p_r="VALUES",Hg="",fae=class{constructor(e,r){let n=e._tree,o=Array.from(n.keys());this.set=e,this._type=r,this._path=o.length>0?[{node:n,keys:o}]:[]}next(){let e=this.dive();return this.backtrack(),e}dive(){if(this._path.length===0)return{done:!0,value:void 0};let{node:e,keys:r}=i9(this._path);if(i9(r)===Hg)return{done:!1,value:this.result()};let n=e.get(i9(r));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;let e=i9(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>i9(e)).filter(e=>e!==Hg).join("")}value(){return i9(this._path).node.get(Hg)}result(){switch(this._type){case p_r:return this.value();case f_r:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}},i9=t=>t[t.length-1],Sfo=(t,e,r)=>{let n=new Map;if(e===void 0)return n;let o=e.length+1,i=o+r,a=new Uint8Array(i*o).fill(r+1);for(let s=0;s<o;++s)a[s]=s;for(let s=1;s<i;++s)a[s*o]=s;return m_r(t,e,r,n,a,1,o,""),n},m_r=(t,e,r,n,o,i,a,s)=>{let u=i*a;e:for(let l of t.keys())if(l===Hg){let c=o[u-1];c<=r&&n.set(s,[t.get(l),c])}else{let c=i;for(let d=0;d<l.length;++d,++c){let f=l[d],p=a*c,m=p-a,h=o[p],y=Math.max(0,c-r-1),g=Math.min(a-1,c+r);for(let b=y;b<g;++b){let _=f!==e[b],w=o[m+b]+ +_,T=o[m+b+1]+1,O=o[p+b]+1,E=o[p+b+1]=Math.min(w,T,O);E<h&&(h=E)}if(h>r)continue e}m_r(t.get(l),e,r,n,o,c,a,s+l)}},pae=class t{constructor(e=new Map,r=""){this._size=void 0,this._tree=e,this._prefix=r}atPrefix(e){if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");let[r,n]=gEe(this._tree,e.slice(this._prefix.length));if(r===void 0){let[o,i]=Kat(n);for(let a of o.keys())if(a!==Hg&&a.startsWith(i)){let s=new Map;return s.set(a.slice(i.length),o.get(a)),new t(s,e)}}return new t(r,e)}clear(){this._size=void 0,this._tree.clear()}delete(e){return this._size=void 0,Cfo(this._tree,e)}entries(){return new fae(this,wfo)}forEach(e){for(let[r,n]of this)e(r,n,this)}fuzzyGet(e,r){return Sfo(this._tree,e,r)}get(e){let r=Hat(this._tree,e);return r!==void 0?r.get(Hg):void 0}has(e){let r=Hat(this._tree,e);return r!==void 0&&r.has(Hg)}keys(){return new fae(this,f_r)}set(e,r){if(typeof e!="string")throw new Error("key must be a string");return this._size=void 0,Bat(this._tree,e).set(Hg,r),this}get size(){if(this._size)return this._size;this._size=0;let e=this.entries();for(;!e.next().done;)this._size+=1;return this._size}update(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;let n=Bat(this._tree,e);return n.set(Hg,r(n.get(Hg))),this}fetch(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;let n=Bat(this._tree,e),o=n.get(Hg);return o===void 0&&n.set(Hg,o=r()),o}values(){return new fae(this,p_r)}[Symbol.iterator](){return this.entries()}static from(e){let r=new t;for(let[n,o]of e)r.set(n,o);return r}static fromObject(e){return t.from(Object.entries(e))}},gEe=(t,e,r=[])=>{if(e.length===0||t==null)return[t,r];for(let n of t.keys())if(n!==Hg&&e.startsWith(n))return r.push([t,n]),gEe(t.get(n),e.slice(n.length),r);return r.push([t,e]),gEe(void 0,"",r)},Hat=(t,e)=>{if(e.length===0||t==null)return t;for(let r of t.keys())if(r!==Hg&&e.startsWith(r))return Hat(t.get(r),e.slice(r.length))},Bat=(t,e)=>{let r=e.length;e:for(let n=0;t&&n<r;){for(let i of t.keys())if(i!==Hg&&e[n]===i[0]){let a=Math.min(r-n,i.length),s=1;for(;s<a&&e[n+s]===i[s];)++s;let u=t.get(i);if(s===i.length)t=u;else{let l=new Map;l.set(i.slice(s),u),t.set(e.slice(n,n+s),l),t.delete(i),t=l}n+=s;continue e}let o=new Map;return t.set(e.slice(n),o),o}return t},Cfo=(t,e)=>{let[r,n]=gEe(t,e);if(r!==void 0){if(r.delete(Hg),r.size===0)h_r(n);else if(r.size===1){let[o,i]=r.entries().next().value;g_r(n,o,i)}}},h_r=t=>{if(t.length===0)return;let[e,r]=Kat(t);if(e.delete(r),e.size===0)h_r(t.slice(0,-1));else if(e.size===1){let[n,o]=e.entries().next().value;n!==Hg&&g_r(t.slice(0,-1),n,o)}},g_r=(t,e,r)=>{if(t.length===0)return;let[n,o]=Kat(t);n.set(o+e,r),n.delete(o)},Kat=t=>t[t.length-1],Gat="or",y_r="and",xfo="and_not",mae=class t{constructor(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');let r=e.autoVacuum==null||e.autoVacuum===!0?Vat:e.autoVacuum;this._options={...zat,...e,autoVacuum:r,searchOptions:{...u_r,...e.searchOptions||{}},autoSuggestOptions:{...Mfo,...e.autoSuggestOptions||{}}},this._index=new pae,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=Jat,this.addFields(this._options.fields)}add(e){let{extractField:r,stringifyField:n,tokenize:o,processTerm:i,fields:a,idField:s}=this._options,u=r(e,s);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${s}"`);if(this._idToShortId.has(u))throw new Error(`MiniSearch: duplicate ID ${u}`);let l=this.addDocumentId(u);this.saveStoredFields(l,e);for(let c of a){let d=r(e,c);if(d==null)continue;let f=o(n(d,c),c),p=this._fieldIds[c],m=new Set(f).size;this.addFieldLength(l,p,this._documentCount-1,m);for(let h of f){let y=i(h,c);if(Array.isArray(y))for(let g of y)this.addTerm(p,l,g);else y&&this.addTerm(p,l,y)}}}addAll(e){for(let r of e)this.add(r)}addAllAsync(e,r={}){let{chunkSize:n=10}=r,o={chunk:[],promise:Promise.resolve()},{chunk:i,promise:a}=e.reduce(({chunk:s,promise:u},l,c)=>(s.push(l),(c+1)%n===0?{chunk:[],promise:u.then(()=>new Promise(d=>setTimeout(d,0))).then(()=>this.addAll(s))}:{chunk:s,promise:u}),o);return a.then(()=>this.addAll(i))}remove(e){let{tokenize:r,processTerm:n,extractField:o,stringifyField:i,fields:a,idField:s}=this._options,u=o(e,s);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${s}"`);let l=this._idToShortId.get(u);if(l==null)throw new Error(`MiniSearch: cannot remove document with ID ${u}: it is not in the index`);for(let c of a){let d=o(e,c);if(d==null)continue;let f=r(i(d,c),c),p=this._fieldIds[c],m=new Set(f).size;this.removeFieldLength(l,p,this._documentCount,m);for(let h of f){let y=n(h,c);if(Array.isArray(y))for(let g of y)this.removeTerm(p,l,g);else y&&this.removeTerm(p,l,y)}}this._storedFields.delete(l),this._documentIds.delete(l),this._idToShortId.delete(u),this._fieldLength.delete(l),this._documentCount-=1}removeAll(e){if(e)for(let r of e)this.remove(r);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new pae,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(e){let r=this._idToShortId.get(e);if(r==null)throw new Error(`MiniSearch: cannot discard document with ID ${e}: it is not in the index`);this._idToShortId.delete(e),this._documentIds.delete(r),this._storedFields.delete(r),(this._fieldLength.get(r)||[]).forEach((n,o)=>{this.removeFieldLength(r,o,this._documentCount,n)}),this._fieldLength.delete(r),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;let{minDirtFactor:e,minDirtCount:r,batchSize:n,batchWait:o}=this._options.autoVacuum;this.conditionalVacuum({batchSize:n,batchWait:o},{minDirtCount:r,minDirtFactor:e})}discardAll(e){let r=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(let n of e)this.discard(n)}finally{this._options.autoVacuum=r}this.maybeAutoVacuum()}replace(e){let{idField:r,extractField:n}=this._options,o=n(e,r);this.discard(o),this.add(e)}vacuum(e={}){return this.conditionalVacuum(e)}conditionalVacuum(e,r){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&r,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{let n=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=Jat,this.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(r)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)}async performVacuuming(e,r){let n=this._dirtCount;if(this.vacuumConditionsMet(r)){let o=e.batchSize||Wat.batchSize,i=e.batchWait||Wat.batchWait,a=1;for(let[s,u]of this._index){for(let[l,c]of u)for(let[d]of c)this._documentIds.has(d)||(c.size<=1?u.delete(l):c.delete(d));this._index.get(s).size===0&&this._index.delete(s),a%o===0&&await new Promise(l=>setTimeout(l,i)),a+=1}this._dirtCount-=n}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(e){if(e==null)return!0;let{minDirtCount:r,minDirtFactor:n}=e;return r=r||Vat.minDirtCount,n=n||Vat.minDirtFactor,this.dirtCount>=r&&this.dirtFactor>=n}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(e){return this._idToShortId.has(e)}getStoredFields(e){let r=this._idToShortId.get(e);if(r!=null)return this._storedFields.get(r)}search(e,r={}){let{searchOptions:n}=this._options,o={...n,...r},i=this.executeQuery(e,r),a=[];for(let[s,{score:u,terms:l,match:c}]of i){let d=l.length||1,f={id:this._documentIds.get(s),score:u*d,terms:Object.keys(c),queryTerms:l,match:c};Object.assign(f,this._storedFields.get(s)),(o.filter==null||o.filter(f))&&a.push(f)}return e===t.wildcard&&o.boostDocument==null||a.sort(c_r),a}autoSuggest(e,r={}){r={...this._options.autoSuggestOptions,...r};let n=new Map;for(let{score:i,terms:a}of this.search(e,r)){let s=a.join(" "),u=n.get(s);u!=null?(u.score+=i,u.count+=1):n.set(s,{score:i,terms:a,count:1})}let o=[];for(let[i,{score:a,terms:s,count:u}]of n)o.push({suggestion:i,terms:s,score:a/u});return o.sort(c_r),o}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(e,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),r)}static async loadJSONAsync(e,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(e),r)}static getDefault(e){if(zat.hasOwnProperty(e))return Uat(zat,e);throw new Error(`MiniSearch: unknown option "${e}"`)}static loadJS(e,r){let{index:n,documentIds:o,fieldLength:i,storedFields:a,serializationVersion:s}=e,u=this.instantiateMiniSearch(e,r);u._documentIds=mEe(o),u._fieldLength=mEe(i),u._storedFields=mEe(a);for(let[l,c]of u._documentIds)u._idToShortId.set(c,l);for(let[l,c]of n){let d=new Map;for(let f of Object.keys(c)){let p=c[f];s===1&&(p=p.ds),d.set(parseInt(f,10),mEe(p))}u._index.set(l,d)}return u}static async loadJSAsync(e,r){let{index:n,documentIds:o,fieldLength:i,storedFields:a,serializationVersion:s}=e,u=this.instantiateMiniSearch(e,r);u._documentIds=await hEe(o),u._fieldLength=await hEe(i),u._storedFields=await hEe(a);for(let[c,d]of u._documentIds)u._idToShortId.set(d,c);let l=0;for(let[c,d]of n){let f=new Map;for(let p of Object.keys(d)){let m=d[p];s===1&&(m=m.ds),f.set(parseInt(p,10),await hEe(m))}++l%1e3===0&&await b_r(0),u._index.set(c,f)}return u}static instantiateMiniSearch(e,r){let{documentCount:n,nextId:o,fieldIds:i,averageFieldLength:a,dirtCount:s,serializationVersion:u}=e;if(u!==1&&u!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");let l=new t(r);return l._documentCount=n,l._nextId=o,l._idToShortId=new Map,l._fieldIds=i,l._avgFieldLength=a,l._dirtCount=s||0,l._index=new pae,l}executeQuery(e,r={}){if(e===t.wildcard)return this.executeWildcardQuery(r);if(typeof e!="string"){let f={...r,...e,queries:void 0},p=e.queries.map(m=>this.executeQuery(m,f));return this.combineResults(p,f.combineWith)}let{tokenize:n,processTerm:o,searchOptions:i}=this._options,a={tokenize:n,processTerm:o,...i,...r},{tokenize:s,processTerm:u}=a,d=s(e).flatMap(f=>u(f)).filter(f=>!!f).map(Pfo(a)).map(f=>this.executeQuerySpec(f,a));return this.combineResults(d,a.combineWith)}executeQuerySpec(e,r){let n={...this._options.searchOptions,...r},o=(n.fields||this._options.fields).reduce((h,y)=>({...h,[y]:Uat(n.boost,y)||1}),{}),{boostDocument:i,weights:a,maxFuzzy:s,bm25:u}=n,{fuzzy:l,prefix:c}={...u_r.weights,...a},d=this._index.get(e.term),f=this.termResults(e.term,e.term,1,e.termBoost,d,o,i,u),p,m;if(e.prefix&&(p=this._index.atPrefix(e.term)),e.fuzzy){let h=e.fuzzy===!0?.2:e.fuzzy,y=h<1?Math.min(s,Math.round(e.term.length*h)):h;y&&(m=this._index.fuzzyGet(e.term,y))}if(p)for(let[h,y]of p){let g=h.length-e.term.length;if(!g)continue;m?.delete(h);let b=c*h.length/(h.length+.3*g);this.termResults(e.term,h,b,e.termBoost,y,o,i,u,f)}if(m)for(let h of m.keys()){let[y,g]=m.get(h);if(!g)continue;let b=l*h.length/(h.length+g);this.termResults(e.term,h,b,e.termBoost,y,o,i,u,f)}return f}executeWildcardQuery(e){let r=new Map,n={...this._options.searchOptions,...e};for(let[o,i]of this._documentIds){let a=n.boostDocument?n.boostDocument(i,"",this._storedFields.get(o)):1;r.set(o,{score:a,terms:[],match:{}})}return r}combineResults(e,r=Gat){if(e.length===0)return new Map;let n=r.toLowerCase(),o=Tfo[n];if(!o)throw new Error(`Invalid combination operator: ${r}`);return e.reduce(o)||new Map}toJSON(){let e=[];for(let[r,n]of this._index){let o={};for(let[i,a]of n)o[i]=Object.fromEntries(a);e.push([r,o])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:e,serializationVersion:2}}termResults(e,r,n,o,i,a,s,u,l=new Map){if(i==null)return l;for(let c of Object.keys(a)){let d=a[c],f=this._fieldIds[c],p=i.get(f);if(p==null)continue;let m=p.size,h=this._avgFieldLength[f];for(let y of p.keys()){if(!this._documentIds.has(y)){this.removeTerm(f,y,r),m-=1;continue}let g=s?s(this._documentIds.get(y),r,this._storedFields.get(y)):1;if(!g)continue;let b=p.get(y),_=this._fieldLength.get(y)[f],w=Efo(b,m,this._documentCount,_,h,u),T=n*o*d*g*w,O=l.get(y);if(O){O.score+=T,Rfo(O.terms,e);let E=Uat(O.match,r);E?E.push(c):O.match[r]=[c]}else l.set(y,{score:T,terms:[e],match:{[r]:[c]}})}}return l}addTerm(e,r,n){let o=this._index.fetch(n,d_r),i=o.get(e);if(i==null)i=new Map,i.set(r,1),o.set(e,i);else{let a=i.get(r);i.set(r,(a||0)+1)}}removeTerm(e,r,n){if(!this._index.has(n)){this.warnDocumentChanged(r,e,n);return}let o=this._index.fetch(n,d_r),i=o.get(e);i==null||i.get(r)==null?this.warnDocumentChanged(r,e,n):i.get(r)<=1?i.size<=1?o.delete(e):i.delete(r):i.set(r,i.get(r)-1),this._index.get(n).size===0&&this._index.delete(n)}warnDocumentChanged(e,r,n){for(let o of Object.keys(this._fieldIds))if(this._fieldIds[o]===r){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(e)} has changed before removal: term "${n}" was not present in field "${o}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(e){let r=this._nextId;return this._idToShortId.set(e,r),this._documentIds.set(r,e),this._documentCount+=1,this._nextId+=1,r}addFields(e){for(let r=0;r<e.length;r++)this._fieldIds[e[r]]=r}addFieldLength(e,r,n,o){let i=this._fieldLength.get(e);i==null&&this._fieldLength.set(e,i=[]),i[r]=o;let s=(this._avgFieldLength[r]||0)*n+o;this._avgFieldLength[r]=s/(n+1)}removeFieldLength(e,r,n,o){if(n===1){this._avgFieldLength[r]=0;return}let i=this._avgFieldLength[r]*n-o;this._avgFieldLength[r]=i/(n-1)}saveStoredFields(e,r){let{storeFields:n,extractField:o}=this._options;if(n==null||n.length===0)return;let i=this._storedFields.get(e);i==null&&this._storedFields.set(e,i={});for(let a of n){let s=o(r,a);s!==void 0&&(i[a]=s)}}};mae.wildcard=Symbol("*");Uat=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0,Tfo={[Gat]:(t,e)=>{for(let r of e.keys()){let n=t.get(r);if(n==null)t.set(r,e.get(r));else{let{score:o,terms:i,match:a}=e.get(r);n.score=n.score+o,n.match=Object.assign(n.match,a),l_r(n.terms,i)}}return t},[y_r]:(t,e)=>{let r=new Map;for(let n of e.keys()){let o=t.get(n);if(o==null)continue;let{score:i,terms:a,match:s}=e.get(n);l_r(o.terms,a),r.set(n,{score:o.score+i,terms:o.terms,match:Object.assign(o.match,s)})}return r},[xfo]:(t,e)=>{for(let r of e.keys())t.delete(r);return t}},Ofo={k:1.2,b:.7,d:.5},Efo=(t,e,r,n,o,i)=>{let{k:a,b:s,d:u}=i;return Math.log(1+(r-e+.5)/(e+.5))*(u+t*(a+1)/(t+a*(1-s+s*n/o)))},Pfo=t=>(e,r,n)=>{let o=typeof t.fuzzy=="function"?t.fuzzy(e,r,n):t.fuzzy||!1,i=typeof t.prefix=="function"?t.prefix(e,r,n):t.prefix===!0,a=typeof t.boostTerm=="function"?t.boostTerm(e,r,n):1;return{term:e,fuzzy:o,prefix:i,termBoost:a}},zat={idField:"id",extractField:(t,e)=>t[e],stringifyField:(t,e)=>t.toString(),tokenize:t=>t.split(Ifo),processTerm:t=>t.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(t,e)=>{typeof console?.[t]=="function"&&console[t](e)},autoVacuum:!0},u_r={combineWith:Gat,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:Ofo},Mfo={combineWith:y_r,prefix:(t,e,r)=>e===r.length-1},Wat={batchSize:1e3,batchWait:10},Jat={minDirtFactor:.1,minDirtCount:20},Vat={...Wat,...Jat},Rfo=(t,e)=>{t.includes(e)||t.push(e)},l_r=(t,e)=>{for(let r of e)t.includes(r)||t.push(r)},c_r=({score:t},{score:e})=>e-t,d_r=()=>new Map,mEe=t=>{let e=new Map;for(let r of Object.keys(t))e.set(parseInt(r,10),t[r]);return e},hEe=async t=>{let e=new Map,r=0;for(let n of Object.keys(t))e.set(parseInt(n,10),t[n]),++r%1e3===0&&await b_r(0);return e},b_r=t=>new Promise(e=>setTimeout(e,t)),Ifo=/[\n\r\p{Z}\p{P}]+/u});var bEe,zc,yEe,v_r=v(()=>{Xe();gr();__r();bEe=require("obsidian");oae();vat();zc=class zc{constructor(e,r){this.app=e;this.index=null;this.indexedChunks=new Set;this.memoryManager=new aH,this.chunkManager=r||lq(e)}createIndex(){return new mae({fields:["title","heading","path","tags","body"],storeFields:["id","notePath","title","heading","chunkIndex"],tokenize:this.tokenizeMixed.bind(this),searchOptions:{boost:{title:zc.FIELD_WEIGHTS.title,heading:zc.FIELD_WEIGHTS.heading,path:zc.FIELD_WEIGHTS.path,tags:zc.FIELD_WEIGHTS.tags,body:zc.FIELD_WEIGHTS.body},prefix:!0,fuzzy:!1,combineWith:"OR"}})}tokenizeMixed(e){if(!e)return[];let r=new Set,n=e.toLowerCase(),o=n,i=null;try{i=n.match(/#[\p{L}\p{N}_/-]+/gu)}catch{i=n.match(/#[a-z0-9_/-]+/g)}if(i)for(let l of i){r.add(l);let c=l.slice(1);if(!c)continue;r.add(c);let d=c.split("/").filter(p=>p.length>0);if(d.length>0){let p="";for(let m of d)p=p?`${p}/${m}`:m,r.add(p),r.add(`#${p}`),r.add(m)}let f=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");o=o.replace(new RegExp(f,"gu")," ")}(o.match(/[a-z0-9_]+/g)||[]).forEach(l=>r.add(l));let s=/[\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]+/g,u=e.match(s)||[];for(let l of u){l.length===1&&r.add(l);for(let c=0;c<l.length-1;c++)r.add(l.slice(c,c+2))}return Array.from(r)}async buildFromCandidates(e){F(`FullTextEngine: [CHUNKS] Starting with ${e.length} candidate notes`),this.indexedChunks.clear(),this.memoryManager.reset(),await new Promise(l=>setTimeout(l,0));let r=Date.now();this.index=this.createIndex();let n=Date.now()-r;F(`FullTextEngine: MiniSearch index created in ${n}ms`);let o={maxChars:jge,overlap:0,maxBytesTotal:this.memoryManager.getMaxBytes()*zc.CHUNK_MEMORY_PERCENTAGE},i=await this.chunkManager.getChunks(e,o);if(i.length===0)return F("FullTextEngine: No chunks generated"),0;F(`FullTextEngine: Generated ${i.length} chunks from ${e.length} notes`);let a=0,s=zc.BATCH_SIZE,u=new Map;for(let l=0;l<i.length;l++){let c=i[l],d=aH.getByteSize(c.content);if(!this.memoryManager.canAddContent(d)){F(`FullTextEngine: Memory limit reached at ${a} chunks`);break}let f=c.notePath.replace(/\.md$/,"").split("/").join(" "),p=u.get(c.notePath);if(!p){let h=this.app.vault.getAbstractFileByPath(c.notePath);if(h instanceof bEe.TFile){let y=this.app.metadataCache.getFileCache(h),g=y?.frontmatter??{},b=y?(0,bEe.getAllTags)(y)??[]:[],_=this.extractFrontmatterTags(g),w=this.normalizeTagList([...b,..._]),T=this.app.metadataCache.resolvedLinks[h.path]??{},O=this.app.metadataCache.getBacklinksForFile(h)?.data??{},E=Object.keys(T),P=Object.keys(O),R=[...E,...P],I=this.extractPropertyValues(g);p={tags:w,links:R,props:I},u.set(c.notePath,p)}else p={tags:[],links:[],props:[]}}let m=[c.content,...p.props].join(" ");this.index.add({id:c.id,title:c.title,heading:c.heading,path:f,body:m,tags:p.tags.join(" "),notePath:c.notePath,chunkIndex:c.chunkIndex}),this.memoryManager.addBytes(d),this.indexedChunks.add(c.id),a++,l>0&&l%s===0&&await new Promise(h=>setTimeout(h,0))}return F(`FullTextEngine: [CHUNKS] Indexed ${a}/${i.length} chunks (${this.memoryManager.getUsagePercent()}% memory)`),a}extractPropertyValues(e){let r=[];if(e&&typeof e=="object")for(let n of Object.values(e))this.extractPrimitiveValues(n,r,zc.MAX_EXTRACTION_DEPTH);return r}extractFrontmatterTags(e){if(!e||typeof e!="object")return[];let r=[],n=["tags","tag"],o=i=>{let a=i.trim();a.length>0&&r.push(a)};for(let i of n){let a=e[i];if(a)if(Array.isArray(a))for(let s of a)typeof s=="string"&&o(s);else typeof a=="string"&&a.split(/[,\s]+/g).map(s=>s.trim()).filter(s=>s.length>0).forEach(o)}return r}normalizeTagList(e){let r=new Set;for(let n of e){if(typeof n!="string")continue;let o=n.trim();if(o.length===0)continue;let i=o.replace(/^#+/,"");if(i.length===0)continue;let a=i.toLowerCase();r.add(`#${a}`),r.add(a);let s=a.split("/").filter(u=>u.length>0);if(s.length>1){let u="";for(let l of s)u=u?`${u}/${l}`:l,r.add(`#${u}`),r.add(u),r.add(l)}else s.length===1&&(r.add(`#${s[0]}`),r.add(s[0]))}return Array.from(r)}extractPrimitiveValues(e,r,n){if(!(n<=0||e==null))if(typeof e=="string"){let o=e.trim();o&&r.push(o)}else typeof e=="number"||typeof e=="boolean"?r.push(String(e)):e instanceof Date?r.push(e.toISOString()):Array.isArray(e)&&e.slice(0,zc.MAX_ARRAY_ITEMS).forEach(o=>{if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){let i=typeof o=="string"?o.trim():String(o);i&&r.push(i)}})}search(e,r=30,n=[],o){if(!this.index)return[];let i=n.length>0?n.join(" "):o||e[0]||"";if(!i.trim())return[];let a={boost:{title:zc.FIELD_WEIGHTS.title,heading:zc.FIELD_WEIGHTS.heading,path:zc.FIELD_WEIGHTS.path,tags:zc.FIELD_WEIGHTS.tags,body:zc.FIELD_WEIGHTS.body},prefix:!0,fuzzy:!1,combineWith:"OR"};try{let s=this.index.search(i,a);return F(`FullText: Search found ${s.length} results for "${i.substring(0,50)}..."`),s.slice(0,r).map(u=>({id:u.id,score:u.score,engine:"fulltext",explanation:{lexicalMatches:this.extractLexicalMatches(u),baseScore:u.score,finalScore:u.score}}))}catch(s){return Ce(`FullText: Search failed for "${i}": ${s}`),[]}}extractLexicalMatches(e){let r=[];if(e.match)for(let[n,o]of Object.entries(e.match))for(let i of o)r.push({field:n,query:i,weight:this.getFieldWeight(n)});return r}getFieldWeight(e){return zc.FIELD_WEIGHTS[e]||1}clear(){try{this.index=null,this.indexedChunks.clear(),this.memoryManager.reset(),F("FullTextEngine: Cleanup completed successfully")}catch(e){Ce(`FullTextEngine: Cleanup error: ${e}`)}}getStats(){return{documentsIndexed:this.indexedChunks.size,memoryUsed:this.memoryManager.getBytesUsed(),memoryPercent:this.memoryManager.getUsagePercent()}}};zc.BATCH_SIZE=10,zc.CHUNK_MEMORY_PERCENTAGE=.35,zc.MAX_ARRAY_ITEMS=10,zc.MAX_EXTRACTION_DEPTH=2,zc.FIELD_WEIGHTS={title:5,heading:2.5,headings:1.5,path:1.5,tags:4,props:1.5,links:1.5,body:1};yEe=zc});function a9(t){if(!t)return[];let e=null;try{e=t.match(/#[\p{L}\p{N}_/-]+/gu)}catch{e=t.match(/#[a-zA-Z0-9_/-]+/g)}if(!e)return[];let r=new Set;for(let n of e){let o=n.trim();o.length<=1||r.add(o.toLowerCase())}return Array.from(r)}var Xat=v(()=>{});var vEe,_Ee,w_r=v(()=>{gr();OS();Xe();Xat();Dt();vEe=class vEe{constructor(e={}){this.options=e;this.cache=new Map;this.config={maxVariants:e.maxVariants??2,timeout:e.timeout??Lge,cacheSize:e.cacheSize??100,minTermLength:2}}async expand(e){if(!e?.trim())return{queries:[],salientTerms:[],originalQuery:"",expandedQueries:[]};let r=this.cache.get(e);if(r)return this.cache.delete(e),this.cache.set(e,r),F(`QueryExpander: Using cached expansion for "${e}"`),r;try{let n=await this.expandWithTimeout(e);return this.cacheResult(e,n),n}catch(n){return Ce(`QueryExpander: Failed to expand query "${e}":`,n),this.fallbackExpansion(e)}}async expandWithTimeout(e){try{return await ONt(r=>this.expandWithLLM(e,r),this.config.timeout,"Query expansion")}catch(r){if(r instanceof rte)return F(`QueryExpander: Timeout reached for "${e}"`),this.fallbackExpansion(e);throw r}}async expandWithLLM(e,r){try{if(!this.options.getChatModel)return F("QueryExpander: No chat model getter provided"),this.fallbackExpansion(e);let n=await this.options.getChatModel();if(!n)return F("QueryExpander: No chat model available"),this.fallbackExpansion(e);let o=vEe.PROMPT_TEMPLATE.replace("{count}",this.config.maxVariants.toString()).replace("{query}",e),i=await Ib(async()=>await n.invoke(o,r?{signal:r}:void 0));if(!i)return this.fallbackExpansion(e);let a=this.extractContent(i);if(!a)return this.fallbackExpansion(e);let s=this.parseXMLResponse(a,e);return F(`QueryExpander: Expanded "${e}" to ${s.queries.length} queries and ${s.salientTerms.length} terms`),s}catch(n){return ie("QueryExpander: LLM expansion failed:",n),this.fallbackExpansion(e)}}extractContent(e){return typeof e=="string"?e:String(e?.content??e?.text??"").trim()||null}extractSalientTermsFromOriginal(e){let r=this.extractTermsFromQueries([e]),n=a9(e);return this.combineBaseAndTagTerms(r,n,e)}parseXMLResponse(e,r){let n=[r],o=new Set,i=/<query>(.*?)<\/query>/g,a;for(;(a=i.exec(e))!==null;){let f=a[1]?.trim();f&&f!==r&&n.length<=this.config.maxVariants&&n.push(f)}let s=e.match(/<salient>([\s\S]*?)<\/salient>/);if(s){let f=/<term>(.*?)<\/term>/g,p;for(;(p=f.exec(s[1]))!==null;){let m=p[1]?.trim().toLowerCase();m&&this.isValidTerm(m)&&o.add(m)}}if(!(n.length>1||o.size>0||/<term>/.test(e)))return this.fallbackExpansion(r);let l=a9(r),c=o.size>0?Array.from(new Set([...o,...l])):this.extractSalientTermsFromOriginal(r),d=n.slice(1);return{queries:n.slice(0,this.config.maxVariants+1),salientTerms:c,originalQuery:r,expandedQueries:d.slice(0,this.config.maxVariants)}}fallbackExpansion(e){let r=this.extractTermsFromQueries([e]),n=a9(e),o=this.combineBaseAndTagTerms(r,n,e);return{queries:[e],salientTerms:o,originalQuery:e,expandedQueries:[]}}extractTermsFromQueries(e){let r=new Set;for(let n of e){let o=n.toLowerCase().replace(/[^\w\s-]/g," ").split(/\s+/);for(let i of o)this.isValidTerm(i)&&(r.add(i),i.includes("-")&&i.split("-").forEach(a=>{this.isValidTerm(a)&&r.add(a)}))}return Array.from(r)}isValidTerm(e){if(e.length<this.config.minTermLength)return!1;if(e.startsWith("#"))try{return/^#[\p{L}\p{N}_/-]+$/u.test(e)}catch{return/^#[A-Za-z0-9_/-]+$/.test(e)}try{return/^[\p{L}\p{N}_-]+$/u.test(e)}catch{return/^[A-Za-z0-9_-]+$/.test(e)}}combineBaseAndTagTerms(e,r,n){let o=new Set([...e,...r]);if(r.length===0)return Array.from(o);let i=this.collectStandaloneTerms(n);for(let a of r){let s=a.slice(1);s.length>0&&!i.has(s)&&o.delete(s)}return Array.from(o)}collectStandaloneTerms(e){let r=new Set;if(!e)return r;let n=e.toLowerCase(),o=this.findTagRanges(n),i=[/[\p{L}\p{N}_-]+/gu,/[a-z0-9_-]+/g];for(let a of i)try{for(let s of n.matchAll(a)){if(s.index===void 0)continue;let u=s.index,l=u+s[0].length;if(o.some(({start:f,end:p})=>u>=f&&l<=p))continue;let d=s[0];this.isValidTerm(d)&&!d.startsWith("#")&&(r.add(d),d.includes("-")&&d.split("-").forEach(f=>{this.isValidTerm(f)&&!f.startsWith("#")&&r.add(f)}))}break}catch{continue}return r}findTagRanges(e){let r=[],n=[/#[\p{L}\p{N}_/-]+/gu,/#[a-z0-9_/-]+/g];for(let o of n)try{for(let i of e.matchAll(o))i.index!==void 0&&r.push({start:i.index,end:i.index+i[0].length});break}catch{continue}return r}cacheResult(e,r){if(this.cache.size>=this.config.cacheSize){let n=this.cache.keys().next().value;n&&this.cache.delete(n)}this.cache.set(e,r)}clearCache(){this.cache.clear(),F("QueryExpander: Cache cleared")}getCacheSize(){return this.cache.size}};vEe.PROMPT_TEMPLATE=`Analyze this search query and provide:
1. SALIENT TERMS from the original query (for ranking)
2. Alternative queries and related terms (for finding more results)

Query: "{query}"

Instructions:

SALIENT TERMS (for ranking - ONLY from original query):
- Extract meaningful words FROM THE ORIGINAL QUERY ONLY
- Include: nouns, proper nouns, technical terms, domain concepts
- Exclude: action verbs (find, search, get), pronouns (my, your), articles (the, a), prepositions (in, on, for), conjunctions (and, or)
- These terms determine search ranking - must be from original query

ALTERNATIVE QUERIES (for recall - specific alternative phrasings):
- Alternative phrasings of the query (specific enough to be useful for search)

Example: "find my piano notes"
- Salient (from original): piano, notes
- Queries: "piano lesson notes", "piano practice sheets"

Example: "\u67E5\u627E\u6211\u7684\u5B66\u4E60\u7B14\u8BB0"
- Salient (from original): \u5B66\u4E60, \u7B14\u8BB0
- Queries: "\u4E2A\u4EBA\u7B14\u8BB0\u6587\u6863"

Format:
<salient>
<term>word_from_original_query</term>
</salient>
<queries>
<query>alternative query</query>
</queries>`;_Ee=vEe});var s9,wEe,S_r=v(()=>{Xe();Wb();s9=class s9{constructor(e){this.app=e}async batchCachedReadGrep(e,r){let{inclusions:n,exclusions:o}=Zl(),a=this.app.vault.getMarkdownFiles().filter(h=>fu(h,n,o)),s=s9.CONFIG.BATCH_SIZE,u=e.map(h=>h.toLowerCase()).filter(h=>this.isGrepWorthy(h)),l=[],c=s9.CONFIG.YIELD_INTERVAL;for(let h=0;h<a.length;h++){let y=a[h],g=y.path.toLowerCase(),b=0;for(let _ of u)g.includes(_)&&b++;b>0&&l.push({path:y.path,matchCount:b}),h>0&&h%c===0&&await new Promise(_=>setTimeout(_,0))}l.sort((h,y)=>y.matchCount-h.matchCount);let d=new Set(l.map(h=>h.path)),f=Math.max(0,r-d.size),p=new Set;if(f>0)for(let h=0;h<a.length&&p.size<f;h+=s){let y=a.slice(h,h+s);await Promise.all(y.map(async g=>{if(!(p.size>=f)&&!d.has(g.path))try{let _=(await this.app.vault.cachedRead(g)).toLowerCase();for(let w of u)if(_.includes(w)){p.add(g.path);break}}catch(b){F(`GrepScanner: Skipping file ${g.path}: ${b}`)}})),h%s9.CONFIG.YIELD_INTERVAL===0&&await new Promise(g=>setTimeout(g,0))}let m=[...d,...p].slice(0,r);if(m.length>0){let h=Math.min(d.size,r),y=m.length-h;F(`  Grep: ${m.length} files match (${h} path, ${y} content) [${e.slice(0,3).join(", ")}${e.length>3?"...":""}]`)}return m}async grep(e,r=200){return this.batchCachedReadGrep([e],r)}isGrepWorthy(e){return!(!e||e.length<=1)}async fileContainsAny(e,r){try{let n=e.path.toLowerCase(),o=0;for(let s of r)n.includes(s.toLowerCase())&&o++;if(o>0)return!0;let a=(await this.app.vault.cachedRead(e)).toLowerCase();return r.some(s=>a.includes(s.toLowerCase()))}catch{return!1}}};s9.CONFIG={BATCH_SIZE:30,YIELD_INTERVAL:100};wEe=s9});function Ax(t){let e=t.lastIndexOf("#");return e===-1?t:t.substring(0,e)}var SEe=v(()=>{});var Afo,CEe,C_r=v(()=>{Xe();SEe();Afo={enabled:!0,minDocsForBoost:2,maxBoostFactor:1.15,minRelevanceRatio:.4},CEe=class{constructor(e){this.config=Afo;this.app=e||null}setConfig(e){this.config={...this.config,...e}}applyBoosts(e){if(!this.config.enabled||e.length===0)return e;let r=this.calculateFolderStats(e);return this.logBoostedFolders(r),e.map(n=>{let o=Ax(n.id),i=this.extractFolder(o),a=r.get(i);if(a){let s=n.score*a.boostFactor;return{...n,score:s,explanation:n.explanation?{...n.explanation,folderBoost:{folder:a.folderPath,documentCount:a.documentCount,totalDocsInFolder:a.totalDocsInFolder,relevanceRatio:a.relevanceRatio,boostFactor:a.boostFactor},finalScore:s}:void 0}}return n})}calculateFolderStats(e){let r=new Map;for(let a of e){let s=Ax(a.id),u=this.extractFolder(s);r.has(u)||r.set(u,new Set),r.get(u).add(s)}let n=new Map;for(let[a,s]of r.entries())n.set(a,s.size);let o=this.getTotalDocsPerFolder(),i=new Map;for(let[a,s]of n.entries()){let u=o.get(a)||s,l=s/u;if(s>=this.config.minDocsForBoost&&l>=this.config.minRelevanceRatio){let d=1+(1+Math.log2(s+1)-1)*Math.sqrt(l),f=Math.min(d,this.config.maxBoostFactor);i.set(a,{folderPath:a,documentCount:s,totalDocsInFolder:u,relevanceRatio:l,boostFactor:f})}}return i}getTotalDocsPerFolder(){let e=new Map;if(!this.app)return e;let r=this.app.vault.getMarkdownFiles();for(let n of r){let o=this.extractFolder(n.path);e.set(o,(e.get(o)||0)+1)}return e}extractFolder(e){return e.substring(0,e.lastIndexOf("/"))||""}logBoostedFolders(e){let r=Array.from(e.values()).sort((n,o)=>o.relevanceRatio-n.relevanceRatio);r.length>0&&(F(`Folder boost: Boosting ${r.length} folders with significant relevance`),r.slice(0,5).forEach(n=>{let o=(n.relevanceRatio*100).toFixed(1);F(`  ${n.folderPath||"(root)"}: ${n.documentCount}/${n.totalDocsInFolder} docs (${o}% relevant, ${n.boostFactor.toFixed(2)}x boost)`)}))}getFolderBoosts(e){return this.config.enabled?this.calculateFolderStats(e):new Map}}});var Nfo,xEe,x_r=v(()=>{Xe();SEe();Nfo={enabled:!0,maxCandidates:10,backlinkWeight:1,coCitationWeight:.5,sharedTagWeight:.3,boostStrength:.1,maxBoostMultiplier:1.2},xEe=class{constructor(e,r={}){this.metadataCache=e.metadataCache,this.config={...Nfo,...r}}applyBoost(e){if(!this.config.enabled||e.length===0)return e;let r=this.filterCandidates(e);if(r.length<2)return e;let n=new Set(r.map(s=>Ax(s.id))),o=new Map;for(let s of n){let u=this.calculateConnections(s,n);o.set(s,u)}let i=e.map(s=>{let u=Ax(s.id),l=o.get(u);return!l||l.boostMultiplier===1?s:{...s,score:s.score*l.boostMultiplier,explanation:s.explanation?{...s.explanation,graphConnections:{backlinks:l.backlinks.length,coCitations:l.coCitations.length,sharedTags:l.sharedTags.length,score:l.connectionScore,boostMultiplier:l.boostMultiplier}}:void 0}}),a=i.filter(s=>{let u=Ax(s.id),l=o.get(u);return l&&l.boostMultiplier>1});return a.length>0&&F(`GraphBoostCalculator: Boosted ${a.length} notes based on connections`),i}calculateConnections(e,r){let n=this.findBacklinks(e,r),o=this.findCoCitations(e,r),i=this.findSharedTags(e,r),a=n.length*this.config.backlinkWeight+o.length*this.config.coCitationWeight+i.length*this.config.sharedTagWeight,s=1;return a>0&&(s=1+this.config.boostStrength*Math.log(1+a),s=Math.min(s,this.config.maxBoostMultiplier)),{backlinks:n,coCitations:o,sharedTags:i,connectionScore:a,boostMultiplier:s}}resolveFile(e){let r=this.metadataCache.getFirstLinkpathDest(e,"");return r&&typeof r=="object"&&"path"in r?r:null}findBacklinks(e,r){let n=[],o=this.resolveFile(e);if(!o)return n;let i=this.metadataCache.getBacklinksForFile(o);if(!i)return n;for(let[a]of i.data)r.has(a)&&a!==e&&n.push(a);return n}findCoCitations(e,r){let n=[],o=new Set,i=this.resolveFile(e);if(!i)return n;let a=this.metadataCache.getBacklinksForFile(i);if(!a)return n;for(let[s]of a.data)o.add(s);if(o.size===0)return n;for(let s of r){if(s===e)continue;let u=this.resolveFile(s);if(!u)continue;let l=this.metadataCache.getBacklinksForFile(u);if(l){for(let[c]of l.data)if(o.has(c)){n.push(s);break}}}return n}findSharedTags(e,r){let n=[],o=this.resolveFile(e);if(!o)return n;let i=this.metadataCache.getFileCache(o);if(!i||!i.tags||i.tags.length===0)return n;let a=new Set(i.tags.map(s=>s.tag));for(let s of r){if(s===e)continue;let u=this.resolveFile(s);if(!u)continue;let l=this.metadataCache.getFileCache(u);if(!l||!l.tags)continue;l.tags.some(d=>a.has(d.tag))&&n.push(s)}return n}filterCandidates(e){let r=new Map;for(let i of e){let a=Ax(i.id);r.has(a)||r.set(a,i)}let n=Array.from(r.values()),o=n.length;return n=n.slice(0,this.config.maxCandidates),o>this.config.maxCandidates&&F(`GraphBoost: Limited to top ${this.config.maxCandidates} note candidates (from ${o} unique notes)`),n}setConfig(e){this.config={...this.config,...e}}}});function T_r(t,e={}){let r={...Dfo,...e};if(t.length===0)return{results:[],cutoffScore:null,uniqueNotes:0,totalBefore:0};let n=[...t].sort((l,c)=>c.score-l.score),o=n[0].score,i=Math.max(o*r.relativeThreshold,r.absoluteMinScore),a;r.ensureDiversity?a=$fo(n,i,r):a=jfo(n,i,r);let s=new Set(a.map(l=>Ax(l.id))).size,u=a.length<n.length?i:null;return F(`AdaptiveCutoff: ${a.length}/${n.length} results kept (${s} unique notes, threshold=${i.toFixed(3)})`),{results:a,cutoffScore:u,uniqueNotes:s,totalBefore:n.length}}function jfo(t,e,r){let n=[];for(let o of t){if(n.length>=r.ceiling||n.length>=r.floor&&o.score<e)break;n.push(o)}return n}function $fo(t,e,r){let n=[],o=new Set,i=[];for(let a of t){let s=Ax(a.id);if(!o.has(s)&&(n.length<r.floor||a.score>=e)){if(o.add(s),n.push(a),n.length>=r.ceiling)break;continue}i.push(a)}if(n.length<r.ceiling)for(let a of i){if(n.length>=r.ceiling||a.score<e&&n.length>=r.floor)break;n.push(a)}return n.sort((a,s)=>s.score-a.score),n}var Dfo,O_r=v(()=>{Xe();SEe();Dfo={floor:3,ceiling:30,relativeThreshold:.3,absoluteMinScore:.01,ensureDiversity:!0}});var TEe,E_r=v(()=>{TEe=class{constructor(e={}){this.config={method:"zscore-tanh",tanhScale:2.5,clipMin:.02,clipMax:.98};this.config={...this.config,...e}}updateExplanation(e,r,n){if(e)return{...e,baseScore:r,finalScore:n}}normalize(e){if(e.length===0)return e;switch(this.config.method){case"zscore-tanh":return this.normalizeZScoreTanh(e);case"minmax":return this.normalizeMinMax(e);case"percentile":return this.normalizePercentile(e);default:return e}}normalizeZScoreTanh(e){let r=e.map(l=>l.score),n=r.reduce((l,c)=>l+c,0)/r.length,o=r.reduce((l,c)=>l+Math.pow(c-n,2),0)/r.length,i=Math.sqrt(o);if(i===0)return e.map(l=>({...l,score:.5,explanation:this.updateExplanation(l.explanation,l.score,.5)}));let a=this.config.tanhScale||2.5,s=this.config.clipMin||.02,u=this.config.clipMax||.98;return e.map(l=>{let c=(l.score-n)/i,d=.5+.5*Math.tanh(c/a),f=Math.max(s,Math.min(u,d));return{...l,score:f,explanation:this.updateExplanation(l.explanation,l.score,f)}})}normalizeMinMax(e){let r=e.map(u=>u.score),n=Math.min(...r),o=Math.max(...r);if(o===n)return e.map(u=>({...u,score:.5,explanation:this.updateExplanation(u.explanation,u.score,.5)}));let i=this.config.clipMin||.02,a=this.config.clipMax||.98;return e.map(u=>{let l=(u.score-n)/(o-n),c=i+l*(a-i);return{...u,score:c,explanation:this.updateExplanation(u.explanation,u.score,c)}})}normalizePercentile(e){let r=e.length,n=this.config.clipMin||.02,o=this.config.clipMax||.98,i=[...e].sort((s,u)=>s.score-u.score),a=new Map;return i.forEach((s,u)=>{let l=u/(r-1),c=n+l*(o-n);a.set(s.id,c)}),e.map(s=>{let u=a.get(s.id)||.5;return{...s,score:u,explanation:this.updateExplanation(s.explanation,s.score,u)}})}getStatistics(e){if(e.length===0)return{mean:0,std:0,min:0,max:0,median:0};let r=e.map(c=>c.score),n=[...r].sort((c,d)=>c-d),o=r.reduce((c,d)=>c+d,0)/r.length,i=r.reduce((c,d)=>c+Math.pow(d-o,2),0)/r.length,a=Math.sqrt(i),s=n[0],u=n[n.length-1],l=n[Math.floor(n.length/2)];return{mean:o,std:a,min:s,max:u,median:l}}}});function Lfo(t,e){return t.length<=e?t:T_r(t,{floor:0,ceiling:e,relativeThreshold:0,absoluteMinScore:0,ensureDiversity:!0}).results}var Zat,Pl,OEe,cH=v(()=>{gr();Xe();oae();v_r();w_r();S_r();C_r();x_r();O_r();E_r();Zat=3,Pl=100,OEe=class{constructor(e,r){this.app=e;this.getChatModel=r;this.grepScanner=new wEe(e),this.chunkManager=lq(e),this.fullTextEngine=new yEe(e,this.chunkManager),this.queryExpander=new _Ee({getChatModel:this.getChatModel,maxVariants:3,timeout:Lge}),this.folderBoostCalculator=new CEe(e),this.graphBoostCalculator=new xEe(e,{enabled:!0,maxCandidates:20,boostStrength:.1,maxBoostMultiplier:1.15}),this.scoreNormalizer=new TEe({method:"minmax",clipMin:.02,clipMax:.98})}async retrieve(e,r={}){let n={queries:[],salientTerms:[],originalQuery:e||"",expandedQueries:[]};if(!e||typeof e!="string")return Ce("SearchCore: Invalid query provided"),{results:[],queryExpansion:n};let o=e.trim();if(o.length===0)return Ce("SearchCore: Empty query provided"),{results:[],queryExpansion:n};o.length>1e3?(Ce("SearchCore: Query too long, truncating"),e=o.substring(0,1e3)):e=o;let i=!!r.returnAll,a=i?Pl:Math.min(Math.max(1,r.maxResults||30),100),s=i?Pl:Math.min(Math.max(10,r.candidateLimit||200),1e3),u=!!(r.enableLexicalBoosts??!0);try{F(`SearchCore: Searching for "${e}"`);let l;r.preExpandedQuery?(F("SearchCore: Using pre-expanded query data (skipping QueryExpander)"),l={queries:r.preExpandedQuery.queries||[e],salientTerms:r.preExpandedQuery.salientTerms||[],originalQuery:r.preExpandedQuery.originalQuery||e,expandedQueries:r.preExpandedQuery.expandedQueries||[]}):l=await this.queryExpander.expand(e);let c=l.queries,d=r.salientTerms?[...new Set([...l.salientTerms,...r.salientTerms])]:l.salientTerms,f=[],p=new Set,m=w=>{if(!w)return;let T=w.toLowerCase();T.length===0||p.has(T)||(p.add(T),f.push(T))};c.forEach(m),d.forEach(m),(c.length>1||d.length>0)&&F(`Query expansion: variants=${JSON.stringify(c)}, salient=${JSON.stringify(d)}`);let h=i?Pl:200,y=await this.grepScanner.batchCachedReadGrep(f,h),g=y.slice(0,s);F(`SearchCore: ${g.length} candidates (from ${y.length} grep hits)`);let _=await this.executeLexicalSearch(g,f,d,a,l.originalQuery,i);if(u&&(_=this.folderBoostCalculator.applyBoosts(_),_=this.graphBoostCalculator.applyBoost(_)),_=this.scoreNormalizer.normalize(_),this.fullTextEngine.clear(),_.length>a&&(_=Lfo(_,a)),_.length>0){let w=this.app.vault.getAbstractFileByPath(_[0].id);F(`SearchCore: ${_.length} results found (top: ${w?.name||_[0].id})`)}else F("SearchCore: No results found");return{results:_,queryExpansion:l}}catch(l){ie("SearchCore: Retrieval failed",l);try{return{results:await this.fallbackSearch(e,a),queryExpansion:n}}catch(c){return ie("SearchCore: Fallback search also failed",c),{results:[],queryExpansion:n}}}}async fallbackSearch(e,r){try{return(await this.grepScanner.grep(e,r)).map((o,i)=>({id:o,score:1/(i+1),engine:"grep"}))}catch(n){return ie("SearchCore: Fallback search failed",n),[]}}getStats(){return{fullTextStats:this.fullTextEngine.getStats()}}getChunkManager(){return this.chunkManager}clear(){this.fullTextEngine.clear(),this.queryExpander.clearCache(),F("SearchCore: Cleared all caches")}async executeLexicalSearch(e,r,n,o,i,a=!1){try{let s=Date.now(),u=await this.fullTextEngine.buildFromCandidates(e),l=Date.now()-s,c=Date.now(),d=a?Pl:Number.isFinite(o)?Math.min(o,1e3):e.length||30,f=a?Pl*Zat:Math.max(d*Zat,Zat),p=this.fullTextEngine.search(r,f,n,i),m=Date.now()-c;return F(`Full-text: ${u} docs indexed (${l}ms), ${p.length} results (${m}ms)`),p}catch(s){return ie("Full-text search failed",s),[]}}}});var Yat={};En(Yat,{HybridRetriever:()=>hae});var hae,PEe=v(()=>{aA();XV();Xe();El();Qe();Dt();OD();o9();uOe();hae=class extends fA{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"]}async getRelevantDocuments(r){return Ib(async()=>{let n=ES(r,app.vault),o=n.map(p=>p.basename),i=[...new Set([...this.options.salientTerms,...o])],a=await this.getExplicitChunks(n),s=await this.getOramaChunks(r,i,this.options.textWeight),u=this.filterAndFormatChunks(s,a),l=u;if(u.length===0)return ee().debug&&console.log("No chunks found for query:",r),l;let c=u.reduce((p,m)=>{let h=m.metadata.score;return typeof h=="number"&&!isNaN(h)?Math.max(p,h):p},0),d=u.every(p=>typeof p.metadata.score!="number"||isNaN(p.metadata.score)),f=this.options.useRerankerThreshold&&(c<this.options.useRerankerThreshold||d);return f&&(l=(await Xl.getInstance().rerank(r,u.map(m=>m.pageContent.slice(0,3e3)))).response.data.map(m=>({...u[m.index],metadata:{...u[m.index].metadata,rerank_score:m.relevance_score}}))),ee().debug&&(console.log("*** HYBRID RETRIEVER DEBUG INFO: ***"),console.log(`
Explicit Chunks: `,a),console.log("Orama Chunks: ",s),console.log("Combined Chunks: ",u),console.log("Max Orama Score: ",c),f?console.log("Reranked Chunks: ",l):console.log("No reranking applied.")),l})}async getExplicitChunks(r){let n=[];for(let o of r){let i=await p0.getInstance().getDocumentsByPath(o.path);if(i.length===0)continue;let a=i.map(s=>new Yl({pageContent:s.content,metadata:{...s.metadata,score:1,path:s.path,mtime:s.mtime,ctime:s.ctime,title:s.title,id:s.id,embeddingModel:s.embeddingModel,tags:s.tags,extension:s.extension,created_at:s.created_at,nchars:s.nchars,chunkId:s.metadata?.chunkId}}));n.push(...a)}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 p0.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&&(ee().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);F("Daily note date range:",d[0],d[d.length-1]);let f=ES(d.join(", "),app.vault),m=(await this.getExplicitChunks(f)).map(_=>({..._,metadata:{..._.metadata,includeInContext:!0}}));F("Modified time range:",l,c),s.where={mtime:{between:[l,c]}};let y=(await ov(a,s)).hits.map(_=>new Yl({pageContent:_.document.content,metadata:{..._.document.metadata,score:_.score,path:_.document.path,mtime:_.document.mtime,ctime:_.document.ctime,title:_.document.title,id:_.document.id,embeddingModel:_.document.embeddingModel,tags:_.document.tags,extension:_.document.extension,created_at:_.document.created_at,nchars:_.document.nchars,chunkId:_.document.metadata?.chunkId}})),g=[...m,...y];return Array.from(new Set(g.map(_=>_.metadata.id))).map(_=>g.find(w=>w.metadata.id===_)).filter(_=>_!==void 0)}F(`Orama search params:
`,s);let u=await ov(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 Yl({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,chunkId:l.document.metadata?.chunkId}}))).filter(l=>l!==null)}async convertQueryToVector(r){let o=await(await dd.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}}))}}});function est(t){let e=[];for(let r of t)r.type==="tool_use"&&e.push({name:r.name,args:r.input,id:r.id,type:"tool_call"});return e}var Qat,tst=v(()=>{nv();nO();Qat=class extends gJ{constructor(e){super(e);x(this,"lc_namespace",["langchain","anthropic","output_parsers"]);x(this,"returnId",!1);x(this,"keyName");x(this,"returnSingle",!1);x(this,"zodSchema");this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}static lc_name(){return"AnthropicToolsOutputParser"}async _validateResult(e){let r=e;if(typeof e=="string")try{r=JSON.parse(e)}catch(o){throw new CS(`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 Wz(this.zodSchema,r);if(n.success)return n.data;throw new CS(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(n.error.issues)}`,JSON.stringify(r,null,2))}async parseResult(e){let r=e.flatMap(i=>{let{message:a}=i;return Array.isArray(a.content)?est(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 P_r(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:t==="none"?{type:"none"}:typeof t=="string"?{type:"tool",name:t}:t}var M_r=v(()=>{});function R_r(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="thinking"}function I_r(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="redacted_thinking"}function A_r(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="search_result"}function N_r(t){return typeof t!="object"||t==null||!("type"in t)||t.type!=="image"||!("source"in t)||typeof t.source!="object"||t.source==null||!("type"in t.source)?!1:t.source.type==="base64"?!(!("media_type"in t.source)||typeof t.source.media_type!="string"||!("data"in t.source)||typeof t.source.data!="string"):t.source.type==="url"?!(!("url"in t.source)||typeof t.source.url!="string"):!1}var D_r,j_r=v(()=>{ra();D_r={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=bb({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},..."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},..."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}`)}}});var $_r,L_r=v(()=>{$_r=t=>t()});function Ffo(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="citation"}function kfo(t){function*e(){for(let r of t)Ffo(r)&&(r.source==="char"?yield{type:"char_location",file_id:r.url??"",start_char_index:r.startIndex??0,end_char_index:r.endIndex??0,document_title:r.title??null,document_index:0,cited_text:r.citedText??""}:r.source==="page"?yield{type:"page_location",file_id:r.url??"",start_page_number:r.startIndex??0,end_page_number:r.endIndex??0,document_title:r.title??null,document_index:0,cited_text:r.citedText??""}:r.source==="block"?yield{type:"content_block_location",file_id:r.url??"",start_block_index:r.startIndex??0,end_block_index:r.endIndex??0,document_title:r.title??null,document_index:0,cited_text:r.citedText??""}:r.source==="url"?yield{type:"web_search_result_location",url:r.url??"",title:r.title??null,encrypted_index:String(r.startIndex??0),cited_text:r.citedText??""}:r.source==="search"&&(yield{type:"search_result_location",title:r.title??null,start_block_index:r.startIndex??0,end_block_index:r.endIndex??0,search_result_index:0,source:r.source??"",cited_text:r.citedText??""}))}return Array.from(e())}function gae(t){return typeof t=="string"?t:qfo(t)}function qfo(t){let e=[];for(let r=0,{length:n}=t;r<n;r++)e.push(String.fromCharCode(t[r]));return btoa(e.join(""))}function rst(t){return(t??"").split(";")[0].toLowerCase()}function yae(t,e){if(t!=null&&typeof t=="object"&&e in t)return t[e]}function u9(t,e){let r=yae(e,"cache_control");r!==void 0&&(t.cache_control=r);let n=yae(e,"citations");n!==void 0&&(t.citations=n);let o=yae(e,"context");o!==void 0&&(t.context=o);let i=yae(e,"title");return i!==void 0&&(t.title=i),t}function nst(t,e){let r=yae(e,"cache_control");return r!==void 0&&(t.cache_control=r),t}function F_r(t){return new Set(["image/jpeg","image/png","image/gif","image/webp"]).has(t)}function k_r(t){let e=[],r=t.response_metadata,n="model_provider"in r&&r?.model_provider==="anthropic";for(let o of t.contentBlocks)if(o.type==="text")o.annotations?e.push({type:"text",text:o.text,citations:kfo(o.annotations)}):e.push({type:"text",text:o.text});else if(o.type==="tool_call")e.push({type:"tool_use",id:o.id??"",name:o.name,input:o.args});else if(o.type==="tool_call_chunk"){let i=$_r(()=>{if(typeof o.args!="string")return o.args;try{return JSON.parse(o.args)}catch{return{}}});e.push({type:"tool_use",id:o.id??"",name:o.name??"",input:i})}else if(o.type==="reasoning"&&n)e.push({type:"thinking",thinking:o.reasoning,signature:String(o.signature)});else if(o.type==="server_tool_call"&&n)o.name==="web_search"?e.push({type:"server_tool_use",name:o.name,id:o.id??"",input:o.args}):o.name==="code_execution"&&e.push({type:"server_tool_use",name:o.name,id:o.id??"",input:o.args});else if(o.type==="server_tool_call_result"&&n)if(o.name==="web_search"&&Array.isArray(o.output.urls)){let i=o.output.urls.map(a=>({type:"web_search_result",title:"",encrypted_content:"",url:a}));e.push({type:"web_search_tool_result",tool_use_id:o.toolCallId??"",content:i})}else o.name==="code_execution"?e.push({type:"code_execution_tool_result",tool_use_id:o.toolCallId??"",content:o.output}):o.name==="mcp_tool_result"&&e.push({type:"mcp_tool_result",tool_use_id:o.toolCallId??"",content:o.output});else{if(o.type==="audio")throw new Error("Anthropic does not support audio content blocks.");if(o.type==="file"){let i=o.metadata;if(o.fileId){e.push(u9({type:"document",source:{type:"file",file_id:o.fileId}},i));continue}if(o.url){let a=rst(o.mimeType);if(a==="application/pdf"||a===""){e.push(u9({type:"document",source:{type:"url",url:o.url}},i));continue}}if(o.data){let a=rst(o.mimeType);if(a===""||a==="application/pdf")e.push(u9({type:"document",source:{type:"base64",data:gae(o.data),media_type:"application/pdf"}},i));else if(a==="text/plain")e.push(u9({type:"document",source:{type:"text",data:gae(o.data),media_type:"text/plain"}},i));else if(F_r(a))e.push(u9({type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:gae(o.data),media_type:a}}]}},i));else throw new Error(`Unsupported file mime type for Anthropic base64 source: ${a}`);continue}throw new Error("File content block must include a fileId, url, or data property.")}else if(o.type==="image"){let i=o.metadata;if(o.fileId){e.push(nst({type:"image",source:{type:"file",file_id:o.fileId}},i));continue}if(o.url){e.push(nst({type:"image",source:{type:"url",url:o.url}},i));continue}if(o.data){let a=rst(o.mimeType)||"image/png";F_r(a)&&e.push(nst({type:"image",source:{type:"base64",data:gae(o.data),media_type:a}},i));continue}throw new Error("Image content block must include a fileId, url, or data property.")}else o.type==="video"||(o.type==="text-plain"?o.data&&e.push(u9({type:"document",source:{type:"text",data:gae(o.data),media_type:"text/plain"}},o.metadata)):o.type==="non_standard"&&n&&e.push(o.value))}return e}var q_r=v(()=>{L_r()});function B_r(t){let e=bb({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 Bfo(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 Au({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else e.push(new Au({content:[{type:"tool_result",...r.content!=null?{content:ost(r)}:{},tool_use_id:r.tool_call_id}]}));else e.push(r);return e}function U_r(t){if(t.id===void 0)throw new Error('Anthropic requires all tool calls to have an "id".');return{type:"tool_use",id:t.id,name:t.name,input:t.args}}function*Ufo(t){let e=["bash_code_execution_tool_result","input_json_delta","server_tool_use","text_editor_code_execution_tool_result","tool_result","tool_use","web_search_result","web_search_tool_result"],r=["text","text_delta"];for(let n of t){py(n)&&(yield AN(n,D_r));let o="cache_control"in n?n.cache_control:void 0;if(n.type==="image_url"){let i;typeof n.image_url=="string"?i=B_r(n.image_url):typeof n.image_url=="object"&&n.image_url!==null&&"url"in n.image_url&&typeof n.image_url.url=="string"&&(i=B_r(n.image_url.url)),i&&(yield{type:"image",source:i,...o?{cache_control:o}:{}})}else{if(N_r(n))return n;if(n.type==="document")yield{...n,...o?{cache_control:o}:{}};else if(R_r(n))yield{type:"thinking",thinking:n.thinking,signature:n.signature,...o?{cache_control:o}:{}};else if(I_r(n))yield{type:"redacted_thinking",data:n.data,...o?{cache_control:o}:{}};else if(A_r(n))yield{type:"search_result",title:n.title,source:n.source,..."cache_control"in n&&n.cache_control?{cache_control:n.cache_control}:{},..."citations"in n&&n.citations?{citations:n.citations}:{},content:n.content};else if(r.find(i=>i===n.type)&&"text"in n)yield{type:"text",text:n.text,...o?{cache_control:o}:{},..."citations"in n&&n.citations?{citations:n.citations}:{}};else if(e.find(i=>i===n.type)){let i={...n};if("index"in i&&delete i.index,i.type==="input_json_delta"&&(i.type="tool_use"),"input"in i&&typeof i.input=="string")try{i.input=JSON.parse(i.input)}catch{i.input={}}yield{...i,...o?{cache_control:o}:{}}}else n.type==="container_upload"&&(yield{...n,...o?{cache_control:o}:{}})}}}function ost(t){let{content:e}=t;return typeof e=="string"?e:Array.from(Ufo(e))}function MEe(t){let e=Bfo(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.type}" is not supported.`);if(mc(i)&&i.response_metadata?.output_version==="v1")return{role:a,content:k_r(i)};if(mc(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(U_r)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(U_r)]};{let{content:s}=i;return!i.tool_calls.every(l=>s.find(c=>(c.type==="tool_use"||c.type==="input_json_delta"||c.type==="server_tool_use")&&c.id===l.id))&&console.warn('The "tool_calls" field on a message is only respected if content is a string.'),{role:a,content:ost(i)}}}else return{role:a,content:ost(i)}});return{messages:zfo(o),system:r}}function zfo(t){if(!t||t.length<=1)return t;let e=[],r=t[0],n=i=>typeof i=="string"?[{type:"text",text:i}]:i,o=i=>i.role!=="user"||typeof i.content=="string"?!1:Array.isArray(i.content)&&i.content.every(a=>a.type==="tool_result");for(let i=1;i<t.length;i+=1){let a=t[i];o(r)&&o(a)?r={...r,content:[...n(r.content),...n(a.content)]}:(e.push(r),r=a)}return e.push(r),e}var ist=v(()=>{j_r();q_r();ra()});function z_r(t,e){let r={model_provider:"anthropic"};if(t.type==="message_start"){let{content:n,usage:o,...i}=t.message,a={};for(let[d,f]of Object.entries(i))f!=null&&(a[d]=f);let{input_tokens:s,output_tokens:u,...l}=o??{},c={input_tokens:s,output_tokens:u,total_tokens:s+u,input_token_details:{cache_creation:l.cache_creation_input_tokens,cache_read:l.cache_read_input_tokens}};return{chunk:new Hr({content:e.coerceContentToString?"":[],additional_kwargs:a,usage_metadata:e.streamUsage?c:void 0,response_metadata:{...r,usage:{...l}},id:t.message.id})}}else if(t.type==="message_delta"){let n={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}},o="context_management"in t.delta?{context_management:t.delta.context_management}:void 0;return{chunk:new Hr({content:e.coerceContentToString?"":[],response_metadata:o,additional_kwargs:{...t.delta},usage_metadata:e.streamUsage?n:void 0})}}else if(t.type==="content_block_start"&&["tool_use","document","server_tool_use","web_search_tool_result"].includes(t.content_block.type)){let n=t.content_block,o;return n.type==="tool_use"?o=[{id:n.id,index:t.index,name:n.name,args:""}]:o=[],{chunk:new Hr({content:e.coerceContentToString?"":[{index:t.index,...t.content_block,input:n.type==="server_tool_use"||n.type==="tool_use"?"":void 0}],response_metadata:r,additional_kwargs:{},tool_call_chunks:o})}}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 Hr({content:t.delta.text})};{let n=t.delta;return"citation"in n&&(n.citations=[n.citation],delete n.citation),n.type==="thinking_delta"||n.type==="signature_delta"?{chunk:new Hr({content:[{index:t.index,...n,type:"thinking"}],response_metadata:r})}:{chunk:new Hr({content:[{index:t.index,...n,type:"text"}],response_metadata:r})}}}else{if(t.type==="content_block_delta"&&t.delta.type==="input_json_delta")return{chunk:new Hr({content:e.coerceContentToString?"":[{index:t.index,input:t.delta.partial_json,type:t.delta.type}],response_metadata:r,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 n=t.content_block?.text;if(n!==void 0)return{chunk:new Hr({content:e.coerceContentToString?n:[{index:t.index,...t.content_block}],response_metadata:r,additional_kwargs:{}})}}else{if(t.type==="content_block_start"&&t.content_block.type==="redacted_thinking")return{chunk:new Hr({content:e.coerceContentToString?"":[{index:t.index,...t.content_block}],response_metadata:r})};if(t.type==="content_block_start"&&t.content_block.type==="thinking"){let n=t.content_block.thinking;return{chunk:new Hr({content:e.coerceContentToString?n:[{index:t.index,...t.content_block}],response_metadata:r})}}}}return null}function V_r(t,e){let r={...e,model_provider:"anthropic"},n=e.usage,o=n!=null?{input_tokens:n.input_tokens??0,output_tokens:n.output_tokens??0,total_tokens:(n.input_tokens??0)+(n.output_tokens??0),input_token_details:{cache_creation:n.cache_creation_input_tokens,cache_read:n.cache_read_input_tokens}}:void 0;if(t.length===1&&t[0].type==="text")return[{text:t[0].text,message:new uo({content:t[0].text,additional_kwargs:e,usage_metadata:o,response_metadata:r,id:e.id})}];{let i=est(t);return[{text:"",message:new uo({content:t,additional_kwargs:e,tool_calls:i,usage_metadata:o,response_metadata:r,id:e.id})}]}}var H_r=v(()=>{tst();ra()});function REe(t,e){return t.lc_error_code=e,t.message=`${t.message}

Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function ast(t){let e;return t.status===400&&t.message.includes("tool")?e=REe(t,"INVALID_TOOL_RESULTS"):t.status===401?e=REe(t,"MODEL_AUTHENTICATION"):t.status===404?e=REe(t,"MODEL_NOT_FOUND"):t.status===429?e=REe(t,"MODEL_RATE_LIMIT"):e=t,e}var W_r=v(()=>{});function yr(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 Ie(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var MD=v(()=>{});var sst,J_r=v(()=>{sst=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return sst=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))}});function RD(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var bae,l9=v(()=>{bae=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)}});var ln,Bh,Wg,gq,c9,d9,f9,p9,m9,h9,g9,y9,b9,Nx=v(()=>{l9();ln=class extends Error{},Bh=class t extends ln{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("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 gq({message:n,cause:bae(r)});let i=r;return e===400?new d9(e,i,n,o):e===401?new f9(e,i,n,o):e===403?new p9(e,i,n,o):e===404?new m9(e,i,n,o):e===409?new h9(e,i,n,o):e===422?new g9(e,i,n,o):e===429?new y9(e,i,n,o):e>=500?new b9(e,i,n,o):new t(e,i,n,o)}},Wg=class extends Bh{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},gq=class extends Bh{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},c9=class extends gq{constructor({message:e}={}){super({message:e??"Request timed out."})}},d9=class extends Bh{},f9=class extends Bh{},p9=class extends Bh{},m9=class extends Bh{},h9=class extends Bh{},g9=class extends Bh{},y9=class extends Bh{},b9=class extends Bh{}});function cst(t){return typeof t!="object"?{}:t??{}}function G_r(t){if(!t)return!0;for(let e in t)return!1;return!0}function X_r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Hfo,K_r,ust,lst,Z_r,IEe,dH=v(()=>{Nx();Hfo=/^[a-z][a-z0-9+.-]*:/i,K_r=t=>Hfo.test(t),ust=t=>(ust=Array.isArray,ust(t)),lst=ust;Z_r=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new ln(`${t} must be an integer`);if(e<0)throw new ln(`${t} must be a positive integer`);return e},IEe=t=>{try{return JSON.parse(t)}catch{return}}});var Y_r,Q_r=v(()=>{Y_r=t=>new Promise(e=>setTimeout(e,t))});var yq,dst=v(()=>{yq="0.65.0"});function Wfo(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}function Kfo(){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 nvr,Jfo,evr,tvr,rvr,ovr,fst=v(()=>{dst();nvr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";Jfo=()=>{let t=Wfo();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yq,"X-Stainless-OS":tvr(Deno.build.os),"X-Stainless-Arch":evr(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":yq,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yq,"X-Stainless-OS":tvr(globalThis.process.platform??"unknown"),"X-Stainless-Arch":evr(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Kfo();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yq,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yq,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};evr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",tvr=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"),ovr=()=>rvr??(rvr=Jfo())});function ivr(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function pst(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function AEe(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return pst({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function _ae(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function avr(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var _9=v(()=>{});var svr,uvr=v(()=>{svr=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});function dvr(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}function vae(t){let e;return(lvr??(e=new globalThis.TextEncoder,lvr=e.encode.bind(e)))(t)}function mst(t){let e;return(cvr??(e=new globalThis.TextDecoder,cvr=e.decode.bind(e)))(t)}var lvr,cvr,hst=v(()=>{});function Zfo(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 fvr(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var Aw,Nw,ID,gst=v(()=>{MD();hst();ID=class{constructor(){Aw.set(this,void 0),Nw.set(this,void 0),yr(this,Aw,new Uint8Array,"f"),yr(this,Nw,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?vae(e):e;yr(this,Aw,dvr([Ie(this,Aw,"f"),r]),"f");let n=[],o;for(;(o=Zfo(Ie(this,Aw,"f"),Ie(this,Nw,"f")))!=null;){if(o.carriage&&Ie(this,Nw,"f")==null){yr(this,Nw,o.index,"f");continue}if(Ie(this,Nw,"f")!=null&&(o.index!==Ie(this,Nw,"f")+1||o.carriage)){n.push(mst(Ie(this,Aw,"f").subarray(0,Ie(this,Nw,"f")-1))),yr(this,Aw,Ie(this,Aw,"f").subarray(Ie(this,Nw,"f")),"f"),yr(this,Nw,null,"f");continue}let i=Ie(this,Nw,"f")!==null?o.preceding-1:o.preceding,a=mst(Ie(this,Aw,"f").subarray(0,i));n.push(a),yr(this,Aw,Ie(this,Aw,"f").subarray(o.index),"f"),yr(this,Nw,null,"f")}return n}flush(){return Ie(this,Aw,"f").length?this.decode(`
`):[]}};Aw=new WeakMap,Nw=new WeakMap;ID.NEWLINE_CHARS=new Set([`
`,"\r"]);ID.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function wae(){}function NEe(t,e,r){return!e||DEe[t]>DEe[r]?wae:e[t].bind(e)}function Uh(t){let e=t.logger,r=t.logLevel??"off";if(!e)return Yfo;let n=pvr.get(e);if(n&&n[0]===r)return n[1];let o={error:NEe("error",e,r),warn:NEe("warn",e,r),info:NEe("info",e,r),debug:NEe("debug",e,r)};return pvr.set(e,[r,o]),o}var DEe,yst,Yfo,pvr,AD,jEe=v(()=>{dH();DEe={off:0,error:200,warn:300,info:400,debug:500},yst=(t,e,r)=>{if(t){if(X_r(DEe,t))return t;Uh(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(DEe))}`)}};Yfo={error:wae,warn:wae,info:wae,debug:wae},pvr=new WeakMap;AD=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="x-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t)});async function*Qfo(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new ln("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new ln("Attempted to iterate over a response with no body");let r=new bst,n=new ID,o=_ae(t.body);for await(let i of epo(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*epo(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"?vae(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=fvr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function tpo(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var Sae,pA,bst,_st=v(()=>{MD();Nx();_9();gst();_9();l9();dH();hst();jEe();Nx();pA=class t{constructor(e,r,n){this.iterator=e,Sae.set(this,void 0),this.controller=r,yr(this,Sae,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?Uh(n):console;async function*a(){if(o)throw new ln("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of Qfo(e,r)){if(u.event==="completion")try{yield JSON.parse(u.data)}catch(l){throw i.error("Could not parse message into JSON:",u.data),i.error("From chunk:",u.raw),l}if(u.event==="message_start"||u.event==="message_delta"||u.event==="message_stop"||u.event==="content_block_start"||u.event==="content_block_delta"||u.event==="content_block_stop")try{yield JSON.parse(u.data)}catch(l){throw i.error("Could not parse message into JSON:",u.data),i.error("From chunk:",u.raw),l}if(u.event!=="ping"&&u.event==="error")throw new Bh(void 0,IEe(u.data)??u.data,void 0,e.headers)}s=!0}catch(u){if(RD(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*i(){let s=new ID,u=_ae(e);for await(let l of u)for(let c of s.decode(l))yield c;for(let l of s.flush())yield l}async function*a(){if(o)throw new ln("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of i())s||u&&(yield JSON.parse(u));s=!0}catch(u){if(RD(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}[(Sae=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller,Ie(this,Sae,"f")),new t(()=>o(r),this.controller,Ie(this,Sae,"f"))]}toReadableStream(){let e=this,r;return pst({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:i}=await r.next();if(i)return n.close();let a=vae(JSON.stringify(o)+`
`);n.enqueue(a)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};bst=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]=tpo(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function $Ee(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,a=await(async()=>{if(e.options.stream)return Uh(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller):pA.fromSSEResponse(r,e.controller);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let u=r.headers.get("content-type")?.split(";")[0]?.trim();if(u?.includes("application/json")||u?.endsWith("+json")){let d=await r.json();return vst(d,r)}return await r.text()})();return Uh(t).debug(`[${n}] response parsed`,AD({retryOfRequestLogID:o,url:r.url,status:r.status,body:a,durationMs:Date.now()-i})),a}function vst(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 wst=v(()=>{_st();jEe()});var Cae,fH,LEe=v(()=>{MD();wst();fH=class t extends Promise{constructor(e,r,n=$Ee){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,Cae.set(this,void 0),yr(this,Cae,e,"f")}_thenUnwrap(e){return new t(Ie(this,Cae,"f"),this.responsePromise,async(r,n)=>vst(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(Ie(this,Cae,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Cae=new WeakMap});var FEe,Sst,xae,h0,bq=v(()=>{MD();Nx();wst();LEe();dH();Sst=class{constructor(e,r,n,o){FEe.set(this,void 0),yr(this,FEe,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new ln("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await Ie(this,FEe,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(FEe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},xae=class extends fH{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await $Ee(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},h0=class extends Sst{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()}nextPageRequestOptions(){if(this.options.query?.before_id){let r=this.first_id;return r?{...this.options,query:{...cst(this.options.query),before_id:r}}:null}let e=this.last_id;return e?{...this.options,query:{...cst(this.options.query),after_id:e}}:null}}});function pH(t,e,r){return xst(),new File(t,e??"unknown_file",r)}function Tae(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}function npo(t){let e=typeof t=="function"?t:t.fetch,r=mvr.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new o(i).text()}catch{return!0}})();return mvr.set(e,n),n}var xst,Tst,hvr,mvr,opo,ipo,Cst,kEe=v(()=>{_9();xst=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};Tst=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",hvr=async(t,e)=>({...t,body:await opo(t.body,e)}),mvr=new WeakMap;opo=async(t,e)=>{if(!await npo(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>Cst(r,n,o))),r},ipo=t=>t instanceof Blob&&"name"in t,Cst=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response){let n={},o=r.headers.get("Content-Type");o&&(n={type:o}),t.append(e,pH([await r.blob()],Tae(r),n))}else if(Tst(r))t.append(e,pH([await new Response(AEe(r)).blob()],Tae(r)));else if(ipo(r))t.append(e,pH([r],Tae(r),{type:r.type}));else if(Array.isArray(r))await Promise.all(r.map(n=>Cst(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>Cst(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}}});async function qEe(t,e,r){if(xst(),t=await t,e||(e=Tae(t)),apo(t))return t instanceof File&&e==null&&r==null?t:pH([await t.arrayBuffer()],e??t.name,{type:t.type,lastModified:t.lastModified,...r});if(spo(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),pH(await Ost(o),e,r)}let n=await Ost(t);if(!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return pH(n,e,r)}async function Ost(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(gvr(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(Tst(t))for await(let r of t)e.push(...await Ost(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${upo(t)}`)}return e}function upo(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var gvr,apo,spo,yvr=v(()=>{kEe();kEe();gvr=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",apo=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&gvr(t),spo=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function"});var Est=v(()=>{yvr()});var bvr=v(()=>{});var Md,mA=v(()=>{Md=class{constructor(e){this._client=e}}});function*cpo(t){if(!t)return;if(_vr in t){let{values:n,nulls:o}=t;yield*n.entries();for(let i of o)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():lst(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=lst(n[1])?n[1]:[n[1]],a=!1;for(let s of i)s!==void 0&&(e&&!a&&(a=!0,yield[o,null]),yield[o,s])}}var _vr,aa,hA=v(()=>{dH();_vr=Symbol.for("brand.privateNullableHeaders");aa=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,a]of cpo(n)){let s=i.toLowerCase();o.has(s)||(e.delete(i),o.add(s)),a===null?(e.delete(i),r.add(s)):(e.append(i,a),r.delete(s))}}return{[_vr]:!0,values:e,nulls:r}}});function wvr(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var vvr,dpo,Jy,v9=v(()=>{Nx();vvr=Object.freeze(Object.create(null)),dpo=(t=wvr)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],a=r.reduce((c,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=n[f],m=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??vvr)??vvr)?.toString)&&(m=p+"",i.push({start:c.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),c+d+(f===n.length?"":m)},""),s=a.split(/[?#]/,1)[0],u=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;for(;(l=u.exec(s))!==null;)i.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can't be safely passed as a path parameter`});if(i.sort((c,d)=>c.start-d.start),i.length>0){let c=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-c),h="^".repeat(p.length);return c=p.start+p.length,f+m+h},"");throw new ln(`Path parameters result in path with invalid segments:
${i.map(f=>f.error).join(`
`)}
${a}
${d}`)}return a},Jy=dpo(wvr)});var w9,Pst=v(()=>{mA();bq();hA();kEe();v9();w9=class extends Md{list(e={},r){let{betas:n,...o}=e??{};return this._client.getAPIList("/v1/files",h0,{query:o,...r,headers:aa([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])})}delete(e,r={},n){let{betas:o}=r??{};return this._client.delete(Jy`/v1/files/${e}`,{...n,headers:aa([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString()},n?.headers])})}download(e,r={},n){let{betas:o}=r??{};return this._client.get(Jy`/v1/files/${e}/content`,{...n,headers:aa([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}retrieveMetadata(e,r={},n){let{betas:o}=r??{};return this._client.get(Jy`/v1/files/${e}`,{...n,headers:aa([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString()},n?.headers])})}upload(e,r){let{betas:n,...o}=e;return this._client.post("/v1/files",hvr({body:o,...r,headers:aa([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])},this._client))}}});var S9,Mst=v(()=>{mA();bq();hA();v9();S9=class extends Md{retrieve(e,r={},n){let{betas:o}=r??{};return this._client.get(Jy`/v1/models/${e}?beta=true`,{...n,headers:aa([{...o?.toString()!=null?{"anthropic-beta":o?.toString()}:void 0},n?.headers])})}list(e={},r){let{betas:n,...o}=e??{};return this._client.getAPIList("/v1/models?beta=true",h0,{query:o,...r,headers:aa([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}}});var C9,Rst=v(()=>{Nx();_9();gst();C9=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new ID;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(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new ln("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new ln("Attempted to iterate over a response with no body");return new t(_ae(e.body),r)}}});var Oae=v(()=>{Nx()});var x9,Ist=v(()=>{mA();bq();hA();Rst();Oae();v9();x9=class extends Md{create(e,r){let{betas:n,...o}=e;return this._client.post("/v1/messages/batches?beta=true",{body:o,...r,headers:aa([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}retrieve(e,r={},n){let{betas:o}=r??{};return this._client.get(Jy`/v1/messages/batches/${e}?beta=true`,{...n,headers:aa([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},n?.headers])})}list(e={},r){let{betas:n,...o}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",h0,{query:o,...r,headers:aa([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}delete(e,r={},n){let{betas:o}=r??{};return this._client.delete(Jy`/v1/messages/batches/${e}?beta=true`,{...n,headers:aa([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},n?.headers])})}cancel(e,r={},n){let{betas:o}=r??{};return this._client.post(Jy`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:aa([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},n?.headers])})}async results(e,r={},n){let o=await this.retrieve(e);if(!o.results_url)throw new ln(`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:aa([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((a,s)=>C9.fromResponse(s.response,s.controller))}}});var Ast=v(()=>{_st()});var hpo,T9,gpo,ypo,BEe,Nst=v(()=>{hpo=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},T9=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),T9(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),T9(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),T9(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),T9(t);break;case"delimiter":return t=t.slice(0,t.length-1),T9(t);break}return t},gpo=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},ypo=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},BEe=t=>JSON.parse(ypo(gpo(T9(hpo(t)))))});function Tvr(t){return t.type==="tool_use"||t.type==="server_tool_use"||t.type==="mcp_tool_use"}var g0,_q,Eae,UEe,Pae,Mae,zEe,Rae,ND,Iae,VEe,HEe,O9,WEe,JEe,Dst,Svr,KEe,jst,$st,Lst,Cvr,xvr,GEe,Ovr=v(()=>{MD();l9();Oae();Ast();Nst();xvr="__json_buf";GEe=class t{constructor(){g0.add(this),this.messages=[],this.receivedMessages=[],_q.set(this,void 0),this.controller=new AbortController,Eae.set(this,void 0),UEe.set(this,()=>{}),Pae.set(this,()=>{}),Mae.set(this,void 0),zEe.set(this,()=>{}),Rae.set(this,()=>{}),ND.set(this,{}),Iae.set(this,!1),VEe.set(this,!1),HEe.set(this,!1),O9.set(this,!1),WEe.set(this,void 0),JEe.set(this,void 0),KEe.set(this,e=>{if(yr(this,VEe,!0,"f"),RD(e)&&(e=new Wg),e instanceof Wg)return yr(this,HEe,!0,"f"),this._emit("abort",e);if(e instanceof ln)return this._emit("error",e);if(e instanceof Error){let r=new ln(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new ln(String(e)))}),yr(this,Eae,new Promise((e,r)=>{yr(this,UEe,e,"f"),yr(this,Pae,r,"f")}),"f"),yr(this,Mae,new Promise((e,r)=>{yr(this,zEe,e,"f"),yr(this,Rae,r,"f")}),"f"),Ie(this,Eae,"f").catch(()=>{}),Ie(this,Mae,"f").catch(()=>{})}get response(){return Ie(this,WEe,"f")}get request_id(){return Ie(this,JEe,"f")}async withResponse(){let e=await Ie(this,Eae,"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")},Ie(this,KEe,"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,i;o&&(o.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),o.addEventListener("abort",i));try{Ie(this,g0,"m",jst).call(this);let{response:a,data:s}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(a);for await(let u of s)Ie(this,g0,"m",$st).call(this,u);if(s.controller.signal?.aborted)throw new Wg;Ie(this,g0,"m",Lst).call(this)}finally{o&&i&&o.removeEventListener("abort",i)}}_connected(e){this.ended||(yr(this,WEe,e,"f"),yr(this,JEe,e?.headers.get("request-id"),"f"),Ie(this,UEe,"f").call(this,e),this._emit("connect"))}get ended(){return Ie(this,Iae,"f")}get errored(){return Ie(this,VEe,"f")}get aborted(){return Ie(this,HEe,"f")}abort(){this.controller.abort()}on(e,r){return(Ie(this,ND,"f")[e]||(Ie(this,ND,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Ie(this,ND,"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(Ie(this,ND,"f")[e]||(Ie(this,ND,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{yr(this,O9,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){yr(this,O9,!0,"f"),await Ie(this,Mae,"f")}get currentMessage(){return Ie(this,_q,"f")}async finalMessage(){return await this.done(),Ie(this,g0,"m",Dst).call(this)}async finalText(){return await this.done(),Ie(this,g0,"m",Svr).call(this)}_emit(e,...r){if(Ie(this,Iae,"f"))return;e==="end"&&(yr(this,Iae,!0,"f"),Ie(this,zEe,"f").call(this));let n=Ie(this,ND,"f")[e];if(n&&(Ie(this,ND,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Ie(this,O9,"f")&&!n?.length&&Promise.reject(o),Ie(this,Pae,"f").call(this,o),Ie(this,Rae,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Ie(this,O9,"f")&&!n?.length&&Promise.reject(o),Ie(this,Pae,"f").call(this,o),Ie(this,Rae,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",Ie(this,g0,"m",Dst).call(this))}async _fromReadableStream(e,r){let n=r?.signal,o;n&&(n.aborted&&this.controller.abort(),o=this.controller.abort.bind(this.controller),n.addEventListener("abort",o));try{Ie(this,g0,"m",jst).call(this),this._connected(null);let i=pA.fromReadableStream(e,this.controller);for await(let a of i)Ie(this,g0,"m",$st).call(this,a);if(i.controller.signal?.aborted)throw new Wg;Ie(this,g0,"m",Lst).call(this)}finally{n&&o&&n.removeEventListener("abort",o)}}[(_q=new WeakMap,Eae=new WeakMap,UEe=new WeakMap,Pae=new WeakMap,Mae=new WeakMap,zEe=new WeakMap,Rae=new WeakMap,ND=new WeakMap,Iae=new WeakMap,VEe=new WeakMap,HEe=new WeakMap,O9=new WeakMap,WEe=new WeakMap,JEe=new WeakMap,KEe=new WeakMap,g0=new WeakSet,Dst=function(){if(this.receivedMessages.length===0)throw new ln("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Svr=function(){if(this.receivedMessages.length===0)throw new ln("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 ln("stream ended without producing a content block with type=text");return r.join(" ")},jst=function(){this.ended||yr(this,_q,void 0,"f")},$st=function(r){if(this.ended)return;let n=Ie(this,g0,"m",Cvr).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":{Tvr(o)&&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":{yr(this,_q,n,"f");break}case"content_block_start":case"message_delta":break}},Lst=function(){if(this.ended)throw new ln("stream has ended, this shouldn't happen");let r=Ie(this,_q,"f");if(!r)throw new ln("request ended without sending any chunks");return yr(this,_q,void 0,"f"),r},Cvr=function(r){let n=Ie(this,_q,"f");if(r.type==="message_start"){if(n)throw new ln(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new ln(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.container=r.delta.container,n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,n.context_management=r.context_management,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),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"&&(n.content[r.index]={...o,text:(o.text||"")+r.delta.text});break}case"citations_delta":{o?.type==="text"&&(n.content[r.index]={...o,citations:[...o.citations??[],r.delta.citation]});break}case"input_json_delta":{if(o&&Tvr(o)){let i=o[xvr]||"";i+=r.delta.partial_json;let a={...o};if(Object.defineProperty(a,xvr,{value:i,enumerable:!1,writable:!0}),i)try{a.input=BEe(i)}catch(s){let u=new ln(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${s}. JSON: ${i}`);Ie(this,KEe,"f").call(this,u)}n.content[r.index]=a}break}case"thinking_delta":{o?.type==="thinking"&&(n.content[r.index]={...o,thinking:o.thinking+r.delta.thinking});break}case"signature_delta":{o?.type==="thinking"&&(n.content[r.index]={...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 pA(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var XEe,Fst=v(()=>{XEe={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192}});function Evr(){let t,e;return{promise:new Promise((n,o)=>{t=n,e=o}),resolve:t,reject:e}}async function bpo(t,e=t.messages.at(-1)){if(!e||e.role!=="assistant"||!e.content||typeof e.content=="string")return null;let r=e.content.filter(o=>o.type==="tool_use");return r.length===0?null:{role:"user",content:await Promise.all(r.map(async o=>{let i=t.tools.find(a=>a.name===o.name);if(!i||!("run"in i))return{type:"tool_result",tool_use_id:o.id,content:`Error: Tool '${o.name}' not found`,is_error:!0};try{let a=o.input;"parse"in i&&i.parse&&(a=i.parse(a));let s=await i.run(a);return{type:"tool_result",tool_use_id:o.id,content:s}}catch(a){return{type:"tool_result",tool_use_id:o.id,content:`Error: ${a instanceof Error?a.message:String(a)}`,is_error:!0}}}))}}var ZEe,E9,mH,av,Aae,gA,DD,vq,Nae,kst,P9,qst=v(()=>{MD();Nx();hA();P9=class{constructor(e,r,n){ZEe.add(this),this.client=e,E9.set(this,!1),mH.set(this,!1),av.set(this,void 0),Aae.set(this,void 0),gA.set(this,void 0),DD.set(this,void 0),vq.set(this,void 0),Nae.set(this,0),yr(this,av,{params:{...r,messages:structuredClone(r.messages)}},"f"),yr(this,Aae,{...n,headers:aa([{"x-stainless-helper":"BetaToolRunner"},n?.headers])},"f"),yr(this,vq,Evr(),"f")}async*[(E9=new WeakMap,mH=new WeakMap,av=new WeakMap,Aae=new WeakMap,gA=new WeakMap,DD=new WeakMap,vq=new WeakMap,Nae=new WeakMap,ZEe=new WeakSet,Symbol.asyncIterator)](){var e;if(Ie(this,E9,"f"))throw new ln("Cannot iterate over a consumed stream");yr(this,E9,!0,"f"),yr(this,mH,!0,"f"),yr(this,DD,void 0,"f");try{for(;;){let r;try{if(Ie(this,av,"f").params.max_iterations&&Ie(this,Nae,"f")>=Ie(this,av,"f").params.max_iterations)break;yr(this,mH,!1,"f"),yr(this,gA,void 0,"f"),yr(this,DD,void 0,"f"),yr(this,Nae,(e=Ie(this,Nae,"f"),e++,e),"f");let{max_iterations:n,...o}=Ie(this,av,"f").params;if(o.stream?(r=this.client.beta.messages.stream({...o},Ie(this,Aae,"f")),yr(this,gA,r.finalMessage(),"f"),yield r):(yr(this,gA,this.client.beta.messages.create({...o,stream:!1},Ie(this,Aae,"f")),"f"),yield Ie(this,gA,"f")),!Ie(this,mH,"f")){let{role:a,content:s}=await Ie(this,gA,"f");Ie(this,av,"f").params.messages.push({role:a,content:s})}let i=await Ie(this,ZEe,"m",kst).call(this,Ie(this,av,"f").params.messages.at(-1));if(i&&Ie(this,av,"f").params.messages.push(i),!i&&!Ie(this,mH,"f"))break}finally{r&&r.abort()}}if(!Ie(this,gA,"f"))throw new ln("ToolRunner concluded without a message from the server");Ie(this,vq,"f").resolve(await Ie(this,gA,"f"))}catch(r){throw yr(this,E9,!1,"f"),Ie(this,vq,"f").promise.catch(()=>{}),Ie(this,vq,"f").reject(r),yr(this,vq,Evr(),"f"),r}}setMessagesParams(e){typeof e=="function"?Ie(this,av,"f").params=e(Ie(this,av,"f").params):Ie(this,av,"f").params=e,yr(this,mH,!0,"f"),yr(this,DD,void 0,"f")}async generateToolResponse(){let e=await Ie(this,gA,"f")??this.params.messages.at(-1);return e?Ie(this,ZEe,"m",kst).call(this,e):null}done(){return Ie(this,vq,"f").promise}async runUntilDone(){if(!Ie(this,E9,"f"))for await(let e of this);return this.done()}get params(){return Ie(this,av,"f").params}pushMessages(...e){this.setMessagesParams(r=>({...r,messages:[...r.messages,...e]}))}then(e,r){return this.runUntilDone().then(e,r)}};kst=async function(e){return Ie(this,DD,"f")!==void 0?Ie(this,DD,"f"):(yr(this,DD,bpo(Ie(this,av,"f").params,e),"f"),Ie(this,DD,"f"))}});var Pvr,wq,Bst=v(()=>{mA();Ist();Ist();hA();Ovr();Fst();qst();qst();Pvr={"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-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-5-sonnet-20241022":"October 22, 2025","claude-3-5-sonnet-20240620":"October 22, 2025"},wq=class extends Md{constructor(){super(...arguments),this.batches=new x9(this._client)}create(e,r){let{betas:n,...o}=e;o.model in Pvr&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${Pvr[o.model]}
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let i=this._client._options.timeout;if(!o.stream&&i==null){let a=XEe[o.model]??void 0;i=this._client.calculateNonstreamingTimeout(o.max_tokens,a)}return this._client.post("/v1/messages?beta=true",{body:o,timeout:i??6e5,...r,headers:aa([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}stream(e,r){return GEe.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:aa([{"anthropic-beta":[...n??[],"token-counting-2024-11-01"].toString()},r?.headers])})}toolRunner(e,r){return new P9(this._client,e,r)}};wq.Batches=x9;wq.BetaToolRunner=P9});var yA,Ust=v(()=>{mA();Pst();Pst();Mst();Mst();Bst();Bst();yA=class extends Md{constructor(){super(...arguments),this.models=new S9(this._client),this.messages=new wq(this._client),this.files=new w9(this._client)}};yA.Models=S9;yA.Messages=wq;yA.Files=w9});var hH,zst=v(()=>{mA();hA();hH=class extends Md{create(e,r){let{betas:n,...o}=e;return this._client.post("/v1/complete",{body:o,timeout:this._client._options.timeout??6e5,...r,headers:aa([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}}});function Avr(t){return t.type==="tool_use"||t.type==="server_tool_use"}var y0,Sq,Dae,YEe,jae,$ae,QEe,Lae,jD,Fae,ePe,tPe,M9,rPe,nPe,Vst,Mvr,Hst,Wst,Jst,Kst,Rvr,Ivr,oPe,Nvr=v(()=>{MD();l9();Oae();Ast();Nst();Ivr="__json_buf";oPe=class t{constructor(){y0.add(this),this.messages=[],this.receivedMessages=[],Sq.set(this,void 0),this.controller=new AbortController,Dae.set(this,void 0),YEe.set(this,()=>{}),jae.set(this,()=>{}),$ae.set(this,void 0),QEe.set(this,()=>{}),Lae.set(this,()=>{}),jD.set(this,{}),Fae.set(this,!1),ePe.set(this,!1),tPe.set(this,!1),M9.set(this,!1),rPe.set(this,void 0),nPe.set(this,void 0),Hst.set(this,e=>{if(yr(this,ePe,!0,"f"),RD(e)&&(e=new Wg),e instanceof Wg)return yr(this,tPe,!0,"f"),this._emit("abort",e);if(e instanceof ln)return this._emit("error",e);if(e instanceof Error){let r=new ln(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new ln(String(e)))}),yr(this,Dae,new Promise((e,r)=>{yr(this,YEe,e,"f"),yr(this,jae,r,"f")}),"f"),yr(this,$ae,new Promise((e,r)=>{yr(this,QEe,e,"f"),yr(this,Lae,r,"f")}),"f"),Ie(this,Dae,"f").catch(()=>{}),Ie(this,$ae,"f").catch(()=>{})}get response(){return Ie(this,rPe,"f")}get request_id(){return Ie(this,nPe,"f")}async withResponse(){let e=await Ie(this,Dae,"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")},Ie(this,Hst,"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,i;o&&(o.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),o.addEventListener("abort",i));try{Ie(this,y0,"m",Wst).call(this);let{response:a,data:s}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(a);for await(let u of s)Ie(this,y0,"m",Jst).call(this,u);if(s.controller.signal?.aborted)throw new Wg;Ie(this,y0,"m",Kst).call(this)}finally{o&&i&&o.removeEventListener("abort",i)}}_connected(e){this.ended||(yr(this,rPe,e,"f"),yr(this,nPe,e?.headers.get("request-id"),"f"),Ie(this,YEe,"f").call(this,e),this._emit("connect"))}get ended(){return Ie(this,Fae,"f")}get errored(){return Ie(this,ePe,"f")}get aborted(){return Ie(this,tPe,"f")}abort(){this.controller.abort()}on(e,r){return(Ie(this,jD,"f")[e]||(Ie(this,jD,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Ie(this,jD,"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(Ie(this,jD,"f")[e]||(Ie(this,jD,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{yr(this,M9,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){yr(this,M9,!0,"f"),await Ie(this,$ae,"f")}get currentMessage(){return Ie(this,Sq,"f")}async finalMessage(){return await this.done(),Ie(this,y0,"m",Vst).call(this)}async finalText(){return await this.done(),Ie(this,y0,"m",Mvr).call(this)}_emit(e,...r){if(Ie(this,Fae,"f"))return;e==="end"&&(yr(this,Fae,!0,"f"),Ie(this,QEe,"f").call(this));let n=Ie(this,jD,"f")[e];if(n&&(Ie(this,jD,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Ie(this,M9,"f")&&!n?.length&&Promise.reject(o),Ie(this,jae,"f").call(this,o),Ie(this,Lae,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Ie(this,M9,"f")&&!n?.length&&Promise.reject(o),Ie(this,jae,"f").call(this,o),Ie(this,Lae,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",Ie(this,y0,"m",Vst).call(this))}async _fromReadableStream(e,r){let n=r?.signal,o;n&&(n.aborted&&this.controller.abort(),o=this.controller.abort.bind(this.controller),n.addEventListener("abort",o));try{Ie(this,y0,"m",Wst).call(this),this._connected(null);let i=pA.fromReadableStream(e,this.controller);for await(let a of i)Ie(this,y0,"m",Jst).call(this,a);if(i.controller.signal?.aborted)throw new Wg;Ie(this,y0,"m",Kst).call(this)}finally{n&&o&&n.removeEventListener("abort",o)}}[(Sq=new WeakMap,Dae=new WeakMap,YEe=new WeakMap,jae=new WeakMap,$ae=new WeakMap,QEe=new WeakMap,Lae=new WeakMap,jD=new WeakMap,Fae=new WeakMap,ePe=new WeakMap,tPe=new WeakMap,M9=new WeakMap,rPe=new WeakMap,nPe=new WeakMap,Hst=new WeakMap,y0=new WeakSet,Vst=function(){if(this.receivedMessages.length===0)throw new ln("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Mvr=function(){if(this.receivedMessages.length===0)throw new ln("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 ln("stream ended without producing a content block with type=text");return r.join(" ")},Wst=function(){this.ended||yr(this,Sq,void 0,"f")},Jst=function(r){if(this.ended)return;let n=Ie(this,y0,"m",Rvr).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":{Avr(o)&&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":{yr(this,Sq,n,"f");break}case"content_block_start":case"message_delta":break}},Kst=function(){if(this.ended)throw new ln("stream has ended, this shouldn't happen");let r=Ie(this,Sq,"f");if(!r)throw new ln("request ended without sending any chunks");return yr(this,Sq,void 0,"f"),r},Rvr=function(r){let n=Ie(this,Sq,"f");if(r.type==="message_start"){if(n)throw new ln(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new ln(`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,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),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"&&(n.content[r.index]={...o,text:(o.text||"")+r.delta.text});break}case"citations_delta":{o?.type==="text"&&(n.content[r.index]={...o,citations:[...o.citations??[],r.delta.citation]});break}case"input_json_delta":{if(o&&Avr(o)){let i=o[Ivr]||"";i+=r.delta.partial_json;let a={...o};Object.defineProperty(a,Ivr,{value:i,enumerable:!1,writable:!0}),i&&(a.input=BEe(i)),n.content[r.index]=a}break}case"thinking_delta":{o?.type==="thinking"&&(n.content[r.index]={...o,thinking:o.thinking+r.delta.thinking});break}case"signature_delta":{o?.type==="thinking"&&(n.content[r.index]={...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 pA(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var R9,Gst=v(()=>{mA();bq();hA();Rst();Oae();v9();R9=class extends Md{create(e,r){return this._client.post("/v1/messages/batches",{body:e,...r})}retrieve(e,r){return this._client.get(Jy`/v1/messages/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/v1/messages/batches",h0,{query:e,...r})}delete(e,r){return this._client.delete(Jy`/v1/messages/batches/${e}`,r)}cancel(e,r){return this._client.post(Jy`/v1/messages/batches/${e}/cancel`,r)}async results(e,r){let n=await this.retrieve(e);if(!n.results_url)throw new ln(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...r,headers:aa([{Accept:"application/binary"},r?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((o,i)=>C9.fromResponse(i.response,i.controller))}}});var Cq,Dvr,Xst=v(()=>{mA();Nvr();Gst();Gst();Fst();Cq=class extends Md{constructor(){super(...arguments),this.batches=new R9(this._client)}create(e,r){e.model in Dvr&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${Dvr[e.model]}
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let n=this._client._options.timeout;if(!e.stream&&n==null){let o=XEe[e.model]??void 0;n=this._client.calculateNonstreamingTimeout(e.max_tokens,o)}return this._client.post("/v1/messages",{body:e,timeout:n??6e5,...r,stream:e.stream??!1})}stream(e,r){return oPe.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},Dvr={"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-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-5-sonnet-20241022":"October 22, 2025","claude-3-5-sonnet-20240620":"October 22, 2025"};Cq.Batches=R9});var gH,Zst=v(()=>{mA();bq();hA();v9();gH=class extends Md{retrieve(e,r={},n){let{betas:o}=r??{};return this._client.get(Jy`/v1/models/${e}`,{...n,headers:aa([{...o?.toString()!=null?{"anthropic-beta":o?.toString()}:void 0},n?.headers])})}list(e={},r){let{betas:n,...o}=e??{};return this._client.getAPIList("/v1/models",h0,{query:o,...r,headers:aa([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}}});var jvr=v(()=>{bvr();Ust();zst();Xst();Zst()});var kae,$vr=v(()=>{kae=t=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()}});var Yst,Qst,iPe,Lvr,Fvr,kvr,xc,bA,eut=v(()=>{MD();J_r();dH();Q_r();l9();fst();_9();uvr();dst();Nx();bq();Est();jvr();LEe();zst();Zst();Ust();Xst();fst();hA();$vr();jEe();dH();Fvr="\\n\\nHuman:",kvr="\\n\\nAssistant:",xc=class{constructor({baseURL:e=kae("ANTHROPIC_BASE_URL"),apiKey:r=kae("ANTHROPIC_API_KEY")??null,authToken:n=kae("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){Yst.add(this),iPe.set(this,void 0);let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&nvr())throw new ln(`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 });
`);this.baseURL=i.baseURL,this.timeout=i.timeout??Qst.DEFAULT_TIMEOUT,this.logger=i.logger??console;let a="warn";this.logLevel=a,this.logLevel=yst(i.logLevel,"ClientOptions.logLevel",this)??yst(kae("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??a,this.fetchOptions=i.fetchOptions,this.maxRetries=i.maxRetries??2,this.fetch=i.fetch??ivr(),yr(this,iPe,svr,"f"),this._options=i,this.apiKey=r,this.authToken=n}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){if(!(this.apiKey&&e.get("x-api-key"))&&!r.has("x-api-key")&&!(this.authToken&&e.get("authorization"))&&!r.has("authorization"))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')}async authHeaders(e){return aa([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey!=null)return aa([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return aa([{Authorization:`Bearer ${this.authToken}`}])}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 ln(`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("&")}getUserAgent(){return`${this.constructor.name}/JS ${yq}`}defaultIdempotencyKey(){return`stainless-node-retry-${sst()}`}makeStatusError(e,r,n,o){return Bh.generate(e,r,n,o)}buildURL(e,r,n){let o=!Ie(this,Yst,"m",Lvr).call(this)&&n||this.baseURL,i=K_r(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return G_r(a)||(r={...a,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new ln("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600*1e3}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(o=>({method:e,path:r,...o})))}request(e,r=null){return new fH(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,i=o.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(o);let{req:a,url:s,timeout:u}=await this.buildRequest(o,{retryCount:i-r});await this.prepareRequest(a,{url:s,options:o});let l="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),c=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if(Uh(this).debug(`[${l}] sending request`,AD({retryOfRequestLogID:n,method:o.method,url:s,options:o,headers:a.headers})),o.signal?.aborted)throw new Wg;let f=new AbortController,p=await this.fetchWithTimeout(s,a,u,f).catch(bae),m=Date.now();if(p instanceof globalThis.Error){let g=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new Wg;let b=RD(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return Uh(this).info(`[${l}] connection ${b?"timed out":"failed"} - ${g}`),Uh(this).debug(`[${l}] connection ${b?"timed out":"failed"} (${g})`,AD({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??l);throw Uh(this).info(`[${l}] connection ${b?"timed out":"failed"} - error; no more retries left`),Uh(this).debug(`[${l}] connection ${b?"timed out":"failed"} (error; no more retries left)`,AD({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),b?new c9:new gq({cause:p})}let h=[...p.headers.entries()].filter(([g])=>g==="request-id").map(([g,b])=>", "+g+": "+JSON.stringify(b)).join(""),y=`[${l}${c}${h}] ${a.method} ${s} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let g=await this.shouldRetry(p);if(r&&g){let E=`retrying, ${r} attempts remaining`;return await avr(p.body),Uh(this).info(`${y} - ${E}`),Uh(this).debug(`[${l}] response error (${E})`,AD({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??l,p.headers)}let b=g?"error; no more retries left":"error; not retryable";Uh(this).info(`${y} - ${b}`);let _=await p.text().catch(E=>bae(E).message),w=IEe(_),T=w?void 0:_;throw Uh(this).debug(`[${l}] response error (${b})`,AD({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:T,durationMs:Date.now()-d})),this.makeStatusError(p.status,w,T,p.headers)}return Uh(this).info(y),Uh(this).debug(`[${l}] response start`,AD({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),{response:p,options:o,controller:f,requestLogID:l,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new xae(this,n,e)}async fetchWithTimeout(e,r,n,o){let{signal:i,method:a,...s}=r||{};i&&i.addEventListener("abort",()=>o.abort());let u=setTimeout(()=>o.abort(),n),l=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body=="object"&&s.body!==null&&Symbol.asyncIterator in s.body,c={signal:o.signal,...l?{duplex:"half"}:{},method:"GET",...s};a&&(c.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,c)}finally{clearTimeout(u)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,o){let i,a=o?.get("retry-after-ms");if(a){let u=parseFloat(a);Number.isNaN(u)||(i=u)}let s=o?.get("retry-after");if(s&&!i){let u=parseFloat(s);Number.isNaN(u)?i=Date.parse(s)-Date.now():i=u*1e3}if(!(i&&0<=i&&i<60*1e3)){let u=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,u)}return await Y_r(i),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}calculateNonstreamingTimeout(e,r){if(36e5*e/128e3>6e5||r!=null&&e>r)throw new ln("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 6e5}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:a,defaultBaseURL:s}=n,u=this.buildURL(i,a,s);"timeout"in n&&Z_r("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:l,body:c}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:l,retryCount:r});return{req:{method:o,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&c instanceof globalThis.ReadableStream&&{duplex:"half"},...c&&{body:c},...this.fetchOptions??{},...n.fetchOptions??{}},url:u,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let a=aa([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...ovr(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=aa([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:AEe(e)}:Ie(this,iPe,"f").call(this,{body:e,headers:n})}};Qst=xc,iPe=new WeakMap,Yst=new WeakSet,Lvr=function(){return this.baseURL!=="https://api.anthropic.com"};xc.Anthropic=Qst;xc.HUMAN_PROMPT=Fvr;xc.AI_PROMPT=kvr;xc.DEFAULT_TIMEOUT=6e5;xc.AnthropicError=ln;xc.APIError=Bh;xc.APIConnectionError=gq;xc.APIConnectionTimeoutError=c9;xc.APIUserAbortError=Wg;xc.NotFoundError=m9;xc.ConflictError=h9;xc.RateLimitError=y9;xc.BadRequestError=d9;xc.AuthenticationError=f9;xc.InternalServerError=b9;xc.PermissionDeniedError=p9;xc.UnprocessableEntityError=g9;xc.toFile=qEe;bA=class extends xc{constructor(){super(...arguments),this.completions=new hH(this),this.messages=new Cq(this),this.models=new gH(this),this.beta=new yA(this)}};bA.Completions=hH;bA.Messages=Cq;bA.Models=gH;bA.Beta=yA});var qvr=v(()=>{eut();Est();LEe();eut();bq();Nx()});function Cpo(t){return t?Object.entries(Spo).find(([r])=>t.startsWith(r))?.[1]??Bvr:Bvr}function xpo(t){return!!(t.tools&&t.tools.length>0)}function Tpo(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 Opo(t){return!!(t.thinking&&t.thinking.type==="enabled")}function Epo(t){return"input_schema"in t}function Ppo(t){let e=["text_editor_","computer_","bash_","web_search_","web_fetch_","str_replace_editor_","str_replace_based_edit_tool_","code_execution_","memory_"];return typeof t=="object"&&t!==null&&"type"in t&&"name"in t&&typeof t.type=="string"&&e.some(r=>typeof t.type=="string"&&t.type.startsWith(r))}function Mpo(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]&&typeof t.content[0].text=="string")return t.content[0].text}var Spo,Bvr,Uvr,tut,zvr=v(()=>{tst();M_r();ist();H_r();W_r();qvr();ra();xm();su();aD();rv();Sy();Qv();nv();iD();Spo={"claude-opus-4-1":8192,"claude-opus-4":8192,"claude-sonnet-4":8192,"claude-sonnet-3-7-sonnet":8192,"claude-3-5-sonnet":4096,"claude-3-5-haiku":4096,"claude-3-haiku":2048},Bvr=2048;Uvr=class extends Vy{constructor(e){super(e??{});x(this,"lc_serializable",!0);x(this,"anthropicApiKey");x(this,"apiKey");x(this,"apiUrl");x(this,"temperature");x(this,"topK");x(this,"topP");x(this,"maxTokens");x(this,"modelName","claude-3-5-sonnet-latest");x(this,"model","claude-3-5-sonnet-latest");x(this,"invocationKwargs");x(this,"stopSequences");x(this,"streaming",!1);x(this,"clientOptions");x(this,"thinking",{type:"disabled"});x(this,"contextManagement");x(this,"batchClient");x(this,"streamingClient");x(this,"streamUsage",!0);x(this,"createClient");if(this.anthropicApiKey=e?.apiKey??e?.anthropicApiKey??un("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.topP=e?.topP??this.topP,this.temperature=e?.temperature??this.temperature,this.topK=e?.topK??this.topK,this.maxTokens=e?.maxTokens??Cpo(this.model),this.stopSequences=e?.stopSequences??this.stopSequences,this.streaming=e?.streaming??!1,this.streamUsage=e?.streamUsage??this.streamUsage,this.thinking=e?.thinking??this.thinking,this.contextManagement=e?.contextManagement??this.contextManagement,this.createClient=e?.createClient??(r=>new bA(r))}static lc_name(){return"ChatAnthropic"}get lc_secrets(){return{anthropicApiKey:"ANTHROPIC_API_KEY",apiKey:"ANTHROPIC_API_KEY"}}get lc_aliases(){return{modelName:"model"}}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(Ppo(r)||Epo(r))return r;if(i0(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(zb(r))return{name:r.name,description:r.description,input_schema:Hi(r.schema)?Ii(r.schema):r.schema};throw new Error(`Unknown tool type passed to ChatAnthropic: ${JSON.stringify(r,null,2)}`)})}bindTools(e,r){return this.withConfig({tools:this.formatStructuredToolToAnthropic(e),...r})}invocationParams(e){let r=P_r(e?.tool_choice);if(this.thinking.type==="enabled"){if(this.topP!==void 0&&this.topK!==-1)throw new Error("topK is not supported when thinking is enabled");if(this.temperature!==void 0&&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,context_management:this.contextManagement,...this.invocationKwargs,container:e?.container}}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,context_management:this.contextManagement,...this.invocationKwargs,container:e?.container}}_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=MEe(e),a={...o,...i,stream:!0},s=!xpo(a)&&!Tpo(a)&&!Opo(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=z_r(l,{streamUsage:c,coerceContentToString:s});if(!d)continue;let{chunk:f}=d,p=Mpo(f),m=new Mi({message:new Hr({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,...MEe(e)},n),{content:i,...a}=o,s=V_r(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 ast(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 ast(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(Hi(n)){let m=Ii(n);l=[{name:s,description:m.description??"A function available to call.",input_schema:m}],u=new Qat({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 Qat({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.withConfig({outputVersion:"v0",tools:l,ls_structured_output_format:{kwargs:{method:"functionCalling"},schema:Ii(n)}});let h=y=>{if(!y.tool_calls||y.tool_calls.length===0)throw new Error(m);return y};c=c.pipe(h)}else c=this.withConfig({outputVersion:"v0",tools:l,tool_choice:{type:"tool",name:s},ls_structured_output_format:{kwargs:{method:"functionCalling"},schema:Ii(n)}});if(!a)return c.pipe(u).withConfig({runName:"ChatAnthropicStructuredOutput"});let d=pl.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=pl.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return gc.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},tut=class extends Uvr{}});var Vvr=v(()=>{ist()});var Hvr=v(()=>{zvr();Vvr()});var rut,Wvr=v(()=>{su();CD();rut=class extends iA{constructor(e){let r=e?.apiKey||un("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}});x(this,"lc_serializable",!0);x(this,"lc_namespace",["langchain","chat_models","deepseek"])}static lc_name(){return"ChatDeepSeek"}_llmType(){return"deepseek"}get lc_secrets(){return{apiKey:"DEEPSEEK_API_KEY"}}_convertCompletionsDeltaToBaseMessageChunk(e,r,n){let o=super._convertCompletionsDeltaToBaseMessageChunk(e,r,n);return o.additional_kwargs.reasoning_content=e.reasoning_content,o}_convertCompletionsMessageToBaseMessage(e,r){let n=super._convertCompletionsMessageToBaseMessage(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 Jvr=v(()=>{Wvr()});var yH,Kvr=v(()=>{yH="0.19.0"});function Xvr(t,e={auto:!1}){if(Gvr)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(bH)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${bH}'\``);Gvr=e.auto,bH=t.kind,nut=t.fetch,Rpo=t.Request,Ipo=t.Response,Apo=t.Headers,out=t.FormData,Npo=t.Blob,aPe=t.File,iut=t.ReadableStream,aut=t.getMultipartRequestOptions,sut=t.getDefaultAgent,sPe=t.fileFromPath,uut=t.isFsReadStream}var Gvr,bH,nut,Rpo,Ipo,Apo,out,Npo,aPe,iut,aut,sut,sPe,uut,lut=v(()=>{Gvr=!1});var uPe,Zvr=v(()=>{uPe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function Yvr({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 uPe(a)}),getDefaultAgent:a=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/groq/groq-typescript#file-uploads")},isFsReadStream:a=>!1}}var Qvr=v(()=>{Zvr()});var ewr=v(()=>{Qvr()});var cut,qae=v(()=>{lut();ewr();lut();cut=()=>{bH||Xvr(Yvr(),{auto:!0})};cut()});var Jg,zh,_H,xq,I9,Bae,Uae,zae,Vae,Hae,Wae,Jae,Kae,Gae=v(()=>{A9();Jg=class extends Error{},zh=class t extends Jg{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||!o)return new xq({message:n,cause:lPe(r)});let i=r;return e===400?new Bae(e,i,n,o):e===401?new Uae(e,i,n,o):e===403?new zae(e,i,n,o):e===404?new Vae(e,i,n,o):e===409?new Hae(e,i,n,o):e===422?new Wae(e,i,n,o):e===429?new Jae(e,i,n,o):e>=500?new Kae(e,i,n,o):new t(e,i,n,o)}},_H=class extends zh{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},xq=class extends zh{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},I9=class extends xq{constructor({message:e}={}){super({message:e??"Request timed out."})}},Bae=class extends zh{},Uae=class extends zh{},zae=class extends zh{},Vae=class extends zh{},Hae=class extends zh{},Wae=class extends zh{},Jae=class extends zh{},Kae=class extends zh{}});function Lpo(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function twr(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 cPe,dut,N9,rwr=v(()=>{qae();Gae();Gae();cPe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new dut;async function*i(){if(!e.body)throw r.abort(),new Jg("Attempted to iterate over a response with no body");let s=new N9,u=twr(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||u.event==="error"){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 zh(l.error.status_code,l.error,l.error.message,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 N9,s=twr(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 iut({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?.()}})}},dut=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]=Lpo(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},N9=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 Jg(`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 Jg(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Jg("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}};N9.NEWLINE_CHARS=new Set([`
`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);N9.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g});async function mut(t,e,r){if(t=await t,owr(t))return t;if(nwr(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=Xae(o)?[await o.arrayBuffer()]:[o];return new aPe(i,e,r)}let n=await kpo(t);if(e||(e=Bpo(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new aPe(n,e,r)}async function kpo(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Xae(t))e.push(await t.arrayBuffer());else if(Upo(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${qpo(t)}`);return e}function qpo(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function Bpo(t){return fut(t.name)||fut(t.filename)||fut(t.path)?.split(/[\\/]/).pop()}var nwr,owr,Xae,Fpo,fut,Upo,hut,vH,iwr,put,dPe=v(()=>{qae();qae();nwr=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",owr=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Xae(t),Xae=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",Fpo=t=>owr(t)||nwr(t)||uut(t);fut=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},Upo=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",hut=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",vH=async t=>{let e=await iwr(t.body);return aut(e,t)},iwr=async t=>{let e=new out;return await Promise.all(Object.entries(t||{}).map(([r,n])=>put(e,r,n))),e},put=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(Fpo(r)){let n=await mut(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>put(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>put(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}}});async function dwr(t){let{response:e}=t;if(t.options.stream)return D9("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):cPe.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 D9("response",e.status,e.url,e.headers,a),a}let i=await e.text();return D9("response",e.status,e.url,e.headers,i),i}function Kpo(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}function emo(t){if(!t)return!0;for(let e in t)return!1;return!0}function tmo(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function cwr(t,e){for(let r in e){if(!tmo(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 D9(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var Vpo,Hpo,fPe,mPe,hPe,awr,yut,Wpo,Jpo,swr,uwr,lwr,Gpo,Xpo,Zpo,Ypo,Qpo,gut,lPe,but,rmo,fwr,nmo,pPe,A9=v(()=>{Kvr();rwr();Gae();qae();dPe();dPe();Vpo=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},Hpo=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)};cut();mPe=class t extends Promise{constructor(e,r=dwr){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>e(await this.parseResponse(r),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)}},hPe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=gut("maxRetries",r),this.timeout=gut("timeout",n),this.httpAgent=o,this.fetch=i??nut}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...Gpo(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${rmo()}`}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&&Xae(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:hut(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&&gut("timeout",e.timeout),e.timeout=e.timeout??this.timeout;let c=e.httpAgent??this.httpAgent??sut(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 cwr(i,a),cwr(i,r),hut(e.body)&&bH!=="node"&&delete i["content-type"],pPe(a,"x-stainless-retry-count")===void 0&&pPe(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),pPe(a,"x-stainless-timeout")===void 0&&pPe(r,"x-stainless-timeout")===void 0&&e.timeout&&(i["x-stainless-timeout"]=String(e.timeout)),this.validateHeaders(i,r),i}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(r=>[...r])):{...e}:{}}makeStatusError(e,r,n,o){return zh.generate(e,r,n,o)}request(e,r=null){return new mPe(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}),D9("request",a,n,i.headers),n.signal?.aborted)throw new _H;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(lPe);if(l instanceof Error){if(n.signal?.aborted)throw new _H;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new I9:new xq({cause:l})}let c=Wpo(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let y=`retrying, ${r} attempts remaining`;return D9(`response (error; ${y})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(y=>lPe(y).message),f=Xpo(d),p=f?void 0:d;throw D9(`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 yut(this,n,e)}buildURL(e,r){let n=Ypo(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return emo(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 Jg(`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 Qpo(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 ${yH}`}},awr=class{constructor(e,r,n,o){fPe.set(this,void 0),Vpo(this,fPe,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 Jg("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 Hpo(this,fPe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(fPe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},yut=class extends mPe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await dwr(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},Wpo=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),Jpo=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yH,"X-Stainless-OS":uwr(Deno.build.os),"X-Stainless-Arch":swr(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":yH,"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":yH,"X-Stainless-OS":uwr(process.platform),"X-Stainless-Arch":swr(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=Kpo();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":yH,"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":yH,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};swr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",uwr=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"),Gpo=()=>lwr??(lwr=Jpo()),Xpo=t=>{try{return JSON.parse(t)}catch{return}},Zpo=/^[a-z][a-z0-9+.-]*:/i,Ypo=t=>Zpo.test(t),Qpo=t=>new Promise(e=>setTimeout(e,t)),gut=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Jg(`${t} must be an integer`);if(e<0)throw new Jg(`${t} must be a positive integer`);return e},lPe=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)},but=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};rmo=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),fwr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",nmo=t=>typeof t?.get=="function",pPe=(t,e)=>{let r=e.toLowerCase();if(nmo(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 pwr=v(()=>{});var Ql,b0=v(()=>{Ql=class{constructor(e){this._client=e}}});var j9,_ut=v(()=>{b0();j9=class extends Ql{create(e,r){return this._client.post("/openai/v1/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var $9,vut=v(()=>{b0();A9();$9=class extends Ql{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",vH({body:e,...r}))}}});var L9,wut=v(()=>{b0();A9();L9=class extends Ql{create(e,r){return this._client.post("/openai/v1/audio/translations",vH({body:e,...r}))}}});var _A,Sut=v(()=>{b0();_ut();_ut();vut();vut();wut();wut();_A=class extends Ql{constructor(){super(...arguments),this.speech=new j9(this._client),this.transcriptions=new $9(this._client),this.translations=new L9(this._client)}};_A.Speech=j9;_A.Transcriptions=$9;_A.Translations=L9});var wH,Cut=v(()=>{b0();wH=class extends Ql{create(e,r){return this._client.post("/openai/v1/batches",{body:e,...r})}retrieve(e,r){return this._client.get(`/openai/v1/batches/${e}`,r)}list(e){return this._client.get("/openai/v1/batches",e)}cancel(e,r){return this._client.post(`/openai/v1/batches/${e}/cancel`,r)}}});var F9,xut=v(()=>{b0();F9=class extends Ql{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}}});var Tq,Tut=v(()=>{b0();xut();xut();Tq=class extends Ql{constructor(){super(...arguments),this.completions=new F9(this._client)}};Tq.Completions=F9});var SH,Out=v(()=>{b0();SH=class extends Ql{}});var CH,Eut=v(()=>{b0();CH=class extends Ql{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}}});var xH,Put=v(()=>{b0();A9();xH=class extends Ql{create(e,r){return this._client.post("/openai/v1/files",vH({body:e,...r}))}list(e){return this._client.get("/openai/v1/files",e)}delete(e,r){return this._client.delete(`/openai/v1/files/${e}`,r)}content(e,r){return this._client.get(`/openai/v1/files/${e}/content`,r)}info(e,r){return this._client.get(`/openai/v1/files/${e}`,r)}}});var TH,Mut=v(()=>{b0();TH=class extends Ql{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)}}});var mwr=v(()=>{pwr();Sut();Cut();Tut();Out();Eut();Put();Mut()});var hwr,wu,gwr,ywr=v(()=>{A9();Gae();dPe();mwr();Cut();Out();Eut();Put();Mut();Sut();Tut();wu=class extends hPe{constructor({baseURL:e=but("GROQ_BASE_URL"),apiKey:r=but("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new Jg("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&&fwr())throw new Jg(`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 SH(this),this.chat=new Tq(this),this.embeddings=new CH(this),this.audio=new _A(this),this.models=new TH(this),this.batches=new wH(this),this.files=new xH(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}`}}};hwr=wu;wu.Groq=hwr;wu.DEFAULT_TIMEOUT=6e4;wu.GroqError=Jg;wu.APIError=zh;wu.APIConnectionError=xq;wu.APIConnectionTimeoutError=I9;wu.APIUserAbortError=_H;wu.NotFoundError=Vae;wu.ConflictError=Hae;wu.RateLimitError=Jae;wu.BadRequestError=Bae;wu.AuthenticationError=Uae;wu.InternalServerError=Kae;wu.PermissionDeniedError=zae;wu.UnprocessableEntityError=Wae;wu.toFile=mut;wu.fileFromPath=sPe;wu.Completions=SH;wu.Chat=Tq;wu.Embeddings=CH;wu.Audio=_A;wu.Models=TH;wu.Batches=wH;wu.Files=xH;gwr=wu});function fmo(t){if(t.role!=="system"&&t.role!=="assistant"&&t.role!=="user"&&t.role!=="function")throw new Error(`Unsupported message role: ${t.role}. Expected "system", "assistant", "user", or "function"`);return t.role}function _wr(t){switch(t.type){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";case"generic":if(!hy.isInstance(t))throw new Error("Invalid generic chat message");return fmo(t);default:throw new Error(`Unknown message type: ${t.type}`)}}function bwr(t){return t.map(e=>{let r={role:_wr(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 mc(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(bV):(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 pmo(t,e,r){let n=t.tool_calls;switch(t.role){case"assistant":{let o=[],i=[];for(let a of n??[])try{o.push(HI(a,{returnId:!0}))}catch(s){i.push(vx(a,s.message))}return new uo({content:t.content||"",additional_kwargs:{tool_calls:n},tool_calls:o,invalid_tool_calls:i,usage_metadata:e,response_metadata:r})}default:return new hy(t.content||"",t.role??"unknown")}}function mmo(t,e,r,n){let o=t.role??e,i=t.content??"",a;t.function_call?a={function_call:t.function_call}:t.tool_calls?a={tool_calls:t.tool_calls}:a={},t.audio&&(a.audio={...t.audio,index:r.choices[0].index});let s,u=n,l,c=r.x_groq;c?.usage&&(s={input_tokens:c.usage.prompt_tokens,output_tokens:c.usage.completion_tokens,total_tokens:c.usage.total_tokens},l={completion_time:c.usage.completion_time,prompt_time:c.usage.prompt_time,queue_time:c.usage.queue_time,total_time:c.usage.total_time}),c?.id&&(u=c.id);let d={usage:s,timing:l};if(o==="user")return new BT({content:i,response_metadata:d});if(o==="assistant"){let f=[];if(Array.isArray(t.tool_calls))for(let p of t.tool_calls)f.push({name:p.function?.name,args:p.function?.arguments,id:p.id,index:p.index,type:"tool_call_chunk"});return new Hr({content:i,tool_call_chunks:f,additional_kwargs:a,id:u,response_metadata:d})}else return o==="system"?new UT({content:i,response_metadata:d}):o==="developer"?new UT({content:i,response_metadata:d,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new qT({content:i,additional_kwargs:a,name:t.name,response_metadata:d}):o==="tool"?new $L({content:i,additional_kwargs:a,tool_call_id:t.tool_call_id,response_metadata:d}):new kT({content:i,role:o,response_metadata:d})}function hmo(t){if(t)return t==="any"||t==="required"?"required":t==="auto"?"auto":t==="none"?"none":typeof t=="string"?{type:"function",function:{name:t}}:t}var lmo,cmo,dmo,Rut,vwr=v(()=>{Sy();aD();ra();xm();su();nv();ywr();Qv();nO();_V();iD();lmo=["frequency_penalty","function_call","functions","logit_bias","logprobs","max_completion_tokens","max_tokens","n","parallel_tool_calls","presence_penalty","reasoning_format","response_format","seed","service_tier","stop","temperature","tool_choice","top_logprobs","top_p"],cmo=["headers","promptIndex","stream_options","tools"],dmo=[...lmo,...cmo];Rut=class extends Vy{constructor(e){super(e);x(this,"lc_namespace",["langchain","chat_models","groq"]);x(this,"client");x(this,"model");x(this,"temperature",.7);x(this,"stop");x(this,"stopSequences");x(this,"maxTokens");x(this,"streaming",!1);x(this,"apiKey");x(this,"streamUsage",!0);x(this,"topP");x(this,"frequencyPenalty");x(this,"presencePenalty");x(this,"logprobs");x(this,"n");x(this,"logitBias");x(this,"user");x(this,"reasoningFormat");x(this,"serviceTier");x(this,"topLogprobs");x(this,"lc_serializable",!0);let r=e.apiKey||un("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"');let n={"User-Agent":"langchainjs",...e.defaultHeaders??{}};this.client=new gwr({apiKey:r,dangerouslyAllowBrowser:!0,baseURL:e.baseUrl,timeout:e.timeout,httpAgent:e.httpAgent,fetch:e.fetch,maxRetries:0,defaultHeaders:n,defaultQuery:e.defaultQuery}),this.apiKey=r,this.temperature=e.temperature??this.temperature,this.model=e.model,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,this.topP=e.topP,this.frequencyPenalty=e.frequencyPenalty,this.presencePenalty=e.presencePenalty,this.logprobs=e.logprobs,this.n=e.n,this.logitBias=e.logitBias,this.user=e.user}get lc_serialized_keys(){return["client","model","temperature","stop","stopSequences","maxTokens","streaming","apiKey","streamUsage","topP","frequencyPenalty","presencePenalty","logprobs","n","logitBias","user","reasoningFormat","serviceTier","topLogprobs"]}static lc_name(){return"ChatGroq"}_llmType(){return"groq"}get lc_secrets(){return{apiKey:"GROQ_API_KEY"}}get callKeys(){return[...super.callKeys,...dmo]}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,r){let n=super.invocationParams(e),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,frequency_penalty:this.frequencyPenalty,function_call:e?.function_call,functions:e?.functions,logit_bias:this.logitBias,logprobs:this.logprobs,n:this.n,parallel_tool_calls:e?.parallel_tool_calls,presence_penalty:this.presencePenalty,reasoning_format:this.reasoningFormat,response_format:e?.response_format,seed:e?.seed,service_tier:this.serviceTier,stop:e?.stop??this.stopSequences,temperature:e?.temperature??this.temperature,tool_choice:hmo(e?.tool_choice),tools:e?.tools?.length?e.tools.map(a=>Rk(a)):void 0,top_logprobs:this.topLogprobs,top_p:this.topP,user:this.user,stream:this.streaming,...n,...o};return i.max_completion_tokens=e?.max_completion_tokens??e?.max_tokens??this.maxTokens,i.max_completion_tokens===-1&&delete i.max_completion_tokens,i}bindTools(e,r){return this.withConfig({tools:e.map(n=>Rk(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r,{streaming:!0}),i=bwr(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 f=mmo(d.delta,s,c,u),p={prompt:r.promptIndex??0,completion:d.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};d.finish_reason!=null&&(m.finish_reason=d.finish_reason,m.system_fingerprint=c.system_fingerprint,m.model_name=c.model);let h=new Mi({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(l&&("choices"in l&&delete l.choices,yield new Mi({message:new Hr({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=bwr(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{choices:f,...p}=s,m={text:c,message:pmo(l.message??{role:"assistant"},d,p)};m.generationInfo={...l.finish_reason?{finish_reason:l.finish_reason}:{},...l.logprobs?{logprobs:l.logprobs}:{}},u.push(m)}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"){let p;Hi(n)?(u=jC.fromZodSchema(n),p=Ii(n)):u=new ew,l=this.withConfig({response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"jsonMode"},schema:p}})}else if(Hi(n)){let p=Ii(n);l=this.bindTools([{type:"function",function:{name:s,description:p.description,parameters:p}}]).withConfig({tool_choice:{type:"function",function:{name:s}},ls_structured_output_format:{kwargs:{method:"functionCalling"},schema:p}}),u=new Ow({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.bindTools([{type:"function",function:p}]).withConfig({tool_choice:{type:"function",function:{name:s}},ls_structured_output_format:{kwargs:{method:"functionCalling"},schema:n}}),u=new Ow({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=pl.assign({parsed:(p,m)=>u.invoke(p.raw,m)}),d=pl.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return gc.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}}});var wwr=v(()=>{vwr()});function ymo(t){return gmo.test(t)}function bmo(t){let e=t,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";if(e===0)return r[0];let n=[],o=62;for(;e;)n.push(r[e%o]),e=Math.floor(e/o);return n.reverse().join("")}function _mo(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 Zae(t){if(ymo(t))return t;{let e=_mo(t),r=bmo(e);return r.length>=9?r.slice(0,9):r.padStart(9,"0")}}function Iut(t){return t?typeof t=="string"?t:t.map(e=>{if(e.type==="image_url"){if(typeof e.imageUrl!="string"&&e.imageUrl?.detail){let{detail:r}=e.imageUrl;if(r!=="high"&&r!=="auto"&&r!=="low")return{type:e.type,image_url:{url:e.imageUrl.url}}}return{type:e.type,image_url:e.imageUrl}}return e}):""}var gmo,Swr=v(()=>{gmo=/^[a-zA-Z0-9]{9}$/});function Cwr(t,e=0){return(Kg[t[e+0]]+Kg[t[e+1]]+Kg[t[e+2]]+Kg[t[e+3]]+"-"+Kg[t[e+4]]+Kg[t[e+5]]+"-"+Kg[t[e+6]]+Kg[t[e+7]]+"-"+Kg[t[e+8]]+Kg[t[e+9]]+"-"+Kg[t[e+10]]+Kg[t[e+11]]+Kg[t[e+12]]+Kg[t[e+13]]+Kg[t[e+14]]+Kg[t[e+15]]).toLowerCase()}var Kg,yPe,xwr=v(()=>{Kg=[];for(yPe=0;yPe<256;++yPe)Kg.push((yPe+256).toString(16).slice(1))});function Aut(){if(!bPe&&(bPe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!bPe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return bPe(vmo)}var bPe,vmo,Twr=v(()=>{vmo=new Uint8Array(16)});var wmo,Nut,Owr=v(()=>{wmo=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Nut={randomUUID:wmo}});function Smo(t,e,r){if(Nut.randomUUID&&!e&&!t)return Nut.randomUUID();t=t||{};var n=t.random||(t.rng||Aut)();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 Cwr(n)}var _Pe,Ewr=v(()=>{Owr();Twr();xwr();_Pe=Smo});var Pwr=v(()=>{Ewr()});var mr=S(Dut=>{"use strict";Object.defineProperty(Dut,"__esModule",{value:!0});Dut.pathToFunc=xmo;var Cmo=Object.prototype.hasOwnProperty;function xmo(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!Cmo.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 vPe=S(_0=>{"use strict";Object.defineProperty(_0,"__esModule",{value:!0});_0.SDK_METADATA=_0.ServerList=_0.ServerEu=void 0;_0.serverURLFromOptions=Omo;var Tmo=mr();_0.ServerEu="eu";_0.ServerList={[_0.ServerEu]:"https://api.mistral.ai"};function Omo(t){let e=t.serverURL,r={};if(!e){let o=t.server??_0.ServerEu;e=_0.ServerList[o]||""}let n=(0,Tmo.pathToFunc)(e)(r);return new URL(n)}_0.SDK_METADATA={language:"typescript",openapiDocVersion:"1.0.0",sdkVersion:"1.10.0",genVersion:"2.687.13",userAgent:"speakeasy-sdk/typescript 1.10.0 2.687.13 1.0.0 @mistralai/mistralai"}});var k9=S(wPe=>{"use strict";Object.defineProperty(wPe,"__esModule",{value:!0});wPe.readableStreamToArrayBuffer=Emo;wPe.getContentTypeFromFileName=Pmo;async function Emo(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}function Pmo(t){if(!t)return null;let e=t.toLowerCase().split(".").pop();return e&&{json:"application/json",xml:"application/xml",html:"text/html",htm:"text/html",txt:"text/plain",csv:"text/csv",pdf:"application/pdf",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",svg:"image/svg+xml",js:"application/javascript",css:"text/css",zip:"application/zip",tar:"application/x-tar",gz:"application/gzip",mp4:"video/mp4",mp3:"audio/mpeg",wav:"audio/wav",webp:"image/webp",ico:"image/x-icon",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",otf:"font/otf"}[e]||null}});var q9=S(vA=>{"use strict";Object.defineProperty(vA,"__esModule",{value:!0});vA.HTTPClient=void 0;vA.matchContentType=Rwr;vA.matchStatusCode=Iwr;vA.matchResponse=Imo;vA.isConnectionError=Amo;vA.isTimeoutError=Nmo;vA.isAbortError=Dmo;var Mmo=(t,e)=>e==null?fetch(t):fetch(t,e),jut=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||Mmo}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}};vA.HTTPClient=jut;var Mwr=/\s*;\s*/g;function Rwr(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(Mwr),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(Mwr),[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 Rmo=new RegExp("^[0-9]xx$","i");function Iwr(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(!Rmo.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 Imo(t,e,r){return Iwr(t,e)&&Rwr(t,r)}function Amo(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 Nmo(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 Dmo(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 Awr=S(SPe=>{"use strict";Object.defineProperty(SPe,"__esModule",{value:!0});SPe.CustomUserAgentHook=void 0;var jmo=vPe(),$ut=class{beforeRequest(e,r){let o=`mistral-client-typescript/${jmo.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};SPe.CustomUserAgentHook=$ut});var Dwr=S(CPe=>{"use strict";Object.defineProperty(CPe,"__esModule",{value:!0});CPe.DeprecationWarningHook=void 0;var Nwr="x-model-deprecation-timestamp",Lut=class{afterSuccess(e,r){return r.headers.has(Nwr)&&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(Nwr)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};CPe.DeprecationWarningHook=Lut});var jwr=S(Fut=>{"use strict";Object.defineProperty(Fut,"__esModule",{value:!0});Fut.initHooks=Fmo;var $mo=Awr(),Lmo=Dwr();function Fmo(t){let e=new $mo.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new Lmo.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var $wr=S(xPe=>{"use strict";Object.defineProperty(xPe,"__esModule",{value:!0});xPe.SDKHooks=void 0;var kmo=jwr(),kut=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,kmo.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}}};xPe.SDKHooks=kut});var Hut=S(sv=>{"use strict";Object.defineProperty(sv,"__esModule",{value:!0});sv.ConnectionError=sv.RequestTimeoutError=sv.RequestAbortedError=sv.InvalidRequestError=sv.UnexpectedClientError=sv.HTTPClientError=void 0;var Oq=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)}};sv.HTTPClientError=Oq;var qut=class extends Oq{constructor(){super(...arguments),this.name="UnexpectedClientError"}};sv.UnexpectedClientError=qut;var But=class extends Oq{constructor(){super(...arguments),this.name="InvalidRequestError"}};sv.InvalidRequestError=But;var Uut=class extends Oq{constructor(){super(...arguments),this.name="RequestAbortedError"}};sv.RequestAbortedError=Uut;var zut=class extends Oq{constructor(){super(...arguments),this.name="RequestTimeoutError"}};sv.RequestTimeoutError=zut;var Vut=class extends Oq{constructor(){super(...arguments),this.name="ConnectionError"}};sv.ConnectionError=Vut});var Rd=S(B9=>{"use strict";Object.defineProperty(B9,"__esModule",{value:!0});B9.OK=qmo;B9.ERR=Bmo;B9.unwrap=Umo;B9.unwrapAsync=zmo;function qmo(t){return{ok:!0,value:t}}function Bmo(t){return{ok:!1,error:t}}function Umo(t){if(!t.ok)throw t.error;return t.value}async function zmo(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var Yae=S(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.getParsedType=el.ZodParsedType=el.objectUtil=el.util=void 0;var Wut;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Wut||(el.util=Wut={}));var Lwr;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Lwr||(el.objectUtil=Lwr={}));el.ZodParsedType=Wut.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Vmo=t=>{switch(typeof t){case"undefined":return el.ZodParsedType.undefined;case"string":return el.ZodParsedType.string;case"number":return Number.isNaN(t)?el.ZodParsedType.nan:el.ZodParsedType.number;case"boolean":return el.ZodParsedType.boolean;case"function":return el.ZodParsedType.function;case"bigint":return el.ZodParsedType.bigint;case"symbol":return el.ZodParsedType.symbol;case"object":return Array.isArray(t)?el.ZodParsedType.array:t===null?el.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?el.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?el.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?el.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?el.ZodParsedType.date:el.ZodParsedType.object;default:return el.ZodParsedType.unknown}};el.getParsedType=Vmo});var TPe=S(Eq=>{"use strict";Object.defineProperty(Eq,"__esModule",{value:!0});Eq.ZodError=Eq.quotelessJson=Eq.ZodIssueCode=void 0;var Fwr=Yae();Eq.ZodIssueCode=Fwr.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 Hmo=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");Eq.quotelessJson=Hmo;var Qae=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,Fwr.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Eq.ZodError=Qae;Qae.create=t=>new Qae(t)});var Kut=S(Jut=>{"use strict";Object.defineProperty(Jut,"__esModule",{value:!0});var Ky=TPe(),OH=Yae(),Wmo=(t,e)=>{let r;switch(t.code){case Ky.ZodIssueCode.invalid_type:t.received===OH.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Ky.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,OH.util.jsonStringifyReplacer)}`;break;case Ky.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${OH.util.joinValues(t.keys,", ")}`;break;case Ky.ZodIssueCode.invalid_union:r="Invalid input";break;case Ky.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${OH.util.joinValues(t.options)}`;break;case Ky.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${OH.util.joinValues(t.options)}, received '${t.received}'`;break;case Ky.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case Ky.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case Ky.ZodIssueCode.invalid_date:r="Invalid date";break;case Ky.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}"`:OH.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Ky.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Ky.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 Ky.ZodIssueCode.custom:r="Invalid input";break;case Ky.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case Ky.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Ky.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,OH.util.assertNever(t)}return{message:r}};Jut.default=Wmo});var OPe=S(Pq=>{"use strict";var Jmo=Pq&&Pq.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pq,"__esModule",{value:!0});Pq.defaultErrorMap=void 0;Pq.setErrorMap=Kmo;Pq.getErrorMap=Gmo;var kwr=Jmo(Kut());Pq.defaultErrorMap=kwr.default;var qwr=kwr.default;function Kmo(t){qwr=t}function Gmo(){return qwr}});var Xut=S(pu=>{"use strict";var Xmo=pu&&pu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pu,"__esModule",{value:!0});pu.isAsync=pu.isValid=pu.isDirty=pu.isAborted=pu.OK=pu.DIRTY=pu.INVALID=pu.ParseStatus=pu.EMPTY_PATH=pu.makeIssue=void 0;pu.addIssueToContext=Qmo;var Zmo=OPe(),Bwr=Xmo(Kut()),Ymo=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}};pu.makeIssue=Ymo;pu.EMPTY_PATH=[];function Qmo(t,e){let r=(0,Zmo.getErrorMap)(),n=(0,pu.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Bwr.default?void 0:Bwr.default].filter(o=>!!o)});t.common.issues.push(n)}var Gut=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 pu.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 pu.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}}};pu.ParseStatus=Gut;pu.INVALID=Object.freeze({status:"aborted"});var eho=t=>({status:"dirty",value:t});pu.DIRTY=eho;var tho=t=>({status:"valid",value:t});pu.OK=tho;var rho=t=>t.status==="aborted";pu.isAborted=rho;var nho=t=>t.status==="dirty";pu.isDirty=nho;var oho=t=>t.status==="valid";pu.isValid=oho;var iho=t=>typeof Promise<"u"&&t instanceof Promise;pu.isAsync=iho});var zwr=S(Uwr=>{"use strict";Object.defineProperty(Uwr,"__esModule",{value:!0})});var Hwr=S(EPe=>{"use strict";Object.defineProperty(EPe,"__esModule",{value:!0});EPe.errorUtil=void 0;var Vwr;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Vwr||(EPe.errorUtil=Vwr={}))});var nSr=S(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.discriminatedUnion=xe.date=xe.boolean=xe.bigint=xe.array=xe.any=xe.coerce=xe.ZodFirstPartyTypeKind=xe.late=xe.ZodSchema=xe.Schema=xe.ZodReadonly=xe.ZodPipeline=xe.ZodBranded=xe.BRAND=xe.ZodNaN=xe.ZodCatch=xe.ZodDefault=xe.ZodNullable=xe.ZodOptional=xe.ZodTransformer=xe.ZodEffects=xe.ZodPromise=xe.ZodNativeEnum=xe.ZodEnum=xe.ZodLiteral=xe.ZodLazy=xe.ZodFunction=xe.ZodSet=xe.ZodMap=xe.ZodRecord=xe.ZodTuple=xe.ZodIntersection=xe.ZodDiscriminatedUnion=xe.ZodUnion=xe.ZodObject=xe.ZodArray=xe.ZodVoid=xe.ZodNever=xe.ZodUnknown=xe.ZodAny=xe.ZodNull=xe.ZodUndefined=xe.ZodSymbol=xe.ZodDate=xe.ZodBoolean=xe.ZodBigInt=xe.ZodNumber=xe.ZodString=xe.ZodType=void 0;xe.NEVER=xe.void=xe.unknown=xe.union=xe.undefined=xe.tuple=xe.transformer=xe.symbol=xe.string=xe.strictObject=xe.set=xe.record=xe.promise=xe.preprocess=xe.pipeline=xe.ostring=xe.optional=xe.onumber=xe.oboolean=xe.object=xe.number=xe.nullable=xe.null=xe.never=xe.nativeEnum=xe.nan=xe.map=xe.literal=xe.lazy=xe.intersection=xe.instanceof=xe.function=xe.enum=xe.effect=void 0;xe.datetimeRegex=Xwr;xe.custom=Ywr;var xt=TPe(),PPe=OPe(),Kr=Hwr(),Oe=Xut(),kt=Yae(),w0=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Wwr=(t,e)=>{if((0,Oe.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 xt.ZodError(t.common.issues);return this._error=r,this._error}}};function Qo(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}var ei=class{get description(){return this._def.description}_getType(e){return(0,kt.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,kt.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Oe.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,kt.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,Oe.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,kt.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Wwr(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,kt.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return(0,Oe.isValid)(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>(0,Oe.isValid)(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,kt.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,Oe.isAsync)(o)?o:Promise.resolve(o));return Wwr(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:xt.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 Dw({schema:this,typeName:Wn.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 v0.create(this,this._def)}nullable(){return SA.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return FD.create(this)}promise(){return Iq.create(this,this._def)}or(e){return NH.create([this,e],this._def)}and(e){return DH.create(this,e,this._def)}transform(e){return new Dw({...Qo(this._def),schema:this,typeName:Wn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new kH({...Qo(this._def),innerType:this,defaultValue:r,typeName:Wn.ZodDefault})}brand(){return new ese({typeName:Wn.ZodBranded,type:this,...Qo(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new qH({...Qo(this._def),innerType:this,catchValue:r,typeName:Wn.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return tse.create(this,e)}readonly(){return BH.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};xe.ZodType=ei;xe.Schema=ei;xe.ZodSchema=ei;var aho=/^c[^\s-]{8,}$/i,sho=/^[0-9a-z]+$/,uho=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lho=/^[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,cho=/^[a-z0-9_-]{21}$/i,dho=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fho=/^[-+]?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)?)??$/,pho=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mho="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Zut,hho=/^(?:(?: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])$/,gho=/^(?:(?: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])$/,yho=/^(([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]))$/,bho=/^(([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])$/,_ho=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vho=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Kwr="((\\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])))",who=new RegExp(`^${Kwr}$`);function Gwr(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Sho(t){return new RegExp(`^${Gwr(t)}$`)}function Xwr(t){let e=`${Kwr}T${Gwr(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 Cho(t,e){return!!((e==="v4"||!e)&&hho.test(t)||(e==="v6"||!e)&&yho.test(t))}function xho(t,e){if(!dho.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Tho(t,e){return!!((e==="v4"||!e)&&gho.test(t)||(e==="v6"||!e)&&bho.test(t))}var Mq=class t extends ei{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==kt.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(i,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.string,received:i.parsedType}),Oe.INVALID}let n=new Oe.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:xt.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,Oe.addIssueToContext)(o,{code:xt.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,Oe.addIssueToContext)(o,{code:xt.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,Oe.addIssueToContext)(o,{code:xt.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")pho.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"email",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Zut||(Zut=new RegExp(mho,"u")),Zut.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"emoji",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")lho.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"uuid",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")cho.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"nanoid",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")aho.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"cuid",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")sho.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"cuid2",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")uho.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"ulid",code:xt.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,Oe.addIssueToContext)(o,{validation:"url",code:xt.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,Oe.addIssueToContext)(o,{validation:"regex",code:xt.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,Oe.addIssueToContext)(o,{code:xt.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,Oe.addIssueToContext)(o,{code:xt.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,Oe.addIssueToContext)(o,{code:xt.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Xwr(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:xt.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?who.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:xt.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Sho(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:xt.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?fho.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"duration",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Cho(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"ip",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?xho(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"jwt",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Tho(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"cidr",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?_ho.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"base64",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?vho.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"base64url",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):kt.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:xt.ZodIssueCode.invalid_string,...Kr.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Kr.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Kr.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Kr.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Kr.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Kr.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Kr.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Kr.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Kr.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Kr.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Kr.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Kr.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Kr.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Kr.errorUtil.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Kr.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,...Kr.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Kr.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Kr.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Kr.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Kr.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Kr.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Kr.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Kr.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Kr.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,Kr.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}};xe.ZodString=Mq;Mq.create=t=>new Mq({checks:[],typeName:Wn.ZodString,coerce:t?.coerce??!1,...Qo(t)});function Oho(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}var EH=class t extends ei{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)!==kt.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(i,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.number,received:i.parsedType}),Oe.INVALID}let n,o=new Oe.ParseStatus;for(let i of this._def.checks)i.kind==="int"?kt.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,Oe.addIssueToContext)(n,{code:xt.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,Oe.addIssueToContext)(n,{code:xt.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,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Oho(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,Oe.addIssueToContext)(n,{code:xt.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,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.not_finite,message:i.message}),o.dirty()):kt.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Kr.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Kr.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Kr.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Kr.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Kr.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Kr.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Kr.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Kr.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Kr.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Kr.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Kr.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Kr.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Kr.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Kr.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"&&kt.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)}};xe.ZodNumber=EH;EH.create=t=>new EH({checks:[],typeName:Wn.ZodNumber,coerce:t?.coerce||!1,...Qo(t)});var PH=class t extends ei{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)!==kt.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new Oe.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,Oe.addIssueToContext)(n,{code:xt.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,Oe.addIssueToContext)(n,{code:xt.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,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):kt.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.bigint,received:r.parsedType}),Oe.INVALID}gte(e,r){return this.setLimit("min",e,!0,Kr.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Kr.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Kr.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Kr.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Kr.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:Kr.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Kr.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Kr.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Kr.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Kr.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}};xe.ZodBigInt=PH;PH.create=t=>new PH({checks:[],typeName:Wn.ZodBigInt,coerce:t?.coerce??!1,...Qo(t)});var MH=class extends ei{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==kt.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.boolean,received:n.parsedType}),Oe.INVALID}return(0,Oe.OK)(e.data)}};xe.ZodBoolean=MH;MH.create=t=>new MH({typeName:Wn.ZodBoolean,coerce:t?.coerce||!1,...Qo(t)});var RH=class t extends ei{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==kt.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(i,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.date,received:i.parsedType}),Oe.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(i,{code:xt.ZodIssueCode.invalid_date}),Oe.INVALID}let n=new Oe.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:xt.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,Oe.addIssueToContext)(o,{code:xt.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):kt.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:Kr.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Kr.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}};xe.ZodDate=RH;RH.create=t=>new RH({checks:[],coerce:t?.coerce||!1,typeName:Wn.ZodDate,...Qo(t)});var z9=class extends ei{_parse(e){if(this._getType(e)!==kt.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.symbol,received:n.parsedType}),Oe.INVALID}return(0,Oe.OK)(e.data)}};xe.ZodSymbol=z9;z9.create=t=>new z9({typeName:Wn.ZodSymbol,...Qo(t)});var IH=class extends ei{_parse(e){if(this._getType(e)!==kt.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.undefined,received:n.parsedType}),Oe.INVALID}return(0,Oe.OK)(e.data)}};xe.ZodUndefined=IH;IH.create=t=>new IH({typeName:Wn.ZodUndefined,...Qo(t)});var AH=class extends ei{_parse(e){if(this._getType(e)!==kt.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.null,received:n.parsedType}),Oe.INVALID}return(0,Oe.OK)(e.data)}};xe.ZodNull=AH;AH.create=t=>new AH({typeName:Wn.ZodNull,...Qo(t)});var Rq=class extends ei{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,Oe.OK)(e.data)}};xe.ZodAny=Rq;Rq.create=t=>new Rq({typeName:Wn.ZodAny,...Qo(t)});var LD=class extends ei{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,Oe.OK)(e.data)}};xe.ZodUnknown=LD;LD.create=t=>new LD({typeName:Wn.ZodUnknown,...Qo(t)});var Dx=class extends ei{_parse(e){let r=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.never,received:r.parsedType}),Oe.INVALID}};xe.ZodNever=Dx;Dx.create=t=>new Dx({typeName:Wn.ZodNever,...Qo(t)});var V9=class extends ei{_parse(e){if(this._getType(e)!==kt.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.void,received:n.parsedType}),Oe.INVALID}return(0,Oe.OK)(e.data)}};xe.ZodVoid=V9;V9.create=t=>new V9({typeName:Wn.ZodVoid,...Qo(t)});var FD=class t extends ei{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==kt.ZodParsedType.array)return(0,Oe.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.array,received:r.parsedType}),Oe.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,Oe.addIssueToContext)(r,{code:a?xt.ZodIssueCode.too_big:xt.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,Oe.addIssueToContext)(r,{code:xt.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,Oe.addIssueToContext)(r,{code:xt.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 w0(r,a,r.path,s)))).then(a=>Oe.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new w0(r,a,r.path,s)));return Oe.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Kr.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Kr.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Kr.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};xe.ZodArray=FD;FD.create=(t,e)=>new FD({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Wn.ZodArray,...Qo(e)});function U9(t){if(t instanceof uv){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=v0.create(U9(n))}return new uv({...t._def,shape:()=>e})}else return t instanceof FD?new FD({...t._def,type:U9(t.element)}):t instanceof v0?v0.create(U9(t.unwrap())):t instanceof SA?SA.create(U9(t.unwrap())):t instanceof wA?wA.create(t.items.map(e=>U9(e))):t}var uv=class t extends ei{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=kt.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==kt.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(l,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.object,received:l.parsedType}),Oe.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Dx&&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 w0(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Dx){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,Oe.addIssueToContext)(o,{code:xt.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 w0(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=>Oe.ParseStatus.mergeObjectSync(n,l)):Oe.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Kr.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Kr.errorUtil.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Wn.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of kt.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of kt.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return U9(this)}partial(e){let r={};for(let n of kt.util.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of kt.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof v0;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Zwr(kt.util.objectKeys(this.shape))}};xe.ZodObject=uv;uv.create=(t,e)=>new uv({shape:()=>t,unknownKeys:"strip",catchall:Dx.create(),typeName:Wn.ZodObject,...Qo(e)});uv.strictCreate=(t,e)=>new uv({shape:()=>t,unknownKeys:"strict",catchall:Dx.create(),typeName:Wn.ZodObject,...Qo(e)});uv.lazycreate=(t,e)=>new uv({shape:t,unknownKeys:"strip",catchall:Dx.create(),typeName:Wn.ZodObject,...Qo(e)});var NH=class extends ei{_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 xt.ZodError(s.ctx.common.issues));return(0,Oe.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_union,unionErrors:a}),Oe.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 xt.ZodError(u));return(0,Oe.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_union,unionErrors:s}),Oe.INVALID}}get options(){return this._def.options}};xe.ZodUnion=NH;NH.create=(t,e)=>new NH({options:t,typeName:Wn.ZodUnion,...Qo(e)});var $D=t=>t instanceof jH?$D(t.schema):t instanceof Dw?$D(t.innerType()):t instanceof $H?[t.value]:t instanceof LH?t.options:t instanceof FH?kt.util.objectValues(t.enum):t instanceof kH?$D(t._def.innerType):t instanceof IH?[void 0]:t instanceof AH?[null]:t instanceof v0?[void 0,...$D(t.unwrap())]:t instanceof SA?[null,...$D(t.unwrap())]:t instanceof ese||t instanceof BH?$D(t.unwrap()):t instanceof qH?$D(t._def.innerType):[],MPe=class t extends ei{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==kt.ZodParsedType.object)return(0,Oe.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.object,received:r.parsedType}),Oe.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,Oe.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Oe.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=$D(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:Wn.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Qo(n)})}};xe.ZodDiscriminatedUnion=MPe;function Yut(t,e){let r=(0,kt.getParsedType)(t),n=(0,kt.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===kt.ZodParsedType.object&&n===kt.ZodParsedType.object){let o=kt.util.objectKeys(e),i=kt.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=Yut(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===kt.ZodParsedType.array&&n===kt.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=Yut(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===kt.ZodParsedType.date&&n===kt.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var DH=class extends ei{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if((0,Oe.isAborted)(i)||(0,Oe.isAborted)(a))return Oe.INVALID;let s=Yut(i.value,a.value);return s.valid?(((0,Oe.isDirty)(i)||(0,Oe.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_intersection_types}),Oe.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}))}};xe.ZodIntersection=DH;DH.create=(t,e,r)=>new DH({left:t,right:e,typeName:Wn.ZodIntersection,...Qo(r)});var wA=class t extends ei{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==kt.ZodParsedType.array)return(0,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.array,received:n.parsedType}),Oe.INVALID;if(n.data.length<this._def.items.length)return(0,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oe.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,Oe.addIssueToContext)(n,{code:xt.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 w0(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Oe.ParseStatus.mergeArray(r,a)):Oe.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};xe.ZodTuple=wA;wA.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wA({items:t,typeName:Wn.ZodTuple,rest:null,...Qo(e)})};var RPe=class t extends ei{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!==kt.ZodParsedType.object)return(0,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.object,received:n.parsedType}),Oe.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new w0(n,s,n.path,s)),value:a._parse(new w0(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Oe.ParseStatus.mergeObjectAsync(r,o):Oe.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof ei?new t({keyType:e,valueType:r,typeName:Wn.ZodRecord,...Qo(n)}):new t({keyType:Mq.create(),valueType:e,typeName:Wn.ZodRecord,...Qo(r)})}};xe.ZodRecord=RPe;var H9=class extends ei{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!==kt.ZodParsedType.map)return(0,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.map,received:n.parsedType}),Oe.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new w0(n,s,n.path,[l,"key"])),value:i._parse(new w0(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 Oe.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 Oe.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};xe.ZodMap=H9;H9.create=(t,e,r)=>new H9({valueType:e,keyType:t,typeName:Wn.ZodMap,...Qo(r)});var W9=class t extends ei{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==kt.ZodParsedType.set)return(0,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.set,received:n.parsedType}),Oe.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,Oe.addIssueToContext)(n,{code:xt.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,Oe.addIssueToContext)(n,{code:xt.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 Oe.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 w0(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:Kr.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Kr.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};xe.ZodSet=W9;W9.create=(t,e)=>new W9({valueType:t,minSize:null,maxSize:null,typeName:Wn.ZodSet,...Qo(e)});var IPe=class t extends ei{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==kt.ZodParsedType.function)return(0,Oe.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.function,received:r.parsedType}),Oe.INVALID;function n(s,u){return(0,Oe.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,PPe.getErrorMap)(),PPe.defaultErrorMap].filter(l=>!!l),issueData:{code:xt.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,Oe.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,PPe.getErrorMap)(),PPe.defaultErrorMap].filter(l=>!!l),issueData:{code:xt.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Iq){let s=this;return(0,Oe.OK)(async function(...u){let l=new xt.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,Oe.OK)(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new xt.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 xt.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:wA.create(e).rest(LD.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||wA.create([]).rest(LD.create()),returns:r||LD.create(),typeName:Wn.ZodFunction,...Qo(n)})}};xe.ZodFunction=IPe;var jH=class extends ei{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})}};xe.ZodLazy=jH;jH.create=(t,e)=>new jH({getter:t,typeName:Wn.ZodLazy,...Qo(e)});var $H=class extends ei{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(r,{received:r.data,code:xt.ZodIssueCode.invalid_literal,expected:this._def.value}),Oe.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};xe.ZodLiteral=$H;$H.create=(t,e)=>new $H({value:t,typeName:Wn.ZodLiteral,...Qo(e)});function Zwr(t,e){return new LH({values:t,typeName:Wn.ZodEnum,...Qo(e)})}var LH=class t extends ei{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,Oe.addIssueToContext)(r,{expected:kt.util.joinValues(n),received:r.parsedType,code:xt.ZodIssueCode.invalid_type}),Oe.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,Oe.addIssueToContext)(r,{received:r.data,code:xt.ZodIssueCode.invalid_enum_value,options:n}),Oe.INVALID}return(0,Oe.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})}};xe.ZodEnum=LH;LH.create=Zwr;var FH=class extends ei{_parse(e){let r=kt.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==kt.ZodParsedType.string&&n.parsedType!==kt.ZodParsedType.number){let o=kt.util.objectValues(r);return(0,Oe.addIssueToContext)(n,{expected:kt.util.joinValues(o),received:n.parsedType,code:xt.ZodIssueCode.invalid_type}),Oe.INVALID}if(this._cache||(this._cache=new Set(kt.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=kt.util.objectValues(r);return(0,Oe.addIssueToContext)(n,{received:n.data,code:xt.ZodIssueCode.invalid_enum_value,options:o}),Oe.INVALID}return(0,Oe.OK)(e.data)}get enum(){return this._def.values}};xe.ZodNativeEnum=FH;FH.create=(t,e)=>new FH({values:t,typeName:Wn.ZodNativeEnum,...Qo(e)});var Iq=class extends ei{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==kt.ZodParsedType.promise&&r.common.async===!1)return(0,Oe.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.promise,received:r.parsedType}),Oe.INVALID;let n=r.parsedType===kt.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,Oe.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};xe.ZodPromise=Iq;Iq.create=(t,e)=>new Iq({type:t,typeName:Wn.ZodPromise,...Qo(e)});var Dw=class extends ei{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Wn.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,Oe.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 Oe.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?Oe.INVALID:u.status==="dirty"||r.value==="dirty"?(0,Oe.DIRTY)(u.value):u});{if(r.value==="aborted")return Oe.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Oe.INVALID:s.status==="dirty"||r.value==="dirty"?(0,Oe.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"?Oe.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"?Oe.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,Oe.isValid)(a))return Oe.INVALID;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,Oe.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):Oe.INVALID);kt.util.assertNever(o)}};xe.ZodEffects=Dw;xe.ZodTransformer=Dw;Dw.create=(t,e,r)=>new Dw({schema:t,typeName:Wn.ZodEffects,effect:e,...Qo(r)});Dw.createWithPreprocess=(t,e,r)=>new Dw({schema:e,effect:{type:"preprocess",transform:t},typeName:Wn.ZodEffects,...Qo(r)});var v0=class extends ei{_parse(e){return this._getType(e)===kt.ZodParsedType.undefined?(0,Oe.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xe.ZodOptional=v0;v0.create=(t,e)=>new v0({innerType:t,typeName:Wn.ZodOptional,...Qo(e)});var SA=class extends ei{_parse(e){return this._getType(e)===kt.ZodParsedType.null?(0,Oe.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xe.ZodNullable=SA;SA.create=(t,e)=>new SA({innerType:t,typeName:Wn.ZodNullable,...Qo(e)});var kH=class extends ei{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===kt.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};xe.ZodDefault=kH;kH.create=(t,e)=>new kH({innerType:t,typeName:Wn.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Qo(e)});var qH=class extends ei{_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,Oe.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new xt.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new xt.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};xe.ZodCatch=qH;qH.create=(t,e)=>new qH({innerType:t,typeName:Wn.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Qo(e)});var J9=class extends ei{_parse(e){if(this._getType(e)!==kt.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.nan,received:n.parsedType}),Oe.INVALID}return{status:"valid",value:e.data}}};xe.ZodNaN=J9;J9.create=t=>new J9({typeName:Wn.ZodNaN,...Qo(t)});xe.BRAND=Symbol("zod_brand");var ese=class extends ei{_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}};xe.ZodBranded=ese;var tse=class t extends ei{_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"?Oe.INVALID:i.status==="dirty"?(r.dirty(),(0,Oe.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"?Oe.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:Wn.ZodPipeline})}};xe.ZodPipeline=tse;var BH=class extends ei{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,Oe.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,Oe.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};xe.ZodReadonly=BH;BH.create=(t,e)=>new BH({innerType:t,typeName:Wn.ZodReadonly,...Qo(e)});function Jwr(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Ywr(t,e={},r){return t?Rq.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=Jwr(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=Jwr(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):Rq.create()}xe.late={object:uv.lazycreate};var Wn;(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"})(Wn||(xe.ZodFirstPartyTypeKind=Wn={}));var Eho=(t,e={message:`Input not instance of ${t.name}`})=>Ywr(r=>r instanceof t,e);xe.instanceof=Eho;var Qwr=Mq.create;xe.string=Qwr;var eSr=EH.create;xe.number=eSr;var Pho=J9.create;xe.nan=Pho;var Mho=PH.create;xe.bigint=Mho;var tSr=MH.create;xe.boolean=tSr;var Rho=RH.create;xe.date=Rho;var Iho=z9.create;xe.symbol=Iho;var Aho=IH.create;xe.undefined=Aho;var Nho=AH.create;xe.null=Nho;var Dho=Rq.create;xe.any=Dho;var jho=LD.create;xe.unknown=jho;var $ho=Dx.create;xe.never=$ho;var Lho=V9.create;xe.void=Lho;var Fho=FD.create;xe.array=Fho;var kho=uv.create;xe.object=kho;var qho=uv.strictCreate;xe.strictObject=qho;var Bho=NH.create;xe.union=Bho;var Uho=MPe.create;xe.discriminatedUnion=Uho;var zho=DH.create;xe.intersection=zho;var Vho=wA.create;xe.tuple=Vho;var Hho=RPe.create;xe.record=Hho;var Who=H9.create;xe.map=Who;var Jho=W9.create;xe.set=Jho;var Kho=IPe.create;xe.function=Kho;var Gho=jH.create;xe.lazy=Gho;var Xho=$H.create;xe.literal=Xho;var Zho=LH.create;xe.enum=Zho;var Yho=FH.create;xe.nativeEnum=Yho;var Qho=Iq.create;xe.promise=Qho;var rSr=Dw.create;xe.effect=rSr;xe.transformer=rSr;var ego=v0.create;xe.optional=ego;var tgo=SA.create;xe.nullable=tgo;var rgo=Dw.createWithPreprocess;xe.preprocess=rgo;var ngo=tse.create;xe.pipeline=ngo;var ogo=()=>Qwr().optional();xe.ostring=ogo;var igo=()=>eSr().optional();xe.onumber=igo;var ago=()=>tSr().optional();xe.oboolean=ago;xe.coerce={string:t=>Mq.create({...t,coerce:!0}),number:t=>EH.create({...t,coerce:!0}),boolean:t=>MH.create({...t,coerce:!0}),bigint:t=>PH.create({...t,coerce:!0}),date:t=>RH.create({...t,coerce:!0})};xe.NEVER=Oe.INVALID});var Qut=S(S0=>{"use strict";var sgo=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]}),K9=S0&&S0.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sgo(e,t,r)};Object.defineProperty(S0,"__esModule",{value:!0});K9(OPe(),S0);K9(Xut(),S0);K9(zwr(),S0);K9(Yae(),S0);K9(nSr(),S0);K9(TPe(),S0)});var ae=S(lv=>{"use strict";var oSr=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]}),ugo=lv&&lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lgo=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)&&oSr(e,t,r);return ugo(e,t),e},cgo=lv&&lv.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oSr(e,t,r)};Object.defineProperty(lv,"__esModule",{value:!0});lv.z=void 0;var iSr=lgo(Qut());lv.z=iSr;cgo(Qut(),lv);lv.default=iSr});var rlt=S(Vh=>{"use strict";var dgo=Vh&&Vh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fgo=Vh&&Vh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pgo=Vh&&Vh.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dgo(r,e,n[o]);return fgo(r,e),r}}();Object.defineProperty(Vh,"__esModule",{value:!0});Vh.zodInbound=Vh.zodOutbound=void 0;Vh.bytesToBase64=aSr;Vh.bytesFromBase64=elt;Vh.stringToBytes=tlt;Vh.stringFromBytes=sSr;Vh.stringToBase64=mgo;Vh.stringFromBase64=hgo;var APe=pgo(ae());function aSr(t){return btoa(String.fromCodePoint(...t))}function elt(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function tlt(t){return new TextEncoder().encode(t)}function sSr(t){return new TextDecoder().decode(t)}function mgo(t){return aSr(tlt(t))}function hgo(t){return sSr(elt(t))}Vh.zodOutbound=APe.instanceof(Uint8Array).or(APe.string().transform(tlt));Vh.zodInbound=APe.instanceof(Uint8Array).or(APe.string().transform(elt))});var olt=S(nlt=>{"use strict";Object.defineProperty(nlt,"__esModule",{value:!0});nlt.isPlainObject=ggo;function ggo(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 Tr=S(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.encodeDeepObjectQuery=sa.encodePipeDelimitedQuery=sa.encodeSpaceDelimitedQuery=sa.encodeFormQuery=sa.encodeJSONQuery=sa.encodeSimple=sa.encodePipeDelimited=sa.encodeSpaceDelimited=sa.encodeForm=sa.EncodingError=void 0;sa.encodeMatrix=ygo;sa.encodeLabel=bgo;sa.encodeBodyForm=_go;sa.encodeDeepObject=lSr;sa.encodeDeepObjectObject=alt;sa.encodeJSON=cSr;sa.queryJoin=dSr;sa.queryEncoder=X9;sa.appendForm=wgo;var uSr=rlt(),jx=olt(),rse=class extends Error{constructor(e){super(e),this.name="EncodingError"}};sa.EncodingError=rse;function ygo(t,e,r){let n="",o=r?.explode?nse(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(G9(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=ose(u,f=>`${a(f)}`)?.join(","):(0,jx.isPlainObject)(u)?c=DPe(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 bgo(t,e,r){let n="",o=r?.explode?nse(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(G9(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=ose(u,c=>`${a(c)}`)?.join("."):(0,jx.isPlainObject)(u)?l=DPe(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,jx.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function ilt(t){return(e,r,n)=>{let o="",i=n?.explode?nse(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(G9(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=ose(c,p=>`${s(p)}`)?.join(u):(0,jx.isPlainObject)(c)?f=DPe(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)}}sa.encodeForm=ilt(",");sa.encodeSpaceDelimited=ilt(" ");sa.encodePipeDelimited=ilt("|");function _go(t,e,r){let n="",o=r?.explode?nse(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(G9(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,jx.isPlainObject)(u)?c=JSON.stringify(u,NPe):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function lSr(t,e,r){if(e!=null){if(!(0,jx.isPlainObject)(e))throw new rse(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return alt(t,e,r)}}function alt(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,jx.isPlainObject)(e))throw new rse(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,jx.isPlainObject)(a)){let c=alt(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=ose(u,c=>`${o(s)}=${o(G9(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function cSr(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,NPe));return r?.explode?o:`${n(t)}=${o}`}var vgo=(t,e,r)=>{let n="",o=r?.explode?nse(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(G9(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=ose(u,c=>`${a(c)}`)?.join(","):(0,jx.isPlainObject)(u)?l=DPe(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,jx.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};sa.encodeSimple=vgo;function nse(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,jx.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function G9(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,uSr.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,NPe):`${t}`}function NPe(t,e){return e instanceof Uint8Array?(0,uSr.bytesToBase64)(e):e}function ose(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 DPe(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 dSr(...t){return t.filter(Boolean).join("&")}function X9(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 dSr(...i)}}sa.encodeJSONQuery=X9(cSr);sa.encodeFormQuery=X9(sa.encodeForm);sa.encodeSpaceDelimitedQuery=X9(sa.encodeSpaceDelimited);sa.encodePipeDelimitedQuery=X9(sa.encodePipeDelimited);sa.encodeDeepObjectQuery=X9(lSr);function wgo(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 fSr=S(slt=>{"use strict";Object.defineProperty(slt,"__esModule",{value:!0});slt.dlv=Sgo;function Sgo(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 llt=S(jw=>{"use strict";var Cgo=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]}),xgo=jw&&jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tgo=jw&&jw.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Cgo(r,e,n[o]);return xgo(r,e),r}}();Object.defineProperty(jw,"__esModule",{value:!0});jw.envSchema=void 0;jw.env=Ogo;jw.resetEnv=Ego;var pSr=fSr(),ult=Tgo(ae());jw.envSchema=ult.object({MISTRAL_API_KEY:ult.string().optional(),MISTRAL_DEBUG:ult.coerce.boolean().optional()});var ise;function Ogo(){return ise||(ise=jw.envSchema.parse((0,pSr.dlv)(globalThis,"process.env")??(0,pSr.dlv)(globalThis,"Deno.env")??{}),ise)}function Ego(){ise=void 0}});var hSr=S(zH=>{"use strict";Object.defineProperty(zH,"__esModule",{value:!0});zH.TemporaryError=zH.PermanentError=void 0;zH.retry=Mgo;var mSr=q9(),Pgo={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},ase=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)}};zH.PermanentError=ase;var UH=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};zH.TemporaryError=UH;async function Mgo(t,e){switch(e.config.strategy){case"backoff":return Ngo(Rgo(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??Pgo);default:return await t()}}function Rgo(t,e){return async()=>{try{let r=await t();if(Ago(r,e.statusCodes))throw new UH("Response failed with retryable status code",r);return r}catch(r){throw r instanceof UH||e.retryConnectionErrors&&((0,mSr.isTimeoutError)(r)||(0,mSr.isConnectionError)(r))?r:new ase("Permanent error",{cause:r})}}}var Igo=new RegExp("^[0-9]xx$","i");function Ago(t,e){let r=`${t.status}`;return e.some(n=>{if(!Igo.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 Ngo(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 ase)throw u.cause;if(Date.now()-a>r){if(u instanceof UH)return u.response;throw u}let c=0;u instanceof UH&&(c=Dgo(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await jgo(d),s++}}function Dgo(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 jgo(t){return new Promise(e=>setTimeout(e,t))}});var Vc=S(Nq=>{"use strict";var sse=Nq&&Nq.__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},C0=Nq&&Nq.__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)},$Pe,CA,kD;Object.defineProperty(Nq,"__esModule",{value:!0});Nq.ClientSDK=void 0;var gSr=$wr(),Z9=Hut(),Aq=Rd(),$go=rlt(),ySr=vPe(),Lgo=Tr(),Fgo=llt(),xA=q9(),kgo=hSr(),jPe=typeof globalThis>"u"?null:globalThis,qgo=typeof jPe=="object"&&jPe!=null&&"importScripts"in jPe&&typeof jPe.importScripts=="function",Bgo=qgo||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",clt=class{constructor(e={}){$Pe.set(this,void 0),CA.set(this,void 0),kD.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof gSr.SDKHooks?sse(this,CA,r.hooks,"f"):sse(this,CA,new gSr.SDKHooks,"f");let n=(0,ySr.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=C0(this,CA,"f").sdkInit({baseURL:n,client:e.httpClient||new xA.HTTPClient});this._baseURL=o,sse(this,$Pe,i,"f"),this._options={...e,hooks:C0(this,CA,"f")},sse(this,kD,this._options.debugLogger,"f"),!C0(this,kD,"f")&&(0,Fgo.env)().MISTRAL_DEBUG&&sse(this,kD,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,Aq.ERR)(new Z9.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[O,E]of Object.entries(u?.queryParams||{})){let P=(0,Lgo.encodeForm)(O,E,{charEncoding:"percent"});typeof P<"u"&&p.push(P)}if(p.length&&(f+=`&${p.join("&")}`),f){let O=f.startsWith("&")?f.slice(1):f;c.search=`?${O}`}let m=new Headers(s),h=u?.basic.username,y=u?.basic.password;if(h!=null||y!=null){let O=(0,$go.stringToBase64)([h||"",y||""].join(":"));m.set("Authorization",`Basic ${O}`)}let g=new Headers(u?.headers||{});for(let[O,E]of g)m.set(O,E);let b=m.get("cookie")||"";for(let[O,E]of Object.entries(u?.cookies||{}))b+=`; ${O}=${E}`;b=b.startsWith("; ")?b.slice(2):b,m.set("cookie",b);let _=new Headers(n?.headers??n?.fetchOptions?.headers);for(let[O,E]of _)m.set(O,E);Bgo||m.set(r.uaHeader??"user-agent",r.userAgent??ySr.SDK_METADATA.userAgent);let w={...n?.fetchOptions,...n};if(!w?.signal&&r.timeoutMs&&r.timeoutMs>0){let O=AbortSignal.timeout(r.timeoutMs);w.signal=O}r.body instanceof ReadableStream&&Object.assign(w,{duplex:"half"});let T;try{T=C0(this,CA,"f").beforeCreateRequest(e,{url:c,options:{...w,body:r.body??null,headers:m,method:o}})}catch(O){return(0,Aq.ERR)(new Z9.UnexpectedClientError("Create request hook failed to execute",{cause:O}))}return(0,Aq.OK)(new Request(T.url,T.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,kgo.retry)(async()=>{let i=await C0(this,CA,"f").beforeRequest(n,e.clone());await Ugo(C0(this,kD,"f"),i).catch(s=>C0(this,kD,"f")?.log("Failed to log request:",s));let a=await C0(this,$Pe,"f").request(i);try{if((0,xA.matchStatusCode)(a,o)){let s=await C0(this,CA,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await C0(this,CA,"f").afterSuccess(n,a)}finally{await zgo(C0(this,kD,"f"),a,i).catch(s=>C0(this,kD,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,Aq.OK)(i),i=>{switch(!0){case(0,xA.isAbortError)(i):return(0,Aq.ERR)(new Z9.RequestAbortedError("Request aborted by client",{cause:i}));case(0,xA.isTimeoutError)(i):return(0,Aq.ERR)(new Z9.RequestTimeoutError("Request timed out",{cause:i}));case(0,xA.isConnectionError)(i):return(0,Aq.ERR)(new Z9.ConnectionError("Unable to make request",{cause:i}));default:return(0,Aq.ERR)(new Z9.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};Nq.ClientSDK=clt;$Pe=new WeakMap,CA=new WeakMap,kD=new WeakMap;var _Sr=/(application|text)\/.*?\+*json.*/,bSr=/(application|text)\/(.*?\+*\bjsonl\b.*|.*?\+*\bx-ndjson\b.*)/;async function Ugo(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 _Sr.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 zgo(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,xA.matchContentType)(e,"application/json")||_Sr.test(o)&&!bSr.test(o)):t.log(await e.clone().json());break;case((0,xA.matchContentType)(e,"application/jsonl")||bSr.test(o)):t.log(await e.clone().text());break;case(0,xA.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,xA.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,xA.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 FPe=S(LPe=>{"use strict";Object.defineProperty(LPe,"__esModule",{value:!0});LPe.MistralError=void 0;var dlt=class extends Error{constructor(e,r){super(e),this.statusCode=r.response.status,this.body=r.body,this.headers=r.response.headers,this.contentType=r.response.headers.get("content-type")||"",this.rawResponse=r.response,this.name="MistralError"}};LPe.MistralError=dlt});var kPe=S($x=>{"use strict";var Vgo=$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]}),Hgo=$x&&$x.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wgo=$x&&$x.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Vgo(r,e,n[o]);return Hgo(r,e),r}}();Object.defineProperty($x,"__esModule",{value:!0});$x.SDKValidationError=void 0;$x.formatZodError=plt;var Jgo=Wgo(ae()),flt=class extends Error{static[Symbol.hasInstance](e){return!(!(e instanceof Error)||!("rawValue"in e)||!("rawMessage"in e)||!("pretty"in e)||typeof e.pretty!="function")}constructor(e,r,n){super(`${e}: ${r}`),this.name="SDKValidationError",this.cause=r,this.rawValue=n,this.rawMessage=e}pretty(){return this.cause instanceof Jgo.ZodError?`${this.rawMessage}
${plt(this.cause)}`:this.toString()}};$x.SDKValidationError=flt;function plt(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(`${plt(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var hlt=S(TA=>{"use strict";var Kgo=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]}),Ggo=TA&&TA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xgo=TA&&TA.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Kgo(r,e,n[o]);return Ggo(r,e),r}}();Object.defineProperty(TA,"__esModule",{value:!0});TA.ResponseValidationError=void 0;var Zgo=Xgo(ae()),Ygo=FPe(),Qgo=kPe(),mlt=class extends Ygo.MistralError{constructor(e,r){super(e,r),this.name="ResponseValidationError",this.cause=r.cause,this.rawValue=r.rawValue,this.rawMessage=r.rawMessage}pretty(){return this.cause instanceof Zgo.ZodError?`${this.rawMessage}
${(0,Qgo.formatZodError)(this.cause)}`:this.toString()}};TA.ResponseValidationError=mlt});var ylt=S(qPe=>{"use strict";Object.defineProperty(qPe,"__esModule",{value:!0});qPe.SDKError=void 0;var eyo=FPe(),glt=class extends eyo.MistralError{constructor(e,r){e&&(e+=": "),e+=`Status ${r.response.status}`;let n=r.response.headers.get("content-type")||'""';n!=="application/json"&&(e+=` Content-Type ${n.includes(" ")?`"${n}"`:n}`);let o=r.body||'""';e+=o.length>100?`
`:". ";let i=o;if(o.length>1e4){let a=o.substring(0,1e4),s=o.length-1e4;i=`${a}...and ${s} more chars`}e+=`Body: ${i}`,e=e.trim(),super(e,r),this.name="SDKError"}};qPe.SDKError=glt});var br=S(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.jsonErr=nyo;Vm.json=oyo;Vm.jsonl=iyo;Vm.jsonlErr=ayo;Vm.textErr=syo;Vm.text=uyo;Vm.bytesErr=lyo;Vm.bytes=cyo;Vm.streamErr=dyo;Vm.stream=fyo;Vm.sseErr=pyo;Vm.sse=myo;Vm.nilErr=hyo;Vm.nil=gyo;Vm.fail=yyo;Vm.match=byo;Vm.unpackHeaders=BPe;var tyo=hlt(),vSr=ylt(),wSr=Rd(),SSr=q9(),CSr=olt(),ryo={jsonl:"application/jsonl",json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function nyo(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function oyo(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function iyo(t,e,r){return{...r,enc:"jsonl",codes:t,schema:e}}function ayo(t,e,r){return{...r,err:!0,enc:"jsonl",codes:t,schema:e}}function syo(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function uyo(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function lyo(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function cyo(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function dyo(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function fyo(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function pyo(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function myo(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function hyo(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function gyo(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function yyo(t){return{enc:"fail",codes:t}}function byo(...t){return async function(r,n,o){let i,a;for(let d of t){let{codes:f}=d,p="ctype"in d?d.ctype:ryo[d.enc];if(p&&(0,SSr.matchResponse)(r,f,p)){a=d;break}else if(!p&&(0,SSr.matchStatusCode)(r,f)){a=d;break}}if(!a)return[{ok:!1,error:new vSr.SDKError("Unexpected Status or Content-Type",{response:r,request:n,body:await r.text().catch(()=>"")})},i];let s=a.enc,u="";switch(s){case"json":u=await r.text(),i=JSON.parse(u);break;case"jsonl":i=r.body;break;case"bytes":i=new Uint8Array(await r.arrayBuffer());break;case"stream":i=r.body;break;case"text":u=await r.text(),i=u;break;case"sse":i=r.body;break;case"nil":u=await r.text(),i=void 0;break;case"fail":u=await r.text(),i=u;break;default:throw new Error(`Unsupported response type: ${s}`)}if(a.enc==="fail")return[{ok:!1,error:new vSr.SDKError("API error occurred",{request:n,response:r,body:u})},i];let l=a.key||o?.resultKey,c;if("err"in a?c={...o?.extraFields,...a.hdrs?{Headers:BPe(r.headers)}:null,...(0,CSr.isPlainObject)(i)?i:null,request$:n,response$:r,body$:u}:l?c={...o?.extraFields,...a.hdrs?{Headers:BPe(r.headers)}:null,[l]:i}:a.hdrs?c={...o?.extraFields,...a.hdrs?{Headers:BPe(r.headers)}:null,...(0,CSr.isPlainObject)(i)?i:null}:c=i,"err"in a){let d=xSr(c,f=>a.schema.parse(f),"Response validation failed",{request:n,response:r,body:u});return[d.ok?{ok:!1,error:d.value}:d,i]}else return[xSr(c,d=>a.schema.parse(d),"Response validation failed",{request:n,response:r,body:u}),i]}}var _yo=/, */;function BPe(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(_yo);return e}function xSr(t,e,r,n){try{return(0,wSr.OK)(e(t))}catch(o){return(0,wSr.ERR)(new tyo.ResponseValidationError(r,{cause:o,rawValue:t,rawMessage:r,...n}))}}});var ce=S(Dq=>{"use strict";Object.defineProperty(Dq,"__esModule",{value:!0});Dq.invariant=vyo;Dq.remap=wyo;Dq.combineSignals=Syo;Dq.abortSignalAny=TSr;Dq.compactMap=Cyo;Dq.allRequired=xyo;var blt=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function vyo(t,e){if(!t)throw new blt(e)}function wyo(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 Syo(...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):TSr(e)}}function TSr(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 Cyo(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}function xyo(t){if(!Object.values(t).every(e=>e==null))return t}});var te=S(use=>{"use strict";Object.defineProperty(use,"__esModule",{value:!0});use.parse=Oyo;use.safeParse=Eyo;use.collectExtraKeys=Pyo;var Tyo=ae(),ESr=kPe(),OSr=Rd();function Oyo(t,e,r){try{return e(t)}catch(n){throw n instanceof Tyo.ZodError?new ESr.SDKValidationError(r,n,t):n}}function Eyo(t,e,r){try{return(0,OSr.OK)(e(t))}catch(n){return(0,OSr.ERR)(new ESr.SDKValidationError(r,n,t))}}function Pyo(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 _r=S(qD=>{"use strict";Object.defineProperty(qD,"__esModule",{value:!0});qD.SecurityError=qD.SecurityErrorCode=void 0;qD.resolveSecurity=PSr;qD.resolveGlobalSecurity=Iyo;qD.extractSecurity=Ayo;var Myo=llt(),zPe;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(zPe||(qD.SecurityErrorCode=zPe={}));var VPe=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(zPe.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(zPe.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};qD.SecurityError=VPe;function PSr(...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 typeof o.value=="string"?!!o.value: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":Ryo(e,n);break;case"http:custom":break;case"http:bearer":UPe(e,n);break;case"oauth2":UPe(e,n);break;case"oauth2:password":UPe(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":UPe(e,n);break;default:throw VPe.unrecognizedType(o)}}),e)}function Ryo(t,e){e.value!=null&&(t.basic=e.value)}function UPe(t,e){if(typeof e.value!="string"||!e.value)return;let r=e.value;r.slice(0,7).toLowerCase()!=="bearer "&&(r=`Bearer ${r}`),e.fieldName!==void 0&&(t.headers[e.fieldName]=r)}function Iyo(t){return PSr([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,Myo.env)().MISTRAL_API_KEY}])}async function Ayo(t){if(t!=null)return typeof t=="function"?t():t}});var jq=S(ua=>{"use strict";var Nyo=ua&&ua.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Dyo=ua&&ua.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jyo=ua&&ua.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Nyo(r,e,n[o]);return Dyo(r,e),r}}();Object.defineProperty(ua,"__esModule",{value:!0});ua.CodeInterpreterTool$=ua.CodeInterpreterTool$outboundSchema=ua.CodeInterpreterTool$inboundSchema=ua.CodeInterpreterToolType$=ua.CodeInterpreterToolType$outboundSchema=ua.CodeInterpreterToolType$inboundSchema=ua.CodeInterpreterToolType=void 0;ua.codeInterpreterToolToJSON=Lyo;ua.codeInterpreterToolFromJSON=Fyo;var _lt=jyo(ae()),$yo=te();ua.CodeInterpreterToolType={CodeInterpreter:"code_interpreter"};ua.CodeInterpreterToolType$inboundSchema=_lt.nativeEnum(ua.CodeInterpreterToolType);ua.CodeInterpreterToolType$outboundSchema=ua.CodeInterpreterToolType$inboundSchema;var MSr;(function(t){t.inboundSchema=ua.CodeInterpreterToolType$inboundSchema,t.outboundSchema=ua.CodeInterpreterToolType$outboundSchema})(MSr||(ua.CodeInterpreterToolType$=MSr={}));ua.CodeInterpreterTool$inboundSchema=_lt.object({type:ua.CodeInterpreterToolType$inboundSchema.default("code_interpreter")});ua.CodeInterpreterTool$outboundSchema=_lt.object({type:ua.CodeInterpreterToolType$outboundSchema.default("code_interpreter")});var RSr;(function(t){t.inboundSchema=ua.CodeInterpreterTool$inboundSchema,t.outboundSchema=ua.CodeInterpreterTool$outboundSchema})(RSr||(ua.CodeInterpreterTool$=RSr={}));function Lyo(t){return JSON.stringify(ua.CodeInterpreterTool$outboundSchema.parse(t))}function Fyo(t){return(0,$yo.safeParse)(t,e=>ua.CodeInterpreterTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CodeInterpreterTool' from JSON")}});var vlt=S(Id=>{"use strict";var kyo=Id&&Id.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qyo=Id&&Id.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Byo=Id&&Id.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kyo(r,e,n[o]);return qyo(r,e),r}}();Object.defineProperty(Id,"__esModule",{value:!0});Id.CompletionArgsStop$=Id.CompletionArgsStop$outboundSchema=Id.CompletionArgsStop$inboundSchema=void 0;Id.completionArgsStopToJSON=zyo;Id.completionArgsStopFromJSON=Vyo;var $q=Byo(ae()),Uyo=te();Id.CompletionArgsStop$inboundSchema=$q.union([$q.string(),$q.array($q.string())]);Id.CompletionArgsStop$outboundSchema=$q.union([$q.string(),$q.array($q.string())]);var ISr;(function(t){t.inboundSchema=Id.CompletionArgsStop$inboundSchema,t.outboundSchema=Id.CompletionArgsStop$outboundSchema})(ISr||(Id.CompletionArgsStop$=ISr={}));function zyo(t){return JSON.stringify(Id.CompletionArgsStop$outboundSchema.parse(t))}function Vyo(t){return(0,Uyo.safeParse)(t,e=>Id.CompletionArgsStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionArgsStop' from JSON")}});var VH=S(Ad=>{"use strict";var Hyo=Ad&&Ad.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wyo=Ad&&Ad.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jyo=Ad&&Ad.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Hyo(r,e,n[o]);return Wyo(r,e),r}}();Object.defineProperty(Ad,"__esModule",{value:!0});Ad.Prediction$=Ad.Prediction$outboundSchema=Ad.Prediction$inboundSchema=void 0;Ad.predictionToJSON=Gyo;Ad.predictionFromJSON=Xyo;var Y9=Jyo(ae()),Kyo=te();Ad.Prediction$inboundSchema=Y9.object({type:Y9.literal("content").default("content"),content:Y9.string().default("")});Ad.Prediction$outboundSchema=Y9.object({type:Y9.literal("content").default("content"),content:Y9.string().default("")});var ASr;(function(t){t.inboundSchema=Ad.Prediction$inboundSchema,t.outboundSchema=Ad.Prediction$outboundSchema})(ASr||(Ad.Prediction$=ASr={}));function Gyo(t){return JSON.stringify(Ad.Prediction$outboundSchema.parse(t))}function Xyo(t){return(0,Kyo.safeParse)(t,e=>Ad.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var wlt=S(Nd=>{"use strict";var Zyo=Nd&&Nd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yyo=Nd&&Nd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qyo=Nd&&Nd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Zyo(r,e,n[o]);return Yyo(r,e),r}}();Object.defineProperty(Nd,"__esModule",{value:!0});Nd.JsonSchema$=Nd.JsonSchema$outboundSchema=Nd.JsonSchema$inboundSchema=void 0;Nd.jsonSchemaToJSON=tbo;Nd.jsonSchemaFromJSON=rbo;var cv=Qyo(ae()),DSr=ce(),ebo=te();Nd.JsonSchema$inboundSchema=cv.object({name:cv.string(),description:cv.nullable(cv.string()).optional(),schema:cv.record(cv.any()),strict:cv.boolean().optional()}).transform(t=>(0,DSr.remap)(t,{schema:"schemaDefinition"}));Nd.JsonSchema$outboundSchema=cv.object({name:cv.string(),description:cv.nullable(cv.string()).optional(),schemaDefinition:cv.record(cv.any()),strict:cv.boolean().optional()}).transform(t=>(0,DSr.remap)(t,{schemaDefinition:"schema"}));var NSr;(function(t){t.inboundSchema=Nd.JsonSchema$inboundSchema,t.outboundSchema=Nd.JsonSchema$outboundSchema})(NSr||(Nd.JsonSchema$=NSr={}));function tbo(t){return JSON.stringify(Nd.JsonSchema$outboundSchema.parse(t))}function rbo(t){return(0,ebo.safeParse)(t,e=>Nd.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var Slt=S(Dd=>{"use strict";var nbo=Dd&&Dd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),obo=Dd&&Dd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ibo=Dd&&Dd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nbo(r,e,n[o]);return obo(r,e),r}}();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.ResponseFormats$=Dd.ResponseFormats$outboundSchema=Dd.ResponseFormats$inboundSchema=Dd.ResponseFormats=void 0;var abo=ibo(ae());Dd.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};Dd.ResponseFormats$inboundSchema=abo.nativeEnum(Dd.ResponseFormats);Dd.ResponseFormats$outboundSchema=Dd.ResponseFormats$inboundSchema;var jSr;(function(t){t.inboundSchema=Dd.ResponseFormats$inboundSchema,t.outboundSchema=Dd.ResponseFormats$outboundSchema})(jSr||(Dd.ResponseFormats$=jSr={}))});var Lq=S(jd=>{"use strict";var sbo=jd&&jd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ubo=jd&&jd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lbo=jd&&jd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sbo(r,e,n[o]);return ubo(r,e),r}}();Object.defineProperty(jd,"__esModule",{value:!0});jd.ResponseFormat$=jd.ResponseFormat$outboundSchema=jd.ResponseFormat$inboundSchema=void 0;jd.responseFormatToJSON=dbo;jd.responseFormatFromJSON=fbo;var HPe=lbo(ae()),LSr=ce(),cbo=te(),FSr=wlt(),kSr=Slt();jd.ResponseFormat$inboundSchema=HPe.object({type:kSr.ResponseFormats$inboundSchema.optional(),json_schema:HPe.nullable(FSr.JsonSchema$inboundSchema).optional()}).transform(t=>(0,LSr.remap)(t,{json_schema:"jsonSchema"}));jd.ResponseFormat$outboundSchema=HPe.object({type:kSr.ResponseFormats$outboundSchema.optional(),jsonSchema:HPe.nullable(FSr.JsonSchema$outboundSchema).optional()}).transform(t=>(0,LSr.remap)(t,{jsonSchema:"json_schema"}));var $Sr;(function(t){t.inboundSchema=jd.ResponseFormat$inboundSchema,t.outboundSchema=jd.ResponseFormat$outboundSchema})($Sr||(jd.ResponseFormat$=$Sr={}));function dbo(t){return JSON.stringify(jd.ResponseFormat$outboundSchema.parse(t))}function fbo(t){return(0,cbo.safeParse)(t,e=>jd.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var HH=S($d=>{"use strict";var pbo=$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]}),mbo=$d&&$d.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hbo=$d&&$d.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pbo(r,e,n[o]);return mbo(r,e),r}}();Object.defineProperty($d,"__esModule",{value:!0});$d.ToolChoiceEnum$=$d.ToolChoiceEnum$outboundSchema=$d.ToolChoiceEnum$inboundSchema=$d.ToolChoiceEnum=void 0;var gbo=hbo(ae());$d.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};$d.ToolChoiceEnum$inboundSchema=gbo.nativeEnum($d.ToolChoiceEnum);$d.ToolChoiceEnum$outboundSchema=$d.ToolChoiceEnum$inboundSchema;var qSr;(function(t){t.inboundSchema=$d.ToolChoiceEnum$inboundSchema,t.outboundSchema=$d.ToolChoiceEnum$outboundSchema})(qSr||($d.ToolChoiceEnum$=qSr={}))});var x0=S(Ld=>{"use strict";var ybo=Ld&&Ld.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bbo=Ld&&Ld.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_bo=Ld&&Ld.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ybo(r,e,n[o]);return bbo(r,e),r}}();Object.defineProperty(Ld,"__esModule",{value:!0});Ld.CompletionArgs$=Ld.CompletionArgs$outboundSchema=Ld.CompletionArgs$inboundSchema=void 0;Ld.completionArgsToJSON=wbo;Ld.completionArgsFromJSON=Sbo;var fs=_bo(ae()),USr=ce(),vbo=te(),zSr=vlt(),VSr=VH(),HSr=Lq(),WSr=HH();Ld.CompletionArgs$inboundSchema=fs.object({stop:fs.nullable(zSr.CompletionArgsStop$inboundSchema).optional(),presence_penalty:fs.nullable(fs.number()).optional(),frequency_penalty:fs.nullable(fs.number()).optional(),temperature:fs.nullable(fs.number()).optional(),top_p:fs.nullable(fs.number()).optional(),max_tokens:fs.nullable(fs.number().int()).optional(),random_seed:fs.nullable(fs.number().int()).optional(),prediction:fs.nullable(VSr.Prediction$inboundSchema).optional(),response_format:fs.nullable(HSr.ResponseFormat$inboundSchema).optional(),tool_choice:WSr.ToolChoiceEnum$inboundSchema.optional()}).transform(t=>(0,USr.remap)(t,{presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice"}));Ld.CompletionArgs$outboundSchema=fs.object({stop:fs.nullable(zSr.CompletionArgsStop$outboundSchema).optional(),presencePenalty:fs.nullable(fs.number()).optional(),frequencyPenalty:fs.nullable(fs.number()).optional(),temperature:fs.nullable(fs.number()).optional(),topP:fs.nullable(fs.number()).optional(),maxTokens:fs.nullable(fs.number().int()).optional(),randomSeed:fs.nullable(fs.number().int()).optional(),prediction:fs.nullable(VSr.Prediction$outboundSchema).optional(),responseFormat:fs.nullable(HSr.ResponseFormat$outboundSchema).optional(),toolChoice:WSr.ToolChoiceEnum$outboundSchema.optional()}).transform(t=>(0,USr.remap)(t,{presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice"}));var BSr;(function(t){t.inboundSchema=Ld.CompletionArgs$inboundSchema,t.outboundSchema=Ld.CompletionArgs$outboundSchema})(BSr||(Ld.CompletionArgs$=BSr={}));function wbo(t){return JSON.stringify(Ld.CompletionArgs$outboundSchema.parse(t))}function Sbo(t){return(0,vbo.safeParse)(t,e=>Ld.CompletionArgs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionArgs' from JSON")}});var Fq=S(la=>{"use strict";var Cbo=la&&la.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xbo=la&&la.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tbo=la&&la.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Cbo(r,e,n[o]);return xbo(r,e),r}}();Object.defineProperty(la,"__esModule",{value:!0});la.DocumentLibraryTool$=la.DocumentLibraryTool$outboundSchema=la.DocumentLibraryTool$inboundSchema=la.DocumentLibraryToolType$=la.DocumentLibraryToolType$outboundSchema=la.DocumentLibraryToolType$inboundSchema=la.DocumentLibraryToolType=void 0;la.documentLibraryToolToJSON=Ebo;la.documentLibraryToolFromJSON=Pbo;var WH=Tbo(ae()),GSr=ce(),Obo=te();la.DocumentLibraryToolType={DocumentLibrary:"document_library"};la.DocumentLibraryToolType$inboundSchema=WH.nativeEnum(la.DocumentLibraryToolType);la.DocumentLibraryToolType$outboundSchema=la.DocumentLibraryToolType$inboundSchema;var JSr;(function(t){t.inboundSchema=la.DocumentLibraryToolType$inboundSchema,t.outboundSchema=la.DocumentLibraryToolType$outboundSchema})(JSr||(la.DocumentLibraryToolType$=JSr={}));la.DocumentLibraryTool$inboundSchema=WH.object({type:la.DocumentLibraryToolType$inboundSchema.default("document_library"),library_ids:WH.array(WH.string())}).transform(t=>(0,GSr.remap)(t,{library_ids:"libraryIds"}));la.DocumentLibraryTool$outboundSchema=WH.object({type:la.DocumentLibraryToolType$outboundSchema.default("document_library"),libraryIds:WH.array(WH.string())}).transform(t=>(0,GSr.remap)(t,{libraryIds:"library_ids"}));var KSr;(function(t){t.inboundSchema=la.DocumentLibraryTool$inboundSchema,t.outboundSchema=la.DocumentLibraryTool$outboundSchema})(KSr||(la.DocumentLibraryTool$=KSr={}));function Ebo(t){return JSON.stringify(la.DocumentLibraryTool$outboundSchema.parse(t))}function Pbo(t){return(0,Obo.safeParse)(t,e=>la.DocumentLibraryTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentLibraryTool' from JSON")}});var WPe=S(Fd=>{"use strict";var Mbo=Fd&&Fd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Rbo=Fd&&Fd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ibo=Fd&&Fd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Mbo(r,e,n[o]);return Rbo(r,e),r}}();Object.defineProperty(Fd,"__esModule",{value:!0});Fd.FunctionT$=Fd.FunctionT$outboundSchema=Fd.FunctionT$inboundSchema=void 0;Fd.functionToJSON=Nbo;Fd.functionFromJSON=Dbo;var T0=Ibo(ae()),Abo=te();Fd.FunctionT$inboundSchema=T0.object({name:T0.string(),description:T0.string().optional(),strict:T0.boolean().optional(),parameters:T0.record(T0.any())});Fd.FunctionT$outboundSchema=T0.object({name:T0.string(),description:T0.string().optional(),strict:T0.boolean().optional(),parameters:T0.record(T0.any())});var XSr;(function(t){t.inboundSchema=Fd.FunctionT$inboundSchema,t.outboundSchema=Fd.FunctionT$outboundSchema})(XSr||(Fd.FunctionT$=XSr={}));function Nbo(t){return JSON.stringify(Fd.FunctionT$outboundSchema.parse(t))}function Dbo(t){return(0,Abo.safeParse)(t,e=>Fd.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var kq=S(ca=>{"use strict";var jbo=ca&&ca.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$bo=ca&&ca.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lbo=ca&&ca.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jbo(r,e,n[o]);return $bo(r,e),r}}();Object.defineProperty(ca,"__esModule",{value:!0});ca.FunctionTool$=ca.FunctionTool$outboundSchema=ca.FunctionTool$inboundSchema=ca.FunctionToolType$=ca.FunctionToolType$outboundSchema=ca.FunctionToolType$inboundSchema=ca.FunctionToolType=void 0;ca.functionToolToJSON=kbo;ca.functionToolFromJSON=qbo;var Clt=Lbo(ae()),Fbo=te(),QSr=WPe();ca.FunctionToolType={Function:"function"};ca.FunctionToolType$inboundSchema=Clt.nativeEnum(ca.FunctionToolType);ca.FunctionToolType$outboundSchema=ca.FunctionToolType$inboundSchema;var ZSr;(function(t){t.inboundSchema=ca.FunctionToolType$inboundSchema,t.outboundSchema=ca.FunctionToolType$outboundSchema})(ZSr||(ca.FunctionToolType$=ZSr={}));ca.FunctionTool$inboundSchema=Clt.object({type:ca.FunctionToolType$inboundSchema.default("function"),function:QSr.FunctionT$inboundSchema});ca.FunctionTool$outboundSchema=Clt.object({type:ca.FunctionToolType$outboundSchema.default("function"),function:QSr.FunctionT$outboundSchema});var YSr;(function(t){t.inboundSchema=ca.FunctionTool$inboundSchema,t.outboundSchema=ca.FunctionTool$outboundSchema})(YSr||(ca.FunctionTool$=YSr={}));function kbo(t){return JSON.stringify(ca.FunctionTool$outboundSchema.parse(t))}function qbo(t){return(0,Fbo.safeParse)(t,e=>ca.FunctionTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionTool' from JSON")}});var qq=S(da=>{"use strict";var Bbo=da&&da.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ubo=da&&da.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zbo=da&&da.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Bbo(r,e,n[o]);return Ubo(r,e),r}}();Object.defineProperty(da,"__esModule",{value:!0});da.ImageGenerationTool$=da.ImageGenerationTool$outboundSchema=da.ImageGenerationTool$inboundSchema=da.ImageGenerationToolType$=da.ImageGenerationToolType$outboundSchema=da.ImageGenerationToolType$inboundSchema=da.ImageGenerationToolType=void 0;da.imageGenerationToolToJSON=Hbo;da.imageGenerationToolFromJSON=Wbo;var xlt=zbo(ae()),Vbo=te();da.ImageGenerationToolType={ImageGeneration:"image_generation"};da.ImageGenerationToolType$inboundSchema=xlt.nativeEnum(da.ImageGenerationToolType);da.ImageGenerationToolType$outboundSchema=da.ImageGenerationToolType$inboundSchema;var e0r;(function(t){t.inboundSchema=da.ImageGenerationToolType$inboundSchema,t.outboundSchema=da.ImageGenerationToolType$outboundSchema})(e0r||(da.ImageGenerationToolType$=e0r={}));da.ImageGenerationTool$inboundSchema=xlt.object({type:da.ImageGenerationToolType$inboundSchema.default("image_generation")});da.ImageGenerationTool$outboundSchema=xlt.object({type:da.ImageGenerationToolType$outboundSchema.default("image_generation")});var t0r;(function(t){t.inboundSchema=da.ImageGenerationTool$inboundSchema,t.outboundSchema=da.ImageGenerationTool$outboundSchema})(t0r||(da.ImageGenerationTool$=t0r={}));function Hbo(t){return JSON.stringify(da.ImageGenerationTool$outboundSchema.parse(t))}function Wbo(t){return(0,Vbo.safeParse)(t,e=>da.ImageGenerationTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageGenerationTool' from JSON")}});var Bq=S(fa=>{"use strict";var Jbo=fa&&fa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kbo=fa&&fa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gbo=fa&&fa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Jbo(r,e,n[o]);return Kbo(r,e),r}}();Object.defineProperty(fa,"__esModule",{value:!0});fa.WebSearchPremiumTool$=fa.WebSearchPremiumTool$outboundSchema=fa.WebSearchPremiumTool$inboundSchema=fa.WebSearchPremiumToolType$=fa.WebSearchPremiumToolType$outboundSchema=fa.WebSearchPremiumToolType$inboundSchema=fa.WebSearchPremiumToolType=void 0;fa.webSearchPremiumToolToJSON=Zbo;fa.webSearchPremiumToolFromJSON=Ybo;var Tlt=Gbo(ae()),Xbo=te();fa.WebSearchPremiumToolType={WebSearchPremium:"web_search_premium"};fa.WebSearchPremiumToolType$inboundSchema=Tlt.nativeEnum(fa.WebSearchPremiumToolType);fa.WebSearchPremiumToolType$outboundSchema=fa.WebSearchPremiumToolType$inboundSchema;var r0r;(function(t){t.inboundSchema=fa.WebSearchPremiumToolType$inboundSchema,t.outboundSchema=fa.WebSearchPremiumToolType$outboundSchema})(r0r||(fa.WebSearchPremiumToolType$=r0r={}));fa.WebSearchPremiumTool$inboundSchema=Tlt.object({type:fa.WebSearchPremiumToolType$inboundSchema.default("web_search_premium")});fa.WebSearchPremiumTool$outboundSchema=Tlt.object({type:fa.WebSearchPremiumToolType$outboundSchema.default("web_search_premium")});var n0r;(function(t){t.inboundSchema=fa.WebSearchPremiumTool$inboundSchema,t.outboundSchema=fa.WebSearchPremiumTool$outboundSchema})(n0r||(fa.WebSearchPremiumTool$=n0r={}));function Zbo(t){return JSON.stringify(fa.WebSearchPremiumTool$outboundSchema.parse(t))}function Ybo(t){return(0,Xbo.safeParse)(t,e=>fa.WebSearchPremiumTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WebSearchPremiumTool' from JSON")}});var Uq=S(pa=>{"use strict";var Qbo=pa&&pa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e_o=pa&&pa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t_o=pa&&pa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Qbo(r,e,n[o]);return e_o(r,e),r}}();Object.defineProperty(pa,"__esModule",{value:!0});pa.WebSearchTool$=pa.WebSearchTool$outboundSchema=pa.WebSearchTool$inboundSchema=pa.WebSearchToolType$=pa.WebSearchToolType$outboundSchema=pa.WebSearchToolType$inboundSchema=pa.WebSearchToolType=void 0;pa.webSearchToolToJSON=n_o;pa.webSearchToolFromJSON=o_o;var Olt=t_o(ae()),r_o=te();pa.WebSearchToolType={WebSearch:"web_search"};pa.WebSearchToolType$inboundSchema=Olt.nativeEnum(pa.WebSearchToolType);pa.WebSearchToolType$outboundSchema=pa.WebSearchToolType$inboundSchema;var o0r;(function(t){t.inboundSchema=pa.WebSearchToolType$inboundSchema,t.outboundSchema=pa.WebSearchToolType$outboundSchema})(o0r||(pa.WebSearchToolType$=o0r={}));pa.WebSearchTool$inboundSchema=Olt.object({type:pa.WebSearchToolType$inboundSchema.default("web_search")});pa.WebSearchTool$outboundSchema=Olt.object({type:pa.WebSearchToolType$outboundSchema.default("web_search")});var i0r;(function(t){t.inboundSchema=pa.WebSearchTool$inboundSchema,t.outboundSchema=pa.WebSearchTool$outboundSchema})(i0r||(pa.WebSearchTool$=i0r={}));function n_o(t){return JSON.stringify(pa.WebSearchTool$outboundSchema.parse(t))}function o_o(t){return(0,r_o.safeParse)(t,e=>pa.WebSearchTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WebSearchTool' from JSON")}});var f0r=S(fo=>{"use strict";var i_o=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]}),a_o=fo&&fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s_o=fo&&fo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&i_o(r,e,n[o]);return a_o(r,e),r}}();Object.defineProperty(fo,"__esModule",{value:!0});fo.Agent$=fo.Agent$outboundSchema=fo.Agent$inboundSchema=fo.AgentObject$=fo.AgentObject$outboundSchema=fo.AgentObject$inboundSchema=fo.AgentTools$=fo.AgentTools$outboundSchema=fo.AgentTools$inboundSchema=fo.AgentObject=void 0;fo.agentToolsToJSON=u_o;fo.agentToolsFromJSON=l_o;fo.agentToJSON=c_o;fo.agentFromJSON=d_o;var At=s_o(ae()),l0r=ce(),c0r=te(),JPe=jq(),d0r=x0(),KPe=Fq(),GPe=kq(),XPe=qq(),ZPe=Bq(),YPe=Uq();fo.AgentObject={Agent:"agent"};fo.AgentTools$inboundSchema=At.union([KPe.DocumentLibraryTool$inboundSchema.and(At.object({type:At.literal("document_library")}).transform(t=>({type:t.type}))),GPe.FunctionTool$inboundSchema.and(At.object({type:At.literal("function")}).transform(t=>({type:t.type}))),JPe.CodeInterpreterTool$inboundSchema.and(At.object({type:At.literal("code_interpreter")}).transform(t=>({type:t.type}))),XPe.ImageGenerationTool$inboundSchema.and(At.object({type:At.literal("image_generation")}).transform(t=>({type:t.type}))),YPe.WebSearchTool$inboundSchema.and(At.object({type:At.literal("web_search")}).transform(t=>({type:t.type}))),ZPe.WebSearchPremiumTool$inboundSchema.and(At.object({type:At.literal("web_search_premium")}).transform(t=>({type:t.type})))]);fo.AgentTools$outboundSchema=At.union([KPe.DocumentLibraryTool$outboundSchema.and(At.object({type:At.literal("document_library")}).transform(t=>({type:t.type}))),GPe.FunctionTool$outboundSchema.and(At.object({type:At.literal("function")}).transform(t=>({type:t.type}))),JPe.CodeInterpreterTool$outboundSchema.and(At.object({type:At.literal("code_interpreter")}).transform(t=>({type:t.type}))),XPe.ImageGenerationTool$outboundSchema.and(At.object({type:At.literal("image_generation")}).transform(t=>({type:t.type}))),YPe.WebSearchTool$outboundSchema.and(At.object({type:At.literal("web_search")}).transform(t=>({type:t.type}))),ZPe.WebSearchPremiumTool$outboundSchema.and(At.object({type:At.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var a0r;(function(t){t.inboundSchema=fo.AgentTools$inboundSchema,t.outboundSchema=fo.AgentTools$outboundSchema})(a0r||(fo.AgentTools$=a0r={}));function u_o(t){return JSON.stringify(fo.AgentTools$outboundSchema.parse(t))}function l_o(t){return(0,c0r.safeParse)(t,e=>fo.AgentTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentTools' from JSON")}fo.AgentObject$inboundSchema=At.nativeEnum(fo.AgentObject);fo.AgentObject$outboundSchema=fo.AgentObject$inboundSchema;var s0r;(function(t){t.inboundSchema=fo.AgentObject$inboundSchema,t.outboundSchema=fo.AgentObject$outboundSchema})(s0r||(fo.AgentObject$=s0r={}));fo.Agent$inboundSchema=At.object({instructions:At.nullable(At.string()).optional(),tools:At.array(At.union([KPe.DocumentLibraryTool$inboundSchema.and(At.object({type:At.literal("document_library")}).transform(t=>({type:t.type}))),GPe.FunctionTool$inboundSchema.and(At.object({type:At.literal("function")}).transform(t=>({type:t.type}))),JPe.CodeInterpreterTool$inboundSchema.and(At.object({type:At.literal("code_interpreter")}).transform(t=>({type:t.type}))),XPe.ImageGenerationTool$inboundSchema.and(At.object({type:At.literal("image_generation")}).transform(t=>({type:t.type}))),YPe.WebSearchTool$inboundSchema.and(At.object({type:At.literal("web_search")}).transform(t=>({type:t.type}))),ZPe.WebSearchPremiumTool$inboundSchema.and(At.object({type:At.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:d0r.CompletionArgs$inboundSchema.optional(),model:At.string(),name:At.string(),description:At.nullable(At.string()).optional(),handoffs:At.nullable(At.array(At.string())).optional(),object:fo.AgentObject$inboundSchema.default("agent"),id:At.string(),version:At.number().int(),created_at:At.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:At.string().datetime({offset:!0}).transform(t=>new Date(t))}).transform(t=>(0,l0r.remap)(t,{completion_args:"completionArgs",created_at:"createdAt",updated_at:"updatedAt"}));fo.Agent$outboundSchema=At.object({instructions:At.nullable(At.string()).optional(),tools:At.array(At.union([KPe.DocumentLibraryTool$outboundSchema.and(At.object({type:At.literal("document_library")}).transform(t=>({type:t.type}))),GPe.FunctionTool$outboundSchema.and(At.object({type:At.literal("function")}).transform(t=>({type:t.type}))),JPe.CodeInterpreterTool$outboundSchema.and(At.object({type:At.literal("code_interpreter")}).transform(t=>({type:t.type}))),XPe.ImageGenerationTool$outboundSchema.and(At.object({type:At.literal("image_generation")}).transform(t=>({type:t.type}))),YPe.WebSearchTool$outboundSchema.and(At.object({type:At.literal("web_search")}).transform(t=>({type:t.type}))),ZPe.WebSearchPremiumTool$outboundSchema.and(At.object({type:At.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:d0r.CompletionArgs$outboundSchema.optional(),model:At.string(),name:At.string(),description:At.nullable(At.string()).optional(),handoffs:At.nullable(At.array(At.string())).optional(),object:fo.AgentObject$outboundSchema.default("agent"),id:At.string(),version:At.number().int(),createdAt:At.date().transform(t=>t.toISOString()),updatedAt:At.date().transform(t=>t.toISOString())}).transform(t=>(0,l0r.remap)(t,{completionArgs:"completion_args",createdAt:"created_at",updatedAt:"updated_at"}));var u0r;(function(t){t.inboundSchema=fo.Agent$inboundSchema,t.outboundSchema=fo.Agent$outboundSchema})(u0r||(fo.Agent$=u0r={}));function c_o(t){return JSON.stringify(fo.Agent$outboundSchema.parse(t))}function d_o(t){return(0,c0r.safeParse)(t,e=>fo.Agent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Agent' from JSON")}});var g0r=S(ma=>{"use strict";var f_o=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]}),p_o=ma&&ma.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m_o=ma&&ma.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&f_o(r,e,n[o]);return p_o(r,e),r}}();Object.defineProperty(ma,"__esModule",{value:!0});ma.AgentConversation$=ma.AgentConversation$outboundSchema=ma.AgentConversation$inboundSchema=ma.AgentConversationObject$=ma.AgentConversationObject$outboundSchema=ma.AgentConversationObject$inboundSchema=ma.AgentConversationObject=void 0;ma.agentConversationToJSON=g_o;ma.agentConversationFromJSON=y_o;var Hm=m_o(ae()),h0r=ce(),h_o=te();ma.AgentConversationObject={Conversation:"conversation"};ma.AgentConversationObject$inboundSchema=Hm.nativeEnum(ma.AgentConversationObject);ma.AgentConversationObject$outboundSchema=ma.AgentConversationObject$inboundSchema;var p0r;(function(t){t.inboundSchema=ma.AgentConversationObject$inboundSchema,t.outboundSchema=ma.AgentConversationObject$outboundSchema})(p0r||(ma.AgentConversationObject$=p0r={}));ma.AgentConversation$inboundSchema=Hm.object({name:Hm.nullable(Hm.string()).optional(),description:Hm.nullable(Hm.string()).optional(),object:ma.AgentConversationObject$inboundSchema.default("conversation"),id:Hm.string(),created_at:Hm.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:Hm.string().datetime({offset:!0}).transform(t=>new Date(t)),agent_id:Hm.string()}).transform(t=>(0,h0r.remap)(t,{created_at:"createdAt",updated_at:"updatedAt",agent_id:"agentId"}));ma.AgentConversation$outboundSchema=Hm.object({name:Hm.nullable(Hm.string()).optional(),description:Hm.nullable(Hm.string()).optional(),object:ma.AgentConversationObject$outboundSchema.default("conversation"),id:Hm.string(),createdAt:Hm.date().transform(t=>t.toISOString()),updatedAt:Hm.date().transform(t=>t.toISOString()),agentId:Hm.string()}).transform(t=>(0,h0r.remap)(t,{createdAt:"created_at",updatedAt:"updated_at",agentId:"agent_id"}));var m0r;(function(t){t.inboundSchema=ma.AgentConversation$inboundSchema,t.outboundSchema=ma.AgentConversation$outboundSchema})(m0r||(ma.AgentConversation$=m0r={}));function g_o(t){return JSON.stringify(ma.AgentConversation$outboundSchema.parse(t))}function y_o(t){return(0,h_o.safeParse)(t,e=>ma.AgentConversation$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentConversation' from JSON")}});var S0r=S(ps=>{"use strict";var b_o=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]}),__o=ps&&ps.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v_o=ps&&ps.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&b_o(r,e,n[o]);return __o(r,e),r}}();Object.defineProperty(ps,"__esModule",{value:!0});ps.AgentCreationRequest$=ps.AgentCreationRequest$outboundSchema=ps.AgentCreationRequest$inboundSchema=ps.AgentCreationRequestTools$=ps.AgentCreationRequestTools$outboundSchema=ps.AgentCreationRequestTools$inboundSchema=void 0;ps.agentCreationRequestToolsToJSON=w_o;ps.agentCreationRequestToolsFromJSON=S_o;ps.agentCreationRequestToJSON=C_o;ps.agentCreationRequestFromJSON=x_o;var tr=v_o(ae()),_0r=ce(),v0r=te(),QPe=jq(),w0r=x0(),eMe=Fq(),tMe=kq(),rMe=qq(),nMe=Bq(),oMe=Uq();ps.AgentCreationRequestTools$inboundSchema=tr.union([eMe.DocumentLibraryTool$inboundSchema.and(tr.object({type:tr.literal("document_library")}).transform(t=>({type:t.type}))),tMe.FunctionTool$inboundSchema.and(tr.object({type:tr.literal("function")}).transform(t=>({type:t.type}))),QPe.CodeInterpreterTool$inboundSchema.and(tr.object({type:tr.literal("code_interpreter")}).transform(t=>({type:t.type}))),rMe.ImageGenerationTool$inboundSchema.and(tr.object({type:tr.literal("image_generation")}).transform(t=>({type:t.type}))),oMe.WebSearchTool$inboundSchema.and(tr.object({type:tr.literal("web_search")}).transform(t=>({type:t.type}))),nMe.WebSearchPremiumTool$inboundSchema.and(tr.object({type:tr.literal("web_search_premium")}).transform(t=>({type:t.type})))]);ps.AgentCreationRequestTools$outboundSchema=tr.union([eMe.DocumentLibraryTool$outboundSchema.and(tr.object({type:tr.literal("document_library")}).transform(t=>({type:t.type}))),tMe.FunctionTool$outboundSchema.and(tr.object({type:tr.literal("function")}).transform(t=>({type:t.type}))),QPe.CodeInterpreterTool$outboundSchema.and(tr.object({type:tr.literal("code_interpreter")}).transform(t=>({type:t.type}))),rMe.ImageGenerationTool$outboundSchema.and(tr.object({type:tr.literal("image_generation")}).transform(t=>({type:t.type}))),oMe.WebSearchTool$outboundSchema.and(tr.object({type:tr.literal("web_search")}).transform(t=>({type:t.type}))),nMe.WebSearchPremiumTool$outboundSchema.and(tr.object({type:tr.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var y0r;(function(t){t.inboundSchema=ps.AgentCreationRequestTools$inboundSchema,t.outboundSchema=ps.AgentCreationRequestTools$outboundSchema})(y0r||(ps.AgentCreationRequestTools$=y0r={}));function w_o(t){return JSON.stringify(ps.AgentCreationRequestTools$outboundSchema.parse(t))}function S_o(t){return(0,v0r.safeParse)(t,e=>ps.AgentCreationRequestTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentCreationRequestTools' from JSON")}ps.AgentCreationRequest$inboundSchema=tr.object({instructions:tr.nullable(tr.string()).optional(),tools:tr.array(tr.union([eMe.DocumentLibraryTool$inboundSchema.and(tr.object({type:tr.literal("document_library")}).transform(t=>({type:t.type}))),tMe.FunctionTool$inboundSchema.and(tr.object({type:tr.literal("function")}).transform(t=>({type:t.type}))),QPe.CodeInterpreterTool$inboundSchema.and(tr.object({type:tr.literal("code_interpreter")}).transform(t=>({type:t.type}))),rMe.ImageGenerationTool$inboundSchema.and(tr.object({type:tr.literal("image_generation")}).transform(t=>({type:t.type}))),oMe.WebSearchTool$inboundSchema.and(tr.object({type:tr.literal("web_search")}).transform(t=>({type:t.type}))),nMe.WebSearchPremiumTool$inboundSchema.and(tr.object({type:tr.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:w0r.CompletionArgs$inboundSchema.optional(),model:tr.string(),name:tr.string(),description:tr.nullable(tr.string()).optional(),handoffs:tr.nullable(tr.array(tr.string())).optional()}).transform(t=>(0,_0r.remap)(t,{completion_args:"completionArgs"}));ps.AgentCreationRequest$outboundSchema=tr.object({instructions:tr.nullable(tr.string()).optional(),tools:tr.array(tr.union([eMe.DocumentLibraryTool$outboundSchema.and(tr.object({type:tr.literal("document_library")}).transform(t=>({type:t.type}))),tMe.FunctionTool$outboundSchema.and(tr.object({type:tr.literal("function")}).transform(t=>({type:t.type}))),QPe.CodeInterpreterTool$outboundSchema.and(tr.object({type:tr.literal("code_interpreter")}).transform(t=>({type:t.type}))),rMe.ImageGenerationTool$outboundSchema.and(tr.object({type:tr.literal("image_generation")}).transform(t=>({type:t.type}))),oMe.WebSearchTool$outboundSchema.and(tr.object({type:tr.literal("web_search")}).transform(t=>({type:t.type}))),nMe.WebSearchPremiumTool$outboundSchema.and(tr.object({type:tr.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:w0r.CompletionArgs$outboundSchema.optional(),model:tr.string(),name:tr.string(),description:tr.nullable(tr.string()).optional(),handoffs:tr.nullable(tr.array(tr.string())).optional()}).transform(t=>(0,_0r.remap)(t,{completionArgs:"completion_args"}));var b0r;(function(t){t.inboundSchema=ps.AgentCreationRequest$inboundSchema,t.outboundSchema=ps.AgentCreationRequest$outboundSchema})(b0r||(ps.AgentCreationRequest$=b0r={}));function C_o(t){return JSON.stringify(ps.AgentCreationRequest$outboundSchema.parse(t))}function x_o(t){return(0,v0r.safeParse)(t,e=>ps.AgentCreationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentCreationRequest' from JSON")}});var Elt=S(ha=>{"use strict";var T_o=ha&&ha.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O_o=ha&&ha.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E_o=ha&&ha.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T_o(r,e,n[o]);return O_o(r,e),r}}();Object.defineProperty(ha,"__esModule",{value:!0});ha.AgentHandoffDoneEvent$=ha.AgentHandoffDoneEvent$outboundSchema=ha.AgentHandoffDoneEvent$inboundSchema=ha.AgentHandoffDoneEventType$=ha.AgentHandoffDoneEventType$outboundSchema=ha.AgentHandoffDoneEventType$inboundSchema=ha.AgentHandoffDoneEventType=void 0;ha.agentHandoffDoneEventToJSON=M_o;ha.agentHandoffDoneEventFromJSON=R_o;var $w=E_o(ae()),T0r=ce(),P_o=te();ha.AgentHandoffDoneEventType={AgentHandoffDone:"agent.handoff.done"};ha.AgentHandoffDoneEventType$inboundSchema=$w.nativeEnum(ha.AgentHandoffDoneEventType);ha.AgentHandoffDoneEventType$outboundSchema=ha.AgentHandoffDoneEventType$inboundSchema;var C0r;(function(t){t.inboundSchema=ha.AgentHandoffDoneEventType$inboundSchema,t.outboundSchema=ha.AgentHandoffDoneEventType$outboundSchema})(C0r||(ha.AgentHandoffDoneEventType$=C0r={}));ha.AgentHandoffDoneEvent$inboundSchema=$w.object({type:ha.AgentHandoffDoneEventType$inboundSchema.default("agent.handoff.done"),created_at:$w.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:$w.number().int().default(0),id:$w.string(),next_agent_id:$w.string(),next_agent_name:$w.string()}).transform(t=>(0,T0r.remap)(t,{created_at:"createdAt",output_index:"outputIndex",next_agent_id:"nextAgentId",next_agent_name:"nextAgentName"}));ha.AgentHandoffDoneEvent$outboundSchema=$w.object({type:ha.AgentHandoffDoneEventType$outboundSchema.default("agent.handoff.done"),createdAt:$w.date().transform(t=>t.toISOString()).optional(),outputIndex:$w.number().int().default(0),id:$w.string(),nextAgentId:$w.string(),nextAgentName:$w.string()}).transform(t=>(0,T0r.remap)(t,{createdAt:"created_at",outputIndex:"output_index",nextAgentId:"next_agent_id",nextAgentName:"next_agent_name"}));var x0r;(function(t){t.inboundSchema=ha.AgentHandoffDoneEvent$inboundSchema,t.outboundSchema=ha.AgentHandoffDoneEvent$outboundSchema})(x0r||(ha.AgentHandoffDoneEvent$=x0r={}));function M_o(t){return JSON.stringify(ha.AgentHandoffDoneEvent$outboundSchema.parse(t))}function R_o(t){return(0,P_o.safeParse)(t,e=>ha.AgentHandoffDoneEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentHandoffDoneEvent' from JSON")}});var lse=S(Jn=>{"use strict";var I_o=Jn&&Jn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),A_o=Jn&&Jn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N_o=Jn&&Jn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&I_o(r,e,n[o]);return A_o(r,e),r}}();Object.defineProperty(Jn,"__esModule",{value:!0});Jn.AgentHandoffEntry$=Jn.AgentHandoffEntry$outboundSchema=Jn.AgentHandoffEntry$inboundSchema=Jn.AgentHandoffEntryType$=Jn.AgentHandoffEntryType$outboundSchema=Jn.AgentHandoffEntryType$inboundSchema=Jn.AgentHandoffEntryObject$=Jn.AgentHandoffEntryObject$outboundSchema=Jn.AgentHandoffEntryObject$inboundSchema=Jn.AgentHandoffEntryType=Jn.AgentHandoffEntryObject=void 0;Jn.agentHandoffEntryToJSON=j_o;Jn.agentHandoffEntryFromJSON=$_o;var kd=N_o(ae()),M0r=ce(),D_o=te();Jn.AgentHandoffEntryObject={Entry:"entry"};Jn.AgentHandoffEntryType={AgentHandoff:"agent.handoff"};Jn.AgentHandoffEntryObject$inboundSchema=kd.nativeEnum(Jn.AgentHandoffEntryObject);Jn.AgentHandoffEntryObject$outboundSchema=Jn.AgentHandoffEntryObject$inboundSchema;var O0r;(function(t){t.inboundSchema=Jn.AgentHandoffEntryObject$inboundSchema,t.outboundSchema=Jn.AgentHandoffEntryObject$outboundSchema})(O0r||(Jn.AgentHandoffEntryObject$=O0r={}));Jn.AgentHandoffEntryType$inboundSchema=kd.nativeEnum(Jn.AgentHandoffEntryType);Jn.AgentHandoffEntryType$outboundSchema=Jn.AgentHandoffEntryType$inboundSchema;var E0r;(function(t){t.inboundSchema=Jn.AgentHandoffEntryType$inboundSchema,t.outboundSchema=Jn.AgentHandoffEntryType$outboundSchema})(E0r||(Jn.AgentHandoffEntryType$=E0r={}));Jn.AgentHandoffEntry$inboundSchema=kd.object({object:Jn.AgentHandoffEntryObject$inboundSchema.default("entry"),type:Jn.AgentHandoffEntryType$inboundSchema.default("agent.handoff"),created_at:kd.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:kd.nullable(kd.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:kd.string().optional(),previous_agent_id:kd.string(),previous_agent_name:kd.string(),next_agent_id:kd.string(),next_agent_name:kd.string()}).transform(t=>(0,M0r.remap)(t,{created_at:"createdAt",completed_at:"completedAt",previous_agent_id:"previousAgentId",previous_agent_name:"previousAgentName",next_agent_id:"nextAgentId",next_agent_name:"nextAgentName"}));Jn.AgentHandoffEntry$outboundSchema=kd.object({object:Jn.AgentHandoffEntryObject$outboundSchema.default("entry"),type:Jn.AgentHandoffEntryType$outboundSchema.default("agent.handoff"),createdAt:kd.date().transform(t=>t.toISOString()).optional(),completedAt:kd.nullable(kd.date().transform(t=>t.toISOString())).optional(),id:kd.string().optional(),previousAgentId:kd.string(),previousAgentName:kd.string(),nextAgentId:kd.string(),nextAgentName:kd.string()}).transform(t=>(0,M0r.remap)(t,{createdAt:"created_at",completedAt:"completed_at",previousAgentId:"previous_agent_id",previousAgentName:"previous_agent_name",nextAgentId:"next_agent_id",nextAgentName:"next_agent_name"}));var P0r;(function(t){t.inboundSchema=Jn.AgentHandoffEntry$inboundSchema,t.outboundSchema=Jn.AgentHandoffEntry$outboundSchema})(P0r||(Jn.AgentHandoffEntry$=P0r={}));function j_o(t){return JSON.stringify(Jn.AgentHandoffEntry$outboundSchema.parse(t))}function $_o(t){return(0,D_o.safeParse)(t,e=>Jn.AgentHandoffEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentHandoffEntry' from JSON")}});var Plt=S(ga=>{"use strict";var L_o=ga&&ga.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F_o=ga&&ga.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k_o=ga&&ga.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&L_o(r,e,n[o]);return F_o(r,e),r}}();Object.defineProperty(ga,"__esModule",{value:!0});ga.AgentHandoffStartedEvent$=ga.AgentHandoffStartedEvent$outboundSchema=ga.AgentHandoffStartedEvent$inboundSchema=ga.AgentHandoffStartedEventType$=ga.AgentHandoffStartedEventType$outboundSchema=ga.AgentHandoffStartedEventType$inboundSchema=ga.AgentHandoffStartedEventType=void 0;ga.agentHandoffStartedEventToJSON=B_o;ga.agentHandoffStartedEventFromJSON=U_o;var Lw=k_o(ae()),A0r=ce(),q_o=te();ga.AgentHandoffStartedEventType={AgentHandoffStarted:"agent.handoff.started"};ga.AgentHandoffStartedEventType$inboundSchema=Lw.nativeEnum(ga.AgentHandoffStartedEventType);ga.AgentHandoffStartedEventType$outboundSchema=ga.AgentHandoffStartedEventType$inboundSchema;var R0r;(function(t){t.inboundSchema=ga.AgentHandoffStartedEventType$inboundSchema,t.outboundSchema=ga.AgentHandoffStartedEventType$outboundSchema})(R0r||(ga.AgentHandoffStartedEventType$=R0r={}));ga.AgentHandoffStartedEvent$inboundSchema=Lw.object({type:ga.AgentHandoffStartedEventType$inboundSchema.default("agent.handoff.started"),created_at:Lw.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:Lw.number().int().default(0),id:Lw.string(),previous_agent_id:Lw.string(),previous_agent_name:Lw.string()}).transform(t=>(0,A0r.remap)(t,{created_at:"createdAt",output_index:"outputIndex",previous_agent_id:"previousAgentId",previous_agent_name:"previousAgentName"}));ga.AgentHandoffStartedEvent$outboundSchema=Lw.object({type:ga.AgentHandoffStartedEventType$outboundSchema.default("agent.handoff.started"),createdAt:Lw.date().transform(t=>t.toISOString()).optional(),outputIndex:Lw.number().int().default(0),id:Lw.string(),previousAgentId:Lw.string(),previousAgentName:Lw.string()}).transform(t=>(0,A0r.remap)(t,{createdAt:"created_at",outputIndex:"output_index",previousAgentId:"previous_agent_id",previousAgentName:"previous_agent_name"}));var I0r;(function(t){t.inboundSchema=ga.AgentHandoffStartedEvent$inboundSchema,t.outboundSchema=ga.AgentHandoffStartedEvent$outboundSchema})(I0r||(ga.AgentHandoffStartedEvent$=I0r={}));function B_o(t){return JSON.stringify(ga.AgentHandoffStartedEvent$outboundSchema.parse(t))}function U_o(t){return(0,q_o.safeParse)(t,e=>ga.AgentHandoffStartedEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentHandoffStartedEvent' from JSON")}});var Mlt=S(ya=>{"use strict";var z_o=ya&&ya.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V_o=ya&&ya.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H_o=ya&&ya.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&z_o(r,e,n[o]);return V_o(r,e),r}}();Object.defineProperty(ya,"__esModule",{value:!0});ya.AudioChunk$=ya.AudioChunk$outboundSchema=ya.AudioChunk$inboundSchema=ya.AudioChunkType$=ya.AudioChunkType$outboundSchema=ya.AudioChunkType$inboundSchema=ya.AudioChunkType=void 0;ya.audioChunkToJSON=J_o;ya.audioChunkFromJSON=K_o;var cse=H_o(ae()),j0r=ce(),W_o=te();ya.AudioChunkType={InputAudio:"input_audio"};ya.AudioChunkType$inboundSchema=cse.nativeEnum(ya.AudioChunkType);ya.AudioChunkType$outboundSchema=ya.AudioChunkType$inboundSchema;var N0r;(function(t){t.inboundSchema=ya.AudioChunkType$inboundSchema,t.outboundSchema=ya.AudioChunkType$outboundSchema})(N0r||(ya.AudioChunkType$=N0r={}));ya.AudioChunk$inboundSchema=cse.object({input_audio:cse.string(),type:ya.AudioChunkType$inboundSchema.default("input_audio")}).transform(t=>(0,j0r.remap)(t,{input_audio:"inputAudio"}));ya.AudioChunk$outboundSchema=cse.object({inputAudio:cse.string(),type:ya.AudioChunkType$outboundSchema.default("input_audio")}).transform(t=>(0,j0r.remap)(t,{inputAudio:"input_audio"}));var D0r;(function(t){t.inboundSchema=ya.AudioChunk$inboundSchema,t.outboundSchema=ya.AudioChunk$outboundSchema})(D0r||(ya.AudioChunk$=D0r={}));function J_o(t){return JSON.stringify(ya.AudioChunk$outboundSchema.parse(t))}function K_o(t){return(0,W_o.safeParse)(t,e=>ya.AudioChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AudioChunk' from JSON")}});var JH=S(ba=>{"use strict";var G_o=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]}),X_o=ba&&ba.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z_o=ba&&ba.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&G_o(r,e,n[o]);return X_o(r,e),r}}();Object.defineProperty(ba,"__esModule",{value:!0});ba.DocumentURLChunk$=ba.DocumentURLChunk$outboundSchema=ba.DocumentURLChunk$inboundSchema=ba.DocumentURLChunkType$=ba.DocumentURLChunkType$outboundSchema=ba.DocumentURLChunkType$inboundSchema=ba.DocumentURLChunkType=void 0;ba.documentURLChunkToJSON=Q_o;ba.documentURLChunkFromJSON=evo;var BD=Z_o(ae()),F0r=ce(),Y_o=te();ba.DocumentURLChunkType={DocumentUrl:"document_url"};ba.DocumentURLChunkType$inboundSchema=BD.nativeEnum(ba.DocumentURLChunkType);ba.DocumentURLChunkType$outboundSchema=ba.DocumentURLChunkType$inboundSchema;var $0r;(function(t){t.inboundSchema=ba.DocumentURLChunkType$inboundSchema,t.outboundSchema=ba.DocumentURLChunkType$outboundSchema})($0r||(ba.DocumentURLChunkType$=$0r={}));ba.DocumentURLChunk$inboundSchema=BD.object({document_url:BD.string(),document_name:BD.nullable(BD.string()).optional(),type:ba.DocumentURLChunkType$inboundSchema.default("document_url")}).transform(t=>(0,F0r.remap)(t,{document_url:"documentUrl",document_name:"documentName"}));ba.DocumentURLChunk$outboundSchema=BD.object({documentUrl:BD.string(),documentName:BD.nullable(BD.string()).optional(),type:ba.DocumentURLChunkType$outboundSchema.default("document_url")}).transform(t=>(0,F0r.remap)(t,{documentUrl:"document_url",documentName:"document_name"}));var L0r;(function(t){t.inboundSchema=ba.DocumentURLChunk$inboundSchema,t.outboundSchema=ba.DocumentURLChunk$outboundSchema})(L0r||(ba.DocumentURLChunk$=L0r={}));function Q_o(t){return JSON.stringify(ba.DocumentURLChunk$outboundSchema.parse(t))}function evo(t){return(0,Y_o.safeParse)(t,e=>ba.DocumentURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentURLChunk' from JSON")}});var iMe=S(qd=>{"use strict";var tvo=qd&&qd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rvo=qd&&qd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nvo=qd&&qd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tvo(r,e,n[o]);return rvo(r,e),r}}();Object.defineProperty(qd,"__esModule",{value:!0});qd.FileChunk$=qd.FileChunk$outboundSchema=qd.FileChunk$inboundSchema=void 0;qd.fileChunkToJSON=ivo;qd.fileChunkFromJSON=avo;var Q9=nvo(ae()),q0r=ce(),ovo=te();qd.FileChunk$inboundSchema=Q9.object({type:Q9.literal("file").default("file"),file_id:Q9.string()}).transform(t=>(0,q0r.remap)(t,{file_id:"fileId"}));qd.FileChunk$outboundSchema=Q9.object({type:Q9.literal("file").default("file"),fileId:Q9.string()}).transform(t=>(0,q0r.remap)(t,{fileId:"file_id"}));var k0r;(function(t){t.inboundSchema=qd.FileChunk$inboundSchema,t.outboundSchema=qd.FileChunk$outboundSchema})(k0r||(qd.FileChunk$=k0r={}));function ivo(t){return JSON.stringify(qd.FileChunk$outboundSchema.parse(t))}function avo(t){return(0,ovo.safeParse)(t,e=>qd.FileChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileChunk' from JSON")}});var Rlt=S(Bd=>{"use strict";var svo=Bd&&Bd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uvo=Bd&&Bd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lvo=Bd&&Bd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&svo(r,e,n[o]);return uvo(r,e),r}}();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.ImageURL$=Bd.ImageURL$outboundSchema=Bd.ImageURL$inboundSchema=void 0;Bd.imageURLToJSON=dvo;Bd.imageURLFromJSON=fvo;var zq=lvo(ae()),cvo=te();Bd.ImageURL$inboundSchema=zq.object({url:zq.string(),detail:zq.nullable(zq.string()).optional()});Bd.ImageURL$outboundSchema=zq.object({url:zq.string(),detail:zq.nullable(zq.string()).optional()});var B0r;(function(t){t.inboundSchema=Bd.ImageURL$inboundSchema,t.outboundSchema=Bd.ImageURL$outboundSchema})(B0r||(Bd.ImageURL$=B0r={}));function dvo(t){return JSON.stringify(Bd.ImageURL$outboundSchema.parse(t))}function fvo(t){return(0,cvo.safeParse)(t,e=>Bd.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var KH=S(po=>{"use strict";var pvo=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]}),mvo=po&&po.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hvo=po&&po.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pvo(r,e,n[o]);return mvo(r,e),r}}();Object.defineProperty(po,"__esModule",{value:!0});po.ImageURLChunk$=po.ImageURLChunk$outboundSchema=po.ImageURLChunk$inboundSchema=po.ImageURLChunkType$=po.ImageURLChunkType$outboundSchema=po.ImageURLChunkType$inboundSchema=po.ImageURLChunkImageURL$=po.ImageURLChunkImageURL$outboundSchema=po.ImageURLChunkImageURL$inboundSchema=po.ImageURLChunkType=void 0;po.imageURLChunkImageURLToJSON=gvo;po.imageURLChunkImageURLFromJSON=yvo;po.imageURLChunkToJSON=bvo;po.imageURLChunkFromJSON=_vo;var Lx=hvo(ae()),H0r=ce(),W0r=te(),aMe=Rlt();po.ImageURLChunkType={ImageUrl:"image_url"};po.ImageURLChunkImageURL$inboundSchema=Lx.union([aMe.ImageURL$inboundSchema,Lx.string()]);po.ImageURLChunkImageURL$outboundSchema=Lx.union([aMe.ImageURL$outboundSchema,Lx.string()]);var U0r;(function(t){t.inboundSchema=po.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=po.ImageURLChunkImageURL$outboundSchema})(U0r||(po.ImageURLChunkImageURL$=U0r={}));function gvo(t){return JSON.stringify(po.ImageURLChunkImageURL$outboundSchema.parse(t))}function yvo(t){return(0,W0r.safeParse)(t,e=>po.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}po.ImageURLChunkType$inboundSchema=Lx.nativeEnum(po.ImageURLChunkType);po.ImageURLChunkType$outboundSchema=po.ImageURLChunkType$inboundSchema;var z0r;(function(t){t.inboundSchema=po.ImageURLChunkType$inboundSchema,t.outboundSchema=po.ImageURLChunkType$outboundSchema})(z0r||(po.ImageURLChunkType$=z0r={}));po.ImageURLChunk$inboundSchema=Lx.object({image_url:Lx.union([aMe.ImageURL$inboundSchema,Lx.string()]),type:po.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,H0r.remap)(t,{image_url:"imageUrl"}));po.ImageURLChunk$outboundSchema=Lx.object({imageUrl:Lx.union([aMe.ImageURL$outboundSchema,Lx.string()]),type:po.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,H0r.remap)(t,{imageUrl:"image_url"}));var V0r;(function(t){t.inboundSchema=po.ImageURLChunk$inboundSchema,t.outboundSchema=po.ImageURLChunk$outboundSchema})(V0r||(po.ImageURLChunk$=V0r={}));function bvo(t){return JSON.stringify(po.ImageURLChunk$outboundSchema.parse(t))}function _vo(t){return(0,W0r.safeParse)(t,e=>po.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var sMe=S(_a=>{"use strict";var vvo=_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]}),wvo=_a&&_a.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Svo=_a&&_a.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vvo(r,e,n[o]);return wvo(r,e),r}}();Object.defineProperty(_a,"__esModule",{value:!0});_a.ReferenceChunk$=_a.ReferenceChunk$outboundSchema=_a.ReferenceChunk$inboundSchema=_a.ReferenceChunkType$=_a.ReferenceChunkType$outboundSchema=_a.ReferenceChunkType$inboundSchema=_a.ReferenceChunkType=void 0;_a.referenceChunkToJSON=xvo;_a.referenceChunkFromJSON=Tvo;var GH=Svo(ae()),G0r=ce(),Cvo=te();_a.ReferenceChunkType={Reference:"reference"};_a.ReferenceChunkType$inboundSchema=GH.nativeEnum(_a.ReferenceChunkType);_a.ReferenceChunkType$outboundSchema=_a.ReferenceChunkType$inboundSchema;var J0r;(function(t){t.inboundSchema=_a.ReferenceChunkType$inboundSchema,t.outboundSchema=_a.ReferenceChunkType$outboundSchema})(J0r||(_a.ReferenceChunkType$=J0r={}));_a.ReferenceChunk$inboundSchema=GH.object({reference_ids:GH.array(GH.number().int()),type:_a.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,G0r.remap)(t,{reference_ids:"referenceIds"}));_a.ReferenceChunk$outboundSchema=GH.object({referenceIds:GH.array(GH.number().int()),type:_a.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,G0r.remap)(t,{referenceIds:"reference_ids"}));var K0r;(function(t){t.inboundSchema=_a.ReferenceChunk$inboundSchema,t.outboundSchema=_a.ReferenceChunk$outboundSchema})(K0r||(_a.ReferenceChunk$=K0r={}));function xvo(t){return JSON.stringify(_a.ReferenceChunk$outboundSchema.parse(t))}function Tvo(t){return(0,Cvo.safeParse)(t,e=>_a.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var Vq=S(va=>{"use strict";var Ovo=va&&va.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Evo=va&&va.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pvo=va&&va.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Ovo(r,e,n[o]);return Evo(r,e),r}}();Object.defineProperty(va,"__esModule",{value:!0});va.TextChunk$=va.TextChunk$outboundSchema=va.TextChunk$inboundSchema=va.TextChunkType$=va.TextChunkType$outboundSchema=va.TextChunkType$inboundSchema=va.TextChunkType=void 0;va.textChunkToJSON=Rvo;va.textChunkFromJSON=Ivo;var dse=Pvo(ae()),Mvo=te();va.TextChunkType={Text:"text"};va.TextChunkType$inboundSchema=dse.nativeEnum(va.TextChunkType);va.TextChunkType$outboundSchema=va.TextChunkType$inboundSchema;var X0r;(function(t){t.inboundSchema=va.TextChunkType$inboundSchema,t.outboundSchema=va.TextChunkType$outboundSchema})(X0r||(va.TextChunkType$=X0r={}));va.TextChunk$inboundSchema=dse.object({text:dse.string(),type:va.TextChunkType$inboundSchema.default("text")});va.TextChunk$outboundSchema=dse.object({text:dse.string(),type:va.TextChunkType$outboundSchema.default("text")});var Z0r;(function(t){t.inboundSchema=va.TextChunk$inboundSchema,t.outboundSchema=va.TextChunk$outboundSchema})(Z0r||(va.TextChunk$=Z0r={}));function Rvo(t){return JSON.stringify(va.TextChunk$outboundSchema.parse(t))}function Ivo(t){return(0,Mvo.safeParse)(t,e=>va.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var XH=S(mo=>{"use strict";var Avo=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]}),Nvo=mo&&mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dvo=mo&&mo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Avo(r,e,n[o]);return Nvo(r,e),r}}();Object.defineProperty(mo,"__esModule",{value:!0});mo.ThinkChunk$=mo.ThinkChunk$outboundSchema=mo.ThinkChunk$inboundSchema=mo.ThinkChunkType$=mo.ThinkChunkType$outboundSchema=mo.ThinkChunkType$inboundSchema=mo.Thinking$=mo.Thinking$outboundSchema=mo.Thinking$inboundSchema=mo.ThinkChunkType=void 0;mo.thinkingToJSON=jvo;mo.thinkingFromJSON=$vo;mo.thinkChunkToJSON=Lvo;mo.thinkChunkFromJSON=Fvo;var Fx=Dvo(ae()),tCr=te(),uMe=sMe(),lMe=Vq();mo.ThinkChunkType={Thinking:"thinking"};mo.Thinking$inboundSchema=Fx.union([uMe.ReferenceChunk$inboundSchema,lMe.TextChunk$inboundSchema]);mo.Thinking$outboundSchema=Fx.union([uMe.ReferenceChunk$outboundSchema,lMe.TextChunk$outboundSchema]);var Y0r;(function(t){t.inboundSchema=mo.Thinking$inboundSchema,t.outboundSchema=mo.Thinking$outboundSchema})(Y0r||(mo.Thinking$=Y0r={}));function jvo(t){return JSON.stringify(mo.Thinking$outboundSchema.parse(t))}function $vo(t){return(0,tCr.safeParse)(t,e=>mo.Thinking$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Thinking' from JSON")}mo.ThinkChunkType$inboundSchema=Fx.nativeEnum(mo.ThinkChunkType);mo.ThinkChunkType$outboundSchema=mo.ThinkChunkType$inboundSchema;var Q0r;(function(t){t.inboundSchema=mo.ThinkChunkType$inboundSchema,t.outboundSchema=mo.ThinkChunkType$outboundSchema})(Q0r||(mo.ThinkChunkType$=Q0r={}));mo.ThinkChunk$inboundSchema=Fx.object({thinking:Fx.array(Fx.union([uMe.ReferenceChunk$inboundSchema,lMe.TextChunk$inboundSchema])),closed:Fx.boolean().optional(),type:mo.ThinkChunkType$inboundSchema.default("thinking")});mo.ThinkChunk$outboundSchema=Fx.object({thinking:Fx.array(Fx.union([uMe.ReferenceChunk$outboundSchema,lMe.TextChunk$outboundSchema])),closed:Fx.boolean().optional(),type:mo.ThinkChunkType$outboundSchema.default("thinking")});var eCr;(function(t){t.inboundSchema=mo.ThinkChunk$inboundSchema,t.outboundSchema=mo.ThinkChunk$outboundSchema})(eCr||(mo.ThinkChunk$=eCr={}));function Lvo(t){return JSON.stringify(mo.ThinkChunk$outboundSchema.parse(t))}function Fvo(t){return(0,tCr.safeParse)(t,e=>mo.ThinkChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ThinkChunk' from JSON")}});var e7=S(Ud=>{"use strict";var kvo=Ud&&Ud.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qvo=Ud&&Ud.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bvo=Ud&&Ud.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kvo(r,e,n[o]);return qvo(r,e),r}}();Object.defineProperty(Ud,"__esModule",{value:!0});Ud.ContentChunk$=Ud.ContentChunk$outboundSchema=Ud.ContentChunk$inboundSchema=void 0;Ud.contentChunkToJSON=zvo;Ud.contentChunkFromJSON=Vvo;var Qs=Bvo(ae()),Uvo=te(),nCr=Mlt(),oCr=JH(),iCr=iMe(),aCr=KH(),sCr=sMe(),uCr=Vq(),lCr=XH();Ud.ContentChunk$inboundSchema=Qs.union([aCr.ImageURLChunk$inboundSchema.and(Qs.object({type:Qs.literal("image_url")}).transform(t=>({type:t.type}))),oCr.DocumentURLChunk$inboundSchema.and(Qs.object({type:Qs.literal("document_url")}).transform(t=>({type:t.type}))),uCr.TextChunk$inboundSchema.and(Qs.object({type:Qs.literal("text")}).transform(t=>({type:t.type}))),sCr.ReferenceChunk$inboundSchema.and(Qs.object({type:Qs.literal("reference")}).transform(t=>({type:t.type}))),iCr.FileChunk$inboundSchema.and(Qs.object({type:Qs.literal("file")}).transform(t=>({type:t.type}))),lCr.ThinkChunk$inboundSchema.and(Qs.object({type:Qs.literal("thinking")}).transform(t=>({type:t.type}))),nCr.AudioChunk$inboundSchema.and(Qs.object({type:Qs.literal("input_audio")}).transform(t=>({type:t.type})))]);Ud.ContentChunk$outboundSchema=Qs.union([aCr.ImageURLChunk$outboundSchema.and(Qs.object({type:Qs.literal("image_url")}).transform(t=>({type:t.type}))),oCr.DocumentURLChunk$outboundSchema.and(Qs.object({type:Qs.literal("document_url")}).transform(t=>({type:t.type}))),uCr.TextChunk$outboundSchema.and(Qs.object({type:Qs.literal("text")}).transform(t=>({type:t.type}))),sCr.ReferenceChunk$outboundSchema.and(Qs.object({type:Qs.literal("reference")}).transform(t=>({type:t.type}))),iCr.FileChunk$outboundSchema.and(Qs.object({type:Qs.literal("file")}).transform(t=>({type:t.type}))),lCr.ThinkChunk$outboundSchema.and(Qs.object({type:Qs.literal("thinking")}).transform(t=>({type:t.type}))),nCr.AudioChunk$outboundSchema.and(Qs.object({type:Qs.literal("input_audio")}).transform(t=>({type:t.type})))]);var rCr;(function(t){t.inboundSchema=Ud.ContentChunk$inboundSchema,t.outboundSchema=Ud.ContentChunk$outboundSchema})(rCr||(Ud.ContentChunk$=rCr={}));function zvo(t){return JSON.stringify(Ud.ContentChunk$outboundSchema.parse(t))}function Vvo(t){return(0,Uvo.safeParse)(t,e=>Ud.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var Ilt=S(ms=>{"use strict";var Hvo=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]}),Wvo=ms&&ms.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jvo=ms&&ms.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Hvo(r,e,n[o]);return Wvo(r,e),r}}();Object.defineProperty(ms,"__esModule",{value:!0});ms.FunctionCall$=ms.FunctionCall$outboundSchema=ms.FunctionCall$inboundSchema=ms.Arguments$=ms.Arguments$outboundSchema=ms.Arguments$inboundSchema=void 0;ms.argumentsToJSON=Kvo;ms.argumentsFromJSON=Gvo;ms.functionCallToJSON=Xvo;ms.functionCallFromJSON=Zvo;var zd=Jvo(ae()),fCr=te();ms.Arguments$inboundSchema=zd.union([zd.record(zd.any()),zd.string()]);ms.Arguments$outboundSchema=zd.union([zd.record(zd.any()),zd.string()]);var cCr;(function(t){t.inboundSchema=ms.Arguments$inboundSchema,t.outboundSchema=ms.Arguments$outboundSchema})(cCr||(ms.Arguments$=cCr={}));function Kvo(t){return JSON.stringify(ms.Arguments$outboundSchema.parse(t))}function Gvo(t){return(0,fCr.safeParse)(t,e=>ms.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}ms.FunctionCall$inboundSchema=zd.object({name:zd.string(),arguments:zd.union([zd.record(zd.any()),zd.string()])});ms.FunctionCall$outboundSchema=zd.object({name:zd.string(),arguments:zd.union([zd.record(zd.any()),zd.string()])});var dCr;(function(t){t.inboundSchema=ms.FunctionCall$inboundSchema,t.outboundSchema=ms.FunctionCall$outboundSchema})(dCr||(ms.FunctionCall$=dCr={}));function Xvo(t){return JSON.stringify(ms.FunctionCall$outboundSchema.parse(t))}function Zvo(t){return(0,fCr.safeParse)(t,e=>ms.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var kx=S(Alt=>{"use strict";Object.defineProperty(Alt,"__esModule",{value:!0});Alt.catchUnrecognizedEnum=Yvo;function Yvo(t){return t}});var fse=S(Vd=>{"use strict";var Qvo=Vd&&Vd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ewo=Vd&&Vd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),two=Vd&&Vd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Qvo(r,e,n[o]);return ewo(r,e),r}}();Object.defineProperty(Vd,"__esModule",{value:!0});Vd.ToolTypes$=Vd.ToolTypes$outboundSchema=Vd.ToolTypes$inboundSchema=Vd.ToolTypes=void 0;var ZH=two(ae()),rwo=kx();Vd.ToolTypes={Function:"function"};Vd.ToolTypes$inboundSchema=ZH.union([ZH.nativeEnum(Vd.ToolTypes),ZH.string().transform(rwo.catchUnrecognizedEnum)]);Vd.ToolTypes$outboundSchema=ZH.union([ZH.nativeEnum(Vd.ToolTypes),ZH.string().and(ZH.custom())]);var pCr;(function(t){t.inboundSchema=Vd.ToolTypes$inboundSchema,t.outboundSchema=Vd.ToolTypes$outboundSchema})(pCr||(Vd.ToolTypes$=pCr={}))});var cMe=S(Hd=>{"use strict";var nwo=Hd&&Hd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),owo=Hd&&Hd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iwo=Hd&&Hd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nwo(r,e,n[o]);return owo(r,e),r}}();Object.defineProperty(Hd,"__esModule",{value:!0});Hd.ToolCall$=Hd.ToolCall$outboundSchema=Hd.ToolCall$inboundSchema=void 0;Hd.toolCallToJSON=swo;Hd.toolCallFromJSON=uwo;var t7=iwo(ae()),awo=te(),hCr=Ilt(),gCr=fse();Hd.ToolCall$inboundSchema=t7.object({id:t7.string().default("null"),type:gCr.ToolTypes$inboundSchema.optional(),function:hCr.FunctionCall$inboundSchema,index:t7.number().int().default(0)});Hd.ToolCall$outboundSchema=t7.object({id:t7.string().default("null"),type:gCr.ToolTypes$outboundSchema.optional(),function:hCr.FunctionCall$outboundSchema,index:t7.number().int().default(0)});var mCr;(function(t){t.inboundSchema=Hd.ToolCall$inboundSchema,t.outboundSchema=Hd.ToolCall$outboundSchema})(mCr||(Hd.ToolCall$=mCr={}));function swo(t){return JSON.stringify(Hd.ToolCall$outboundSchema.parse(t))}function uwo(t){return(0,awo.safeParse)(t,e=>Hd.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var OA=S(ho=>{"use strict";var lwo=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]}),cwo=ho&&ho.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dwo=ho&&ho.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&lwo(r,e,n[o]);return cwo(r,e),r}}();Object.defineProperty(ho,"__esModule",{value:!0});ho.AssistantMessage$=ho.AssistantMessage$outboundSchema=ho.AssistantMessage$inboundSchema=ho.AssistantMessageRole$=ho.AssistantMessageRole$outboundSchema=ho.AssistantMessageRole$inboundSchema=ho.AssistantMessageContent$=ho.AssistantMessageContent$outboundSchema=ho.AssistantMessageContent$inboundSchema=ho.AssistantMessageRole=void 0;ho.assistantMessageContentToJSON=fwo;ho.assistantMessageContentFromJSON=pwo;ho.assistantMessageToJSON=mwo;ho.assistantMessageFromJSON=hwo;var Tc=dwo(ae()),vCr=ce(),wCr=te(),dMe=e7(),SCr=cMe();ho.AssistantMessageRole={Assistant:"assistant"};ho.AssistantMessageContent$inboundSchema=Tc.union([Tc.string(),Tc.array(dMe.ContentChunk$inboundSchema)]);ho.AssistantMessageContent$outboundSchema=Tc.union([Tc.string(),Tc.array(dMe.ContentChunk$outboundSchema)]);var yCr;(function(t){t.inboundSchema=ho.AssistantMessageContent$inboundSchema,t.outboundSchema=ho.AssistantMessageContent$outboundSchema})(yCr||(ho.AssistantMessageContent$=yCr={}));function fwo(t){return JSON.stringify(ho.AssistantMessageContent$outboundSchema.parse(t))}function pwo(t){return(0,wCr.safeParse)(t,e=>ho.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}ho.AssistantMessageRole$inboundSchema=Tc.nativeEnum(ho.AssistantMessageRole);ho.AssistantMessageRole$outboundSchema=ho.AssistantMessageRole$inboundSchema;var bCr;(function(t){t.inboundSchema=ho.AssistantMessageRole$inboundSchema,t.outboundSchema=ho.AssistantMessageRole$outboundSchema})(bCr||(ho.AssistantMessageRole$=bCr={}));ho.AssistantMessage$inboundSchema=Tc.object({content:Tc.nullable(Tc.union([Tc.string(),Tc.array(dMe.ContentChunk$inboundSchema)])).optional(),tool_calls:Tc.nullable(Tc.array(SCr.ToolCall$inboundSchema)).optional(),prefix:Tc.boolean().default(!1),role:ho.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,vCr.remap)(t,{tool_calls:"toolCalls"}));ho.AssistantMessage$outboundSchema=Tc.object({content:Tc.nullable(Tc.union([Tc.string(),Tc.array(dMe.ContentChunk$outboundSchema)])).optional(),toolCalls:Tc.nullable(Tc.array(SCr.ToolCall$outboundSchema)).optional(),prefix:Tc.boolean().default(!1),role:ho.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,vCr.remap)(t,{toolCalls:"tool_calls"}));var _Cr;(function(t){t.inboundSchema=ho.AssistantMessage$inboundSchema,t.outboundSchema=ho.AssistantMessage$outboundSchema})(_Cr||(ho.AssistantMessage$=_Cr={}));function mwo(t){return JSON.stringify(ho.AssistantMessage$outboundSchema.parse(t))}function hwo(t){return(0,wCr.safeParse)(t,e=>ho.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var r7=S(Wd=>{"use strict";var gwo=Wd&&Wd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ywo=Wd&&Wd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bwo=Wd&&Wd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gwo(r,e,n[o]);return ywo(r,e),r}}();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.MistralPromptMode$=Wd.MistralPromptMode$outboundSchema=Wd.MistralPromptMode$inboundSchema=Wd.MistralPromptMode=void 0;var YH=bwo(ae()),_wo=kx();Wd.MistralPromptMode={Reasoning:"reasoning"};Wd.MistralPromptMode$inboundSchema=YH.union([YH.nativeEnum(Wd.MistralPromptMode),YH.string().transform(_wo.catchUnrecognizedEnum)]);Wd.MistralPromptMode$outboundSchema=YH.union([YH.nativeEnum(Wd.MistralPromptMode),YH.string().and(YH.custom())]);var CCr;(function(t){t.inboundSchema=Wd.MistralPromptMode$inboundSchema,t.outboundSchema=Wd.MistralPromptMode$outboundSchema})(CCr||(Wd.MistralPromptMode$=CCr={}))});var Nlt=S(Jd=>{"use strict";var vwo=Jd&&Jd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wwo=Jd&&Jd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Swo=Jd&&Jd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vwo(r,e,n[o]);return wwo(r,e),r}}();Object.defineProperty(Jd,"__esModule",{value:!0});Jd.SystemMessageContentChunks$=Jd.SystemMessageContentChunks$outboundSchema=Jd.SystemMessageContentChunks$inboundSchema=void 0;Jd.systemMessageContentChunksToJSON=xwo;Jd.systemMessageContentChunksFromJSON=Two;var EA=Swo(ae()),Cwo=te(),TCr=Vq(),OCr=XH();Jd.SystemMessageContentChunks$inboundSchema=EA.union([TCr.TextChunk$inboundSchema.and(EA.object({type:EA.literal("text")}).transform(t=>({type:t.type}))),OCr.ThinkChunk$inboundSchema.and(EA.object({type:EA.literal("thinking")}).transform(t=>({type:t.type})))]);Jd.SystemMessageContentChunks$outboundSchema=EA.union([TCr.TextChunk$outboundSchema.and(EA.object({type:EA.literal("text")}).transform(t=>({type:t.type}))),OCr.ThinkChunk$outboundSchema.and(EA.object({type:EA.literal("thinking")}).transform(t=>({type:t.type})))]);var xCr;(function(t){t.inboundSchema=Jd.SystemMessageContentChunks$inboundSchema,t.outboundSchema=Jd.SystemMessageContentChunks$outboundSchema})(xCr||(Jd.SystemMessageContentChunks$=xCr={}));function xwo(t){return JSON.stringify(Jd.SystemMessageContentChunks$outboundSchema.parse(t))}function Two(t){return(0,Cwo.safeParse)(t,e=>Jd.SystemMessageContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContentChunks' from JSON")}});var UD=S(go=>{"use strict";var Owo=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]}),Ewo=go&&go.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pwo=go&&go.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Owo(r,e,n[o]);return Ewo(r,e),r}}();Object.defineProperty(go,"__esModule",{value:!0});go.SystemMessage$=go.SystemMessage$outboundSchema=go.SystemMessage$inboundSchema=go.Role$=go.Role$outboundSchema=go.Role$inboundSchema=go.SystemMessageContent$=go.SystemMessageContent$outboundSchema=go.SystemMessageContent$inboundSchema=go.Role=void 0;go.systemMessageContentToJSON=Mwo;go.systemMessageContentFromJSON=Rwo;go.systemMessageToJSON=Iwo;go.systemMessageFromJSON=Awo;var Jb=Pwo(ae()),RCr=te(),fMe=Nlt();go.Role={System:"system"};go.SystemMessageContent$inboundSchema=Jb.union([Jb.string(),Jb.array(fMe.SystemMessageContentChunks$inboundSchema)]);go.SystemMessageContent$outboundSchema=Jb.union([Jb.string(),Jb.array(fMe.SystemMessageContentChunks$outboundSchema)]);var ECr;(function(t){t.inboundSchema=go.SystemMessageContent$inboundSchema,t.outboundSchema=go.SystemMessageContent$outboundSchema})(ECr||(go.SystemMessageContent$=ECr={}));function Mwo(t){return JSON.stringify(go.SystemMessageContent$outboundSchema.parse(t))}function Rwo(t){return(0,RCr.safeParse)(t,e=>go.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}go.Role$inboundSchema=Jb.nativeEnum(go.Role);go.Role$outboundSchema=go.Role$inboundSchema;var PCr;(function(t){t.inboundSchema=go.Role$inboundSchema,t.outboundSchema=go.Role$outboundSchema})(PCr||(go.Role$=PCr={}));go.SystemMessage$inboundSchema=Jb.object({content:Jb.union([Jb.string(),Jb.array(fMe.SystemMessageContentChunks$inboundSchema)]),role:go.Role$inboundSchema.default("system")});go.SystemMessage$outboundSchema=Jb.object({content:Jb.union([Jb.string(),Jb.array(fMe.SystemMessageContentChunks$outboundSchema)]),role:go.Role$outboundSchema.default("system")});var MCr;(function(t){t.inboundSchema=go.SystemMessage$inboundSchema,t.outboundSchema=go.SystemMessage$outboundSchema})(MCr||(go.SystemMessage$=MCr={}));function Iwo(t){return JSON.stringify(go.SystemMessage$outboundSchema.parse(t))}function Awo(t){return(0,RCr.safeParse)(t,e=>go.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var n7=S(Kd=>{"use strict";var Nwo=Kd&&Kd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Dwo=Kd&&Kd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jwo=Kd&&Kd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Nwo(r,e,n[o]);return Dwo(r,e),r}}();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.Tool$=Kd.Tool$outboundSchema=Kd.Tool$inboundSchema=void 0;Kd.toolToJSON=Lwo;Kd.toolFromJSON=Fwo;var ACr=jwo(ae()),$wo=te(),NCr=WPe(),DCr=fse();Kd.Tool$inboundSchema=ACr.object({type:DCr.ToolTypes$inboundSchema.optional(),function:NCr.FunctionT$inboundSchema});Kd.Tool$outboundSchema=ACr.object({type:DCr.ToolTypes$outboundSchema.optional(),function:NCr.FunctionT$outboundSchema});var ICr;(function(t){t.inboundSchema=Kd.Tool$inboundSchema,t.outboundSchema=Kd.Tool$outboundSchema})(ICr||(Kd.Tool$=ICr={}));function Lwo(t){return JSON.stringify(Kd.Tool$outboundSchema.parse(t))}function Fwo(t){return(0,$wo.safeParse)(t,e=>Kd.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var Dlt=S(Gd=>{"use strict";var kwo=Gd&&Gd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qwo=Gd&&Gd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bwo=Gd&&Gd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kwo(r,e,n[o]);return qwo(r,e),r}}();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.FunctionName$=Gd.FunctionName$outboundSchema=Gd.FunctionName$inboundSchema=void 0;Gd.functionNameToJSON=zwo;Gd.functionNameFromJSON=Vwo;var pMe=Bwo(ae()),Uwo=te();Gd.FunctionName$inboundSchema=pMe.object({name:pMe.string()});Gd.FunctionName$outboundSchema=pMe.object({name:pMe.string()});var jCr;(function(t){t.inboundSchema=Gd.FunctionName$inboundSchema,t.outboundSchema=Gd.FunctionName$outboundSchema})(jCr||(Gd.FunctionName$=jCr={}));function zwo(t){return JSON.stringify(Gd.FunctionName$outboundSchema.parse(t))}function Vwo(t){return(0,Uwo.safeParse)(t,e=>Gd.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var o7=S(Xd=>{"use strict";var Hwo=Xd&&Xd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wwo=Xd&&Xd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jwo=Xd&&Xd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Hwo(r,e,n[o]);return Wwo(r,e),r}}();Object.defineProperty(Xd,"__esModule",{value:!0});Xd.ToolChoice$=Xd.ToolChoice$outboundSchema=Xd.ToolChoice$inboundSchema=void 0;Xd.toolChoiceToJSON=Gwo;Xd.toolChoiceFromJSON=Xwo;var LCr=Jwo(ae()),Kwo=te(),FCr=Dlt(),kCr=fse();Xd.ToolChoice$inboundSchema=LCr.object({type:kCr.ToolTypes$inboundSchema.optional(),function:FCr.FunctionName$inboundSchema});Xd.ToolChoice$outboundSchema=LCr.object({type:kCr.ToolTypes$outboundSchema.optional(),function:FCr.FunctionName$outboundSchema});var $Cr;(function(t){t.inboundSchema=Xd.ToolChoice$inboundSchema,t.outboundSchema=Xd.ToolChoice$outboundSchema})($Cr||(Xd.ToolChoice$=$Cr={}));function Gwo(t){return JSON.stringify(Xd.ToolChoice$outboundSchema.parse(t))}function Xwo(t){return(0,Kwo.safeParse)(t,e=>Xd.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var zD=S(yo=>{"use strict";var Zwo=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]}),Ywo=yo&&yo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qwo=yo&&yo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Zwo(r,e,n[o]);return Ywo(r,e),r}}();Object.defineProperty(yo,"__esModule",{value:!0});yo.ToolMessage$=yo.ToolMessage$outboundSchema=yo.ToolMessage$inboundSchema=yo.ToolMessageRole$=yo.ToolMessageRole$outboundSchema=yo.ToolMessageRole$inboundSchema=yo.ToolMessageContent$=yo.ToolMessageContent$outboundSchema=yo.ToolMessageContent$inboundSchema=yo.ToolMessageRole=void 0;yo.toolMessageContentToJSON=eSo;yo.toolMessageContentFromJSON=tSo;yo.toolMessageToJSON=rSo;yo.toolMessageFromJSON=nSo;var Ml=Qwo(ae()),zCr=ce(),VCr=te(),mMe=e7();yo.ToolMessageRole={Tool:"tool"};yo.ToolMessageContent$inboundSchema=Ml.union([Ml.string(),Ml.array(mMe.ContentChunk$inboundSchema)]);yo.ToolMessageContent$outboundSchema=Ml.union([Ml.string(),Ml.array(mMe.ContentChunk$outboundSchema)]);var qCr;(function(t){t.inboundSchema=yo.ToolMessageContent$inboundSchema,t.outboundSchema=yo.ToolMessageContent$outboundSchema})(qCr||(yo.ToolMessageContent$=qCr={}));function eSo(t){return JSON.stringify(yo.ToolMessageContent$outboundSchema.parse(t))}function tSo(t){return(0,VCr.safeParse)(t,e=>yo.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}yo.ToolMessageRole$inboundSchema=Ml.nativeEnum(yo.ToolMessageRole);yo.ToolMessageRole$outboundSchema=yo.ToolMessageRole$inboundSchema;var BCr;(function(t){t.inboundSchema=yo.ToolMessageRole$inboundSchema,t.outboundSchema=yo.ToolMessageRole$outboundSchema})(BCr||(yo.ToolMessageRole$=BCr={}));yo.ToolMessage$inboundSchema=Ml.object({content:Ml.nullable(Ml.union([Ml.string(),Ml.array(mMe.ContentChunk$inboundSchema)])),tool_call_id:Ml.nullable(Ml.string()).optional(),name:Ml.nullable(Ml.string()).optional(),role:yo.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,zCr.remap)(t,{tool_call_id:"toolCallId"}));yo.ToolMessage$outboundSchema=Ml.object({content:Ml.nullable(Ml.union([Ml.string(),Ml.array(mMe.ContentChunk$outboundSchema)])),toolCallId:Ml.nullable(Ml.string()).optional(),name:Ml.nullable(Ml.string()).optional(),role:yo.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,zCr.remap)(t,{toolCallId:"tool_call_id"}));var UCr;(function(t){t.inboundSchema=yo.ToolMessage$inboundSchema,t.outboundSchema=yo.ToolMessage$outboundSchema})(UCr||(yo.ToolMessage$=UCr={}));function rSo(t){return JSON.stringify(yo.ToolMessage$outboundSchema.parse(t))}function nSo(t){return(0,VCr.safeParse)(t,e=>yo.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var VD=S(bo=>{"use strict";var oSo=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]}),iSo=bo&&bo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aSo=bo&&bo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&oSo(r,e,n[o]);return iSo(r,e),r}}();Object.defineProperty(bo,"__esModule",{value:!0});bo.UserMessage$=bo.UserMessage$outboundSchema=bo.UserMessage$inboundSchema=bo.UserMessageRole$=bo.UserMessageRole$outboundSchema=bo.UserMessageRole$inboundSchema=bo.UserMessageContent$=bo.UserMessageContent$outboundSchema=bo.UserMessageContent$inboundSchema=bo.UserMessageRole=void 0;bo.userMessageContentToJSON=sSo;bo.userMessageContentFromJSON=uSo;bo.userMessageToJSON=lSo;bo.userMessageFromJSON=cSo;var Gg=aSo(ae()),KCr=te(),hMe=e7();bo.UserMessageRole={User:"user"};bo.UserMessageContent$inboundSchema=Gg.union([Gg.string(),Gg.array(hMe.ContentChunk$inboundSchema)]);bo.UserMessageContent$outboundSchema=Gg.union([Gg.string(),Gg.array(hMe.ContentChunk$outboundSchema)]);var HCr;(function(t){t.inboundSchema=bo.UserMessageContent$inboundSchema,t.outboundSchema=bo.UserMessageContent$outboundSchema})(HCr||(bo.UserMessageContent$=HCr={}));function sSo(t){return JSON.stringify(bo.UserMessageContent$outboundSchema.parse(t))}function uSo(t){return(0,KCr.safeParse)(t,e=>bo.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}bo.UserMessageRole$inboundSchema=Gg.nativeEnum(bo.UserMessageRole);bo.UserMessageRole$outboundSchema=bo.UserMessageRole$inboundSchema;var WCr;(function(t){t.inboundSchema=bo.UserMessageRole$inboundSchema,t.outboundSchema=bo.UserMessageRole$outboundSchema})(WCr||(bo.UserMessageRole$=WCr={}));bo.UserMessage$inboundSchema=Gg.object({content:Gg.nullable(Gg.union([Gg.string(),Gg.array(hMe.ContentChunk$inboundSchema)])),role:bo.UserMessageRole$inboundSchema.default("user")});bo.UserMessage$outboundSchema=Gg.object({content:Gg.nullable(Gg.union([Gg.string(),Gg.array(hMe.ContentChunk$outboundSchema)])),role:bo.UserMessageRole$outboundSchema.default("user")});var JCr;(function(t){t.inboundSchema=bo.UserMessage$inboundSchema,t.outboundSchema=bo.UserMessage$outboundSchema})(JCr||(bo.UserMessage$=JCr={}));function lSo(t){return JSON.stringify(bo.UserMessage$outboundSchema.parse(t))}function cSo(t){return(0,KCr.safeParse)(t,e=>bo.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var oxr=S(Yr=>{"use strict";var dSo=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]}),fSo=Yr&&Yr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pSo=Yr&&Yr.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dSo(r,e,n[o]);return fSo(r,e),r}}();Object.defineProperty(Yr,"__esModule",{value:!0});Yr.AgentsCompletionRequest$=Yr.AgentsCompletionRequest$outboundSchema=Yr.AgentsCompletionRequest$inboundSchema=Yr.AgentsCompletionRequestToolChoice$=Yr.AgentsCompletionRequestToolChoice$outboundSchema=Yr.AgentsCompletionRequestToolChoice$inboundSchema=Yr.AgentsCompletionRequestMessages$=Yr.AgentsCompletionRequestMessages$outboundSchema=Yr.AgentsCompletionRequestMessages$inboundSchema=Yr.AgentsCompletionRequestStop$=Yr.AgentsCompletionRequestStop$outboundSchema=Yr.AgentsCompletionRequestStop$inboundSchema=void 0;Yr.agentsCompletionRequestStopToJSON=mSo;Yr.agentsCompletionRequestStopFromJSON=hSo;Yr.agentsCompletionRequestMessagesToJSON=gSo;Yr.agentsCompletionRequestMessagesFromJSON=ySo;Yr.agentsCompletionRequestToolChoiceToJSON=bSo;Yr.agentsCompletionRequestToolChoiceFromJSON=_So;Yr.agentsCompletionRequestToJSON=vSo;Yr.agentsCompletionRequestFromJSON=wSo;var St=pSo(ae()),QCr=ce(),gMe=te(),yMe=OA(),exr=r7(),txr=VH(),rxr=Lq(),bMe=UD(),nxr=n7(),_Me=o7(),vMe=HH(),wMe=zD(),SMe=VD();Yr.AgentsCompletionRequestStop$inboundSchema=St.union([St.string(),St.array(St.string())]);Yr.AgentsCompletionRequestStop$outboundSchema=St.union([St.string(),St.array(St.string())]);var GCr;(function(t){t.inboundSchema=Yr.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=Yr.AgentsCompletionRequestStop$outboundSchema})(GCr||(Yr.AgentsCompletionRequestStop$=GCr={}));function mSo(t){return JSON.stringify(Yr.AgentsCompletionRequestStop$outboundSchema.parse(t))}function hSo(t){return(0,gMe.safeParse)(t,e=>Yr.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}Yr.AgentsCompletionRequestMessages$inboundSchema=St.union([bMe.SystemMessage$inboundSchema.and(St.object({role:St.literal("system")}).transform(t=>({role:t.role}))),wMe.ToolMessage$inboundSchema.and(St.object({role:St.literal("tool")}).transform(t=>({role:t.role}))),SMe.UserMessage$inboundSchema.and(St.object({role:St.literal("user")}).transform(t=>({role:t.role}))),yMe.AssistantMessage$inboundSchema.and(St.object({role:St.literal("assistant")}).transform(t=>({role:t.role})))]);Yr.AgentsCompletionRequestMessages$outboundSchema=St.union([bMe.SystemMessage$outboundSchema.and(St.object({role:St.literal("system")}).transform(t=>({role:t.role}))),wMe.ToolMessage$outboundSchema.and(St.object({role:St.literal("tool")}).transform(t=>({role:t.role}))),SMe.UserMessage$outboundSchema.and(St.object({role:St.literal("user")}).transform(t=>({role:t.role}))),yMe.AssistantMessage$outboundSchema.and(St.object({role:St.literal("assistant")}).transform(t=>({role:t.role})))]);var XCr;(function(t){t.inboundSchema=Yr.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=Yr.AgentsCompletionRequestMessages$outboundSchema})(XCr||(Yr.AgentsCompletionRequestMessages$=XCr={}));function gSo(t){return JSON.stringify(Yr.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function ySo(t){return(0,gMe.safeParse)(t,e=>Yr.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}Yr.AgentsCompletionRequestToolChoice$inboundSchema=St.union([_Me.ToolChoice$inboundSchema,vMe.ToolChoiceEnum$inboundSchema]);Yr.AgentsCompletionRequestToolChoice$outboundSchema=St.union([_Me.ToolChoice$outboundSchema,vMe.ToolChoiceEnum$outboundSchema]);var ZCr;(function(t){t.inboundSchema=Yr.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Yr.AgentsCompletionRequestToolChoice$outboundSchema})(ZCr||(Yr.AgentsCompletionRequestToolChoice$=ZCr={}));function bSo(t){return JSON.stringify(Yr.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function _So(t){return(0,gMe.safeParse)(t,e=>Yr.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}Yr.AgentsCompletionRequest$inboundSchema=St.object({max_tokens:St.nullable(St.number().int()).optional(),stream:St.boolean().default(!1),stop:St.union([St.string(),St.array(St.string())]).optional(),random_seed:St.nullable(St.number().int()).optional(),messages:St.array(St.union([bMe.SystemMessage$inboundSchema.and(St.object({role:St.literal("system")}).transform(t=>({role:t.role}))),wMe.ToolMessage$inboundSchema.and(St.object({role:St.literal("tool")}).transform(t=>({role:t.role}))),SMe.UserMessage$inboundSchema.and(St.object({role:St.literal("user")}).transform(t=>({role:t.role}))),yMe.AssistantMessage$inboundSchema.and(St.object({role:St.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:rxr.ResponseFormat$inboundSchema.optional(),tools:St.nullable(St.array(nxr.Tool$inboundSchema)).optional(),tool_choice:St.union([_Me.ToolChoice$inboundSchema,vMe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:St.number().optional(),frequency_penalty:St.number().optional(),n:St.nullable(St.number().int()).optional(),prediction:txr.Prediction$inboundSchema.optional(),parallel_tool_calls:St.boolean().optional(),prompt_mode:St.nullable(exr.MistralPromptMode$inboundSchema).optional(),agent_id:St.string()}).transform(t=>(0,QCr.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",parallel_tool_calls:"parallelToolCalls",prompt_mode:"promptMode",agent_id:"agentId"}));Yr.AgentsCompletionRequest$outboundSchema=St.object({maxTokens:St.nullable(St.number().int()).optional(),stream:St.boolean().default(!1),stop:St.union([St.string(),St.array(St.string())]).optional(),randomSeed:St.nullable(St.number().int()).optional(),messages:St.array(St.union([bMe.SystemMessage$outboundSchema.and(St.object({role:St.literal("system")}).transform(t=>({role:t.role}))),wMe.ToolMessage$outboundSchema.and(St.object({role:St.literal("tool")}).transform(t=>({role:t.role}))),SMe.UserMessage$outboundSchema.and(St.object({role:St.literal("user")}).transform(t=>({role:t.role}))),yMe.AssistantMessage$outboundSchema.and(St.object({role:St.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:rxr.ResponseFormat$outboundSchema.optional(),tools:St.nullable(St.array(nxr.Tool$outboundSchema)).optional(),toolChoice:St.union([_Me.ToolChoice$outboundSchema,vMe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:St.number().optional(),frequencyPenalty:St.number().optional(),n:St.nullable(St.number().int()).optional(),prediction:txr.Prediction$outboundSchema.optional(),parallelToolCalls:St.boolean().optional(),promptMode:St.nullable(exr.MistralPromptMode$outboundSchema).optional(),agentId:St.string()}).transform(t=>(0,QCr.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",parallelToolCalls:"parallel_tool_calls",promptMode:"prompt_mode",agentId:"agent_id"}));var YCr;(function(t){t.inboundSchema=Yr.AgentsCompletionRequest$inboundSchema,t.outboundSchema=Yr.AgentsCompletionRequest$outboundSchema})(YCr||(Yr.AgentsCompletionRequest$=YCr={}));function vSo(t){return JSON.stringify(Yr.AgentsCompletionRequest$outboundSchema.parse(t))}function wSo(t){return(0,gMe.safeParse)(t,e=>Yr.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var mxr=S(Qr=>{"use strict";var SSo=Qr&&Qr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CSo=Qr&&Qr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xSo=Qr&&Qr.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&SSo(r,e,n[o]);return CSo(r,e),r}}();Object.defineProperty(Qr,"__esModule",{value:!0});Qr.AgentsCompletionStreamRequest$=Qr.AgentsCompletionStreamRequest$outboundSchema=Qr.AgentsCompletionStreamRequest$inboundSchema=Qr.AgentsCompletionStreamRequestToolChoice$=Qr.AgentsCompletionStreamRequestToolChoice$outboundSchema=Qr.AgentsCompletionStreamRequestToolChoice$inboundSchema=Qr.AgentsCompletionStreamRequestMessages$=Qr.AgentsCompletionStreamRequestMessages$outboundSchema=Qr.AgentsCompletionStreamRequestMessages$inboundSchema=Qr.AgentsCompletionStreamRequestStop$=Qr.AgentsCompletionStreamRequestStop$outboundSchema=Qr.AgentsCompletionStreamRequestStop$inboundSchema=void 0;Qr.agentsCompletionStreamRequestStopToJSON=TSo;Qr.agentsCompletionStreamRequestStopFromJSON=OSo;Qr.agentsCompletionStreamRequestMessagesToJSON=ESo;Qr.agentsCompletionStreamRequestMessagesFromJSON=PSo;Qr.agentsCompletionStreamRequestToolChoiceToJSON=MSo;Qr.agentsCompletionStreamRequestToolChoiceFromJSON=RSo;Qr.agentsCompletionStreamRequestToJSON=ISo;Qr.agentsCompletionStreamRequestFromJSON=ASo;var Ct=xSo(ae()),lxr=ce(),CMe=te(),xMe=OA(),cxr=r7(),dxr=VH(),fxr=Lq(),TMe=UD(),pxr=n7(),OMe=o7(),EMe=HH(),PMe=zD(),MMe=VD();Qr.AgentsCompletionStreamRequestStop$inboundSchema=Ct.union([Ct.string(),Ct.array(Ct.string())]);Qr.AgentsCompletionStreamRequestStop$outboundSchema=Ct.union([Ct.string(),Ct.array(Ct.string())]);var ixr;(function(t){t.inboundSchema=Qr.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Qr.AgentsCompletionStreamRequestStop$outboundSchema})(ixr||(Qr.AgentsCompletionStreamRequestStop$=ixr={}));function TSo(t){return JSON.stringify(Qr.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function OSo(t){return(0,CMe.safeParse)(t,e=>Qr.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}Qr.AgentsCompletionStreamRequestMessages$inboundSchema=Ct.union([TMe.SystemMessage$inboundSchema.and(Ct.object({role:Ct.literal("system")}).transform(t=>({role:t.role}))),PMe.ToolMessage$inboundSchema.and(Ct.object({role:Ct.literal("tool")}).transform(t=>({role:t.role}))),MMe.UserMessage$inboundSchema.and(Ct.object({role:Ct.literal("user")}).transform(t=>({role:t.role}))),xMe.AssistantMessage$inboundSchema.and(Ct.object({role:Ct.literal("assistant")}).transform(t=>({role:t.role})))]);Qr.AgentsCompletionStreamRequestMessages$outboundSchema=Ct.union([TMe.SystemMessage$outboundSchema.and(Ct.object({role:Ct.literal("system")}).transform(t=>({role:t.role}))),PMe.ToolMessage$outboundSchema.and(Ct.object({role:Ct.literal("tool")}).transform(t=>({role:t.role}))),MMe.UserMessage$outboundSchema.and(Ct.object({role:Ct.literal("user")}).transform(t=>({role:t.role}))),xMe.AssistantMessage$outboundSchema.and(Ct.object({role:Ct.literal("assistant")}).transform(t=>({role:t.role})))]);var axr;(function(t){t.inboundSchema=Qr.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Qr.AgentsCompletionStreamRequestMessages$outboundSchema})(axr||(Qr.AgentsCompletionStreamRequestMessages$=axr={}));function ESo(t){return JSON.stringify(Qr.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function PSo(t){return(0,CMe.safeParse)(t,e=>Qr.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}Qr.AgentsCompletionStreamRequestToolChoice$inboundSchema=Ct.union([OMe.ToolChoice$inboundSchema,EMe.ToolChoiceEnum$inboundSchema]);Qr.AgentsCompletionStreamRequestToolChoice$outboundSchema=Ct.union([OMe.ToolChoice$outboundSchema,EMe.ToolChoiceEnum$outboundSchema]);var sxr;(function(t){t.inboundSchema=Qr.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Qr.AgentsCompletionStreamRequestToolChoice$outboundSchema})(sxr||(Qr.AgentsCompletionStreamRequestToolChoice$=sxr={}));function MSo(t){return JSON.stringify(Qr.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function RSo(t){return(0,CMe.safeParse)(t,e=>Qr.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}Qr.AgentsCompletionStreamRequest$inboundSchema=Ct.object({max_tokens:Ct.nullable(Ct.number().int()).optional(),stream:Ct.boolean().default(!0),stop:Ct.union([Ct.string(),Ct.array(Ct.string())]).optional(),random_seed:Ct.nullable(Ct.number().int()).optional(),messages:Ct.array(Ct.union([TMe.SystemMessage$inboundSchema.and(Ct.object({role:Ct.literal("system")}).transform(t=>({role:t.role}))),PMe.ToolMessage$inboundSchema.and(Ct.object({role:Ct.literal("tool")}).transform(t=>({role:t.role}))),MMe.UserMessage$inboundSchema.and(Ct.object({role:Ct.literal("user")}).transform(t=>({role:t.role}))),xMe.AssistantMessage$inboundSchema.and(Ct.object({role:Ct.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:fxr.ResponseFormat$inboundSchema.optional(),tools:Ct.nullable(Ct.array(pxr.Tool$inboundSchema)).optional(),tool_choice:Ct.union([OMe.ToolChoice$inboundSchema,EMe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Ct.number().optional(),frequency_penalty:Ct.number().optional(),n:Ct.nullable(Ct.number().int()).optional(),prediction:dxr.Prediction$inboundSchema.optional(),parallel_tool_calls:Ct.boolean().optional(),prompt_mode:Ct.nullable(cxr.MistralPromptMode$inboundSchema).optional(),agent_id:Ct.string()}).transform(t=>(0,lxr.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",parallel_tool_calls:"parallelToolCalls",prompt_mode:"promptMode",agent_id:"agentId"}));Qr.AgentsCompletionStreamRequest$outboundSchema=Ct.object({maxTokens:Ct.nullable(Ct.number().int()).optional(),stream:Ct.boolean().default(!0),stop:Ct.union([Ct.string(),Ct.array(Ct.string())]).optional(),randomSeed:Ct.nullable(Ct.number().int()).optional(),messages:Ct.array(Ct.union([TMe.SystemMessage$outboundSchema.and(Ct.object({role:Ct.literal("system")}).transform(t=>({role:t.role}))),PMe.ToolMessage$outboundSchema.and(Ct.object({role:Ct.literal("tool")}).transform(t=>({role:t.role}))),MMe.UserMessage$outboundSchema.and(Ct.object({role:Ct.literal("user")}).transform(t=>({role:t.role}))),xMe.AssistantMessage$outboundSchema.and(Ct.object({role:Ct.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:fxr.ResponseFormat$outboundSchema.optional(),tools:Ct.nullable(Ct.array(pxr.Tool$outboundSchema)).optional(),toolChoice:Ct.union([OMe.ToolChoice$outboundSchema,EMe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Ct.number().optional(),frequencyPenalty:Ct.number().optional(),n:Ct.nullable(Ct.number().int()).optional(),prediction:dxr.Prediction$outboundSchema.optional(),parallelToolCalls:Ct.boolean().optional(),promptMode:Ct.nullable(cxr.MistralPromptMode$outboundSchema).optional(),agentId:Ct.string()}).transform(t=>(0,lxr.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",parallelToolCalls:"parallel_tool_calls",promptMode:"prompt_mode",agentId:"agent_id"}));var uxr;(function(t){t.inboundSchema=Qr.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=Qr.AgentsCompletionStreamRequest$outboundSchema})(uxr||(Qr.AgentsCompletionStreamRequest$=uxr={}));function ISo(t){return JSON.stringify(Qr.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function ASo(t){return(0,CMe.safeParse)(t,e=>Qr.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var vxr=S(hs=>{"use strict";var NSo=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]}),DSo=hs&&hs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jSo=hs&&hs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&NSo(r,e,n[o]);return DSo(r,e),r}}();Object.defineProperty(hs,"__esModule",{value:!0});hs.AgentUpdateRequest$=hs.AgentUpdateRequest$outboundSchema=hs.AgentUpdateRequest$inboundSchema=hs.AgentUpdateRequestTools$=hs.AgentUpdateRequestTools$outboundSchema=hs.AgentUpdateRequestTools$inboundSchema=void 0;hs.agentUpdateRequestToolsToJSON=$So;hs.agentUpdateRequestToolsFromJSON=LSo;hs.agentUpdateRequestToJSON=FSo;hs.agentUpdateRequestFromJSON=kSo;var Ht=jSo(ae()),yxr=ce(),bxr=te(),RMe=jq(),_xr=x0(),IMe=Fq(),AMe=kq(),NMe=qq(),DMe=Bq(),jMe=Uq();hs.AgentUpdateRequestTools$inboundSchema=Ht.union([IMe.DocumentLibraryTool$inboundSchema.and(Ht.object({type:Ht.literal("document_library")}).transform(t=>({type:t.type}))),AMe.FunctionTool$inboundSchema.and(Ht.object({type:Ht.literal("function")}).transform(t=>({type:t.type}))),RMe.CodeInterpreterTool$inboundSchema.and(Ht.object({type:Ht.literal("code_interpreter")}).transform(t=>({type:t.type}))),NMe.ImageGenerationTool$inboundSchema.and(Ht.object({type:Ht.literal("image_generation")}).transform(t=>({type:t.type}))),jMe.WebSearchTool$inboundSchema.and(Ht.object({type:Ht.literal("web_search")}).transform(t=>({type:t.type}))),DMe.WebSearchPremiumTool$inboundSchema.and(Ht.object({type:Ht.literal("web_search_premium")}).transform(t=>({type:t.type})))]);hs.AgentUpdateRequestTools$outboundSchema=Ht.union([IMe.DocumentLibraryTool$outboundSchema.and(Ht.object({type:Ht.literal("document_library")}).transform(t=>({type:t.type}))),AMe.FunctionTool$outboundSchema.and(Ht.object({type:Ht.literal("function")}).transform(t=>({type:t.type}))),RMe.CodeInterpreterTool$outboundSchema.and(Ht.object({type:Ht.literal("code_interpreter")}).transform(t=>({type:t.type}))),NMe.ImageGenerationTool$outboundSchema.and(Ht.object({type:Ht.literal("image_generation")}).transform(t=>({type:t.type}))),jMe.WebSearchTool$outboundSchema.and(Ht.object({type:Ht.literal("web_search")}).transform(t=>({type:t.type}))),DMe.WebSearchPremiumTool$outboundSchema.and(Ht.object({type:Ht.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var hxr;(function(t){t.inboundSchema=hs.AgentUpdateRequestTools$inboundSchema,t.outboundSchema=hs.AgentUpdateRequestTools$outboundSchema})(hxr||(hs.AgentUpdateRequestTools$=hxr={}));function $So(t){return JSON.stringify(hs.AgentUpdateRequestTools$outboundSchema.parse(t))}function LSo(t){return(0,bxr.safeParse)(t,e=>hs.AgentUpdateRequestTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentUpdateRequestTools' from JSON")}hs.AgentUpdateRequest$inboundSchema=Ht.object({instructions:Ht.nullable(Ht.string()).optional(),tools:Ht.array(Ht.union([IMe.DocumentLibraryTool$inboundSchema.and(Ht.object({type:Ht.literal("document_library")}).transform(t=>({type:t.type}))),AMe.FunctionTool$inboundSchema.and(Ht.object({type:Ht.literal("function")}).transform(t=>({type:t.type}))),RMe.CodeInterpreterTool$inboundSchema.and(Ht.object({type:Ht.literal("code_interpreter")}).transform(t=>({type:t.type}))),NMe.ImageGenerationTool$inboundSchema.and(Ht.object({type:Ht.literal("image_generation")}).transform(t=>({type:t.type}))),jMe.WebSearchTool$inboundSchema.and(Ht.object({type:Ht.literal("web_search")}).transform(t=>({type:t.type}))),DMe.WebSearchPremiumTool$inboundSchema.and(Ht.object({type:Ht.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:_xr.CompletionArgs$inboundSchema.optional(),model:Ht.nullable(Ht.string()).optional(),name:Ht.nullable(Ht.string()).optional(),description:Ht.nullable(Ht.string()).optional(),handoffs:Ht.nullable(Ht.array(Ht.string())).optional()}).transform(t=>(0,yxr.remap)(t,{completion_args:"completionArgs"}));hs.AgentUpdateRequest$outboundSchema=Ht.object({instructions:Ht.nullable(Ht.string()).optional(),tools:Ht.array(Ht.union([IMe.DocumentLibraryTool$outboundSchema.and(Ht.object({type:Ht.literal("document_library")}).transform(t=>({type:t.type}))),AMe.FunctionTool$outboundSchema.and(Ht.object({type:Ht.literal("function")}).transform(t=>({type:t.type}))),RMe.CodeInterpreterTool$outboundSchema.and(Ht.object({type:Ht.literal("code_interpreter")}).transform(t=>({type:t.type}))),NMe.ImageGenerationTool$outboundSchema.and(Ht.object({type:Ht.literal("image_generation")}).transform(t=>({type:t.type}))),jMe.WebSearchTool$outboundSchema.and(Ht.object({type:Ht.literal("web_search")}).transform(t=>({type:t.type}))),DMe.WebSearchPremiumTool$outboundSchema.and(Ht.object({type:Ht.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:_xr.CompletionArgs$outboundSchema.optional(),model:Ht.nullable(Ht.string()).optional(),name:Ht.nullable(Ht.string()).optional(),description:Ht.nullable(Ht.string()).optional(),handoffs:Ht.nullable(Ht.array(Ht.string())).optional()}).transform(t=>(0,yxr.remap)(t,{completionArgs:"completion_args"}));var gxr;(function(t){t.inboundSchema=hs.AgentUpdateRequest$inboundSchema,t.outboundSchema=hs.AgentUpdateRequest$outboundSchema})(gxr||(hs.AgentUpdateRequest$=gxr={}));function FSo(t){return JSON.stringify(hs.AgentUpdateRequest$outboundSchema.parse(t))}function kSo(t){return(0,bxr.safeParse)(t,e=>hs.AgentUpdateRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentUpdateRequest' from JSON")}});var jlt=S(Zd=>{"use strict";var qSo=Zd&&Zd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BSo=Zd&&Zd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),USo=Zd&&Zd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qSo(r,e,n[o]);return BSo(r,e),r}}();Object.defineProperty(Zd,"__esModule",{value:!0});Zd.ApiEndpoint$=Zd.ApiEndpoint$outboundSchema=Zd.ApiEndpoint$inboundSchema=Zd.ApiEndpoint=void 0;var QH=USo(ae()),zSo=kx();Zd.ApiEndpoint={RootV1ChatCompletions:"/v1/chat/completions",RootV1Embeddings:"/v1/embeddings",RootV1FimCompletions:"/v1/fim/completions",RootV1Moderations:"/v1/moderations",RootV1ChatModerations:"/v1/chat/moderations",RootV1Ocr:"/v1/ocr",RootV1Classifications:"/v1/classifications",RootV1ChatClassifications:"/v1/chat/classifications",RootV1Conversations:"/v1/conversations",RootV1AudioTranscriptions:"/v1/audio/transcriptions"};Zd.ApiEndpoint$inboundSchema=QH.union([QH.nativeEnum(Zd.ApiEndpoint),QH.string().transform(zSo.catchUnrecognizedEnum)]);Zd.ApiEndpoint$outboundSchema=QH.union([QH.nativeEnum(Zd.ApiEndpoint),QH.string().and(QH.custom())]);var wxr;(function(t){t.inboundSchema=Zd.ApiEndpoint$inboundSchema,t.outboundSchema=Zd.ApiEndpoint$outboundSchema})(wxr||(Zd.ApiEndpoint$=wxr={}))});var xxr=S(wa=>{"use strict";var VSo=wa&&wa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HSo=wa&&wa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WSo=wa&&wa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&VSo(r,e,n[o]);return HSo(r,e),r}}();Object.defineProperty(wa,"__esModule",{value:!0});wa.ArchiveFTModelOut$=wa.ArchiveFTModelOut$outboundSchema=wa.ArchiveFTModelOut$inboundSchema=wa.ArchiveFTModelOutObject$=wa.ArchiveFTModelOutObject$outboundSchema=wa.ArchiveFTModelOutObject$inboundSchema=wa.ArchiveFTModelOutObject=void 0;wa.archiveFTModelOutToJSON=KSo;wa.archiveFTModelOutFromJSON=GSo;var eW=WSo(ae()),JSo=te();wa.ArchiveFTModelOutObject={Model:"model"};wa.ArchiveFTModelOutObject$inboundSchema=eW.nativeEnum(wa.ArchiveFTModelOutObject);wa.ArchiveFTModelOutObject$outboundSchema=wa.ArchiveFTModelOutObject$inboundSchema;var Sxr;(function(t){t.inboundSchema=wa.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=wa.ArchiveFTModelOutObject$outboundSchema})(Sxr||(wa.ArchiveFTModelOutObject$=Sxr={}));wa.ArchiveFTModelOut$inboundSchema=eW.object({id:eW.string(),object:wa.ArchiveFTModelOutObject$inboundSchema.default("model"),archived:eW.boolean().default(!0)});wa.ArchiveFTModelOut$outboundSchema=eW.object({id:eW.string(),object:wa.ArchiveFTModelOutObject$outboundSchema.default("model"),archived:eW.boolean().default(!0)});var Cxr;(function(t){t.inboundSchema=wa.ArchiveFTModelOut$inboundSchema,t.outboundSchema=wa.ArchiveFTModelOut$outboundSchema})(Cxr||(wa.ArchiveFTModelOut$=Cxr={}));function KSo(t){return JSON.stringify(wa.ArchiveFTModelOut$outboundSchema.parse(t))}function GSo(t){return(0,JSo.safeParse)(t,e=>wa.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var HD=S(qx=>{"use strict";var XSo=qx&&qx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZSo=qx&&qx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YSo=qx&&qx.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XSo(r,e,n[o]);return ZSo(r,e),r}}();Object.defineProperty(qx,"__esModule",{value:!0});qx.blobLikeSchema=void 0;qx.isBlobLike=Txr;var QSo=YSo(ae());qx.blobLikeSchema=QSo.custom(Txr,{message:"expected a Blob, File or Blob-like object",fatal:!0});function Txr(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 $Me=S(Yd=>{"use strict";var e0o=Yd&&Yd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t0o=Yd&&Yd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r0o=Yd&&Yd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&e0o(r,e,n[o]);return t0o(r,e),r}}();Object.defineProperty(Yd,"__esModule",{value:!0});Yd.FileT$=Yd.FileT$outboundSchema=Yd.FileT$inboundSchema=void 0;Yd.fileToJSON=o0o;Yd.fileFromJSON=i0o;var dv=r0o(ae()),n0o=te();Yd.FileT$inboundSchema=dv.object({fileName:dv.string(),content:dv.union([dv.instanceof(ReadableStream),dv.instanceof(Blob),dv.instanceof(ArrayBuffer),dv.instanceof(Uint8Array)])});Yd.FileT$outboundSchema=dv.object({fileName:dv.string(),content:dv.union([dv.instanceof(ReadableStream),dv.instanceof(Blob),dv.instanceof(ArrayBuffer),dv.instanceof(Uint8Array)])});var Oxr;(function(t){t.inboundSchema=Yd.FileT$inboundSchema,t.outboundSchema=Yd.FileT$outboundSchema})(Oxr||(Yd.FileT$=Oxr={}));function o0o(t){return JSON.stringify(Yd.FileT$outboundSchema.parse(t))}function i0o(t){return(0,n0o.safeParse)(t,e=>Yd.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}});var LMe=S(Qd=>{"use strict";var a0o=Qd&&Qd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s0o=Qd&&Qd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u0o=Qd&&Qd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&a0o(r,e,n[o]);return s0o(r,e),r}}();Object.defineProperty(Qd,"__esModule",{value:!0});Qd.TimestampGranularity$=Qd.TimestampGranularity$outboundSchema=Qd.TimestampGranularity$inboundSchema=Qd.TimestampGranularity=void 0;var l0o=u0o(ae());Qd.TimestampGranularity={Segment:"segment"};Qd.TimestampGranularity$inboundSchema=l0o.nativeEnum(Qd.TimestampGranularity);Qd.TimestampGranularity$outboundSchema=Qd.TimestampGranularity$inboundSchema;var Exr;(function(t){t.inboundSchema=Qd.TimestampGranularity$inboundSchema,t.outboundSchema=Qd.TimestampGranularity$outboundSchema})(Exr||(Qd.TimestampGranularity$=Exr={}))});var Axr=S(ef=>{"use strict";var c0o=ef&&ef.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d0o=ef&&ef.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f0o=ef&&ef.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&c0o(r,e,n[o]);return d0o(r,e),r}}();Object.defineProperty(ef,"__esModule",{value:!0});ef.AudioTranscriptionRequest$=ef.AudioTranscriptionRequest$outboundSchema=ef.AudioTranscriptionRequest$inboundSchema=void 0;ef.audioTranscriptionRequestToJSON=h0o;ef.audioTranscriptionRequestFromJSON=g0o;var ec=f0o(ae()),Mxr=ce(),p0o=te(),m0o=HD(),Rxr=$Me(),Ixr=LMe();ef.AudioTranscriptionRequest$inboundSchema=ec.object({model:ec.string(),file:Rxr.FileT$inboundSchema.optional(),file_url:ec.nullable(ec.string()).optional(),file_id:ec.nullable(ec.string()).optional(),language:ec.nullable(ec.string()).optional(),temperature:ec.nullable(ec.number()).optional(),stream:ec.literal(!1).default(!1),timestamp_granularities:ec.array(Ixr.TimestampGranularity$inboundSchema).optional()}).transform(t=>(0,Mxr.remap)(t,{file_url:"fileUrl",file_id:"fileId",timestamp_granularities:"timestampGranularities"}));ef.AudioTranscriptionRequest$outboundSchema=ec.object({model:ec.string(),file:Rxr.FileT$outboundSchema.or(m0o.blobLikeSchema).optional(),fileUrl:ec.nullable(ec.string()).optional(),fileId:ec.nullable(ec.string()).optional(),language:ec.nullable(ec.string()).optional(),temperature:ec.nullable(ec.number()).optional(),stream:ec.literal(!1).default(!1),timestampGranularities:ec.array(Ixr.TimestampGranularity$outboundSchema).optional()}).transform(t=>(0,Mxr.remap)(t,{fileUrl:"file_url",fileId:"file_id",timestampGranularities:"timestamp_granularities"}));var Pxr;(function(t){t.inboundSchema=ef.AudioTranscriptionRequest$inboundSchema,t.outboundSchema=ef.AudioTranscriptionRequest$outboundSchema})(Pxr||(ef.AudioTranscriptionRequest$=Pxr={}));function h0o(t){return JSON.stringify(ef.AudioTranscriptionRequest$outboundSchema.parse(t))}function g0o(t){return(0,p0o.safeParse)(t,e=>ef.AudioTranscriptionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AudioTranscriptionRequest' from JSON")}});var Lxr=S(tf=>{"use strict";var y0o=tf&&tf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),b0o=tf&&tf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_0o=tf&&tf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&y0o(r,e,n[o]);return b0o(r,e),r}}();Object.defineProperty(tf,"__esModule",{value:!0});tf.AudioTranscriptionRequestStream$=tf.AudioTranscriptionRequestStream$outboundSchema=tf.AudioTranscriptionRequestStream$inboundSchema=void 0;tf.audioTranscriptionRequestStreamToJSON=S0o;tf.audioTranscriptionRequestStreamFromJSON=C0o;var tc=_0o(ae()),Dxr=ce(),v0o=te(),w0o=HD(),jxr=$Me(),$xr=LMe();tf.AudioTranscriptionRequestStream$inboundSchema=tc.object({model:tc.string(),file:jxr.FileT$inboundSchema.optional(),file_url:tc.nullable(tc.string()).optional(),file_id:tc.nullable(tc.string()).optional(),language:tc.nullable(tc.string()).optional(),temperature:tc.nullable(tc.number()).optional(),stream:tc.literal(!0).default(!0),timestamp_granularities:tc.array($xr.TimestampGranularity$inboundSchema).optional()}).transform(t=>(0,Dxr.remap)(t,{file_url:"fileUrl",file_id:"fileId",timestamp_granularities:"timestampGranularities"}));tf.AudioTranscriptionRequestStream$outboundSchema=tc.object({model:tc.string(),file:jxr.FileT$outboundSchema.or(w0o.blobLikeSchema).optional(),fileUrl:tc.nullable(tc.string()).optional(),fileId:tc.nullable(tc.string()).optional(),language:tc.nullable(tc.string()).optional(),temperature:tc.nullable(tc.number()).optional(),stream:tc.literal(!0).default(!0),timestampGranularities:tc.array($xr.TimestampGranularity$outboundSchema).optional()}).transform(t=>(0,Dxr.remap)(t,{fileUrl:"file_url",fileId:"file_id",timestampGranularities:"timestamp_granularities"}));var Nxr;(function(t){t.inboundSchema=tf.AudioTranscriptionRequestStream$inboundSchema,t.outboundSchema=tf.AudioTranscriptionRequestStream$outboundSchema})(Nxr||(tf.AudioTranscriptionRequestStream$=Nxr={}));function S0o(t){return JSON.stringify(tf.AudioTranscriptionRequestStream$outboundSchema.parse(t))}function C0o(t){return(0,v0o.safeParse)(t,e=>tf.AudioTranscriptionRequestStream$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AudioTranscriptionRequestStream' from JSON")}});var FMe=S(rf=>{"use strict";var x0o=rf&&rf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T0o=rf&&rf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O0o=rf&&rf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&x0o(r,e,n[o]);return T0o(r,e),r}}();Object.defineProperty(rf,"__esModule",{value:!0});rf.ModelCapabilities$=rf.ModelCapabilities$outboundSchema=rf.ModelCapabilities$inboundSchema=void 0;rf.modelCapabilitiesToJSON=P0o;rf.modelCapabilitiesFromJSON=M0o;var fv=O0o(ae()),kxr=ce(),E0o=te();rf.ModelCapabilities$inboundSchema=fv.object({completion_chat:fv.boolean().default(!0),completion_fim:fv.boolean().default(!1),function_calling:fv.boolean().default(!0),fine_tuning:fv.boolean().default(!1),vision:fv.boolean().default(!1),classification:fv.boolean().default(!1)}).transform(t=>(0,kxr.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));rf.ModelCapabilities$outboundSchema=fv.object({completionChat:fv.boolean().default(!0),completionFim:fv.boolean().default(!1),functionCalling:fv.boolean().default(!0),fineTuning:fv.boolean().default(!1),vision:fv.boolean().default(!1),classification:fv.boolean().default(!1)}).transform(t=>(0,kxr.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var Fxr;(function(t){t.inboundSchema=rf.ModelCapabilities$inboundSchema,t.outboundSchema=rf.ModelCapabilities$outboundSchema})(Fxr||(rf.ModelCapabilities$=Fxr={}));function P0o(t){return JSON.stringify(rf.ModelCapabilities$outboundSchema.parse(t))}function M0o(t){return(0,E0o.safeParse)(t,e=>rf.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var $lt=S(gs=>{"use strict";var R0o=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]}),I0o=gs&&gs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A0o=gs&&gs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&R0o(r,e,n[o]);return I0o(r,e),r}}();Object.defineProperty(gs,"__esModule",{value:!0});gs.BaseModelCard$=gs.BaseModelCard$outboundSchema=gs.BaseModelCard$inboundSchema=gs.BaseModelCardType$=gs.BaseModelCardType$outboundSchema=gs.BaseModelCardType$inboundSchema=gs.BaseModelCardType=void 0;gs.baseModelCardToJSON=D0o;gs.baseModelCardFromJSON=j0o;var Si=A0o(ae()),Uxr=ce(),N0o=te(),zxr=FMe();gs.BaseModelCardType={Base:"base"};gs.BaseModelCardType$inboundSchema=Si.nativeEnum(gs.BaseModelCardType);gs.BaseModelCardType$outboundSchema=gs.BaseModelCardType$inboundSchema;var qxr;(function(t){t.inboundSchema=gs.BaseModelCardType$inboundSchema,t.outboundSchema=gs.BaseModelCardType$outboundSchema})(qxr||(gs.BaseModelCardType$=qxr={}));gs.BaseModelCard$inboundSchema=Si.object({id:Si.string(),object:Si.string().default("model"),created:Si.number().int().optional(),owned_by:Si.string().default("mistralai"),capabilities:zxr.ModelCapabilities$inboundSchema,name:Si.nullable(Si.string()).optional(),description:Si.nullable(Si.string()).optional(),max_context_length:Si.number().int().default(32768),aliases:Si.array(Si.string()).optional(),deprecation:Si.nullable(Si.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),deprecation_replacement_model:Si.nullable(Si.string()).optional(),default_model_temperature:Si.nullable(Si.number()).optional(),type:Si.literal("base").default("base")}).transform(t=>(0,Uxr.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",deprecation_replacement_model:"deprecationReplacementModel",default_model_temperature:"defaultModelTemperature"}));gs.BaseModelCard$outboundSchema=Si.object({id:Si.string(),object:Si.string().default("model"),created:Si.number().int().optional(),ownedBy:Si.string().default("mistralai"),capabilities:zxr.ModelCapabilities$outboundSchema,name:Si.nullable(Si.string()).optional(),description:Si.nullable(Si.string()).optional(),maxContextLength:Si.number().int().default(32768),aliases:Si.array(Si.string()).optional(),deprecation:Si.nullable(Si.date().transform(t=>t.toISOString())).optional(),deprecationReplacementModel:Si.nullable(Si.string()).optional(),defaultModelTemperature:Si.nullable(Si.number()).optional(),type:Si.literal("base").default("base")}).transform(t=>(0,Uxr.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",deprecationReplacementModel:"deprecation_replacement_model",defaultModelTemperature:"default_model_temperature"}));var Bxr;(function(t){t.inboundSchema=gs.BaseModelCard$inboundSchema,t.outboundSchema=gs.BaseModelCard$outboundSchema})(Bxr||(gs.BaseModelCard$=Bxr={}));function D0o(t){return JSON.stringify(gs.BaseModelCard$outboundSchema.parse(t))}function j0o(t){return(0,N0o.safeParse)(t,e=>gs.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var Llt=S(nf=>{"use strict";var $0o=nf&&nf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L0o=nf&&nf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F0o=nf&&nf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$0o(r,e,n[o]);return L0o(r,e),r}}();Object.defineProperty(nf,"__esModule",{value:!0});nf.BatchError$=nf.BatchError$outboundSchema=nf.BatchError$inboundSchema=void 0;nf.batchErrorToJSON=q0o;nf.batchErrorFromJSON=B0o;var i7=F0o(ae()),k0o=te();nf.BatchError$inboundSchema=i7.object({message:i7.string(),count:i7.number().int().default(1)});nf.BatchError$outboundSchema=i7.object({message:i7.string(),count:i7.number().int().default(1)});var Vxr;(function(t){t.inboundSchema=nf.BatchError$inboundSchema,t.outboundSchema=nf.BatchError$outboundSchema})(Vxr||(nf.BatchError$=Vxr={}));function q0o(t){return JSON.stringify(nf.BatchError$outboundSchema.parse(t))}function B0o(t){return(0,k0o.safeParse)(t,e=>nf.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var Kxr=S(of=>{"use strict";var U0o=of&&of.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z0o=of&&of.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V0o=of&&of.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&U0o(r,e,n[o]);return z0o(r,e),r}}();Object.defineProperty(of,"__esModule",{value:!0});of.BatchJobIn$=of.BatchJobIn$outboundSchema=of.BatchJobIn$inboundSchema=void 0;of.batchJobInToJSON=W0o;of.batchJobInFromJSON=J0o;var Hc=V0o(ae()),Wxr=ce(),H0o=te(),Jxr=jlt();of.BatchJobIn$inboundSchema=Hc.object({input_files:Hc.array(Hc.string()),endpoint:Jxr.ApiEndpoint$inboundSchema,model:Hc.nullable(Hc.string()).optional(),agent_id:Hc.nullable(Hc.string()).optional(),metadata:Hc.nullable(Hc.record(Hc.string())).optional(),timeout_hours:Hc.number().int().default(24)}).transform(t=>(0,Wxr.remap)(t,{input_files:"inputFiles",agent_id:"agentId",timeout_hours:"timeoutHours"}));of.BatchJobIn$outboundSchema=Hc.object({inputFiles:Hc.array(Hc.string()),endpoint:Jxr.ApiEndpoint$outboundSchema,model:Hc.nullable(Hc.string()).optional(),agentId:Hc.nullable(Hc.string()).optional(),metadata:Hc.nullable(Hc.record(Hc.string())).optional(),timeoutHours:Hc.number().int().default(24)}).transform(t=>(0,Wxr.remap)(t,{inputFiles:"input_files",agentId:"agent_id",timeoutHours:"timeout_hours"}));var Hxr;(function(t){t.inboundSchema=of.BatchJobIn$inboundSchema,t.outboundSchema=of.BatchJobIn$outboundSchema})(Hxr||(of.BatchJobIn$=Hxr={}));function W0o(t){return JSON.stringify(of.BatchJobIn$outboundSchema.parse(t))}function J0o(t){return(0,H0o.safeParse)(t,e=>of.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var Flt=S(af=>{"use strict";var K0o=af&&af.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),G0o=af&&af.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X0o=af&&af.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&K0o(r,e,n[o]);return G0o(r,e),r}}();Object.defineProperty(af,"__esModule",{value:!0});af.BatchJobStatus$=af.BatchJobStatus$outboundSchema=af.BatchJobStatus$inboundSchema=af.BatchJobStatus=void 0;var Z0o=X0o(ae());af.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};af.BatchJobStatus$inboundSchema=Z0o.nativeEnum(af.BatchJobStatus);af.BatchJobStatus$outboundSchema=af.BatchJobStatus$inboundSchema;var Gxr;(function(t){t.inboundSchema=af.BatchJobStatus$inboundSchema,t.outboundSchema=af.BatchJobStatus$outboundSchema})(Gxr||(af.BatchJobStatus$=Gxr={}))});var klt=S(Sa=>{"use strict";var Y0o=Sa&&Sa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q0o=Sa&&Sa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eCo=Sa&&Sa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Y0o(r,e,n[o]);return Q0o(r,e),r}}();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.BatchJobOut$=Sa.BatchJobOut$outboundSchema=Sa.BatchJobOut$inboundSchema=Sa.BatchJobOutObject$=Sa.BatchJobOutObject$outboundSchema=Sa.BatchJobOutObject$inboundSchema=Sa.BatchJobOutObject=void 0;Sa.batchJobOutToJSON=rCo;Sa.batchJobOutFromJSON=nCo;var yn=eCo(ae()),Yxr=ce(),tCo=te(),Qxr=Llt(),eTr=Flt();Sa.BatchJobOutObject={Batch:"batch"};Sa.BatchJobOutObject$inboundSchema=yn.nativeEnum(Sa.BatchJobOutObject);Sa.BatchJobOutObject$outboundSchema=Sa.BatchJobOutObject$inboundSchema;var Xxr;(function(t){t.inboundSchema=Sa.BatchJobOutObject$inboundSchema,t.outboundSchema=Sa.BatchJobOutObject$outboundSchema})(Xxr||(Sa.BatchJobOutObject$=Xxr={}));Sa.BatchJobOut$inboundSchema=yn.object({id:yn.string(),object:Sa.BatchJobOutObject$inboundSchema.default("batch"),input_files:yn.array(yn.string()),metadata:yn.nullable(yn.record(yn.any())).optional(),endpoint:yn.string(),model:yn.nullable(yn.string()).optional(),agent_id:yn.nullable(yn.string()).optional(),output_file:yn.nullable(yn.string()).optional(),error_file:yn.nullable(yn.string()).optional(),errors:yn.array(Qxr.BatchError$inboundSchema),status:eTr.BatchJobStatus$inboundSchema,created_at:yn.number().int(),total_requests:yn.number().int(),completed_requests:yn.number().int(),succeeded_requests:yn.number().int(),failed_requests:yn.number().int(),started_at:yn.nullable(yn.number().int()).optional(),completed_at:yn.nullable(yn.number().int()).optional()}).transform(t=>(0,Yxr.remap)(t,{input_files:"inputFiles",agent_id:"agentId",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"}));Sa.BatchJobOut$outboundSchema=yn.object({id:yn.string(),object:Sa.BatchJobOutObject$outboundSchema.default("batch"),inputFiles:yn.array(yn.string()),metadata:yn.nullable(yn.record(yn.any())).optional(),endpoint:yn.string(),model:yn.nullable(yn.string()).optional(),agentId:yn.nullable(yn.string()).optional(),outputFile:yn.nullable(yn.string()).optional(),errorFile:yn.nullable(yn.string()).optional(),errors:yn.array(Qxr.BatchError$outboundSchema),status:eTr.BatchJobStatus$outboundSchema,createdAt:yn.number().int(),totalRequests:yn.number().int(),completedRequests:yn.number().int(),succeededRequests:yn.number().int(),failedRequests:yn.number().int(),startedAt:yn.nullable(yn.number().int()).optional(),completedAt:yn.nullable(yn.number().int()).optional()}).transform(t=>(0,Yxr.remap)(t,{inputFiles:"input_files",agentId:"agent_id",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 Zxr;(function(t){t.inboundSchema=Sa.BatchJobOut$inboundSchema,t.outboundSchema=Sa.BatchJobOut$outboundSchema})(Zxr||(Sa.BatchJobOut$=Zxr={}));function rCo(t){return JSON.stringify(Sa.BatchJobOut$outboundSchema.parse(t))}function nCo(t){return(0,tCo.safeParse)(t,e=>Sa.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var oTr=S(Ca=>{"use strict";var oCo=Ca&&Ca.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iCo=Ca&&Ca.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aCo=Ca&&Ca.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&oCo(r,e,n[o]);return iCo(r,e),r}}();Object.defineProperty(Ca,"__esModule",{value:!0});Ca.BatchJobsOut$=Ca.BatchJobsOut$outboundSchema=Ca.BatchJobsOut$inboundSchema=Ca.BatchJobsOutObject$=Ca.BatchJobsOutObject$outboundSchema=Ca.BatchJobsOutObject$inboundSchema=Ca.BatchJobsOutObject=void 0;Ca.batchJobsOutToJSON=uCo;Ca.batchJobsOutFromJSON=lCo;var tW=aCo(ae()),sCo=te(),nTr=klt();Ca.BatchJobsOutObject={List:"list"};Ca.BatchJobsOutObject$inboundSchema=tW.nativeEnum(Ca.BatchJobsOutObject);Ca.BatchJobsOutObject$outboundSchema=Ca.BatchJobsOutObject$inboundSchema;var tTr;(function(t){t.inboundSchema=Ca.BatchJobsOutObject$inboundSchema,t.outboundSchema=Ca.BatchJobsOutObject$outboundSchema})(tTr||(Ca.BatchJobsOutObject$=tTr={}));Ca.BatchJobsOut$inboundSchema=tW.object({data:tW.array(nTr.BatchJobOut$inboundSchema).optional(),object:Ca.BatchJobsOutObject$inboundSchema.default("list"),total:tW.number().int()});Ca.BatchJobsOut$outboundSchema=tW.object({data:tW.array(nTr.BatchJobOut$outboundSchema).optional(),object:Ca.BatchJobsOutObject$outboundSchema.default("list"),total:tW.number().int()});var rTr;(function(t){t.inboundSchema=Ca.BatchJobsOut$inboundSchema,t.outboundSchema=Ca.BatchJobsOut$outboundSchema})(rTr||(Ca.BatchJobsOut$=rTr={}));function uCo(t){return JSON.stringify(Ca.BatchJobsOut$outboundSchema.parse(t))}function lCo(t){return(0,sCo.safeParse)(t,e=>Ca.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var Hq=S(sf=>{"use strict";var cCo=sf&&sf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dCo=sf&&sf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fCo=sf&&sf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cCo(r,e,n[o]);return dCo(r,e),r}}();Object.defineProperty(sf,"__esModule",{value:!0});sf.BuiltInConnectors$=sf.BuiltInConnectors$outboundSchema=sf.BuiltInConnectors$inboundSchema=sf.BuiltInConnectors=void 0;var pCo=fCo(ae());sf.BuiltInConnectors={WebSearch:"web_search",WebSearchPremium:"web_search_premium",CodeInterpreter:"code_interpreter",ImageGeneration:"image_generation",DocumentLibrary:"document_library"};sf.BuiltInConnectors$inboundSchema=pCo.nativeEnum(sf.BuiltInConnectors);sf.BuiltInConnectors$outboundSchema=sf.BuiltInConnectors$inboundSchema;var iTr;(function(t){t.inboundSchema=sf.BuiltInConnectors$inboundSchema,t.outboundSchema=sf.BuiltInConnectors$outboundSchema})(iTr||(sf.BuiltInConnectors$=iTr={}))});var qlt=S(ys=>{"use strict";var mCo=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]}),hCo=ys&&ys.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gCo=ys&&ys.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mCo(r,e,n[o]);return hCo(r,e),r}}();Object.defineProperty(ys,"__esModule",{value:!0});ys.InstructRequest$=ys.InstructRequest$outboundSchema=ys.InstructRequest$inboundSchema=ys.InstructRequestMessages$=ys.InstructRequestMessages$outboundSchema=ys.InstructRequestMessages$inboundSchema=void 0;ys.instructRequestMessagesToJSON=yCo;ys.instructRequestMessagesFromJSON=bCo;ys.instructRequestToJSON=_Co;ys.instructRequestFromJSON=vCo;var hi=gCo(ae()),uTr=te(),kMe=OA(),qMe=UD(),BMe=zD(),UMe=VD();ys.InstructRequestMessages$inboundSchema=hi.union([qMe.SystemMessage$inboundSchema.and(hi.object({role:hi.literal("system")}).transform(t=>({role:t.role}))),BMe.ToolMessage$inboundSchema.and(hi.object({role:hi.literal("tool")}).transform(t=>({role:t.role}))),UMe.UserMessage$inboundSchema.and(hi.object({role:hi.literal("user")}).transform(t=>({role:t.role}))),kMe.AssistantMessage$inboundSchema.and(hi.object({role:hi.literal("assistant")}).transform(t=>({role:t.role})))]);ys.InstructRequestMessages$outboundSchema=hi.union([qMe.SystemMessage$outboundSchema.and(hi.object({role:hi.literal("system")}).transform(t=>({role:t.role}))),BMe.ToolMessage$outboundSchema.and(hi.object({role:hi.literal("tool")}).transform(t=>({role:t.role}))),UMe.UserMessage$outboundSchema.and(hi.object({role:hi.literal("user")}).transform(t=>({role:t.role}))),kMe.AssistantMessage$outboundSchema.and(hi.object({role:hi.literal("assistant")}).transform(t=>({role:t.role})))]);var aTr;(function(t){t.inboundSchema=ys.InstructRequestMessages$inboundSchema,t.outboundSchema=ys.InstructRequestMessages$outboundSchema})(aTr||(ys.InstructRequestMessages$=aTr={}));function yCo(t){return JSON.stringify(ys.InstructRequestMessages$outboundSchema.parse(t))}function bCo(t){return(0,uTr.safeParse)(t,e=>ys.InstructRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequestMessages' from JSON")}ys.InstructRequest$inboundSchema=hi.object({messages:hi.array(hi.union([qMe.SystemMessage$inboundSchema.and(hi.object({role:hi.literal("system")}).transform(t=>({role:t.role}))),BMe.ToolMessage$inboundSchema.and(hi.object({role:hi.literal("tool")}).transform(t=>({role:t.role}))),UMe.UserMessage$inboundSchema.and(hi.object({role:hi.literal("user")}).transform(t=>({role:t.role}))),kMe.AssistantMessage$inboundSchema.and(hi.object({role:hi.literal("assistant")}).transform(t=>({role:t.role})))]))});ys.InstructRequest$outboundSchema=hi.object({messages:hi.array(hi.union([qMe.SystemMessage$outboundSchema.and(hi.object({role:hi.literal("system")}).transform(t=>({role:t.role}))),BMe.ToolMessage$outboundSchema.and(hi.object({role:hi.literal("tool")}).transform(t=>({role:t.role}))),UMe.UserMessage$outboundSchema.and(hi.object({role:hi.literal("user")}).transform(t=>({role:t.role}))),kMe.AssistantMessage$outboundSchema.and(hi.object({role:hi.literal("assistant")}).transform(t=>({role:t.role})))]))});var sTr;(function(t){t.inboundSchema=ys.InstructRequest$inboundSchema,t.outboundSchema=ys.InstructRequest$outboundSchema})(sTr||(ys.InstructRequest$=sTr={}));function _Co(t){return JSON.stringify(ys.InstructRequest$outboundSchema.parse(t))}function vCo(t){return(0,uTr.safeParse)(t,e=>ys.InstructRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequest' from JSON")}});var Ult=S(vo=>{"use strict";var wCo=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]}),SCo=vo&&vo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CCo=vo&&vo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wCo(r,e,n[o]);return SCo(r,e),r}}();Object.defineProperty(vo,"__esModule",{value:!0});vo.Inputs$=vo.Inputs$outboundSchema=vo.Inputs$inboundSchema=vo.InstructRequestInputs$=vo.InstructRequestInputs$outboundSchema=vo.InstructRequestInputs$inboundSchema=vo.InstructRequestInputsMessages$=vo.InstructRequestInputsMessages$outboundSchema=vo.InstructRequestInputsMessages$inboundSchema=void 0;vo.instructRequestInputsMessagesToJSON=xCo;vo.instructRequestInputsMessagesFromJSON=TCo;vo.instructRequestInputsToJSON=OCo;vo.instructRequestInputsFromJSON=ECo;vo.inputsToJSON=PCo;vo.inputsFromJSON=MCo;var _o=CCo(ae()),Blt=te(),zMe=OA(),fTr=qlt(),VMe=UD(),HMe=zD(),WMe=VD();vo.InstructRequestInputsMessages$inboundSchema=_o.union([VMe.SystemMessage$inboundSchema.and(_o.object({role:_o.literal("system")}).transform(t=>({role:t.role}))),HMe.ToolMessage$inboundSchema.and(_o.object({role:_o.literal("tool")}).transform(t=>({role:t.role}))),WMe.UserMessage$inboundSchema.and(_o.object({role:_o.literal("user")}).transform(t=>({role:t.role}))),zMe.AssistantMessage$inboundSchema.and(_o.object({role:_o.literal("assistant")}).transform(t=>({role:t.role})))]);vo.InstructRequestInputsMessages$outboundSchema=_o.union([VMe.SystemMessage$outboundSchema.and(_o.object({role:_o.literal("system")}).transform(t=>({role:t.role}))),HMe.ToolMessage$outboundSchema.and(_o.object({role:_o.literal("tool")}).transform(t=>({role:t.role}))),WMe.UserMessage$outboundSchema.and(_o.object({role:_o.literal("user")}).transform(t=>({role:t.role}))),zMe.AssistantMessage$outboundSchema.and(_o.object({role:_o.literal("assistant")}).transform(t=>({role:t.role})))]);var lTr;(function(t){t.inboundSchema=vo.InstructRequestInputsMessages$inboundSchema,t.outboundSchema=vo.InstructRequestInputsMessages$outboundSchema})(lTr||(vo.InstructRequestInputsMessages$=lTr={}));function xCo(t){return JSON.stringify(vo.InstructRequestInputsMessages$outboundSchema.parse(t))}function TCo(t){return(0,Blt.safeParse)(t,e=>vo.InstructRequestInputsMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequestInputsMessages' from JSON")}vo.InstructRequestInputs$inboundSchema=_o.object({messages:_o.array(_o.union([VMe.SystemMessage$inboundSchema.and(_o.object({role:_o.literal("system")}).transform(t=>({role:t.role}))),HMe.ToolMessage$inboundSchema.and(_o.object({role:_o.literal("tool")}).transform(t=>({role:t.role}))),WMe.UserMessage$inboundSchema.and(_o.object({role:_o.literal("user")}).transform(t=>({role:t.role}))),zMe.AssistantMessage$inboundSchema.and(_o.object({role:_o.literal("assistant")}).transform(t=>({role:t.role})))]))});vo.InstructRequestInputs$outboundSchema=_o.object({messages:_o.array(_o.union([VMe.SystemMessage$outboundSchema.and(_o.object({role:_o.literal("system")}).transform(t=>({role:t.role}))),HMe.ToolMessage$outboundSchema.and(_o.object({role:_o.literal("tool")}).transform(t=>({role:t.role}))),WMe.UserMessage$outboundSchema.and(_o.object({role:_o.literal("user")}).transform(t=>({role:t.role}))),zMe.AssistantMessage$outboundSchema.and(_o.object({role:_o.literal("assistant")}).transform(t=>({role:t.role})))]))});var cTr;(function(t){t.inboundSchema=vo.InstructRequestInputs$inboundSchema,t.outboundSchema=vo.InstructRequestInputs$outboundSchema})(cTr||(vo.InstructRequestInputs$=cTr={}));function OCo(t){return JSON.stringify(vo.InstructRequestInputs$outboundSchema.parse(t))}function ECo(t){return(0,Blt.safeParse)(t,e=>vo.InstructRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequestInputs' from JSON")}vo.Inputs$inboundSchema=_o.union([_o.lazy(()=>vo.InstructRequestInputs$inboundSchema),_o.array(fTr.InstructRequest$inboundSchema)]);vo.Inputs$outboundSchema=_o.union([_o.lazy(()=>vo.InstructRequestInputs$outboundSchema),_o.array(fTr.InstructRequest$outboundSchema)]);var dTr;(function(t){t.inboundSchema=vo.Inputs$inboundSchema,t.outboundSchema=vo.Inputs$outboundSchema})(dTr||(vo.Inputs$=dTr={}));function PCo(t){return JSON.stringify(vo.Inputs$outboundSchema.parse(t))}function MCo(t){return(0,Blt.safeParse)(t,e=>vo.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}});var gTr=S(uf=>{"use strict";var RCo=uf&&uf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ICo=uf&&uf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ACo=uf&&uf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&RCo(r,e,n[o]);return ICo(r,e),r}}();Object.defineProperty(uf,"__esModule",{value:!0});uf.ChatClassificationRequest$=uf.ChatClassificationRequest$outboundSchema=uf.ChatClassificationRequest$inboundSchema=void 0;uf.chatClassificationRequestToJSON=DCo;uf.chatClassificationRequestFromJSON=jCo;var JMe=ACo(ae()),mTr=ce(),NCo=te(),hTr=Ult();uf.ChatClassificationRequest$inboundSchema=JMe.object({model:JMe.string(),input:hTr.Inputs$inboundSchema}).transform(t=>(0,mTr.remap)(t,{input:"inputs"}));uf.ChatClassificationRequest$outboundSchema=JMe.object({model:JMe.string(),inputs:hTr.Inputs$outboundSchema}).transform(t=>(0,mTr.remap)(t,{inputs:"input"}));var pTr;(function(t){t.inboundSchema=uf.ChatClassificationRequest$inboundSchema,t.outboundSchema=uf.ChatClassificationRequest$outboundSchema})(pTr||(uf.ChatClassificationRequest$=pTr={}));function DCo(t){return JSON.stringify(uf.ChatClassificationRequest$outboundSchema.parse(t))}function jCo(t){return(0,NCo.safeParse)(t,e=>uf.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var KMe=S(xa=>{"use strict";var $Co=xa&&xa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LCo=xa&&xa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FCo=xa&&xa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$Co(r,e,n[o]);return LCo(r,e),r}}();Object.defineProperty(xa,"__esModule",{value:!0});xa.ChatCompletionChoice$=xa.ChatCompletionChoice$outboundSchema=xa.ChatCompletionChoice$inboundSchema=xa.FinishReason$=xa.FinishReason$outboundSchema=xa.FinishReason$inboundSchema=xa.FinishReason=void 0;xa.chatCompletionChoiceToJSON=BCo;xa.chatCompletionChoiceFromJSON=UCo;var Bx=FCo(ae()),_Tr=ce(),kCo=te(),qCo=kx(),vTr=OA();xa.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};xa.FinishReason$inboundSchema=Bx.union([Bx.nativeEnum(xa.FinishReason),Bx.string().transform(qCo.catchUnrecognizedEnum)]);xa.FinishReason$outboundSchema=Bx.union([Bx.nativeEnum(xa.FinishReason),Bx.string().and(Bx.custom())]);var yTr;(function(t){t.inboundSchema=xa.FinishReason$inboundSchema,t.outboundSchema=xa.FinishReason$outboundSchema})(yTr||(xa.FinishReason$=yTr={}));xa.ChatCompletionChoice$inboundSchema=Bx.object({index:Bx.number().int(),message:vTr.AssistantMessage$inboundSchema,finish_reason:xa.FinishReason$inboundSchema}).transform(t=>(0,_Tr.remap)(t,{finish_reason:"finishReason"}));xa.ChatCompletionChoice$outboundSchema=Bx.object({index:Bx.number().int(),message:vTr.AssistantMessage$outboundSchema,finishReason:xa.FinishReason$outboundSchema}).transform(t=>(0,_Tr.remap)(t,{finishReason:"finish_reason"}));var bTr;(function(t){t.inboundSchema=xa.ChatCompletionChoice$inboundSchema,t.outboundSchema=xa.ChatCompletionChoice$outboundSchema})(bTr||(xa.ChatCompletionChoice$=bTr={}));function BCo(t){return JSON.stringify(xa.ChatCompletionChoice$outboundSchema.parse(t))}function UCo(t){return(0,kCo.safeParse)(t,e=>xa.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var RTr=S(en=>{"use strict";var zCo=en&&en.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VCo=en&&en.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HCo=en&&en.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zCo(r,e,n[o]);return VCo(r,e),r}}();Object.defineProperty(en,"__esModule",{value:!0});en.ChatCompletionRequest$=en.ChatCompletionRequest$outboundSchema=en.ChatCompletionRequest$inboundSchema=en.ChatCompletionRequestToolChoice$=en.ChatCompletionRequestToolChoice$outboundSchema=en.ChatCompletionRequestToolChoice$inboundSchema=en.Messages$=en.Messages$outboundSchema=en.Messages$inboundSchema=en.Stop$=en.Stop$outboundSchema=en.Stop$inboundSchema=void 0;en.stopToJSON=WCo;en.stopFromJSON=JCo;en.messagesToJSON=KCo;en.messagesFromJSON=GCo;en.chatCompletionRequestToolChoiceToJSON=XCo;en.chatCompletionRequestToolChoiceFromJSON=ZCo;en.chatCompletionRequestToJSON=YCo;en.chatCompletionRequestFromJSON=QCo;var lt=HCo(ae()),TTr=ce(),GMe=te(),XMe=OA(),OTr=r7(),ETr=VH(),PTr=Lq(),ZMe=UD(),MTr=n7(),YMe=o7(),QMe=HH(),eRe=zD(),tRe=VD();en.Stop$inboundSchema=lt.union([lt.string(),lt.array(lt.string())]);en.Stop$outboundSchema=lt.union([lt.string(),lt.array(lt.string())]);var wTr;(function(t){t.inboundSchema=en.Stop$inboundSchema,t.outboundSchema=en.Stop$outboundSchema})(wTr||(en.Stop$=wTr={}));function WCo(t){return JSON.stringify(en.Stop$outboundSchema.parse(t))}function JCo(t){return(0,GMe.safeParse)(t,e=>en.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}en.Messages$inboundSchema=lt.union([ZMe.SystemMessage$inboundSchema.and(lt.object({role:lt.literal("system")}).transform(t=>({role:t.role}))),eRe.ToolMessage$inboundSchema.and(lt.object({role:lt.literal("tool")}).transform(t=>({role:t.role}))),tRe.UserMessage$inboundSchema.and(lt.object({role:lt.literal("user")}).transform(t=>({role:t.role}))),XMe.AssistantMessage$inboundSchema.and(lt.object({role:lt.literal("assistant")}).transform(t=>({role:t.role})))]);en.Messages$outboundSchema=lt.union([ZMe.SystemMessage$outboundSchema.and(lt.object({role:lt.literal("system")}).transform(t=>({role:t.role}))),eRe.ToolMessage$outboundSchema.and(lt.object({role:lt.literal("tool")}).transform(t=>({role:t.role}))),tRe.UserMessage$outboundSchema.and(lt.object({role:lt.literal("user")}).transform(t=>({role:t.role}))),XMe.AssistantMessage$outboundSchema.and(lt.object({role:lt.literal("assistant")}).transform(t=>({role:t.role})))]);var STr;(function(t){t.inboundSchema=en.Messages$inboundSchema,t.outboundSchema=en.Messages$outboundSchema})(STr||(en.Messages$=STr={}));function KCo(t){return JSON.stringify(en.Messages$outboundSchema.parse(t))}function GCo(t){return(0,GMe.safeParse)(t,e=>en.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}en.ChatCompletionRequestToolChoice$inboundSchema=lt.union([YMe.ToolChoice$inboundSchema,QMe.ToolChoiceEnum$inboundSchema]);en.ChatCompletionRequestToolChoice$outboundSchema=lt.union([YMe.ToolChoice$outboundSchema,QMe.ToolChoiceEnum$outboundSchema]);var CTr;(function(t){t.inboundSchema=en.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=en.ChatCompletionRequestToolChoice$outboundSchema})(CTr||(en.ChatCompletionRequestToolChoice$=CTr={}));function XCo(t){return JSON.stringify(en.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function ZCo(t){return(0,GMe.safeParse)(t,e=>en.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}en.ChatCompletionRequest$inboundSchema=lt.object({model:lt.string(),temperature:lt.nullable(lt.number()).optional(),top_p:lt.number().optional(),max_tokens:lt.nullable(lt.number().int()).optional(),stream:lt.boolean().default(!1),stop:lt.union([lt.string(),lt.array(lt.string())]).optional(),random_seed:lt.nullable(lt.number().int()).optional(),messages:lt.array(lt.union([ZMe.SystemMessage$inboundSchema.and(lt.object({role:lt.literal("system")}).transform(t=>({role:t.role}))),eRe.ToolMessage$inboundSchema.and(lt.object({role:lt.literal("tool")}).transform(t=>({role:t.role}))),tRe.UserMessage$inboundSchema.and(lt.object({role:lt.literal("user")}).transform(t=>({role:t.role}))),XMe.AssistantMessage$inboundSchema.and(lt.object({role:lt.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:PTr.ResponseFormat$inboundSchema.optional(),tools:lt.nullable(lt.array(MTr.Tool$inboundSchema)).optional(),tool_choice:lt.union([YMe.ToolChoice$inboundSchema,QMe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:lt.number().optional(),frequency_penalty:lt.number().optional(),n:lt.nullable(lt.number().int()).optional(),prediction:ETr.Prediction$inboundSchema.optional(),parallel_tool_calls:lt.boolean().optional(),prompt_mode:lt.nullable(OTr.MistralPromptMode$inboundSchema).optional(),safe_prompt:lt.boolean().optional()}).transform(t=>(0,TTr.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",parallel_tool_calls:"parallelToolCalls",prompt_mode:"promptMode",safe_prompt:"safePrompt"}));en.ChatCompletionRequest$outboundSchema=lt.object({model:lt.string(),temperature:lt.nullable(lt.number()).optional(),topP:lt.number().optional(),maxTokens:lt.nullable(lt.number().int()).optional(),stream:lt.boolean().default(!1),stop:lt.union([lt.string(),lt.array(lt.string())]).optional(),randomSeed:lt.nullable(lt.number().int()).optional(),messages:lt.array(lt.union([ZMe.SystemMessage$outboundSchema.and(lt.object({role:lt.literal("system")}).transform(t=>({role:t.role}))),eRe.ToolMessage$outboundSchema.and(lt.object({role:lt.literal("tool")}).transform(t=>({role:t.role}))),tRe.UserMessage$outboundSchema.and(lt.object({role:lt.literal("user")}).transform(t=>({role:t.role}))),XMe.AssistantMessage$outboundSchema.and(lt.object({role:lt.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:PTr.ResponseFormat$outboundSchema.optional(),tools:lt.nullable(lt.array(MTr.Tool$outboundSchema)).optional(),toolChoice:lt.union([YMe.ToolChoice$outboundSchema,QMe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:lt.number().optional(),frequencyPenalty:lt.number().optional(),n:lt.nullable(lt.number().int()).optional(),prediction:ETr.Prediction$outboundSchema.optional(),parallelToolCalls:lt.boolean().optional(),promptMode:lt.nullable(OTr.MistralPromptMode$outboundSchema).optional(),safePrompt:lt.boolean().optional()}).transform(t=>(0,TTr.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",parallelToolCalls:"parallel_tool_calls",promptMode:"prompt_mode",safePrompt:"safe_prompt"}));var xTr;(function(t){t.inboundSchema=en.ChatCompletionRequest$inboundSchema,t.outboundSchema=en.ChatCompletionRequest$outboundSchema})(xTr||(en.ChatCompletionRequest$=xTr={}));function YCo(t){return JSON.stringify(en.ChatCompletionRequest$outboundSchema.parse(t))}function QCo(t){return(0,GMe.safeParse)(t,e=>en.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var Wq=S(lf=>{"use strict";var exo=lf&&lf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),txo=lf&&lf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rxo=lf&&lf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&exo(r,e,n[o]);return txo(r,e),r}}();Object.defineProperty(lf,"__esModule",{value:!0});lf.UsageInfo$=lf.UsageInfo$outboundSchema=lf.UsageInfo$inboundSchema=void 0;lf.usageInfoToJSON=nxo;lf.usageInfoFromJSON=oxo;var Kb=rxo(ae()),ATr=ce(),NTr=te();lf.UsageInfo$inboundSchema=(0,NTr.collectExtraKeys)(Kb.object({prompt_tokens:Kb.number().int().default(0),completion_tokens:Kb.number().int().default(0),total_tokens:Kb.number().int().default(0),prompt_audio_seconds:Kb.nullable(Kb.number().int()).optional()}).catchall(Kb.any()),"additionalProperties",!0).transform(t=>(0,ATr.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens",prompt_audio_seconds:"promptAudioSeconds"}));lf.UsageInfo$outboundSchema=Kb.object({promptTokens:Kb.number().int().default(0),completionTokens:Kb.number().int().default(0),totalTokens:Kb.number().int().default(0),promptAudioSeconds:Kb.nullable(Kb.number().int()).optional(),additionalProperties:Kb.record(Kb.any())}).transform(t=>({...t.additionalProperties,...(0,ATr.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens",promptAudioSeconds:"prompt_audio_seconds",additionalProperties:null})}));var ITr;(function(t){t.inboundSchema=lf.UsageInfo$inboundSchema,t.outboundSchema=lf.UsageInfo$outboundSchema})(ITr||(lf.UsageInfo$=ITr={}));function nxo(t){return JSON.stringify(lf.UsageInfo$outboundSchema.parse(t))}function oxo(t){return(0,NTr.safeParse)(t,e=>lf.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var LTr=S(cf=>{"use strict";var ixo=cf&&cf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),axo=cf&&cf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sxo=cf&&cf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ixo(r,e,n[o]);return axo(r,e),r}}();Object.defineProperty(cf,"__esModule",{value:!0});cf.ChatCompletionResponse$=cf.ChatCompletionResponse$outboundSchema=cf.ChatCompletionResponse$inboundSchema=void 0;cf.chatCompletionResponseToJSON=lxo;cf.chatCompletionResponseFromJSON=cxo;var O0=sxo(ae()),uxo=te(),jTr=KMe(),$Tr=Wq();cf.ChatCompletionResponse$inboundSchema=O0.object({id:O0.string(),object:O0.string(),model:O0.string(),usage:$Tr.UsageInfo$inboundSchema,created:O0.number().int(),choices:O0.array(jTr.ChatCompletionChoice$inboundSchema)});cf.ChatCompletionResponse$outboundSchema=O0.object({id:O0.string(),object:O0.string(),model:O0.string(),usage:$Tr.UsageInfo$outboundSchema,created:O0.number().int(),choices:O0.array(jTr.ChatCompletionChoice$outboundSchema)});var DTr;(function(t){t.inboundSchema=cf.ChatCompletionResponse$inboundSchema,t.outboundSchema=cf.ChatCompletionResponse$outboundSchema})(DTr||(cf.ChatCompletionResponse$=DTr={}));function lxo(t){return JSON.stringify(cf.ChatCompletionResponse$outboundSchema.parse(t))}function cxo(t){return(0,uxo.safeParse)(t,e=>cf.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var JTr=S(tn=>{"use strict";var dxo=tn&&tn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fxo=tn&&tn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pxo=tn&&tn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dxo(r,e,n[o]);return fxo(r,e),r}}();Object.defineProperty(tn,"__esModule",{value:!0});tn.ChatCompletionStreamRequest$=tn.ChatCompletionStreamRequest$outboundSchema=tn.ChatCompletionStreamRequest$inboundSchema=tn.ChatCompletionStreamRequestToolChoice$=tn.ChatCompletionStreamRequestToolChoice$outboundSchema=tn.ChatCompletionStreamRequestToolChoice$inboundSchema=tn.ChatCompletionStreamRequestMessages$=tn.ChatCompletionStreamRequestMessages$outboundSchema=tn.ChatCompletionStreamRequestMessages$inboundSchema=tn.ChatCompletionStreamRequestStop$=tn.ChatCompletionStreamRequestStop$outboundSchema=tn.ChatCompletionStreamRequestStop$inboundSchema=void 0;tn.chatCompletionStreamRequestStopToJSON=mxo;tn.chatCompletionStreamRequestStopFromJSON=hxo;tn.chatCompletionStreamRequestMessagesToJSON=gxo;tn.chatCompletionStreamRequestMessagesFromJSON=yxo;tn.chatCompletionStreamRequestToolChoiceToJSON=bxo;tn.chatCompletionStreamRequestToolChoiceFromJSON=_xo;tn.chatCompletionStreamRequestToJSON=vxo;tn.chatCompletionStreamRequestFromJSON=wxo;var ct=pxo(ae()),UTr=ce(),rRe=te(),nRe=OA(),zTr=r7(),VTr=VH(),HTr=Lq(),oRe=UD(),WTr=n7(),iRe=o7(),aRe=HH(),sRe=zD(),uRe=VD();tn.ChatCompletionStreamRequestStop$inboundSchema=ct.union([ct.string(),ct.array(ct.string())]);tn.ChatCompletionStreamRequestStop$outboundSchema=ct.union([ct.string(),ct.array(ct.string())]);var FTr;(function(t){t.inboundSchema=tn.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=tn.ChatCompletionStreamRequestStop$outboundSchema})(FTr||(tn.ChatCompletionStreamRequestStop$=FTr={}));function mxo(t){return JSON.stringify(tn.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function hxo(t){return(0,rRe.safeParse)(t,e=>tn.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}tn.ChatCompletionStreamRequestMessages$inboundSchema=ct.union([oRe.SystemMessage$inboundSchema.and(ct.object({role:ct.literal("system")}).transform(t=>({role:t.role}))),sRe.ToolMessage$inboundSchema.and(ct.object({role:ct.literal("tool")}).transform(t=>({role:t.role}))),uRe.UserMessage$inboundSchema.and(ct.object({role:ct.literal("user")}).transform(t=>({role:t.role}))),nRe.AssistantMessage$inboundSchema.and(ct.object({role:ct.literal("assistant")}).transform(t=>({role:t.role})))]);tn.ChatCompletionStreamRequestMessages$outboundSchema=ct.union([oRe.SystemMessage$outboundSchema.and(ct.object({role:ct.literal("system")}).transform(t=>({role:t.role}))),sRe.ToolMessage$outboundSchema.and(ct.object({role:ct.literal("tool")}).transform(t=>({role:t.role}))),uRe.UserMessage$outboundSchema.and(ct.object({role:ct.literal("user")}).transform(t=>({role:t.role}))),nRe.AssistantMessage$outboundSchema.and(ct.object({role:ct.literal("assistant")}).transform(t=>({role:t.role})))]);var kTr;(function(t){t.inboundSchema=tn.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=tn.ChatCompletionStreamRequestMessages$outboundSchema})(kTr||(tn.ChatCompletionStreamRequestMessages$=kTr={}));function gxo(t){return JSON.stringify(tn.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function yxo(t){return(0,rRe.safeParse)(t,e=>tn.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}tn.ChatCompletionStreamRequestToolChoice$inboundSchema=ct.union([iRe.ToolChoice$inboundSchema,aRe.ToolChoiceEnum$inboundSchema]);tn.ChatCompletionStreamRequestToolChoice$outboundSchema=ct.union([iRe.ToolChoice$outboundSchema,aRe.ToolChoiceEnum$outboundSchema]);var qTr;(function(t){t.inboundSchema=tn.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=tn.ChatCompletionStreamRequestToolChoice$outboundSchema})(qTr||(tn.ChatCompletionStreamRequestToolChoice$=qTr={}));function bxo(t){return JSON.stringify(tn.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function _xo(t){return(0,rRe.safeParse)(t,e=>tn.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}tn.ChatCompletionStreamRequest$inboundSchema=ct.object({model:ct.string(),temperature:ct.nullable(ct.number()).optional(),top_p:ct.number().optional(),max_tokens:ct.nullable(ct.number().int()).optional(),stream:ct.boolean().default(!0),stop:ct.union([ct.string(),ct.array(ct.string())]).optional(),random_seed:ct.nullable(ct.number().int()).optional(),messages:ct.array(ct.union([oRe.SystemMessage$inboundSchema.and(ct.object({role:ct.literal("system")}).transform(t=>({role:t.role}))),sRe.ToolMessage$inboundSchema.and(ct.object({role:ct.literal("tool")}).transform(t=>({role:t.role}))),uRe.UserMessage$inboundSchema.and(ct.object({role:ct.literal("user")}).transform(t=>({role:t.role}))),nRe.AssistantMessage$inboundSchema.and(ct.object({role:ct.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:HTr.ResponseFormat$inboundSchema.optional(),tools:ct.nullable(ct.array(WTr.Tool$inboundSchema)).optional(),tool_choice:ct.union([iRe.ToolChoice$inboundSchema,aRe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:ct.number().optional(),frequency_penalty:ct.number().optional(),n:ct.nullable(ct.number().int()).optional(),prediction:VTr.Prediction$inboundSchema.optional(),parallel_tool_calls:ct.boolean().optional(),prompt_mode:ct.nullable(zTr.MistralPromptMode$inboundSchema).optional(),safe_prompt:ct.boolean().optional()}).transform(t=>(0,UTr.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",parallel_tool_calls:"parallelToolCalls",prompt_mode:"promptMode",safe_prompt:"safePrompt"}));tn.ChatCompletionStreamRequest$outboundSchema=ct.object({model:ct.string(),temperature:ct.nullable(ct.number()).optional(),topP:ct.number().optional(),maxTokens:ct.nullable(ct.number().int()).optional(),stream:ct.boolean().default(!0),stop:ct.union([ct.string(),ct.array(ct.string())]).optional(),randomSeed:ct.nullable(ct.number().int()).optional(),messages:ct.array(ct.union([oRe.SystemMessage$outboundSchema.and(ct.object({role:ct.literal("system")}).transform(t=>({role:t.role}))),sRe.ToolMessage$outboundSchema.and(ct.object({role:ct.literal("tool")}).transform(t=>({role:t.role}))),uRe.UserMessage$outboundSchema.and(ct.object({role:ct.literal("user")}).transform(t=>({role:t.role}))),nRe.AssistantMessage$outboundSchema.and(ct.object({role:ct.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:HTr.ResponseFormat$outboundSchema.optional(),tools:ct.nullable(ct.array(WTr.Tool$outboundSchema)).optional(),toolChoice:ct.union([iRe.ToolChoice$outboundSchema,aRe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:ct.number().optional(),frequencyPenalty:ct.number().optional(),n:ct.nullable(ct.number().int()).optional(),prediction:VTr.Prediction$outboundSchema.optional(),parallelToolCalls:ct.boolean().optional(),promptMode:ct.nullable(zTr.MistralPromptMode$outboundSchema).optional(),safePrompt:ct.boolean().optional()}).transform(t=>(0,UTr.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",parallelToolCalls:"parallel_tool_calls",promptMode:"prompt_mode",safePrompt:"safe_prompt"}));var BTr;(function(t){t.inboundSchema=tn.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=tn.ChatCompletionStreamRequest$outboundSchema})(BTr||(tn.ChatCompletionStreamRequest$=BTr={}));function vxo(t){return JSON.stringify(tn.ChatCompletionStreamRequest$outboundSchema.parse(t))}function wxo(t){return(0,rRe.safeParse)(t,e=>tn.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var QTr=S(rn=>{"use strict";var Sxo=rn&&rn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cxo=rn&&rn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xxo=rn&&rn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Sxo(r,e,n[o]);return Cxo(r,e),r}}();Object.defineProperty(rn,"__esModule",{value:!0});rn.ChatModerationRequest$=rn.ChatModerationRequest$outboundSchema=rn.ChatModerationRequest$inboundSchema=rn.ChatModerationRequestInputs$=rn.ChatModerationRequestInputs$outboundSchema=rn.ChatModerationRequestInputs$inboundSchema=rn.One$=rn.One$outboundSchema=rn.One$inboundSchema=rn.Two$=rn.Two$outboundSchema=rn.Two$inboundSchema=void 0;rn.twoToJSON=Txo;rn.twoFromJSON=Oxo;rn.oneToJSON=Exo;rn.oneFromJSON=Pxo;rn.chatModerationRequestInputsToJSON=Mxo;rn.chatModerationRequestInputsFromJSON=Rxo;rn.chatModerationRequestToJSON=Ixo;rn.chatModerationRequestFromJSON=Axo;var qe=xxo(ae()),YTr=ce(),lRe=te(),E0=OA(),P0=UD(),M0=zD(),R0=VD();rn.Two$inboundSchema=qe.union([P0.SystemMessage$inboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),M0.ToolMessage$inboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role}))),R0.UserMessage$inboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),E0.AssistantMessage$inboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role})))]);rn.Two$outboundSchema=qe.union([P0.SystemMessage$outboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),M0.ToolMessage$outboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role}))),R0.UserMessage$outboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),E0.AssistantMessage$outboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role})))]);var KTr;(function(t){t.inboundSchema=rn.Two$inboundSchema,t.outboundSchema=rn.Two$outboundSchema})(KTr||(rn.Two$=KTr={}));function Txo(t){return JSON.stringify(rn.Two$outboundSchema.parse(t))}function Oxo(t){return(0,lRe.safeParse)(t,e=>rn.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}rn.One$inboundSchema=qe.union([P0.SystemMessage$inboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),M0.ToolMessage$inboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role}))),R0.UserMessage$inboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),E0.AssistantMessage$inboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role})))]);rn.One$outboundSchema=qe.union([P0.SystemMessage$outboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),M0.ToolMessage$outboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role}))),R0.UserMessage$outboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),E0.AssistantMessage$outboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role})))]);var GTr;(function(t){t.inboundSchema=rn.One$inboundSchema,t.outboundSchema=rn.One$outboundSchema})(GTr||(rn.One$=GTr={}));function Exo(t){return JSON.stringify(rn.One$outboundSchema.parse(t))}function Pxo(t){return(0,lRe.safeParse)(t,e=>rn.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}rn.ChatModerationRequestInputs$inboundSchema=qe.union([qe.array(qe.union([P0.SystemMessage$inboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),M0.ToolMessage$inboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role}))),R0.UserMessage$inboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),E0.AssistantMessage$inboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role})))])),qe.array(qe.array(qe.union([P0.SystemMessage$inboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),M0.ToolMessage$inboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role}))),R0.UserMessage$inboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),E0.AssistantMessage$inboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role})))])))]);rn.ChatModerationRequestInputs$outboundSchema=qe.union([qe.array(qe.union([P0.SystemMessage$outboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),M0.ToolMessage$outboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role}))),R0.UserMessage$outboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),E0.AssistantMessage$outboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role})))])),qe.array(qe.array(qe.union([P0.SystemMessage$outboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),M0.ToolMessage$outboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role}))),R0.UserMessage$outboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),E0.AssistantMessage$outboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role})))])))]);var XTr;(function(t){t.inboundSchema=rn.ChatModerationRequestInputs$inboundSchema,t.outboundSchema=rn.ChatModerationRequestInputs$outboundSchema})(XTr||(rn.ChatModerationRequestInputs$=XTr={}));function Mxo(t){return JSON.stringify(rn.ChatModerationRequestInputs$outboundSchema.parse(t))}function Rxo(t){return(0,lRe.safeParse)(t,e=>rn.ChatModerationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatModerationRequestInputs' from JSON")}rn.ChatModerationRequest$inboundSchema=qe.object({input:qe.union([qe.array(qe.union([P0.SystemMessage$inboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),M0.ToolMessage$inboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role}))),R0.UserMessage$inboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),E0.AssistantMessage$inboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role})))])),qe.array(qe.array(qe.union([P0.SystemMessage$inboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),M0.ToolMessage$inboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role}))),R0.UserMessage$inboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),E0.AssistantMessage$inboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role})))])))]),model:qe.string()}).transform(t=>(0,YTr.remap)(t,{input:"inputs"}));rn.ChatModerationRequest$outboundSchema=qe.object({inputs:qe.union([qe.array(qe.union([P0.SystemMessage$outboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),M0.ToolMessage$outboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role}))),R0.UserMessage$outboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),E0.AssistantMessage$outboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role})))])),qe.array(qe.array(qe.union([P0.SystemMessage$outboundSchema.and(qe.object({role:qe.literal("system")}).transform(t=>({role:t.role}))),M0.ToolMessage$outboundSchema.and(qe.object({role:qe.literal("tool")}).transform(t=>({role:t.role}))),R0.UserMessage$outboundSchema.and(qe.object({role:qe.literal("user")}).transform(t=>({role:t.role}))),E0.AssistantMessage$outboundSchema.and(qe.object({role:qe.literal("assistant")}).transform(t=>({role:t.role})))])))]),model:qe.string()}).transform(t=>(0,YTr.remap)(t,{inputs:"input"}));var ZTr;(function(t){t.inboundSchema=rn.ChatModerationRequest$inboundSchema,t.outboundSchema=rn.ChatModerationRequest$outboundSchema})(ZTr||(rn.ChatModerationRequest$=ZTr={}));function Ixo(t){return JSON.stringify(rn.ChatModerationRequest$outboundSchema.parse(t))}function Axo(t){return(0,lRe.safeParse)(t,e=>rn.ChatModerationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatModerationRequest' from JSON")}});var zlt=S(df=>{"use strict";var Nxo=df&&df.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Dxo=df&&df.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jxo=df&&df.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Nxo(r,e,n[o]);return Dxo(r,e),r}}();Object.defineProperty(df,"__esModule",{value:!0});df.MetricOut$=df.MetricOut$outboundSchema=df.MetricOut$inboundSchema=void 0;df.metricOutToJSON=Lxo;df.metricOutFromJSON=Fxo;var pv=jxo(ae()),tOr=ce(),$xo=te();df.MetricOut$inboundSchema=pv.object({train_loss:pv.nullable(pv.number()).optional(),valid_loss:pv.nullable(pv.number()).optional(),valid_mean_token_accuracy:pv.nullable(pv.number()).optional()}).transform(t=>(0,tOr.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));df.MetricOut$outboundSchema=pv.object({trainLoss:pv.nullable(pv.number()).optional(),validLoss:pv.nullable(pv.number()).optional(),validMeanTokenAccuracy:pv.nullable(pv.number()).optional()}).transform(t=>(0,tOr.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var eOr;(function(t){t.inboundSchema=df.MetricOut$inboundSchema,t.outboundSchema=df.MetricOut$outboundSchema})(eOr||(df.MetricOut$=eOr={}));function Lxo(t){return JSON.stringify(df.MetricOut$outboundSchema.parse(t))}function Fxo(t){return(0,$xo.safeParse)(t,e=>df.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var cRe=S(ff=>{"use strict";var kxo=ff&&ff.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qxo=ff&&ff.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bxo=ff&&ff.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kxo(r,e,n[o]);return qxo(r,e),r}}();Object.defineProperty(ff,"__esModule",{value:!0});ff.CheckpointOut$=ff.CheckpointOut$outboundSchema=ff.CheckpointOut$inboundSchema=void 0;ff.checkpointOutToJSON=zxo;ff.checkpointOutFromJSON=Vxo;var a7=Bxo(ae()),nOr=ce(),Uxo=te(),oOr=zlt();ff.CheckpointOut$inboundSchema=a7.object({metrics:oOr.MetricOut$inboundSchema,step_number:a7.number().int(),created_at:a7.number().int()}).transform(t=>(0,nOr.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));ff.CheckpointOut$outboundSchema=a7.object({metrics:oOr.MetricOut$outboundSchema,stepNumber:a7.number().int(),createdAt:a7.number().int()}).transform(t=>(0,nOr.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var rOr;(function(t){t.inboundSchema=ff.CheckpointOut$inboundSchema,t.outboundSchema=ff.CheckpointOut$outboundSchema})(rOr||(ff.CheckpointOut$=rOr={}));function zxo(t){return JSON.stringify(ff.CheckpointOut$outboundSchema.parse(t))}function Vxo(t){return(0,Uxo.safeParse)(t,e=>ff.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var lOr=S(bs=>{"use strict";var Hxo=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]}),Wxo=bs&&bs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jxo=bs&&bs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Hxo(r,e,n[o]);return Wxo(r,e),r}}();Object.defineProperty(bs,"__esModule",{value:!0});bs.ClassificationRequest$=bs.ClassificationRequest$outboundSchema=bs.ClassificationRequest$inboundSchema=bs.ClassificationRequestInputs$=bs.ClassificationRequestInputs$outboundSchema=bs.ClassificationRequestInputs$inboundSchema=void 0;bs.classificationRequestInputsToJSON=Kxo;bs.classificationRequestInputsFromJSON=Gxo;bs.classificationRequestToJSON=Xxo;bs.classificationRequestFromJSON=Zxo;var pf=Jxo(ae()),sOr=ce(),uOr=te();bs.ClassificationRequestInputs$inboundSchema=pf.union([pf.string(),pf.array(pf.string())]);bs.ClassificationRequestInputs$outboundSchema=pf.union([pf.string(),pf.array(pf.string())]);var iOr;(function(t){t.inboundSchema=bs.ClassificationRequestInputs$inboundSchema,t.outboundSchema=bs.ClassificationRequestInputs$outboundSchema})(iOr||(bs.ClassificationRequestInputs$=iOr={}));function Kxo(t){return JSON.stringify(bs.ClassificationRequestInputs$outboundSchema.parse(t))}function Gxo(t){return(0,uOr.safeParse)(t,e=>bs.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}bs.ClassificationRequest$inboundSchema=pf.object({model:pf.string(),input:pf.union([pf.string(),pf.array(pf.string())])}).transform(t=>(0,sOr.remap)(t,{input:"inputs"}));bs.ClassificationRequest$outboundSchema=pf.object({model:pf.string(),inputs:pf.union([pf.string(),pf.array(pf.string())])}).transform(t=>(0,sOr.remap)(t,{inputs:"input"}));var aOr;(function(t){t.inboundSchema=bs.ClassificationRequest$inboundSchema,t.outboundSchema=bs.ClassificationRequest$outboundSchema})(aOr||(bs.ClassificationRequest$=aOr={}));function Xxo(t){return JSON.stringify(bs.ClassificationRequest$outboundSchema.parse(t))}function Zxo(t){return(0,uOr.safeParse)(t,e=>bs.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var Vlt=S(mf=>{"use strict";var Yxo=mf&&mf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qxo=mf&&mf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eTo=mf&&mf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Yxo(r,e,n[o]);return Qxo(r,e),r}}();Object.defineProperty(mf,"__esModule",{value:!0});mf.ClassificationTargetResult$=mf.ClassificationTargetResult$outboundSchema=mf.ClassificationTargetResult$inboundSchema=void 0;mf.classificationTargetResultToJSON=rTo;mf.classificationTargetResultFromJSON=nTo;var s7=eTo(ae()),tTo=te();mf.ClassificationTargetResult$inboundSchema=s7.object({scores:s7.record(s7.number())});mf.ClassificationTargetResult$outboundSchema=s7.object({scores:s7.record(s7.number())});var cOr;(function(t){t.inboundSchema=mf.ClassificationTargetResult$inboundSchema,t.outboundSchema=mf.ClassificationTargetResult$outboundSchema})(cOr||(mf.ClassificationTargetResult$=cOr={}));function rTo(t){return JSON.stringify(mf.ClassificationTargetResult$outboundSchema.parse(t))}function nTo(t){return(0,tTo.safeParse)(t,e=>mf.ClassificationTargetResult$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationTargetResult' from JSON")}});var pOr=S(hf=>{"use strict";var oTo=hf&&hf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iTo=hf&&hf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aTo=hf&&hf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&oTo(r,e,n[o]);return iTo(r,e),r}}();Object.defineProperty(hf,"__esModule",{value:!0});hf.ClassificationResponse$=hf.ClassificationResponse$outboundSchema=hf.ClassificationResponse$inboundSchema=void 0;hf.classificationResponseToJSON=uTo;hf.classificationResponseFromJSON=lTo;var PA=aTo(ae()),sTo=te(),fOr=Vlt();hf.ClassificationResponse$inboundSchema=PA.object({id:PA.string(),model:PA.string(),results:PA.array(PA.record(fOr.ClassificationTargetResult$inboundSchema))});hf.ClassificationResponse$outboundSchema=PA.object({id:PA.string(),model:PA.string(),results:PA.array(PA.record(fOr.ClassificationTargetResult$outboundSchema))});var dOr;(function(t){t.inboundSchema=hf.ClassificationResponse$inboundSchema,t.outboundSchema=hf.ClassificationResponse$outboundSchema})(dOr||(hf.ClassificationResponse$=dOr={}));function uTo(t){return JSON.stringify(hf.ClassificationResponse$outboundSchema.parse(t))}function lTo(t){return(0,sTo.safeParse)(t,e=>hf.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var dRe=S(gf=>{"use strict";var cTo=gf&&gf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dTo=gf&&gf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fTo=gf&&gf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cTo(r,e,n[o]);return dTo(r,e),r}}();Object.defineProperty(gf,"__esModule",{value:!0});gf.FTClassifierLossFunction$=gf.FTClassifierLossFunction$outboundSchema=gf.FTClassifierLossFunction$inboundSchema=gf.FTClassifierLossFunction=void 0;var pTo=fTo(ae());gf.FTClassifierLossFunction={SingleClass:"single_class",MultiClass:"multi_class"};gf.FTClassifierLossFunction$inboundSchema=pTo.nativeEnum(gf.FTClassifierLossFunction);gf.FTClassifierLossFunction$outboundSchema=gf.FTClassifierLossFunction$inboundSchema;var mOr;(function(t){t.inboundSchema=gf.FTClassifierLossFunction$inboundSchema,t.outboundSchema=gf.FTClassifierLossFunction$outboundSchema})(mOr||(gf.FTClassifierLossFunction$=mOr={}))});var fRe=S(yf=>{"use strict";var mTo=yf&&yf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hTo=yf&&yf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gTo=yf&&yf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mTo(r,e,n[o]);return hTo(r,e),r}}();Object.defineProperty(yf,"__esModule",{value:!0});yf.ClassifierTargetOut$=yf.ClassifierTargetOut$outboundSchema=yf.ClassifierTargetOut$inboundSchema=void 0;yf.classifierTargetOutToJSON=bTo;yf.classifierTargetOutFromJSON=_To;var MA=gTo(ae()),gOr=ce(),yTo=te(),yOr=dRe();yf.ClassifierTargetOut$inboundSchema=MA.object({name:MA.string(),labels:MA.array(MA.string()),weight:MA.number(),loss_function:yOr.FTClassifierLossFunction$inboundSchema}).transform(t=>(0,gOr.remap)(t,{loss_function:"lossFunction"}));yf.ClassifierTargetOut$outboundSchema=MA.object({name:MA.string(),labels:MA.array(MA.string()),weight:MA.number(),lossFunction:yOr.FTClassifierLossFunction$outboundSchema}).transform(t=>(0,gOr.remap)(t,{lossFunction:"loss_function"}));var hOr;(function(t){t.inboundSchema=yf.ClassifierTargetOut$inboundSchema,t.outboundSchema=yf.ClassifierTargetOut$outboundSchema})(hOr||(yf.ClassifierTargetOut$=hOr={}));function bTo(t){return JSON.stringify(yf.ClassifierTargetOut$outboundSchema.parse(t))}function _To(t){return(0,yTo.safeParse)(t,e=>yf.ClassifierTargetOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTargetOut' from JSON")}});var pRe=S(bf=>{"use strict";var vTo=bf&&bf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wTo=bf&&bf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),STo=bf&&bf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vTo(r,e,n[o]);return wTo(r,e),r}}();Object.defineProperty(bf,"__esModule",{value:!0});bf.ClassifierTrainingParameters$=bf.ClassifierTrainingParameters$outboundSchema=bf.ClassifierTrainingParameters$inboundSchema=void 0;bf.classifierTrainingParametersToJSON=xTo;bf.classifierTrainingParametersFromJSON=TTo;var rc=STo(ae()),_Or=ce(),CTo=te();bf.ClassifierTrainingParameters$inboundSchema=rc.object({training_steps:rc.nullable(rc.number().int()).optional(),learning_rate:rc.number().default(1e-4),weight_decay:rc.nullable(rc.number()).optional(),warmup_fraction:rc.nullable(rc.number()).optional(),epochs:rc.nullable(rc.number()).optional(),seq_len:rc.nullable(rc.number().int()).optional()}).transform(t=>(0,_Or.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen"}));bf.ClassifierTrainingParameters$outboundSchema=rc.object({trainingSteps:rc.nullable(rc.number().int()).optional(),learningRate:rc.number().default(1e-4),weightDecay:rc.nullable(rc.number()).optional(),warmupFraction:rc.nullable(rc.number()).optional(),epochs:rc.nullable(rc.number()).optional(),seqLen:rc.nullable(rc.number().int()).optional()}).transform(t=>(0,_Or.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len"}));var bOr;(function(t){t.inboundSchema=bf.ClassifierTrainingParameters$inboundSchema,t.outboundSchema=bf.ClassifierTrainingParameters$outboundSchema})(bOr||(bf.ClassifierTrainingParameters$=bOr={}));function xTo(t){return JSON.stringify(bf.ClassifierTrainingParameters$outboundSchema.parse(t))}function TTo(t){return(0,CTo.safeParse)(t,e=>bf.ClassifierTrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTrainingParameters' from JSON")}});var mRe=S(_f=>{"use strict";var OTo=_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]}),ETo=_f&&_f.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PTo=_f&&_f.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&OTo(r,e,n[o]);return ETo(r,e),r}}();Object.defineProperty(_f,"__esModule",{value:!0});_f.EventOut$=_f.EventOut$outboundSchema=_f.EventOut$inboundSchema=void 0;_f.eventOutToJSON=RTo;_f.eventOutFromJSON=ITo;var I0=PTo(ae()),wOr=ce(),MTo=te();_f.EventOut$inboundSchema=I0.object({name:I0.string(),data:I0.nullable(I0.record(I0.any())).optional(),created_at:I0.number().int()}).transform(t=>(0,wOr.remap)(t,{created_at:"createdAt"}));_f.EventOut$outboundSchema=I0.object({name:I0.string(),data:I0.nullable(I0.record(I0.any())).optional(),createdAt:I0.number().int()}).transform(t=>(0,wOr.remap)(t,{createdAt:"created_at"}));var vOr;(function(t){t.inboundSchema=_f.EventOut$inboundSchema,t.outboundSchema=_f.EventOut$outboundSchema})(vOr||(_f.EventOut$=vOr={}));function RTo(t){return JSON.stringify(_f.EventOut$outboundSchema.parse(t))}function ITo(t){return(0,MTo.safeParse)(t,e=>_f.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var u7=S(vf=>{"use strict";var ATo=vf&&vf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NTo=vf&&vf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DTo=vf&&vf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ATo(r,e,n[o]);return NTo(r,e),r}}();Object.defineProperty(vf,"__esModule",{value:!0});vf.JobMetadataOut$=vf.JobMetadataOut$outboundSchema=vf.JobMetadataOut$inboundSchema=void 0;vf.jobMetadataOutToJSON=$To;vf.jobMetadataOutFromJSON=LTo;var eu=DTo(ae()),COr=ce(),jTo=te();vf.JobMetadataOut$inboundSchema=eu.object({expected_duration_seconds:eu.nullable(eu.number().int()).optional(),cost:eu.nullable(eu.number()).optional(),cost_currency:eu.nullable(eu.string()).optional(),train_tokens_per_step:eu.nullable(eu.number().int()).optional(),train_tokens:eu.nullable(eu.number().int()).optional(),data_tokens:eu.nullable(eu.number().int()).optional(),estimated_start_time:eu.nullable(eu.number().int()).optional()}).transform(t=>(0,COr.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));vf.JobMetadataOut$outboundSchema=eu.object({expectedDurationSeconds:eu.nullable(eu.number().int()).optional(),cost:eu.nullable(eu.number()).optional(),costCurrency:eu.nullable(eu.string()).optional(),trainTokensPerStep:eu.nullable(eu.number().int()).optional(),trainTokens:eu.nullable(eu.number().int()).optional(),dataTokens:eu.nullable(eu.number().int()).optional(),estimatedStartTime:eu.nullable(eu.number().int()).optional()}).transform(t=>(0,COr.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 SOr;(function(t){t.inboundSchema=vf.JobMetadataOut$inboundSchema,t.outboundSchema=vf.JobMetadataOut$outboundSchema})(SOr||(vf.JobMetadataOut$=SOr={}));function $To(t){return JSON.stringify(vf.JobMetadataOut$outboundSchema.parse(t))}function LTo(t){return(0,jTo.safeParse)(t,e=>vf.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var l7=S(Ta=>{"use strict";var FTo=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]}),kTo=Ta&&Ta.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qTo=Ta&&Ta.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&FTo(r,e,n[o]);return kTo(r,e),r}}();Object.defineProperty(Ta,"__esModule",{value:!0});Ta.WandbIntegrationOut$=Ta.WandbIntegrationOut$outboundSchema=Ta.WandbIntegrationOut$inboundSchema=Ta.WandbIntegrationOutType$=Ta.WandbIntegrationOutType$outboundSchema=Ta.WandbIntegrationOutType$inboundSchema=Ta.WandbIntegrationOutType=void 0;Ta.wandbIntegrationOutToJSON=UTo;Ta.wandbIntegrationOutFromJSON=zTo;var Xg=qTo(ae()),OOr=ce(),BTo=te();Ta.WandbIntegrationOutType={Wandb:"wandb"};Ta.WandbIntegrationOutType$inboundSchema=Xg.nativeEnum(Ta.WandbIntegrationOutType);Ta.WandbIntegrationOutType$outboundSchema=Ta.WandbIntegrationOutType$inboundSchema;var xOr;(function(t){t.inboundSchema=Ta.WandbIntegrationOutType$inboundSchema,t.outboundSchema=Ta.WandbIntegrationOutType$outboundSchema})(xOr||(Ta.WandbIntegrationOutType$=xOr={}));Ta.WandbIntegrationOut$inboundSchema=Xg.object({type:Ta.WandbIntegrationOutType$inboundSchema.default("wandb"),project:Xg.string(),name:Xg.nullable(Xg.string()).optional(),run_name:Xg.nullable(Xg.string()).optional(),url:Xg.nullable(Xg.string()).optional()}).transform(t=>(0,OOr.remap)(t,{run_name:"runName"}));Ta.WandbIntegrationOut$outboundSchema=Xg.object({type:Ta.WandbIntegrationOutType$outboundSchema.default("wandb"),project:Xg.string(),name:Xg.nullable(Xg.string()).optional(),runName:Xg.nullable(Xg.string()).optional(),url:Xg.nullable(Xg.string()).optional()}).transform(t=>(0,OOr.remap)(t,{runName:"run_name"}));var TOr;(function(t){t.inboundSchema=Ta.WandbIntegrationOut$inboundSchema,t.outboundSchema=Ta.WandbIntegrationOut$outboundSchema})(TOr||(Ta.WandbIntegrationOut$=TOr={}));function UTo(t){return JSON.stringify(Ta.WandbIntegrationOut$outboundSchema.parse(t))}function zTo(t){return(0,BTo.safeParse)(t,e=>Ta.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var kOr=S(rr=>{"use strict";var VTo=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]}),HTo=rr&&rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WTo=rr&&rr.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&VTo(r,e,n[o]);return HTo(r,e),r}}();Object.defineProperty(rr,"__esModule",{value:!0});rr.ClassifierDetailedJobOut$=rr.ClassifierDetailedJobOut$outboundSchema=rr.ClassifierDetailedJobOut$inboundSchema=rr.ClassifierDetailedJobOutJobType$=rr.ClassifierDetailedJobOutJobType$outboundSchema=rr.ClassifierDetailedJobOutJobType$inboundSchema=rr.ClassifierDetailedJobOutIntegrations$=rr.ClassifierDetailedJobOutIntegrations$outboundSchema=rr.ClassifierDetailedJobOutIntegrations$inboundSchema=rr.ClassifierDetailedJobOutObject$=rr.ClassifierDetailedJobOutObject$outboundSchema=rr.ClassifierDetailedJobOutObject$inboundSchema=rr.ClassifierDetailedJobOutStatus$=rr.ClassifierDetailedJobOutStatus$outboundSchema=rr.ClassifierDetailedJobOutStatus$inboundSchema=rr.ClassifierDetailedJobOutJobType=rr.ClassifierDetailedJobOutObject=rr.ClassifierDetailedJobOutStatus=void 0;rr.classifierDetailedJobOutIntegrationsToJSON=JTo;rr.classifierDetailedJobOutIntegrationsFromJSON=KTo;rr.classifierDetailedJobOutToJSON=GTo;rr.classifierDetailedJobOutFromJSON=XTo;var Bn=WTo(ae()),AOr=ce(),NOr=te(),DOr=cRe(),jOr=fRe(),$Or=pRe(),LOr=mRe(),FOr=u7(),hRe=l7();rr.ClassifierDetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};rr.ClassifierDetailedJobOutObject={Job:"job"};rr.ClassifierDetailedJobOutJobType={Classifier:"classifier"};rr.ClassifierDetailedJobOutStatus$inboundSchema=Bn.nativeEnum(rr.ClassifierDetailedJobOutStatus);rr.ClassifierDetailedJobOutStatus$outboundSchema=rr.ClassifierDetailedJobOutStatus$inboundSchema;var EOr;(function(t){t.inboundSchema=rr.ClassifierDetailedJobOutStatus$inboundSchema,t.outboundSchema=rr.ClassifierDetailedJobOutStatus$outboundSchema})(EOr||(rr.ClassifierDetailedJobOutStatus$=EOr={}));rr.ClassifierDetailedJobOutObject$inboundSchema=Bn.nativeEnum(rr.ClassifierDetailedJobOutObject);rr.ClassifierDetailedJobOutObject$outboundSchema=rr.ClassifierDetailedJobOutObject$inboundSchema;var POr;(function(t){t.inboundSchema=rr.ClassifierDetailedJobOutObject$inboundSchema,t.outboundSchema=rr.ClassifierDetailedJobOutObject$outboundSchema})(POr||(rr.ClassifierDetailedJobOutObject$=POr={}));rr.ClassifierDetailedJobOutIntegrations$inboundSchema=hRe.WandbIntegrationOut$inboundSchema;rr.ClassifierDetailedJobOutIntegrations$outboundSchema=hRe.WandbIntegrationOut$outboundSchema;var MOr;(function(t){t.inboundSchema=rr.ClassifierDetailedJobOutIntegrations$inboundSchema,t.outboundSchema=rr.ClassifierDetailedJobOutIntegrations$outboundSchema})(MOr||(rr.ClassifierDetailedJobOutIntegrations$=MOr={}));function JTo(t){return JSON.stringify(rr.ClassifierDetailedJobOutIntegrations$outboundSchema.parse(t))}function KTo(t){return(0,NOr.safeParse)(t,e=>rr.ClassifierDetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierDetailedJobOutIntegrations' from JSON")}rr.ClassifierDetailedJobOutJobType$inboundSchema=Bn.nativeEnum(rr.ClassifierDetailedJobOutJobType);rr.ClassifierDetailedJobOutJobType$outboundSchema=rr.ClassifierDetailedJobOutJobType$inboundSchema;var ROr;(function(t){t.inboundSchema=rr.ClassifierDetailedJobOutJobType$inboundSchema,t.outboundSchema=rr.ClassifierDetailedJobOutJobType$outboundSchema})(ROr||(rr.ClassifierDetailedJobOutJobType$=ROr={}));rr.ClassifierDetailedJobOut$inboundSchema=Bn.object({id:Bn.string(),auto_start:Bn.boolean(),model:Bn.string(),status:rr.ClassifierDetailedJobOutStatus$inboundSchema,created_at:Bn.number().int(),modified_at:Bn.number().int(),training_files:Bn.array(Bn.string()),validation_files:Bn.nullable(Bn.array(Bn.string())).optional(),object:rr.ClassifierDetailedJobOutObject$inboundSchema.default("job"),fine_tuned_model:Bn.nullable(Bn.string()).optional(),suffix:Bn.nullable(Bn.string()).optional(),integrations:Bn.nullable(Bn.array(hRe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Bn.nullable(Bn.number().int()).optional(),metadata:Bn.nullable(FOr.JobMetadataOut$inboundSchema).optional(),job_type:rr.ClassifierDetailedJobOutJobType$inboundSchema.default("classifier"),hyperparameters:$Or.ClassifierTrainingParameters$inboundSchema,events:Bn.array(LOr.EventOut$inboundSchema).optional(),checkpoints:Bn.array(DOr.CheckpointOut$inboundSchema).optional(),classifier_targets:Bn.array(jOr.ClassifierTargetOut$inboundSchema)}).transform(t=>(0,AOr.remap)(t,{auto_start:"autoStart",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens",job_type:"jobType",classifier_targets:"classifierTargets"}));rr.ClassifierDetailedJobOut$outboundSchema=Bn.object({id:Bn.string(),autoStart:Bn.boolean(),model:Bn.string(),status:rr.ClassifierDetailedJobOutStatus$outboundSchema,createdAt:Bn.number().int(),modifiedAt:Bn.number().int(),trainingFiles:Bn.array(Bn.string()),validationFiles:Bn.nullable(Bn.array(Bn.string())).optional(),object:rr.ClassifierDetailedJobOutObject$outboundSchema.default("job"),fineTunedModel:Bn.nullable(Bn.string()).optional(),suffix:Bn.nullable(Bn.string()).optional(),integrations:Bn.nullable(Bn.array(hRe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Bn.nullable(Bn.number().int()).optional(),metadata:Bn.nullable(FOr.JobMetadataOut$outboundSchema).optional(),jobType:rr.ClassifierDetailedJobOutJobType$outboundSchema.default("classifier"),hyperparameters:$Or.ClassifierTrainingParameters$outboundSchema,events:Bn.array(LOr.EventOut$outboundSchema).optional(),checkpoints:Bn.array(DOr.CheckpointOut$outboundSchema).optional(),classifierTargets:Bn.array(jOr.ClassifierTargetOut$outboundSchema)}).transform(t=>(0,AOr.remap)(t,{autoStart:"auto_start",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens",jobType:"job_type",classifierTargets:"classifier_targets"}));var IOr;(function(t){t.inboundSchema=rr.ClassifierDetailedJobOut$inboundSchema,t.outboundSchema=rr.ClassifierDetailedJobOut$outboundSchema})(IOr||(rr.ClassifierDetailedJobOut$=IOr={}));function GTo(t){return JSON.stringify(rr.ClassifierDetailedJobOut$outboundSchema.parse(t))}function XTo(t){return(0,NOr.safeParse)(t,e=>rr.ClassifierDetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierDetailedJobOut' from JSON")}});var gRe=S(wf=>{"use strict";var ZTo=wf&&wf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YTo=wf&&wf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QTo=wf&&wf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ZTo(r,e,n[o]);return YTo(r,e),r}}();Object.defineProperty(wf,"__esModule",{value:!0});wf.FTModelCapabilitiesOut$=wf.FTModelCapabilitiesOut$outboundSchema=wf.FTModelCapabilitiesOut$inboundSchema=void 0;wf.ftModelCapabilitiesOutToJSON=tOo;wf.ftModelCapabilitiesOutFromJSON=rOo;var A0=QTo(ae()),BOr=ce(),eOo=te();wf.FTModelCapabilitiesOut$inboundSchema=A0.object({completion_chat:A0.boolean().default(!0),completion_fim:A0.boolean().default(!1),function_calling:A0.boolean().default(!1),fine_tuning:A0.boolean().default(!1),classification:A0.boolean().default(!1)}).transform(t=>(0,BOr.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));wf.FTModelCapabilitiesOut$outboundSchema=A0.object({completionChat:A0.boolean().default(!0),completionFim:A0.boolean().default(!1),functionCalling:A0.boolean().default(!1),fineTuning:A0.boolean().default(!1),classification:A0.boolean().default(!1)}).transform(t=>(0,BOr.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var qOr;(function(t){t.inboundSchema=wf.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=wf.FTModelCapabilitiesOut$outboundSchema})(qOr||(wf.FTModelCapabilitiesOut$=qOr={}));function tOo(t){return JSON.stringify(wf.FTModelCapabilitiesOut$outboundSchema.parse(t))}function rOo(t){return(0,eOo.safeParse)(t,e=>wf.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var KOr=S(Kn=>{"use strict";var nOo=Kn&&Kn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oOo=Kn&&Kn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iOo=Kn&&Kn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nOo(r,e,n[o]);return oOo(r,e),r}}();Object.defineProperty(Kn,"__esModule",{value:!0});Kn.ClassifierFTModelOut$=Kn.ClassifierFTModelOut$outboundSchema=Kn.ClassifierFTModelOut$inboundSchema=Kn.ClassifierFTModelOutModelType$=Kn.ClassifierFTModelOutModelType$outboundSchema=Kn.ClassifierFTModelOutModelType$inboundSchema=Kn.ClassifierFTModelOutObject$=Kn.ClassifierFTModelOutObject$outboundSchema=Kn.ClassifierFTModelOutObject$inboundSchema=Kn.ClassifierFTModelOutModelType=Kn.ClassifierFTModelOutObject=void 0;Kn.classifierFTModelOutToJSON=sOo;Kn.classifierFTModelOutFromJSON=uOo;var qi=iOo(ae()),HOr=ce(),aOo=te(),WOr=fRe(),JOr=gRe();Kn.ClassifierFTModelOutObject={Model:"model"};Kn.ClassifierFTModelOutModelType={Classifier:"classifier"};Kn.ClassifierFTModelOutObject$inboundSchema=qi.nativeEnum(Kn.ClassifierFTModelOutObject);Kn.ClassifierFTModelOutObject$outboundSchema=Kn.ClassifierFTModelOutObject$inboundSchema;var UOr;(function(t){t.inboundSchema=Kn.ClassifierFTModelOutObject$inboundSchema,t.outboundSchema=Kn.ClassifierFTModelOutObject$outboundSchema})(UOr||(Kn.ClassifierFTModelOutObject$=UOr={}));Kn.ClassifierFTModelOutModelType$inboundSchema=qi.nativeEnum(Kn.ClassifierFTModelOutModelType);Kn.ClassifierFTModelOutModelType$outboundSchema=Kn.ClassifierFTModelOutModelType$inboundSchema;var zOr;(function(t){t.inboundSchema=Kn.ClassifierFTModelOutModelType$inboundSchema,t.outboundSchema=Kn.ClassifierFTModelOutModelType$outboundSchema})(zOr||(Kn.ClassifierFTModelOutModelType$=zOr={}));Kn.ClassifierFTModelOut$inboundSchema=qi.object({id:qi.string(),object:Kn.ClassifierFTModelOutObject$inboundSchema.default("model"),created:qi.number().int(),owned_by:qi.string(),workspace_id:qi.string(),root:qi.string(),root_version:qi.string(),archived:qi.boolean(),name:qi.nullable(qi.string()).optional(),description:qi.nullable(qi.string()).optional(),capabilities:JOr.FTModelCapabilitiesOut$inboundSchema,max_context_length:qi.number().int().default(32768),aliases:qi.array(qi.string()).optional(),job:qi.string(),classifier_targets:qi.array(WOr.ClassifierTargetOut$inboundSchema),model_type:Kn.ClassifierFTModelOutModelType$inboundSchema.default("classifier")}).transform(t=>(0,HOr.remap)(t,{owned_by:"ownedBy",workspace_id:"workspaceId",root_version:"rootVersion",max_context_length:"maxContextLength",classifier_targets:"classifierTargets",model_type:"modelType"}));Kn.ClassifierFTModelOut$outboundSchema=qi.object({id:qi.string(),object:Kn.ClassifierFTModelOutObject$outboundSchema.default("model"),created:qi.number().int(),ownedBy:qi.string(),workspaceId:qi.string(),root:qi.string(),rootVersion:qi.string(),archived:qi.boolean(),name:qi.nullable(qi.string()).optional(),description:qi.nullable(qi.string()).optional(),capabilities:JOr.FTModelCapabilitiesOut$outboundSchema,maxContextLength:qi.number().int().default(32768),aliases:qi.array(qi.string()).optional(),job:qi.string(),classifierTargets:qi.array(WOr.ClassifierTargetOut$outboundSchema),modelType:Kn.ClassifierFTModelOutModelType$outboundSchema.default("classifier")}).transform(t=>(0,HOr.remap)(t,{ownedBy:"owned_by",workspaceId:"workspace_id",rootVersion:"root_version",maxContextLength:"max_context_length",classifierTargets:"classifier_targets",modelType:"model_type"}));var VOr;(function(t){t.inboundSchema=Kn.ClassifierFTModelOut$inboundSchema,t.outboundSchema=Kn.ClassifierFTModelOut$outboundSchema})(VOr||(Kn.ClassifierFTModelOut$=VOr={}));function sOo(t){return JSON.stringify(Kn.ClassifierFTModelOut$outboundSchema.parse(t))}function uOo(t){return(0,aOo.safeParse)(t,e=>Kn.ClassifierFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierFTModelOut' from JSON")}});var Hlt=S(nr=>{"use strict";var lOo=nr&&nr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cOo=nr&&nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dOo=nr&&nr.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&lOo(r,e,n[o]);return cOo(r,e),r}}();Object.defineProperty(nr,"__esModule",{value:!0});nr.ClassifierJobOut$=nr.ClassifierJobOut$outboundSchema=nr.ClassifierJobOut$inboundSchema=nr.ClassifierJobOutJobType$=nr.ClassifierJobOutJobType$outboundSchema=nr.ClassifierJobOutJobType$inboundSchema=nr.ClassifierJobOutIntegrations$=nr.ClassifierJobOutIntegrations$outboundSchema=nr.ClassifierJobOutIntegrations$inboundSchema=nr.ClassifierJobOutObject$=nr.ClassifierJobOutObject$outboundSchema=nr.ClassifierJobOutObject$inboundSchema=nr.ClassifierJobOutStatus$=nr.ClassifierJobOutStatus$outboundSchema=nr.ClassifierJobOutStatus$inboundSchema=nr.ClassifierJobOutJobType=nr.ClassifierJobOutObject=nr.ClassifierJobOutStatus=void 0;nr.classifierJobOutIntegrationsToJSON=fOo;nr.classifierJobOutIntegrationsFromJSON=pOo;nr.classifierJobOutToJSON=mOo;nr.classifierJobOutFromJSON=hOo;var Wo=dOo(ae()),eEr=ce(),tEr=te(),rEr=pRe(),nEr=u7(),yRe=l7();nr.ClassifierJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};nr.ClassifierJobOutObject={Job:"job"};nr.ClassifierJobOutJobType={Classifier:"classifier"};nr.ClassifierJobOutStatus$inboundSchema=Wo.nativeEnum(nr.ClassifierJobOutStatus);nr.ClassifierJobOutStatus$outboundSchema=nr.ClassifierJobOutStatus$inboundSchema;var GOr;(function(t){t.inboundSchema=nr.ClassifierJobOutStatus$inboundSchema,t.outboundSchema=nr.ClassifierJobOutStatus$outboundSchema})(GOr||(nr.ClassifierJobOutStatus$=GOr={}));nr.ClassifierJobOutObject$inboundSchema=Wo.nativeEnum(nr.ClassifierJobOutObject);nr.ClassifierJobOutObject$outboundSchema=nr.ClassifierJobOutObject$inboundSchema;var XOr;(function(t){t.inboundSchema=nr.ClassifierJobOutObject$inboundSchema,t.outboundSchema=nr.ClassifierJobOutObject$outboundSchema})(XOr||(nr.ClassifierJobOutObject$=XOr={}));nr.ClassifierJobOutIntegrations$inboundSchema=yRe.WandbIntegrationOut$inboundSchema;nr.ClassifierJobOutIntegrations$outboundSchema=yRe.WandbIntegrationOut$outboundSchema;var ZOr;(function(t){t.inboundSchema=nr.ClassifierJobOutIntegrations$inboundSchema,t.outboundSchema=nr.ClassifierJobOutIntegrations$outboundSchema})(ZOr||(nr.ClassifierJobOutIntegrations$=ZOr={}));function fOo(t){return JSON.stringify(nr.ClassifierJobOutIntegrations$outboundSchema.parse(t))}function pOo(t){return(0,tEr.safeParse)(t,e=>nr.ClassifierJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierJobOutIntegrations' from JSON")}nr.ClassifierJobOutJobType$inboundSchema=Wo.nativeEnum(nr.ClassifierJobOutJobType);nr.ClassifierJobOutJobType$outboundSchema=nr.ClassifierJobOutJobType$inboundSchema;var YOr;(function(t){t.inboundSchema=nr.ClassifierJobOutJobType$inboundSchema,t.outboundSchema=nr.ClassifierJobOutJobType$outboundSchema})(YOr||(nr.ClassifierJobOutJobType$=YOr={}));nr.ClassifierJobOut$inboundSchema=Wo.object({id:Wo.string(),auto_start:Wo.boolean(),model:Wo.string(),status:nr.ClassifierJobOutStatus$inboundSchema,created_at:Wo.number().int(),modified_at:Wo.number().int(),training_files:Wo.array(Wo.string()),validation_files:Wo.nullable(Wo.array(Wo.string())).optional(),object:nr.ClassifierJobOutObject$inboundSchema.default("job"),fine_tuned_model:Wo.nullable(Wo.string()).optional(),suffix:Wo.nullable(Wo.string()).optional(),integrations:Wo.nullable(Wo.array(yRe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Wo.nullable(Wo.number().int()).optional(),metadata:Wo.nullable(nEr.JobMetadataOut$inboundSchema).optional(),job_type:nr.ClassifierJobOutJobType$inboundSchema.default("classifier"),hyperparameters:rEr.ClassifierTrainingParameters$inboundSchema}).transform(t=>(0,eEr.remap)(t,{auto_start:"autoStart",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens",job_type:"jobType"}));nr.ClassifierJobOut$outboundSchema=Wo.object({id:Wo.string(),autoStart:Wo.boolean(),model:Wo.string(),status:nr.ClassifierJobOutStatus$outboundSchema,createdAt:Wo.number().int(),modifiedAt:Wo.number().int(),trainingFiles:Wo.array(Wo.string()),validationFiles:Wo.nullable(Wo.array(Wo.string())).optional(),object:nr.ClassifierJobOutObject$outboundSchema.default("job"),fineTunedModel:Wo.nullable(Wo.string()).optional(),suffix:Wo.nullable(Wo.string()).optional(),integrations:Wo.nullable(Wo.array(yRe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Wo.nullable(Wo.number().int()).optional(),metadata:Wo.nullable(nEr.JobMetadataOut$outboundSchema).optional(),jobType:nr.ClassifierJobOutJobType$outboundSchema.default("classifier"),hyperparameters:rEr.ClassifierTrainingParameters$outboundSchema}).transform(t=>(0,eEr.remap)(t,{autoStart:"auto_start",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens",jobType:"job_type"}));var QOr;(function(t){t.inboundSchema=nr.ClassifierJobOut$inboundSchema,t.outboundSchema=nr.ClassifierJobOut$outboundSchema})(QOr||(nr.ClassifierJobOut$=QOr={}));function mOo(t){return JSON.stringify(nr.ClassifierJobOut$outboundSchema.parse(t))}function hOo(t){return(0,tEr.safeParse)(t,e=>nr.ClassifierJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierJobOut' from JSON")}});var Wlt=S(Sf=>{"use strict";var gOo=Sf&&Sf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yOo=Sf&&Sf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bOo=Sf&&Sf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gOo(r,e,n[o]);return yOo(r,e),r}}();Object.defineProperty(Sf,"__esModule",{value:!0});Sf.ClassifierTargetIn$=Sf.ClassifierTargetIn$outboundSchema=Sf.ClassifierTargetIn$inboundSchema=void 0;Sf.classifierTargetInToJSON=vOo;Sf.classifierTargetInFromJSON=wOo;var N0=bOo(ae()),iEr=ce(),_Oo=te(),aEr=dRe();Sf.ClassifierTargetIn$inboundSchema=N0.object({name:N0.string(),labels:N0.array(N0.string()),weight:N0.number().default(1),loss_function:N0.nullable(aEr.FTClassifierLossFunction$inboundSchema).optional()}).transform(t=>(0,iEr.remap)(t,{loss_function:"lossFunction"}));Sf.ClassifierTargetIn$outboundSchema=N0.object({name:N0.string(),labels:N0.array(N0.string()),weight:N0.number().default(1),lossFunction:N0.nullable(aEr.FTClassifierLossFunction$outboundSchema).optional()}).transform(t=>(0,iEr.remap)(t,{lossFunction:"loss_function"}));var oEr;(function(t){t.inboundSchema=Sf.ClassifierTargetIn$inboundSchema,t.outboundSchema=Sf.ClassifierTargetIn$outboundSchema})(oEr||(Sf.ClassifierTargetIn$=oEr={}));function vOo(t){return JSON.stringify(Sf.ClassifierTargetIn$outboundSchema.parse(t))}function wOo(t){return(0,_Oo.safeParse)(t,e=>Sf.ClassifierTargetIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTargetIn' from JSON")}});var Jlt=S(Cf=>{"use strict";var SOo=Cf&&Cf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),COo=Cf&&Cf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xOo=Cf&&Cf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&SOo(r,e,n[o]);return COo(r,e),r}}();Object.defineProperty(Cf,"__esModule",{value:!0});Cf.ClassifierTrainingParametersIn$=Cf.ClassifierTrainingParametersIn$outboundSchema=Cf.ClassifierTrainingParametersIn$inboundSchema=void 0;Cf.classifierTrainingParametersInToJSON=OOo;Cf.classifierTrainingParametersInFromJSON=EOo;var nc=xOo(ae()),uEr=ce(),TOo=te();Cf.ClassifierTrainingParametersIn$inboundSchema=nc.object({training_steps:nc.nullable(nc.number().int()).optional(),learning_rate:nc.number().default(1e-4),weight_decay:nc.nullable(nc.number()).optional(),warmup_fraction:nc.nullable(nc.number()).optional(),epochs:nc.nullable(nc.number()).optional(),seq_len:nc.nullable(nc.number().int()).optional()}).transform(t=>(0,uEr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen"}));Cf.ClassifierTrainingParametersIn$outboundSchema=nc.object({trainingSteps:nc.nullable(nc.number().int()).optional(),learningRate:nc.number().default(1e-4),weightDecay:nc.nullable(nc.number()).optional(),warmupFraction:nc.nullable(nc.number()).optional(),epochs:nc.nullable(nc.number()).optional(),seqLen:nc.nullable(nc.number().int()).optional()}).transform(t=>(0,uEr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len"}));var sEr;(function(t){t.inboundSchema=Cf.ClassifierTrainingParametersIn$inboundSchema,t.outboundSchema=Cf.ClassifierTrainingParametersIn$outboundSchema})(sEr||(Cf.ClassifierTrainingParametersIn$=sEr={}));function OOo(t){return JSON.stringify(Cf.ClassifierTrainingParametersIn$outboundSchema.parse(t))}function EOo(t){return(0,TOo.safeParse)(t,e=>Cf.ClassifierTrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTrainingParametersIn' from JSON")}});var Klt=S(_s=>{"use strict";var POo=_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]}),MOo=_s&&_s.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ROo=_s&&_s.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&POo(r,e,n[o]);return MOo(r,e),r}}();Object.defineProperty(_s,"__esModule",{value:!0});_s.DeltaMessage$=_s.DeltaMessage$outboundSchema=_s.DeltaMessage$inboundSchema=_s.Content$=_s.Content$outboundSchema=_s.Content$inboundSchema=void 0;_s.contentToJSON=IOo;_s.contentFromJSON=AOo;_s.deltaMessageToJSON=NOo;_s.deltaMessageFromJSON=DOo;var oc=ROo(ae()),dEr=ce(),fEr=te(),bRe=e7(),pEr=cMe();_s.Content$inboundSchema=oc.union([oc.string(),oc.array(bRe.ContentChunk$inboundSchema)]);_s.Content$outboundSchema=oc.union([oc.string(),oc.array(bRe.ContentChunk$outboundSchema)]);var lEr;(function(t){t.inboundSchema=_s.Content$inboundSchema,t.outboundSchema=_s.Content$outboundSchema})(lEr||(_s.Content$=lEr={}));function IOo(t){return JSON.stringify(_s.Content$outboundSchema.parse(t))}function AOo(t){return(0,fEr.safeParse)(t,e=>_s.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}_s.DeltaMessage$inboundSchema=oc.object({role:oc.nullable(oc.string()).optional(),content:oc.nullable(oc.union([oc.string(),oc.array(bRe.ContentChunk$inboundSchema)])).optional(),tool_calls:oc.nullable(oc.array(pEr.ToolCall$inboundSchema)).optional()}).transform(t=>(0,dEr.remap)(t,{tool_calls:"toolCalls"}));_s.DeltaMessage$outboundSchema=oc.object({role:oc.nullable(oc.string()).optional(),content:oc.nullable(oc.union([oc.string(),oc.array(bRe.ContentChunk$outboundSchema)])).optional(),toolCalls:oc.nullable(oc.array(pEr.ToolCall$outboundSchema)).optional()}).transform(t=>(0,dEr.remap)(t,{toolCalls:"tool_calls"}));var cEr;(function(t){t.inboundSchema=_s.DeltaMessage$inboundSchema,t.outboundSchema=_s.DeltaMessage$outboundSchema})(cEr||(_s.DeltaMessage$=cEr={}));function NOo(t){return JSON.stringify(_s.DeltaMessage$outboundSchema.parse(t))}function DOo(t){return(0,fEr.safeParse)(t,e=>_s.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var Glt=S(Oa=>{"use strict";var jOo=Oa&&Oa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Oo=Oa&&Oa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LOo=Oa&&Oa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jOo(r,e,n[o]);return $Oo(r,e),r}}();Object.defineProperty(Oa,"__esModule",{value:!0});Oa.CompletionResponseStreamChoice$=Oa.CompletionResponseStreamChoice$outboundSchema=Oa.CompletionResponseStreamChoice$inboundSchema=Oa.CompletionResponseStreamChoiceFinishReason$=Oa.CompletionResponseStreamChoiceFinishReason$outboundSchema=Oa.CompletionResponseStreamChoiceFinishReason$inboundSchema=Oa.CompletionResponseStreamChoiceFinishReason=void 0;Oa.completionResponseStreamChoiceToJSON=qOo;Oa.completionResponseStreamChoiceFromJSON=BOo;var Fw=LOo(ae()),gEr=ce(),FOo=te(),kOo=kx(),yEr=Klt();Oa.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};Oa.CompletionResponseStreamChoiceFinishReason$inboundSchema=Fw.union([Fw.nativeEnum(Oa.CompletionResponseStreamChoiceFinishReason),Fw.string().transform(kOo.catchUnrecognizedEnum)]);Oa.CompletionResponseStreamChoiceFinishReason$outboundSchema=Fw.union([Fw.nativeEnum(Oa.CompletionResponseStreamChoiceFinishReason),Fw.string().and(Fw.custom())]);var mEr;(function(t){t.inboundSchema=Oa.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=Oa.CompletionResponseStreamChoiceFinishReason$outboundSchema})(mEr||(Oa.CompletionResponseStreamChoiceFinishReason$=mEr={}));Oa.CompletionResponseStreamChoice$inboundSchema=Fw.object({index:Fw.number().int(),delta:yEr.DeltaMessage$inboundSchema,finish_reason:Fw.nullable(Oa.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,gEr.remap)(t,{finish_reason:"finishReason"}));Oa.CompletionResponseStreamChoice$outboundSchema=Fw.object({index:Fw.number().int(),delta:yEr.DeltaMessage$outboundSchema,finishReason:Fw.nullable(Oa.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,gEr.remap)(t,{finishReason:"finish_reason"}));var hEr;(function(t){t.inboundSchema=Oa.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=Oa.CompletionResponseStreamChoice$outboundSchema})(hEr||(Oa.CompletionResponseStreamChoice$=hEr={}));function qOo(t){return JSON.stringify(Oa.CompletionResponseStreamChoice$outboundSchema.parse(t))}function BOo(t){return(0,FOo.safeParse)(t,e=>Oa.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var Xlt=S(xf=>{"use strict";var UOo=xf&&xf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zOo=xf&&xf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VOo=xf&&xf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&UOo(r,e,n[o]);return zOo(r,e),r}}();Object.defineProperty(xf,"__esModule",{value:!0});xf.CompletionChunk$=xf.CompletionChunk$outboundSchema=xf.CompletionChunk$inboundSchema=void 0;xf.completionChunkToJSON=WOo;xf.completionChunkFromJSON=JOo;var D0=VOo(ae()),HOo=te(),_Er=Glt(),vEr=Wq();xf.CompletionChunk$inboundSchema=D0.object({id:D0.string(),object:D0.string().optional(),created:D0.number().int().optional(),model:D0.string(),usage:vEr.UsageInfo$inboundSchema.optional(),choices:D0.array(_Er.CompletionResponseStreamChoice$inboundSchema)});xf.CompletionChunk$outboundSchema=D0.object({id:D0.string(),object:D0.string().optional(),created:D0.number().int().optional(),model:D0.string(),usage:vEr.UsageInfo$outboundSchema.optional(),choices:D0.array(_Er.CompletionResponseStreamChoice$outboundSchema)});var bEr;(function(t){t.inboundSchema=xf.CompletionChunk$inboundSchema,t.outboundSchema=xf.CompletionChunk$outboundSchema})(bEr||(xf.CompletionChunk$=bEr={}));function WOo(t){return JSON.stringify(xf.CompletionChunk$outboundSchema.parse(t))}function JOo(t){return(0,HOo.safeParse)(t,e=>xf.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var _Re=S(Tf=>{"use strict";var KOo=Tf&&Tf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GOo=Tf&&Tf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XOo=Tf&&Tf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&KOo(r,e,n[o]);return GOo(r,e),r}}();Object.defineProperty(Tf,"__esModule",{value:!0});Tf.CompletionTrainingParameters$=Tf.CompletionTrainingParameters$outboundSchema=Tf.CompletionTrainingParameters$inboundSchema=void 0;Tf.completionTrainingParametersToJSON=YOo;Tf.completionTrainingParametersFromJSON=QOo;var Su=XOo(ae()),SEr=ce(),ZOo=te();Tf.CompletionTrainingParameters$inboundSchema=Su.object({training_steps:Su.nullable(Su.number().int()).optional(),learning_rate:Su.number().default(1e-4),weight_decay:Su.nullable(Su.number()).optional(),warmup_fraction:Su.nullable(Su.number()).optional(),epochs:Su.nullable(Su.number()).optional(),seq_len:Su.nullable(Su.number().int()).optional(),fim_ratio:Su.nullable(Su.number()).optional()}).transform(t=>(0,SEr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen",fim_ratio:"fimRatio"}));Tf.CompletionTrainingParameters$outboundSchema=Su.object({trainingSteps:Su.nullable(Su.number().int()).optional(),learningRate:Su.number().default(1e-4),weightDecay:Su.nullable(Su.number()).optional(),warmupFraction:Su.nullable(Su.number()).optional(),epochs:Su.nullable(Su.number()).optional(),seqLen:Su.nullable(Su.number().int()).optional(),fimRatio:Su.nullable(Su.number()).optional()}).transform(t=>(0,SEr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len",fimRatio:"fim_ratio"}));var wEr;(function(t){t.inboundSchema=Tf.CompletionTrainingParameters$inboundSchema,t.outboundSchema=Tf.CompletionTrainingParameters$outboundSchema})(wEr||(Tf.CompletionTrainingParameters$=wEr={}));function YOo(t){return JSON.stringify(Tf.CompletionTrainingParameters$outboundSchema.parse(t))}function QOo(t){return(0,ZOo.safeParse)(t,e=>Tf.CompletionTrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionTrainingParameters' from JSON")}});var vRe=S(Ea=>{"use strict";var eEo=Ea&&Ea.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tEo=Ea&&Ea.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rEo=Ea&&Ea.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eEo(r,e,n[o]);return tEo(r,e),r}}();Object.defineProperty(Ea,"__esModule",{value:!0});Ea.GithubRepositoryOut$=Ea.GithubRepositoryOut$outboundSchema=Ea.GithubRepositoryOut$inboundSchema=Ea.GithubRepositoryOutType$=Ea.GithubRepositoryOutType$outboundSchema=Ea.GithubRepositoryOutType$inboundSchema=Ea.GithubRepositoryOutType=void 0;Ea.githubRepositoryOutToJSON=oEo;Ea.githubRepositoryOutFromJSON=iEo;var Gb=rEo(ae()),TEr=ce(),nEo=te();Ea.GithubRepositoryOutType={Github:"github"};Ea.GithubRepositoryOutType$inboundSchema=Gb.nativeEnum(Ea.GithubRepositoryOutType);Ea.GithubRepositoryOutType$outboundSchema=Ea.GithubRepositoryOutType$inboundSchema;var CEr;(function(t){t.inboundSchema=Ea.GithubRepositoryOutType$inboundSchema,t.outboundSchema=Ea.GithubRepositoryOutType$outboundSchema})(CEr||(Ea.GithubRepositoryOutType$=CEr={}));Ea.GithubRepositoryOut$inboundSchema=Gb.object({type:Ea.GithubRepositoryOutType$inboundSchema.default("github"),name:Gb.string(),owner:Gb.string(),ref:Gb.nullable(Gb.string()).optional(),weight:Gb.number().default(1),commit_id:Gb.string()}).transform(t=>(0,TEr.remap)(t,{commit_id:"commitId"}));Ea.GithubRepositoryOut$outboundSchema=Gb.object({type:Ea.GithubRepositoryOutType$outboundSchema.default("github"),name:Gb.string(),owner:Gb.string(),ref:Gb.nullable(Gb.string()).optional(),weight:Gb.number().default(1),commitId:Gb.string()}).transform(t=>(0,TEr.remap)(t,{commitId:"commit_id"}));var xEr;(function(t){t.inboundSchema=Ea.GithubRepositoryOut$inboundSchema,t.outboundSchema=Ea.GithubRepositoryOut$outboundSchema})(xEr||(Ea.GithubRepositoryOut$=xEr={}));function oEo(t){return JSON.stringify(Ea.GithubRepositoryOut$outboundSchema.parse(t))}function iEo(t){return(0,nEo.safeParse)(t,e=>Ea.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var LEr=S(Tt=>{"use strict";var aEo=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]}),sEo=Tt&&Tt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uEo=Tt&&Tt.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aEo(r,e,n[o]);return sEo(r,e),r}}();Object.defineProperty(Tt,"__esModule",{value:!0});Tt.CompletionDetailedJobOut$=Tt.CompletionDetailedJobOut$outboundSchema=Tt.CompletionDetailedJobOut$inboundSchema=Tt.CompletionDetailedJobOutRepositories$=Tt.CompletionDetailedJobOutRepositories$outboundSchema=Tt.CompletionDetailedJobOutRepositories$inboundSchema=Tt.CompletionDetailedJobOutJobType$=Tt.CompletionDetailedJobOutJobType$outboundSchema=Tt.CompletionDetailedJobOutJobType$inboundSchema=Tt.CompletionDetailedJobOutIntegrations$=Tt.CompletionDetailedJobOutIntegrations$outboundSchema=Tt.CompletionDetailedJobOutIntegrations$inboundSchema=Tt.CompletionDetailedJobOutObject$=Tt.CompletionDetailedJobOutObject$outboundSchema=Tt.CompletionDetailedJobOutObject$inboundSchema=Tt.CompletionDetailedJobOutStatus$=Tt.CompletionDetailedJobOutStatus$outboundSchema=Tt.CompletionDetailedJobOutStatus$inboundSchema=Tt.CompletionDetailedJobOutJobType=Tt.CompletionDetailedJobOutObject=Tt.CompletionDetailedJobOutStatus=void 0;Tt.completionDetailedJobOutIntegrationsToJSON=lEo;Tt.completionDetailedJobOutIntegrationsFromJSON=cEo;Tt.completionDetailedJobOutRepositoriesToJSON=dEo;Tt.completionDetailedJobOutRepositoriesFromJSON=fEo;Tt.completionDetailedJobOutToJSON=pEo;Tt.completionDetailedJobOutFromJSON=mEo;var Un=uEo(ae()),AEr=ce(),Zlt=te(),NEr=cRe(),DEr=_Re(),jEr=mRe(),wRe=vRe(),$Er=u7(),SRe=l7();Tt.CompletionDetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Tt.CompletionDetailedJobOutObject={Job:"job"};Tt.CompletionDetailedJobOutJobType={Completion:"completion"};Tt.CompletionDetailedJobOutStatus$inboundSchema=Un.nativeEnum(Tt.CompletionDetailedJobOutStatus);Tt.CompletionDetailedJobOutStatus$outboundSchema=Tt.CompletionDetailedJobOutStatus$inboundSchema;var OEr;(function(t){t.inboundSchema=Tt.CompletionDetailedJobOutStatus$inboundSchema,t.outboundSchema=Tt.CompletionDetailedJobOutStatus$outboundSchema})(OEr||(Tt.CompletionDetailedJobOutStatus$=OEr={}));Tt.CompletionDetailedJobOutObject$inboundSchema=Un.nativeEnum(Tt.CompletionDetailedJobOutObject);Tt.CompletionDetailedJobOutObject$outboundSchema=Tt.CompletionDetailedJobOutObject$inboundSchema;var EEr;(function(t){t.inboundSchema=Tt.CompletionDetailedJobOutObject$inboundSchema,t.outboundSchema=Tt.CompletionDetailedJobOutObject$outboundSchema})(EEr||(Tt.CompletionDetailedJobOutObject$=EEr={}));Tt.CompletionDetailedJobOutIntegrations$inboundSchema=SRe.WandbIntegrationOut$inboundSchema;Tt.CompletionDetailedJobOutIntegrations$outboundSchema=SRe.WandbIntegrationOut$outboundSchema;var PEr;(function(t){t.inboundSchema=Tt.CompletionDetailedJobOutIntegrations$inboundSchema,t.outboundSchema=Tt.CompletionDetailedJobOutIntegrations$outboundSchema})(PEr||(Tt.CompletionDetailedJobOutIntegrations$=PEr={}));function lEo(t){return JSON.stringify(Tt.CompletionDetailedJobOutIntegrations$outboundSchema.parse(t))}function cEo(t){return(0,Zlt.safeParse)(t,e=>Tt.CompletionDetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionDetailedJobOutIntegrations' from JSON")}Tt.CompletionDetailedJobOutJobType$inboundSchema=Un.nativeEnum(Tt.CompletionDetailedJobOutJobType);Tt.CompletionDetailedJobOutJobType$outboundSchema=Tt.CompletionDetailedJobOutJobType$inboundSchema;var MEr;(function(t){t.inboundSchema=Tt.CompletionDetailedJobOutJobType$inboundSchema,t.outboundSchema=Tt.CompletionDetailedJobOutJobType$outboundSchema})(MEr||(Tt.CompletionDetailedJobOutJobType$=MEr={}));Tt.CompletionDetailedJobOutRepositories$inboundSchema=wRe.GithubRepositoryOut$inboundSchema;Tt.CompletionDetailedJobOutRepositories$outboundSchema=wRe.GithubRepositoryOut$outboundSchema;var REr;(function(t){t.inboundSchema=Tt.CompletionDetailedJobOutRepositories$inboundSchema,t.outboundSchema=Tt.CompletionDetailedJobOutRepositories$outboundSchema})(REr||(Tt.CompletionDetailedJobOutRepositories$=REr={}));function dEo(t){return JSON.stringify(Tt.CompletionDetailedJobOutRepositories$outboundSchema.parse(t))}function fEo(t){return(0,Zlt.safeParse)(t,e=>Tt.CompletionDetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionDetailedJobOutRepositories' from JSON")}Tt.CompletionDetailedJobOut$inboundSchema=Un.object({id:Un.string(),auto_start:Un.boolean(),model:Un.string(),status:Tt.CompletionDetailedJobOutStatus$inboundSchema,created_at:Un.number().int(),modified_at:Un.number().int(),training_files:Un.array(Un.string()),validation_files:Un.nullable(Un.array(Un.string())).optional(),object:Tt.CompletionDetailedJobOutObject$inboundSchema.default("job"),fine_tuned_model:Un.nullable(Un.string()).optional(),suffix:Un.nullable(Un.string()).optional(),integrations:Un.nullable(Un.array(SRe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Un.nullable(Un.number().int()).optional(),metadata:Un.nullable($Er.JobMetadataOut$inboundSchema).optional(),job_type:Tt.CompletionDetailedJobOutJobType$inboundSchema.default("completion"),hyperparameters:DEr.CompletionTrainingParameters$inboundSchema,repositories:Un.array(wRe.GithubRepositoryOut$inboundSchema).optional(),events:Un.array(jEr.EventOut$inboundSchema).optional(),checkpoints:Un.array(NEr.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,AEr.remap)(t,{auto_start:"autoStart",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens",job_type:"jobType"}));Tt.CompletionDetailedJobOut$outboundSchema=Un.object({id:Un.string(),autoStart:Un.boolean(),model:Un.string(),status:Tt.CompletionDetailedJobOutStatus$outboundSchema,createdAt:Un.number().int(),modifiedAt:Un.number().int(),trainingFiles:Un.array(Un.string()),validationFiles:Un.nullable(Un.array(Un.string())).optional(),object:Tt.CompletionDetailedJobOutObject$outboundSchema.default("job"),fineTunedModel:Un.nullable(Un.string()).optional(),suffix:Un.nullable(Un.string()).optional(),integrations:Un.nullable(Un.array(SRe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Un.nullable(Un.number().int()).optional(),metadata:Un.nullable($Er.JobMetadataOut$outboundSchema).optional(),jobType:Tt.CompletionDetailedJobOutJobType$outboundSchema.default("completion"),hyperparameters:DEr.CompletionTrainingParameters$outboundSchema,repositories:Un.array(wRe.GithubRepositoryOut$outboundSchema).optional(),events:Un.array(jEr.EventOut$outboundSchema).optional(),checkpoints:Un.array(NEr.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,AEr.remap)(t,{autoStart:"auto_start",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens",jobType:"job_type"}));var IEr;(function(t){t.inboundSchema=Tt.CompletionDetailedJobOut$inboundSchema,t.outboundSchema=Tt.CompletionDetailedJobOut$outboundSchema})(IEr||(Tt.CompletionDetailedJobOut$=IEr={}));function pEo(t){return JSON.stringify(Tt.CompletionDetailedJobOut$outboundSchema.parse(t))}function mEo(t){return(0,Zlt.safeParse)(t,e=>Tt.CompletionDetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionDetailedJobOut' from JSON")}});var qEr=S(Of=>{"use strict";var hEo=Of&&Of.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gEo=Of&&Of.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yEo=Of&&Of.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hEo(r,e,n[o]);return gEo(r,e),r}}();Object.defineProperty(Of,"__esModule",{value:!0});Of.CompletionEvent$=Of.CompletionEvent$outboundSchema=Of.CompletionEvent$inboundSchema=void 0;Of.completionEventToJSON=_Eo;Of.completionEventFromJSON=vEo;var pse=yEo(ae()),bEo=te(),kEr=Xlt();Of.CompletionEvent$inboundSchema=pse.object({data:pse.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:pse.ZodIssueCode.custom,message:`malformed json: ${r}`}),pse.NEVER}}).pipe(kEr.CompletionChunk$inboundSchema)});Of.CompletionEvent$outboundSchema=pse.object({data:kEr.CompletionChunk$outboundSchema});var FEr;(function(t){t.inboundSchema=Of.CompletionEvent$inboundSchema,t.outboundSchema=Of.CompletionEvent$outboundSchema})(FEr||(Of.CompletionEvent$=FEr={}));function _Eo(t){return JSON.stringify(Of.CompletionEvent$outboundSchema.parse(t))}function vEo(t){return(0,bEo.safeParse)(t,e=>Of.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var WEr=S(Gn=>{"use strict";var wEo=Gn&&Gn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SEo=Gn&&Gn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CEo=Gn&&Gn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wEo(r,e,n[o]);return SEo(r,e),r}}();Object.defineProperty(Gn,"__esModule",{value:!0});Gn.CompletionFTModelOut$=Gn.CompletionFTModelOut$outboundSchema=Gn.CompletionFTModelOut$inboundSchema=Gn.ModelType$=Gn.ModelType$outboundSchema=Gn.ModelType$inboundSchema=Gn.CompletionFTModelOutObject$=Gn.CompletionFTModelOutObject$outboundSchema=Gn.CompletionFTModelOutObject$inboundSchema=Gn.ModelType=Gn.CompletionFTModelOutObject=void 0;Gn.completionFTModelOutToJSON=TEo;Gn.completionFTModelOutFromJSON=OEo;var Pa=CEo(ae()),VEr=ce(),xEo=te(),HEr=gRe();Gn.CompletionFTModelOutObject={Model:"model"};Gn.ModelType={Completion:"completion"};Gn.CompletionFTModelOutObject$inboundSchema=Pa.nativeEnum(Gn.CompletionFTModelOutObject);Gn.CompletionFTModelOutObject$outboundSchema=Gn.CompletionFTModelOutObject$inboundSchema;var BEr;(function(t){t.inboundSchema=Gn.CompletionFTModelOutObject$inboundSchema,t.outboundSchema=Gn.CompletionFTModelOutObject$outboundSchema})(BEr||(Gn.CompletionFTModelOutObject$=BEr={}));Gn.ModelType$inboundSchema=Pa.nativeEnum(Gn.ModelType);Gn.ModelType$outboundSchema=Gn.ModelType$inboundSchema;var UEr;(function(t){t.inboundSchema=Gn.ModelType$inboundSchema,t.outboundSchema=Gn.ModelType$outboundSchema})(UEr||(Gn.ModelType$=UEr={}));Gn.CompletionFTModelOut$inboundSchema=Pa.object({id:Pa.string(),object:Gn.CompletionFTModelOutObject$inboundSchema.default("model"),created:Pa.number().int(),owned_by:Pa.string(),workspace_id:Pa.string(),root:Pa.string(),root_version:Pa.string(),archived:Pa.boolean(),name:Pa.nullable(Pa.string()).optional(),description:Pa.nullable(Pa.string()).optional(),capabilities:HEr.FTModelCapabilitiesOut$inboundSchema,max_context_length:Pa.number().int().default(32768),aliases:Pa.array(Pa.string()).optional(),job:Pa.string(),model_type:Gn.ModelType$inboundSchema.default("completion")}).transform(t=>(0,VEr.remap)(t,{owned_by:"ownedBy",workspace_id:"workspaceId",root_version:"rootVersion",max_context_length:"maxContextLength",model_type:"modelType"}));Gn.CompletionFTModelOut$outboundSchema=Pa.object({id:Pa.string(),object:Gn.CompletionFTModelOutObject$outboundSchema.default("model"),created:Pa.number().int(),ownedBy:Pa.string(),workspaceId:Pa.string(),root:Pa.string(),rootVersion:Pa.string(),archived:Pa.boolean(),name:Pa.nullable(Pa.string()).optional(),description:Pa.nullable(Pa.string()).optional(),capabilities:HEr.FTModelCapabilitiesOut$outboundSchema,maxContextLength:Pa.number().int().default(32768),aliases:Pa.array(Pa.string()).optional(),job:Pa.string(),modelType:Gn.ModelType$outboundSchema.default("completion")}).transform(t=>(0,VEr.remap)(t,{ownedBy:"owned_by",workspaceId:"workspace_id",rootVersion:"root_version",maxContextLength:"max_context_length",modelType:"model_type"}));var zEr;(function(t){t.inboundSchema=Gn.CompletionFTModelOut$inboundSchema,t.outboundSchema=Gn.CompletionFTModelOut$outboundSchema})(zEr||(Gn.CompletionFTModelOut$=zEr={}));function TEo(t){return JSON.stringify(Gn.CompletionFTModelOut$outboundSchema.parse(t))}function OEo(t){return(0,xEo.safeParse)(t,e=>Gn.CompletionFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionFTModelOut' from JSON")}});var Qlt=S(Ot=>{"use strict";var EEo=Ot&&Ot.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PEo=Ot&&Ot.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MEo=Ot&&Ot.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&EEo(r,e,n[o]);return PEo(r,e),r}}();Object.defineProperty(Ot,"__esModule",{value:!0});Ot.CompletionJobOut$=Ot.CompletionJobOut$outboundSchema=Ot.CompletionJobOut$inboundSchema=Ot.Repositories$=Ot.Repositories$outboundSchema=Ot.Repositories$inboundSchema=Ot.JobType$=Ot.JobType$outboundSchema=Ot.JobType$inboundSchema=Ot.Integrations$=Ot.Integrations$outboundSchema=Ot.Integrations$inboundSchema=Ot.CompletionJobOutObject$=Ot.CompletionJobOutObject$outboundSchema=Ot.CompletionJobOutObject$inboundSchema=Ot.Status$=Ot.Status$outboundSchema=Ot.Status$inboundSchema=Ot.JobType=Ot.CompletionJobOutObject=Ot.Status=void 0;Ot.integrationsToJSON=REo;Ot.integrationsFromJSON=IEo;Ot.repositoriesToJSON=AEo;Ot.repositoriesFromJSON=NEo;Ot.completionJobOutToJSON=DEo;Ot.completionJobOutFromJSON=jEo;var Lo=MEo(ae()),QEr=ce(),Ylt=te(),ePr=_Re(),CRe=vRe(),tPr=u7(),xRe=l7();Ot.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Ot.CompletionJobOutObject={Job:"job"};Ot.JobType={Completion:"completion"};Ot.Status$inboundSchema=Lo.nativeEnum(Ot.Status);Ot.Status$outboundSchema=Ot.Status$inboundSchema;var JEr;(function(t){t.inboundSchema=Ot.Status$inboundSchema,t.outboundSchema=Ot.Status$outboundSchema})(JEr||(Ot.Status$=JEr={}));Ot.CompletionJobOutObject$inboundSchema=Lo.nativeEnum(Ot.CompletionJobOutObject);Ot.CompletionJobOutObject$outboundSchema=Ot.CompletionJobOutObject$inboundSchema;var KEr;(function(t){t.inboundSchema=Ot.CompletionJobOutObject$inboundSchema,t.outboundSchema=Ot.CompletionJobOutObject$outboundSchema})(KEr||(Ot.CompletionJobOutObject$=KEr={}));Ot.Integrations$inboundSchema=xRe.WandbIntegrationOut$inboundSchema;Ot.Integrations$outboundSchema=xRe.WandbIntegrationOut$outboundSchema;var GEr;(function(t){t.inboundSchema=Ot.Integrations$inboundSchema,t.outboundSchema=Ot.Integrations$outboundSchema})(GEr||(Ot.Integrations$=GEr={}));function REo(t){return JSON.stringify(Ot.Integrations$outboundSchema.parse(t))}function IEo(t){return(0,Ylt.safeParse)(t,e=>Ot.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}Ot.JobType$inboundSchema=Lo.nativeEnum(Ot.JobType);Ot.JobType$outboundSchema=Ot.JobType$inboundSchema;var XEr;(function(t){t.inboundSchema=Ot.JobType$inboundSchema,t.outboundSchema=Ot.JobType$outboundSchema})(XEr||(Ot.JobType$=XEr={}));Ot.Repositories$inboundSchema=CRe.GithubRepositoryOut$inboundSchema;Ot.Repositories$outboundSchema=CRe.GithubRepositoryOut$outboundSchema;var ZEr;(function(t){t.inboundSchema=Ot.Repositories$inboundSchema,t.outboundSchema=Ot.Repositories$outboundSchema})(ZEr||(Ot.Repositories$=ZEr={}));function AEo(t){return JSON.stringify(Ot.Repositories$outboundSchema.parse(t))}function NEo(t){return(0,Ylt.safeParse)(t,e=>Ot.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}Ot.CompletionJobOut$inboundSchema=Lo.object({id:Lo.string(),auto_start:Lo.boolean(),model:Lo.string(),status:Ot.Status$inboundSchema,created_at:Lo.number().int(),modified_at:Lo.number().int(),training_files:Lo.array(Lo.string()),validation_files:Lo.nullable(Lo.array(Lo.string())).optional(),object:Ot.CompletionJobOutObject$inboundSchema.default("job"),fine_tuned_model:Lo.nullable(Lo.string()).optional(),suffix:Lo.nullable(Lo.string()).optional(),integrations:Lo.nullable(Lo.array(xRe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Lo.nullable(Lo.number().int()).optional(),metadata:Lo.nullable(tPr.JobMetadataOut$inboundSchema).optional(),job_type:Ot.JobType$inboundSchema.default("completion"),hyperparameters:ePr.CompletionTrainingParameters$inboundSchema,repositories:Lo.array(CRe.GithubRepositoryOut$inboundSchema).optional()}).transform(t=>(0,QEr.remap)(t,{auto_start:"autoStart",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens",job_type:"jobType"}));Ot.CompletionJobOut$outboundSchema=Lo.object({id:Lo.string(),autoStart:Lo.boolean(),model:Lo.string(),status:Ot.Status$outboundSchema,createdAt:Lo.number().int(),modifiedAt:Lo.number().int(),trainingFiles:Lo.array(Lo.string()),validationFiles:Lo.nullable(Lo.array(Lo.string())).optional(),object:Ot.CompletionJobOutObject$outboundSchema.default("job"),fineTunedModel:Lo.nullable(Lo.string()).optional(),suffix:Lo.nullable(Lo.string()).optional(),integrations:Lo.nullable(Lo.array(xRe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Lo.nullable(Lo.number().int()).optional(),metadata:Lo.nullable(tPr.JobMetadataOut$outboundSchema).optional(),jobType:Ot.JobType$outboundSchema.default("completion"),hyperparameters:ePr.CompletionTrainingParameters$outboundSchema,repositories:Lo.array(CRe.GithubRepositoryOut$outboundSchema).optional()}).transform(t=>(0,QEr.remap)(t,{autoStart:"auto_start",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens",jobType:"job_type"}));var YEr;(function(t){t.inboundSchema=Ot.CompletionJobOut$inboundSchema,t.outboundSchema=Ot.CompletionJobOut$outboundSchema})(YEr||(Ot.CompletionJobOut$=YEr={}));function DEo(t){return JSON.stringify(Ot.CompletionJobOut$outboundSchema.parse(t))}function jEo(t){return(0,Ylt.safeParse)(t,e=>Ot.CompletionJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionJobOut' from JSON")}});var ect=S(Ef=>{"use strict";var $Eo=Ef&&Ef.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LEo=Ef&&Ef.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FEo=Ef&&Ef.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$Eo(r,e,n[o]);return LEo(r,e),r}}();Object.defineProperty(Ef,"__esModule",{value:!0});Ef.CompletionTrainingParametersIn$=Ef.CompletionTrainingParametersIn$outboundSchema=Ef.CompletionTrainingParametersIn$inboundSchema=void 0;Ef.completionTrainingParametersInToJSON=qEo;Ef.completionTrainingParametersInFromJSON=BEo;var Cu=FEo(ae()),nPr=ce(),kEo=te();Ef.CompletionTrainingParametersIn$inboundSchema=Cu.object({training_steps:Cu.nullable(Cu.number().int()).optional(),learning_rate:Cu.number().default(1e-4),weight_decay:Cu.nullable(Cu.number()).optional(),warmup_fraction:Cu.nullable(Cu.number()).optional(),epochs:Cu.nullable(Cu.number()).optional(),seq_len:Cu.nullable(Cu.number().int()).optional(),fim_ratio:Cu.nullable(Cu.number()).optional()}).transform(t=>(0,nPr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen",fim_ratio:"fimRatio"}));Ef.CompletionTrainingParametersIn$outboundSchema=Cu.object({trainingSteps:Cu.nullable(Cu.number().int()).optional(),learningRate:Cu.number().default(1e-4),weightDecay:Cu.nullable(Cu.number()).optional(),warmupFraction:Cu.nullable(Cu.number()).optional(),epochs:Cu.nullable(Cu.number()).optional(),seqLen:Cu.nullable(Cu.number().int()).optional(),fimRatio:Cu.nullable(Cu.number()).optional()}).transform(t=>(0,nPr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len",fimRatio:"fim_ratio"}));var rPr;(function(t){t.inboundSchema=Ef.CompletionTrainingParametersIn$inboundSchema,t.outboundSchema=Ef.CompletionTrainingParametersIn$outboundSchema})(rPr||(Ef.CompletionTrainingParametersIn$=rPr={}));function qEo(t){return JSON.stringify(Ef.CompletionTrainingParametersIn$outboundSchema.parse(t))}function BEo(t){return(0,kEo.safeParse)(t,e=>Ef.CompletionTrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionTrainingParametersIn' from JSON")}});var tct=S(Pf=>{"use strict";var UEo=Pf&&Pf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zEo=Pf&&Pf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VEo=Pf&&Pf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&UEo(r,e,n[o]);return zEo(r,e),r}}();Object.defineProperty(Pf,"__esModule",{value:!0});Pf.FunctionCallEntryArguments$=Pf.FunctionCallEntryArguments$outboundSchema=Pf.FunctionCallEntryArguments$inboundSchema=void 0;Pf.functionCallEntryArgumentsToJSON=WEo;Pf.functionCallEntryArgumentsFromJSON=JEo;var Jq=VEo(ae()),HEo=te();Pf.FunctionCallEntryArguments$inboundSchema=Jq.union([Jq.record(Jq.any()),Jq.string()]);Pf.FunctionCallEntryArguments$outboundSchema=Jq.union([Jq.record(Jq.any()),Jq.string()]);var oPr;(function(t){t.inboundSchema=Pf.FunctionCallEntryArguments$inboundSchema,t.outboundSchema=Pf.FunctionCallEntryArguments$outboundSchema})(oPr||(Pf.FunctionCallEntryArguments$=oPr={}));function WEo(t){return JSON.stringify(Pf.FunctionCallEntryArguments$outboundSchema.parse(t))}function JEo(t){return(0,HEo.safeParse)(t,e=>Pf.FunctionCallEntryArguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCallEntryArguments' from JSON")}});var mse=S(Xn=>{"use strict";var KEo=Xn&&Xn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GEo=Xn&&Xn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XEo=Xn&&Xn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&KEo(r,e,n[o]);return GEo(r,e),r}}();Object.defineProperty(Xn,"__esModule",{value:!0});Xn.FunctionCallEntry$=Xn.FunctionCallEntry$outboundSchema=Xn.FunctionCallEntry$inboundSchema=Xn.FunctionCallEntryType$=Xn.FunctionCallEntryType$outboundSchema=Xn.FunctionCallEntryType$inboundSchema=Xn.FunctionCallEntryObject$=Xn.FunctionCallEntryObject$outboundSchema=Xn.FunctionCallEntryObject$inboundSchema=Xn.FunctionCallEntryType=Xn.FunctionCallEntryObject=void 0;Xn.functionCallEntryToJSON=YEo;Xn.functionCallEntryFromJSON=QEo;var Gy=XEo(ae()),uPr=ce(),ZEo=te(),lPr=tct();Xn.FunctionCallEntryObject={Entry:"entry"};Xn.FunctionCallEntryType={FunctionCall:"function.call"};Xn.FunctionCallEntryObject$inboundSchema=Gy.nativeEnum(Xn.FunctionCallEntryObject);Xn.FunctionCallEntryObject$outboundSchema=Xn.FunctionCallEntryObject$inboundSchema;var iPr;(function(t){t.inboundSchema=Xn.FunctionCallEntryObject$inboundSchema,t.outboundSchema=Xn.FunctionCallEntryObject$outboundSchema})(iPr||(Xn.FunctionCallEntryObject$=iPr={}));Xn.FunctionCallEntryType$inboundSchema=Gy.nativeEnum(Xn.FunctionCallEntryType);Xn.FunctionCallEntryType$outboundSchema=Xn.FunctionCallEntryType$inboundSchema;var aPr;(function(t){t.inboundSchema=Xn.FunctionCallEntryType$inboundSchema,t.outboundSchema=Xn.FunctionCallEntryType$outboundSchema})(aPr||(Xn.FunctionCallEntryType$=aPr={}));Xn.FunctionCallEntry$inboundSchema=Gy.object({object:Xn.FunctionCallEntryObject$inboundSchema.default("entry"),type:Xn.FunctionCallEntryType$inboundSchema.default("function.call"),created_at:Gy.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:Gy.nullable(Gy.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:Gy.string().optional(),tool_call_id:Gy.string(),name:Gy.string(),arguments:lPr.FunctionCallEntryArguments$inboundSchema}).transform(t=>(0,uPr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",tool_call_id:"toolCallId"}));Xn.FunctionCallEntry$outboundSchema=Gy.object({object:Xn.FunctionCallEntryObject$outboundSchema.default("entry"),type:Xn.FunctionCallEntryType$outboundSchema.default("function.call"),createdAt:Gy.date().transform(t=>t.toISOString()).optional(),completedAt:Gy.nullable(Gy.date().transform(t=>t.toISOString())).optional(),id:Gy.string().optional(),toolCallId:Gy.string(),name:Gy.string(),arguments:lPr.FunctionCallEntryArguments$outboundSchema}).transform(t=>(0,uPr.remap)(t,{createdAt:"created_at",completedAt:"completed_at",toolCallId:"tool_call_id"}));var sPr;(function(t){t.inboundSchema=Xn.FunctionCallEntry$inboundSchema,t.outboundSchema=Xn.FunctionCallEntry$outboundSchema})(sPr||(Xn.FunctionCallEntry$=sPr={}));function YEo(t){return JSON.stringify(Xn.FunctionCallEntry$outboundSchema.parse(t))}function QEo(t){return(0,ZEo.safeParse)(t,e=>Xn.FunctionCallEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCallEntry' from JSON")}});var TRe=S(Zn=>{"use strict";var ePo=Zn&&Zn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tPo=Zn&&Zn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rPo=Zn&&Zn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ePo(r,e,n[o]);return tPo(r,e),r}}();Object.defineProperty(Zn,"__esModule",{value:!0});Zn.FunctionResultEntry$=Zn.FunctionResultEntry$outboundSchema=Zn.FunctionResultEntry$inboundSchema=Zn.FunctionResultEntryType$=Zn.FunctionResultEntryType$outboundSchema=Zn.FunctionResultEntryType$inboundSchema=Zn.FunctionResultEntryObject$=Zn.FunctionResultEntryObject$outboundSchema=Zn.FunctionResultEntryObject$inboundSchema=Zn.FunctionResultEntryType=Zn.FunctionResultEntryObject=void 0;Zn.functionResultEntryToJSON=oPo;Zn.functionResultEntryFromJSON=iPo;var Xy=rPo(ae()),pPr=ce(),nPo=te();Zn.FunctionResultEntryObject={Entry:"entry"};Zn.FunctionResultEntryType={FunctionResult:"function.result"};Zn.FunctionResultEntryObject$inboundSchema=Xy.nativeEnum(Zn.FunctionResultEntryObject);Zn.FunctionResultEntryObject$outboundSchema=Zn.FunctionResultEntryObject$inboundSchema;var cPr;(function(t){t.inboundSchema=Zn.FunctionResultEntryObject$inboundSchema,t.outboundSchema=Zn.FunctionResultEntryObject$outboundSchema})(cPr||(Zn.FunctionResultEntryObject$=cPr={}));Zn.FunctionResultEntryType$inboundSchema=Xy.nativeEnum(Zn.FunctionResultEntryType);Zn.FunctionResultEntryType$outboundSchema=Zn.FunctionResultEntryType$inboundSchema;var dPr;(function(t){t.inboundSchema=Zn.FunctionResultEntryType$inboundSchema,t.outboundSchema=Zn.FunctionResultEntryType$outboundSchema})(dPr||(Zn.FunctionResultEntryType$=dPr={}));Zn.FunctionResultEntry$inboundSchema=Xy.object({object:Zn.FunctionResultEntryObject$inboundSchema.default("entry"),type:Zn.FunctionResultEntryType$inboundSchema.default("function.result"),created_at:Xy.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:Xy.nullable(Xy.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:Xy.string().optional(),tool_call_id:Xy.string(),result:Xy.string()}).transform(t=>(0,pPr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",tool_call_id:"toolCallId"}));Zn.FunctionResultEntry$outboundSchema=Xy.object({object:Zn.FunctionResultEntryObject$outboundSchema.default("entry"),type:Zn.FunctionResultEntryType$outboundSchema.default("function.result"),createdAt:Xy.date().transform(t=>t.toISOString()).optional(),completedAt:Xy.nullable(Xy.date().transform(t=>t.toISOString())).optional(),id:Xy.string().optional(),toolCallId:Xy.string(),result:Xy.string()}).transform(t=>(0,pPr.remap)(t,{createdAt:"created_at",completedAt:"completed_at",toolCallId:"tool_call_id"}));var fPr;(function(t){t.inboundSchema=Zn.FunctionResultEntry$inboundSchema,t.outboundSchema=Zn.FunctionResultEntry$outboundSchema})(fPr||(Zn.FunctionResultEntry$=fPr={}));function oPo(t){return JSON.stringify(Zn.FunctionResultEntry$outboundSchema.parse(t))}function iPo(t){return(0,nPo.safeParse)(t,e=>Zn.FunctionResultEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionResultEntry' from JSON")}});var hse=S(Ma=>{"use strict";var aPo=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]}),sPo=Ma&&Ma.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uPo=Ma&&Ma.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aPo(r,e,n[o]);return sPo(r,e),r}}();Object.defineProperty(Ma,"__esModule",{value:!0});Ma.ToolFileChunk$=Ma.ToolFileChunk$outboundSchema=Ma.ToolFileChunk$inboundSchema=Ma.ToolFileChunkType$=Ma.ToolFileChunkType$outboundSchema=Ma.ToolFileChunkType$inboundSchema=Ma.ToolFileChunkType=void 0;Ma.toolFileChunkToJSON=cPo;Ma.toolFileChunkFromJSON=dPo;var kw=uPo(ae()),gPr=ce(),lPo=te(),yPr=Hq();Ma.ToolFileChunkType={ToolFile:"tool_file"};Ma.ToolFileChunkType$inboundSchema=kw.nativeEnum(Ma.ToolFileChunkType);Ma.ToolFileChunkType$outboundSchema=Ma.ToolFileChunkType$inboundSchema;var mPr;(function(t){t.inboundSchema=Ma.ToolFileChunkType$inboundSchema,t.outboundSchema=Ma.ToolFileChunkType$outboundSchema})(mPr||(Ma.ToolFileChunkType$=mPr={}));Ma.ToolFileChunk$inboundSchema=kw.object({type:Ma.ToolFileChunkType$inboundSchema.default("tool_file"),tool:yPr.BuiltInConnectors$inboundSchema,file_id:kw.string(),file_name:kw.nullable(kw.string()).optional(),file_type:kw.nullable(kw.string()).optional()}).transform(t=>(0,gPr.remap)(t,{file_id:"fileId",file_name:"fileName",file_type:"fileType"}));Ma.ToolFileChunk$outboundSchema=kw.object({type:Ma.ToolFileChunkType$outboundSchema.default("tool_file"),tool:yPr.BuiltInConnectors$outboundSchema,fileId:kw.string(),fileName:kw.nullable(kw.string()).optional(),fileType:kw.nullable(kw.string()).optional()}).transform(t=>(0,gPr.remap)(t,{fileId:"file_id",fileName:"file_name",fileType:"file_type"}));var hPr;(function(t){t.inboundSchema=Ma.ToolFileChunk$inboundSchema,t.outboundSchema=Ma.ToolFileChunk$outboundSchema})(hPr||(Ma.ToolFileChunk$=hPr={}));function cPo(t){return JSON.stringify(Ma.ToolFileChunk$outboundSchema.parse(t))}function dPo(t){return(0,lPo.safeParse)(t,e=>Ma.ToolFileChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolFileChunk' from JSON")}});var rct=S(Mf=>{"use strict";var fPo=Mf&&Mf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pPo=Mf&&Mf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mPo=Mf&&Mf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fPo(r,e,n[o]);return pPo(r,e),r}}();Object.defineProperty(Mf,"__esModule",{value:!0});Mf.MessageInputContentChunks$=Mf.MessageInputContentChunks$outboundSchema=Mf.MessageInputContentChunks$inboundSchema=void 0;Mf.messageInputContentChunksToJSON=gPo;Mf.messageInputContentChunksFromJSON=yPo;var _Pr=mPo(ae()),hPo=te(),vPr=JH(),wPr=KH(),SPr=Vq(),CPr=XH(),xPr=hse();Mf.MessageInputContentChunks$inboundSchema=_Pr.union([xPr.ToolFileChunk$inboundSchema,SPr.TextChunk$inboundSchema,wPr.ImageURLChunk$inboundSchema,vPr.DocumentURLChunk$inboundSchema,CPr.ThinkChunk$inboundSchema]);Mf.MessageInputContentChunks$outboundSchema=_Pr.union([xPr.ToolFileChunk$outboundSchema,SPr.TextChunk$outboundSchema,wPr.ImageURLChunk$outboundSchema,vPr.DocumentURLChunk$outboundSchema,CPr.ThinkChunk$outboundSchema]);var bPr;(function(t){t.inboundSchema=Mf.MessageInputContentChunks$inboundSchema,t.outboundSchema=Mf.MessageInputContentChunks$outboundSchema})(bPr||(Mf.MessageInputContentChunks$=bPr={}));function gPo(t){return JSON.stringify(Mf.MessageInputContentChunks$outboundSchema.parse(t))}function yPo(t){return(0,hPo.safeParse)(t,e=>Mf.MessageInputContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageInputContentChunks' from JSON")}});var gse=S(or=>{"use strict";var bPo=or&&or.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Po=or&&or.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vPo=or&&or.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bPo(r,e,n[o]);return _Po(r,e),r}}();Object.defineProperty(or,"__esModule",{value:!0});or.MessageInputEntry$=or.MessageInputEntry$outboundSchema=or.MessageInputEntry$inboundSchema=or.MessageInputEntryContent$=or.MessageInputEntryContent$outboundSchema=or.MessageInputEntryContent$inboundSchema=or.MessageInputEntryRole$=or.MessageInputEntryRole$outboundSchema=or.MessageInputEntryRole$inboundSchema=or.MessageInputEntryType$=or.MessageInputEntryType$outboundSchema=or.MessageInputEntryType$inboundSchema=or.ObjectT$=or.ObjectT$outboundSchema=or.ObjectT$inboundSchema=or.MessageInputEntryRole=or.MessageInputEntryType=or.ObjectT=void 0;or.messageInputEntryContentToJSON=wPo;or.messageInputEntryContentFromJSON=SPo;or.messageInputEntryToJSON=CPo;or.messageInputEntryFromJSON=xPo;var qu=vPo(ae()),RPr=ce(),IPr=te(),ORe=rct();or.ObjectT={Entry:"entry"};or.MessageInputEntryType={MessageInput:"message.input"};or.MessageInputEntryRole={Assistant:"assistant",User:"user"};or.ObjectT$inboundSchema=qu.nativeEnum(or.ObjectT);or.ObjectT$outboundSchema=or.ObjectT$inboundSchema;var TPr;(function(t){t.inboundSchema=or.ObjectT$inboundSchema,t.outboundSchema=or.ObjectT$outboundSchema})(TPr||(or.ObjectT$=TPr={}));or.MessageInputEntryType$inboundSchema=qu.nativeEnum(or.MessageInputEntryType);or.MessageInputEntryType$outboundSchema=or.MessageInputEntryType$inboundSchema;var OPr;(function(t){t.inboundSchema=or.MessageInputEntryType$inboundSchema,t.outboundSchema=or.MessageInputEntryType$outboundSchema})(OPr||(or.MessageInputEntryType$=OPr={}));or.MessageInputEntryRole$inboundSchema=qu.nativeEnum(or.MessageInputEntryRole);or.MessageInputEntryRole$outboundSchema=or.MessageInputEntryRole$inboundSchema;var EPr;(function(t){t.inboundSchema=or.MessageInputEntryRole$inboundSchema,t.outboundSchema=or.MessageInputEntryRole$outboundSchema})(EPr||(or.MessageInputEntryRole$=EPr={}));or.MessageInputEntryContent$inboundSchema=qu.union([qu.string(),qu.array(ORe.MessageInputContentChunks$inboundSchema)]);or.MessageInputEntryContent$outboundSchema=qu.union([qu.string(),qu.array(ORe.MessageInputContentChunks$outboundSchema)]);var PPr;(function(t){t.inboundSchema=or.MessageInputEntryContent$inboundSchema,t.outboundSchema=or.MessageInputEntryContent$outboundSchema})(PPr||(or.MessageInputEntryContent$=PPr={}));function wPo(t){return JSON.stringify(or.MessageInputEntryContent$outboundSchema.parse(t))}function SPo(t){return(0,IPr.safeParse)(t,e=>or.MessageInputEntryContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageInputEntryContent' from JSON")}or.MessageInputEntry$inboundSchema=qu.object({object:or.ObjectT$inboundSchema.default("entry"),type:or.MessageInputEntryType$inboundSchema.default("message.input"),created_at:qu.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:qu.nullable(qu.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:qu.string().optional(),role:or.MessageInputEntryRole$inboundSchema,content:qu.union([qu.string(),qu.array(ORe.MessageInputContentChunks$inboundSchema)]),prefix:qu.boolean().default(!1)}).transform(t=>(0,RPr.remap)(t,{created_at:"createdAt",completed_at:"completedAt"}));or.MessageInputEntry$outboundSchema=qu.object({object:or.ObjectT$outboundSchema.default("entry"),type:or.MessageInputEntryType$outboundSchema.default("message.input"),createdAt:qu.date().transform(t=>t.toISOString()).optional(),completedAt:qu.nullable(qu.date().transform(t=>t.toISOString())).optional(),id:qu.string().optional(),role:or.MessageInputEntryRole$outboundSchema,content:qu.union([qu.string(),qu.array(ORe.MessageInputContentChunks$outboundSchema)]),prefix:qu.boolean().default(!1)}).transform(t=>(0,RPr.remap)(t,{createdAt:"created_at",completedAt:"completed_at"}));var MPr;(function(t){t.inboundSchema=or.MessageInputEntry$inboundSchema,t.outboundSchema=or.MessageInputEntry$outboundSchema})(MPr||(or.MessageInputEntry$=MPr={}));function CPo(t){return JSON.stringify(or.MessageInputEntry$outboundSchema.parse(t))}function xPo(t){return(0,IPr.safeParse)(t,e=>or.MessageInputEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageInputEntry' from JSON")}});var ERe=S(Ra=>{"use strict";var TPo=Ra&&Ra.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OPo=Ra&&Ra.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EPo=Ra&&Ra.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TPo(r,e,n[o]);return OPo(r,e),r}}();Object.defineProperty(Ra,"__esModule",{value:!0});Ra.ToolReferenceChunk$=Ra.ToolReferenceChunk$outboundSchema=Ra.ToolReferenceChunk$inboundSchema=Ra.ToolReferenceChunkType$=Ra.ToolReferenceChunkType$outboundSchema=Ra.ToolReferenceChunkType$inboundSchema=Ra.ToolReferenceChunkType=void 0;Ra.toolReferenceChunkToJSON=MPo;Ra.toolReferenceChunkFromJSON=RPo;var Zg=EPo(ae()),PPo=te(),DPr=Hq();Ra.ToolReferenceChunkType={ToolReference:"tool_reference"};Ra.ToolReferenceChunkType$inboundSchema=Zg.nativeEnum(Ra.ToolReferenceChunkType);Ra.ToolReferenceChunkType$outboundSchema=Ra.ToolReferenceChunkType$inboundSchema;var APr;(function(t){t.inboundSchema=Ra.ToolReferenceChunkType$inboundSchema,t.outboundSchema=Ra.ToolReferenceChunkType$outboundSchema})(APr||(Ra.ToolReferenceChunkType$=APr={}));Ra.ToolReferenceChunk$inboundSchema=Zg.object({type:Ra.ToolReferenceChunkType$inboundSchema.default("tool_reference"),tool:DPr.BuiltInConnectors$inboundSchema,title:Zg.string(),url:Zg.nullable(Zg.string()).optional(),favicon:Zg.nullable(Zg.string()).optional(),description:Zg.nullable(Zg.string()).optional()});Ra.ToolReferenceChunk$outboundSchema=Zg.object({type:Ra.ToolReferenceChunkType$outboundSchema.default("tool_reference"),tool:DPr.BuiltInConnectors$outboundSchema,title:Zg.string(),url:Zg.nullable(Zg.string()).optional(),favicon:Zg.nullable(Zg.string()).optional(),description:Zg.nullable(Zg.string()).optional()});var NPr;(function(t){t.inboundSchema=Ra.ToolReferenceChunk$inboundSchema,t.outboundSchema=Ra.ToolReferenceChunk$outboundSchema})(NPr||(Ra.ToolReferenceChunk$=NPr={}));function MPo(t){return JSON.stringify(Ra.ToolReferenceChunk$outboundSchema.parse(t))}function RPo(t){return(0,PPo.safeParse)(t,e=>Ra.ToolReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolReferenceChunk' from JSON")}});var nct=S(Rf=>{"use strict";var IPo=Rf&&Rf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),APo=Rf&&Rf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NPo=Rf&&Rf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IPo(r,e,n[o]);return APo(r,e),r}}();Object.defineProperty(Rf,"__esModule",{value:!0});Rf.MessageOutputContentChunks$=Rf.MessageOutputContentChunks$outboundSchema=Rf.MessageOutputContentChunks$inboundSchema=void 0;Rf.messageOutputContentChunksToJSON=jPo;Rf.messageOutputContentChunksFromJSON=$Po;var $Pr=NPo(ae()),DPo=te(),LPr=JH(),FPr=KH(),kPr=Vq(),qPr=XH(),BPr=hse(),UPr=ERe();Rf.MessageOutputContentChunks$inboundSchema=$Pr.union([BPr.ToolFileChunk$inboundSchema,UPr.ToolReferenceChunk$inboundSchema,kPr.TextChunk$inboundSchema,FPr.ImageURLChunk$inboundSchema,LPr.DocumentURLChunk$inboundSchema,qPr.ThinkChunk$inboundSchema]);Rf.MessageOutputContentChunks$outboundSchema=$Pr.union([BPr.ToolFileChunk$outboundSchema,UPr.ToolReferenceChunk$outboundSchema,kPr.TextChunk$outboundSchema,FPr.ImageURLChunk$outboundSchema,LPr.DocumentURLChunk$outboundSchema,qPr.ThinkChunk$outboundSchema]);var jPr;(function(t){t.inboundSchema=Rf.MessageOutputContentChunks$inboundSchema,t.outboundSchema=Rf.MessageOutputContentChunks$outboundSchema})(jPr||(Rf.MessageOutputContentChunks$=jPr={}));function jPo(t){return JSON.stringify(Rf.MessageOutputContentChunks$outboundSchema.parse(t))}function $Po(t){return(0,DPo.safeParse)(t,e=>Rf.MessageOutputContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputContentChunks' from JSON")}});var c7=S(ir=>{"use strict";var LPo=ir&&ir.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FPo=ir&&ir.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kPo=ir&&ir.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LPo(r,e,n[o]);return FPo(r,e),r}}();Object.defineProperty(ir,"__esModule",{value:!0});ir.MessageOutputEntry$=ir.MessageOutputEntry$outboundSchema=ir.MessageOutputEntry$inboundSchema=ir.MessageOutputEntryContent$=ir.MessageOutputEntryContent$outboundSchema=ir.MessageOutputEntryContent$inboundSchema=ir.MessageOutputEntryRole$=ir.MessageOutputEntryRole$outboundSchema=ir.MessageOutputEntryRole$inboundSchema=ir.MessageOutputEntryType$=ir.MessageOutputEntryType$outboundSchema=ir.MessageOutputEntryType$inboundSchema=ir.MessageOutputEntryObject$=ir.MessageOutputEntryObject$outboundSchema=ir.MessageOutputEntryObject$inboundSchema=ir.MessageOutputEntryRole=ir.MessageOutputEntryType=ir.MessageOutputEntryObject=void 0;ir.messageOutputEntryContentToJSON=qPo;ir.messageOutputEntryContentFromJSON=BPo;ir.messageOutputEntryToJSON=UPo;ir.messageOutputEntryFromJSON=zPo;var us=kPo(ae()),KPr=ce(),GPr=te(),PRe=nct();ir.MessageOutputEntryObject={Entry:"entry"};ir.MessageOutputEntryType={MessageOutput:"message.output"};ir.MessageOutputEntryRole={Assistant:"assistant"};ir.MessageOutputEntryObject$inboundSchema=us.nativeEnum(ir.MessageOutputEntryObject);ir.MessageOutputEntryObject$outboundSchema=ir.MessageOutputEntryObject$inboundSchema;var zPr;(function(t){t.inboundSchema=ir.MessageOutputEntryObject$inboundSchema,t.outboundSchema=ir.MessageOutputEntryObject$outboundSchema})(zPr||(ir.MessageOutputEntryObject$=zPr={}));ir.MessageOutputEntryType$inboundSchema=us.nativeEnum(ir.MessageOutputEntryType);ir.MessageOutputEntryType$outboundSchema=ir.MessageOutputEntryType$inboundSchema;var VPr;(function(t){t.inboundSchema=ir.MessageOutputEntryType$inboundSchema,t.outboundSchema=ir.MessageOutputEntryType$outboundSchema})(VPr||(ir.MessageOutputEntryType$=VPr={}));ir.MessageOutputEntryRole$inboundSchema=us.nativeEnum(ir.MessageOutputEntryRole);ir.MessageOutputEntryRole$outboundSchema=ir.MessageOutputEntryRole$inboundSchema;var HPr;(function(t){t.inboundSchema=ir.MessageOutputEntryRole$inboundSchema,t.outboundSchema=ir.MessageOutputEntryRole$outboundSchema})(HPr||(ir.MessageOutputEntryRole$=HPr={}));ir.MessageOutputEntryContent$inboundSchema=us.union([us.string(),us.array(PRe.MessageOutputContentChunks$inboundSchema)]);ir.MessageOutputEntryContent$outboundSchema=us.union([us.string(),us.array(PRe.MessageOutputContentChunks$outboundSchema)]);var WPr;(function(t){t.inboundSchema=ir.MessageOutputEntryContent$inboundSchema,t.outboundSchema=ir.MessageOutputEntryContent$outboundSchema})(WPr||(ir.MessageOutputEntryContent$=WPr={}));function qPo(t){return JSON.stringify(ir.MessageOutputEntryContent$outboundSchema.parse(t))}function BPo(t){return(0,GPr.safeParse)(t,e=>ir.MessageOutputEntryContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEntryContent' from JSON")}ir.MessageOutputEntry$inboundSchema=us.object({object:ir.MessageOutputEntryObject$inboundSchema.default("entry"),type:ir.MessageOutputEntryType$inboundSchema.default("message.output"),created_at:us.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:us.nullable(us.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:us.string().optional(),agent_id:us.nullable(us.string()).optional(),model:us.nullable(us.string()).optional(),role:ir.MessageOutputEntryRole$inboundSchema.default("assistant"),content:us.union([us.string(),us.array(PRe.MessageOutputContentChunks$inboundSchema)])}).transform(t=>(0,KPr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",agent_id:"agentId"}));ir.MessageOutputEntry$outboundSchema=us.object({object:ir.MessageOutputEntryObject$outboundSchema.default("entry"),type:ir.MessageOutputEntryType$outboundSchema.default("message.output"),createdAt:us.date().transform(t=>t.toISOString()).optional(),completedAt:us.nullable(us.date().transform(t=>t.toISOString())).optional(),id:us.string().optional(),agentId:us.nullable(us.string()).optional(),model:us.nullable(us.string()).optional(),role:ir.MessageOutputEntryRole$outboundSchema.default("assistant"),content:us.union([us.string(),us.array(PRe.MessageOutputContentChunks$outboundSchema)])}).transform(t=>(0,KPr.remap)(t,{createdAt:"created_at",completedAt:"completed_at",agentId:"agent_id"}));var JPr;(function(t){t.inboundSchema=ir.MessageOutputEntry$inboundSchema,t.outboundSchema=ir.MessageOutputEntry$outboundSchema})(JPr||(ir.MessageOutputEntry$=JPr={}));function UPo(t){return JSON.stringify(ir.MessageOutputEntry$outboundSchema.parse(t))}function zPo(t){return(0,GPr.safeParse)(t,e=>ir.MessageOutputEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEntry' from JSON")}});var yse=S(Yn=>{"use strict";var VPo=Yn&&Yn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HPo=Yn&&Yn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WPo=Yn&&Yn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&VPo(r,e,n[o]);return HPo(r,e),r}}();Object.defineProperty(Yn,"__esModule",{value:!0});Yn.ToolExecutionEntry$=Yn.ToolExecutionEntry$outboundSchema=Yn.ToolExecutionEntry$inboundSchema=Yn.ToolExecutionEntryType$=Yn.ToolExecutionEntryType$outboundSchema=Yn.ToolExecutionEntryType$inboundSchema=Yn.ToolExecutionEntryObject$=Yn.ToolExecutionEntryObject$outboundSchema=Yn.ToolExecutionEntryObject$inboundSchema=Yn.ToolExecutionEntryType=Yn.ToolExecutionEntryObject=void 0;Yn.toolExecutionEntryToJSON=KPo;Yn.toolExecutionEntryFromJSON=GPo;var Hh=WPo(ae()),QPr=ce(),JPo=te(),eMr=Hq();Yn.ToolExecutionEntryObject={Entry:"entry"};Yn.ToolExecutionEntryType={ToolExecution:"tool.execution"};Yn.ToolExecutionEntryObject$inboundSchema=Hh.nativeEnum(Yn.ToolExecutionEntryObject);Yn.ToolExecutionEntryObject$outboundSchema=Yn.ToolExecutionEntryObject$inboundSchema;var XPr;(function(t){t.inboundSchema=Yn.ToolExecutionEntryObject$inboundSchema,t.outboundSchema=Yn.ToolExecutionEntryObject$outboundSchema})(XPr||(Yn.ToolExecutionEntryObject$=XPr={}));Yn.ToolExecutionEntryType$inboundSchema=Hh.nativeEnum(Yn.ToolExecutionEntryType);Yn.ToolExecutionEntryType$outboundSchema=Yn.ToolExecutionEntryType$inboundSchema;var ZPr;(function(t){t.inboundSchema=Yn.ToolExecutionEntryType$inboundSchema,t.outboundSchema=Yn.ToolExecutionEntryType$outboundSchema})(ZPr||(Yn.ToolExecutionEntryType$=ZPr={}));Yn.ToolExecutionEntry$inboundSchema=Hh.object({object:Yn.ToolExecutionEntryObject$inboundSchema.default("entry"),type:Yn.ToolExecutionEntryType$inboundSchema.default("tool.execution"),created_at:Hh.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:Hh.nullable(Hh.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:Hh.string().optional(),name:eMr.BuiltInConnectors$inboundSchema,arguments:Hh.string(),info:Hh.record(Hh.any()).optional()}).transform(t=>(0,QPr.remap)(t,{created_at:"createdAt",completed_at:"completedAt"}));Yn.ToolExecutionEntry$outboundSchema=Hh.object({object:Yn.ToolExecutionEntryObject$outboundSchema.default("entry"),type:Yn.ToolExecutionEntryType$outboundSchema.default("tool.execution"),createdAt:Hh.date().transform(t=>t.toISOString()).optional(),completedAt:Hh.nullable(Hh.date().transform(t=>t.toISOString())).optional(),id:Hh.string().optional(),name:eMr.BuiltInConnectors$outboundSchema,arguments:Hh.string(),info:Hh.record(Hh.any()).optional()}).transform(t=>(0,QPr.remap)(t,{createdAt:"created_at",completedAt:"completed_at"}));var YPr;(function(t){t.inboundSchema=Yn.ToolExecutionEntry$inboundSchema,t.outboundSchema=Yn.ToolExecutionEntry$outboundSchema})(YPr||(Yn.ToolExecutionEntry$=YPr={}));function KPo(t){return JSON.stringify(Yn.ToolExecutionEntry$outboundSchema.parse(t))}function GPo(t){return(0,JPo.safeParse)(t,e=>Yn.ToolExecutionEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionEntry' from JSON")}});var oct=S(If=>{"use strict";var XPo=If&&If.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZPo=If&&If.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YPo=If&&If.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XPo(r,e,n[o]);return ZPo(r,e),r}}();Object.defineProperty(If,"__esModule",{value:!0});If.InputEntries$=If.InputEntries$outboundSchema=If.InputEntries$inboundSchema=void 0;If.inputEntriesToJSON=eMo;If.inputEntriesFromJSON=tMo;var rMr=YPo(ae()),QPo=te(),nMr=lse(),oMr=mse(),iMr=TRe(),aMr=gse(),sMr=c7(),uMr=yse();If.InputEntries$inboundSchema=rMr.union([nMr.AgentHandoffEntry$inboundSchema,oMr.FunctionCallEntry$inboundSchema,aMr.MessageInputEntry$inboundSchema,iMr.FunctionResultEntry$inboundSchema,uMr.ToolExecutionEntry$inboundSchema,sMr.MessageOutputEntry$inboundSchema]);If.InputEntries$outboundSchema=rMr.union([nMr.AgentHandoffEntry$outboundSchema,oMr.FunctionCallEntry$outboundSchema,aMr.MessageInputEntry$outboundSchema,iMr.FunctionResultEntry$outboundSchema,uMr.ToolExecutionEntry$outboundSchema,sMr.MessageOutputEntry$outboundSchema]);var tMr;(function(t){t.inboundSchema=If.InputEntries$inboundSchema,t.outboundSchema=If.InputEntries$outboundSchema})(tMr||(If.InputEntries$=tMr={}));function eMo(t){return JSON.stringify(If.InputEntries$outboundSchema.parse(t))}function tMo(t){return(0,QPo.safeParse)(t,e=>If.InputEntries$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InputEntries' from JSON")}});var Kq=S(Af=>{"use strict";var rMo=Af&&Af.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nMo=Af&&Af.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oMo=Af&&Af.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rMo(r,e,n[o]);return nMo(r,e),r}}();Object.defineProperty(Af,"__esModule",{value:!0});Af.ConversationInputs$=Af.ConversationInputs$outboundSchema=Af.ConversationInputs$inboundSchema=void 0;Af.conversationInputsToJSON=aMo;Af.conversationInputsFromJSON=sMo;var d7=oMo(ae()),iMo=te(),cMr=oct();Af.ConversationInputs$inboundSchema=d7.union([d7.string(),d7.array(cMr.InputEntries$inboundSchema)]);Af.ConversationInputs$outboundSchema=d7.union([d7.string(),d7.array(cMr.InputEntries$outboundSchema)]);var lMr;(function(t){t.inboundSchema=Af.ConversationInputs$inboundSchema,t.outboundSchema=Af.ConversationInputs$outboundSchema})(lMr||(Af.ConversationInputs$=lMr={}));function aMo(t){return JSON.stringify(Af.ConversationInputs$outboundSchema.parse(t))}function sMo(t){return(0,iMo.safeParse)(t,e=>Af.ConversationInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationInputs' from JSON")}});var gMr=S(Ia=>{"use strict";var uMo=Ia&&Ia.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lMo=Ia&&Ia.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cMo=Ia&&Ia.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&uMo(r,e,n[o]);return lMo(r,e),r}}();Object.defineProperty(Ia,"__esModule",{value:!0});Ia.ConversationAppendRequest$=Ia.ConversationAppendRequest$outboundSchema=Ia.ConversationAppendRequest$inboundSchema=Ia.ConversationAppendRequestHandoffExecution$=Ia.ConversationAppendRequestHandoffExecution$outboundSchema=Ia.ConversationAppendRequestHandoffExecution$inboundSchema=Ia.ConversationAppendRequestHandoffExecution=void 0;Ia.conversationAppendRequestToJSON=fMo;Ia.conversationAppendRequestFromJSON=pMo;var rW=cMo(ae()),pMr=ce(),dMo=te(),mMr=x0(),hMr=Kq();Ia.ConversationAppendRequestHandoffExecution={Client:"client",Server:"server"};Ia.ConversationAppendRequestHandoffExecution$inboundSchema=rW.nativeEnum(Ia.ConversationAppendRequestHandoffExecution);Ia.ConversationAppendRequestHandoffExecution$outboundSchema=Ia.ConversationAppendRequestHandoffExecution$inboundSchema;var dMr;(function(t){t.inboundSchema=Ia.ConversationAppendRequestHandoffExecution$inboundSchema,t.outboundSchema=Ia.ConversationAppendRequestHandoffExecution$outboundSchema})(dMr||(Ia.ConversationAppendRequestHandoffExecution$=dMr={}));Ia.ConversationAppendRequest$inboundSchema=rW.object({inputs:hMr.ConversationInputs$inboundSchema,stream:rW.boolean().default(!1),store:rW.boolean().default(!0),handoff_execution:Ia.ConversationAppendRequestHandoffExecution$inboundSchema.default("server"),completion_args:mMr.CompletionArgs$inboundSchema.optional()}).transform(t=>(0,pMr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs"}));Ia.ConversationAppendRequest$outboundSchema=rW.object({inputs:hMr.ConversationInputs$outboundSchema,stream:rW.boolean().default(!1),store:rW.boolean().default(!0),handoffExecution:Ia.ConversationAppendRequestHandoffExecution$outboundSchema.default("server"),completionArgs:mMr.CompletionArgs$outboundSchema.optional()}).transform(t=>(0,pMr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args"}));var fMr;(function(t){t.inboundSchema=Ia.ConversationAppendRequest$inboundSchema,t.outboundSchema=Ia.ConversationAppendRequest$outboundSchema})(fMr||(Ia.ConversationAppendRequest$=fMr={}));function fMo(t){return JSON.stringify(Ia.ConversationAppendRequest$outboundSchema.parse(t))}function pMo(t){return(0,dMo.safeParse)(t,e=>Ia.ConversationAppendRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationAppendRequest' from JSON")}});var SMr=S(Aa=>{"use strict";var mMo=Aa&&Aa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hMo=Aa&&Aa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gMo=Aa&&Aa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mMo(r,e,n[o]);return hMo(r,e),r}}();Object.defineProperty(Aa,"__esModule",{value:!0});Aa.ConversationAppendStreamRequest$=Aa.ConversationAppendStreamRequest$outboundSchema=Aa.ConversationAppendStreamRequest$inboundSchema=Aa.ConversationAppendStreamRequestHandoffExecution$=Aa.ConversationAppendStreamRequestHandoffExecution$outboundSchema=Aa.ConversationAppendStreamRequestHandoffExecution$inboundSchema=Aa.ConversationAppendStreamRequestHandoffExecution=void 0;Aa.conversationAppendStreamRequestToJSON=bMo;Aa.conversationAppendStreamRequestFromJSON=_Mo;var nW=gMo(ae()),_Mr=ce(),yMo=te(),vMr=x0(),wMr=Kq();Aa.ConversationAppendStreamRequestHandoffExecution={Client:"client",Server:"server"};Aa.ConversationAppendStreamRequestHandoffExecution$inboundSchema=nW.nativeEnum(Aa.ConversationAppendStreamRequestHandoffExecution);Aa.ConversationAppendStreamRequestHandoffExecution$outboundSchema=Aa.ConversationAppendStreamRequestHandoffExecution$inboundSchema;var yMr;(function(t){t.inboundSchema=Aa.ConversationAppendStreamRequestHandoffExecution$inboundSchema,t.outboundSchema=Aa.ConversationAppendStreamRequestHandoffExecution$outboundSchema})(yMr||(Aa.ConversationAppendStreamRequestHandoffExecution$=yMr={}));Aa.ConversationAppendStreamRequest$inboundSchema=nW.object({inputs:wMr.ConversationInputs$inboundSchema,stream:nW.boolean().default(!0),store:nW.boolean().default(!0),handoff_execution:Aa.ConversationAppendStreamRequestHandoffExecution$inboundSchema.default("server"),completion_args:vMr.CompletionArgs$inboundSchema.optional()}).transform(t=>(0,_Mr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs"}));Aa.ConversationAppendStreamRequest$outboundSchema=nW.object({inputs:wMr.ConversationInputs$outboundSchema,stream:nW.boolean().default(!0),store:nW.boolean().default(!0),handoffExecution:Aa.ConversationAppendStreamRequestHandoffExecution$outboundSchema.default("server"),completionArgs:vMr.CompletionArgs$outboundSchema.optional()}).transform(t=>(0,_Mr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args"}));var bMr;(function(t){t.inboundSchema=Aa.ConversationAppendStreamRequest$inboundSchema,t.outboundSchema=Aa.ConversationAppendStreamRequest$outboundSchema})(bMr||(Aa.ConversationAppendStreamRequest$=bMr={}));function bMo(t){return JSON.stringify(Aa.ConversationAppendStreamRequest$outboundSchema.parse(t))}function _Mo(t){return(0,yMo.safeParse)(t,e=>Aa.ConversationAppendStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationAppendStreamRequest' from JSON")}});var ict=S(Na=>{"use strict";var vMo=Na&&Na.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wMo=Na&&Na.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SMo=Na&&Na.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vMo(r,e,n[o]);return wMo(r,e),r}}();Object.defineProperty(Na,"__esModule",{value:!0});Na.FunctionCallEvent$=Na.FunctionCallEvent$outboundSchema=Na.FunctionCallEvent$inboundSchema=Na.FunctionCallEventType$=Na.FunctionCallEventType$outboundSchema=Na.FunctionCallEventType$inboundSchema=Na.FunctionCallEventType=void 0;Na.functionCallEventToJSON=xMo;Na.functionCallEventFromJSON=TMo;var Xb=SMo(ae()),TMr=ce(),CMo=te();Na.FunctionCallEventType={FunctionCallDelta:"function.call.delta"};Na.FunctionCallEventType$inboundSchema=Xb.nativeEnum(Na.FunctionCallEventType);Na.FunctionCallEventType$outboundSchema=Na.FunctionCallEventType$inboundSchema;var CMr;(function(t){t.inboundSchema=Na.FunctionCallEventType$inboundSchema,t.outboundSchema=Na.FunctionCallEventType$outboundSchema})(CMr||(Na.FunctionCallEventType$=CMr={}));Na.FunctionCallEvent$inboundSchema=Xb.object({type:Na.FunctionCallEventType$inboundSchema.default("function.call.delta"),created_at:Xb.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:Xb.number().int().default(0),id:Xb.string(),name:Xb.string(),tool_call_id:Xb.string(),arguments:Xb.string()}).transform(t=>(0,TMr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",tool_call_id:"toolCallId"}));Na.FunctionCallEvent$outboundSchema=Xb.object({type:Na.FunctionCallEventType$outboundSchema.default("function.call.delta"),createdAt:Xb.date().transform(t=>t.toISOString()).optional(),outputIndex:Xb.number().int().default(0),id:Xb.string(),name:Xb.string(),toolCallId:Xb.string(),arguments:Xb.string()}).transform(t=>(0,TMr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",toolCallId:"tool_call_id"}));var xMr;(function(t){t.inboundSchema=Na.FunctionCallEvent$inboundSchema,t.outboundSchema=Na.FunctionCallEvent$outboundSchema})(xMr||(Na.FunctionCallEvent$=xMr={}));function xMo(t){return JSON.stringify(Na.FunctionCallEvent$outboundSchema.parse(t))}function TMo(t){return(0,CMo.safeParse)(t,e=>Na.FunctionCallEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCallEvent' from JSON")}});var act=S(Nf=>{"use strict";var OMo=Nf&&Nf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EMo=Nf&&Nf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PMo=Nf&&Nf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&OMo(r,e,n[o]);return EMo(r,e),r}}();Object.defineProperty(Nf,"__esModule",{value:!0});Nf.OutputContentChunks$=Nf.OutputContentChunks$outboundSchema=Nf.OutputContentChunks$inboundSchema=void 0;Nf.outputContentChunksToJSON=RMo;Nf.outputContentChunksFromJSON=IMo;var EMr=PMo(ae()),MMo=te(),PMr=JH(),MMr=KH(),RMr=Vq(),IMr=XH(),AMr=hse(),NMr=ERe();Nf.OutputContentChunks$inboundSchema=EMr.union([AMr.ToolFileChunk$inboundSchema,NMr.ToolReferenceChunk$inboundSchema,RMr.TextChunk$inboundSchema,MMr.ImageURLChunk$inboundSchema,PMr.DocumentURLChunk$inboundSchema,IMr.ThinkChunk$inboundSchema]);Nf.OutputContentChunks$outboundSchema=EMr.union([AMr.ToolFileChunk$outboundSchema,NMr.ToolReferenceChunk$outboundSchema,RMr.TextChunk$outboundSchema,MMr.ImageURLChunk$outboundSchema,PMr.DocumentURLChunk$outboundSchema,IMr.ThinkChunk$outboundSchema]);var OMr;(function(t){t.inboundSchema=Nf.OutputContentChunks$inboundSchema,t.outboundSchema=Nf.OutputContentChunks$outboundSchema})(OMr||(Nf.OutputContentChunks$=OMr={}));function RMo(t){return JSON.stringify(Nf.OutputContentChunks$outboundSchema.parse(t))}function IMo(t){return(0,MMo.safeParse)(t,e=>Nf.OutputContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OutputContentChunks' from JSON")}});var sct=S(Br=>{"use strict";var AMo=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]}),NMo=Br&&Br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DMo=Br&&Br.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&AMo(r,e,n[o]);return NMo(r,e),r}}();Object.defineProperty(Br,"__esModule",{value:!0});Br.MessageOutputEvent$=Br.MessageOutputEvent$outboundSchema=Br.MessageOutputEvent$inboundSchema=Br.MessageOutputEventContent$=Br.MessageOutputEventContent$outboundSchema=Br.MessageOutputEventContent$inboundSchema=Br.MessageOutputEventRole$=Br.MessageOutputEventRole$outboundSchema=Br.MessageOutputEventRole$inboundSchema=Br.MessageOutputEventType$=Br.MessageOutputEventType$outboundSchema=Br.MessageOutputEventType$inboundSchema=Br.MessageOutputEventRole=Br.MessageOutputEventType=void 0;Br.messageOutputEventContentToJSON=jMo;Br.messageOutputEventContentFromJSON=$Mo;Br.messageOutputEventToJSON=LMo;Br.messageOutputEventFromJSON=FMo;var xu=DMo(ae()),FMr=ce(),kMr=te(),MRe=act();Br.MessageOutputEventType={MessageOutputDelta:"message.output.delta"};Br.MessageOutputEventRole={Assistant:"assistant"};Br.MessageOutputEventType$inboundSchema=xu.nativeEnum(Br.MessageOutputEventType);Br.MessageOutputEventType$outboundSchema=Br.MessageOutputEventType$inboundSchema;var DMr;(function(t){t.inboundSchema=Br.MessageOutputEventType$inboundSchema,t.outboundSchema=Br.MessageOutputEventType$outboundSchema})(DMr||(Br.MessageOutputEventType$=DMr={}));Br.MessageOutputEventRole$inboundSchema=xu.nativeEnum(Br.MessageOutputEventRole);Br.MessageOutputEventRole$outboundSchema=Br.MessageOutputEventRole$inboundSchema;var jMr;(function(t){t.inboundSchema=Br.MessageOutputEventRole$inboundSchema,t.outboundSchema=Br.MessageOutputEventRole$outboundSchema})(jMr||(Br.MessageOutputEventRole$=jMr={}));Br.MessageOutputEventContent$inboundSchema=xu.union([xu.string(),MRe.OutputContentChunks$inboundSchema]);Br.MessageOutputEventContent$outboundSchema=xu.union([xu.string(),MRe.OutputContentChunks$outboundSchema]);var $Mr;(function(t){t.inboundSchema=Br.MessageOutputEventContent$inboundSchema,t.outboundSchema=Br.MessageOutputEventContent$outboundSchema})($Mr||(Br.MessageOutputEventContent$=$Mr={}));function jMo(t){return JSON.stringify(Br.MessageOutputEventContent$outboundSchema.parse(t))}function $Mo(t){return(0,kMr.safeParse)(t,e=>Br.MessageOutputEventContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEventContent' from JSON")}Br.MessageOutputEvent$inboundSchema=xu.object({type:Br.MessageOutputEventType$inboundSchema.default("message.output.delta"),created_at:xu.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:xu.number().int().default(0),id:xu.string(),content_index:xu.number().int().default(0),model:xu.nullable(xu.string()).optional(),agent_id:xu.nullable(xu.string()).optional(),role:Br.MessageOutputEventRole$inboundSchema.default("assistant"),content:xu.union([xu.string(),MRe.OutputContentChunks$inboundSchema])}).transform(t=>(0,FMr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",content_index:"contentIndex",agent_id:"agentId"}));Br.MessageOutputEvent$outboundSchema=xu.object({type:Br.MessageOutputEventType$outboundSchema.default("message.output.delta"),createdAt:xu.date().transform(t=>t.toISOString()).optional(),outputIndex:xu.number().int().default(0),id:xu.string(),contentIndex:xu.number().int().default(0),model:xu.nullable(xu.string()).optional(),agentId:xu.nullable(xu.string()).optional(),role:Br.MessageOutputEventRole$outboundSchema.default("assistant"),content:xu.union([xu.string(),MRe.OutputContentChunks$outboundSchema])}).transform(t=>(0,FMr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",contentIndex:"content_index",agentId:"agent_id"}));var LMr;(function(t){t.inboundSchema=Br.MessageOutputEvent$inboundSchema,t.outboundSchema=Br.MessageOutputEvent$outboundSchema})(LMr||(Br.MessageOutputEvent$=LMr={}));function LMo(t){return JSON.stringify(Br.MessageOutputEvent$outboundSchema.parse(t))}function FMo(t){return(0,kMr.safeParse)(t,e=>Br.MessageOutputEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEvent' from JSON")}});var RRe=S(Df=>{"use strict";var kMo=Df&&Df.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qMo=Df&&Df.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BMo=Df&&Df.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kMo(r,e,n[o]);return qMo(r,e),r}}();Object.defineProperty(Df,"__esModule",{value:!0});Df.ConversationUsageInfo$=Df.ConversationUsageInfo$outboundSchema=Df.ConversationUsageInfo$inboundSchema=void 0;Df.conversationUsageInfoToJSON=zMo;Df.conversationUsageInfoFromJSON=VMo;var Wh=BMo(ae()),BMr=ce(),UMo=te();Df.ConversationUsageInfo$inboundSchema=Wh.object({prompt_tokens:Wh.number().int().default(0),completion_tokens:Wh.number().int().default(0),total_tokens:Wh.number().int().default(0),connector_tokens:Wh.nullable(Wh.number().int()).optional(),connectors:Wh.nullable(Wh.record(Wh.number().int())).optional()}).transform(t=>(0,BMr.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens",connector_tokens:"connectorTokens"}));Df.ConversationUsageInfo$outboundSchema=Wh.object({promptTokens:Wh.number().int().default(0),completionTokens:Wh.number().int().default(0),totalTokens:Wh.number().int().default(0),connectorTokens:Wh.nullable(Wh.number().int()).optional(),connectors:Wh.nullable(Wh.record(Wh.number().int())).optional()}).transform(t=>(0,BMr.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens",connectorTokens:"connector_tokens"}));var qMr;(function(t){t.inboundSchema=Df.ConversationUsageInfo$inboundSchema,t.outboundSchema=Df.ConversationUsageInfo$outboundSchema})(qMr||(Df.ConversationUsageInfo$=qMr={}));function zMo(t){return JSON.stringify(Df.ConversationUsageInfo$outboundSchema.parse(t))}function VMo(t){return(0,UMo.safeParse)(t,e=>Df.ConversationUsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationUsageInfo' from JSON")}});var uct=S(Da=>{"use strict";var HMo=Da&&Da.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WMo=Da&&Da.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JMo=Da&&Da.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&HMo(r,e,n[o]);return WMo(r,e),r}}();Object.defineProperty(Da,"__esModule",{value:!0});Da.ResponseDoneEvent$=Da.ResponseDoneEvent$outboundSchema=Da.ResponseDoneEvent$inboundSchema=Da.ResponseDoneEventType$=Da.ResponseDoneEventType$outboundSchema=Da.ResponseDoneEventType$inboundSchema=Da.ResponseDoneEventType=void 0;Da.responseDoneEventToJSON=GMo;Da.responseDoneEventFromJSON=XMo;var bse=JMo(ae()),VMr=ce(),KMo=te(),HMr=RRe();Da.ResponseDoneEventType={ConversationResponseDone:"conversation.response.done"};Da.ResponseDoneEventType$inboundSchema=bse.nativeEnum(Da.ResponseDoneEventType);Da.ResponseDoneEventType$outboundSchema=Da.ResponseDoneEventType$inboundSchema;var UMr;(function(t){t.inboundSchema=Da.ResponseDoneEventType$inboundSchema,t.outboundSchema=Da.ResponseDoneEventType$outboundSchema})(UMr||(Da.ResponseDoneEventType$=UMr={}));Da.ResponseDoneEvent$inboundSchema=bse.object({type:Da.ResponseDoneEventType$inboundSchema.default("conversation.response.done"),created_at:bse.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),usage:HMr.ConversationUsageInfo$inboundSchema}).transform(t=>(0,VMr.remap)(t,{created_at:"createdAt"}));Da.ResponseDoneEvent$outboundSchema=bse.object({type:Da.ResponseDoneEventType$outboundSchema.default("conversation.response.done"),createdAt:bse.date().transform(t=>t.toISOString()).optional(),usage:HMr.ConversationUsageInfo$outboundSchema}).transform(t=>(0,VMr.remap)(t,{createdAt:"created_at"}));var zMr;(function(t){t.inboundSchema=Da.ResponseDoneEvent$inboundSchema,t.outboundSchema=Da.ResponseDoneEvent$outboundSchema})(zMr||(Da.ResponseDoneEvent$=zMr={}));function GMo(t){return JSON.stringify(Da.ResponseDoneEvent$outboundSchema.parse(t))}function XMo(t){return(0,KMo.safeParse)(t,e=>Da.ResponseDoneEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseDoneEvent' from JSON")}});var lct=S(ja=>{"use strict";var ZMo=ja&&ja.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YMo=ja&&ja.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QMo=ja&&ja.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ZMo(r,e,n[o]);return YMo(r,e),r}}();Object.defineProperty(ja,"__esModule",{value:!0});ja.ResponseErrorEvent$=ja.ResponseErrorEvent$outboundSchema=ja.ResponseErrorEvent$inboundSchema=ja.ResponseErrorEventType$=ja.ResponseErrorEventType$outboundSchema=ja.ResponseErrorEventType$inboundSchema=ja.ResponseErrorEventType=void 0;ja.responseErrorEventToJSON=tRo;ja.responseErrorEventFromJSON=rRo;var WD=QMo(ae()),KMr=ce(),eRo=te();ja.ResponseErrorEventType={ConversationResponseError:"conversation.response.error"};ja.ResponseErrorEventType$inboundSchema=WD.nativeEnum(ja.ResponseErrorEventType);ja.ResponseErrorEventType$outboundSchema=ja.ResponseErrorEventType$inboundSchema;var WMr;(function(t){t.inboundSchema=ja.ResponseErrorEventType$inboundSchema,t.outboundSchema=ja.ResponseErrorEventType$outboundSchema})(WMr||(ja.ResponseErrorEventType$=WMr={}));ja.ResponseErrorEvent$inboundSchema=WD.object({type:ja.ResponseErrorEventType$inboundSchema.default("conversation.response.error"),created_at:WD.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),message:WD.string(),code:WD.number().int()}).transform(t=>(0,KMr.remap)(t,{created_at:"createdAt"}));ja.ResponseErrorEvent$outboundSchema=WD.object({type:ja.ResponseErrorEventType$outboundSchema.default("conversation.response.error"),createdAt:WD.date().transform(t=>t.toISOString()).optional(),message:WD.string(),code:WD.number().int()}).transform(t=>(0,KMr.remap)(t,{createdAt:"created_at"}));var JMr;(function(t){t.inboundSchema=ja.ResponseErrorEvent$inboundSchema,t.outboundSchema=ja.ResponseErrorEvent$outboundSchema})(JMr||(ja.ResponseErrorEvent$=JMr={}));function tRo(t){return JSON.stringify(ja.ResponseErrorEvent$outboundSchema.parse(t))}function rRo(t){return(0,eRo.safeParse)(t,e=>ja.ResponseErrorEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseErrorEvent' from JSON")}});var cct=S($a=>{"use strict";var nRo=$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]}),oRo=$a&&$a.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iRo=$a&&$a.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nRo(r,e,n[o]);return oRo(r,e),r}}();Object.defineProperty($a,"__esModule",{value:!0});$a.ResponseStartedEvent$=$a.ResponseStartedEvent$outboundSchema=$a.ResponseStartedEvent$inboundSchema=$a.ResponseStartedEventType$=$a.ResponseStartedEventType$outboundSchema=$a.ResponseStartedEventType$inboundSchema=$a.ResponseStartedEventType=void 0;$a.responseStartedEventToJSON=sRo;$a.responseStartedEventFromJSON=uRo;var oW=iRo(ae()),ZMr=ce(),aRo=te();$a.ResponseStartedEventType={ConversationResponseStarted:"conversation.response.started"};$a.ResponseStartedEventType$inboundSchema=oW.nativeEnum($a.ResponseStartedEventType);$a.ResponseStartedEventType$outboundSchema=$a.ResponseStartedEventType$inboundSchema;var GMr;(function(t){t.inboundSchema=$a.ResponseStartedEventType$inboundSchema,t.outboundSchema=$a.ResponseStartedEventType$outboundSchema})(GMr||($a.ResponseStartedEventType$=GMr={}));$a.ResponseStartedEvent$inboundSchema=oW.object({type:$a.ResponseStartedEventType$inboundSchema.default("conversation.response.started"),created_at:oW.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),conversation_id:oW.string()}).transform(t=>(0,ZMr.remap)(t,{created_at:"createdAt",conversation_id:"conversationId"}));$a.ResponseStartedEvent$outboundSchema=oW.object({type:$a.ResponseStartedEventType$outboundSchema.default("conversation.response.started"),createdAt:oW.date().transform(t=>t.toISOString()).optional(),conversationId:oW.string()}).transform(t=>(0,ZMr.remap)(t,{createdAt:"created_at",conversationId:"conversation_id"}));var XMr;(function(t){t.inboundSchema=$a.ResponseStartedEvent$inboundSchema,t.outboundSchema=$a.ResponseStartedEvent$outboundSchema})(XMr||($a.ResponseStartedEvent$=XMr={}));function sRo(t){return JSON.stringify($a.ResponseStartedEvent$outboundSchema.parse(t))}function uRo(t){return(0,aRo.safeParse)(t,e=>$a.ResponseStartedEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseStartedEvent' from JSON")}});var dct=S(jf=>{"use strict";var lRo=jf&&jf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cRo=jf&&jf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dRo=jf&&jf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&lRo(r,e,n[o]);return cRo(r,e),r}}();Object.defineProperty(jf,"__esModule",{value:!0});jf.SSETypes$=jf.SSETypes$outboundSchema=jf.SSETypes$inboundSchema=jf.SSETypes=void 0;var fRo=dRo(ae());jf.SSETypes={ConversationResponseStarted:"conversation.response.started",ConversationResponseDone:"conversation.response.done",ConversationResponseError:"conversation.response.error",MessageOutputDelta:"message.output.delta",ToolExecutionStarted:"tool.execution.started",ToolExecutionDelta:"tool.execution.delta",ToolExecutionDone:"tool.execution.done",AgentHandoffStarted:"agent.handoff.started",AgentHandoffDone:"agent.handoff.done",FunctionCallDelta:"function.call.delta"};jf.SSETypes$inboundSchema=fRo.nativeEnum(jf.SSETypes);jf.SSETypes$outboundSchema=jf.SSETypes$inboundSchema;var YMr;(function(t){t.inboundSchema=jf.SSETypes$inboundSchema,t.outboundSchema=jf.SSETypes$outboundSchema})(YMr||(jf.SSETypes$=YMr={}))});var fct=S(La=>{"use strict";var pRo=La&&La.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mRo=La&&La.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hRo=La&&La.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pRo(r,e,n[o]);return mRo(r,e),r}}();Object.defineProperty(La,"__esModule",{value:!0});La.ToolExecutionDeltaEvent$=La.ToolExecutionDeltaEvent$outboundSchema=La.ToolExecutionDeltaEvent$inboundSchema=La.ToolExecutionDeltaEventType$=La.ToolExecutionDeltaEventType$outboundSchema=La.ToolExecutionDeltaEventType$inboundSchema=La.ToolExecutionDeltaEventType=void 0;La.toolExecutionDeltaEventToJSON=yRo;La.toolExecutionDeltaEventFromJSON=bRo;var Ux=hRo(ae()),tRr=ce(),gRo=te(),rRr=Hq();La.ToolExecutionDeltaEventType={ToolExecutionDelta:"tool.execution.delta"};La.ToolExecutionDeltaEventType$inboundSchema=Ux.nativeEnum(La.ToolExecutionDeltaEventType);La.ToolExecutionDeltaEventType$outboundSchema=La.ToolExecutionDeltaEventType$inboundSchema;var QMr;(function(t){t.inboundSchema=La.ToolExecutionDeltaEventType$inboundSchema,t.outboundSchema=La.ToolExecutionDeltaEventType$outboundSchema})(QMr||(La.ToolExecutionDeltaEventType$=QMr={}));La.ToolExecutionDeltaEvent$inboundSchema=Ux.object({type:La.ToolExecutionDeltaEventType$inboundSchema.default("tool.execution.delta"),created_at:Ux.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:Ux.number().int().default(0),id:Ux.string(),name:rRr.BuiltInConnectors$inboundSchema,arguments:Ux.string()}).transform(t=>(0,tRr.remap)(t,{created_at:"createdAt",output_index:"outputIndex"}));La.ToolExecutionDeltaEvent$outboundSchema=Ux.object({type:La.ToolExecutionDeltaEventType$outboundSchema.default("tool.execution.delta"),createdAt:Ux.date().transform(t=>t.toISOString()).optional(),outputIndex:Ux.number().int().default(0),id:Ux.string(),name:rRr.BuiltInConnectors$outboundSchema,arguments:Ux.string()}).transform(t=>(0,tRr.remap)(t,{createdAt:"created_at",outputIndex:"output_index"}));var eRr;(function(t){t.inboundSchema=La.ToolExecutionDeltaEvent$inboundSchema,t.outboundSchema=La.ToolExecutionDeltaEvent$outboundSchema})(eRr||(La.ToolExecutionDeltaEvent$=eRr={}));function yRo(t){return JSON.stringify(La.ToolExecutionDeltaEvent$outboundSchema.parse(t))}function bRo(t){return(0,gRo.safeParse)(t,e=>La.ToolExecutionDeltaEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionDeltaEvent' from JSON")}});var pct=S(Fa=>{"use strict";var _Ro=Fa&&Fa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vRo=Fa&&Fa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wRo=Fa&&Fa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Ro(r,e,n[o]);return vRo(r,e),r}}();Object.defineProperty(Fa,"__esModule",{value:!0});Fa.ToolExecutionDoneEvent$=Fa.ToolExecutionDoneEvent$outboundSchema=Fa.ToolExecutionDoneEvent$inboundSchema=Fa.ToolExecutionDoneEventType$=Fa.ToolExecutionDoneEventType$outboundSchema=Fa.ToolExecutionDoneEventType$inboundSchema=Fa.ToolExecutionDoneEventType=void 0;Fa.toolExecutionDoneEventToJSON=CRo;Fa.toolExecutionDoneEventFromJSON=xRo;var qw=wRo(ae()),iRr=ce(),SRo=te(),aRr=Hq();Fa.ToolExecutionDoneEventType={ToolExecutionDone:"tool.execution.done"};Fa.ToolExecutionDoneEventType$inboundSchema=qw.nativeEnum(Fa.ToolExecutionDoneEventType);Fa.ToolExecutionDoneEventType$outboundSchema=Fa.ToolExecutionDoneEventType$inboundSchema;var nRr;(function(t){t.inboundSchema=Fa.ToolExecutionDoneEventType$inboundSchema,t.outboundSchema=Fa.ToolExecutionDoneEventType$outboundSchema})(nRr||(Fa.ToolExecutionDoneEventType$=nRr={}));Fa.ToolExecutionDoneEvent$inboundSchema=qw.object({type:Fa.ToolExecutionDoneEventType$inboundSchema.default("tool.execution.done"),created_at:qw.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:qw.number().int().default(0),id:qw.string(),name:aRr.BuiltInConnectors$inboundSchema,info:qw.record(qw.any()).optional()}).transform(t=>(0,iRr.remap)(t,{created_at:"createdAt",output_index:"outputIndex"}));Fa.ToolExecutionDoneEvent$outboundSchema=qw.object({type:Fa.ToolExecutionDoneEventType$outboundSchema.default("tool.execution.done"),createdAt:qw.date().transform(t=>t.toISOString()).optional(),outputIndex:qw.number().int().default(0),id:qw.string(),name:aRr.BuiltInConnectors$outboundSchema,info:qw.record(qw.any()).optional()}).transform(t=>(0,iRr.remap)(t,{createdAt:"created_at",outputIndex:"output_index"}));var oRr;(function(t){t.inboundSchema=Fa.ToolExecutionDoneEvent$inboundSchema,t.outboundSchema=Fa.ToolExecutionDoneEvent$outboundSchema})(oRr||(Fa.ToolExecutionDoneEvent$=oRr={}));function CRo(t){return JSON.stringify(Fa.ToolExecutionDoneEvent$outboundSchema.parse(t))}function xRo(t){return(0,SRo.safeParse)(t,e=>Fa.ToolExecutionDoneEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionDoneEvent' from JSON")}});var mct=S(ka=>{"use strict";var TRo=ka&&ka.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ORo=ka&&ka.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ERo=ka&&ka.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TRo(r,e,n[o]);return ORo(r,e),r}}();Object.defineProperty(ka,"__esModule",{value:!0});ka.ToolExecutionStartedEvent$=ka.ToolExecutionStartedEvent$outboundSchema=ka.ToolExecutionStartedEvent$inboundSchema=ka.ToolExecutionStartedEventType$=ka.ToolExecutionStartedEventType$outboundSchema=ka.ToolExecutionStartedEventType$inboundSchema=ka.ToolExecutionStartedEventType=void 0;ka.toolExecutionStartedEventToJSON=MRo;ka.toolExecutionStartedEventFromJSON=RRo;var zx=ERo(ae()),lRr=ce(),PRo=te(),cRr=Hq();ka.ToolExecutionStartedEventType={ToolExecutionStarted:"tool.execution.started"};ka.ToolExecutionStartedEventType$inboundSchema=zx.nativeEnum(ka.ToolExecutionStartedEventType);ka.ToolExecutionStartedEventType$outboundSchema=ka.ToolExecutionStartedEventType$inboundSchema;var sRr;(function(t){t.inboundSchema=ka.ToolExecutionStartedEventType$inboundSchema,t.outboundSchema=ka.ToolExecutionStartedEventType$outboundSchema})(sRr||(ka.ToolExecutionStartedEventType$=sRr={}));ka.ToolExecutionStartedEvent$inboundSchema=zx.object({type:ka.ToolExecutionStartedEventType$inboundSchema.default("tool.execution.started"),created_at:zx.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:zx.number().int().default(0),id:zx.string(),name:cRr.BuiltInConnectors$inboundSchema,arguments:zx.string()}).transform(t=>(0,lRr.remap)(t,{created_at:"createdAt",output_index:"outputIndex"}));ka.ToolExecutionStartedEvent$outboundSchema=zx.object({type:ka.ToolExecutionStartedEventType$outboundSchema.default("tool.execution.started"),createdAt:zx.date().transform(t=>t.toISOString()).optional(),outputIndex:zx.number().int().default(0),id:zx.string(),name:cRr.BuiltInConnectors$outboundSchema,arguments:zx.string()}).transform(t=>(0,lRr.remap)(t,{createdAt:"created_at",outputIndex:"output_index"}));var uRr;(function(t){t.inboundSchema=ka.ToolExecutionStartedEvent$inboundSchema,t.outboundSchema=ka.ToolExecutionStartedEvent$outboundSchema})(uRr||(ka.ToolExecutionStartedEvent$=uRr={}));function MRo(t){return JSON.stringify(ka.ToolExecutionStartedEvent$outboundSchema.parse(t))}function RRo(t){return(0,PRo.safeParse)(t,e=>ka.ToolExecutionStartedEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionStartedEvent' from JSON")}});var hRr=S(vs=>{"use strict";var IRo=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]}),ARo=vs&&vs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NRo=vs&&vs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IRo(r,e,n[o]);return ARo(r,e),r}}();Object.defineProperty(vs,"__esModule",{value:!0});vs.ConversationEvents$=vs.ConversationEvents$outboundSchema=vs.ConversationEvents$inboundSchema=vs.ConversationEventsData$=vs.ConversationEventsData$outboundSchema=vs.ConversationEventsData$inboundSchema=void 0;vs.conversationEventsDataToJSON=DRo;vs.conversationEventsDataFromJSON=jRo;vs.conversationEventsToJSON=$Ro;vs.conversationEventsFromJSON=LRo;var yt=NRo(ae()),pRr=te(),IRe=Elt(),ARe=Plt(),NRe=ict(),DRe=sct(),jRe=uct(),$Re=lct(),LRe=cct(),mRr=dct(),FRe=fct(),kRe=pct(),qRe=mct();vs.ConversationEventsData$inboundSchema=yt.union([NRe.FunctionCallEvent$inboundSchema.and(yt.object({type:yt.literal("function.call.delta")}).transform(t=>({type:t.type}))),IRe.AgentHandoffDoneEvent$inboundSchema.and(yt.object({type:yt.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),ARe.AgentHandoffStartedEvent$inboundSchema.and(yt.object({type:yt.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),FRe.ToolExecutionDeltaEvent$inboundSchema.and(yt.object({type:yt.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),qRe.ToolExecutionStartedEvent$inboundSchema.and(yt.object({type:yt.literal("tool.execution.started")}).transform(t=>({type:t.type}))),$Re.ResponseErrorEvent$inboundSchema.and(yt.object({type:yt.literal("conversation.response.error")}).transform(t=>({type:t.type}))),DRe.MessageOutputEvent$inboundSchema.and(yt.object({type:yt.literal("message.output.delta")}).transform(t=>({type:t.type}))),kRe.ToolExecutionDoneEvent$inboundSchema.and(yt.object({type:yt.literal("tool.execution.done")}).transform(t=>({type:t.type}))),jRe.ResponseDoneEvent$inboundSchema.and(yt.object({type:yt.literal("conversation.response.done")}).transform(t=>({type:t.type}))),LRe.ResponseStartedEvent$inboundSchema.and(yt.object({type:yt.literal("conversation.response.started")}).transform(t=>({type:t.type})))]);vs.ConversationEventsData$outboundSchema=yt.union([NRe.FunctionCallEvent$outboundSchema.and(yt.object({type:yt.literal("function.call.delta")}).transform(t=>({type:t.type}))),IRe.AgentHandoffDoneEvent$outboundSchema.and(yt.object({type:yt.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),ARe.AgentHandoffStartedEvent$outboundSchema.and(yt.object({type:yt.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),FRe.ToolExecutionDeltaEvent$outboundSchema.and(yt.object({type:yt.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),qRe.ToolExecutionStartedEvent$outboundSchema.and(yt.object({type:yt.literal("tool.execution.started")}).transform(t=>({type:t.type}))),$Re.ResponseErrorEvent$outboundSchema.and(yt.object({type:yt.literal("conversation.response.error")}).transform(t=>({type:t.type}))),DRe.MessageOutputEvent$outboundSchema.and(yt.object({type:yt.literal("message.output.delta")}).transform(t=>({type:t.type}))),kRe.ToolExecutionDoneEvent$outboundSchema.and(yt.object({type:yt.literal("tool.execution.done")}).transform(t=>({type:t.type}))),jRe.ResponseDoneEvent$outboundSchema.and(yt.object({type:yt.literal("conversation.response.done")}).transform(t=>({type:t.type}))),LRe.ResponseStartedEvent$outboundSchema.and(yt.object({type:yt.literal("conversation.response.started")}).transform(t=>({type:t.type})))]);var dRr;(function(t){t.inboundSchema=vs.ConversationEventsData$inboundSchema,t.outboundSchema=vs.ConversationEventsData$outboundSchema})(dRr||(vs.ConversationEventsData$=dRr={}));function DRo(t){return JSON.stringify(vs.ConversationEventsData$outboundSchema.parse(t))}function jRo(t){return(0,pRr.safeParse)(t,e=>vs.ConversationEventsData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationEventsData' from JSON")}vs.ConversationEvents$inboundSchema=yt.object({event:mRr.SSETypes$inboundSchema,data:yt.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:yt.ZodIssueCode.custom,message:`malformed json: ${r}`}),yt.NEVER}}).pipe(yt.union([NRe.FunctionCallEvent$inboundSchema.and(yt.object({type:yt.literal("function.call.delta")}).transform(t=>({type:t.type}))),IRe.AgentHandoffDoneEvent$inboundSchema.and(yt.object({type:yt.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),ARe.AgentHandoffStartedEvent$inboundSchema.and(yt.object({type:yt.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),FRe.ToolExecutionDeltaEvent$inboundSchema.and(yt.object({type:yt.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),qRe.ToolExecutionStartedEvent$inboundSchema.and(yt.object({type:yt.literal("tool.execution.started")}).transform(t=>({type:t.type}))),$Re.ResponseErrorEvent$inboundSchema.and(yt.object({type:yt.literal("conversation.response.error")}).transform(t=>({type:t.type}))),DRe.MessageOutputEvent$inboundSchema.and(yt.object({type:yt.literal("message.output.delta")}).transform(t=>({type:t.type}))),kRe.ToolExecutionDoneEvent$inboundSchema.and(yt.object({type:yt.literal("tool.execution.done")}).transform(t=>({type:t.type}))),jRe.ResponseDoneEvent$inboundSchema.and(yt.object({type:yt.literal("conversation.response.done")}).transform(t=>({type:t.type}))),LRe.ResponseStartedEvent$inboundSchema.and(yt.object({type:yt.literal("conversation.response.started")}).transform(t=>({type:t.type})))]))});vs.ConversationEvents$outboundSchema=yt.object({event:mRr.SSETypes$outboundSchema,data:yt.union([NRe.FunctionCallEvent$outboundSchema.and(yt.object({type:yt.literal("function.call.delta")}).transform(t=>({type:t.type}))),IRe.AgentHandoffDoneEvent$outboundSchema.and(yt.object({type:yt.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),ARe.AgentHandoffStartedEvent$outboundSchema.and(yt.object({type:yt.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),FRe.ToolExecutionDeltaEvent$outboundSchema.and(yt.object({type:yt.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),qRe.ToolExecutionStartedEvent$outboundSchema.and(yt.object({type:yt.literal("tool.execution.started")}).transform(t=>({type:t.type}))),$Re.ResponseErrorEvent$outboundSchema.and(yt.object({type:yt.literal("conversation.response.error")}).transform(t=>({type:t.type}))),DRe.MessageOutputEvent$outboundSchema.and(yt.object({type:yt.literal("message.output.delta")}).transform(t=>({type:t.type}))),kRe.ToolExecutionDoneEvent$outboundSchema.and(yt.object({type:yt.literal("tool.execution.done")}).transform(t=>({type:t.type}))),jRe.ResponseDoneEvent$outboundSchema.and(yt.object({type:yt.literal("conversation.response.done")}).transform(t=>({type:t.type}))),LRe.ResponseStartedEvent$outboundSchema.and(yt.object({type:yt.literal("conversation.response.started")}).transform(t=>({type:t.type})))])});var fRr;(function(t){t.inboundSchema=vs.ConversationEvents$inboundSchema,t.outboundSchema=vs.ConversationEvents$outboundSchema})(fRr||(vs.ConversationEvents$=fRr={}));function $Ro(t){return JSON.stringify(vs.ConversationEvents$outboundSchema.parse(t))}function LRo(t){return(0,pRr.safeParse)(t,e=>vs.ConversationEvents$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationEvents' from JSON")}});var wRr=S(wo=>{"use strict";var FRo=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]}),kRo=wo&&wo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qRo=wo&&wo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&FRo(r,e,n[o]);return kRo(r,e),r}}();Object.defineProperty(wo,"__esModule",{value:!0});wo.ConversationHistory$=wo.ConversationHistory$outboundSchema=wo.ConversationHistory$inboundSchema=wo.Entries$=wo.Entries$outboundSchema=wo.Entries$inboundSchema=wo.ConversationHistoryObject$=wo.ConversationHistoryObject$outboundSchema=wo.ConversationHistoryObject$inboundSchema=wo.ConversationHistoryObject=void 0;wo.entriesToJSON=BRo;wo.entriesFromJSON=URo;wo.conversationHistoryToJSON=zRo;wo.conversationHistoryFromJSON=VRo;var Vx=qRo(ae()),_Rr=ce(),vRr=te(),BRe=lse(),URe=mse(),zRe=TRe(),VRe=gse(),HRe=c7(),WRe=yse();wo.ConversationHistoryObject={ConversationHistory:"conversation.history"};wo.ConversationHistoryObject$inboundSchema=Vx.nativeEnum(wo.ConversationHistoryObject);wo.ConversationHistoryObject$outboundSchema=wo.ConversationHistoryObject$inboundSchema;var gRr;(function(t){t.inboundSchema=wo.ConversationHistoryObject$inboundSchema,t.outboundSchema=wo.ConversationHistoryObject$outboundSchema})(gRr||(wo.ConversationHistoryObject$=gRr={}));wo.Entries$inboundSchema=Vx.union([BRe.AgentHandoffEntry$inboundSchema,URe.FunctionCallEntry$inboundSchema,VRe.MessageInputEntry$inboundSchema,zRe.FunctionResultEntry$inboundSchema,WRe.ToolExecutionEntry$inboundSchema,HRe.MessageOutputEntry$inboundSchema]);wo.Entries$outboundSchema=Vx.union([BRe.AgentHandoffEntry$outboundSchema,URe.FunctionCallEntry$outboundSchema,VRe.MessageInputEntry$outboundSchema,zRe.FunctionResultEntry$outboundSchema,WRe.ToolExecutionEntry$outboundSchema,HRe.MessageOutputEntry$outboundSchema]);var yRr;(function(t){t.inboundSchema=wo.Entries$inboundSchema,t.outboundSchema=wo.Entries$outboundSchema})(yRr||(wo.Entries$=yRr={}));function BRo(t){return JSON.stringify(wo.Entries$outboundSchema.parse(t))}function URo(t){return(0,vRr.safeParse)(t,e=>wo.Entries$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Entries' from JSON")}wo.ConversationHistory$inboundSchema=Vx.object({object:wo.ConversationHistoryObject$inboundSchema.default("conversation.history"),conversation_id:Vx.string(),entries:Vx.array(Vx.union([BRe.AgentHandoffEntry$inboundSchema,URe.FunctionCallEntry$inboundSchema,VRe.MessageInputEntry$inboundSchema,zRe.FunctionResultEntry$inboundSchema,WRe.ToolExecutionEntry$inboundSchema,HRe.MessageOutputEntry$inboundSchema]))}).transform(t=>(0,_Rr.remap)(t,{conversation_id:"conversationId"}));wo.ConversationHistory$outboundSchema=Vx.object({object:wo.ConversationHistoryObject$outboundSchema.default("conversation.history"),conversationId:Vx.string(),entries:Vx.array(Vx.union([BRe.AgentHandoffEntry$outboundSchema,URe.FunctionCallEntry$outboundSchema,VRe.MessageInputEntry$outboundSchema,zRe.FunctionResultEntry$outboundSchema,WRe.ToolExecutionEntry$outboundSchema,HRe.MessageOutputEntry$outboundSchema]))}).transform(t=>(0,_Rr.remap)(t,{conversationId:"conversation_id"}));var bRr;(function(t){t.inboundSchema=wo.ConversationHistory$inboundSchema,t.outboundSchema=wo.ConversationHistory$outboundSchema})(bRr||(wo.ConversationHistory$=bRr={}));function zRo(t){return JSON.stringify(wo.ConversationHistory$outboundSchema.parse(t))}function VRo(t){return(0,vRr.safeParse)(t,e=>wo.ConversationHistory$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationHistory' from JSON")}});var hct=S($f=>{"use strict";var HRo=$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]}),WRo=$f&&$f.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JRo=$f&&$f.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&HRo(r,e,n[o]);return WRo(r,e),r}}();Object.defineProperty($f,"__esModule",{value:!0});$f.MessageEntries$=$f.MessageEntries$outboundSchema=$f.MessageEntries$inboundSchema=void 0;$f.messageEntriesToJSON=GRo;$f.messageEntriesFromJSON=XRo;var CRr=JRo(ae()),KRo=te(),xRr=gse(),TRr=c7();$f.MessageEntries$inboundSchema=CRr.union([xRr.MessageInputEntry$inboundSchema,TRr.MessageOutputEntry$inboundSchema]);$f.MessageEntries$outboundSchema=CRr.union([xRr.MessageInputEntry$outboundSchema,TRr.MessageOutputEntry$outboundSchema]);var SRr;(function(t){t.inboundSchema=$f.MessageEntries$inboundSchema,t.outboundSchema=$f.MessageEntries$outboundSchema})(SRr||($f.MessageEntries$=SRr={}));function GRo(t){return JSON.stringify($f.MessageEntries$outboundSchema.parse(t))}function XRo(t){return(0,KRo.safeParse)(t,e=>$f.MessageEntries$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageEntries' from JSON")}});var RRr=S(qa=>{"use strict";var ZRo=qa&&qa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YRo=qa&&qa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QRo=qa&&qa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ZRo(r,e,n[o]);return YRo(r,e),r}}();Object.defineProperty(qa,"__esModule",{value:!0});qa.ConversationMessages$=qa.ConversationMessages$outboundSchema=qa.ConversationMessages$inboundSchema=qa.ConversationMessagesObject$=qa.ConversationMessagesObject$outboundSchema=qa.ConversationMessagesObject$inboundSchema=qa.ConversationMessagesObject=void 0;qa.conversationMessagesToJSON=tIo;qa.conversationMessagesFromJSON=rIo;var iW=QRo(ae()),PRr=ce(),eIo=te(),MRr=hct();qa.ConversationMessagesObject={ConversationMessages:"conversation.messages"};qa.ConversationMessagesObject$inboundSchema=iW.nativeEnum(qa.ConversationMessagesObject);qa.ConversationMessagesObject$outboundSchema=qa.ConversationMessagesObject$inboundSchema;var ORr;(function(t){t.inboundSchema=qa.ConversationMessagesObject$inboundSchema,t.outboundSchema=qa.ConversationMessagesObject$outboundSchema})(ORr||(qa.ConversationMessagesObject$=ORr={}));qa.ConversationMessages$inboundSchema=iW.object({object:qa.ConversationMessagesObject$inboundSchema.default("conversation.messages"),conversation_id:iW.string(),messages:iW.array(MRr.MessageEntries$inboundSchema)}).transform(t=>(0,PRr.remap)(t,{conversation_id:"conversationId"}));qa.ConversationMessages$outboundSchema=iW.object({object:qa.ConversationMessagesObject$outboundSchema.default("conversation.messages"),conversationId:iW.string(),messages:iW.array(MRr.MessageEntries$outboundSchema)}).transform(t=>(0,PRr.remap)(t,{conversationId:"conversation_id"}));var ERr;(function(t){t.inboundSchema=qa.ConversationMessages$inboundSchema,t.outboundSchema=qa.ConversationMessages$outboundSchema})(ERr||(qa.ConversationMessages$=ERr={}));function tIo(t){return JSON.stringify(qa.ConversationMessages$outboundSchema.parse(t))}function rIo(t){return(0,eIo.safeParse)(t,e=>qa.ConversationMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationMessages' from JSON")}});var FRr=S(So=>{"use strict";var nIo=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]}),oIo=So&&So.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iIo=So&&So.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nIo(r,e,n[o]);return oIo(r,e),r}}();Object.defineProperty(So,"__esModule",{value:!0});So.ConversationRequest$=So.ConversationRequest$outboundSchema=So.ConversationRequest$inboundSchema=So.Tools$=So.Tools$outboundSchema=So.Tools$inboundSchema=So.HandoffExecution$=So.HandoffExecution$outboundSchema=So.HandoffExecution$inboundSchema=So.HandoffExecution=void 0;So.toolsToJSON=aIo;So.toolsFromJSON=sIo;So.conversationRequestToJSON=uIo;So.conversationRequestFromJSON=lIo;var bt=iIo(ae()),DRr=ce(),jRr=te(),JRe=jq(),$Rr=x0(),LRr=Kq(),KRe=Fq(),GRe=kq(),XRe=qq(),ZRe=Bq(),YRe=Uq();So.HandoffExecution={Client:"client",Server:"server"};So.HandoffExecution$inboundSchema=bt.nativeEnum(So.HandoffExecution);So.HandoffExecution$outboundSchema=So.HandoffExecution$inboundSchema;var IRr;(function(t){t.inboundSchema=So.HandoffExecution$inboundSchema,t.outboundSchema=So.HandoffExecution$outboundSchema})(IRr||(So.HandoffExecution$=IRr={}));So.Tools$inboundSchema=bt.union([KRe.DocumentLibraryTool$inboundSchema.and(bt.object({type:bt.literal("document_library")}).transform(t=>({type:t.type}))),GRe.FunctionTool$inboundSchema.and(bt.object({type:bt.literal("function")}).transform(t=>({type:t.type}))),JRe.CodeInterpreterTool$inboundSchema.and(bt.object({type:bt.literal("code_interpreter")}).transform(t=>({type:t.type}))),XRe.ImageGenerationTool$inboundSchema.and(bt.object({type:bt.literal("image_generation")}).transform(t=>({type:t.type}))),YRe.WebSearchTool$inboundSchema.and(bt.object({type:bt.literal("web_search")}).transform(t=>({type:t.type}))),ZRe.WebSearchPremiumTool$inboundSchema.and(bt.object({type:bt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);So.Tools$outboundSchema=bt.union([KRe.DocumentLibraryTool$outboundSchema.and(bt.object({type:bt.literal("document_library")}).transform(t=>({type:t.type}))),GRe.FunctionTool$outboundSchema.and(bt.object({type:bt.literal("function")}).transform(t=>({type:t.type}))),JRe.CodeInterpreterTool$outboundSchema.and(bt.object({type:bt.literal("code_interpreter")}).transform(t=>({type:t.type}))),XRe.ImageGenerationTool$outboundSchema.and(bt.object({type:bt.literal("image_generation")}).transform(t=>({type:t.type}))),YRe.WebSearchTool$outboundSchema.and(bt.object({type:bt.literal("web_search")}).transform(t=>({type:t.type}))),ZRe.WebSearchPremiumTool$outboundSchema.and(bt.object({type:bt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var ARr;(function(t){t.inboundSchema=So.Tools$inboundSchema,t.outboundSchema=So.Tools$outboundSchema})(ARr||(So.Tools$=ARr={}));function aIo(t){return JSON.stringify(So.Tools$outboundSchema.parse(t))}function sIo(t){return(0,jRr.safeParse)(t,e=>So.Tools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tools' from JSON")}So.ConversationRequest$inboundSchema=bt.object({inputs:LRr.ConversationInputs$inboundSchema,stream:bt.boolean().default(!1),store:bt.nullable(bt.boolean()).optional(),handoff_execution:bt.nullable(So.HandoffExecution$inboundSchema).optional(),instructions:bt.nullable(bt.string()).optional(),tools:bt.nullable(bt.array(bt.union([KRe.DocumentLibraryTool$inboundSchema.and(bt.object({type:bt.literal("document_library")}).transform(t=>({type:t.type}))),GRe.FunctionTool$inboundSchema.and(bt.object({type:bt.literal("function")}).transform(t=>({type:t.type}))),JRe.CodeInterpreterTool$inboundSchema.and(bt.object({type:bt.literal("code_interpreter")}).transform(t=>({type:t.type}))),XRe.ImageGenerationTool$inboundSchema.and(bt.object({type:bt.literal("image_generation")}).transform(t=>({type:t.type}))),YRe.WebSearchTool$inboundSchema.and(bt.object({type:bt.literal("web_search")}).transform(t=>({type:t.type}))),ZRe.WebSearchPremiumTool$inboundSchema.and(bt.object({type:bt.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completion_args:bt.nullable($Rr.CompletionArgs$inboundSchema).optional(),name:bt.nullable(bt.string()).optional(),description:bt.nullable(bt.string()).optional(),agent_id:bt.nullable(bt.string()).optional(),model:bt.nullable(bt.string()).optional()}).transform(t=>(0,DRr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",agent_id:"agentId"}));So.ConversationRequest$outboundSchema=bt.object({inputs:LRr.ConversationInputs$outboundSchema,stream:bt.boolean().default(!1),store:bt.nullable(bt.boolean()).optional(),handoffExecution:bt.nullable(So.HandoffExecution$outboundSchema).optional(),instructions:bt.nullable(bt.string()).optional(),tools:bt.nullable(bt.array(bt.union([KRe.DocumentLibraryTool$outboundSchema.and(bt.object({type:bt.literal("document_library")}).transform(t=>({type:t.type}))),GRe.FunctionTool$outboundSchema.and(bt.object({type:bt.literal("function")}).transform(t=>({type:t.type}))),JRe.CodeInterpreterTool$outboundSchema.and(bt.object({type:bt.literal("code_interpreter")}).transform(t=>({type:t.type}))),XRe.ImageGenerationTool$outboundSchema.and(bt.object({type:bt.literal("image_generation")}).transform(t=>({type:t.type}))),YRe.WebSearchTool$outboundSchema.and(bt.object({type:bt.literal("web_search")}).transform(t=>({type:t.type}))),ZRe.WebSearchPremiumTool$outboundSchema.and(bt.object({type:bt.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completionArgs:bt.nullable($Rr.CompletionArgs$outboundSchema).optional(),name:bt.nullable(bt.string()).optional(),description:bt.nullable(bt.string()).optional(),agentId:bt.nullable(bt.string()).optional(),model:bt.nullable(bt.string()).optional()}).transform(t=>(0,DRr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",agentId:"agent_id"}));var NRr;(function(t){t.inboundSchema=So.ConversationRequest$inboundSchema,t.outboundSchema=So.ConversationRequest$outboundSchema})(NRr||(So.ConversationRequest$=NRr={}));function uIo(t){return JSON.stringify(So.ConversationRequest$outboundSchema.parse(t))}function lIo(t){return(0,jRr.safeParse)(t,e=>So.ConversationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationRequest' from JSON")}});var HRr=S(Co=>{"use strict";var cIo=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]}),dIo=Co&&Co.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fIo=Co&&Co.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cIo(r,e,n[o]);return dIo(r,e),r}}();Object.defineProperty(Co,"__esModule",{value:!0});Co.ConversationResponse$=Co.ConversationResponse$outboundSchema=Co.ConversationResponse$inboundSchema=Co.Outputs$=Co.Outputs$outboundSchema=Co.Outputs$inboundSchema=Co.ConversationResponseObject$=Co.ConversationResponseObject$outboundSchema=Co.ConversationResponseObject$inboundSchema=Co.ConversationResponseObject=void 0;Co.outputsToJSON=pIo;Co.outputsFromJSON=mIo;Co.conversationResponseToJSON=hIo;Co.conversationResponseFromJSON=gIo;var Hx=fIo(ae()),URr=ce(),zRr=te(),QRe=lse(),VRr=RRe(),eIe=mse(),tIe=c7(),rIe=yse();Co.ConversationResponseObject={ConversationResponse:"conversation.response"};Co.ConversationResponseObject$inboundSchema=Hx.nativeEnum(Co.ConversationResponseObject);Co.ConversationResponseObject$outboundSchema=Co.ConversationResponseObject$inboundSchema;var kRr;(function(t){t.inboundSchema=Co.ConversationResponseObject$inboundSchema,t.outboundSchema=Co.ConversationResponseObject$outboundSchema})(kRr||(Co.ConversationResponseObject$=kRr={}));Co.Outputs$inboundSchema=Hx.union([QRe.AgentHandoffEntry$inboundSchema,eIe.FunctionCallEntry$inboundSchema,rIe.ToolExecutionEntry$inboundSchema,tIe.MessageOutputEntry$inboundSchema]);Co.Outputs$outboundSchema=Hx.union([QRe.AgentHandoffEntry$outboundSchema,eIe.FunctionCallEntry$outboundSchema,rIe.ToolExecutionEntry$outboundSchema,tIe.MessageOutputEntry$outboundSchema]);var qRr;(function(t){t.inboundSchema=Co.Outputs$inboundSchema,t.outboundSchema=Co.Outputs$outboundSchema})(qRr||(Co.Outputs$=qRr={}));function pIo(t){return JSON.stringify(Co.Outputs$outboundSchema.parse(t))}function mIo(t){return(0,zRr.safeParse)(t,e=>Co.Outputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Outputs' from JSON")}Co.ConversationResponse$inboundSchema=Hx.object({object:Co.ConversationResponseObject$inboundSchema.default("conversation.response"),conversation_id:Hx.string(),outputs:Hx.array(Hx.union([QRe.AgentHandoffEntry$inboundSchema,eIe.FunctionCallEntry$inboundSchema,rIe.ToolExecutionEntry$inboundSchema,tIe.MessageOutputEntry$inboundSchema])),usage:VRr.ConversationUsageInfo$inboundSchema}).transform(t=>(0,URr.remap)(t,{conversation_id:"conversationId"}));Co.ConversationResponse$outboundSchema=Hx.object({object:Co.ConversationResponseObject$outboundSchema.default("conversation.response"),conversationId:Hx.string(),outputs:Hx.array(Hx.union([QRe.AgentHandoffEntry$outboundSchema,eIe.FunctionCallEntry$outboundSchema,rIe.ToolExecutionEntry$outboundSchema,tIe.MessageOutputEntry$outboundSchema])),usage:VRr.ConversationUsageInfo$outboundSchema}).transform(t=>(0,URr.remap)(t,{conversationId:"conversation_id"}));var BRr;(function(t){t.inboundSchema=Co.ConversationResponse$inboundSchema,t.outboundSchema=Co.ConversationResponse$outboundSchema})(BRr||(Co.ConversationResponse$=BRr={}));function hIo(t){return JSON.stringify(Co.ConversationResponse$outboundSchema.parse(t))}function gIo(t){return(0,zRr.safeParse)(t,e=>Co.ConversationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationResponse' from JSON")}});var ZRr=S(Ba=>{"use strict";var yIo=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]}),bIo=Ba&&Ba.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Io=Ba&&Ba.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yIo(r,e,n[o]);return bIo(r,e),r}}();Object.defineProperty(Ba,"__esModule",{value:!0});Ba.ConversationRestartRequest$=Ba.ConversationRestartRequest$outboundSchema=Ba.ConversationRestartRequest$inboundSchema=Ba.ConversationRestartRequestHandoffExecution$=Ba.ConversationRestartRequestHandoffExecution$outboundSchema=Ba.ConversationRestartRequestHandoffExecution$inboundSchema=Ba.ConversationRestartRequestHandoffExecution=void 0;Ba.conversationRestartRequestToJSON=wIo;Ba.conversationRestartRequestFromJSON=SIo;var JD=_Io(ae()),KRr=ce(),vIo=te(),GRr=x0(),XRr=Kq();Ba.ConversationRestartRequestHandoffExecution={Client:"client",Server:"server"};Ba.ConversationRestartRequestHandoffExecution$inboundSchema=JD.nativeEnum(Ba.ConversationRestartRequestHandoffExecution);Ba.ConversationRestartRequestHandoffExecution$outboundSchema=Ba.ConversationRestartRequestHandoffExecution$inboundSchema;var WRr;(function(t){t.inboundSchema=Ba.ConversationRestartRequestHandoffExecution$inboundSchema,t.outboundSchema=Ba.ConversationRestartRequestHandoffExecution$outboundSchema})(WRr||(Ba.ConversationRestartRequestHandoffExecution$=WRr={}));Ba.ConversationRestartRequest$inboundSchema=JD.object({inputs:XRr.ConversationInputs$inboundSchema,stream:JD.boolean().default(!1),store:JD.boolean().default(!0),handoff_execution:Ba.ConversationRestartRequestHandoffExecution$inboundSchema.default("server"),completion_args:GRr.CompletionArgs$inboundSchema.optional(),from_entry_id:JD.string()}).transform(t=>(0,KRr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",from_entry_id:"fromEntryId"}));Ba.ConversationRestartRequest$outboundSchema=JD.object({inputs:XRr.ConversationInputs$outboundSchema,stream:JD.boolean().default(!1),store:JD.boolean().default(!0),handoffExecution:Ba.ConversationRestartRequestHandoffExecution$outboundSchema.default("server"),completionArgs:GRr.CompletionArgs$outboundSchema.optional(),fromEntryId:JD.string()}).transform(t=>(0,KRr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",fromEntryId:"from_entry_id"}));var JRr;(function(t){t.inboundSchema=Ba.ConversationRestartRequest$inboundSchema,t.outboundSchema=Ba.ConversationRestartRequest$outboundSchema})(JRr||(Ba.ConversationRestartRequest$=JRr={}));function wIo(t){return JSON.stringify(Ba.ConversationRestartRequest$outboundSchema.parse(t))}function SIo(t){return(0,vIo.safeParse)(t,e=>Ba.ConversationRestartRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationRestartRequest' from JSON")}});var nIr=S(Ua=>{"use strict";var CIo=Ua&&Ua.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xIo=Ua&&Ua.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TIo=Ua&&Ua.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&CIo(r,e,n[o]);return xIo(r,e),r}}();Object.defineProperty(Ua,"__esModule",{value:!0});Ua.ConversationRestartStreamRequest$=Ua.ConversationRestartStreamRequest$outboundSchema=Ua.ConversationRestartStreamRequest$inboundSchema=Ua.ConversationRestartStreamRequestHandoffExecution$=Ua.ConversationRestartStreamRequestHandoffExecution$outboundSchema=Ua.ConversationRestartStreamRequestHandoffExecution$inboundSchema=Ua.ConversationRestartStreamRequestHandoffExecution=void 0;Ua.conversationRestartStreamRequestToJSON=EIo;Ua.conversationRestartStreamRequestFromJSON=PIo;var KD=TIo(ae()),eIr=ce(),OIo=te(),tIr=x0(),rIr=Kq();Ua.ConversationRestartStreamRequestHandoffExecution={Client:"client",Server:"server"};Ua.ConversationRestartStreamRequestHandoffExecution$inboundSchema=KD.nativeEnum(Ua.ConversationRestartStreamRequestHandoffExecution);Ua.ConversationRestartStreamRequestHandoffExecution$outboundSchema=Ua.ConversationRestartStreamRequestHandoffExecution$inboundSchema;var YRr;(function(t){t.inboundSchema=Ua.ConversationRestartStreamRequestHandoffExecution$inboundSchema,t.outboundSchema=Ua.ConversationRestartStreamRequestHandoffExecution$outboundSchema})(YRr||(Ua.ConversationRestartStreamRequestHandoffExecution$=YRr={}));Ua.ConversationRestartStreamRequest$inboundSchema=KD.object({inputs:rIr.ConversationInputs$inboundSchema,stream:KD.boolean().default(!0),store:KD.boolean().default(!0),handoff_execution:Ua.ConversationRestartStreamRequestHandoffExecution$inboundSchema.default("server"),completion_args:tIr.CompletionArgs$inboundSchema.optional(),from_entry_id:KD.string()}).transform(t=>(0,eIr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",from_entry_id:"fromEntryId"}));Ua.ConversationRestartStreamRequest$outboundSchema=KD.object({inputs:rIr.ConversationInputs$outboundSchema,stream:KD.boolean().default(!0),store:KD.boolean().default(!0),handoffExecution:Ua.ConversationRestartStreamRequestHandoffExecution$outboundSchema.default("server"),completionArgs:tIr.CompletionArgs$outboundSchema.optional(),fromEntryId:KD.string()}).transform(t=>(0,eIr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",fromEntryId:"from_entry_id"}));var QRr;(function(t){t.inboundSchema=Ua.ConversationRestartStreamRequest$inboundSchema,t.outboundSchema=Ua.ConversationRestartStreamRequest$outboundSchema})(QRr||(Ua.ConversationRestartStreamRequest$=QRr={}));function EIo(t){return JSON.stringify(Ua.ConversationRestartStreamRequest$outboundSchema.parse(t))}function PIo(t){return(0,OIo.safeParse)(t,e=>Ua.ConversationRestartStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationRestartStreamRequest' from JSON")}});var dIr=S(xo=>{"use strict";var MIo=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]}),RIo=xo&&xo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IIo=xo&&xo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&MIo(r,e,n[o]);return RIo(r,e),r}}();Object.defineProperty(xo,"__esModule",{value:!0});xo.ConversationStreamRequest$=xo.ConversationStreamRequest$outboundSchema=xo.ConversationStreamRequest$inboundSchema=xo.ConversationStreamRequestTools$=xo.ConversationStreamRequestTools$outboundSchema=xo.ConversationStreamRequestTools$inboundSchema=xo.ConversationStreamRequestHandoffExecution$=xo.ConversationStreamRequestHandoffExecution$outboundSchema=xo.ConversationStreamRequestHandoffExecution$inboundSchema=xo.ConversationStreamRequestHandoffExecution=void 0;xo.conversationStreamRequestToolsToJSON=AIo;xo.conversationStreamRequestToolsFromJSON=NIo;xo.conversationStreamRequestToJSON=DIo;xo.conversationStreamRequestFromJSON=jIo;var _t=IIo(ae()),sIr=ce(),uIr=te(),nIe=jq(),lIr=x0(),cIr=Kq(),oIe=Fq(),iIe=kq(),aIe=qq(),sIe=Bq(),uIe=Uq();xo.ConversationStreamRequestHandoffExecution={Client:"client",Server:"server"};xo.ConversationStreamRequestHandoffExecution$inboundSchema=_t.nativeEnum(xo.ConversationStreamRequestHandoffExecution);xo.ConversationStreamRequestHandoffExecution$outboundSchema=xo.ConversationStreamRequestHandoffExecution$inboundSchema;var oIr;(function(t){t.inboundSchema=xo.ConversationStreamRequestHandoffExecution$inboundSchema,t.outboundSchema=xo.ConversationStreamRequestHandoffExecution$outboundSchema})(oIr||(xo.ConversationStreamRequestHandoffExecution$=oIr={}));xo.ConversationStreamRequestTools$inboundSchema=_t.union([oIe.DocumentLibraryTool$inboundSchema.and(_t.object({type:_t.literal("document_library")}).transform(t=>({type:t.type}))),iIe.FunctionTool$inboundSchema.and(_t.object({type:_t.literal("function")}).transform(t=>({type:t.type}))),nIe.CodeInterpreterTool$inboundSchema.and(_t.object({type:_t.literal("code_interpreter")}).transform(t=>({type:t.type}))),aIe.ImageGenerationTool$inboundSchema.and(_t.object({type:_t.literal("image_generation")}).transform(t=>({type:t.type}))),uIe.WebSearchTool$inboundSchema.and(_t.object({type:_t.literal("web_search")}).transform(t=>({type:t.type}))),sIe.WebSearchPremiumTool$inboundSchema.and(_t.object({type:_t.literal("web_search_premium")}).transform(t=>({type:t.type})))]);xo.ConversationStreamRequestTools$outboundSchema=_t.union([oIe.DocumentLibraryTool$outboundSchema.and(_t.object({type:_t.literal("document_library")}).transform(t=>({type:t.type}))),iIe.FunctionTool$outboundSchema.and(_t.object({type:_t.literal("function")}).transform(t=>({type:t.type}))),nIe.CodeInterpreterTool$outboundSchema.and(_t.object({type:_t.literal("code_interpreter")}).transform(t=>({type:t.type}))),aIe.ImageGenerationTool$outboundSchema.and(_t.object({type:_t.literal("image_generation")}).transform(t=>({type:t.type}))),uIe.WebSearchTool$outboundSchema.and(_t.object({type:_t.literal("web_search")}).transform(t=>({type:t.type}))),sIe.WebSearchPremiumTool$outboundSchema.and(_t.object({type:_t.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var iIr;(function(t){t.inboundSchema=xo.ConversationStreamRequestTools$inboundSchema,t.outboundSchema=xo.ConversationStreamRequestTools$outboundSchema})(iIr||(xo.ConversationStreamRequestTools$=iIr={}));function AIo(t){return JSON.stringify(xo.ConversationStreamRequestTools$outboundSchema.parse(t))}function NIo(t){return(0,uIr.safeParse)(t,e=>xo.ConversationStreamRequestTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationStreamRequestTools' from JSON")}xo.ConversationStreamRequest$inboundSchema=_t.object({inputs:cIr.ConversationInputs$inboundSchema,stream:_t.boolean().default(!0),store:_t.nullable(_t.boolean()).optional(),handoff_execution:_t.nullable(xo.ConversationStreamRequestHandoffExecution$inboundSchema).optional(),instructions:_t.nullable(_t.string()).optional(),tools:_t.nullable(_t.array(_t.union([oIe.DocumentLibraryTool$inboundSchema.and(_t.object({type:_t.literal("document_library")}).transform(t=>({type:t.type}))),iIe.FunctionTool$inboundSchema.and(_t.object({type:_t.literal("function")}).transform(t=>({type:t.type}))),nIe.CodeInterpreterTool$inboundSchema.and(_t.object({type:_t.literal("code_interpreter")}).transform(t=>({type:t.type}))),aIe.ImageGenerationTool$inboundSchema.and(_t.object({type:_t.literal("image_generation")}).transform(t=>({type:t.type}))),uIe.WebSearchTool$inboundSchema.and(_t.object({type:_t.literal("web_search")}).transform(t=>({type:t.type}))),sIe.WebSearchPremiumTool$inboundSchema.and(_t.object({type:_t.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completion_args:_t.nullable(lIr.CompletionArgs$inboundSchema).optional(),name:_t.nullable(_t.string()).optional(),description:_t.nullable(_t.string()).optional(),agent_id:_t.nullable(_t.string()).optional(),model:_t.nullable(_t.string()).optional()}).transform(t=>(0,sIr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",agent_id:"agentId"}));xo.ConversationStreamRequest$outboundSchema=_t.object({inputs:cIr.ConversationInputs$outboundSchema,stream:_t.boolean().default(!0),store:_t.nullable(_t.boolean()).optional(),handoffExecution:_t.nullable(xo.ConversationStreamRequestHandoffExecution$outboundSchema).optional(),instructions:_t.nullable(_t.string()).optional(),tools:_t.nullable(_t.array(_t.union([oIe.DocumentLibraryTool$outboundSchema.and(_t.object({type:_t.literal("document_library")}).transform(t=>({type:t.type}))),iIe.FunctionTool$outboundSchema.and(_t.object({type:_t.literal("function")}).transform(t=>({type:t.type}))),nIe.CodeInterpreterTool$outboundSchema.and(_t.object({type:_t.literal("code_interpreter")}).transform(t=>({type:t.type}))),aIe.ImageGenerationTool$outboundSchema.and(_t.object({type:_t.literal("image_generation")}).transform(t=>({type:t.type}))),uIe.WebSearchTool$outboundSchema.and(_t.object({type:_t.literal("web_search")}).transform(t=>({type:t.type}))),sIe.WebSearchPremiumTool$outboundSchema.and(_t.object({type:_t.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completionArgs:_t.nullable(lIr.CompletionArgs$outboundSchema).optional(),name:_t.nullable(_t.string()).optional(),description:_t.nullable(_t.string()).optional(),agentId:_t.nullable(_t.string()).optional(),model:_t.nullable(_t.string()).optional()}).transform(t=>(0,sIr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",agentId:"agent_id"}));var aIr;(function(t){t.inboundSchema=xo.ConversationStreamRequest$inboundSchema,t.outboundSchema=xo.ConversationStreamRequest$outboundSchema})(aIr||(xo.ConversationStreamRequest$=aIr={}));function DIo(t){return JSON.stringify(xo.ConversationStreamRequest$outboundSchema.parse(t))}function jIo(t){return(0,uIr.safeParse)(t,e=>xo.ConversationStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationStreamRequest' from JSON")}});var pIr=S(Lf=>{"use strict";var $Io=Lf&&Lf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LIo=Lf&&Lf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FIo=Lf&&Lf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$Io(r,e,n[o]);return LIo(r,e),r}}();Object.defineProperty(Lf,"__esModule",{value:!0});Lf.DeleteFileOut$=Lf.DeleteFileOut$outboundSchema=Lf.DeleteFileOut$inboundSchema=void 0;Lf.deleteFileOutToJSON=qIo;Lf.deleteFileOutFromJSON=BIo;var Gq=FIo(ae()),kIo=te();Lf.DeleteFileOut$inboundSchema=Gq.object({id:Gq.string(),object:Gq.string(),deleted:Gq.boolean()});Lf.DeleteFileOut$outboundSchema=Gq.object({id:Gq.string(),object:Gq.string(),deleted:Gq.boolean()});var fIr;(function(t){t.inboundSchema=Lf.DeleteFileOut$inboundSchema,t.outboundSchema=Lf.DeleteFileOut$outboundSchema})(fIr||(Lf.DeleteFileOut$=fIr={}));function qIo(t){return JSON.stringify(Lf.DeleteFileOut$outboundSchema.parse(t))}function BIo(t){return(0,kIo.safeParse)(t,e=>Lf.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var hIr=S(Ff=>{"use strict";var UIo=Ff&&Ff.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zIo=Ff&&Ff.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VIo=Ff&&Ff.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&UIo(r,e,n[o]);return zIo(r,e),r}}();Object.defineProperty(Ff,"__esModule",{value:!0});Ff.DeleteModelOut$=Ff.DeleteModelOut$outboundSchema=Ff.DeleteModelOut$inboundSchema=void 0;Ff.deleteModelOutToJSON=WIo;Ff.deleteModelOutFromJSON=JIo;var Xq=VIo(ae()),HIo=te();Ff.DeleteModelOut$inboundSchema=Xq.object({id:Xq.string(),object:Xq.string().default("model"),deleted:Xq.boolean().default(!0)});Ff.DeleteModelOut$outboundSchema=Xq.object({id:Xq.string(),object:Xq.string().default("model"),deleted:Xq.boolean().default(!0)});var mIr;(function(t){t.inboundSchema=Ff.DeleteModelOut$inboundSchema,t.outboundSchema=Ff.DeleteModelOut$outboundSchema})(mIr||(Ff.DeleteModelOut$=mIr={}));function WIo(t){return JSON.stringify(Ff.DeleteModelOut$outboundSchema.parse(t))}function JIo(t){return(0,HIo.safeParse)(t,e=>Ff.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var gct=S(kf=>{"use strict";var KIo=kf&&kf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GIo=kf&&kf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XIo=kf&&kf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&KIo(r,e,n[o]);return GIo(r,e),r}}();Object.defineProperty(kf,"__esModule",{value:!0});kf.DocumentOut$=kf.DocumentOut$outboundSchema=kf.DocumentOut$inboundSchema=void 0;kf.documentOutToJSON=YIo;kf.documentOutFromJSON=QIo;var To=XIo(ae()),yIr=ce(),ZIo=te();kf.DocumentOut$inboundSchema=To.object({id:To.string(),library_id:To.string(),hash:To.string(),mime_type:To.string(),extension:To.string(),size:To.number().int(),name:To.string(),summary:To.nullable(To.string()).optional(),created_at:To.string().datetime({offset:!0}).transform(t=>new Date(t)),last_processed_at:To.nullable(To.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),number_of_pages:To.nullable(To.number().int()).optional(),processing_status:To.string(),uploaded_by_id:To.string(),uploaded_by_type:To.string(),tokens_processing_main_content:To.nullable(To.number().int()).optional(),tokens_processing_summary:To.nullable(To.number().int()).optional(),tokens_processing_total:To.number().int()}).transform(t=>(0,yIr.remap)(t,{library_id:"libraryId",mime_type:"mimeType",created_at:"createdAt",last_processed_at:"lastProcessedAt",number_of_pages:"numberOfPages",processing_status:"processingStatus",uploaded_by_id:"uploadedById",uploaded_by_type:"uploadedByType",tokens_processing_main_content:"tokensProcessingMainContent",tokens_processing_summary:"tokensProcessingSummary",tokens_processing_total:"tokensProcessingTotal"}));kf.DocumentOut$outboundSchema=To.object({id:To.string(),libraryId:To.string(),hash:To.string(),mimeType:To.string(),extension:To.string(),size:To.number().int(),name:To.string(),summary:To.nullable(To.string()).optional(),createdAt:To.date().transform(t=>t.toISOString()),lastProcessedAt:To.nullable(To.date().transform(t=>t.toISOString())).optional(),numberOfPages:To.nullable(To.number().int()).optional(),processingStatus:To.string(),uploadedById:To.string(),uploadedByType:To.string(),tokensProcessingMainContent:To.nullable(To.number().int()).optional(),tokensProcessingSummary:To.nullable(To.number().int()).optional(),tokensProcessingTotal:To.number().int()}).transform(t=>(0,yIr.remap)(t,{libraryId:"library_id",mimeType:"mime_type",createdAt:"created_at",lastProcessedAt:"last_processed_at",numberOfPages:"number_of_pages",processingStatus:"processing_status",uploadedById:"uploaded_by_id",uploadedByType:"uploaded_by_type",tokensProcessingMainContent:"tokens_processing_main_content",tokensProcessingSummary:"tokens_processing_summary",tokensProcessingTotal:"tokens_processing_total"}));var gIr;(function(t){t.inboundSchema=kf.DocumentOut$inboundSchema,t.outboundSchema=kf.DocumentOut$outboundSchema})(gIr||(kf.DocumentOut$=gIr={}));function YIo(t){return JSON.stringify(kf.DocumentOut$outboundSchema.parse(t))}function QIo(t){return(0,ZIo.safeParse)(t,e=>kf.DocumentOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentOut' from JSON")}});var _Ir=S(qf=>{"use strict";var eAo=qf&&qf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tAo=qf&&qf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rAo=qf&&qf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eAo(r,e,n[o]);return tAo(r,e),r}}();Object.defineProperty(qf,"__esModule",{value:!0});qf.DocumentTextContent$=qf.DocumentTextContent$outboundSchema=qf.DocumentTextContent$inboundSchema=void 0;qf.documentTextContentToJSON=oAo;qf.documentTextContentFromJSON=iAo;var lIe=rAo(ae()),nAo=te();qf.DocumentTextContent$inboundSchema=lIe.object({text:lIe.string()});qf.DocumentTextContent$outboundSchema=lIe.object({text:lIe.string()});var bIr;(function(t){t.inboundSchema=qf.DocumentTextContent$inboundSchema,t.outboundSchema=qf.DocumentTextContent$outboundSchema})(bIr||(qf.DocumentTextContent$=bIr={}));function oAo(t){return JSON.stringify(qf.DocumentTextContent$outboundSchema.parse(t))}function iAo(t){return(0,nAo.safeParse)(t,e=>qf.DocumentTextContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentTextContent' from JSON")}});var wIr=S(Bf=>{"use strict";var aAo=Bf&&Bf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sAo=Bf&&Bf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uAo=Bf&&Bf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aAo(r,e,n[o]);return sAo(r,e),r}}();Object.defineProperty(Bf,"__esModule",{value:!0});Bf.DocumentUpdateIn$=Bf.DocumentUpdateIn$outboundSchema=Bf.DocumentUpdateIn$inboundSchema=void 0;Bf.documentUpdateInToJSON=cAo;Bf.documentUpdateInFromJSON=dAo;var f7=uAo(ae()),lAo=te();Bf.DocumentUpdateIn$inboundSchema=f7.object({name:f7.nullable(f7.string()).optional()});Bf.DocumentUpdateIn$outboundSchema=f7.object({name:f7.nullable(f7.string()).optional()});var vIr;(function(t){t.inboundSchema=Bf.DocumentUpdateIn$inboundSchema,t.outboundSchema=Bf.DocumentUpdateIn$outboundSchema})(vIr||(Bf.DocumentUpdateIn$=vIr={}));function cAo(t){return JSON.stringify(Bf.DocumentUpdateIn$outboundSchema.parse(t))}function dAo(t){return(0,lAo.safeParse)(t,e=>Bf.DocumentUpdateIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentUpdateIn' from JSON")}});var yct=S(Uf=>{"use strict";var fAo=Uf&&Uf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pAo=Uf&&Uf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mAo=Uf&&Uf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fAo(r,e,n[o]);return pAo(r,e),r}}();Object.defineProperty(Uf,"__esModule",{value:!0});Uf.EmbeddingDtype$=Uf.EmbeddingDtype$outboundSchema=Uf.EmbeddingDtype$inboundSchema=Uf.EmbeddingDtype=void 0;var hAo=mAo(ae());Uf.EmbeddingDtype={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"};Uf.EmbeddingDtype$inboundSchema=hAo.nativeEnum(Uf.EmbeddingDtype);Uf.EmbeddingDtype$outboundSchema=Uf.EmbeddingDtype$inboundSchema;var SIr;(function(t){t.inboundSchema=Uf.EmbeddingDtype$inboundSchema,t.outboundSchema=Uf.EmbeddingDtype$outboundSchema})(SIr||(Uf.EmbeddingDtype$=SIr={}))});var bct=S(zf=>{"use strict";var gAo=zf&&zf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yAo=zf&&zf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bAo=zf&&zf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gAo(r,e,n[o]);return yAo(r,e),r}}();Object.defineProperty(zf,"__esModule",{value:!0});zf.EncodingFormat$=zf.EncodingFormat$outboundSchema=zf.EncodingFormat$inboundSchema=zf.EncodingFormat=void 0;var _Ao=bAo(ae());zf.EncodingFormat={Float:"float",Base64:"base64"};zf.EncodingFormat$inboundSchema=_Ao.nativeEnum(zf.EncodingFormat);zf.EncodingFormat$outboundSchema=zf.EncodingFormat$inboundSchema;var CIr;(function(t){t.inboundSchema=zf.EncodingFormat$inboundSchema,t.outboundSchema=zf.EncodingFormat$outboundSchema})(CIr||(zf.EncodingFormat$=CIr={}))});var RIr=S(ws=>{"use strict";var vAo=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]}),wAo=ws&&ws.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SAo=ws&&ws.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vAo(r,e,n[o]);return wAo(r,e),r}}();Object.defineProperty(ws,"__esModule",{value:!0});ws.EmbeddingRequest$=ws.EmbeddingRequest$outboundSchema=ws.EmbeddingRequest$inboundSchema=ws.EmbeddingRequestInputs$=ws.EmbeddingRequestInputs$outboundSchema=ws.EmbeddingRequestInputs$inboundSchema=void 0;ws.embeddingRequestInputsToJSON=CAo;ws.embeddingRequestInputsFromJSON=xAo;ws.embeddingRequestToJSON=TAo;ws.embeddingRequestFromJSON=OAo;var ic=SAo(ae()),OIr=ce(),EIr=te(),PIr=yct(),MIr=bct();ws.EmbeddingRequestInputs$inboundSchema=ic.union([ic.string(),ic.array(ic.string())]);ws.EmbeddingRequestInputs$outboundSchema=ic.union([ic.string(),ic.array(ic.string())]);var xIr;(function(t){t.inboundSchema=ws.EmbeddingRequestInputs$inboundSchema,t.outboundSchema=ws.EmbeddingRequestInputs$outboundSchema})(xIr||(ws.EmbeddingRequestInputs$=xIr={}));function CAo(t){return JSON.stringify(ws.EmbeddingRequestInputs$outboundSchema.parse(t))}function xAo(t){return(0,EIr.safeParse)(t,e=>ws.EmbeddingRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequestInputs' from JSON")}ws.EmbeddingRequest$inboundSchema=ic.object({model:ic.string(),input:ic.union([ic.string(),ic.array(ic.string())]),output_dimension:ic.nullable(ic.number().int()).optional(),output_dtype:PIr.EmbeddingDtype$inboundSchema.optional(),encoding_format:MIr.EncodingFormat$inboundSchema.optional()}).transform(t=>(0,OIr.remap)(t,{input:"inputs",output_dimension:"outputDimension",output_dtype:"outputDtype",encoding_format:"encodingFormat"}));ws.EmbeddingRequest$outboundSchema=ic.object({model:ic.string(),inputs:ic.union([ic.string(),ic.array(ic.string())]),outputDimension:ic.nullable(ic.number().int()).optional(),outputDtype:PIr.EmbeddingDtype$outboundSchema.optional(),encodingFormat:MIr.EncodingFormat$outboundSchema.optional()}).transform(t=>(0,OIr.remap)(t,{inputs:"input",outputDimension:"output_dimension",outputDtype:"output_dtype",encodingFormat:"encoding_format"}));var TIr;(function(t){t.inboundSchema=ws.EmbeddingRequest$inboundSchema,t.outboundSchema=ws.EmbeddingRequest$outboundSchema})(TIr||(ws.EmbeddingRequest$=TIr={}));function TAo(t){return JSON.stringify(ws.EmbeddingRequest$outboundSchema.parse(t))}function OAo(t){return(0,EIr.safeParse)(t,e=>ws.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var _ct=S(Vf=>{"use strict";var EAo=Vf&&Vf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PAo=Vf&&Vf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MAo=Vf&&Vf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&EAo(r,e,n[o]);return PAo(r,e),r}}();Object.defineProperty(Vf,"__esModule",{value:!0});Vf.EmbeddingResponseData$=Vf.EmbeddingResponseData$outboundSchema=Vf.EmbeddingResponseData$inboundSchema=void 0;Vf.embeddingResponseDataToJSON=IAo;Vf.embeddingResponseDataFromJSON=AAo;var RA=MAo(ae()),RAo=te();Vf.EmbeddingResponseData$inboundSchema=RA.object({object:RA.string().optional(),embedding:RA.array(RA.number()).optional(),index:RA.number().int().optional()});Vf.EmbeddingResponseData$outboundSchema=RA.object({object:RA.string().optional(),embedding:RA.array(RA.number()).optional(),index:RA.number().int().optional()});var IIr;(function(t){t.inboundSchema=Vf.EmbeddingResponseData$inboundSchema,t.outboundSchema=Vf.EmbeddingResponseData$outboundSchema})(IIr||(Vf.EmbeddingResponseData$=IIr={}));function IAo(t){return JSON.stringify(Vf.EmbeddingResponseData$outboundSchema.parse(t))}function AAo(t){return(0,RAo.safeParse)(t,e=>Vf.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var jIr=S(Hf=>{"use strict";var NAo=Hf&&Hf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DAo=Hf&&Hf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jAo=Hf&&Hf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&NAo(r,e,n[o]);return DAo(r,e),r}}();Object.defineProperty(Hf,"__esModule",{value:!0});Hf.EmbeddingResponse$=Hf.EmbeddingResponse$outboundSchema=Hf.EmbeddingResponse$inboundSchema=void 0;Hf.embeddingResponseToJSON=LAo;Hf.embeddingResponseFromJSON=FAo;var IA=jAo(ae()),$Ao=te(),NIr=_ct(),DIr=Wq();Hf.EmbeddingResponse$inboundSchema=IA.object({id:IA.string(),object:IA.string(),model:IA.string(),usage:DIr.UsageInfo$inboundSchema,data:IA.array(NIr.EmbeddingResponseData$inboundSchema)});Hf.EmbeddingResponse$outboundSchema=IA.object({id:IA.string(),object:IA.string(),model:IA.string(),usage:DIr.UsageInfo$outboundSchema,data:IA.array(NIr.EmbeddingResponseData$outboundSchema)});var AIr;(function(t){t.inboundSchema=Hf.EmbeddingResponse$inboundSchema,t.outboundSchema=Hf.EmbeddingResponse$outboundSchema})(AIr||(Hf.EmbeddingResponse$=AIr={}));function LAo(t){return JSON.stringify(Hf.EmbeddingResponse$outboundSchema.parse(t))}function FAo(t){return(0,$Ao.safeParse)(t,e=>Hf.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var cIe=S(Wf=>{"use strict";var kAo=Wf&&Wf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qAo=Wf&&Wf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BAo=Wf&&Wf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kAo(r,e,n[o]);return qAo(r,e),r}}();Object.defineProperty(Wf,"__esModule",{value:!0});Wf.EntityType$=Wf.EntityType$outboundSchema=Wf.EntityType$inboundSchema=Wf.EntityType=void 0;var aW=BAo(ae()),UAo=kx();Wf.EntityType={User:"User",Workspace:"Workspace",Org:"Org"};Wf.EntityType$inboundSchema=aW.union([aW.nativeEnum(Wf.EntityType),aW.string().transform(UAo.catchUnrecognizedEnum)]);Wf.EntityType$outboundSchema=aW.union([aW.nativeEnum(Wf.EntityType),aW.string().and(aW.custom())]);var $Ir;(function(t){t.inboundSchema=Wf.EntityType$inboundSchema,t.outboundSchema=Wf.EntityType$outboundSchema})($Ir||(Wf.EntityType$=$Ir={}))});var _se=S(Jf=>{"use strict";var zAo=Jf&&Jf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VAo=Jf&&Jf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HAo=Jf&&Jf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zAo(r,e,n[o]);return VAo(r,e),r}}();Object.defineProperty(Jf,"__esModule",{value:!0});Jf.FilePurpose$=Jf.FilePurpose$outboundSchema=Jf.FilePurpose$inboundSchema=Jf.FilePurpose=void 0;var sW=HAo(ae()),WAo=kx();Jf.FilePurpose={FineTune:"fine-tune",Batch:"batch",Ocr:"ocr"};Jf.FilePurpose$inboundSchema=sW.union([sW.nativeEnum(Jf.FilePurpose),sW.string().transform(WAo.catchUnrecognizedEnum)]);Jf.FilePurpose$outboundSchema=sW.union([sW.nativeEnum(Jf.FilePurpose),sW.string().and(sW.custom())]);var LIr;(function(t){t.inboundSchema=Jf.FilePurpose$inboundSchema,t.outboundSchema=Jf.FilePurpose$outboundSchema})(LIr||(Jf.FilePurpose$=LIr={}))});var vse=S(Kf=>{"use strict";var JAo=Kf&&Kf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KAo=Kf&&Kf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GAo=Kf&&Kf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&JAo(r,e,n[o]);return KAo(r,e),r}}();Object.defineProperty(Kf,"__esModule",{value:!0});Kf.SampleType$=Kf.SampleType$outboundSchema=Kf.SampleType$inboundSchema=Kf.SampleType=void 0;var uW=GAo(ae()),XAo=kx();Kf.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};Kf.SampleType$inboundSchema=uW.union([uW.nativeEnum(Kf.SampleType),uW.string().transform(XAo.catchUnrecognizedEnum)]);Kf.SampleType$outboundSchema=uW.union([uW.nativeEnum(Kf.SampleType),uW.string().and(uW.custom())]);var FIr;(function(t){t.inboundSchema=Kf.SampleType$inboundSchema,t.outboundSchema=Kf.SampleType$outboundSchema})(FIr||(Kf.SampleType$=FIr={}))});var wse=S(Gf=>{"use strict";var ZAo=Gf&&Gf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YAo=Gf&&Gf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QAo=Gf&&Gf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ZAo(r,e,n[o]);return YAo(r,e),r}}();Object.defineProperty(Gf,"__esModule",{value:!0});Gf.Source$=Gf.Source$outboundSchema=Gf.Source$inboundSchema=Gf.Source=void 0;var lW=QAo(ae()),eNo=kx();Gf.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};Gf.Source$inboundSchema=lW.union([lW.nativeEnum(Gf.Source),lW.string().transform(eNo.catchUnrecognizedEnum)]);Gf.Source$outboundSchema=lW.union([lW.nativeEnum(Gf.Source),lW.string().and(lW.custom())]);var kIr;(function(t){t.inboundSchema=Gf.Source$inboundSchema,t.outboundSchema=Gf.Source$outboundSchema})(kIr||(Gf.Source$=kIr={}))});var vct=S(Xf=>{"use strict";var tNo=Xf&&Xf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rNo=Xf&&Xf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nNo=Xf&&Xf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tNo(r,e,n[o]);return rNo(r,e),r}}();Object.defineProperty(Xf,"__esModule",{value:!0});Xf.FileSchema$=Xf.FileSchema$outboundSchema=Xf.FileSchema$inboundSchema=void 0;Xf.fileSchemaToJSON=iNo;Xf.fileSchemaFromJSON=aNo;var ac=nNo(ae()),BIr=ce(),oNo=te(),UIr=_se(),zIr=vse(),VIr=wse();Xf.FileSchema$inboundSchema=ac.object({id:ac.string(),object:ac.string(),bytes:ac.number().int(),created_at:ac.number().int(),filename:ac.string(),purpose:UIr.FilePurpose$inboundSchema,sample_type:zIr.SampleType$inboundSchema,num_lines:ac.nullable(ac.number().int()).optional(),mimetype:ac.nullable(ac.string()).optional(),source:VIr.Source$inboundSchema,signature:ac.nullable(ac.string()).optional()}).transform(t=>(0,BIr.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Xf.FileSchema$outboundSchema=ac.object({id:ac.string(),object:ac.string(),sizeBytes:ac.number().int(),createdAt:ac.number().int(),filename:ac.string(),purpose:UIr.FilePurpose$outboundSchema,sampleType:zIr.SampleType$outboundSchema,numLines:ac.nullable(ac.number().int()).optional(),mimetype:ac.nullable(ac.string()).optional(),source:VIr.Source$outboundSchema,signature:ac.nullable(ac.string()).optional()}).transform(t=>(0,BIr.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var qIr;(function(t){t.inboundSchema=Xf.FileSchema$inboundSchema,t.outboundSchema=Xf.FileSchema$outboundSchema})(qIr||(Xf.FileSchema$=qIr={}));function iNo(t){return JSON.stringify(Xf.FileSchema$outboundSchema.parse(t))}function aNo(t){return(0,oNo.safeParse)(t,e=>Xf.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var WIr=S(Zf=>{"use strict";var sNo=Zf&&Zf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uNo=Zf&&Zf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lNo=Zf&&Zf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sNo(r,e,n[o]);return uNo(r,e),r}}();Object.defineProperty(Zf,"__esModule",{value:!0});Zf.FileSignedURL$=Zf.FileSignedURL$outboundSchema=Zf.FileSignedURL$inboundSchema=void 0;Zf.fileSignedURLToJSON=dNo;Zf.fileSignedURLFromJSON=fNo;var dIe=lNo(ae()),cNo=te();Zf.FileSignedURL$inboundSchema=dIe.object({url:dIe.string()});Zf.FileSignedURL$outboundSchema=dIe.object({url:dIe.string()});var HIr;(function(t){t.inboundSchema=Zf.FileSignedURL$inboundSchema,t.outboundSchema=Zf.FileSignedURL$outboundSchema})(HIr||(Zf.FileSignedURL$=HIr={}));function dNo(t){return JSON.stringify(Zf.FileSignedURL$outboundSchema.parse(t))}function fNo(t){return(0,cNo.safeParse)(t,e=>Zf.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var ZIr=S(Ss=>{"use strict";var pNo=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]}),mNo=Ss&&Ss.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hNo=Ss&&Ss.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pNo(r,e,n[o]);return mNo(r,e),r}}();Object.defineProperty(Ss,"__esModule",{value:!0});Ss.FIMCompletionRequest$=Ss.FIMCompletionRequest$outboundSchema=Ss.FIMCompletionRequest$inboundSchema=Ss.FIMCompletionRequestStop$=Ss.FIMCompletionRequestStop$outboundSchema=Ss.FIMCompletionRequestStop$inboundSchema=void 0;Ss.fimCompletionRequestStopToJSON=gNo;Ss.fimCompletionRequestStopFromJSON=yNo;Ss.fimCompletionRequestToJSON=bNo;Ss.fimCompletionRequestFromJSON=_No;var Oo=hNo(ae()),GIr=ce(),XIr=te();Ss.FIMCompletionRequestStop$inboundSchema=Oo.union([Oo.string(),Oo.array(Oo.string())]);Ss.FIMCompletionRequestStop$outboundSchema=Oo.union([Oo.string(),Oo.array(Oo.string())]);var JIr;(function(t){t.inboundSchema=Ss.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=Ss.FIMCompletionRequestStop$outboundSchema})(JIr||(Ss.FIMCompletionRequestStop$=JIr={}));function gNo(t){return JSON.stringify(Ss.FIMCompletionRequestStop$outboundSchema.parse(t))}function yNo(t){return(0,XIr.safeParse)(t,e=>Ss.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}Ss.FIMCompletionRequest$inboundSchema=Oo.object({model:Oo.string(),temperature:Oo.nullable(Oo.number()).optional(),top_p:Oo.number().default(1),max_tokens:Oo.nullable(Oo.number().int()).optional(),stream:Oo.boolean().default(!1),stop:Oo.union([Oo.string(),Oo.array(Oo.string())]).optional(),random_seed:Oo.nullable(Oo.number().int()).optional(),prompt:Oo.string(),suffix:Oo.nullable(Oo.string()).optional(),min_tokens:Oo.nullable(Oo.number().int()).optional()}).transform(t=>(0,GIr.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));Ss.FIMCompletionRequest$outboundSchema=Oo.object({model:Oo.string(),temperature:Oo.nullable(Oo.number()).optional(),topP:Oo.number().default(1),maxTokens:Oo.nullable(Oo.number().int()).optional(),stream:Oo.boolean().default(!1),stop:Oo.union([Oo.string(),Oo.array(Oo.string())]).optional(),randomSeed:Oo.nullable(Oo.number().int()).optional(),prompt:Oo.string(),suffix:Oo.nullable(Oo.string()).optional(),minTokens:Oo.nullable(Oo.number().int()).optional()}).transform(t=>(0,GIr.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var KIr;(function(t){t.inboundSchema=Ss.FIMCompletionRequest$inboundSchema,t.outboundSchema=Ss.FIMCompletionRequest$outboundSchema})(KIr||(Ss.FIMCompletionRequest$=KIr={}));function bNo(t){return JSON.stringify(Ss.FIMCompletionRequest$outboundSchema.parse(t))}function _No(t){return(0,XIr.safeParse)(t,e=>Ss.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var tAr=S(Yf=>{"use strict";var vNo=Yf&&Yf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wNo=Yf&&Yf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SNo=Yf&&Yf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vNo(r,e,n[o]);return wNo(r,e),r}}();Object.defineProperty(Yf,"__esModule",{value:!0});Yf.FIMCompletionResponse$=Yf.FIMCompletionResponse$outboundSchema=Yf.FIMCompletionResponse$inboundSchema=void 0;Yf.fimCompletionResponseToJSON=xNo;Yf.fimCompletionResponseFromJSON=TNo;var j0=SNo(ae()),CNo=te(),QIr=KMe(),eAr=Wq();Yf.FIMCompletionResponse$inboundSchema=j0.object({id:j0.string(),object:j0.string(),model:j0.string(),usage:eAr.UsageInfo$inboundSchema,created:j0.number().int(),choices:j0.array(QIr.ChatCompletionChoice$inboundSchema)});Yf.FIMCompletionResponse$outboundSchema=j0.object({id:j0.string(),object:j0.string(),model:j0.string(),usage:eAr.UsageInfo$outboundSchema,created:j0.number().int(),choices:j0.array(QIr.ChatCompletionChoice$outboundSchema)});var YIr;(function(t){t.inboundSchema=Yf.FIMCompletionResponse$inboundSchema,t.outboundSchema=Yf.FIMCompletionResponse$outboundSchema})(YIr||(Yf.FIMCompletionResponse$=YIr={}));function xNo(t){return JSON.stringify(Yf.FIMCompletionResponse$outboundSchema.parse(t))}function TNo(t){return(0,CNo.safeParse)(t,e=>Yf.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var aAr=S(Cs=>{"use strict";var ONo=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]}),ENo=Cs&&Cs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PNo=Cs&&Cs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ONo(r,e,n[o]);return ENo(r,e),r}}();Object.defineProperty(Cs,"__esModule",{value:!0});Cs.FIMCompletionStreamRequest$=Cs.FIMCompletionStreamRequest$outboundSchema=Cs.FIMCompletionStreamRequest$inboundSchema=Cs.FIMCompletionStreamRequestStop$=Cs.FIMCompletionStreamRequestStop$outboundSchema=Cs.FIMCompletionStreamRequestStop$inboundSchema=void 0;Cs.fimCompletionStreamRequestStopToJSON=MNo;Cs.fimCompletionStreamRequestStopFromJSON=RNo;Cs.fimCompletionStreamRequestToJSON=INo;Cs.fimCompletionStreamRequestFromJSON=ANo;var Eo=PNo(ae()),oAr=ce(),iAr=te();Cs.FIMCompletionStreamRequestStop$inboundSchema=Eo.union([Eo.string(),Eo.array(Eo.string())]);Cs.FIMCompletionStreamRequestStop$outboundSchema=Eo.union([Eo.string(),Eo.array(Eo.string())]);var rAr;(function(t){t.inboundSchema=Cs.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Cs.FIMCompletionStreamRequestStop$outboundSchema})(rAr||(Cs.FIMCompletionStreamRequestStop$=rAr={}));function MNo(t){return JSON.stringify(Cs.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function RNo(t){return(0,iAr.safeParse)(t,e=>Cs.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}Cs.FIMCompletionStreamRequest$inboundSchema=Eo.object({model:Eo.string(),temperature:Eo.nullable(Eo.number()).optional(),top_p:Eo.number().default(1),max_tokens:Eo.nullable(Eo.number().int()).optional(),stream:Eo.boolean().default(!0),stop:Eo.union([Eo.string(),Eo.array(Eo.string())]).optional(),random_seed:Eo.nullable(Eo.number().int()).optional(),prompt:Eo.string(),suffix:Eo.nullable(Eo.string()).optional(),min_tokens:Eo.nullable(Eo.number().int()).optional()}).transform(t=>(0,oAr.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));Cs.FIMCompletionStreamRequest$outboundSchema=Eo.object({model:Eo.string(),temperature:Eo.nullable(Eo.number()).optional(),topP:Eo.number().default(1),maxTokens:Eo.nullable(Eo.number().int()).optional(),stream:Eo.boolean().default(!0),stop:Eo.union([Eo.string(),Eo.array(Eo.string())]).optional(),randomSeed:Eo.nullable(Eo.number().int()).optional(),prompt:Eo.string(),suffix:Eo.nullable(Eo.string()).optional(),minTokens:Eo.nullable(Eo.number().int()).optional()}).transform(t=>(0,oAr.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var nAr;(function(t){t.inboundSchema=Cs.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=Cs.FIMCompletionStreamRequest$outboundSchema})(nAr||(Cs.FIMCompletionStreamRequest$=nAr={}));function INo(t){return JSON.stringify(Cs.FIMCompletionStreamRequest$outboundSchema.parse(t))}function ANo(t){return(0,iAr.safeParse)(t,e=>Cs.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var wct=S(Qf=>{"use strict";var NNo=Qf&&Qf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DNo=Qf&&Qf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jNo=Qf&&Qf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&NNo(r,e,n[o]);return DNo(r,e),r}}();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.FineTuneableModelType$=Qf.FineTuneableModelType$outboundSchema=Qf.FineTuneableModelType$inboundSchema=Qf.FineTuneableModelType=void 0;var $No=jNo(ae());Qf.FineTuneableModelType={Completion:"completion",Classifier:"classifier"};Qf.FineTuneableModelType$inboundSchema=$No.nativeEnum(Qf.FineTuneableModelType);Qf.FineTuneableModelType$outboundSchema=Qf.FineTuneableModelType$inboundSchema;var sAr;(function(t){t.inboundSchema=Qf.FineTuneableModelType$inboundSchema,t.outboundSchema=Qf.FineTuneableModelType$outboundSchema})(sAr||(Qf.FineTuneableModelType$=sAr={}))});var Sct=S(xs=>{"use strict";var LNo=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]}),FNo=xs&&xs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kNo=xs&&xs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LNo(r,e,n[o]);return FNo(r,e),r}}();Object.defineProperty(xs,"__esModule",{value:!0});xs.FTModelCard$=xs.FTModelCard$outboundSchema=xs.FTModelCard$inboundSchema=xs.FTModelCardType$=xs.FTModelCardType$outboundSchema=xs.FTModelCardType$inboundSchema=xs.FTModelCardType=void 0;xs.ftModelCardToJSON=BNo;xs.ftModelCardFromJSON=UNo;var Fo=kNo(ae()),cAr=ce(),qNo=te(),dAr=FMe();xs.FTModelCardType={FineTuned:"fine-tuned"};xs.FTModelCardType$inboundSchema=Fo.nativeEnum(xs.FTModelCardType);xs.FTModelCardType$outboundSchema=xs.FTModelCardType$inboundSchema;var uAr;(function(t){t.inboundSchema=xs.FTModelCardType$inboundSchema,t.outboundSchema=xs.FTModelCardType$outboundSchema})(uAr||(xs.FTModelCardType$=uAr={}));xs.FTModelCard$inboundSchema=Fo.object({id:Fo.string(),object:Fo.string().default("model"),created:Fo.number().int().optional(),owned_by:Fo.string().default("mistralai"),capabilities:dAr.ModelCapabilities$inboundSchema,name:Fo.nullable(Fo.string()).optional(),description:Fo.nullable(Fo.string()).optional(),max_context_length:Fo.number().int().default(32768),aliases:Fo.array(Fo.string()).optional(),deprecation:Fo.nullable(Fo.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),deprecation_replacement_model:Fo.nullable(Fo.string()).optional(),default_model_temperature:Fo.nullable(Fo.number()).optional(),type:Fo.literal("fine-tuned").default("fine-tuned"),job:Fo.string(),root:Fo.string(),archived:Fo.boolean().default(!1)}).transform(t=>(0,cAr.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",deprecation_replacement_model:"deprecationReplacementModel",default_model_temperature:"defaultModelTemperature"}));xs.FTModelCard$outboundSchema=Fo.object({id:Fo.string(),object:Fo.string().default("model"),created:Fo.number().int().optional(),ownedBy:Fo.string().default("mistralai"),capabilities:dAr.ModelCapabilities$outboundSchema,name:Fo.nullable(Fo.string()).optional(),description:Fo.nullable(Fo.string()).optional(),maxContextLength:Fo.number().int().default(32768),aliases:Fo.array(Fo.string()).optional(),deprecation:Fo.nullable(Fo.date().transform(t=>t.toISOString())).optional(),deprecationReplacementModel:Fo.nullable(Fo.string()).optional(),defaultModelTemperature:Fo.nullable(Fo.number()).optional(),type:Fo.literal("fine-tuned").default("fine-tuned"),job:Fo.string(),root:Fo.string(),archived:Fo.boolean().default(!1)}).transform(t=>(0,cAr.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",deprecationReplacementModel:"deprecation_replacement_model",defaultModelTemperature:"default_model_temperature"}));var lAr;(function(t){t.inboundSchema=xs.FTModelCard$inboundSchema,t.outboundSchema=xs.FTModelCard$outboundSchema})(lAr||(xs.FTModelCard$=lAr={}));function BNo(t){return JSON.stringify(xs.FTModelCard$outboundSchema.parse(t))}function UNo(t){return(0,qNo.safeParse)(t,e=>xs.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var Cct=S(za=>{"use strict";var zNo=za&&za.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VNo=za&&za.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HNo=za&&za.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zNo(r,e,n[o]);return VNo(r,e),r}}();Object.defineProperty(za,"__esModule",{value:!0});za.GithubRepositoryIn$=za.GithubRepositoryIn$outboundSchema=za.GithubRepositoryIn$inboundSchema=za.GithubRepositoryInType$=za.GithubRepositoryInType$outboundSchema=za.GithubRepositoryInType$inboundSchema=za.GithubRepositoryInType=void 0;za.githubRepositoryInToJSON=JNo;za.githubRepositoryInFromJSON=KNo;var Zb=HNo(ae()),WNo=te();za.GithubRepositoryInType={Github:"github"};za.GithubRepositoryInType$inboundSchema=Zb.nativeEnum(za.GithubRepositoryInType);za.GithubRepositoryInType$outboundSchema=za.GithubRepositoryInType$inboundSchema;var fAr;(function(t){t.inboundSchema=za.GithubRepositoryInType$inboundSchema,t.outboundSchema=za.GithubRepositoryInType$outboundSchema})(fAr||(za.GithubRepositoryInType$=fAr={}));za.GithubRepositoryIn$inboundSchema=Zb.object({type:za.GithubRepositoryInType$inboundSchema.default("github"),name:Zb.string(),owner:Zb.string(),ref:Zb.nullable(Zb.string()).optional(),weight:Zb.number().default(1),token:Zb.string()});za.GithubRepositoryIn$outboundSchema=Zb.object({type:za.GithubRepositoryInType$outboundSchema.default("github"),name:Zb.string(),owner:Zb.string(),ref:Zb.nullable(Zb.string()).optional(),weight:Zb.number().default(1),token:Zb.string()});var pAr;(function(t){t.inboundSchema=za.GithubRepositoryIn$inboundSchema,t.outboundSchema=za.GithubRepositoryIn$outboundSchema})(pAr||(za.GithubRepositoryIn$=pAr={}));function JNo(t){return JSON.stringify(za.GithubRepositoryIn$outboundSchema.parse(t))}function KNo(t){return(0,WNo.safeParse)(t,e=>za.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var xct=S(ep=>{"use strict";var GNo=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]}),XNo=ep&&ep.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZNo=ep&&ep.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&GNo(r,e,n[o]);return XNo(r,e),r}}();Object.defineProperty(ep,"__esModule",{value:!0});ep.TrainingFile$=ep.TrainingFile$outboundSchema=ep.TrainingFile$inboundSchema=void 0;ep.trainingFileToJSON=QNo;ep.trainingFileFromJSON=e1o;var p7=ZNo(ae()),hAr=ce(),YNo=te();ep.TrainingFile$inboundSchema=p7.object({file_id:p7.string(),weight:p7.number().default(1)}).transform(t=>(0,hAr.remap)(t,{file_id:"fileId"}));ep.TrainingFile$outboundSchema=p7.object({fileId:p7.string(),weight:p7.number().default(1)}).transform(t=>(0,hAr.remap)(t,{fileId:"file_id"}));var mAr;(function(t){t.inboundSchema=ep.TrainingFile$inboundSchema,t.outboundSchema=ep.TrainingFile$outboundSchema})(mAr||(ep.TrainingFile$=mAr={}));function QNo(t){return JSON.stringify(ep.TrainingFile$outboundSchema.parse(t))}function e1o(t){return(0,YNo.safeParse)(t,e=>ep.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var Tct=S(Va=>{"use strict";var t1o=Va&&Va.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r1o=Va&&Va.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n1o=Va&&Va.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&t1o(r,e,n[o]);return r1o(r,e),r}}();Object.defineProperty(Va,"__esModule",{value:!0});Va.WandbIntegration$=Va.WandbIntegration$outboundSchema=Va.WandbIntegration$inboundSchema=Va.WandbIntegrationType$=Va.WandbIntegrationType$outboundSchema=Va.WandbIntegrationType$inboundSchema=Va.WandbIntegrationType=void 0;Va.wandbIntegrationToJSON=i1o;Va.wandbIntegrationFromJSON=a1o;var Yb=n1o(ae()),bAr=ce(),o1o=te();Va.WandbIntegrationType={Wandb:"wandb"};Va.WandbIntegrationType$inboundSchema=Yb.nativeEnum(Va.WandbIntegrationType);Va.WandbIntegrationType$outboundSchema=Va.WandbIntegrationType$inboundSchema;var gAr;(function(t){t.inboundSchema=Va.WandbIntegrationType$inboundSchema,t.outboundSchema=Va.WandbIntegrationType$outboundSchema})(gAr||(Va.WandbIntegrationType$=gAr={}));Va.WandbIntegration$inboundSchema=Yb.object({type:Va.WandbIntegrationType$inboundSchema.default("wandb"),project:Yb.string(),name:Yb.nullable(Yb.string()).optional(),api_key:Yb.string(),run_name:Yb.nullable(Yb.string()).optional()}).transform(t=>(0,bAr.remap)(t,{api_key:"apiKey",run_name:"runName"}));Va.WandbIntegration$outboundSchema=Yb.object({type:Va.WandbIntegrationType$outboundSchema.default("wandb"),project:Yb.string(),name:Yb.nullable(Yb.string()).optional(),apiKey:Yb.string(),runName:Yb.nullable(Yb.string()).optional()}).transform(t=>(0,bAr.remap)(t,{apiKey:"api_key",runName:"run_name"}));var yAr;(function(t){t.inboundSchema=Va.WandbIntegration$inboundSchema,t.outboundSchema=Va.WandbIntegration$outboundSchema})(yAr||(Va.WandbIntegration$=yAr={}));function i1o(t){return JSON.stringify(Va.WandbIntegration$outboundSchema.parse(t))}function a1o(t){return(0,o1o.safeParse)(t,e=>Va.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var EAr=S(nn=>{"use strict";var s1o=nn&&nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u1o=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l1o=nn&&nn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&s1o(r,e,n[o]);return u1o(r,e),r}}();Object.defineProperty(nn,"__esModule",{value:!0});nn.JobIn$=nn.JobIn$outboundSchema=nn.JobIn$inboundSchema=nn.JobInRepositories$=nn.JobInRepositories$outboundSchema=nn.JobInRepositories$inboundSchema=nn.Hyperparameters$=nn.Hyperparameters$outboundSchema=nn.Hyperparameters$inboundSchema=nn.JobInIntegrations$=nn.JobInIntegrations$outboundSchema=nn.JobInIntegrations$inboundSchema=void 0;nn.jobInIntegrationsToJSON=c1o;nn.jobInIntegrationsFromJSON=d1o;nn.hyperparametersToJSON=f1o;nn.hyperparametersFromJSON=p1o;nn.jobInRepositoriesToJSON=m1o;nn.jobInRepositoriesFromJSON=h1o;nn.jobInToJSON=g1o;nn.jobInFromJSON=y1o;var Pi=l1o(ae()),CAr=ce(),fIe=te(),xAr=Wlt(),pIe=Jlt(),mIe=ect(),TAr=wct(),hIe=Cct(),OAr=xct(),gIe=Tct();nn.JobInIntegrations$inboundSchema=gIe.WandbIntegration$inboundSchema;nn.JobInIntegrations$outboundSchema=gIe.WandbIntegration$outboundSchema;var _Ar;(function(t){t.inboundSchema=nn.JobInIntegrations$inboundSchema,t.outboundSchema=nn.JobInIntegrations$outboundSchema})(_Ar||(nn.JobInIntegrations$=_Ar={}));function c1o(t){return JSON.stringify(nn.JobInIntegrations$outboundSchema.parse(t))}function d1o(t){return(0,fIe.safeParse)(t,e=>nn.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}nn.Hyperparameters$inboundSchema=Pi.union([mIe.CompletionTrainingParametersIn$inboundSchema,pIe.ClassifierTrainingParametersIn$inboundSchema]);nn.Hyperparameters$outboundSchema=Pi.union([mIe.CompletionTrainingParametersIn$outboundSchema,pIe.ClassifierTrainingParametersIn$outboundSchema]);var vAr;(function(t){t.inboundSchema=nn.Hyperparameters$inboundSchema,t.outboundSchema=nn.Hyperparameters$outboundSchema})(vAr||(nn.Hyperparameters$=vAr={}));function f1o(t){return JSON.stringify(nn.Hyperparameters$outboundSchema.parse(t))}function p1o(t){return(0,fIe.safeParse)(t,e=>nn.Hyperparameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Hyperparameters' from JSON")}nn.JobInRepositories$inboundSchema=hIe.GithubRepositoryIn$inboundSchema;nn.JobInRepositories$outboundSchema=hIe.GithubRepositoryIn$outboundSchema;var wAr;(function(t){t.inboundSchema=nn.JobInRepositories$inboundSchema,t.outboundSchema=nn.JobInRepositories$outboundSchema})(wAr||(nn.JobInRepositories$=wAr={}));function m1o(t){return JSON.stringify(nn.JobInRepositories$outboundSchema.parse(t))}function h1o(t){return(0,fIe.safeParse)(t,e=>nn.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}nn.JobIn$inboundSchema=Pi.object({model:Pi.string(),training_files:Pi.array(OAr.TrainingFile$inboundSchema).optional(),validation_files:Pi.nullable(Pi.array(Pi.string())).optional(),suffix:Pi.nullable(Pi.string()).optional(),integrations:Pi.nullable(Pi.array(gIe.WandbIntegration$inboundSchema)).optional(),auto_start:Pi.boolean().optional(),invalid_sample_skip_percentage:Pi.number().default(0),job_type:Pi.nullable(TAr.FineTuneableModelType$inboundSchema).optional(),hyperparameters:Pi.union([mIe.CompletionTrainingParametersIn$inboundSchema,pIe.ClassifierTrainingParametersIn$inboundSchema]),repositories:Pi.nullable(Pi.array(hIe.GithubRepositoryIn$inboundSchema)).optional(),classifier_targets:Pi.nullable(Pi.array(xAr.ClassifierTargetIn$inboundSchema)).optional()}).transform(t=>(0,CAr.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart",invalid_sample_skip_percentage:"invalidSampleSkipPercentage",job_type:"jobType",classifier_targets:"classifierTargets"}));nn.JobIn$outboundSchema=Pi.object({model:Pi.string(),trainingFiles:Pi.array(OAr.TrainingFile$outboundSchema).optional(),validationFiles:Pi.nullable(Pi.array(Pi.string())).optional(),suffix:Pi.nullable(Pi.string()).optional(),integrations:Pi.nullable(Pi.array(gIe.WandbIntegration$outboundSchema)).optional(),autoStart:Pi.boolean().optional(),invalidSampleSkipPercentage:Pi.number().default(0),jobType:Pi.nullable(TAr.FineTuneableModelType$outboundSchema).optional(),hyperparameters:Pi.union([mIe.CompletionTrainingParametersIn$outboundSchema,pIe.ClassifierTrainingParametersIn$outboundSchema]),repositories:Pi.nullable(Pi.array(hIe.GithubRepositoryIn$outboundSchema)).optional(),classifierTargets:Pi.nullable(Pi.array(xAr.ClassifierTargetIn$outboundSchema)).optional()}).transform(t=>(0,CAr.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start",invalidSampleSkipPercentage:"invalid_sample_skip_percentage",jobType:"job_type",classifierTargets:"classifier_targets"}));var SAr;(function(t){t.inboundSchema=nn.JobIn$inboundSchema,t.outboundSchema=nn.JobIn$outboundSchema})(SAr||(nn.JobIn$=SAr={}));function g1o(t){return JSON.stringify(nn.JobIn$outboundSchema.parse(t))}function y1o(t){return(0,fIe.safeParse)(t,e=>nn.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var AAr=S(Po=>{"use strict";var b1o=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]}),_1o=Po&&Po.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v1o=Po&&Po.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&b1o(r,e,n[o]);return _1o(r,e),r}}();Object.defineProperty(Po,"__esModule",{value:!0});Po.JobsOut$=Po.JobsOut$outboundSchema=Po.JobsOut$inboundSchema=Po.JobsOutObject$=Po.JobsOutObject$outboundSchema=Po.JobsOutObject$inboundSchema=Po.JobsOutData$=Po.JobsOutData$outboundSchema=Po.JobsOutData$inboundSchema=Po.JobsOutObject=void 0;Po.jobsOutDataToJSON=w1o;Po.jobsOutDataFromJSON=S1o;Po.jobsOutToJSON=C1o;Po.jobsOutFromJSON=x1o;var Bu=v1o(ae()),IAr=te(),yIe=Hlt(),bIe=Qlt();Po.JobsOutObject={List:"list"};Po.JobsOutData$inboundSchema=Bu.union([yIe.ClassifierJobOut$inboundSchema.and(Bu.object({job_type:Bu.literal("classifier")}).transform(t=>({jobType:t.job_type}))),bIe.CompletionJobOut$inboundSchema.and(Bu.object({job_type:Bu.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Po.JobsOutData$outboundSchema=Bu.union([yIe.ClassifierJobOut$outboundSchema.and(Bu.object({jobType:Bu.literal("classifier")}).transform(t=>({job_type:t.jobType}))),bIe.CompletionJobOut$outboundSchema.and(Bu.object({jobType:Bu.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var PAr;(function(t){t.inboundSchema=Po.JobsOutData$inboundSchema,t.outboundSchema=Po.JobsOutData$outboundSchema})(PAr||(Po.JobsOutData$=PAr={}));function w1o(t){return JSON.stringify(Po.JobsOutData$outboundSchema.parse(t))}function S1o(t){return(0,IAr.safeParse)(t,e=>Po.JobsOutData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOutData' from JSON")}Po.JobsOutObject$inboundSchema=Bu.nativeEnum(Po.JobsOutObject);Po.JobsOutObject$outboundSchema=Po.JobsOutObject$inboundSchema;var MAr;(function(t){t.inboundSchema=Po.JobsOutObject$inboundSchema,t.outboundSchema=Po.JobsOutObject$outboundSchema})(MAr||(Po.JobsOutObject$=MAr={}));Po.JobsOut$inboundSchema=Bu.object({data:Bu.array(Bu.union([yIe.ClassifierJobOut$inboundSchema.and(Bu.object({job_type:Bu.literal("classifier")}).transform(t=>({jobType:t.job_type}))),bIe.CompletionJobOut$inboundSchema.and(Bu.object({job_type:Bu.literal("completion")}).transform(t=>({jobType:t.job_type})))])).optional(),object:Po.JobsOutObject$inboundSchema.default("list"),total:Bu.number().int()});Po.JobsOut$outboundSchema=Bu.object({data:Bu.array(Bu.union([yIe.ClassifierJobOut$outboundSchema.and(Bu.object({jobType:Bu.literal("classifier")}).transform(t=>({job_type:t.jobType}))),bIe.CompletionJobOut$outboundSchema.and(Bu.object({jobType:Bu.literal("completion")}).transform(t=>({job_type:t.jobType})))])).optional(),object:Po.JobsOutObject$outboundSchema.default("list"),total:Bu.number().int()});var RAr;(function(t){t.inboundSchema=Po.JobsOut$inboundSchema,t.outboundSchema=Po.JobsOut$outboundSchema})(RAr||(Po.JobsOut$=RAr={}));function C1o(t){return JSON.stringify(Po.JobsOut$outboundSchema.parse(t))}function x1o(t){return(0,IAr.safeParse)(t,e=>Po.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var $Ar=S(Ha=>{"use strict";var T1o=Ha&&Ha.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O1o=Ha&&Ha.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E1o=Ha&&Ha.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T1o(r,e,n[o]);return O1o(r,e),r}}();Object.defineProperty(Ha,"__esModule",{value:!0});Ha.LegacyJobMetadataOut$=Ha.LegacyJobMetadataOut$outboundSchema=Ha.LegacyJobMetadataOut$inboundSchema=Ha.LegacyJobMetadataOutObject$=Ha.LegacyJobMetadataOutObject$outboundSchema=Ha.LegacyJobMetadataOutObject$inboundSchema=Ha.LegacyJobMetadataOutObject=void 0;Ha.legacyJobMetadataOutToJSON=M1o;Ha.legacyJobMetadataOutFromJSON=R1o;var Jo=E1o(ae()),jAr=ce(),P1o=te();Ha.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};Ha.LegacyJobMetadataOutObject$inboundSchema=Jo.nativeEnum(Ha.LegacyJobMetadataOutObject);Ha.LegacyJobMetadataOutObject$outboundSchema=Ha.LegacyJobMetadataOutObject$inboundSchema;var NAr;(function(t){t.inboundSchema=Ha.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=Ha.LegacyJobMetadataOutObject$outboundSchema})(NAr||(Ha.LegacyJobMetadataOutObject$=NAr={}));Ha.LegacyJobMetadataOut$inboundSchema=Jo.object({expected_duration_seconds:Jo.nullable(Jo.number().int()).optional(),cost:Jo.nullable(Jo.number()).optional(),cost_currency:Jo.nullable(Jo.string()).optional(),train_tokens_per_step:Jo.nullable(Jo.number().int()).optional(),train_tokens:Jo.nullable(Jo.number().int()).optional(),data_tokens:Jo.nullable(Jo.number().int()).optional(),estimated_start_time:Jo.nullable(Jo.number().int()).optional(),deprecated:Jo.boolean().default(!0),details:Jo.string(),epochs:Jo.nullable(Jo.number()).optional(),training_steps:Jo.nullable(Jo.number().int()).optional(),object:Ha.LegacyJobMetadataOutObject$inboundSchema.default("job.metadata")}).transform(t=>(0,jAr.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"}));Ha.LegacyJobMetadataOut$outboundSchema=Jo.object({expectedDurationSeconds:Jo.nullable(Jo.number().int()).optional(),cost:Jo.nullable(Jo.number()).optional(),costCurrency:Jo.nullable(Jo.string()).optional(),trainTokensPerStep:Jo.nullable(Jo.number().int()).optional(),trainTokens:Jo.nullable(Jo.number().int()).optional(),dataTokens:Jo.nullable(Jo.number().int()).optional(),estimatedStartTime:Jo.nullable(Jo.number().int()).optional(),deprecated:Jo.boolean().default(!0),details:Jo.string(),epochs:Jo.nullable(Jo.number()).optional(),trainingSteps:Jo.nullable(Jo.number().int()).optional(),object:Ha.LegacyJobMetadataOutObject$outboundSchema.default("job.metadata")}).transform(t=>(0,jAr.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 DAr;(function(t){t.inboundSchema=Ha.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=Ha.LegacyJobMetadataOut$outboundSchema})(DAr||(Ha.LegacyJobMetadataOut$=DAr={}));function M1o(t){return JSON.stringify(Ha.LegacyJobMetadataOut$outboundSchema.parse(t))}function R1o(t){return(0,P1o.safeParse)(t,e=>Ha.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var kAr=S(tp=>{"use strict";var I1o=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]}),A1o=tp&&tp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N1o=tp&&tp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&I1o(r,e,n[o]);return A1o(r,e),r}}();Object.defineProperty(tp,"__esModule",{value:!0});tp.LibraryIn$=tp.LibraryIn$outboundSchema=tp.LibraryIn$inboundSchema=void 0;tp.libraryInToJSON=j1o;tp.libraryInFromJSON=$1o;var $0=N1o(ae()),FAr=ce(),D1o=te();tp.LibraryIn$inboundSchema=$0.object({name:$0.string(),description:$0.nullable($0.string()).optional(),chunk_size:$0.nullable($0.number().int()).optional()}).transform(t=>(0,FAr.remap)(t,{chunk_size:"chunkSize"}));tp.LibraryIn$outboundSchema=$0.object({name:$0.string(),description:$0.nullable($0.string()).optional(),chunkSize:$0.nullable($0.number().int()).optional()}).transform(t=>(0,FAr.remap)(t,{chunkSize:"chunk_size"}));var LAr;(function(t){t.inboundSchema=tp.LibraryIn$inboundSchema,t.outboundSchema=tp.LibraryIn$outboundSchema})(LAr||(tp.LibraryIn$=LAr={}));function j1o(t){return JSON.stringify(tp.LibraryIn$outboundSchema.parse(t))}function $1o(t){return(0,D1o.safeParse)(t,e=>tp.LibraryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibraryIn' from JSON")}});var BAr=S(rp=>{"use strict";var L1o=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]}),F1o=rp&&rp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k1o=rp&&rp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&L1o(r,e,n[o]);return F1o(r,e),r}}();Object.defineProperty(rp,"__esModule",{value:!0});rp.LibraryInUpdate$=rp.LibraryInUpdate$outboundSchema=rp.LibraryInUpdate$inboundSchema=void 0;rp.libraryInUpdateToJSON=B1o;rp.libraryInUpdateFromJSON=U1o;var AA=k1o(ae()),q1o=te();rp.LibraryInUpdate$inboundSchema=AA.object({name:AA.nullable(AA.string()).optional(),description:AA.nullable(AA.string()).optional()});rp.LibraryInUpdate$outboundSchema=AA.object({name:AA.nullable(AA.string()).optional(),description:AA.nullable(AA.string()).optional()});var qAr;(function(t){t.inboundSchema=rp.LibraryInUpdate$inboundSchema,t.outboundSchema=rp.LibraryInUpdate$outboundSchema})(qAr||(rp.LibraryInUpdate$=qAr={}));function B1o(t){return JSON.stringify(rp.LibraryInUpdate$outboundSchema.parse(t))}function U1o(t){return(0,q1o.safeParse)(t,e=>rp.LibraryInUpdate$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibraryInUpdate' from JSON")}});var Oct=S(np=>{"use strict";var z1o=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]}),V1o=np&&np.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H1o=np&&np.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&z1o(r,e,n[o]);return V1o(r,e),r}}();Object.defineProperty(np,"__esModule",{value:!0});np.LibraryOut$=np.LibraryOut$outboundSchema=np.LibraryOut$inboundSchema=void 0;np.libraryOutToJSON=J1o;np.libraryOutFromJSON=K1o;var jn=H1o(ae()),zAr=ce(),W1o=te();np.LibraryOut$inboundSchema=jn.object({id:jn.string(),name:jn.string(),created_at:jn.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:jn.string().datetime({offset:!0}).transform(t=>new Date(t)),owner_id:jn.string(),owner_type:jn.string(),total_size:jn.number().int(),nb_documents:jn.number().int(),chunk_size:jn.nullable(jn.number().int()),emoji:jn.nullable(jn.string()).optional(),description:jn.nullable(jn.string()).optional(),generated_name:jn.nullable(jn.string()).optional(),generated_description:jn.nullable(jn.string()).optional(),explicit_user_members_count:jn.nullable(jn.number().int()).optional(),explicit_workspace_members_count:jn.nullable(jn.number().int()).optional(),org_sharing_role:jn.nullable(jn.string()).optional()}).transform(t=>(0,zAr.remap)(t,{created_at:"createdAt",updated_at:"updatedAt",owner_id:"ownerId",owner_type:"ownerType",total_size:"totalSize",nb_documents:"nbDocuments",chunk_size:"chunkSize",generated_name:"generatedName",generated_description:"generatedDescription",explicit_user_members_count:"explicitUserMembersCount",explicit_workspace_members_count:"explicitWorkspaceMembersCount",org_sharing_role:"orgSharingRole"}));np.LibraryOut$outboundSchema=jn.object({id:jn.string(),name:jn.string(),createdAt:jn.date().transform(t=>t.toISOString()),updatedAt:jn.date().transform(t=>t.toISOString()),ownerId:jn.string(),ownerType:jn.string(),totalSize:jn.number().int(),nbDocuments:jn.number().int(),chunkSize:jn.nullable(jn.number().int()),emoji:jn.nullable(jn.string()).optional(),description:jn.nullable(jn.string()).optional(),generatedName:jn.nullable(jn.string()).optional(),generatedDescription:jn.nullable(jn.string()).optional(),explicitUserMembersCount:jn.nullable(jn.number().int()).optional(),explicitWorkspaceMembersCount:jn.nullable(jn.number().int()).optional(),orgSharingRole:jn.nullable(jn.string()).optional()}).transform(t=>(0,zAr.remap)(t,{createdAt:"created_at",updatedAt:"updated_at",ownerId:"owner_id",ownerType:"owner_type",totalSize:"total_size",nbDocuments:"nb_documents",chunkSize:"chunk_size",generatedName:"generated_name",generatedDescription:"generated_description",explicitUserMembersCount:"explicit_user_members_count",explicitWorkspaceMembersCount:"explicit_workspace_members_count",orgSharingRole:"org_sharing_role"}));var UAr;(function(t){t.inboundSchema=np.LibraryOut$inboundSchema,t.outboundSchema=np.LibraryOut$outboundSchema})(UAr||(np.LibraryOut$=UAr={}));function J1o(t){return JSON.stringify(np.LibraryOut$outboundSchema.parse(t))}function K1o(t){return(0,W1o.safeParse)(t,e=>np.LibraryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibraryOut' from JSON")}});var Ect=S(op=>{"use strict";var G1o=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]}),X1o=op&&op.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z1o=op&&op.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&G1o(r,e,n[o]);return X1o(r,e),r}}();Object.defineProperty(op,"__esModule",{value:!0});op.PaginationInfo$=op.PaginationInfo$outboundSchema=op.PaginationInfo$inboundSchema=void 0;op.paginationInfoToJSON=Q1o;op.paginationInfoFromJSON=eDo;var L0=Z1o(ae()),HAr=ce(),Y1o=te();op.PaginationInfo$inboundSchema=L0.object({total_items:L0.number().int(),total_pages:L0.number().int(),current_page:L0.number().int(),page_size:L0.number().int(),has_more:L0.boolean()}).transform(t=>(0,HAr.remap)(t,{total_items:"totalItems",total_pages:"totalPages",current_page:"currentPage",page_size:"pageSize",has_more:"hasMore"}));op.PaginationInfo$outboundSchema=L0.object({totalItems:L0.number().int(),totalPages:L0.number().int(),currentPage:L0.number().int(),pageSize:L0.number().int(),hasMore:L0.boolean()}).transform(t=>(0,HAr.remap)(t,{totalItems:"total_items",totalPages:"total_pages",currentPage:"current_page",pageSize:"page_size",hasMore:"has_more"}));var VAr;(function(t){t.inboundSchema=op.PaginationInfo$inboundSchema,t.outboundSchema=op.PaginationInfo$outboundSchema})(VAr||(op.PaginationInfo$=VAr={}));function Q1o(t){return JSON.stringify(op.PaginationInfo$outboundSchema.parse(t))}function eDo(t){return(0,Y1o.safeParse)(t,e=>op.PaginationInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'PaginationInfo' from JSON")}});var GAr=S(ip=>{"use strict";var tDo=ip&&ip.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rDo=ip&&ip.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nDo=ip&&ip.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tDo(r,e,n[o]);return rDo(r,e),r}}();Object.defineProperty(ip,"__esModule",{value:!0});ip.ListDocumentOut$=ip.ListDocumentOut$outboundSchema=ip.ListDocumentOut$inboundSchema=void 0;ip.listDocumentOutToJSON=iDo;ip.listDocumentOutFromJSON=aDo;var _Ie=nDo(ae()),oDo=te(),JAr=gct(),KAr=Ect();ip.ListDocumentOut$inboundSchema=_Ie.object({pagination:KAr.PaginationInfo$inboundSchema,data:_Ie.array(JAr.DocumentOut$inboundSchema)});ip.ListDocumentOut$outboundSchema=_Ie.object({pagination:KAr.PaginationInfo$outboundSchema,data:_Ie.array(JAr.DocumentOut$outboundSchema)});var WAr;(function(t){t.inboundSchema=ip.ListDocumentOut$inboundSchema,t.outboundSchema=ip.ListDocumentOut$outboundSchema})(WAr||(ip.ListDocumentOut$=WAr={}));function iDo(t){return JSON.stringify(ip.ListDocumentOut$outboundSchema.parse(t))}function aDo(t){return(0,oDo.safeParse)(t,e=>ip.ListDocumentOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListDocumentOut' from JSON")}});var YAr=S(ap=>{"use strict";var sDo=ap&&ap.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uDo=ap&&ap.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lDo=ap&&ap.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sDo(r,e,n[o]);return uDo(r,e),r}}();Object.defineProperty(ap,"__esModule",{value:!0});ap.ListFilesOut$=ap.ListFilesOut$outboundSchema=ap.ListFilesOut$inboundSchema=void 0;ap.listFilesOutToJSON=dDo;ap.listFilesOutFromJSON=fDo;var Zq=lDo(ae()),cDo=te(),ZAr=vct();ap.ListFilesOut$inboundSchema=Zq.object({data:Zq.array(ZAr.FileSchema$inboundSchema),object:Zq.string(),total:Zq.number().int()});ap.ListFilesOut$outboundSchema=Zq.object({data:Zq.array(ZAr.FileSchema$outboundSchema),object:Zq.string(),total:Zq.number().int()});var XAr;(function(t){t.inboundSchema=ap.ListFilesOut$inboundSchema,t.outboundSchema=ap.ListFilesOut$outboundSchema})(XAr||(ap.ListFilesOut$=XAr={}));function dDo(t){return JSON.stringify(ap.ListFilesOut$outboundSchema.parse(t))}function fDo(t){return(0,cDo.safeParse)(t,e=>ap.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var tNr=S(sp=>{"use strict";var pDo=sp&&sp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mDo=sp&&sp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hDo=sp&&sp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pDo(r,e,n[o]);return mDo(r,e),r}}();Object.defineProperty(sp,"__esModule",{value:!0});sp.ListLibraryOut$=sp.ListLibraryOut$outboundSchema=sp.ListLibraryOut$inboundSchema=void 0;sp.listLibraryOutToJSON=yDo;sp.listLibraryOutFromJSON=bDo;var vIe=hDo(ae()),gDo=te(),eNr=Oct();sp.ListLibraryOut$inboundSchema=vIe.object({data:vIe.array(eNr.LibraryOut$inboundSchema)});sp.ListLibraryOut$outboundSchema=vIe.object({data:vIe.array(eNr.LibraryOut$outboundSchema)});var QAr;(function(t){t.inboundSchema=sp.ListLibraryOut$inboundSchema,t.outboundSchema=sp.ListLibraryOut$outboundSchema})(QAr||(sp.ListLibraryOut$=QAr={}));function yDo(t){return JSON.stringify(sp.ListLibraryOut$outboundSchema.parse(t))}function bDo(t){return(0,gDo.safeParse)(t,e=>sp.ListLibraryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListLibraryOut' from JSON")}});var Pct=S(up=>{"use strict";var _Do=up&&up.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vDo=up&&up.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wDo=up&&up.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Do(r,e,n[o]);return vDo(r,e),r}}();Object.defineProperty(up,"__esModule",{value:!0});up.SharingOut$=up.SharingOut$outboundSchema=up.SharingOut$inboundSchema=void 0;up.sharingOutToJSON=CDo;up.sharingOutFromJSON=xDo;var Zy=wDo(ae()),nNr=ce(),SDo=te();up.SharingOut$inboundSchema=Zy.object({library_id:Zy.string(),user_id:Zy.nullable(Zy.string()).optional(),org_id:Zy.string(),role:Zy.string(),share_with_type:Zy.string(),share_with_uuid:Zy.string()}).transform(t=>(0,nNr.remap)(t,{library_id:"libraryId",user_id:"userId",org_id:"orgId",share_with_type:"shareWithType",share_with_uuid:"shareWithUuid"}));up.SharingOut$outboundSchema=Zy.object({libraryId:Zy.string(),userId:Zy.nullable(Zy.string()).optional(),orgId:Zy.string(),role:Zy.string(),shareWithType:Zy.string(),shareWithUuid:Zy.string()}).transform(t=>(0,nNr.remap)(t,{libraryId:"library_id",userId:"user_id",orgId:"org_id",shareWithType:"share_with_type",shareWithUuid:"share_with_uuid"}));var rNr;(function(t){t.inboundSchema=up.SharingOut$inboundSchema,t.outboundSchema=up.SharingOut$outboundSchema})(rNr||(up.SharingOut$=rNr={}));function CDo(t){return JSON.stringify(up.SharingOut$outboundSchema.parse(t))}function xDo(t){return(0,SDo.safeParse)(t,e=>up.SharingOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SharingOut' from JSON")}});var aNr=S(lp=>{"use strict";var TDo=lp&&lp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ODo=lp&&lp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EDo=lp&&lp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TDo(r,e,n[o]);return ODo(r,e),r}}();Object.defineProperty(lp,"__esModule",{value:!0});lp.ListSharingOut$=lp.ListSharingOut$outboundSchema=lp.ListSharingOut$inboundSchema=void 0;lp.listSharingOutToJSON=MDo;lp.listSharingOutFromJSON=RDo;var wIe=EDo(ae()),PDo=te(),iNr=Pct();lp.ListSharingOut$inboundSchema=wIe.object({data:wIe.array(iNr.SharingOut$inboundSchema)});lp.ListSharingOut$outboundSchema=wIe.object({data:wIe.array(iNr.SharingOut$outboundSchema)});var oNr;(function(t){t.inboundSchema=lp.ListSharingOut$inboundSchema,t.outboundSchema=lp.ListSharingOut$outboundSchema})(oNr||(lp.ListSharingOut$=oNr={}));function MDo(t){return JSON.stringify(lp.ListSharingOut$outboundSchema.parse(t))}function RDo(t){return(0,PDo.safeParse)(t,e=>lp.ListSharingOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListSharingOut' from JSON")}});var pNr=S(Mo=>{"use strict";var IDo=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]}),ADo=Mo&&Mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NDo=Mo&&Mo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IDo(r,e,n[o]);return ADo(r,e),r}}();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.ModelConversation$=Mo.ModelConversation$outboundSchema=Mo.ModelConversation$inboundSchema=Mo.ModelConversationObject$=Mo.ModelConversationObject$outboundSchema=Mo.ModelConversationObject$inboundSchema=Mo.ModelConversationTools$=Mo.ModelConversationTools$outboundSchema=Mo.ModelConversationTools$inboundSchema=Mo.ModelConversationObject=void 0;Mo.modelConversationToolsToJSON=DDo;Mo.modelConversationToolsFromJSON=jDo;Mo.modelConversationToJSON=$Do;Mo.modelConversationFromJSON=LDo;var Gt=NDo(ae()),cNr=ce(),dNr=te(),SIe=jq(),fNr=x0(),CIe=Fq(),xIe=kq(),TIe=qq(),OIe=Bq(),EIe=Uq();Mo.ModelConversationObject={Conversation:"conversation"};Mo.ModelConversationTools$inboundSchema=Gt.union([CIe.DocumentLibraryTool$inboundSchema.and(Gt.object({type:Gt.literal("document_library")}).transform(t=>({type:t.type}))),xIe.FunctionTool$inboundSchema.and(Gt.object({type:Gt.literal("function")}).transform(t=>({type:t.type}))),SIe.CodeInterpreterTool$inboundSchema.and(Gt.object({type:Gt.literal("code_interpreter")}).transform(t=>({type:t.type}))),TIe.ImageGenerationTool$inboundSchema.and(Gt.object({type:Gt.literal("image_generation")}).transform(t=>({type:t.type}))),EIe.WebSearchTool$inboundSchema.and(Gt.object({type:Gt.literal("web_search")}).transform(t=>({type:t.type}))),OIe.WebSearchPremiumTool$inboundSchema.and(Gt.object({type:Gt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);Mo.ModelConversationTools$outboundSchema=Gt.union([CIe.DocumentLibraryTool$outboundSchema.and(Gt.object({type:Gt.literal("document_library")}).transform(t=>({type:t.type}))),xIe.FunctionTool$outboundSchema.and(Gt.object({type:Gt.literal("function")}).transform(t=>({type:t.type}))),SIe.CodeInterpreterTool$outboundSchema.and(Gt.object({type:Gt.literal("code_interpreter")}).transform(t=>({type:t.type}))),TIe.ImageGenerationTool$outboundSchema.and(Gt.object({type:Gt.literal("image_generation")}).transform(t=>({type:t.type}))),EIe.WebSearchTool$outboundSchema.and(Gt.object({type:Gt.literal("web_search")}).transform(t=>({type:t.type}))),OIe.WebSearchPremiumTool$outboundSchema.and(Gt.object({type:Gt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var sNr;(function(t){t.inboundSchema=Mo.ModelConversationTools$inboundSchema,t.outboundSchema=Mo.ModelConversationTools$outboundSchema})(sNr||(Mo.ModelConversationTools$=sNr={}));function DDo(t){return JSON.stringify(Mo.ModelConversationTools$outboundSchema.parse(t))}function jDo(t){return(0,dNr.safeParse)(t,e=>Mo.ModelConversationTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelConversationTools' from JSON")}Mo.ModelConversationObject$inboundSchema=Gt.nativeEnum(Mo.ModelConversationObject);Mo.ModelConversationObject$outboundSchema=Mo.ModelConversationObject$inboundSchema;var uNr;(function(t){t.inboundSchema=Mo.ModelConversationObject$inboundSchema,t.outboundSchema=Mo.ModelConversationObject$outboundSchema})(uNr||(Mo.ModelConversationObject$=uNr={}));Mo.ModelConversation$inboundSchema=Gt.object({instructions:Gt.nullable(Gt.string()).optional(),tools:Gt.array(Gt.union([CIe.DocumentLibraryTool$inboundSchema.and(Gt.object({type:Gt.literal("document_library")}).transform(t=>({type:t.type}))),xIe.FunctionTool$inboundSchema.and(Gt.object({type:Gt.literal("function")}).transform(t=>({type:t.type}))),SIe.CodeInterpreterTool$inboundSchema.and(Gt.object({type:Gt.literal("code_interpreter")}).transform(t=>({type:t.type}))),TIe.ImageGenerationTool$inboundSchema.and(Gt.object({type:Gt.literal("image_generation")}).transform(t=>({type:t.type}))),EIe.WebSearchTool$inboundSchema.and(Gt.object({type:Gt.literal("web_search")}).transform(t=>({type:t.type}))),OIe.WebSearchPremiumTool$inboundSchema.and(Gt.object({type:Gt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:fNr.CompletionArgs$inboundSchema.optional(),name:Gt.nullable(Gt.string()).optional(),description:Gt.nullable(Gt.string()).optional(),object:Mo.ModelConversationObject$inboundSchema.default("conversation"),id:Gt.string(),created_at:Gt.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:Gt.string().datetime({offset:!0}).transform(t=>new Date(t)),model:Gt.string()}).transform(t=>(0,cNr.remap)(t,{completion_args:"completionArgs",created_at:"createdAt",updated_at:"updatedAt"}));Mo.ModelConversation$outboundSchema=Gt.object({instructions:Gt.nullable(Gt.string()).optional(),tools:Gt.array(Gt.union([CIe.DocumentLibraryTool$outboundSchema.and(Gt.object({type:Gt.literal("document_library")}).transform(t=>({type:t.type}))),xIe.FunctionTool$outboundSchema.and(Gt.object({type:Gt.literal("function")}).transform(t=>({type:t.type}))),SIe.CodeInterpreterTool$outboundSchema.and(Gt.object({type:Gt.literal("code_interpreter")}).transform(t=>({type:t.type}))),TIe.ImageGenerationTool$outboundSchema.and(Gt.object({type:Gt.literal("image_generation")}).transform(t=>({type:t.type}))),EIe.WebSearchTool$outboundSchema.and(Gt.object({type:Gt.literal("web_search")}).transform(t=>({type:t.type}))),OIe.WebSearchPremiumTool$outboundSchema.and(Gt.object({type:Gt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:fNr.CompletionArgs$outboundSchema.optional(),name:Gt.nullable(Gt.string()).optional(),description:Gt.nullable(Gt.string()).optional(),object:Mo.ModelConversationObject$outboundSchema.default("conversation"),id:Gt.string(),createdAt:Gt.date().transform(t=>t.toISOString()),updatedAt:Gt.date().transform(t=>t.toISOString()),model:Gt.string()}).transform(t=>(0,cNr.remap)(t,{completionArgs:"completion_args",createdAt:"created_at",updatedAt:"updated_at"}));var lNr;(function(t){t.inboundSchema=Mo.ModelConversation$inboundSchema,t.outboundSchema=Mo.ModelConversation$outboundSchema})(lNr||(Mo.ModelConversation$=lNr={}));function $Do(t){return JSON.stringify(Mo.ModelConversation$outboundSchema.parse(t))}function LDo(t){return(0,dNr.safeParse)(t,e=>Mo.ModelConversation$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelConversation' from JSON")}});var yNr=S(Ts=>{"use strict";var FDo=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]}),kDo=Ts&&Ts.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qDo=Ts&&Ts.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&FDo(r,e,n[o]);return kDo(r,e),r}}();Object.defineProperty(Ts,"__esModule",{value:!0});Ts.ModelList$=Ts.ModelList$outboundSchema=Ts.ModelList$inboundSchema=Ts.Data$=Ts.Data$outboundSchema=Ts.Data$inboundSchema=void 0;Ts.dataToJSON=BDo;Ts.dataFromJSON=UDo;Ts.modelListToJSON=zDo;Ts.modelListFromJSON=VDo;var tl=qDo(ae()),gNr=te(),PIe=$lt(),MIe=Sct();Ts.Data$inboundSchema=tl.union([MIe.FTModelCard$inboundSchema.and(tl.object({type:tl.literal("fine-tuned")}).transform(t=>({type:t.type}))),PIe.BaseModelCard$inboundSchema.and(tl.object({type:tl.literal("base")}).transform(t=>({type:t.type})))]);Ts.Data$outboundSchema=tl.union([MIe.FTModelCard$outboundSchema.and(tl.object({type:tl.literal("fine-tuned")}).transform(t=>({type:t.type}))),PIe.BaseModelCard$outboundSchema.and(tl.object({type:tl.literal("base")}).transform(t=>({type:t.type})))]);var mNr;(function(t){t.inboundSchema=Ts.Data$inboundSchema,t.outboundSchema=Ts.Data$outboundSchema})(mNr||(Ts.Data$=mNr={}));function BDo(t){return JSON.stringify(Ts.Data$outboundSchema.parse(t))}function UDo(t){return(0,gNr.safeParse)(t,e=>Ts.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}Ts.ModelList$inboundSchema=tl.object({object:tl.string().default("list"),data:tl.array(tl.union([MIe.FTModelCard$inboundSchema.and(tl.object({type:tl.literal("fine-tuned")}).transform(t=>({type:t.type}))),PIe.BaseModelCard$inboundSchema.and(tl.object({type:tl.literal("base")}).transform(t=>({type:t.type})))])).optional()});Ts.ModelList$outboundSchema=tl.object({object:tl.string().default("list"),data:tl.array(tl.union([MIe.FTModelCard$outboundSchema.and(tl.object({type:tl.literal("fine-tuned")}).transform(t=>({type:t.type}))),PIe.BaseModelCard$outboundSchema.and(tl.object({type:tl.literal("base")}).transform(t=>({type:t.type})))])).optional()});var hNr;(function(t){t.inboundSchema=Ts.ModelList$inboundSchema,t.outboundSchema=Ts.ModelList$outboundSchema})(hNr||(Ts.ModelList$=hNr={}));function zDo(t){return JSON.stringify(Ts.ModelList$outboundSchema.parse(t))}function VDo(t){return(0,gNr.safeParse)(t,e=>Ts.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var Mct=S(cp=>{"use strict";var HDo=cp&&cp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WDo=cp&&cp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JDo=cp&&cp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&HDo(r,e,n[o]);return WDo(r,e),r}}();Object.defineProperty(cp,"__esModule",{value:!0});cp.ModerationObject$=cp.ModerationObject$outboundSchema=cp.ModerationObject$inboundSchema=void 0;cp.moderationObjectToJSON=GDo;cp.moderationObjectFromJSON=XDo;var NA=JDo(ae()),_Nr=ce(),KDo=te();cp.ModerationObject$inboundSchema=NA.object({categories:NA.record(NA.boolean()).optional(),category_scores:NA.record(NA.number()).optional()}).transform(t=>(0,_Nr.remap)(t,{category_scores:"categoryScores"}));cp.ModerationObject$outboundSchema=NA.object({categories:NA.record(NA.boolean()).optional(),categoryScores:NA.record(NA.number()).optional()}).transform(t=>(0,_Nr.remap)(t,{categoryScores:"category_scores"}));var bNr;(function(t){t.inboundSchema=cp.ModerationObject$inboundSchema,t.outboundSchema=cp.ModerationObject$outboundSchema})(bNr||(cp.ModerationObject$=bNr={}));function GDo(t){return JSON.stringify(cp.ModerationObject$outboundSchema.parse(t))}function XDo(t){return(0,KDo.safeParse)(t,e=>cp.ModerationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModerationObject' from JSON")}});var SNr=S(dp=>{"use strict";var ZDo=dp&&dp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YDo=dp&&dp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QDo=dp&&dp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ZDo(r,e,n[o]);return YDo(r,e),r}}();Object.defineProperty(dp,"__esModule",{value:!0});dp.ModerationResponse$=dp.ModerationResponse$outboundSchema=dp.ModerationResponse$inboundSchema=void 0;dp.moderationResponseToJSON=tjo;dp.moderationResponseFromJSON=rjo;var Yq=QDo(ae()),ejo=te(),wNr=Mct();dp.ModerationResponse$inboundSchema=Yq.object({id:Yq.string(),model:Yq.string(),results:Yq.array(wNr.ModerationObject$inboundSchema)});dp.ModerationResponse$outboundSchema=Yq.object({id:Yq.string(),model:Yq.string(),results:Yq.array(wNr.ModerationObject$outboundSchema)});var vNr;(function(t){t.inboundSchema=dp.ModerationResponse$inboundSchema,t.outboundSchema=dp.ModerationResponse$outboundSchema})(vNr||(dp.ModerationResponse$=vNr={}));function tjo(t){return JSON.stringify(dp.ModerationResponse$outboundSchema.parse(t))}function rjo(t){return(0,ejo.safeParse)(t,e=>dp.ModerationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModerationResponse' from JSON")}});var Rct=S(fp=>{"use strict";var njo=fp&&fp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ojo=fp&&fp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ijo=fp&&fp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&njo(r,e,n[o]);return ojo(r,e),r}}();Object.defineProperty(fp,"__esModule",{value:!0});fp.OCRImageObject$=fp.OCRImageObject$outboundSchema=fp.OCRImageObject$inboundSchema=void 0;fp.ocrImageObjectToJSON=sjo;fp.ocrImageObjectFromJSON=ujo;var Tu=ijo(ae()),xNr=ce(),ajo=te();fp.OCRImageObject$inboundSchema=Tu.object({id:Tu.string(),top_left_x:Tu.nullable(Tu.number().int()),top_left_y:Tu.nullable(Tu.number().int()),bottom_right_x:Tu.nullable(Tu.number().int()),bottom_right_y:Tu.nullable(Tu.number().int()),image_base64:Tu.nullable(Tu.string()).optional(),image_annotation:Tu.nullable(Tu.string()).optional()}).transform(t=>(0,xNr.remap)(t,{top_left_x:"topLeftX",top_left_y:"topLeftY",bottom_right_x:"bottomRightX",bottom_right_y:"bottomRightY",image_base64:"imageBase64",image_annotation:"imageAnnotation"}));fp.OCRImageObject$outboundSchema=Tu.object({id:Tu.string(),topLeftX:Tu.nullable(Tu.number().int()),topLeftY:Tu.nullable(Tu.number().int()),bottomRightX:Tu.nullable(Tu.number().int()),bottomRightY:Tu.nullable(Tu.number().int()),imageBase64:Tu.nullable(Tu.string()).optional(),imageAnnotation:Tu.nullable(Tu.string()).optional()}).transform(t=>(0,xNr.remap)(t,{topLeftX:"top_left_x",topLeftY:"top_left_y",bottomRightX:"bottom_right_x",bottomRightY:"bottom_right_y",imageBase64:"image_base64",imageAnnotation:"image_annotation"}));var CNr;(function(t){t.inboundSchema=fp.OCRImageObject$inboundSchema,t.outboundSchema=fp.OCRImageObject$outboundSchema})(CNr||(fp.OCRImageObject$=CNr={}));function sjo(t){return JSON.stringify(fp.OCRImageObject$outboundSchema.parse(t))}function ujo(t){return(0,ajo.safeParse)(t,e=>fp.OCRImageObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRImageObject' from JSON")}});var Ict=S(pp=>{"use strict";var ljo=pp&&pp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cjo=pp&&pp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),djo=pp&&pp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ljo(r,e,n[o]);return cjo(r,e),r}}();Object.defineProperty(pp,"__esModule",{value:!0});pp.OCRPageDimensions$=pp.OCRPageDimensions$outboundSchema=pp.OCRPageDimensions$inboundSchema=void 0;pp.ocrPageDimensionsToJSON=pjo;pp.ocrPageDimensionsFromJSON=mjo;var Qq=djo(ae()),fjo=te();pp.OCRPageDimensions$inboundSchema=Qq.object({dpi:Qq.number().int(),height:Qq.number().int(),width:Qq.number().int()});pp.OCRPageDimensions$outboundSchema=Qq.object({dpi:Qq.number().int(),height:Qq.number().int(),width:Qq.number().int()});var TNr;(function(t){t.inboundSchema=pp.OCRPageDimensions$inboundSchema,t.outboundSchema=pp.OCRPageDimensions$outboundSchema})(TNr||(pp.OCRPageDimensions$=TNr={}));function pjo(t){return JSON.stringify(pp.OCRPageDimensions$outboundSchema.parse(t))}function mjo(t){return(0,fjo.safeParse)(t,e=>pp.OCRPageDimensions$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRPageDimensions' from JSON")}});var Act=S(mp=>{"use strict";var hjo=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]}),gjo=mp&&mp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yjo=mp&&mp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hjo(r,e,n[o]);return gjo(r,e),r}}();Object.defineProperty(mp,"__esModule",{value:!0});mp.OCRPageObject$=mp.OCRPageObject$outboundSchema=mp.OCRPageObject$inboundSchema=void 0;mp.ocrPageObjectToJSON=_jo;mp.ocrPageObjectFromJSON=vjo;var DA=yjo(ae()),bjo=te(),ENr=Rct(),PNr=Ict();mp.OCRPageObject$inboundSchema=DA.object({index:DA.number().int(),markdown:DA.string(),images:DA.array(ENr.OCRImageObject$inboundSchema),dimensions:DA.nullable(PNr.OCRPageDimensions$inboundSchema)});mp.OCRPageObject$outboundSchema=DA.object({index:DA.number().int(),markdown:DA.string(),images:DA.array(ENr.OCRImageObject$outboundSchema),dimensions:DA.nullable(PNr.OCRPageDimensions$outboundSchema)});var ONr;(function(t){t.inboundSchema=mp.OCRPageObject$inboundSchema,t.outboundSchema=mp.OCRPageObject$outboundSchema})(ONr||(mp.OCRPageObject$=ONr={}));function _jo(t){return JSON.stringify(mp.OCRPageObject$outboundSchema.parse(t))}function vjo(t){return(0,bjo.safeParse)(t,e=>mp.OCRPageObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRPageObject' from JSON")}});var NNr=S(Os=>{"use strict";var wjo=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]}),Sjo=Os&&Os.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cjo=Os&&Os.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wjo(r,e,n[o]);return Sjo(r,e),r}}();Object.defineProperty(Os,"__esModule",{value:!0});Os.OCRRequest$=Os.OCRRequest$outboundSchema=Os.OCRRequest$inboundSchema=Os.Document$=Os.Document$outboundSchema=Os.Document$inboundSchema=void 0;Os.documentToJSON=xjo;Os.documentFromJSON=Tjo;Os.ocrRequestToJSON=Ojo;Os.ocrRequestFromJSON=Ejo;var Wa=Cjo(ae()),INr=ce(),ANr=te(),IIe=JH(),AIe=iMe(),NIe=KH(),RIe=Lq();Os.Document$inboundSchema=Wa.union([AIe.FileChunk$inboundSchema,IIe.DocumentURLChunk$inboundSchema,NIe.ImageURLChunk$inboundSchema]);Os.Document$outboundSchema=Wa.union([AIe.FileChunk$outboundSchema,IIe.DocumentURLChunk$outboundSchema,NIe.ImageURLChunk$outboundSchema]);var MNr;(function(t){t.inboundSchema=Os.Document$inboundSchema,t.outboundSchema=Os.Document$outboundSchema})(MNr||(Os.Document$=MNr={}));function xjo(t){return JSON.stringify(Os.Document$outboundSchema.parse(t))}function Tjo(t){return(0,ANr.safeParse)(t,e=>Os.Document$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Document' from JSON")}Os.OCRRequest$inboundSchema=Wa.object({model:Wa.nullable(Wa.string()),id:Wa.string().optional(),document:Wa.union([AIe.FileChunk$inboundSchema,IIe.DocumentURLChunk$inboundSchema,NIe.ImageURLChunk$inboundSchema]),pages:Wa.nullable(Wa.array(Wa.number().int())).optional(),include_image_base64:Wa.nullable(Wa.boolean()).optional(),image_limit:Wa.nullable(Wa.number().int()).optional(),image_min_size:Wa.nullable(Wa.number().int()).optional(),bbox_annotation_format:Wa.nullable(RIe.ResponseFormat$inboundSchema).optional(),document_annotation_format:Wa.nullable(RIe.ResponseFormat$inboundSchema).optional()}).transform(t=>(0,INr.remap)(t,{include_image_base64:"includeImageBase64",image_limit:"imageLimit",image_min_size:"imageMinSize",bbox_annotation_format:"bboxAnnotationFormat",document_annotation_format:"documentAnnotationFormat"}));Os.OCRRequest$outboundSchema=Wa.object({model:Wa.nullable(Wa.string()),id:Wa.string().optional(),document:Wa.union([AIe.FileChunk$outboundSchema,IIe.DocumentURLChunk$outboundSchema,NIe.ImageURLChunk$outboundSchema]),pages:Wa.nullable(Wa.array(Wa.number().int())).optional(),includeImageBase64:Wa.nullable(Wa.boolean()).optional(),imageLimit:Wa.nullable(Wa.number().int()).optional(),imageMinSize:Wa.nullable(Wa.number().int()).optional(),bboxAnnotationFormat:Wa.nullable(RIe.ResponseFormat$outboundSchema).optional(),documentAnnotationFormat:Wa.nullable(RIe.ResponseFormat$outboundSchema).optional()}).transform(t=>(0,INr.remap)(t,{includeImageBase64:"include_image_base64",imageLimit:"image_limit",imageMinSize:"image_min_size",bboxAnnotationFormat:"bbox_annotation_format",documentAnnotationFormat:"document_annotation_format"}));var RNr;(function(t){t.inboundSchema=Os.OCRRequest$inboundSchema,t.outboundSchema=Os.OCRRequest$outboundSchema})(RNr||(Os.OCRRequest$=RNr={}));function Ojo(t){return JSON.stringify(Os.OCRRequest$outboundSchema.parse(t))}function Ejo(t){return(0,ANr.safeParse)(t,e=>Os.OCRRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRRequest' from JSON")}});var Nct=S(hp=>{"use strict";var Pjo=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]}),Mjo=hp&&hp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rjo=hp&&hp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Pjo(r,e,n[o]);return Mjo(r,e),r}}();Object.defineProperty(hp,"__esModule",{value:!0});hp.OCRUsageInfo$=hp.OCRUsageInfo$outboundSchema=hp.OCRUsageInfo$inboundSchema=void 0;hp.ocrUsageInfoToJSON=Ajo;hp.ocrUsageInfoFromJSON=Njo;var eB=Rjo(ae()),jNr=ce(),Ijo=te();hp.OCRUsageInfo$inboundSchema=eB.object({pages_processed:eB.number().int(),doc_size_bytes:eB.nullable(eB.number().int()).optional()}).transform(t=>(0,jNr.remap)(t,{pages_processed:"pagesProcessed",doc_size_bytes:"docSizeBytes"}));hp.OCRUsageInfo$outboundSchema=eB.object({pagesProcessed:eB.number().int(),docSizeBytes:eB.nullable(eB.number().int()).optional()}).transform(t=>(0,jNr.remap)(t,{pagesProcessed:"pages_processed",docSizeBytes:"doc_size_bytes"}));var DNr;(function(t){t.inboundSchema=hp.OCRUsageInfo$inboundSchema,t.outboundSchema=hp.OCRUsageInfo$outboundSchema})(DNr||(hp.OCRUsageInfo$=DNr={}));function Ajo(t){return JSON.stringify(hp.OCRUsageInfo$outboundSchema.parse(t))}function Njo(t){return(0,Ijo.safeParse)(t,e=>hp.OCRUsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRUsageInfo' from JSON")}});var qNr=S(gp=>{"use strict";var Djo=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]}),jjo=gp&&gp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$jo=gp&&gp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Djo(r,e,n[o]);return jjo(r,e),r}}();Object.defineProperty(gp,"__esModule",{value:!0});gp.OCRResponse$=gp.OCRResponse$outboundSchema=gp.OCRResponse$inboundSchema=void 0;gp.ocrResponseToJSON=Fjo;gp.ocrResponseFromJSON=kjo;var jA=$jo(ae()),LNr=ce(),Ljo=te(),FNr=Act(),kNr=Nct();gp.OCRResponse$inboundSchema=jA.object({pages:jA.array(FNr.OCRPageObject$inboundSchema),model:jA.string(),document_annotation:jA.nullable(jA.string()).optional(),usage_info:kNr.OCRUsageInfo$inboundSchema}).transform(t=>(0,LNr.remap)(t,{document_annotation:"documentAnnotation",usage_info:"usageInfo"}));gp.OCRResponse$outboundSchema=jA.object({pages:jA.array(FNr.OCRPageObject$outboundSchema),model:jA.string(),documentAnnotation:jA.nullable(jA.string()).optional(),usageInfo:kNr.OCRUsageInfo$outboundSchema}).transform(t=>(0,LNr.remap)(t,{documentAnnotation:"document_annotation",usageInfo:"usage_info"}));var $Nr;(function(t){t.inboundSchema=gp.OCRResponse$inboundSchema,t.outboundSchema=gp.OCRResponse$outboundSchema})($Nr||(gp.OCRResponse$=$Nr={}));function Fjo(t){return JSON.stringify(gp.OCRResponse$outboundSchema.parse(t))}function kjo(t){return(0,Ljo.safeParse)(t,e=>gp.OCRResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRResponse' from JSON")}});var zNr=S(yp=>{"use strict";var qjo=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]}),Bjo=yp&&yp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ujo=yp&&yp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qjo(r,e,n[o]);return Bjo(r,e),r}}();Object.defineProperty(yp,"__esModule",{value:!0});yp.ProcessingStatusOut$=yp.ProcessingStatusOut$outboundSchema=yp.ProcessingStatusOut$inboundSchema=void 0;yp.processingStatusOutToJSON=Vjo;yp.processingStatusOutFromJSON=Hjo;var m7=Ujo(ae()),UNr=ce(),zjo=te();yp.ProcessingStatusOut$inboundSchema=m7.object({document_id:m7.string(),processing_status:m7.string()}).transform(t=>(0,UNr.remap)(t,{document_id:"documentId",processing_status:"processingStatus"}));yp.ProcessingStatusOut$outboundSchema=m7.object({documentId:m7.string(),processingStatus:m7.string()}).transform(t=>(0,UNr.remap)(t,{documentId:"document_id",processingStatus:"processing_status"}));var BNr;(function(t){t.inboundSchema=yp.ProcessingStatusOut$inboundSchema,t.outboundSchema=yp.ProcessingStatusOut$outboundSchema})(BNr||(yp.ProcessingStatusOut$=BNr={}));function Vjo(t){return JSON.stringify(yp.ProcessingStatusOut$outboundSchema.parse(t))}function Hjo(t){return(0,zjo.safeParse)(t,e=>yp.ProcessingStatusOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ProcessingStatusOut' from JSON")}});var GNr=S(bp=>{"use strict";var Wjo=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]}),Jjo=bp&&bp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kjo=bp&&bp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Wjo(r,e,n[o]);return Jjo(r,e),r}}();Object.defineProperty(bp,"__esModule",{value:!0});bp.RetrieveFileOut$=bp.RetrieveFileOut$outboundSchema=bp.RetrieveFileOut$inboundSchema=void 0;bp.retrieveFileOutToJSON=Xjo;bp.retrieveFileOutFromJSON=Zjo;var rl=Kjo(ae()),HNr=ce(),Gjo=te(),WNr=_se(),JNr=vse(),KNr=wse();bp.RetrieveFileOut$inboundSchema=rl.object({id:rl.string(),object:rl.string(),bytes:rl.number().int(),created_at:rl.number().int(),filename:rl.string(),purpose:WNr.FilePurpose$inboundSchema,sample_type:JNr.SampleType$inboundSchema,num_lines:rl.nullable(rl.number().int()).optional(),mimetype:rl.nullable(rl.string()).optional(),source:KNr.Source$inboundSchema,signature:rl.nullable(rl.string()).optional(),deleted:rl.boolean()}).transform(t=>(0,HNr.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));bp.RetrieveFileOut$outboundSchema=rl.object({id:rl.string(),object:rl.string(),sizeBytes:rl.number().int(),createdAt:rl.number().int(),filename:rl.string(),purpose:WNr.FilePurpose$outboundSchema,sampleType:JNr.SampleType$outboundSchema,numLines:rl.nullable(rl.number().int()).optional(),mimetype:rl.nullable(rl.string()).optional(),source:KNr.Source$outboundSchema,signature:rl.nullable(rl.string()).optional(),deleted:rl.boolean()}).transform(t=>(0,HNr.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var VNr;(function(t){t.inboundSchema=bp.RetrieveFileOut$inboundSchema,t.outboundSchema=bp.RetrieveFileOut$outboundSchema})(VNr||(bp.RetrieveFileOut$=VNr={}));function Xjo(t){return JSON.stringify(bp.RetrieveFileOut$outboundSchema.parse(t))}function Zjo(t){return(0,Gjo.safeParse)(t,e=>bp.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var YNr=S(_p=>{"use strict";var Yjo=_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]}),Qjo=_p&&_p.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e$o=_p&&_p.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Yjo(r,e,n[o]);return Qjo(r,e),r}}();Object.defineProperty(_p,"__esModule",{value:!0});_p.Security$=_p.Security$outboundSchema=_p.Security$inboundSchema=void 0;_p.securityToJSON=r$o;_p.securityFromJSON=n$o;var DIe=e$o(ae()),ZNr=ce(),t$o=te();_p.Security$inboundSchema=DIe.object({ApiKey:DIe.string().optional()}).transform(t=>(0,ZNr.remap)(t,{ApiKey:"apiKey"}));_p.Security$outboundSchema=DIe.object({apiKey:DIe.string().optional()}).transform(t=>(0,ZNr.remap)(t,{apiKey:"ApiKey"}));var XNr;(function(t){t.inboundSchema=_p.Security$inboundSchema,t.outboundSchema=_p.Security$outboundSchema})(XNr||(_p.Security$=XNr={}));function r$o(t){return JSON.stringify(_p.Security$outboundSchema.parse(t))}function n$o(t){return(0,t$o.safeParse)(t,e=>_p.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var Dct=S(vp=>{"use strict";var o$o=vp&&vp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i$o=vp&&vp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a$o=vp&&vp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&o$o(r,e,n[o]);return i$o(r,e),r}}();Object.defineProperty(vp,"__esModule",{value:!0});vp.ShareEnum$=vp.ShareEnum$outboundSchema=vp.ShareEnum$inboundSchema=vp.ShareEnum=void 0;var cW=a$o(ae()),s$o=kx();vp.ShareEnum={Viewer:"Viewer",Editor:"Editor"};vp.ShareEnum$inboundSchema=cW.union([cW.nativeEnum(vp.ShareEnum),cW.string().transform(s$o.catchUnrecognizedEnum)]);vp.ShareEnum$outboundSchema=cW.union([cW.nativeEnum(vp.ShareEnum),cW.string().and(cW.custom())]);var QNr;(function(t){t.inboundSchema=vp.ShareEnum$inboundSchema,t.outboundSchema=vp.ShareEnum$outboundSchema})(QNr||(vp.ShareEnum$=QNr={}))});var n1r=S(wp=>{"use strict";var u$o=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]}),l$o=wp&&wp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c$o=wp&&wp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&u$o(r,e,n[o]);return l$o(r,e),r}}();Object.defineProperty(wp,"__esModule",{value:!0});wp.SharingDelete$=wp.SharingDelete$outboundSchema=wp.SharingDelete$inboundSchema=void 0;wp.sharingDeleteToJSON=f$o;wp.sharingDeleteFromJSON=p$o;var h7=c$o(ae()),t1r=ce(),d$o=te(),r1r=cIe();wp.SharingDelete$inboundSchema=h7.object({org_id:h7.string(),share_with_uuid:h7.string(),share_with_type:r1r.EntityType$inboundSchema}).transform(t=>(0,t1r.remap)(t,{org_id:"orgId",share_with_uuid:"shareWithUuid",share_with_type:"shareWithType"}));wp.SharingDelete$outboundSchema=h7.object({orgId:h7.string(),shareWithUuid:h7.string(),shareWithType:r1r.EntityType$outboundSchema}).transform(t=>(0,t1r.remap)(t,{orgId:"org_id",shareWithUuid:"share_with_uuid",shareWithType:"share_with_type"}));var e1r;(function(t){t.inboundSchema=wp.SharingDelete$inboundSchema,t.outboundSchema=wp.SharingDelete$outboundSchema})(e1r||(wp.SharingDelete$=e1r={}));function f$o(t){return JSON.stringify(wp.SharingDelete$outboundSchema.parse(t))}function p$o(t){return(0,d$o.safeParse)(t,e=>wp.SharingDelete$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SharingDelete' from JSON")}});var u1r=S(Sp=>{"use strict";var m$o=Sp&&Sp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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$o=Sp&&Sp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g$o=Sp&&Sp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&m$o(r,e,n[o]);return h$o(r,e),r}}();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.SharingIn$=Sp.SharingIn$outboundSchema=Sp.SharingIn$inboundSchema=void 0;Sp.sharingInToJSON=b$o;Sp.sharingInFromJSON=_$o;var g7=g$o(ae()),i1r=ce(),y$o=te(),a1r=cIe(),s1r=Dct();Sp.SharingIn$inboundSchema=g7.object({org_id:g7.string(),level:s1r.ShareEnum$inboundSchema,share_with_uuid:g7.string(),share_with_type:a1r.EntityType$inboundSchema}).transform(t=>(0,i1r.remap)(t,{org_id:"orgId",share_with_uuid:"shareWithUuid",share_with_type:"shareWithType"}));Sp.SharingIn$outboundSchema=g7.object({orgId:g7.string(),level:s1r.ShareEnum$outboundSchema,shareWithUuid:g7.string(),shareWithType:a1r.EntityType$outboundSchema}).transform(t=>(0,i1r.remap)(t,{orgId:"org_id",shareWithUuid:"share_with_uuid",shareWithType:"share_with_type"}));var o1r;(function(t){t.inboundSchema=Sp.SharingIn$inboundSchema,t.outboundSchema=Sp.SharingIn$outboundSchema})(o1r||(Sp.SharingIn$=o1r={}));function b$o(t){return JSON.stringify(Sp.SharingIn$outboundSchema.parse(t))}function _$o(t){return(0,y$o.safeParse)(t,e=>Sp.SharingIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SharingIn' from JSON")}});var jIe=S(Ja=>{"use strict";var v$o=Ja&&Ja.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),w$o=Ja&&Ja.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S$o=Ja&&Ja.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&v$o(r,e,n[o]);return w$o(r,e),r}}();Object.defineProperty(Ja,"__esModule",{value:!0});Ja.TranscriptionSegmentChunk$=Ja.TranscriptionSegmentChunk$outboundSchema=Ja.TranscriptionSegmentChunk$inboundSchema=Ja.Type$=Ja.Type$outboundSchema=Ja.Type$inboundSchema=Ja.Type=void 0;Ja.transcriptionSegmentChunkToJSON=x$o;Ja.transcriptionSegmentChunkFromJSON=T$o;var F0=S$o(ae()),C$o=ce(),d1r=te();Ja.Type={TranscriptionSegment:"transcription_segment"};Ja.Type$inboundSchema=F0.nativeEnum(Ja.Type);Ja.Type$outboundSchema=Ja.Type$inboundSchema;var l1r;(function(t){t.inboundSchema=Ja.Type$inboundSchema,t.outboundSchema=Ja.Type$outboundSchema})(l1r||(Ja.Type$=l1r={}));Ja.TranscriptionSegmentChunk$inboundSchema=(0,d1r.collectExtraKeys)(F0.object({text:F0.string(),start:F0.number(),end:F0.number(),type:Ja.Type$inboundSchema.default("transcription_segment")}).catchall(F0.any()),"additionalProperties",!0);Ja.TranscriptionSegmentChunk$outboundSchema=F0.object({text:F0.string(),start:F0.number(),end:F0.number(),type:Ja.Type$outboundSchema.default("transcription_segment"),additionalProperties:F0.record(F0.any())}).transform(t=>({...t.additionalProperties,...(0,C$o.remap)(t,{additionalProperties:null})}));var c1r;(function(t){t.inboundSchema=Ja.TranscriptionSegmentChunk$inboundSchema,t.outboundSchema=Ja.TranscriptionSegmentChunk$outboundSchema})(c1r||(Ja.TranscriptionSegmentChunk$=c1r={}));function x$o(t){return JSON.stringify(Ja.TranscriptionSegmentChunk$outboundSchema.parse(t))}function T$o(t){return(0,d1r.safeParse)(t,e=>Ja.TranscriptionSegmentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionSegmentChunk' from JSON")}});var g1r=S(Cp=>{"use strict";var O$o=Cp&&Cp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E$o=Cp&&Cp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P$o=Cp&&Cp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&O$o(r,e,n[o]);return E$o(r,e),r}}();Object.defineProperty(Cp,"__esModule",{value:!0});Cp.TranscriptionResponse$=Cp.TranscriptionResponse$outboundSchema=Cp.TranscriptionResponse$inboundSchema=void 0;Cp.transcriptionResponseToJSON=R$o;Cp.transcriptionResponseFromJSON=I$o;var Qb=P$o(ae()),M$o=ce(),p1r=te(),m1r=jIe(),h1r=Wq();Cp.TranscriptionResponse$inboundSchema=(0,p1r.collectExtraKeys)(Qb.object({model:Qb.string(),text:Qb.string(),segments:Qb.array(m1r.TranscriptionSegmentChunk$inboundSchema).optional(),usage:h1r.UsageInfo$inboundSchema,language:Qb.nullable(Qb.string())}).catchall(Qb.any()),"additionalProperties",!0);Cp.TranscriptionResponse$outboundSchema=Qb.object({model:Qb.string(),text:Qb.string(),segments:Qb.array(m1r.TranscriptionSegmentChunk$outboundSchema).optional(),usage:h1r.UsageInfo$outboundSchema,language:Qb.nullable(Qb.string()),additionalProperties:Qb.record(Qb.any())}).transform(t=>({...t.additionalProperties,...(0,M$o.remap)(t,{additionalProperties:null})}));var f1r;(function(t){t.inboundSchema=Cp.TranscriptionResponse$inboundSchema,t.outboundSchema=Cp.TranscriptionResponse$outboundSchema})(f1r||(Cp.TranscriptionResponse$=f1r={}));function R$o(t){return JSON.stringify(Cp.TranscriptionResponse$outboundSchema.parse(t))}function I$o(t){return(0,p1r.safeParse)(t,e=>Cp.TranscriptionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionResponse' from JSON")}});var jct=S(Ka=>{"use strict";var A$o=Ka&&Ka.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),N$o=Ka&&Ka.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D$o=Ka&&Ka.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&A$o(r,e,n[o]);return N$o(r,e),r}}();Object.defineProperty(Ka,"__esModule",{value:!0});Ka.TranscriptionStreamDone$=Ka.TranscriptionStreamDone$outboundSchema=Ka.TranscriptionStreamDone$inboundSchema=Ka.TranscriptionStreamDoneType$=Ka.TranscriptionStreamDoneType$outboundSchema=Ka.TranscriptionStreamDoneType$inboundSchema=Ka.TranscriptionStreamDoneType=void 0;Ka.transcriptionStreamDoneToJSON=$$o;Ka.transcriptionStreamDoneFromJSON=L$o;var Yy=D$o(ae()),j$o=ce(),_1r=te(),v1r=jIe(),w1r=Wq();Ka.TranscriptionStreamDoneType={TranscriptionDone:"transcription.done"};Ka.TranscriptionStreamDoneType$inboundSchema=Yy.nativeEnum(Ka.TranscriptionStreamDoneType);Ka.TranscriptionStreamDoneType$outboundSchema=Ka.TranscriptionStreamDoneType$inboundSchema;var y1r;(function(t){t.inboundSchema=Ka.TranscriptionStreamDoneType$inboundSchema,t.outboundSchema=Ka.TranscriptionStreamDoneType$outboundSchema})(y1r||(Ka.TranscriptionStreamDoneType$=y1r={}));Ka.TranscriptionStreamDone$inboundSchema=(0,_1r.collectExtraKeys)(Yy.object({model:Yy.string(),text:Yy.string(),segments:Yy.array(v1r.TranscriptionSegmentChunk$inboundSchema).optional(),usage:w1r.UsageInfo$inboundSchema,type:Ka.TranscriptionStreamDoneType$inboundSchema.default("transcription.done"),language:Yy.nullable(Yy.string())}).catchall(Yy.any()),"additionalProperties",!0);Ka.TranscriptionStreamDone$outboundSchema=Yy.object({model:Yy.string(),text:Yy.string(),segments:Yy.array(v1r.TranscriptionSegmentChunk$outboundSchema).optional(),usage:w1r.UsageInfo$outboundSchema,type:Ka.TranscriptionStreamDoneType$outboundSchema.default("transcription.done"),language:Yy.nullable(Yy.string()),additionalProperties:Yy.record(Yy.any())}).transform(t=>({...t.additionalProperties,...(0,j$o.remap)(t,{additionalProperties:null})}));var b1r;(function(t){t.inboundSchema=Ka.TranscriptionStreamDone$inboundSchema,t.outboundSchema=Ka.TranscriptionStreamDone$outboundSchema})(b1r||(Ka.TranscriptionStreamDone$=b1r={}));function $$o(t){return JSON.stringify(Ka.TranscriptionStreamDone$outboundSchema.parse(t))}function L$o(t){return(0,_1r.safeParse)(t,e=>Ka.TranscriptionStreamDone$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamDone' from JSON")}});var $ct=S(xp=>{"use strict";var F$o=xp&&xp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),k$o=xp&&xp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q$o=xp&&xp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&F$o(r,e,n[o]);return k$o(r,e),r}}();Object.defineProperty(xp,"__esModule",{value:!0});xp.TranscriptionStreamEventTypes$=xp.TranscriptionStreamEventTypes$outboundSchema=xp.TranscriptionStreamEventTypes$inboundSchema=xp.TranscriptionStreamEventTypes=void 0;var B$o=q$o(ae());xp.TranscriptionStreamEventTypes={TranscriptionLanguage:"transcription.language",TranscriptionSegment:"transcription.segment",TranscriptionTextDelta:"transcription.text.delta",TranscriptionDone:"transcription.done"};xp.TranscriptionStreamEventTypes$inboundSchema=B$o.nativeEnum(xp.TranscriptionStreamEventTypes);xp.TranscriptionStreamEventTypes$outboundSchema=xp.TranscriptionStreamEventTypes$inboundSchema;var S1r;(function(t){t.inboundSchema=xp.TranscriptionStreamEventTypes$inboundSchema,t.outboundSchema=xp.TranscriptionStreamEventTypes$outboundSchema})(S1r||(xp.TranscriptionStreamEventTypes$=S1r={}))});var Lct=S(Ga=>{"use strict";var U$o=Ga&&Ga.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z$o=Ga&&Ga.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V$o=Ga&&Ga.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&U$o(r,e,n[o]);return z$o(r,e),r}}();Object.defineProperty(Ga,"__esModule",{value:!0});Ga.TranscriptionStreamLanguage$=Ga.TranscriptionStreamLanguage$outboundSchema=Ga.TranscriptionStreamLanguage$inboundSchema=Ga.TranscriptionStreamLanguageType$=Ga.TranscriptionStreamLanguageType$outboundSchema=Ga.TranscriptionStreamLanguageType$inboundSchema=Ga.TranscriptionStreamLanguageType=void 0;Ga.transcriptionStreamLanguageToJSON=H$o;Ga.transcriptionStreamLanguageFromJSON=W$o;var tB=V$o(ae()),T1r=ce(),O1r=te();Ga.TranscriptionStreamLanguageType={TranscriptionLanguage:"transcription.language"};Ga.TranscriptionStreamLanguageType$inboundSchema=tB.nativeEnum(Ga.TranscriptionStreamLanguageType);Ga.TranscriptionStreamLanguageType$outboundSchema=Ga.TranscriptionStreamLanguageType$inboundSchema;var C1r;(function(t){t.inboundSchema=Ga.TranscriptionStreamLanguageType$inboundSchema,t.outboundSchema=Ga.TranscriptionStreamLanguageType$outboundSchema})(C1r||(Ga.TranscriptionStreamLanguageType$=C1r={}));Ga.TranscriptionStreamLanguage$inboundSchema=(0,O1r.collectExtraKeys)(tB.object({type:Ga.TranscriptionStreamLanguageType$inboundSchema.default("transcription.language"),audio_language:tB.string()}).catchall(tB.any()),"additionalProperties",!0).transform(t=>(0,T1r.remap)(t,{audio_language:"audioLanguage"}));Ga.TranscriptionStreamLanguage$outboundSchema=tB.object({type:Ga.TranscriptionStreamLanguageType$outboundSchema.default("transcription.language"),audioLanguage:tB.string(),additionalProperties:tB.record(tB.any())}).transform(t=>({...t.additionalProperties,...(0,T1r.remap)(t,{audioLanguage:"audio_language",additionalProperties:null})}));var x1r;(function(t){t.inboundSchema=Ga.TranscriptionStreamLanguage$inboundSchema,t.outboundSchema=Ga.TranscriptionStreamLanguage$outboundSchema})(x1r||(Ga.TranscriptionStreamLanguage$=x1r={}));function H$o(t){return JSON.stringify(Ga.TranscriptionStreamLanguage$outboundSchema.parse(t))}function W$o(t){return(0,O1r.safeParse)(t,e=>Ga.TranscriptionStreamLanguage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamLanguage' from JSON")}});var Fct=S(Xa=>{"use strict";var J$o=Xa&&Xa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K$o=Xa&&Xa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G$o=Xa&&Xa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&J$o(r,e,n[o]);return K$o(r,e),r}}();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.TranscriptionStreamSegmentDelta$=Xa.TranscriptionStreamSegmentDelta$outboundSchema=Xa.TranscriptionStreamSegmentDelta$inboundSchema=Xa.TranscriptionStreamSegmentDeltaType$=Xa.TranscriptionStreamSegmentDeltaType$outboundSchema=Xa.TranscriptionStreamSegmentDeltaType$inboundSchema=Xa.TranscriptionStreamSegmentDeltaType=void 0;Xa.transcriptionStreamSegmentDeltaToJSON=Z$o;Xa.transcriptionStreamSegmentDeltaFromJSON=Y$o;var k0=G$o(ae()),X$o=ce(),M1r=te();Xa.TranscriptionStreamSegmentDeltaType={TranscriptionSegment:"transcription.segment"};Xa.TranscriptionStreamSegmentDeltaType$inboundSchema=k0.nativeEnum(Xa.TranscriptionStreamSegmentDeltaType);Xa.TranscriptionStreamSegmentDeltaType$outboundSchema=Xa.TranscriptionStreamSegmentDeltaType$inboundSchema;var E1r;(function(t){t.inboundSchema=Xa.TranscriptionStreamSegmentDeltaType$inboundSchema,t.outboundSchema=Xa.TranscriptionStreamSegmentDeltaType$outboundSchema})(E1r||(Xa.TranscriptionStreamSegmentDeltaType$=E1r={}));Xa.TranscriptionStreamSegmentDelta$inboundSchema=(0,M1r.collectExtraKeys)(k0.object({text:k0.string(),start:k0.number(),end:k0.number(),type:Xa.TranscriptionStreamSegmentDeltaType$inboundSchema.default("transcription.segment")}).catchall(k0.any()),"additionalProperties",!0);Xa.TranscriptionStreamSegmentDelta$outboundSchema=k0.object({text:k0.string(),start:k0.number(),end:k0.number(),type:Xa.TranscriptionStreamSegmentDeltaType$outboundSchema.default("transcription.segment"),additionalProperties:k0.record(k0.any())}).transform(t=>({...t.additionalProperties,...(0,X$o.remap)(t,{additionalProperties:null})}));var P1r;(function(t){t.inboundSchema=Xa.TranscriptionStreamSegmentDelta$inboundSchema,t.outboundSchema=Xa.TranscriptionStreamSegmentDelta$outboundSchema})(P1r||(Xa.TranscriptionStreamSegmentDelta$=P1r={}));function Z$o(t){return JSON.stringify(Xa.TranscriptionStreamSegmentDelta$outboundSchema.parse(t))}function Y$o(t){return(0,M1r.safeParse)(t,e=>Xa.TranscriptionStreamSegmentDelta$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamSegmentDelta' from JSON")}});var kct=S(Za=>{"use strict";var Q$o=Za&&Za.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eLo=Za&&Za.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tLo=Za&&Za.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Q$o(r,e,n[o]);return eLo(r,e),r}}();Object.defineProperty(Za,"__esModule",{value:!0});Za.TranscriptionStreamTextDelta$=Za.TranscriptionStreamTextDelta$outboundSchema=Za.TranscriptionStreamTextDelta$inboundSchema=Za.TranscriptionStreamTextDeltaType$=Za.TranscriptionStreamTextDeltaType$outboundSchema=Za.TranscriptionStreamTextDeltaType$inboundSchema=Za.TranscriptionStreamTextDeltaType=void 0;Za.transcriptionStreamTextDeltaToJSON=nLo;Za.transcriptionStreamTextDeltaFromJSON=oLo;var rB=tLo(ae()),rLo=ce(),A1r=te();Za.TranscriptionStreamTextDeltaType={TranscriptionTextDelta:"transcription.text.delta"};Za.TranscriptionStreamTextDeltaType$inboundSchema=rB.nativeEnum(Za.TranscriptionStreamTextDeltaType);Za.TranscriptionStreamTextDeltaType$outboundSchema=Za.TranscriptionStreamTextDeltaType$inboundSchema;var R1r;(function(t){t.inboundSchema=Za.TranscriptionStreamTextDeltaType$inboundSchema,t.outboundSchema=Za.TranscriptionStreamTextDeltaType$outboundSchema})(R1r||(Za.TranscriptionStreamTextDeltaType$=R1r={}));Za.TranscriptionStreamTextDelta$inboundSchema=(0,A1r.collectExtraKeys)(rB.object({text:rB.string(),type:Za.TranscriptionStreamTextDeltaType$inboundSchema.default("transcription.text.delta")}).catchall(rB.any()),"additionalProperties",!0);Za.TranscriptionStreamTextDelta$outboundSchema=rB.object({text:rB.string(),type:Za.TranscriptionStreamTextDeltaType$outboundSchema.default("transcription.text.delta"),additionalProperties:rB.record(rB.any())}).transform(t=>({...t.additionalProperties,...(0,rLo.remap)(t,{additionalProperties:null})}));var I1r;(function(t){t.inboundSchema=Za.TranscriptionStreamTextDelta$inboundSchema,t.outboundSchema=Za.TranscriptionStreamTextDelta$outboundSchema})(I1r||(Za.TranscriptionStreamTextDelta$=I1r={}));function nLo(t){return JSON.stringify(Za.TranscriptionStreamTextDelta$outboundSchema.parse(t))}function oLo(t){return(0,A1r.safeParse)(t,e=>Za.TranscriptionStreamTextDelta$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamTextDelta' from JSON")}});var L1r=S(Es=>{"use strict";var iLo=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]}),aLo=Es&&Es.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sLo=Es&&Es.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&iLo(r,e,n[o]);return aLo(r,e),r}}();Object.defineProperty(Es,"__esModule",{value:!0});Es.TranscriptionStreamEvents$=Es.TranscriptionStreamEvents$outboundSchema=Es.TranscriptionStreamEvents$inboundSchema=Es.TranscriptionStreamEventsData$=Es.TranscriptionStreamEventsData$outboundSchema=Es.TranscriptionStreamEventsData$inboundSchema=void 0;Es.transcriptionStreamEventsDataToJSON=uLo;Es.transcriptionStreamEventsDataFromJSON=lLo;Es.transcriptionStreamEventsToJSON=cLo;Es.transcriptionStreamEventsFromJSON=dLo;var li=sLo(ae()),j1r=te(),$Ie=jct(),$1r=$ct(),LIe=Lct(),FIe=Fct(),kIe=kct();Es.TranscriptionStreamEventsData$inboundSchema=li.union([$Ie.TranscriptionStreamDone$inboundSchema.and(li.object({type:li.literal("transcription.done")}).transform(t=>({type:t.type}))),FIe.TranscriptionStreamSegmentDelta$inboundSchema.and(li.object({type:li.literal("transcription.segment")}).transform(t=>({type:t.type}))),LIe.TranscriptionStreamLanguage$inboundSchema.and(li.object({type:li.literal("transcription.language")}).transform(t=>({type:t.type}))),kIe.TranscriptionStreamTextDelta$inboundSchema.and(li.object({type:li.literal("transcription.text.delta")}).transform(t=>({type:t.type})))]);Es.TranscriptionStreamEventsData$outboundSchema=li.union([$Ie.TranscriptionStreamDone$outboundSchema.and(li.object({type:li.literal("transcription.done")}).transform(t=>({type:t.type}))),FIe.TranscriptionStreamSegmentDelta$outboundSchema.and(li.object({type:li.literal("transcription.segment")}).transform(t=>({type:t.type}))),LIe.TranscriptionStreamLanguage$outboundSchema.and(li.object({type:li.literal("transcription.language")}).transform(t=>({type:t.type}))),kIe.TranscriptionStreamTextDelta$outboundSchema.and(li.object({type:li.literal("transcription.text.delta")}).transform(t=>({type:t.type})))]);var N1r;(function(t){t.inboundSchema=Es.TranscriptionStreamEventsData$inboundSchema,t.outboundSchema=Es.TranscriptionStreamEventsData$outboundSchema})(N1r||(Es.TranscriptionStreamEventsData$=N1r={}));function uLo(t){return JSON.stringify(Es.TranscriptionStreamEventsData$outboundSchema.parse(t))}function lLo(t){return(0,j1r.safeParse)(t,e=>Es.TranscriptionStreamEventsData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamEventsData' from JSON")}Es.TranscriptionStreamEvents$inboundSchema=li.object({event:$1r.TranscriptionStreamEventTypes$inboundSchema,data:li.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:li.ZodIssueCode.custom,message:`malformed json: ${r}`}),li.NEVER}}).pipe(li.union([$Ie.TranscriptionStreamDone$inboundSchema.and(li.object({type:li.literal("transcription.done")}).transform(t=>({type:t.type}))),FIe.TranscriptionStreamSegmentDelta$inboundSchema.and(li.object({type:li.literal("transcription.segment")}).transform(t=>({type:t.type}))),LIe.TranscriptionStreamLanguage$inboundSchema.and(li.object({type:li.literal("transcription.language")}).transform(t=>({type:t.type}))),kIe.TranscriptionStreamTextDelta$inboundSchema.and(li.object({type:li.literal("transcription.text.delta")}).transform(t=>({type:t.type})))]))});Es.TranscriptionStreamEvents$outboundSchema=li.object({event:$1r.TranscriptionStreamEventTypes$outboundSchema,data:li.union([$Ie.TranscriptionStreamDone$outboundSchema.and(li.object({type:li.literal("transcription.done")}).transform(t=>({type:t.type}))),FIe.TranscriptionStreamSegmentDelta$outboundSchema.and(li.object({type:li.literal("transcription.segment")}).transform(t=>({type:t.type}))),LIe.TranscriptionStreamLanguage$outboundSchema.and(li.object({type:li.literal("transcription.language")}).transform(t=>({type:t.type}))),kIe.TranscriptionStreamTextDelta$outboundSchema.and(li.object({type:li.literal("transcription.text.delta")}).transform(t=>({type:t.type})))])});var D1r;(function(t){t.inboundSchema=Es.TranscriptionStreamEvents$inboundSchema,t.outboundSchema=Es.TranscriptionStreamEvents$outboundSchema})(D1r||(Es.TranscriptionStreamEvents$=D1r={}));function cLo(t){return JSON.stringify(Es.TranscriptionStreamEvents$outboundSchema.parse(t))}function dLo(t){return(0,j1r.safeParse)(t,e=>Es.TranscriptionStreamEvents$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamEvents' from JSON")}});var q1r=S(Ya=>{"use strict";var fLo=Ya&&Ya.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pLo=Ya&&Ya.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mLo=Ya&&Ya.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fLo(r,e,n[o]);return pLo(r,e),r}}();Object.defineProperty(Ya,"__esModule",{value:!0});Ya.UnarchiveFTModelOut$=Ya.UnarchiveFTModelOut$outboundSchema=Ya.UnarchiveFTModelOut$inboundSchema=Ya.UnarchiveFTModelOutObject$=Ya.UnarchiveFTModelOutObject$outboundSchema=Ya.UnarchiveFTModelOutObject$inboundSchema=Ya.UnarchiveFTModelOutObject=void 0;Ya.unarchiveFTModelOutToJSON=gLo;Ya.unarchiveFTModelOutFromJSON=yLo;var dW=mLo(ae()),hLo=te();Ya.UnarchiveFTModelOutObject={Model:"model"};Ya.UnarchiveFTModelOutObject$inboundSchema=dW.nativeEnum(Ya.UnarchiveFTModelOutObject);Ya.UnarchiveFTModelOutObject$outboundSchema=Ya.UnarchiveFTModelOutObject$inboundSchema;var F1r;(function(t){t.inboundSchema=Ya.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=Ya.UnarchiveFTModelOutObject$outboundSchema})(F1r||(Ya.UnarchiveFTModelOutObject$=F1r={}));Ya.UnarchiveFTModelOut$inboundSchema=dW.object({id:dW.string(),object:Ya.UnarchiveFTModelOutObject$inboundSchema.default("model"),archived:dW.boolean().default(!1)});Ya.UnarchiveFTModelOut$outboundSchema=dW.object({id:dW.string(),object:Ya.UnarchiveFTModelOutObject$outboundSchema.default("model"),archived:dW.boolean().default(!1)});var k1r;(function(t){t.inboundSchema=Ya.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=Ya.UnarchiveFTModelOut$outboundSchema})(k1r||(Ya.UnarchiveFTModelOut$=k1r={}));function gLo(t){return JSON.stringify(Ya.UnarchiveFTModelOut$outboundSchema.parse(t))}function yLo(t){return(0,hLo.safeParse)(t,e=>Ya.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var U1r=S(Tp=>{"use strict";var bLo=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]}),_Lo=Tp&&Tp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vLo=Tp&&Tp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bLo(r,e,n[o]);return _Lo(r,e),r}}();Object.defineProperty(Tp,"__esModule",{value:!0});Tp.UpdateFTModelIn$=Tp.UpdateFTModelIn$outboundSchema=Tp.UpdateFTModelIn$inboundSchema=void 0;Tp.updateFTModelInToJSON=SLo;Tp.updateFTModelInFromJSON=CLo;var $A=vLo(ae()),wLo=te();Tp.UpdateFTModelIn$inboundSchema=$A.object({name:$A.nullable($A.string()).optional(),description:$A.nullable($A.string()).optional()});Tp.UpdateFTModelIn$outboundSchema=$A.object({name:$A.nullable($A.string()).optional(),description:$A.nullable($A.string()).optional()});var B1r;(function(t){t.inboundSchema=Tp.UpdateFTModelIn$inboundSchema,t.outboundSchema=Tp.UpdateFTModelIn$outboundSchema})(B1r||(Tp.UpdateFTModelIn$=B1r={}));function SLo(t){return JSON.stringify(Tp.UpdateFTModelIn$outboundSchema.parse(t))}function CLo(t){return(0,wLo.safeParse)(t,e=>Tp.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var K1r=S(Op=>{"use strict";var xLo=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]}),TLo=Op&&Op.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OLo=Op&&Op.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&xLo(r,e,n[o]);return TLo(r,e),r}}();Object.defineProperty(Op,"__esModule",{value:!0});Op.UploadFileOut$=Op.UploadFileOut$outboundSchema=Op.UploadFileOut$inboundSchema=void 0;Op.uploadFileOutToJSON=PLo;Op.uploadFileOutFromJSON=MLo;var sc=OLo(ae()),V1r=ce(),ELo=te(),H1r=_se(),W1r=vse(),J1r=wse();Op.UploadFileOut$inboundSchema=sc.object({id:sc.string(),object:sc.string(),bytes:sc.number().int(),created_at:sc.number().int(),filename:sc.string(),purpose:H1r.FilePurpose$inboundSchema,sample_type:W1r.SampleType$inboundSchema,num_lines:sc.nullable(sc.number().int()).optional(),mimetype:sc.nullable(sc.string()).optional(),source:J1r.Source$inboundSchema,signature:sc.nullable(sc.string()).optional()}).transform(t=>(0,V1r.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Op.UploadFileOut$outboundSchema=sc.object({id:sc.string(),object:sc.string(),sizeBytes:sc.number().int(),createdAt:sc.number().int(),filename:sc.string(),purpose:H1r.FilePurpose$outboundSchema,sampleType:W1r.SampleType$outboundSchema,numLines:sc.nullable(sc.number().int()).optional(),mimetype:sc.nullable(sc.string()).optional(),source:J1r.Source$outboundSchema,signature:sc.nullable(sc.string()).optional()}).transform(t=>(0,V1r.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var z1r;(function(t){t.inboundSchema=Op.UploadFileOut$inboundSchema,t.outboundSchema=Op.UploadFileOut$outboundSchema})(z1r||(Op.UploadFileOut$=z1r={}));function PLo(t){return JSON.stringify(Op.UploadFileOut$outboundSchema.parse(t))}function MLo(t){return(0,ELo.safeParse)(t,e=>Op.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var Y1r=S(Ps=>{"use strict";var RLo=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]}),ILo=Ps&&Ps.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ALo=Ps&&Ps.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&RLo(r,e,n[o]);return ILo(r,e),r}}();Object.defineProperty(Ps,"__esModule",{value:!0});Ps.ValidationError$=Ps.ValidationError$outboundSchema=Ps.ValidationError$inboundSchema=Ps.Loc$=Ps.Loc$outboundSchema=Ps.Loc$inboundSchema=void 0;Ps.locToJSON=NLo;Ps.locFromJSON=DLo;Ps.validationErrorToJSON=jLo;Ps.validationErrorFromJSON=$Lo;var Ep=ALo(ae()),Z1r=te();Ps.Loc$inboundSchema=Ep.union([Ep.string(),Ep.number().int()]);Ps.Loc$outboundSchema=Ep.union([Ep.string(),Ep.number().int()]);var G1r;(function(t){t.inboundSchema=Ps.Loc$inboundSchema,t.outboundSchema=Ps.Loc$outboundSchema})(G1r||(Ps.Loc$=G1r={}));function NLo(t){return JSON.stringify(Ps.Loc$outboundSchema.parse(t))}function DLo(t){return(0,Z1r.safeParse)(t,e=>Ps.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}Ps.ValidationError$inboundSchema=Ep.object({loc:Ep.array(Ep.union([Ep.string(),Ep.number().int()])),msg:Ep.string(),type:Ep.string()});Ps.ValidationError$outboundSchema=Ep.object({loc:Ep.array(Ep.union([Ep.string(),Ep.number().int()])),msg:Ep.string(),type:Ep.string()});var X1r;(function(t){t.inboundSchema=Ps.ValidationError$inboundSchema,t.outboundSchema=Ps.ValidationError$outboundSchema})(X1r||(Ps.ValidationError$=X1r={}));function jLo(t){return JSON.stringify(Ps.ValidationError$outboundSchema.parse(t))}function $Lo(t){return(0,Z1r.safeParse)(t,e=>Ps.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var zt=S(ye=>{"use strict";var LLo=ye&&ye.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),we=ye&&ye.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&LLo(e,t,r)};Object.defineProperty(ye,"__esModule",{value:!0});we(f0r(),ye);we(g0r(),ye);we(S0r(),ye);we(Elt(),ye);we(lse(),ye);we(Plt(),ye);we(oxr(),ye);we(mxr(),ye);we(vxr(),ye);we(jlt(),ye);we(xxr(),ye);we(OA(),ye);we(Mlt(),ye);we(Axr(),ye);we(Lxr(),ye);we($lt(),ye);we(Llt(),ye);we(Kxr(),ye);we(klt(),ye);we(oTr(),ye);we(Flt(),ye);we(Hq(),ye);we(gTr(),ye);we(KMe(),ye);we(RTr(),ye);we(LTr(),ye);we(JTr(),ye);we(QTr(),ye);we(cRe(),ye);we(lOr(),ye);we(pOr(),ye);we(Vlt(),ye);we(kOr(),ye);we(KOr(),ye);we(Hlt(),ye);we(Wlt(),ye);we(fRe(),ye);we(pRe(),ye);we(Jlt(),ye);we(jq(),ye);we(x0(),ye);we(vlt(),ye);we(Xlt(),ye);we(LEr(),ye);we(qEr(),ye);we(WEr(),ye);we(Qlt(),ye);we(Glt(),ye);we(_Re(),ye);we(ect(),ye);we(e7(),ye);we(gMr(),ye);we(SMr(),ye);we(hRr(),ye);we(wRr(),ye);we(Kq(),ye);we(RRr(),ye);we(FRr(),ye);we(HRr(),ye);we(ZRr(),ye);we(nIr(),ye);we(dIr(),ye);we(RRe(),ye);we(pIr(),ye);we(hIr(),ye);we(Klt(),ye);we(Fq(),ye);we(gct(),ye);we(_Ir(),ye);we(wIr(),ye);we(JH(),ye);we(yct(),ye);we(RIr(),ye);we(jIr(),ye);we(_ct(),ye);we(bct(),ye);we(cIe(),ye);we(mRe(),ye);we($Me(),ye);we(iMe(),ye);we(_se(),ye);we(vct(),ye);we(WIr(),ye);we(ZIr(),ye);we(tAr(),ye);we(aAr(),ye);we(wct(),ye);we(dRe(),ye);we(gRe(),ye);we(Sct(),ye);we(WPe(),ye);we(Ilt(),ye);we(mse(),ye);we(tct(),ye);we(ict(),ye);we(Dlt(),ye);we(TRe(),ye);we(kq(),ye);we(Cct(),ye);we(vRe(),ye);we(qq(),ye);we(Rlt(),ye);we(KH(),ye);we(oct(),ye);we(Ult(),ye);we(qlt(),ye);we(EAr(),ye);we(u7(),ye);we(AAr(),ye);we(wlt(),ye);we($Ar(),ye);we(kAr(),ye);we(BAr(),ye);we(Oct(),ye);we(GAr(),ye);we(YAr(),ye);we(tNr(),ye);we(aNr(),ye);we(hct(),ye);we(rct(),ye);we(gse(),ye);we(nct(),ye);we(c7(),ye);we(sct(),ye);we(zlt(),ye);we(r7(),ye);we(FMe(),ye);we(pNr(),ye);we(yNr(),ye);we(Mct(),ye);we(SNr(),ye);we(Rct(),ye);we(Ict(),ye);we(Act(),ye);we(NNr(),ye);we(qNr(),ye);we(Nct(),ye);we(act(),ye);we(Ect(),ye);we(VH(),ye);we(zNr(),ye);we(sMe(),ye);we(uct(),ye);we(lct(),ye);we(Lq(),ye);we(Slt(),ye);we(cct(),ye);we(GNr(),ye);we(vse(),ye);we(YNr(),ye);we(Dct(),ye);we(n1r(),ye);we(u1r(),ye);we(Pct(),ye);we(wse(),ye);we(dct(),ye);we(UD(),ye);we(Nlt(),ye);we(Vq(),ye);we(XH(),ye);we(LMe(),ye);we(n7(),ye);we(cMe(),ye);we(o7(),ye);we(HH(),ye);we(fct(),ye);we(pct(),ye);we(yse(),ye);we(mct(),ye);we(hse(),ye);we(zD(),ye);we(ERe(),ye);we(fse(),ye);we(xct(),ye);we(g1r(),ye);we(jIe(),ye);we(jct(),ye);we(L1r(),ye);we($ct(),ye);we(Lct(),ye);we(Fct(),ye);we(kct(),ye);we(q1r(),ye);we(U1r(),ye);we(K1r(),ye);we(Wq(),ye);we(VD(),ye);we(Y1r(),ye);we(Tct(),ye);we(l7(),ye);we(Bq(),ye);we(Uq(),ye)});var rDr=S(Jh=>{"use strict";var FLo=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]}),kLo=Jh&&Jh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eDr=Jh&&Jh.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&FLo(r,e,n[o]);return kLo(r,e),r}}();Object.defineProperty(Jh,"__esModule",{value:!0});Jh.HTTPValidationError$=Jh.HTTPValidationError$outboundSchema=Jh.HTTPValidationError$inboundSchema=Jh.HTTPValidationError=void 0;var nB=eDr(ae()),tDr=eDr(zt()),qLo=FPe(),Sse=class extends qLo.MistralError{constructor(e,r){let n="message"in e&&typeof e.message=="string"?e.message:`API error occurred: ${JSON.stringify(e)}`;super(n,r),this.data$=e,e.detail!=null&&(this.detail=e.detail),this.name="HTTPValidationError"}};Jh.HTTPValidationError=Sse;Jh.HTTPValidationError$inboundSchema=nB.object({detail:nB.array(tDr.ValidationError$inboundSchema).optional(),request$:nB.instanceof(Request),response$:nB.instanceof(Response),body$:nB.string()}).transform(t=>new Sse(t,{request:t.request$,response:t.response$,body:t.body$}));Jh.HTTPValidationError$outboundSchema=nB.instanceof(Sse).transform(t=>t.data$).pipe(nB.object({detail:nB.array(tDr.ValidationError$outboundSchema).optional()}));var Q1r;(function(t){t.inboundSchema=Jh.HTTPValidationError$inboundSchema,t.outboundSchema=Jh.HTTPValidationError$outboundSchema})(Q1r||(Jh.HTTPValidationError$=Q1r={}))});var Qn=S(Wx=>{"use strict";var BLo=Wx&&Wx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cse=Wx&&Wx.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BLo(e,t,r)};Object.defineProperty(Wx,"__esModule",{value:!0});Cse(Hut(),Wx);Cse(rDr(),Wx);Cse(hlt(),Wx);Cse(ylt(),Wx);Cse(kPe(),Wx)});var vr=S(oB=>{"use strict";var nDr=oB&&oB.__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},xse=oB&&oB.__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)},y7,Tse,oDr;Object.defineProperty(oB,"__esModule",{value:!0});oB.APIPromise=void 0;var qct=class{constructor(e){y7.set(this,void 0),Tse.set(this,void 0),this[oDr]="APIPromise",nDr(this,y7,e instanceof Promise?e:Promise.resolve(e),"f"),nDr(this,Tse,e instanceof Promise?xse(this,y7,"f").then(([r])=>r):Promise.resolve(e[0]),"f")}then(e,r){return xse(this,y7,"f").then(e?([n])=>e(n):void 0,r)}catch(e){return xse(this,Tse,"f").catch(e)}finally(e){return xse(this,Tse,"f").finally(e)}$inspect(){return xse(this,y7,"f")}};oB.APIPromise=qct;y7=new WeakMap,Tse=new WeakMap,oDr=Symbol.toStringTag});var sDr=S(GD=>{"use strict";var ULo=GD&&GD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zLo=GD&&GD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bct=GD&&GD.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ULo(r,e,n[o]);return zLo(r,e),r}}();Object.defineProperty(GD,"__esModule",{value:!0});GD.agentsComplete=XLo;var VLo=Tr(),Ose=Bct(br()),HLo=ce(),WLo=te(),iDr=_r(),JLo=mr(),aDr=Bct(zt()),KLo=Bct(Qn()),GLo=vr();function XLo(t,e,r){return new GLo.APIPromise(ZLo(t,e,r))}async function ZLo(t,e,r){let n=(0,WLo.safeParse)(e,b=>aDr.AgentsCompletionRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,VLo.encodeJSON)("body",o,{explode:!0}),a=(0,JLo.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,HLo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,iDr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,iDr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Ose.match(Ose.json(200,aDr.ChatCompletionResponse$inboundSchema),Ose.jsonErr(422,KLo.HTTPValidationError$inboundSchema),Ose.fail("4XX"),Ose.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var iB=S(qIe=>{"use strict";Object.defineProperty(qIe,"__esModule",{value:!0});qIe.EventStream=void 0;var Uct=class extends ReadableStream{constructor(e,r){let n=e.getReader(),o=new Uint8Array;super({async pull(i){try{for(;;){let a=QLo(o);if(!a){let l=await n.read();if(l.done)return i.close();o=YLo(o,l.value);continue}let s=o.slice(0,a.index);o=o.slice(a.index+a.length);let u=eFo(s,r);if(u?.value)return i.enqueue(u.value);if(u?.done)return await n.cancel("done"),i.close()}}catch(a){i.error(a),await n.cancel(a)}},cancel:i=>n.cancel(i)})}[Symbol.asyncIterator](){let e=ReadableStream.prototype[Symbol.asyncIterator];if(typeof e=="function")return e.call(this);let r=this.getReader();return{next:async()=>{let n=await r.read();return n.done?(r.releaseLock(),{done:!0,value:void 0}):{done:!1,value:n.value}},throw:async n=>(await r.cancel(n),r.releaseLock(),{done:!0,value:void 0}),return:async()=>(await r.cancel("done"),r.releaseLock(),{done:!0,value:void 0}),[Symbol.asyncIterator](){return this}}}};qIe.EventStream=Uct;function YLo(t,e){let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r}function QLo(t){let e=t.length;for(let r=0;r<e;r++){if(r<=e-4&&t[r]===13&&t[r+1]===10&&t[r+2]===13&&t[r+3]===10)return{index:r,length:4};if(r<=e-2&&t[r]===13&&t[r+1]===13)return{index:r,length:2};if(r<=e-2&&t[r]===10&&t[r+1]===10)return{index:r,length:2}}return null}function eFo(t,e){let n=new TextDecoder().decode(t).split(/\r\n|\r|\n/),o=[],i={},a=!0;for(let s of n){if(!s||s.startsWith(":"))continue;a=!1;let u=s.indexOf(":"),l=s.slice(0,u),c=s[u+1]===" "?s.slice(u+2):s.slice(u+1);if(l==="data")o.push(c);else if(l==="event")i.event=c;else if(l==="id")i.id=c;else if(l==="retry"){let d=Number(c);isNaN(d)||(i.retry=d)}}if(!a)return o.length&&(i.data=o.join(`
`)),e(i)}});var cDr=S(XD=>{"use strict";var tFo=XD&&XD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rFo=XD&&XD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BIe=XD&&XD.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tFo(r,e,n[o]);return rFo(r,e),r}}();Object.defineProperty(XD,"__esModule",{value:!0});XD.agentsStream=dFo;var nFo=BIe(ae()),oFo=Tr(),iFo=iB(),Ese=BIe(br()),aFo=ce(),sFo=te(),uDr=_r(),uFo=mr(),lDr=BIe(zt()),lFo=BIe(Qn()),cFo=vr();function dFo(t,e,r){return new cFo.APIPromise(fFo(t,e,r))}async function fFo(t,e,r){let n=(0,sFo.safeParse)(e,b=>lDr.AgentsCompletionStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,oFo.encodeJSON)("body",o,{explode:!0}),a=(0,uFo.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,aFo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,uDr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,uDr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Ese.match(Ese.sse(200,nFo.instanceof(ReadableStream).transform(b=>new iFo.EventStream(b,_=>_.data==="[DONE]"?{done:!0}:{value:lDr.CompletionEvent$inboundSchema.parse(_)}))),Ese.jsonErr(422,lFo.HTTPValidationError$inboundSchema),Ese.fail("4XX"),Ese.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var fDr=S(UIe=>{"use strict";Object.defineProperty(UIe,"__esModule",{value:!0});UIe.Agents=void 0;var pFo=sDr(),mFo=cDr(),hFo=Vc(),dDr=Rd(),zct=class extends hFo.ClientSDK{async complete(e,r){return(0,dDr.unwrapAsync)((0,pFo.agentsComplete)(this,e,r))}async stream(e,r){return(0,dDr.unwrapAsync)((0,mFo.agentsStream)(this,e,r))}};UIe.Agents=zct});var Pse=S(Vct=>{"use strict";Object.defineProperty(Vct,"__esModule",{value:!0});Vct.isReadableStream=gFo;function gFo(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 gDr=S(ZD=>{"use strict";var yFo=ZD&&ZD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bFo=ZD&&ZD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hDr=ZD&&ZD.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yFo(r,e,n[o]);return bFo(r,e),r}}();Object.defineProperty(ZD,"__esModule",{value:!0});ZD.audioTranscriptionsComplete=TFo;var LA=Tr(),Hct=k9(),zIe=hDr(br()),_Fo=ce(),vFo=te(),pDr=_r(),wFo=mr(),mDr=hDr(zt()),SFo=vr(),CFo=HD(),xFo=Pse();function TFo(t,e,r){return new SFo.APIPromise(OFo(t,e,r))}async function OFo(t,e,r){let n=(0,vFo.safeParse)(e,g=>mDr.AudioTranscriptionRequest$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,LA.appendForm)(i,"model",o.model),o.file!==void 0)if((0,CFo.isBlobLike)(o.file))(0,LA.appendForm)(i,"file",o.file);else if((0,xFo.isReadableStream)(o.file.content)){let g=await(0,Hct.readableStreamToArrayBuffer)(o.file.content),b=(0,Hct.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream",_=new Blob([g],{type:b});(0,LA.appendForm)(i,"file",_,o.file.fileName)}else{let g=(0,Hct.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream";(0,LA.appendForm)(i,"file",new Blob([o.file.content],{type:g}),o.file.fileName)}o.file_id!==void 0&&(0,LA.appendForm)(i,"file_id",o.file_id),o.file_url!==void 0&&(0,LA.appendForm)(i,"file_url",o.file_url),o.language!==void 0&&(0,LA.appendForm)(i,"language",o.language),o.stream!==void 0&&(0,LA.appendForm)(i,"stream",o.stream),o.temperature!==void 0&&(0,LA.appendForm)(i,"temperature",o.temperature),o.timestamp_granularities!==void 0&&(0,LA.appendForm)(i,"timestamp_granularities",o.timestamp_granularities);let a=(0,wFo.pathToFunc)("/v1/audio/transcriptions")(),s=new Headers((0,_Fo.compactMap)({Accept:"application/json"})),u=await(0,pDr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,pDr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"audio_api_v1_transcriptions_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,[y]=await zIe.match(zIe.json(200,mDr.TranscriptionResponse$inboundSchema),zIe.fail("4XX"),zIe.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var _Dr=S(YD=>{"use strict";var EFo=YD&&YD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PFo=YD&&YD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jct=YD&&YD.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&EFo(r,e,n[o]);return PFo(r,e),r}}();Object.defineProperty(YD,"__esModule",{value:!0});YD.audioTranscriptionsStream=LFo;var MFo=Jct(ae()),FA=Tr(),RFo=iB(),Wct=k9(),VIe=Jct(br()),IFo=ce(),AFo=te(),yDr=_r(),NFo=mr(),bDr=Jct(zt()),DFo=vr(),jFo=HD(),$Fo=Pse();function LFo(t,e,r){return new DFo.APIPromise(FFo(t,e,r))}async function FFo(t,e,r){let n=(0,AFo.safeParse)(e,g=>bDr.AudioTranscriptionRequestStream$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,FA.appendForm)(i,"model",o.model),o.file!==void 0)if((0,jFo.isBlobLike)(o.file))(0,FA.appendForm)(i,"file",o.file);else if((0,$Fo.isReadableStream)(o.file.content)){let g=await(0,Wct.readableStreamToArrayBuffer)(o.file.content),b=(0,Wct.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream",_=new Blob([g],{type:b});(0,FA.appendForm)(i,"file",_,o.file.fileName)}else{let g=(0,Wct.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream";(0,FA.appendForm)(i,"file",new Blob([o.file.content],{type:g}),o.file.fileName)}o.file_id!==void 0&&(0,FA.appendForm)(i,"file_id",o.file_id),o.file_url!==void 0&&(0,FA.appendForm)(i,"file_url",o.file_url),o.language!==void 0&&(0,FA.appendForm)(i,"language",o.language),o.stream!==void 0&&(0,FA.appendForm)(i,"stream",o.stream),o.temperature!==void 0&&(0,FA.appendForm)(i,"temperature",o.temperature),o.timestamp_granularities!==void 0&&(0,FA.appendForm)(i,"timestamp_granularities",o.timestamp_granularities);let a=(0,NFo.pathToFunc)("/v1/audio/transcriptions#stream")(),s=new Headers((0,IFo.compactMap)({Accept:"text/event-stream"})),u=await(0,yDr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,yDr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"audio_api_v1_transcriptions_post_stream",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,[y]=await VIe.match(VIe.sse(200,MFo.instanceof(ReadableStream).transform(g=>new RFo.EventStream(g,b=>({value:bDr.TranscriptionStreamEvents$inboundSchema.parse(b)})))),VIe.fail("4XX"),VIe.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var wDr=S(HIe=>{"use strict";Object.defineProperty(HIe,"__esModule",{value:!0});HIe.Transcriptions=void 0;var kFo=gDr(),qFo=_Dr(),BFo=Vc(),vDr=Rd(),Kct=class extends BFo.ClientSDK{async complete(e,r){return(0,vDr.unwrapAsync)((0,kFo.audioTranscriptionsComplete)(this,e,r))}async stream(e,r){return(0,vDr.unwrapAsync)((0,qFo.audioTranscriptionsStream)(this,e,r))}};HIe.Transcriptions=Kct});var SDr=S(WIe=>{"use strict";Object.defineProperty(WIe,"__esModule",{value:!0});WIe.Audio=void 0;var UFo=Vc(),zFo=wDr(),Gct=class extends UFo.ClientSDK{get transcriptions(){return this._transcriptions??(this._transcriptions=new zFo.Transcriptions(this._options))}};WIe.Audio=Gct});var TDr=S(Pp=>{"use strict";var VFo=Pp&&Pp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HFo=Pp&&Pp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WFo=Pp&&Pp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&VFo(r,e,n[o]);return HFo(r,e),r}}();Object.defineProperty(Pp,"__esModule",{value:!0});Pp.AgentsApiV1AgentsGetRequest$=Pp.AgentsApiV1AgentsGetRequest$outboundSchema=Pp.AgentsApiV1AgentsGetRequest$inboundSchema=void 0;Pp.agentsApiV1AgentsGetRequestToJSON=KFo;Pp.agentsApiV1AgentsGetRequestFromJSON=GFo;var JIe=WFo(ae()),xDr=ce(),JFo=te();Pp.AgentsApiV1AgentsGetRequest$inboundSchema=JIe.object({agent_id:JIe.string()}).transform(t=>(0,xDr.remap)(t,{agent_id:"agentId"}));Pp.AgentsApiV1AgentsGetRequest$outboundSchema=JIe.object({agentId:JIe.string()}).transform(t=>(0,xDr.remap)(t,{agentId:"agent_id"}));var CDr;(function(t){t.inboundSchema=Pp.AgentsApiV1AgentsGetRequest$inboundSchema,t.outboundSchema=Pp.AgentsApiV1AgentsGetRequest$outboundSchema})(CDr||(Pp.AgentsApiV1AgentsGetRequest$=CDr={}));function KFo(t){return JSON.stringify(Pp.AgentsApiV1AgentsGetRequest$outboundSchema.parse(t))}function GFo(t){return(0,JFo.safeParse)(t,e=>Pp.AgentsApiV1AgentsGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsGetRequest' from JSON")}});var PDr=S(Mp=>{"use strict";var XFo=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]}),ZFo=Mp&&Mp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YFo=Mp&&Mp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XFo(r,e,n[o]);return ZFo(r,e),r}}();Object.defineProperty(Mp,"__esModule",{value:!0});Mp.AgentsApiV1AgentsListRequest$=Mp.AgentsApiV1AgentsListRequest$outboundSchema=Mp.AgentsApiV1AgentsListRequest$inboundSchema=void 0;Mp.agentsApiV1AgentsListRequestToJSON=eko;Mp.agentsApiV1AgentsListRequestFromJSON=tko;var b7=YFo(ae()),EDr=ce(),QFo=te();Mp.AgentsApiV1AgentsListRequest$inboundSchema=b7.object({page:b7.number().int().default(0),page_size:b7.number().int().default(20)}).transform(t=>(0,EDr.remap)(t,{page_size:"pageSize"}));Mp.AgentsApiV1AgentsListRequest$outboundSchema=b7.object({page:b7.number().int().default(0),pageSize:b7.number().int().default(20)}).transform(t=>(0,EDr.remap)(t,{pageSize:"page_size"}));var ODr;(function(t){t.inboundSchema=Mp.AgentsApiV1AgentsListRequest$inboundSchema,t.outboundSchema=Mp.AgentsApiV1AgentsListRequest$outboundSchema})(ODr||(Mp.AgentsApiV1AgentsListRequest$=ODr={}));function eko(t){return JSON.stringify(Mp.AgentsApiV1AgentsListRequest$outboundSchema.parse(t))}function tko(t){return(0,QFo.safeParse)(t,e=>Mp.AgentsApiV1AgentsListRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsListRequest' from JSON")}});var NDr=S(Rp=>{"use strict";var rko=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]}),nko=Rp&&Rp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RDr=Rp&&Rp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rko(r,e,n[o]);return nko(r,e),r}}();Object.defineProperty(Rp,"__esModule",{value:!0});Rp.AgentsApiV1AgentsUpdateRequest$=Rp.AgentsApiV1AgentsUpdateRequest$outboundSchema=Rp.AgentsApiV1AgentsUpdateRequest$inboundSchema=void 0;Rp.agentsApiV1AgentsUpdateRequestToJSON=iko;Rp.agentsApiV1AgentsUpdateRequestFromJSON=ako;var KIe=RDr(ae()),IDr=ce(),oko=te(),ADr=RDr(zt());Rp.AgentsApiV1AgentsUpdateRequest$inboundSchema=KIe.object({agent_id:KIe.string(),AgentUpdateRequest:ADr.AgentUpdateRequest$inboundSchema}).transform(t=>(0,IDr.remap)(t,{agent_id:"agentId",AgentUpdateRequest:"agentUpdateRequest"}));Rp.AgentsApiV1AgentsUpdateRequest$outboundSchema=KIe.object({agentId:KIe.string(),agentUpdateRequest:ADr.AgentUpdateRequest$outboundSchema}).transform(t=>(0,IDr.remap)(t,{agentId:"agent_id",agentUpdateRequest:"AgentUpdateRequest"}));var MDr;(function(t){t.inboundSchema=Rp.AgentsApiV1AgentsUpdateRequest$inboundSchema,t.outboundSchema=Rp.AgentsApiV1AgentsUpdateRequest$outboundSchema})(MDr||(Rp.AgentsApiV1AgentsUpdateRequest$=MDr={}));function iko(t){return JSON.stringify(Rp.AgentsApiV1AgentsUpdateRequest$outboundSchema.parse(t))}function ako(t){return(0,oko.safeParse)(t,e=>Rp.AgentsApiV1AgentsUpdateRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsUpdateRequest' from JSON")}});var $Dr=S(Ip=>{"use strict";var sko=Ip&&Ip.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uko=Ip&&Ip.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lko=Ip&&Ip.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sko(r,e,n[o]);return uko(r,e),r}}();Object.defineProperty(Ip,"__esModule",{value:!0});Ip.AgentsApiV1AgentsUpdateVersionRequest$=Ip.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema=Ip.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema=void 0;Ip.agentsApiV1AgentsUpdateVersionRequestToJSON=dko;Ip.agentsApiV1AgentsUpdateVersionRequestFromJSON=fko;var _7=lko(ae()),jDr=ce(),cko=te();Ip.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema=_7.object({agent_id:_7.string(),version:_7.number().int()}).transform(t=>(0,jDr.remap)(t,{agent_id:"agentId"}));Ip.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema=_7.object({agentId:_7.string(),version:_7.number().int()}).transform(t=>(0,jDr.remap)(t,{agentId:"agent_id"}));var DDr;(function(t){t.inboundSchema=Ip.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema,t.outboundSchema=Ip.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema})(DDr||(Ip.AgentsApiV1AgentsUpdateVersionRequest$=DDr={}));function dko(t){return JSON.stringify(Ip.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema.parse(t))}function fko(t){return(0,cko.safeParse)(t,e=>Ip.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsUpdateVersionRequest' from JSON")}});var BDr=S(Ap=>{"use strict";var pko=Ap&&Ap.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mko=Ap&&Ap.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FDr=Ap&&Ap.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pko(r,e,n[o]);return mko(r,e),r}}();Object.defineProperty(Ap,"__esModule",{value:!0});Ap.AgentsApiV1ConversationsAppendRequest$=Ap.AgentsApiV1ConversationsAppendRequest$outboundSchema=Ap.AgentsApiV1ConversationsAppendRequest$inboundSchema=void 0;Ap.agentsApiV1ConversationsAppendRequestToJSON=gko;Ap.agentsApiV1ConversationsAppendRequestFromJSON=yko;var GIe=FDr(ae()),kDr=ce(),hko=te(),qDr=FDr(zt());Ap.AgentsApiV1ConversationsAppendRequest$inboundSchema=GIe.object({conversation_id:GIe.string(),ConversationAppendRequest:qDr.ConversationAppendRequest$inboundSchema}).transform(t=>(0,kDr.remap)(t,{conversation_id:"conversationId",ConversationAppendRequest:"conversationAppendRequest"}));Ap.AgentsApiV1ConversationsAppendRequest$outboundSchema=GIe.object({conversationId:GIe.string(),conversationAppendRequest:qDr.ConversationAppendRequest$outboundSchema}).transform(t=>(0,kDr.remap)(t,{conversationId:"conversation_id",conversationAppendRequest:"ConversationAppendRequest"}));var LDr;(function(t){t.inboundSchema=Ap.AgentsApiV1ConversationsAppendRequest$inboundSchema,t.outboundSchema=Ap.AgentsApiV1ConversationsAppendRequest$outboundSchema})(LDr||(Ap.AgentsApiV1ConversationsAppendRequest$=LDr={}));function gko(t){return JSON.stringify(Ap.AgentsApiV1ConversationsAppendRequest$outboundSchema.parse(t))}function yko(t){return(0,hko.safeParse)(t,e=>Ap.AgentsApiV1ConversationsAppendRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsAppendRequest' from JSON")}});var WDr=S(Np=>{"use strict";var bko=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]}),_ko=Np&&Np.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zDr=Np&&Np.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bko(r,e,n[o]);return _ko(r,e),r}}();Object.defineProperty(Np,"__esModule",{value:!0});Np.AgentsApiV1ConversationsAppendStreamRequest$=Np.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema=Np.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema=void 0;Np.agentsApiV1ConversationsAppendStreamRequestToJSON=wko;Np.agentsApiV1ConversationsAppendStreamRequestFromJSON=Sko;var XIe=zDr(ae()),VDr=ce(),vko=te(),HDr=zDr(zt());Np.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema=XIe.object({conversation_id:XIe.string(),ConversationAppendStreamRequest:HDr.ConversationAppendStreamRequest$inboundSchema}).transform(t=>(0,VDr.remap)(t,{conversation_id:"conversationId",ConversationAppendStreamRequest:"conversationAppendStreamRequest"}));Np.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema=XIe.object({conversationId:XIe.string(),conversationAppendStreamRequest:HDr.ConversationAppendStreamRequest$outboundSchema}).transform(t=>(0,VDr.remap)(t,{conversationId:"conversation_id",conversationAppendStreamRequest:"ConversationAppendStreamRequest"}));var UDr;(function(t){t.inboundSchema=Np.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema,t.outboundSchema=Np.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema})(UDr||(Np.AgentsApiV1ConversationsAppendStreamRequest$=UDr={}));function wko(t){return JSON.stringify(Np.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema.parse(t))}function Sko(t){return(0,vko.safeParse)(t,e=>Np.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsAppendStreamRequest' from JSON")}});var YDr=S(Ms=>{"use strict";var Cko=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]}),xko=Ms&&Ms.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GDr=Ms&&Ms.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Cko(r,e,n[o]);return xko(r,e),r}}();Object.defineProperty(Ms,"__esModule",{value:!0});Ms.AgentsApiV1ConversationsGetResponseV1ConversationsGet$=Ms.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema=Ms.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema=Ms.AgentsApiV1ConversationsGetRequest$=Ms.AgentsApiV1ConversationsGetRequest$outboundSchema=Ms.AgentsApiV1ConversationsGetRequest$inboundSchema=void 0;Ms.agentsApiV1ConversationsGetRequestToJSON=Tko;Ms.agentsApiV1ConversationsGetRequestFromJSON=Oko;Ms.agentsApiV1ConversationsGetResponseV1ConversationsGetToJSON=Eko;Ms.agentsApiV1ConversationsGetResponseV1ConversationsGetFromJSON=Pko;var v7=GDr(ae()),XDr=ce(),ZDr=te(),ZIe=GDr(zt());Ms.AgentsApiV1ConversationsGetRequest$inboundSchema=v7.object({conversation_id:v7.string()}).transform(t=>(0,XDr.remap)(t,{conversation_id:"conversationId"}));Ms.AgentsApiV1ConversationsGetRequest$outboundSchema=v7.object({conversationId:v7.string()}).transform(t=>(0,XDr.remap)(t,{conversationId:"conversation_id"}));var JDr;(function(t){t.inboundSchema=Ms.AgentsApiV1ConversationsGetRequest$inboundSchema,t.outboundSchema=Ms.AgentsApiV1ConversationsGetRequest$outboundSchema})(JDr||(Ms.AgentsApiV1ConversationsGetRequest$=JDr={}));function Tko(t){return JSON.stringify(Ms.AgentsApiV1ConversationsGetRequest$outboundSchema.parse(t))}function Oko(t){return(0,ZDr.safeParse)(t,e=>Ms.AgentsApiV1ConversationsGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsGetRequest' from JSON")}Ms.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema=v7.union([ZIe.ModelConversation$inboundSchema,ZIe.AgentConversation$inboundSchema]);Ms.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema=v7.union([ZIe.ModelConversation$outboundSchema,ZIe.AgentConversation$outboundSchema]);var KDr;(function(t){t.inboundSchema=Ms.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema,t.outboundSchema=Ms.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema})(KDr||(Ms.AgentsApiV1ConversationsGetResponseV1ConversationsGet$=KDr={}));function Eko(t){return JSON.stringify(Ms.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema.parse(t))}function Pko(t){return(0,ZDr.safeParse)(t,e=>Ms.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsGetResponseV1ConversationsGet' from JSON")}});var tjr=S(Dp=>{"use strict";var Mko=Dp&&Dp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Rko=Dp&&Dp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Iko=Dp&&Dp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Mko(r,e,n[o]);return Rko(r,e),r}}();Object.defineProperty(Dp,"__esModule",{value:!0});Dp.AgentsApiV1ConversationsHistoryRequest$=Dp.AgentsApiV1ConversationsHistoryRequest$outboundSchema=Dp.AgentsApiV1ConversationsHistoryRequest$inboundSchema=void 0;Dp.agentsApiV1ConversationsHistoryRequestToJSON=Nko;Dp.agentsApiV1ConversationsHistoryRequestFromJSON=Dko;var YIe=Iko(ae()),ejr=ce(),Ako=te();Dp.AgentsApiV1ConversationsHistoryRequest$inboundSchema=YIe.object({conversation_id:YIe.string()}).transform(t=>(0,ejr.remap)(t,{conversation_id:"conversationId"}));Dp.AgentsApiV1ConversationsHistoryRequest$outboundSchema=YIe.object({conversationId:YIe.string()}).transform(t=>(0,ejr.remap)(t,{conversationId:"conversation_id"}));var QDr;(function(t){t.inboundSchema=Dp.AgentsApiV1ConversationsHistoryRequest$inboundSchema,t.outboundSchema=Dp.AgentsApiV1ConversationsHistoryRequest$outboundSchema})(QDr||(Dp.AgentsApiV1ConversationsHistoryRequest$=QDr={}));function Nko(t){return JSON.stringify(Dp.AgentsApiV1ConversationsHistoryRequest$outboundSchema.parse(t))}function Dko(t){return(0,Ako.safeParse)(t,e=>Dp.AgentsApiV1ConversationsHistoryRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsHistoryRequest' from JSON")}});var sjr=S(Rs=>{"use strict";var jko=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]}),$ko=Rs&&Rs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ojr=Rs&&Rs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jko(r,e,n[o]);return $ko(r,e),r}}();Object.defineProperty(Rs,"__esModule",{value:!0});Rs.ResponseBody$=Rs.ResponseBody$outboundSchema=Rs.ResponseBody$inboundSchema=Rs.AgentsApiV1ConversationsListRequest$=Rs.AgentsApiV1ConversationsListRequest$outboundSchema=Rs.AgentsApiV1ConversationsListRequest$inboundSchema=void 0;Rs.agentsApiV1ConversationsListRequestToJSON=Lko;Rs.agentsApiV1ConversationsListRequestFromJSON=Fko;Rs.responseBodyToJSON=kko;Rs.responseBodyFromJSON=qko;var aB=ojr(ae()),ijr=ce(),ajr=te(),QIe=ojr(zt());Rs.AgentsApiV1ConversationsListRequest$inboundSchema=aB.object({page:aB.number().int().default(0),page_size:aB.number().int().default(100)}).transform(t=>(0,ijr.remap)(t,{page_size:"pageSize"}));Rs.AgentsApiV1ConversationsListRequest$outboundSchema=aB.object({page:aB.number().int().default(0),pageSize:aB.number().int().default(100)}).transform(t=>(0,ijr.remap)(t,{pageSize:"page_size"}));var rjr;(function(t){t.inboundSchema=Rs.AgentsApiV1ConversationsListRequest$inboundSchema,t.outboundSchema=Rs.AgentsApiV1ConversationsListRequest$outboundSchema})(rjr||(Rs.AgentsApiV1ConversationsListRequest$=rjr={}));function Lko(t){return JSON.stringify(Rs.AgentsApiV1ConversationsListRequest$outboundSchema.parse(t))}function Fko(t){return(0,ajr.safeParse)(t,e=>Rs.AgentsApiV1ConversationsListRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsListRequest' from JSON")}Rs.ResponseBody$inboundSchema=aB.union([QIe.ModelConversation$inboundSchema,QIe.AgentConversation$inboundSchema]);Rs.ResponseBody$outboundSchema=aB.union([QIe.ModelConversation$outboundSchema,QIe.AgentConversation$outboundSchema]);var njr;(function(t){t.inboundSchema=Rs.ResponseBody$inboundSchema,t.outboundSchema=Rs.ResponseBody$outboundSchema})(njr||(Rs.ResponseBody$=njr={}));function kko(t){return JSON.stringify(Rs.ResponseBody$outboundSchema.parse(t))}function qko(t){return(0,ajr.safeParse)(t,e=>Rs.ResponseBody$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseBody' from JSON")}});var cjr=S(jp=>{"use strict";var Bko=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]}),Uko=jp&&jp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zko=jp&&jp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Bko(r,e,n[o]);return Uko(r,e),r}}();Object.defineProperty(jp,"__esModule",{value:!0});jp.AgentsApiV1ConversationsMessagesRequest$=jp.AgentsApiV1ConversationsMessagesRequest$outboundSchema=jp.AgentsApiV1ConversationsMessagesRequest$inboundSchema=void 0;jp.agentsApiV1ConversationsMessagesRequestToJSON=Hko;jp.agentsApiV1ConversationsMessagesRequestFromJSON=Wko;var eAe=zko(ae()),ljr=ce(),Vko=te();jp.AgentsApiV1ConversationsMessagesRequest$inboundSchema=eAe.object({conversation_id:eAe.string()}).transform(t=>(0,ljr.remap)(t,{conversation_id:"conversationId"}));jp.AgentsApiV1ConversationsMessagesRequest$outboundSchema=eAe.object({conversationId:eAe.string()}).transform(t=>(0,ljr.remap)(t,{conversationId:"conversation_id"}));var ujr;(function(t){t.inboundSchema=jp.AgentsApiV1ConversationsMessagesRequest$inboundSchema,t.outboundSchema=jp.AgentsApiV1ConversationsMessagesRequest$outboundSchema})(ujr||(jp.AgentsApiV1ConversationsMessagesRequest$=ujr={}));function Hko(t){return JSON.stringify(jp.AgentsApiV1ConversationsMessagesRequest$outboundSchema.parse(t))}function Wko(t){return(0,Vko.safeParse)(t,e=>jp.AgentsApiV1ConversationsMessagesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsMessagesRequest' from JSON")}});var hjr=S($p=>{"use strict";var Jko=$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]}),Kko=$p&&$p.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fjr=$p&&$p.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Jko(r,e,n[o]);return Kko(r,e),r}}();Object.defineProperty($p,"__esModule",{value:!0});$p.AgentsApiV1ConversationsRestartRequest$=$p.AgentsApiV1ConversationsRestartRequest$outboundSchema=$p.AgentsApiV1ConversationsRestartRequest$inboundSchema=void 0;$p.agentsApiV1ConversationsRestartRequestToJSON=Xko;$p.agentsApiV1ConversationsRestartRequestFromJSON=Zko;var tAe=fjr(ae()),pjr=ce(),Gko=te(),mjr=fjr(zt());$p.AgentsApiV1ConversationsRestartRequest$inboundSchema=tAe.object({conversation_id:tAe.string(),ConversationRestartRequest:mjr.ConversationRestartRequest$inboundSchema}).transform(t=>(0,pjr.remap)(t,{conversation_id:"conversationId",ConversationRestartRequest:"conversationRestartRequest"}));$p.AgentsApiV1ConversationsRestartRequest$outboundSchema=tAe.object({conversationId:tAe.string(),conversationRestartRequest:mjr.ConversationRestartRequest$outboundSchema}).transform(t=>(0,pjr.remap)(t,{conversationId:"conversation_id",conversationRestartRequest:"ConversationRestartRequest"}));var djr;(function(t){t.inboundSchema=$p.AgentsApiV1ConversationsRestartRequest$inboundSchema,t.outboundSchema=$p.AgentsApiV1ConversationsRestartRequest$outboundSchema})(djr||($p.AgentsApiV1ConversationsRestartRequest$=djr={}));function Xko(t){return JSON.stringify($p.AgentsApiV1ConversationsRestartRequest$outboundSchema.parse(t))}function Zko(t){return(0,Gko.safeParse)(t,e=>$p.AgentsApiV1ConversationsRestartRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsRestartRequest' from JSON")}});var vjr=S(Lp=>{"use strict";var Yko=Lp&&Lp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qko=Lp&&Lp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yjr=Lp&&Lp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Yko(r,e,n[o]);return Qko(r,e),r}}();Object.defineProperty(Lp,"__esModule",{value:!0});Lp.AgentsApiV1ConversationsRestartStreamRequest$=Lp.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema=Lp.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema=void 0;Lp.agentsApiV1ConversationsRestartStreamRequestToJSON=tqo;Lp.agentsApiV1ConversationsRestartStreamRequestFromJSON=rqo;var rAe=yjr(ae()),bjr=ce(),eqo=te(),_jr=yjr(zt());Lp.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema=rAe.object({conversation_id:rAe.string(),ConversationRestartStreamRequest:_jr.ConversationRestartStreamRequest$inboundSchema}).transform(t=>(0,bjr.remap)(t,{conversation_id:"conversationId",ConversationRestartStreamRequest:"conversationRestartStreamRequest"}));Lp.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema=rAe.object({conversationId:rAe.string(),conversationRestartStreamRequest:_jr.ConversationRestartStreamRequest$outboundSchema}).transform(t=>(0,bjr.remap)(t,{conversationId:"conversation_id",conversationRestartStreamRequest:"ConversationRestartStreamRequest"}));var gjr;(function(t){t.inboundSchema=Lp.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema,t.outboundSchema=Lp.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema})(gjr||(Lp.AgentsApiV1ConversationsRestartStreamRequest$=gjr={}));function tqo(t){return JSON.stringify(Lp.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema.parse(t))}function rqo(t){return(0,eqo.safeParse)(t,e=>Lp.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsRestartStreamRequest' from JSON")}});var Cjr=S(Fp=>{"use strict";var nqo=Fp&&Fp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oqo=Fp&&Fp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iqo=Fp&&Fp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nqo(r,e,n[o]);return oqo(r,e),r}}();Object.defineProperty(Fp,"__esModule",{value:!0});Fp.DeleteModelV1ModelsModelIdDeleteRequest$=Fp.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Fp.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;Fp.deleteModelV1ModelsModelIdDeleteRequestToJSON=sqo;Fp.deleteModelV1ModelsModelIdDeleteRequestFromJSON=uqo;var nAe=iqo(ae()),Sjr=ce(),aqo=te();Fp.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=nAe.object({model_id:nAe.string()}).transform(t=>(0,Sjr.remap)(t,{model_id:"modelId"}));Fp.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=nAe.object({modelId:nAe.string()}).transform(t=>(0,Sjr.remap)(t,{modelId:"model_id"}));var wjr;(function(t){t.inboundSchema=Fp.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=Fp.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(wjr||(Fp.DeleteModelV1ModelsModelIdDeleteRequest$=wjr={}));function sqo(t){return JSON.stringify(Fp.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function uqo(t){return(0,aqo.safeParse)(t,e=>Fp.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var Ojr=S(kp=>{"use strict";var lqo=kp&&kp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cqo=kp&&kp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dqo=kp&&kp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&lqo(r,e,n[o]);return cqo(r,e),r}}();Object.defineProperty(kp,"__esModule",{value:!0});kp.FilesApiRoutesDeleteFileRequest$=kp.FilesApiRoutesDeleteFileRequest$outboundSchema=kp.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;kp.filesApiRoutesDeleteFileRequestToJSON=pqo;kp.filesApiRoutesDeleteFileRequestFromJSON=mqo;var oAe=dqo(ae()),Tjr=ce(),fqo=te();kp.FilesApiRoutesDeleteFileRequest$inboundSchema=oAe.object({file_id:oAe.string()}).transform(t=>(0,Tjr.remap)(t,{file_id:"fileId"}));kp.FilesApiRoutesDeleteFileRequest$outboundSchema=oAe.object({fileId:oAe.string()}).transform(t=>(0,Tjr.remap)(t,{fileId:"file_id"}));var xjr;(function(t){t.inboundSchema=kp.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=kp.FilesApiRoutesDeleteFileRequest$outboundSchema})(xjr||(kp.FilesApiRoutesDeleteFileRequest$=xjr={}));function pqo(t){return JSON.stringify(kp.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function mqo(t){return(0,fqo.safeParse)(t,e=>kp.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var Mjr=S(qp=>{"use strict";var hqo=qp&&qp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gqo=qp&&qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yqo=qp&&qp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hqo(r,e,n[o]);return gqo(r,e),r}}();Object.defineProperty(qp,"__esModule",{value:!0});qp.FilesApiRoutesDownloadFileRequest$=qp.FilesApiRoutesDownloadFileRequest$outboundSchema=qp.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;qp.filesApiRoutesDownloadFileRequestToJSON=_qo;qp.filesApiRoutesDownloadFileRequestFromJSON=vqo;var iAe=yqo(ae()),Pjr=ce(),bqo=te();qp.FilesApiRoutesDownloadFileRequest$inboundSchema=iAe.object({file_id:iAe.string()}).transform(t=>(0,Pjr.remap)(t,{file_id:"fileId"}));qp.FilesApiRoutesDownloadFileRequest$outboundSchema=iAe.object({fileId:iAe.string()}).transform(t=>(0,Pjr.remap)(t,{fileId:"file_id"}));var Ejr;(function(t){t.inboundSchema=qp.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=qp.FilesApiRoutesDownloadFileRequest$outboundSchema})(Ejr||(qp.FilesApiRoutesDownloadFileRequest$=Ejr={}));function _qo(t){return JSON.stringify(qp.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function vqo(t){return(0,bqo.safeParse)(t,e=>qp.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var Ajr=S(Bp=>{"use strict";var wqo=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]}),Sqo=Bp&&Bp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cqo=Bp&&Bp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wqo(r,e,n[o]);return Sqo(r,e),r}}();Object.defineProperty(Bp,"__esModule",{value:!0});Bp.FilesApiRoutesGetSignedUrlRequest$=Bp.FilesApiRoutesGetSignedUrlRequest$outboundSchema=Bp.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;Bp.filesApiRoutesGetSignedUrlRequestToJSON=Tqo;Bp.filesApiRoutesGetSignedUrlRequestFromJSON=Oqo;var w7=Cqo(ae()),Ijr=ce(),xqo=te();Bp.FilesApiRoutesGetSignedUrlRequest$inboundSchema=w7.object({file_id:w7.string(),expiry:w7.number().int().default(24)}).transform(t=>(0,Ijr.remap)(t,{file_id:"fileId"}));Bp.FilesApiRoutesGetSignedUrlRequest$outboundSchema=w7.object({fileId:w7.string(),expiry:w7.number().int().default(24)}).transform(t=>(0,Ijr.remap)(t,{fileId:"file_id"}));var Rjr;(function(t){t.inboundSchema=Bp.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=Bp.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(Rjr||(Bp.FilesApiRoutesGetSignedUrlRequest$=Rjr={}));function Tqo(t){return JSON.stringify(Bp.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function Oqo(t){return(0,xqo.safeParse)(t,e=>Bp.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var $jr=S(zp=>{"use strict";var Eqo=zp&&zp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pqo=zp&&zp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Djr=zp&&zp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Eqo(r,e,n[o]);return Pqo(r,e),r}}();Object.defineProperty(zp,"__esModule",{value:!0});zp.FilesApiRoutesListFilesRequest$=zp.FilesApiRoutesListFilesRequest$outboundSchema=zp.FilesApiRoutesListFilesRequest$inboundSchema=void 0;zp.filesApiRoutesListFilesRequestToJSON=Rqo;zp.filesApiRoutesListFilesRequestFromJSON=Iqo;var Up=Djr(ae()),jjr=ce(),Mqo=te(),S7=Djr(zt());zp.FilesApiRoutesListFilesRequest$inboundSchema=Up.object({page:Up.number().int().default(0),page_size:Up.number().int().default(100),sample_type:Up.nullable(Up.array(S7.SampleType$inboundSchema)).optional(),source:Up.nullable(Up.array(S7.Source$inboundSchema)).optional(),search:Up.nullable(Up.string()).optional(),purpose:Up.nullable(S7.FilePurpose$inboundSchema).optional()}).transform(t=>(0,jjr.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));zp.FilesApiRoutesListFilesRequest$outboundSchema=Up.object({page:Up.number().int().default(0),pageSize:Up.number().int().default(100),sampleType:Up.nullable(Up.array(S7.SampleType$outboundSchema)).optional(),source:Up.nullable(Up.array(S7.Source$outboundSchema)).optional(),search:Up.nullable(Up.string()).optional(),purpose:Up.nullable(S7.FilePurpose$outboundSchema).optional()}).transform(t=>(0,jjr.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var Njr;(function(t){t.inboundSchema=zp.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=zp.FilesApiRoutesListFilesRequest$outboundSchema})(Njr||(zp.FilesApiRoutesListFilesRequest$=Njr={}));function Rqo(t){return JSON.stringify(zp.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function Iqo(t){return(0,Mqo.safeParse)(t,e=>zp.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var kjr=S(Vp=>{"use strict";var Aqo=Vp&&Vp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Nqo=Vp&&Vp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dqo=Vp&&Vp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Aqo(r,e,n[o]);return Nqo(r,e),r}}();Object.defineProperty(Vp,"__esModule",{value:!0});Vp.FilesApiRoutesRetrieveFileRequest$=Vp.FilesApiRoutesRetrieveFileRequest$outboundSchema=Vp.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;Vp.filesApiRoutesRetrieveFileRequestToJSON=$qo;Vp.filesApiRoutesRetrieveFileRequestFromJSON=Lqo;var aAe=Dqo(ae()),Fjr=ce(),jqo=te();Vp.FilesApiRoutesRetrieveFileRequest$inboundSchema=aAe.object({file_id:aAe.string()}).transform(t=>(0,Fjr.remap)(t,{file_id:"fileId"}));Vp.FilesApiRoutesRetrieveFileRequest$outboundSchema=aAe.object({fileId:aAe.string()}).transform(t=>(0,Fjr.remap)(t,{fileId:"file_id"}));var Ljr;(function(t){t.inboundSchema=Vp.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=Vp.FilesApiRoutesRetrieveFileRequest$outboundSchema})(Ljr||(Vp.FilesApiRoutesRetrieveFileRequest$=Ljr={}));function $qo(t){return JSON.stringify(Vp.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function Lqo(t){return(0,jqo.safeParse)(t,e=>Vp.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var zjr=S(Hp=>{"use strict";var Fqo=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]}),kqo=Hp&&Hp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bjr=Hp&&Hp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Fqo(r,e,n[o]);return kqo(r,e),r}}();Object.defineProperty(Hp,"__esModule",{value:!0});Hp.FilesApiRoutesUploadFileMultiPartBodyParams$=Hp.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=Hp.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=void 0;Hp.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=Uqo;Hp.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=zqo;var Ujr=Bjr(ae()),qqo=te(),Bqo=HD(),sAe=Bjr(zt());Hp.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=Ujr.object({purpose:sAe.FilePurpose$inboundSchema.optional(),file:sAe.FileT$inboundSchema});Hp.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=Ujr.object({purpose:sAe.FilePurpose$outboundSchema.optional(),file:sAe.FileT$outboundSchema.or(Bqo.blobLikeSchema)});var qjr;(function(t){t.inboundSchema=Hp.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=Hp.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(qjr||(Hp.FilesApiRoutesUploadFileMultiPartBodyParams$=qjr={}));function Uqo(t){return JSON.stringify(Hp.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function zqo(t){return(0,qqo.safeParse)(t,e=>Hp.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var Wjr=S(Wp=>{"use strict";var Vqo=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]}),Hqo=Wp&&Wp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wqo=Wp&&Wp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Vqo(r,e,n[o]);return Hqo(r,e),r}}();Object.defineProperty(Wp,"__esModule",{value:!0});Wp.JobsApiRoutesBatchCancelBatchJobRequest$=Wp.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=Wp.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;Wp.jobsApiRoutesBatchCancelBatchJobRequestToJSON=Kqo;Wp.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=Gqo;var uAe=Wqo(ae()),Hjr=ce(),Jqo=te();Wp.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=uAe.object({job_id:uAe.string()}).transform(t=>(0,Hjr.remap)(t,{job_id:"jobId"}));Wp.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=uAe.object({jobId:uAe.string()}).transform(t=>(0,Hjr.remap)(t,{jobId:"job_id"}));var Vjr;(function(t){t.inboundSchema=Wp.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=Wp.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(Vjr||(Wp.JobsApiRoutesBatchCancelBatchJobRequest$=Vjr={}));function Kqo(t){return JSON.stringify(Wp.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function Gqo(t){return(0,Jqo.safeParse)(t,e=>Wp.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var Gjr=S(Jp=>{"use strict";var Xqo=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]}),Zqo=Jp&&Jp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yqo=Jp&&Jp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Xqo(r,e,n[o]);return Zqo(r,e),r}}();Object.defineProperty(Jp,"__esModule",{value:!0});Jp.JobsApiRoutesBatchGetBatchJobRequest$=Jp.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=Jp.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;Jp.jobsApiRoutesBatchGetBatchJobRequestToJSON=eBo;Jp.jobsApiRoutesBatchGetBatchJobRequestFromJSON=tBo;var lAe=Yqo(ae()),Kjr=ce(),Qqo=te();Jp.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=lAe.object({job_id:lAe.string()}).transform(t=>(0,Kjr.remap)(t,{job_id:"jobId"}));Jp.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=lAe.object({jobId:lAe.string()}).transform(t=>(0,Kjr.remap)(t,{jobId:"job_id"}));var Jjr;(function(t){t.inboundSchema=Jp.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=Jp.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(Jjr||(Jp.JobsApiRoutesBatchGetBatchJobRequest$=Jjr={}));function eBo(t){return JSON.stringify(Jp.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function tBo(t){return(0,Qqo.safeParse)(t,e=>Jp.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var e$r=S(Kp=>{"use strict";var rBo=Kp&&Kp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nBo=Kp&&Kp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zjr=Kp&&Kp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rBo(r,e,n[o]);return nBo(r,e),r}}();Object.defineProperty(Kp,"__esModule",{value:!0});Kp.JobsApiRoutesBatchGetBatchJobsRequest$=Kp.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Kp.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;Kp.jobsApiRoutesBatchGetBatchJobsRequestToJSON=iBo;Kp.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=aBo;var tu=Zjr(ae()),Yjr=ce(),oBo=te(),Qjr=Zjr(zt());Kp.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=tu.object({page:tu.number().int().default(0),page_size:tu.number().int().default(100),model:tu.nullable(tu.string()).optional(),agent_id:tu.nullable(tu.string()).optional(),metadata:tu.nullable(tu.record(tu.any())).optional(),created_after:tu.nullable(tu.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:tu.boolean().default(!1),status:tu.nullable(tu.array(Qjr.BatchJobStatus$inboundSchema)).optional()}).transform(t=>(0,Yjr.remap)(t,{page_size:"pageSize",agent_id:"agentId",created_after:"createdAfter",created_by_me:"createdByMe"}));Kp.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=tu.object({page:tu.number().int().default(0),pageSize:tu.number().int().default(100),model:tu.nullable(tu.string()).optional(),agentId:tu.nullable(tu.string()).optional(),metadata:tu.nullable(tu.record(tu.any())).optional(),createdAfter:tu.nullable(tu.date().transform(t=>t.toISOString())).optional(),createdByMe:tu.boolean().default(!1),status:tu.nullable(tu.array(Qjr.BatchJobStatus$outboundSchema)).optional()}).transform(t=>(0,Yjr.remap)(t,{pageSize:"page_size",agentId:"agent_id",createdAfter:"created_after",createdByMe:"created_by_me"}));var Xjr;(function(t){t.inboundSchema=Kp.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=Kp.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(Xjr||(Kp.JobsApiRoutesBatchGetBatchJobsRequest$=Xjr={}));function iBo(t){return JSON.stringify(Kp.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function aBo(t){return(0,oBo.safeParse)(t,e=>Kp.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var n$r=S(Gp=>{"use strict";var sBo=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]}),uBo=Gp&&Gp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lBo=Gp&&Gp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sBo(r,e,n[o]);return uBo(r,e),r}}();Object.defineProperty(Gp,"__esModule",{value:!0});Gp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=Gp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=Gp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;Gp.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=dBo;Gp.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=fBo;var cAe=lBo(ae()),r$r=ce(),cBo=te();Gp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=cAe.object({model_id:cAe.string()}).transform(t=>(0,r$r.remap)(t,{model_id:"modelId"}));Gp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=cAe.object({modelId:cAe.string()}).transform(t=>(0,r$r.remap)(t,{modelId:"model_id"}));var t$r;(function(t){t.inboundSchema=Gp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=Gp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(t$r||(Gp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=t$r={}));function dBo(t){return JSON.stringify(Gp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function fBo(t){return(0,cBo.safeParse)(t,e=>Gp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var l$r=S(Is=>{"use strict";var pBo=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]}),mBo=Is&&Is.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a$r=Is&&Is.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pBo(r,e,n[o]);return mBo(r,e),r}}();Object.defineProperty(Is,"__esModule",{value:!0});Is.JobsApiRoutesFineTuningCancelFineTuningJobResponse$=Is.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema=Is.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema=Is.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=Is.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=Is.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;Is.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=hBo;Is.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=gBo;Is.jobsApiRoutesFineTuningCancelFineTuningJobResponseToJSON=yBo;Is.jobsApiRoutesFineTuningCancelFineTuningJobResponseFromJSON=bBo;var mv=a$r(ae()),s$r=ce(),u$r=te(),dAe=a$r(zt());Is.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=mv.object({job_id:mv.string()}).transform(t=>(0,s$r.remap)(t,{job_id:"jobId"}));Is.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=mv.object({jobId:mv.string()}).transform(t=>(0,s$r.remap)(t,{jobId:"job_id"}));var o$r;(function(t){t.inboundSchema=Is.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=Is.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(o$r||(Is.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=o$r={}));function hBo(t){return JSON.stringify(Is.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function gBo(t){return(0,u$r.safeParse)(t,e=>Is.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}Is.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema=mv.union([dAe.ClassifierDetailedJobOut$inboundSchema.and(mv.object({job_type:mv.literal("classifier")}).transform(t=>({jobType:t.job_type}))),dAe.CompletionDetailedJobOut$inboundSchema.and(mv.object({job_type:mv.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Is.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema=mv.union([dAe.ClassifierDetailedJobOut$outboundSchema.and(mv.object({jobType:mv.literal("classifier")}).transform(t=>({job_type:t.jobType}))),dAe.CompletionDetailedJobOut$outboundSchema.and(mv.object({jobType:mv.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var i$r;(function(t){t.inboundSchema=Is.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema,t.outboundSchema=Is.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema})(i$r||(Is.JobsApiRoutesFineTuningCancelFineTuningJobResponse$=i$r={}));function yBo(t){return JSON.stringify(Is.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema.parse(t))}function bBo(t){return(0,u$r.safeParse)(t,e=>Is.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobResponse' from JSON")}});var m$r=S(As=>{"use strict";var _Bo=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]}),vBo=As&&As.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f$r=As&&As.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Bo(r,e,n[o]);return vBo(r,e),r}}();Object.defineProperty(As,"__esModule",{value:!0});As.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=As.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=As.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=As.One$=As.One$outboundSchema=As.One$inboundSchema=void 0;As.oneToJSON=wBo;As.oneFromJSON=SBo;As.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=CBo;As.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=xBo;var Wc=f$r(ae()),p$r=te(),kA=f$r(zt());As.One$inboundSchema=Wc.union([kA.ClassifierJobOut$inboundSchema.and(Wc.object({job_type:Wc.literal("classifier")}).transform(t=>({jobType:t.job_type}))),kA.CompletionJobOut$inboundSchema.and(Wc.object({job_type:Wc.literal("completion")}).transform(t=>({jobType:t.job_type})))]);As.One$outboundSchema=Wc.union([kA.ClassifierJobOut$outboundSchema.and(Wc.object({jobType:Wc.literal("classifier")}).transform(t=>({job_type:t.jobType}))),kA.CompletionJobOut$outboundSchema.and(Wc.object({jobType:Wc.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var c$r;(function(t){t.inboundSchema=As.One$inboundSchema,t.outboundSchema=As.One$outboundSchema})(c$r||(As.One$=c$r={}));function wBo(t){return JSON.stringify(As.One$outboundSchema.parse(t))}function SBo(t){return(0,p$r.safeParse)(t,e=>As.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}As.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=Wc.union([kA.LegacyJobMetadataOut$inboundSchema,Wc.union([kA.ClassifierJobOut$inboundSchema.and(Wc.object({job_type:Wc.literal("classifier")}).transform(t=>({jobType:t.job_type}))),kA.CompletionJobOut$inboundSchema.and(Wc.object({job_type:Wc.literal("completion")}).transform(t=>({jobType:t.job_type})))])]);As.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Wc.union([kA.LegacyJobMetadataOut$outboundSchema,Wc.union([kA.ClassifierJobOut$outboundSchema.and(Wc.object({jobType:Wc.literal("classifier")}).transform(t=>({job_type:t.jobType}))),kA.CompletionJobOut$outboundSchema.and(Wc.object({jobType:Wc.literal("completion")}).transform(t=>({job_type:t.jobType})))])]);var d$r;(function(t){t.inboundSchema=As.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=As.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(d$r||(As.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=d$r={}));function CBo(t){return JSON.stringify(As.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function xBo(t){return(0,p$r.safeParse)(t,e=>As.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var v$r=S(Ns=>{"use strict";var TBo=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]}),OBo=Ns&&Ns.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y$r=Ns&&Ns.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TBo(r,e,n[o]);return OBo(r,e),r}}();Object.defineProperty(Ns,"__esModule",{value:!0});Ns.JobsApiRoutesFineTuningGetFineTuningJobResponse$=Ns.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema=Ns.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema=Ns.JobsApiRoutesFineTuningGetFineTuningJobRequest$=Ns.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=Ns.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;Ns.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=EBo;Ns.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=PBo;Ns.jobsApiRoutesFineTuningGetFineTuningJobResponseToJSON=MBo;Ns.jobsApiRoutesFineTuningGetFineTuningJobResponseFromJSON=RBo;var hv=y$r(ae()),b$r=ce(),_$r=te(),fAe=y$r(zt());Ns.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=hv.object({job_id:hv.string()}).transform(t=>(0,b$r.remap)(t,{job_id:"jobId"}));Ns.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=hv.object({jobId:hv.string()}).transform(t=>(0,b$r.remap)(t,{jobId:"job_id"}));var h$r;(function(t){t.inboundSchema=Ns.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=Ns.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(h$r||(Ns.JobsApiRoutesFineTuningGetFineTuningJobRequest$=h$r={}));function EBo(t){return JSON.stringify(Ns.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function PBo(t){return(0,_$r.safeParse)(t,e=>Ns.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}Ns.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema=hv.union([fAe.ClassifierDetailedJobOut$inboundSchema.and(hv.object({job_type:hv.literal("classifier")}).transform(t=>({jobType:t.job_type}))),fAe.CompletionDetailedJobOut$inboundSchema.and(hv.object({job_type:hv.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Ns.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema=hv.union([fAe.ClassifierDetailedJobOut$outboundSchema.and(hv.object({jobType:hv.literal("classifier")}).transform(t=>({job_type:t.jobType}))),fAe.CompletionDetailedJobOut$outboundSchema.and(hv.object({jobType:hv.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var g$r;(function(t){t.inboundSchema=Ns.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema,t.outboundSchema=Ns.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema})(g$r||(Ns.JobsApiRoutesFineTuningGetFineTuningJobResponse$=g$r={}));function MBo(t){return JSON.stringify(Ns.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema.parse(t))}function RBo(t){return(0,_$r.safeParse)(t,e=>Ns.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobResponse' from JSON")}});var x$r=S(Qa=>{"use strict";var IBo=Qa&&Qa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ABo=Qa&&Qa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NBo=Qa&&Qa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IBo(r,e,n[o]);return ABo(r,e),r}}();Object.defineProperty(Qa,"__esModule",{value:!0});Qa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=Qa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Qa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Qa.Status$=Qa.Status$outboundSchema=Qa.Status$inboundSchema=Qa.Status=void 0;Qa.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=jBo;Qa.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=$Bo;var Gi=NBo(ae()),C$r=ce(),DBo=te();Qa.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Qa.Status$inboundSchema=Gi.nativeEnum(Qa.Status);Qa.Status$outboundSchema=Qa.Status$inboundSchema;var w$r;(function(t){t.inboundSchema=Qa.Status$inboundSchema,t.outboundSchema=Qa.Status$outboundSchema})(w$r||(Qa.Status$=w$r={}));Qa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Gi.object({page:Gi.number().int().default(0),page_size:Gi.number().int().default(100),model:Gi.nullable(Gi.string()).optional(),created_after:Gi.nullable(Gi.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_before:Gi.nullable(Gi.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Gi.boolean().default(!1),status:Gi.nullable(Qa.Status$inboundSchema).optional(),wandb_project:Gi.nullable(Gi.string()).optional(),wandb_name:Gi.nullable(Gi.string()).optional(),suffix:Gi.nullable(Gi.string()).optional()}).transform(t=>(0,C$r.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_before:"createdBefore",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));Qa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Gi.object({page:Gi.number().int().default(0),pageSize:Gi.number().int().default(100),model:Gi.nullable(Gi.string()).optional(),createdAfter:Gi.nullable(Gi.date().transform(t=>t.toISOString())).optional(),createdBefore:Gi.nullable(Gi.date().transform(t=>t.toISOString())).optional(),createdByMe:Gi.boolean().default(!1),status:Gi.nullable(Qa.Status$outboundSchema).optional(),wandbProject:Gi.nullable(Gi.string()).optional(),wandbName:Gi.nullable(Gi.string()).optional(),suffix:Gi.nullable(Gi.string()).optional()}).transform(t=>(0,C$r.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdBefore:"created_before",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var S$r;(function(t){t.inboundSchema=Qa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=Qa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(S$r||(Qa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=S$r={}));function jBo(t){return JSON.stringify(Qa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function $Bo(t){return(0,DBo.safeParse)(t,e=>Qa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var R$r=S(Ds=>{"use strict";var LBo=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]}),FBo=Ds&&Ds.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E$r=Ds&&Ds.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LBo(r,e,n[o]);return FBo(r,e),r}}();Object.defineProperty(Ds,"__esModule",{value:!0});Ds.JobsApiRoutesFineTuningStartFineTuningJobResponse$=Ds.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema=Ds.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema=Ds.JobsApiRoutesFineTuningStartFineTuningJobRequest$=Ds.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=Ds.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;Ds.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=kBo;Ds.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=qBo;Ds.jobsApiRoutesFineTuningStartFineTuningJobResponseToJSON=BBo;Ds.jobsApiRoutesFineTuningStartFineTuningJobResponseFromJSON=UBo;var gv=E$r(ae()),P$r=ce(),M$r=te(),pAe=E$r(zt());Ds.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=gv.object({job_id:gv.string()}).transform(t=>(0,P$r.remap)(t,{job_id:"jobId"}));Ds.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=gv.object({jobId:gv.string()}).transform(t=>(0,P$r.remap)(t,{jobId:"job_id"}));var T$r;(function(t){t.inboundSchema=Ds.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=Ds.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(T$r||(Ds.JobsApiRoutesFineTuningStartFineTuningJobRequest$=T$r={}));function kBo(t){return JSON.stringify(Ds.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function qBo(t){return(0,M$r.safeParse)(t,e=>Ds.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}Ds.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema=gv.union([pAe.ClassifierDetailedJobOut$inboundSchema.and(gv.object({job_type:gv.literal("classifier")}).transform(t=>({jobType:t.job_type}))),pAe.CompletionDetailedJobOut$inboundSchema.and(gv.object({job_type:gv.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Ds.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema=gv.union([pAe.ClassifierDetailedJobOut$outboundSchema.and(gv.object({jobType:gv.literal("classifier")}).transform(t=>({job_type:t.jobType}))),pAe.CompletionDetailedJobOut$outboundSchema.and(gv.object({jobType:gv.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var O$r;(function(t){t.inboundSchema=Ds.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema,t.outboundSchema=Ds.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema})(O$r||(Ds.JobsApiRoutesFineTuningStartFineTuningJobResponse$=O$r={}));function BBo(t){return JSON.stringify(Ds.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema.parse(t))}function UBo(t){return(0,M$r.safeParse)(t,e=>Ds.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobResponse' from JSON")}});var N$r=S(Xp=>{"use strict";var zBo=Xp&&Xp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VBo=Xp&&Xp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HBo=Xp&&Xp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zBo(r,e,n[o]);return VBo(r,e),r}}();Object.defineProperty(Xp,"__esModule",{value:!0});Xp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=Xp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=Xp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;Xp.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=JBo;Xp.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=KBo;var mAe=HBo(ae()),A$r=ce(),WBo=te();Xp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=mAe.object({model_id:mAe.string()}).transform(t=>(0,A$r.remap)(t,{model_id:"modelId"}));Xp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=mAe.object({modelId:mAe.string()}).transform(t=>(0,A$r.remap)(t,{modelId:"model_id"}));var I$r;(function(t){t.inboundSchema=Xp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=Xp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(I$r||(Xp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=I$r={}));function JBo(t){return JSON.stringify(Xp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function KBo(t){return(0,WBo.safeParse)(t,e=>Xp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var k$r=S(js=>{"use strict";var GBo=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]}),XBo=js&&js.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$$r=js&&js.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&GBo(r,e,n[o]);return XBo(r,e),r}}();Object.defineProperty(js,"__esModule",{value:!0});js.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$=js.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema=js.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema=js.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=js.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=js.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;js.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=ZBo;js.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=YBo;js.jobsApiRoutesFineTuningUpdateFineTunedModelResponseToJSON=QBo;js.jobsApiRoutesFineTuningUpdateFineTunedModelResponseFromJSON=eUo;var yv=$$r(ae()),L$r=ce(),F$r=te(),C7=$$r(zt());js.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=yv.object({model_id:yv.string(),UpdateFTModelIn:C7.UpdateFTModelIn$inboundSchema}).transform(t=>(0,L$r.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));js.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=yv.object({modelId:yv.string(),updateFTModelIn:C7.UpdateFTModelIn$outboundSchema}).transform(t=>(0,L$r.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var D$r;(function(t){t.inboundSchema=js.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=js.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(D$r||(js.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=D$r={}));function ZBo(t){return JSON.stringify(js.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function YBo(t){return(0,F$r.safeParse)(t,e=>js.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}js.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema=yv.union([C7.ClassifierFTModelOut$inboundSchema.and(yv.object({model_type:yv.literal("classifier")}).transform(t=>({modelType:t.model_type}))),C7.CompletionFTModelOut$inboundSchema.and(yv.object({model_type:yv.literal("completion")}).transform(t=>({modelType:t.model_type})))]);js.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema=yv.union([C7.ClassifierFTModelOut$outboundSchema.and(yv.object({modelType:yv.literal("classifier")}).transform(t=>({model_type:t.modelType}))),C7.CompletionFTModelOut$outboundSchema.and(yv.object({modelType:yv.literal("completion")}).transform(t=>({model_type:t.modelType})))]);var j$r;(function(t){t.inboundSchema=js.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema,t.outboundSchema=js.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema})(j$r||(js.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$=j$r={}));function QBo(t){return JSON.stringify(js.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema.parse(t))}function eUo(t){return(0,F$r.safeParse)(t,e=>js.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelResponse' from JSON")}});var U$r=S(Zp=>{"use strict";var tUo=Zp&&Zp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rUo=Zp&&Zp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nUo=Zp&&Zp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tUo(r,e,n[o]);return rUo(r,e),r}}();Object.defineProperty(Zp,"__esModule",{value:!0});Zp.LibrariesDeleteV1Request$=Zp.LibrariesDeleteV1Request$outboundSchema=Zp.LibrariesDeleteV1Request$inboundSchema=void 0;Zp.librariesDeleteV1RequestToJSON=iUo;Zp.librariesDeleteV1RequestFromJSON=aUo;var hAe=nUo(ae()),B$r=ce(),oUo=te();Zp.LibrariesDeleteV1Request$inboundSchema=hAe.object({library_id:hAe.string()}).transform(t=>(0,B$r.remap)(t,{library_id:"libraryId"}));Zp.LibrariesDeleteV1Request$outboundSchema=hAe.object({libraryId:hAe.string()}).transform(t=>(0,B$r.remap)(t,{libraryId:"library_id"}));var q$r;(function(t){t.inboundSchema=Zp.LibrariesDeleteV1Request$inboundSchema,t.outboundSchema=Zp.LibrariesDeleteV1Request$outboundSchema})(q$r||(Zp.LibrariesDeleteV1Request$=q$r={}));function iUo(t){return JSON.stringify(Zp.LibrariesDeleteV1Request$outboundSchema.parse(t))}function aUo(t){return(0,oUo.safeParse)(t,e=>Zp.LibrariesDeleteV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDeleteV1Request' from JSON")}});var H$r=S(Yp=>{"use strict";var sUo=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]}),uUo=Yp&&Yp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lUo=Yp&&Yp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sUo(r,e,n[o]);return uUo(r,e),r}}();Object.defineProperty(Yp,"__esModule",{value:!0});Yp.LibrariesDocumentsDeleteV1Request$=Yp.LibrariesDocumentsDeleteV1Request$outboundSchema=Yp.LibrariesDocumentsDeleteV1Request$inboundSchema=void 0;Yp.librariesDocumentsDeleteV1RequestToJSON=dUo;Yp.librariesDocumentsDeleteV1RequestFromJSON=fUo;var x7=lUo(ae()),V$r=ce(),cUo=te();Yp.LibrariesDocumentsDeleteV1Request$inboundSchema=x7.object({library_id:x7.string(),document_id:x7.string()}).transform(t=>(0,V$r.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Yp.LibrariesDocumentsDeleteV1Request$outboundSchema=x7.object({libraryId:x7.string(),documentId:x7.string()}).transform(t=>(0,V$r.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var z$r;(function(t){t.inboundSchema=Yp.LibrariesDocumentsDeleteV1Request$inboundSchema,t.outboundSchema=Yp.LibrariesDocumentsDeleteV1Request$outboundSchema})(z$r||(Yp.LibrariesDocumentsDeleteV1Request$=z$r={}));function dUo(t){return JSON.stringify(Yp.LibrariesDocumentsDeleteV1Request$outboundSchema.parse(t))}function fUo(t){return(0,cUo.safeParse)(t,e=>Yp.LibrariesDocumentsDeleteV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsDeleteV1Request' from JSON")}});var K$r=S(Qp=>{"use strict";var pUo=Qp&&Qp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mUo=Qp&&Qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hUo=Qp&&Qp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pUo(r,e,n[o]);return mUo(r,e),r}}();Object.defineProperty(Qp,"__esModule",{value:!0});Qp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$=Qp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema=Qp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema=void 0;Qp.librariesDocumentsGetExtractedTextSignedUrlV1RequestToJSON=yUo;Qp.librariesDocumentsGetExtractedTextSignedUrlV1RequestFromJSON=bUo;var T7=hUo(ae()),J$r=ce(),gUo=te();Qp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema=T7.object({library_id:T7.string(),document_id:T7.string()}).transform(t=>(0,J$r.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Qp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema=T7.object({libraryId:T7.string(),documentId:T7.string()}).transform(t=>(0,J$r.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var W$r;(function(t){t.inboundSchema=Qp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema,t.outboundSchema=Qp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema})(W$r||(Qp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$=W$r={}));function yUo(t){return JSON.stringify(Qp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema.parse(t))}function bUo(t){return(0,gUo.safeParse)(t,e=>Qp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetExtractedTextSignedUrlV1Request' from JSON")}});var Z$r=S(em=>{"use strict";var _Uo=em&&em.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vUo=em&&em.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wUo=em&&em.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Uo(r,e,n[o]);return vUo(r,e),r}}();Object.defineProperty(em,"__esModule",{value:!0});em.LibrariesDocumentsGetSignedUrlV1Request$=em.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema=em.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema=void 0;em.librariesDocumentsGetSignedUrlV1RequestToJSON=CUo;em.librariesDocumentsGetSignedUrlV1RequestFromJSON=xUo;var O7=wUo(ae()),X$r=ce(),SUo=te();em.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema=O7.object({library_id:O7.string(),document_id:O7.string()}).transform(t=>(0,X$r.remap)(t,{library_id:"libraryId",document_id:"documentId"}));em.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema=O7.object({libraryId:O7.string(),documentId:O7.string()}).transform(t=>(0,X$r.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var G$r;(function(t){t.inboundSchema=em.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema,t.outboundSchema=em.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema})(G$r||(em.LibrariesDocumentsGetSignedUrlV1Request$=G$r={}));function CUo(t){return JSON.stringify(em.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema.parse(t))}function xUo(t){return(0,SUo.safeParse)(t,e=>em.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetSignedUrlV1Request' from JSON")}});var eLr=S(tm=>{"use strict";var TUo=tm&&tm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OUo=tm&&tm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EUo=tm&&tm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TUo(r,e,n[o]);return OUo(r,e),r}}();Object.defineProperty(tm,"__esModule",{value:!0});tm.LibrariesDocumentsGetStatusV1Request$=tm.LibrariesDocumentsGetStatusV1Request$outboundSchema=tm.LibrariesDocumentsGetStatusV1Request$inboundSchema=void 0;tm.librariesDocumentsGetStatusV1RequestToJSON=MUo;tm.librariesDocumentsGetStatusV1RequestFromJSON=RUo;var E7=EUo(ae()),Q$r=ce(),PUo=te();tm.LibrariesDocumentsGetStatusV1Request$inboundSchema=E7.object({library_id:E7.string(),document_id:E7.string()}).transform(t=>(0,Q$r.remap)(t,{library_id:"libraryId",document_id:"documentId"}));tm.LibrariesDocumentsGetStatusV1Request$outboundSchema=E7.object({libraryId:E7.string(),documentId:E7.string()}).transform(t=>(0,Q$r.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var Y$r;(function(t){t.inboundSchema=tm.LibrariesDocumentsGetStatusV1Request$inboundSchema,t.outboundSchema=tm.LibrariesDocumentsGetStatusV1Request$outboundSchema})(Y$r||(tm.LibrariesDocumentsGetStatusV1Request$=Y$r={}));function MUo(t){return JSON.stringify(tm.LibrariesDocumentsGetStatusV1Request$outboundSchema.parse(t))}function RUo(t){return(0,PUo.safeParse)(t,e=>tm.LibrariesDocumentsGetStatusV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetStatusV1Request' from JSON")}});var nLr=S(rm=>{"use strict";var IUo=rm&&rm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AUo=rm&&rm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NUo=rm&&rm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IUo(r,e,n[o]);return AUo(r,e),r}}();Object.defineProperty(rm,"__esModule",{value:!0});rm.LibrariesDocumentsGetTextContentV1Request$=rm.LibrariesDocumentsGetTextContentV1Request$outboundSchema=rm.LibrariesDocumentsGetTextContentV1Request$inboundSchema=void 0;rm.librariesDocumentsGetTextContentV1RequestToJSON=jUo;rm.librariesDocumentsGetTextContentV1RequestFromJSON=$Uo;var P7=NUo(ae()),rLr=ce(),DUo=te();rm.LibrariesDocumentsGetTextContentV1Request$inboundSchema=P7.object({library_id:P7.string(),document_id:P7.string()}).transform(t=>(0,rLr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));rm.LibrariesDocumentsGetTextContentV1Request$outboundSchema=P7.object({libraryId:P7.string(),documentId:P7.string()}).transform(t=>(0,rLr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var tLr;(function(t){t.inboundSchema=rm.LibrariesDocumentsGetTextContentV1Request$inboundSchema,t.outboundSchema=rm.LibrariesDocumentsGetTextContentV1Request$outboundSchema})(tLr||(rm.LibrariesDocumentsGetTextContentV1Request$=tLr={}));function jUo(t){return JSON.stringify(rm.LibrariesDocumentsGetTextContentV1Request$outboundSchema.parse(t))}function $Uo(t){return(0,DUo.safeParse)(t,e=>rm.LibrariesDocumentsGetTextContentV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetTextContentV1Request' from JSON")}});var aLr=S(nm=>{"use strict";var LUo=nm&&nm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FUo=nm&&nm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kUo=nm&&nm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LUo(r,e,n[o]);return FUo(r,e),r}}();Object.defineProperty(nm,"__esModule",{value:!0});nm.LibrariesDocumentsGetV1Request$=nm.LibrariesDocumentsGetV1Request$outboundSchema=nm.LibrariesDocumentsGetV1Request$inboundSchema=void 0;nm.librariesDocumentsGetV1RequestToJSON=BUo;nm.librariesDocumentsGetV1RequestFromJSON=UUo;var M7=kUo(ae()),iLr=ce(),qUo=te();nm.LibrariesDocumentsGetV1Request$inboundSchema=M7.object({library_id:M7.string(),document_id:M7.string()}).transform(t=>(0,iLr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));nm.LibrariesDocumentsGetV1Request$outboundSchema=M7.object({libraryId:M7.string(),documentId:M7.string()}).transform(t=>(0,iLr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var oLr;(function(t){t.inboundSchema=nm.LibrariesDocumentsGetV1Request$inboundSchema,t.outboundSchema=nm.LibrariesDocumentsGetV1Request$outboundSchema})(oLr||(nm.LibrariesDocumentsGetV1Request$=oLr={}));function BUo(t){return JSON.stringify(nm.LibrariesDocumentsGetV1Request$outboundSchema.parse(t))}function UUo(t){return(0,qUo.safeParse)(t,e=>nm.LibrariesDocumentsGetV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetV1Request' from JSON")}});var lLr=S(om=>{"use strict";var zUo=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]}),VUo=om&&om.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HUo=om&&om.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zUo(r,e,n[o]);return VUo(r,e),r}}();Object.defineProperty(om,"__esModule",{value:!0});om.LibrariesDocumentsListV1Request$=om.LibrariesDocumentsListV1Request$outboundSchema=om.LibrariesDocumentsListV1Request$inboundSchema=void 0;om.librariesDocumentsListV1RequestToJSON=JUo;om.librariesDocumentsListV1RequestFromJSON=KUo;var Qy=HUo(ae()),uLr=ce(),WUo=te();om.LibrariesDocumentsListV1Request$inboundSchema=Qy.object({library_id:Qy.string(),search:Qy.nullable(Qy.string()).optional(),page_size:Qy.number().int().default(100),page:Qy.number().int().default(0),sort_by:Qy.string().default("created_at"),sort_order:Qy.string().default("desc")}).transform(t=>(0,uLr.remap)(t,{library_id:"libraryId",page_size:"pageSize",sort_by:"sortBy",sort_order:"sortOrder"}));om.LibrariesDocumentsListV1Request$outboundSchema=Qy.object({libraryId:Qy.string(),search:Qy.nullable(Qy.string()).optional(),pageSize:Qy.number().int().default(100),page:Qy.number().int().default(0),sortBy:Qy.string().default("created_at"),sortOrder:Qy.string().default("desc")}).transform(t=>(0,uLr.remap)(t,{libraryId:"library_id",pageSize:"page_size",sortBy:"sort_by",sortOrder:"sort_order"}));var sLr;(function(t){t.inboundSchema=om.LibrariesDocumentsListV1Request$inboundSchema,t.outboundSchema=om.LibrariesDocumentsListV1Request$outboundSchema})(sLr||(om.LibrariesDocumentsListV1Request$=sLr={}));function JUo(t){return JSON.stringify(om.LibrariesDocumentsListV1Request$outboundSchema.parse(t))}function KUo(t){return(0,WUo.safeParse)(t,e=>om.LibrariesDocumentsListV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsListV1Request' from JSON")}});var fLr=S(im=>{"use strict";var GUo=im&&im.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XUo=im&&im.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZUo=im&&im.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&GUo(r,e,n[o]);return XUo(r,e),r}}();Object.defineProperty(im,"__esModule",{value:!0});im.LibrariesDocumentsReprocessV1Request$=im.LibrariesDocumentsReprocessV1Request$outboundSchema=im.LibrariesDocumentsReprocessV1Request$inboundSchema=void 0;im.librariesDocumentsReprocessV1RequestToJSON=QUo;im.librariesDocumentsReprocessV1RequestFromJSON=ezo;var R7=ZUo(ae()),dLr=ce(),YUo=te();im.LibrariesDocumentsReprocessV1Request$inboundSchema=R7.object({library_id:R7.string(),document_id:R7.string()}).transform(t=>(0,dLr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));im.LibrariesDocumentsReprocessV1Request$outboundSchema=R7.object({libraryId:R7.string(),documentId:R7.string()}).transform(t=>(0,dLr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var cLr;(function(t){t.inboundSchema=im.LibrariesDocumentsReprocessV1Request$inboundSchema,t.outboundSchema=im.LibrariesDocumentsReprocessV1Request$outboundSchema})(cLr||(im.LibrariesDocumentsReprocessV1Request$=cLr={}));function QUo(t){return JSON.stringify(im.LibrariesDocumentsReprocessV1Request$outboundSchema.parse(t))}function ezo(t){return(0,YUo.safeParse)(t,e=>im.LibrariesDocumentsReprocessV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsReprocessV1Request' from JSON")}});var yLr=S(am=>{"use strict";var tzo=am&&am.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rzo=am&&am.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mLr=am&&am.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tzo(r,e,n[o]);return rzo(r,e),r}}();Object.defineProperty(am,"__esModule",{value:!0});am.LibrariesDocumentsUpdateV1Request$=am.LibrariesDocumentsUpdateV1Request$outboundSchema=am.LibrariesDocumentsUpdateV1Request$inboundSchema=void 0;am.librariesDocumentsUpdateV1RequestToJSON=ozo;am.librariesDocumentsUpdateV1RequestFromJSON=izo;var I7=mLr(ae()),hLr=ce(),nzo=te(),gLr=mLr(zt());am.LibrariesDocumentsUpdateV1Request$inboundSchema=I7.object({library_id:I7.string(),document_id:I7.string(),DocumentUpdateIn:gLr.DocumentUpdateIn$inboundSchema}).transform(t=>(0,hLr.remap)(t,{library_id:"libraryId",document_id:"documentId",DocumentUpdateIn:"documentUpdateIn"}));am.LibrariesDocumentsUpdateV1Request$outboundSchema=I7.object({libraryId:I7.string(),documentId:I7.string(),documentUpdateIn:gLr.DocumentUpdateIn$outboundSchema}).transform(t=>(0,hLr.remap)(t,{libraryId:"library_id",documentId:"document_id",documentUpdateIn:"DocumentUpdateIn"}));var pLr;(function(t){t.inboundSchema=am.LibrariesDocumentsUpdateV1Request$inboundSchema,t.outboundSchema=am.LibrariesDocumentsUpdateV1Request$outboundSchema})(pLr||(am.LibrariesDocumentsUpdateV1Request$=pLr={}));function ozo(t){return JSON.stringify(am.LibrariesDocumentsUpdateV1Request$outboundSchema.parse(t))}function izo(t){return(0,nzo.safeParse)(t,e=>am.LibrariesDocumentsUpdateV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsUpdateV1Request' from JSON")}});var xLr=S(es=>{"use strict";var azo=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]}),szo=es&&es.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vLr=es&&es.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&azo(r,e,n[o]);return szo(r,e),r}}();Object.defineProperty(es,"__esModule",{value:!0});es.LibrariesDocumentsUploadV1Request$=es.LibrariesDocumentsUploadV1Request$outboundSchema=es.LibrariesDocumentsUploadV1Request$inboundSchema=es.LibrariesDocumentsUploadV1DocumentUpload$=es.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema=es.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema=void 0;es.librariesDocumentsUploadV1DocumentUploadToJSON=lzo;es.librariesDocumentsUploadV1DocumentUploadFromJSON=czo;es.librariesDocumentsUploadV1RequestToJSON=dzo;es.librariesDocumentsUploadV1RequestFromJSON=fzo;var sB=vLr(ae()),wLr=ce(),SLr=te(),uzo=HD(),CLr=vLr(zt());es.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema=sB.object({file:CLr.FileT$inboundSchema});es.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema=sB.object({file:CLr.FileT$outboundSchema.or(uzo.blobLikeSchema)});var bLr;(function(t){t.inboundSchema=es.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema,t.outboundSchema=es.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema})(bLr||(es.LibrariesDocumentsUploadV1DocumentUpload$=bLr={}));function lzo(t){return JSON.stringify(es.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema.parse(t))}function czo(t){return(0,SLr.safeParse)(t,e=>es.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsUploadV1DocumentUpload' from JSON")}es.LibrariesDocumentsUploadV1Request$inboundSchema=sB.object({library_id:sB.string(),RequestBody:sB.lazy(()=>es.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema)}).transform(t=>(0,wLr.remap)(t,{library_id:"libraryId",RequestBody:"requestBody"}));es.LibrariesDocumentsUploadV1Request$outboundSchema=sB.object({libraryId:sB.string(),requestBody:sB.lazy(()=>es.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema)}).transform(t=>(0,wLr.remap)(t,{libraryId:"library_id",requestBody:"RequestBody"}));var _Lr;(function(t){t.inboundSchema=es.LibrariesDocumentsUploadV1Request$inboundSchema,t.outboundSchema=es.LibrariesDocumentsUploadV1Request$outboundSchema})(_Lr||(es.LibrariesDocumentsUploadV1Request$=_Lr={}));function dzo(t){return JSON.stringify(es.LibrariesDocumentsUploadV1Request$outboundSchema.parse(t))}function fzo(t){return(0,SLr.safeParse)(t,e=>es.LibrariesDocumentsUploadV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsUploadV1Request' from JSON")}});var ELr=S(sm=>{"use strict";var pzo=sm&&sm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mzo=sm&&sm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hzo=sm&&sm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pzo(r,e,n[o]);return mzo(r,e),r}}();Object.defineProperty(sm,"__esModule",{value:!0});sm.LibrariesGetV1Request$=sm.LibrariesGetV1Request$outboundSchema=sm.LibrariesGetV1Request$inboundSchema=void 0;sm.librariesGetV1RequestToJSON=yzo;sm.librariesGetV1RequestFromJSON=bzo;var gAe=hzo(ae()),OLr=ce(),gzo=te();sm.LibrariesGetV1Request$inboundSchema=gAe.object({library_id:gAe.string()}).transform(t=>(0,OLr.remap)(t,{library_id:"libraryId"}));sm.LibrariesGetV1Request$outboundSchema=gAe.object({libraryId:gAe.string()}).transform(t=>(0,OLr.remap)(t,{libraryId:"library_id"}));var TLr;(function(t){t.inboundSchema=sm.LibrariesGetV1Request$inboundSchema,t.outboundSchema=sm.LibrariesGetV1Request$outboundSchema})(TLr||(sm.LibrariesGetV1Request$=TLr={}));function yzo(t){return JSON.stringify(sm.LibrariesGetV1Request$outboundSchema.parse(t))}function bzo(t){return(0,gzo.safeParse)(t,e=>sm.LibrariesGetV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesGetV1Request' from JSON")}});var ALr=S(um=>{"use strict";var _zo=um&&um.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vzo=um&&um.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MLr=um&&um.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_zo(r,e,n[o]);return vzo(r,e),r}}();Object.defineProperty(um,"__esModule",{value:!0});um.LibrariesShareCreateV1Request$=um.LibrariesShareCreateV1Request$outboundSchema=um.LibrariesShareCreateV1Request$inboundSchema=void 0;um.librariesShareCreateV1RequestToJSON=Szo;um.librariesShareCreateV1RequestFromJSON=Czo;var yAe=MLr(ae()),RLr=ce(),wzo=te(),ILr=MLr(zt());um.LibrariesShareCreateV1Request$inboundSchema=yAe.object({library_id:yAe.string(),SharingIn:ILr.SharingIn$inboundSchema}).transform(t=>(0,RLr.remap)(t,{library_id:"libraryId",SharingIn:"sharingIn"}));um.LibrariesShareCreateV1Request$outboundSchema=yAe.object({libraryId:yAe.string(),sharingIn:ILr.SharingIn$outboundSchema}).transform(t=>(0,RLr.remap)(t,{libraryId:"library_id",sharingIn:"SharingIn"}));var PLr;(function(t){t.inboundSchema=um.LibrariesShareCreateV1Request$inboundSchema,t.outboundSchema=um.LibrariesShareCreateV1Request$outboundSchema})(PLr||(um.LibrariesShareCreateV1Request$=PLr={}));function Szo(t){return JSON.stringify(um.LibrariesShareCreateV1Request$outboundSchema.parse(t))}function Czo(t){return(0,wzo.safeParse)(t,e=>um.LibrariesShareCreateV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesShareCreateV1Request' from JSON")}});var LLr=S(lm=>{"use strict";var xzo=lm&&lm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tzo=lm&&lm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DLr=lm&&lm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&xzo(r,e,n[o]);return Tzo(r,e),r}}();Object.defineProperty(lm,"__esModule",{value:!0});lm.LibrariesShareDeleteV1Request$=lm.LibrariesShareDeleteV1Request$outboundSchema=lm.LibrariesShareDeleteV1Request$inboundSchema=void 0;lm.librariesShareDeleteV1RequestToJSON=Ezo;lm.librariesShareDeleteV1RequestFromJSON=Pzo;var bAe=DLr(ae()),jLr=ce(),Ozo=te(),$Lr=DLr(zt());lm.LibrariesShareDeleteV1Request$inboundSchema=bAe.object({library_id:bAe.string(),SharingDelete:$Lr.SharingDelete$inboundSchema}).transform(t=>(0,jLr.remap)(t,{library_id:"libraryId",SharingDelete:"sharingDelete"}));lm.LibrariesShareDeleteV1Request$outboundSchema=bAe.object({libraryId:bAe.string(),sharingDelete:$Lr.SharingDelete$outboundSchema}).transform(t=>(0,jLr.remap)(t,{libraryId:"library_id",sharingDelete:"SharingDelete"}));var NLr;(function(t){t.inboundSchema=lm.LibrariesShareDeleteV1Request$inboundSchema,t.outboundSchema=lm.LibrariesShareDeleteV1Request$outboundSchema})(NLr||(lm.LibrariesShareDeleteV1Request$=NLr={}));function Ezo(t){return JSON.stringify(lm.LibrariesShareDeleteV1Request$outboundSchema.parse(t))}function Pzo(t){return(0,Ozo.safeParse)(t,e=>lm.LibrariesShareDeleteV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesShareDeleteV1Request' from JSON")}});var qLr=S(cm=>{"use strict";var Mzo=cm&&cm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Rzo=cm&&cm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Izo=cm&&cm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Mzo(r,e,n[o]);return Rzo(r,e),r}}();Object.defineProperty(cm,"__esModule",{value:!0});cm.LibrariesShareListV1Request$=cm.LibrariesShareListV1Request$outboundSchema=cm.LibrariesShareListV1Request$inboundSchema=void 0;cm.librariesShareListV1RequestToJSON=Nzo;cm.librariesShareListV1RequestFromJSON=Dzo;var _Ae=Izo(ae()),kLr=ce(),Azo=te();cm.LibrariesShareListV1Request$inboundSchema=_Ae.object({library_id:_Ae.string()}).transform(t=>(0,kLr.remap)(t,{library_id:"libraryId"}));cm.LibrariesShareListV1Request$outboundSchema=_Ae.object({libraryId:_Ae.string()}).transform(t=>(0,kLr.remap)(t,{libraryId:"library_id"}));var FLr;(function(t){t.inboundSchema=cm.LibrariesShareListV1Request$inboundSchema,t.outboundSchema=cm.LibrariesShareListV1Request$outboundSchema})(FLr||(cm.LibrariesShareListV1Request$=FLr={}));function Nzo(t){return JSON.stringify(cm.LibrariesShareListV1Request$outboundSchema.parse(t))}function Dzo(t){return(0,Azo.safeParse)(t,e=>cm.LibrariesShareListV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesShareListV1Request' from JSON")}});var HLr=S(dm=>{"use strict";var jzo=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]}),$zo=dm&&dm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ULr=dm&&dm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jzo(r,e,n[o]);return $zo(r,e),r}}();Object.defineProperty(dm,"__esModule",{value:!0});dm.LibrariesUpdateV1Request$=dm.LibrariesUpdateV1Request$outboundSchema=dm.LibrariesUpdateV1Request$inboundSchema=void 0;dm.librariesUpdateV1RequestToJSON=Fzo;dm.librariesUpdateV1RequestFromJSON=kzo;var vAe=ULr(ae()),zLr=ce(),Lzo=te(),VLr=ULr(zt());dm.LibrariesUpdateV1Request$inboundSchema=vAe.object({library_id:vAe.string(),LibraryInUpdate:VLr.LibraryInUpdate$inboundSchema}).transform(t=>(0,zLr.remap)(t,{library_id:"libraryId",LibraryInUpdate:"libraryInUpdate"}));dm.LibrariesUpdateV1Request$outboundSchema=vAe.object({libraryId:vAe.string(),libraryInUpdate:VLr.LibraryInUpdate$outboundSchema}).transform(t=>(0,zLr.remap)(t,{libraryId:"library_id",libraryInUpdate:"LibraryInUpdate"}));var BLr;(function(t){t.inboundSchema=dm.LibrariesUpdateV1Request$inboundSchema,t.outboundSchema=dm.LibrariesUpdateV1Request$outboundSchema})(BLr||(dm.LibrariesUpdateV1Request$=BLr={}));function Fzo(t){return JSON.stringify(dm.LibrariesUpdateV1Request$outboundSchema.parse(t))}function kzo(t){return(0,Lzo.safeParse)(t,e=>dm.LibrariesUpdateV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesUpdateV1Request' from JSON")}});var ZLr=S($s=>{"use strict";var qzo=$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]}),Bzo=$s&&$s.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KLr=$s&&$s.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qzo(r,e,n[o]);return Bzo(r,e),r}}();Object.defineProperty($s,"__esModule",{value:!0});$s.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=$s.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=$s.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=$s.RetrieveModelV1ModelsModelIdGetRequest$=$s.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=$s.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;$s.retrieveModelV1ModelsModelIdGetRequestToJSON=Uzo;$s.retrieveModelV1ModelsModelIdGetRequestFromJSON=zzo;$s.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=Vzo;$s.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=Hzo;var bv=KLr(ae()),GLr=ce(),XLr=te(),wAe=KLr(zt());$s.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=bv.object({model_id:bv.string()}).transform(t=>(0,GLr.remap)(t,{model_id:"modelId"}));$s.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=bv.object({modelId:bv.string()}).transform(t=>(0,GLr.remap)(t,{modelId:"model_id"}));var WLr;(function(t){t.inboundSchema=$s.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=$s.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(WLr||($s.RetrieveModelV1ModelsModelIdGetRequest$=WLr={}));function Uzo(t){return JSON.stringify($s.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function zzo(t){return(0,XLr.safeParse)(t,e=>$s.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}$s.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=bv.union([wAe.FTModelCard$inboundSchema.and(bv.object({type:bv.literal("fine-tuned")}).transform(t=>({type:t.type}))),wAe.BaseModelCard$inboundSchema.and(bv.object({type:bv.literal("base")}).transform(t=>({type:t.type})))]);$s.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=bv.union([wAe.FTModelCard$outboundSchema.and(bv.object({type:bv.literal("fine-tuned")}).transform(t=>({type:t.type}))),wAe.BaseModelCard$outboundSchema.and(bv.object({type:bv.literal("base")}).transform(t=>({type:t.type})))]);var JLr;(function(t){t.inboundSchema=$s.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=$s.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(JLr||($s.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=JLr={}));function Vzo(t){return JSON.stringify($s.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function Hzo(t){return(0,XLr.safeParse)(t,e=>$s.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var eo=S(bn=>{"use strict";var Wzo=bn&&bn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oo=bn&&bn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Wzo(e,t,r)};Object.defineProperty(bn,"__esModule",{value:!0});oo(TDr(),bn);oo(PDr(),bn);oo(NDr(),bn);oo($Dr(),bn);oo(BDr(),bn);oo(WDr(),bn);oo(YDr(),bn);oo(tjr(),bn);oo(sjr(),bn);oo(cjr(),bn);oo(hjr(),bn);oo(vjr(),bn);oo(Cjr(),bn);oo(Ojr(),bn);oo(Mjr(),bn);oo(Ajr(),bn);oo($jr(),bn);oo(kjr(),bn);oo(zjr(),bn);oo(Wjr(),bn);oo(Gjr(),bn);oo(e$r(),bn);oo(n$r(),bn);oo(l$r(),bn);oo(m$r(),bn);oo(v$r(),bn);oo(x$r(),bn);oo(R$r(),bn);oo(N$r(),bn);oo(k$r(),bn);oo(U$r(),bn);oo(H$r(),bn);oo(K$r(),bn);oo(Z$r(),bn);oo(eLr(),bn);oo(nLr(),bn);oo(aLr(),bn);oo(lLr(),bn);oo(fLr(),bn);oo(yLr(),bn);oo(xLr(),bn);oo(ELr(),bn);oo(ALr(),bn);oo(LLr(),bn);oo(qLr(),bn);oo(HLr(),bn);oo(ZLr(),bn)});var QLr=S(QD=>{"use strict";var Jzo=QD&&QD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kzo=QD&&QD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xct=QD&&QD.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Jzo(r,e,n[o]);return Kzo(r,e),r}}();Object.defineProperty(QD,"__esModule",{value:!0});QD.batchJobsCancel=r4o;var Gzo=Tr(),SAe=Xct(br()),Xzo=ce(),Zzo=te(),YLr=_r(),Yzo=mr(),Qzo=Xct(zt()),e4o=Xct(eo()),t4o=vr();function r4o(t,e,r){return new t4o.APIPromise(n4o(t,e,r))}async function n4o(t,e,r){let n=(0,Zzo.safeParse)(e,b=>e4o.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,Gzo.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Yzo.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,Xzo.compactMap)({Accept:"application/json"})),l=await(0,YLr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,YLr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await SAe.match(SAe.json(200,Qzo.BatchJobOut$inboundSchema),SAe.fail("4XX"),SAe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var nFr=S(ej=>{"use strict";var o4o=ej&&ej.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i4o=ej&&ej.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rFr=ej&&ej.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&o4o(r,e,n[o]);return i4o(r,e),r}}();Object.defineProperty(ej,"__esModule",{value:!0});ej.batchJobsCreate=d4o;var a4o=Tr(),CAe=rFr(br()),s4o=ce(),u4o=te(),eFr=_r(),l4o=mr(),tFr=rFr(zt()),c4o=vr();function d4o(t,e,r){return new c4o.APIPromise(f4o(t,e,r))}async function f4o(t,e,r){let n=(0,u4o.safeParse)(e,g=>tFr.BatchJobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,a4o.encodeJSON)("body",o,{explode:!0}),a=(0,l4o.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,s4o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,eFr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,eFr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,[y]=await CAe.match(CAe.json(200,tFr.BatchJobOut$inboundSchema),CAe.fail("4XX"),CAe.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var iFr=S(tj=>{"use strict";var p4o=tj&&tj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m4o=tj&&tj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zct=tj&&tj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&p4o(r,e,n[o]);return m4o(r,e),r}}();Object.defineProperty(tj,"__esModule",{value:!0});tj.batchJobsGet=S4o;var h4o=Tr(),xAe=Zct(br()),g4o=ce(),y4o=te(),oFr=_r(),b4o=mr(),_4o=Zct(zt()),v4o=Zct(eo()),w4o=vr();function S4o(t,e,r){return new w4o.APIPromise(C4o(t,e,r))}async function C4o(t,e,r){let n=(0,y4o.safeParse)(e,b=>v4o.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,h4o.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,b4o.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,g4o.compactMap)({Accept:"application/json"})),l=await(0,oFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,oFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await xAe.match(xAe.json(200,_4o.BatchJobOut$inboundSchema),xAe.fail("4XX"),xAe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var sFr=S(rj=>{"use strict";var x4o=rj&&rj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T4o=rj&&rj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yct=rj&&rj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&x4o(r,e,n[o]);return T4o(r,e),r}}();Object.defineProperty(rj,"__esModule",{value:!0});rj.batchJobsList=N4o;var O4o=Tr(),TAe=Yct(br()),E4o=ce(),P4o=te(),aFr=_r(),M4o=mr(),R4o=Yct(zt()),I4o=Yct(eo()),A4o=vr();function N4o(t,e,r){return new A4o.APIPromise(D4o(t,e,r))}async function D4o(t,e,r){let n=(0,P4o.safeParse)(e,b=>I4o.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,M4o.pathToFunc)("/v1/batch/jobs")(),s=(0,O4o.encodeFormQuery)({agent_id:o?.agent_id,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,E4o.compactMap)({Accept:"application/json"})),l=await(0,aFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,aFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await TAe.match(TAe.json(200,R4o.BatchJobsOut$inboundSchema),TAe.fail("4XX"),TAe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var uFr=S(EAe=>{"use strict";Object.defineProperty(EAe,"__esModule",{value:!0});EAe.MistralJobs=void 0;var j4o=QLr(),$4o=nFr(),L4o=iFr(),F4o=sFr(),k4o=Vc(),OAe=Rd(),Qct=class extends k4o.ClientSDK{async list(e,r){return(0,OAe.unwrapAsync)((0,F4o.batchJobsList)(this,e,r))}async create(e,r){return(0,OAe.unwrapAsync)((0,$4o.batchJobsCreate)(this,e,r))}async get(e,r){return(0,OAe.unwrapAsync)((0,L4o.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,OAe.unwrapAsync)((0,j4o.batchJobsCancel)(this,e,r))}};EAe.MistralJobs=Qct});var lFr=S(PAe=>{"use strict";Object.defineProperty(PAe,"__esModule",{value:!0});PAe.Batch=void 0;var q4o=Vc(),B4o=uFr(),edt=class extends q4o.ClientSDK{get jobs(){return this._jobs??(this._jobs=new B4o.MistralJobs(this._options))}};PAe.Batch=edt});var fFr=S(nj=>{"use strict";var U4o=nj&&nj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z4o=nj&&nj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MAe=nj&&nj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&U4o(r,e,n[o]);return z4o(r,e),r}}();Object.defineProperty(nj,"__esModule",{value:!0});nj.betaConversationsAppend=Z4o;var cFr=Tr(),Mse=MAe(br()),V4o=ce(),H4o=te(),dFr=_r(),W4o=mr(),J4o=MAe(zt()),K4o=MAe(Qn()),G4o=MAe(eo()),X4o=vr();function Z4o(t,e,r){return new X4o.APIPromise(Y4o(t,e,r))}async function Y4o(t,e,r){let n=(0,H4o.safeParse)(e,_=>G4o.AgentsApiV1ConversationsAppendRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,cFr.encodeJSON)("body",o.ConversationAppendRequest,{explode:!0}),a={conversation_id:(0,cFr.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,W4o.pathToFunc)("/v1/conversations/{conversation_id}")(a),u=new Headers((0,V4o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,dFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,dFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_append",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Mse.match(Mse.json(200,J4o.ConversationResponse$inboundSchema),Mse.jsonErr(422,K4o.HTTPValidationError$inboundSchema),Mse.fail("4XX"),Mse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var hFr=S(oj=>{"use strict";var Q4o=oj&&oj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e2o=oj&&oj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ise=oj&&oj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Q4o(r,e,n[o]);return e2o(r,e),r}}();Object.defineProperty(oj,"__esModule",{value:!0});oj.betaConversationsAppendStream=c2o;var t2o=Ise(ae()),pFr=Tr(),r2o=iB(),Rse=Ise(br()),n2o=ce(),o2o=te(),mFr=_r(),i2o=mr(),a2o=Ise(zt()),s2o=Ise(Qn()),u2o=Ise(eo()),l2o=vr();function c2o(t,e,r){return new l2o.APIPromise(d2o(t,e,r))}async function d2o(t,e,r){let n=(0,o2o.safeParse)(e,_=>u2o.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,pFr.encodeJSON)("body",o.ConversationAppendStreamRequest,{explode:!0}),a={conversation_id:(0,pFr.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,i2o.pathToFunc)("/v1/conversations/{conversation_id}#stream")(a),u=new Headers((0,n2o.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),l=await(0,mFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,mFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_append_stream",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Rse.match(Rse.sse(200,t2o.instanceof(ReadableStream).transform(_=>new r2o.EventStream(_,w=>({value:a2o.ConversationEvents$inboundSchema.parse(w)})))),Rse.jsonErr(422,s2o.HTTPValidationError$inboundSchema),Rse.fail("4XX"),Rse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var bFr=S(ij=>{"use strict";var f2o=ij&&ij.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p2o=ij&&ij.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tdt=ij&&ij.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&f2o(r,e,n[o]);return p2o(r,e),r}}();Object.defineProperty(ij,"__esModule",{value:!0});ij.betaConversationsGet=v2o;var m2o=Tr(),Ase=tdt(br()),h2o=ce(),g2o=te(),gFr=_r(),y2o=mr(),b2o=tdt(Qn()),yFr=tdt(eo()),_2o=vr();function v2o(t,e,r){return new _2o.APIPromise(w2o(t,e,r))}async function w2o(t,e,r){let n=(0,g2o.safeParse)(e,_=>yFr.AgentsApiV1ConversationsGetRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={conversation_id:(0,m2o.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,y2o.pathToFunc)("/v1/conversations/{conversation_id}")(a),u=new Headers((0,h2o.compactMap)({Accept:"application/json"})),l=await(0,gFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,gFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Ase.match(Ase.json(200,yFr.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema),Ase.jsonErr(422,b2o.HTTPValidationError$inboundSchema),Ase.fail("4XX"),Ase.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var vFr=S(aj=>{"use strict";var S2o=aj&&aj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C2o=aj&&aj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RAe=aj&&aj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&S2o(r,e,n[o]);return C2o(r,e),r}}();Object.defineProperty(aj,"__esModule",{value:!0});aj.betaConversationsGetHistory=A2o;var x2o=Tr(),Nse=RAe(br()),T2o=ce(),O2o=te(),_Fr=_r(),E2o=mr(),P2o=RAe(zt()),M2o=RAe(Qn()),R2o=RAe(eo()),I2o=vr();function A2o(t,e,r){return new I2o.APIPromise(N2o(t,e,r))}async function N2o(t,e,r){let n=(0,O2o.safeParse)(e,_=>R2o.AgentsApiV1ConversationsHistoryRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={conversation_id:(0,x2o.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,E2o.pathToFunc)("/v1/conversations/{conversation_id}/history")(a),u=new Headers((0,T2o.compactMap)({Accept:"application/json"})),l=await(0,_Fr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,_Fr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_history",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Nse.match(Nse.json(200,P2o.ConversationHistory$inboundSchema),Nse.jsonErr(422,M2o.HTTPValidationError$inboundSchema),Nse.fail("4XX"),Nse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var SFr=S(sj=>{"use strict";var D2o=sj&&sj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),j2o=sj&&sj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IAe=sj&&sj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&D2o(r,e,n[o]);return j2o(r,e),r}}();Object.defineProperty(sj,"__esModule",{value:!0});sj.betaConversationsGetMessages=V2o;var $2o=Tr(),Dse=IAe(br()),L2o=ce(),F2o=te(),wFr=_r(),k2o=mr(),q2o=IAe(zt()),B2o=IAe(Qn()),U2o=IAe(eo()),z2o=vr();function V2o(t,e,r){return new z2o.APIPromise(H2o(t,e,r))}async function H2o(t,e,r){let n=(0,F2o.safeParse)(e,_=>U2o.AgentsApiV1ConversationsMessagesRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={conversation_id:(0,$2o.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,k2o.pathToFunc)("/v1/conversations/{conversation_id}/messages")(a),u=new Headers((0,L2o.compactMap)({Accept:"application/json"})),l=await(0,wFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,wFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_messages",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Dse.match(Dse.json(200,q2o.ConversationMessages$inboundSchema),Dse.jsonErr(422,B2o.HTTPValidationError$inboundSchema),Dse.fail("4XX"),Dse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var TFr=S(uj=>{"use strict";var W2o=uj&&uj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J2o=uj&&uj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AAe=uj&&uj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&W2o(r,e,n[o]);return J2o(r,e),r}}();Object.defineProperty(uj,"__esModule",{value:!0});uj.betaConversationsList=tVo;var K2o=AAe(ae()),G2o=Tr(),jse=AAe(br()),X2o=ce(),Z2o=te(),CFr=_r(),Y2o=mr(),Q2o=AAe(Qn()),xFr=AAe(eo()),eVo=vr();function tVo(t,e,r){return new eVo.APIPromise(rVo(t,e,r))}async function rVo(t,e,r){let n=(0,Z2o.safeParse)(e,_=>xFr.AgentsApiV1ConversationsListRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,Y2o.pathToFunc)("/v1/conversations")(),s=(0,G2o.encodeFormQuery)({page:o?.page,page_size:o?.page_size}),u=new Headers((0,X2o.compactMap)({Accept:"application/json"})),l=await(0,CFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,CFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_list",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await jse.match(jse.json(200,K2o.array(xFr.ResponseBody$inboundSchema)),jse.jsonErr(422,Q2o.HTTPValidationError$inboundSchema),jse.fail("4XX"),jse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var PFr=S(lj=>{"use strict";var nVo=lj&&lj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oVo=lj&&lj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NAe=lj&&lj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nVo(r,e,n[o]);return oVo(r,e),r}}();Object.defineProperty(lj,"__esModule",{value:!0});lj.betaConversationsRestart=fVo;var OFr=Tr(),$se=NAe(br()),iVo=ce(),aVo=te(),EFr=_r(),sVo=mr(),uVo=NAe(zt()),lVo=NAe(Qn()),cVo=NAe(eo()),dVo=vr();function fVo(t,e,r){return new dVo.APIPromise(pVo(t,e,r))}async function pVo(t,e,r){let n=(0,aVo.safeParse)(e,_=>cVo.AgentsApiV1ConversationsRestartRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,OFr.encodeJSON)("body",o.ConversationRestartRequest,{explode:!0}),a={conversation_id:(0,OFr.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,sVo.pathToFunc)("/v1/conversations/{conversation_id}/restart")(a),u=new Headers((0,iVo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,EFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,EFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_restart",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await $se.match($se.json(200,uVo.ConversationResponse$inboundSchema),$se.jsonErr(422,lVo.HTTPValidationError$inboundSchema),$se.fail("4XX"),$se.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var IFr=S(cj=>{"use strict";var mVo=cj&&cj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hVo=cj&&cj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fse=cj&&cj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mVo(r,e,n[o]);return hVo(r,e),r}}();Object.defineProperty(cj,"__esModule",{value:!0});cj.betaConversationsRestartStream=TVo;var gVo=Fse(ae()),MFr=Tr(),yVo=iB(),Lse=Fse(br()),bVo=ce(),_Vo=te(),RFr=_r(),vVo=mr(),wVo=Fse(zt()),SVo=Fse(Qn()),CVo=Fse(eo()),xVo=vr();function TVo(t,e,r){return new xVo.APIPromise(OVo(t,e,r))}async function OVo(t,e,r){let n=(0,_Vo.safeParse)(e,_=>CVo.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,MFr.encodeJSON)("body",o.ConversationRestartStreamRequest,{explode:!0}),a={conversation_id:(0,MFr.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,vVo.pathToFunc)("/v1/conversations/{conversation_id}/restart#stream")(a),u=new Headers((0,bVo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),l=await(0,RFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,RFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_restart_stream",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Lse.match(Lse.sse(200,gVo.instanceof(ReadableStream).transform(_=>new yVo.EventStream(_,w=>({value:wVo.ConversationEvents$inboundSchema.parse(w)})))),Lse.jsonErr(422,SVo.HTTPValidationError$inboundSchema),Lse.fail("4XX"),Lse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var DFr=S(dj=>{"use strict";var EVo=dj&&dj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PVo=dj&&dj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rdt=dj&&dj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&EVo(r,e,n[o]);return PVo(r,e),r}}();Object.defineProperty(dj,"__esModule",{value:!0});dj.betaConversationsStart=jVo;var MVo=Tr(),kse=rdt(br()),RVo=ce(),IVo=te(),AFr=_r(),AVo=mr(),NFr=rdt(zt()),NVo=rdt(Qn()),DVo=vr();function jVo(t,e,r){return new DVo.APIPromise($Vo(t,e,r))}async function $Vo(t,e,r){let n=(0,IVo.safeParse)(e,b=>NFr.ConversationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,MVo.encodeJSON)("body",o,{explode:!0}),a=(0,AVo.pathToFunc)("/v1/conversations")(),s=new Headers((0,RVo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,AFr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,AFr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_start",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await kse.match(kse.json(200,NFr.ConversationResponse$inboundSchema),kse.jsonErr(422,NVo.HTTPValidationError$inboundSchema),kse.fail("4XX"),kse.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var LFr=S(fj=>{"use strict";var LVo=fj&&fj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FVo=fj&&fj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DAe=fj&&fj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LVo(r,e,n[o]);return FVo(r,e),r}}();Object.defineProperty(fj,"__esModule",{value:!0});fj.betaConversationsStartStream=JVo;var kVo=DAe(ae()),qVo=Tr(),BVo=iB(),qse=DAe(br()),UVo=ce(),zVo=te(),jFr=_r(),VVo=mr(),$Fr=DAe(zt()),HVo=DAe(Qn()),WVo=vr();function JVo(t,e,r){return new WVo.APIPromise(KVo(t,e,r))}async function KVo(t,e,r){let n=(0,zVo.safeParse)(e,b=>$Fr.ConversationStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,qVo.encodeJSON)("body",o,{explode:!0}),a=(0,VVo.pathToFunc)("/v1/conversations#stream")(),s=new Headers((0,UVo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,jFr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,jFr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_start_stream",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await qse.match(qse.sse(200,kVo.instanceof(ReadableStream).transform(b=>new BVo.EventStream(b,_=>({value:$Fr.ConversationEvents$inboundSchema.parse(_)})))),qse.jsonErr(422,HVo.HTTPValidationError$inboundSchema),qse.fail("4XX"),qse.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var FFr=S(jAe=>{"use strict";Object.defineProperty(jAe,"__esModule",{value:!0});jAe.Conversations=void 0;var GVo=fFr(),XVo=hFr(),ZVo=bFr(),YVo=vFr(),QVo=SFr(),eHo=TFr(),tHo=PFr(),rHo=IFr(),nHo=DFr(),oHo=LFr(),iHo=Vc(),qA=Rd(),ndt=class extends iHo.ClientSDK{async start(e,r){return(0,qA.unwrapAsync)((0,nHo.betaConversationsStart)(this,e,r))}async list(e,r){return(0,qA.unwrapAsync)((0,eHo.betaConversationsList)(this,e,r))}async get(e,r){return(0,qA.unwrapAsync)((0,ZVo.betaConversationsGet)(this,e,r))}async append(e,r){return(0,qA.unwrapAsync)((0,GVo.betaConversationsAppend)(this,e,r))}async getHistory(e,r){return(0,qA.unwrapAsync)((0,YVo.betaConversationsGetHistory)(this,e,r))}async getMessages(e,r){return(0,qA.unwrapAsync)((0,QVo.betaConversationsGetMessages)(this,e,r))}async restart(e,r){return(0,qA.unwrapAsync)((0,tHo.betaConversationsRestart)(this,e,r))}async startStream(e,r){return(0,qA.unwrapAsync)((0,oHo.betaConversationsStartStream)(this,e,r))}async appendStream(e,r){return(0,qA.unwrapAsync)((0,XVo.betaConversationsAppendStream)(this,e,r))}async restartStream(e,r){return(0,qA.unwrapAsync)((0,rHo.betaConversationsRestartStream)(this,e,r))}};jAe.Conversations=ndt});var BFr=S(pj=>{"use strict";var aHo=pj&&pj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sHo=pj&&pj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),odt=pj&&pj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aHo(r,e,n[o]);return sHo(r,e),r}}();Object.defineProperty(pj,"__esModule",{value:!0});pj.betaLibrariesCreate=mHo;var uHo=Tr(),Bse=odt(br()),lHo=ce(),cHo=te(),kFr=_r(),dHo=mr(),qFr=odt(zt()),fHo=odt(Qn()),pHo=vr();function mHo(t,e,r){return new pHo.APIPromise(hHo(t,e,r))}async function hHo(t,e,r){let n=(0,cHo.safeParse)(e,b=>qFr.LibraryIn$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,uHo.encodeJSON)("body",o,{explode:!0}),a=(0,dHo.pathToFunc)("/v1/libraries")(),s=new Headers((0,lHo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,kFr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,kFr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_create_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Bse.match(Bse.json(201,qFr.LibraryOut$inboundSchema),Bse.jsonErr(422,fHo.HTTPValidationError$inboundSchema),Bse.fail("4XX"),Bse.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var zFr=S(mj=>{"use strict";var gHo=mj&&mj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yHo=mj&&mj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Ae=mj&&mj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gHo(r,e,n[o]);return yHo(r,e),r}}();Object.defineProperty(mj,"__esModule",{value:!0});mj.betaLibrariesDelete=OHo;var bHo=Tr(),Use=$Ae(br()),_Ho=ce(),vHo=te(),UFr=_r(),wHo=mr(),SHo=$Ae(zt()),CHo=$Ae(Qn()),xHo=$Ae(eo()),THo=vr();function OHo(t,e,r){return new THo.APIPromise(EHo(t,e,r))}async function EHo(t,e,r){let n=(0,vHo.safeParse)(e,_=>xHo.LibrariesDeleteV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,bHo.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,wHo.pathToFunc)("/v1/libraries/{library_id}")(a),u=new Headers((0,_Ho.compactMap)({Accept:"application/json"})),l=await(0,UFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,UFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_delete_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Use.match(Use.json(200,SHo.LibraryOut$inboundSchema),Use.jsonErr(422,CHo.HTTPValidationError$inboundSchema),Use.fail("4XX"),Use.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var HFr=S(hj=>{"use strict";var PHo=hj&&hj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MHo=hj&&hj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LAe=hj&&hj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&PHo(r,e,n[o]);return MHo(r,e),r}}();Object.defineProperty(hj,"__esModule",{value:!0});hj.betaLibrariesGet=FHo;var RHo=Tr(),zse=LAe(br()),IHo=ce(),AHo=te(),VFr=_r(),NHo=mr(),DHo=LAe(zt()),jHo=LAe(Qn()),$Ho=LAe(eo()),LHo=vr();function FHo(t,e,r){return new LHo.APIPromise(kHo(t,e,r))}async function kHo(t,e,r){let n=(0,AHo.safeParse)(e,_=>$Ho.LibrariesGetV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,RHo.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,NHo.pathToFunc)("/v1/libraries/{library_id}")(a),u=new Headers((0,IHo.compactMap)({Accept:"application/json"})),l=await(0,VFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,VFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_get_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await zse.match(zse.json(200,DHo.LibraryOut$inboundSchema),zse.jsonErr(422,jHo.HTTPValidationError$inboundSchema),zse.fail("4XX"),zse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var KFr=S(gj=>{"use strict";var qHo=gj&&gj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BHo=gj&&gj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JFr=gj&&gj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qHo(r,e,n[o]);return BHo(r,e),r}}();Object.defineProperty(gj,"__esModule",{value:!0});gj.betaLibrariesList=WHo;var FAe=JFr(br()),UHo=ce(),WFr=_r(),zHo=mr(),VHo=JFr(zt()),HHo=vr();function WHo(t,e){return new HHo.APIPromise(JHo(t,e))}async function JHo(t,e){let r=(0,zHo.pathToFunc)("/v1/libraries")(),n=new Headers((0,UHo.compactMap)({Accept:"application/json"})),o=await(0,WFr.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,WFr.resolveGlobalSecurity)(i),s={options:t._options,baseURL:e?.serverURL??t._baseURL??"",operationID:"libraries_list_v1",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,userAgent:t._options.userAgent,timeoutMs:e?.timeoutMs||t._options.timeoutMs||-1},e);if(!u.ok)return[u,{status:"invalid"}];let l=u.value,c=await t._do(l,{context:s,errorCodes:["4XX","5XX"],retryConfig:s.retryConfig,retryCodes:s.retryCodes});if(!c.ok)return[c,{status:"request-error",request:l}];let d=c.value,[f]=await FAe.match(FAe.json(200,VHo.ListLibraryOut$inboundSchema),FAe.fail("4XX"),FAe.fail("5XX"))(d,l);return f.ok?[f,{status:"complete",request:l,response:d}]:[f,{status:"complete",request:l,response:d}]}});var ZFr=S(yj=>{"use strict";var KHo=yj&&yj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GHo=yj&&yj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kAe=yj&&yj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&KHo(r,e,n[o]);return GHo(r,e),r}}();Object.defineProperty(yj,"__esModule",{value:!0});yj.betaLibrariesUpdate=nWo;var GFr=Tr(),Vse=kAe(br()),XHo=ce(),ZHo=te(),XFr=_r(),YHo=mr(),QHo=kAe(zt()),eWo=kAe(Qn()),tWo=kAe(eo()),rWo=vr();function nWo(t,e,r){return new rWo.APIPromise(oWo(t,e,r))}async function oWo(t,e,r){let n=(0,ZHo.safeParse)(e,_=>tWo.LibrariesUpdateV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,GFr.encodeJSON)("body",o.LibraryInUpdate,{explode:!0}),a={library_id:(0,GFr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,YHo.pathToFunc)("/v1/libraries/{library_id}")(a),u=new Headers((0,XHo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,XFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,XFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_update_v1",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:"PUT",baseURL:r?.serverURL,path:s,headers:u,body:i,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Vse.match(Vse.json(200,QHo.LibraryOut$inboundSchema),Vse.jsonErr(422,eWo.HTTPValidationError$inboundSchema),Vse.fail("4XX"),Vse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var ekr=S(bj=>{"use strict";var iWo=bj&&bj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aWo=bj&&bj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qAe=bj&&bj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&iWo(r,e,n[o]);return aWo(r,e),r}}();Object.defineProperty(bj,"__esModule",{value:!0});bj.betaLibrariesAccessesDelete=mWo;var YFr=Tr(),Hse=qAe(br()),sWo=ce(),uWo=te(),QFr=_r(),lWo=mr(),cWo=qAe(zt()),dWo=qAe(Qn()),fWo=qAe(eo()),pWo=vr();function mWo(t,e,r){return new pWo.APIPromise(hWo(t,e,r))}async function hWo(t,e,r){let n=(0,uWo.safeParse)(e,_=>fWo.LibrariesShareDeleteV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,YFr.encodeJSON)("body",o.SharingDelete,{explode:!0}),a={library_id:(0,YFr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,lWo.pathToFunc)("/v1/libraries/{library_id}/share")(a),u=new Headers((0,sWo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,QFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,QFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_share_delete_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Hse.match(Hse.json(200,cWo.SharingOut$inboundSchema),Hse.jsonErr(422,dWo.HTTPValidationError$inboundSchema),Hse.fail("4XX"),Hse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var rkr=S(_j=>{"use strict";var gWo=_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]}),yWo=_j&&_j.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BAe=_j&&_j.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gWo(r,e,n[o]);return yWo(r,e),r}}();Object.defineProperty(_j,"__esModule",{value:!0});_j.betaLibrariesAccessesList=OWo;var bWo=Tr(),Wse=BAe(br()),_Wo=ce(),vWo=te(),tkr=_r(),wWo=mr(),SWo=BAe(zt()),CWo=BAe(Qn()),xWo=BAe(eo()),TWo=vr();function OWo(t,e,r){return new TWo.APIPromise(EWo(t,e,r))}async function EWo(t,e,r){let n=(0,vWo.safeParse)(e,_=>xWo.LibrariesShareListV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,bWo.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,wWo.pathToFunc)("/v1/libraries/{library_id}/share")(a),u=new Headers((0,_Wo.compactMap)({Accept:"application/json"})),l=await(0,tkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,tkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_share_list_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Wse.match(Wse.json(200,SWo.ListSharingOut$inboundSchema),Wse.jsonErr(422,CWo.HTTPValidationError$inboundSchema),Wse.fail("4XX"),Wse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var ikr=S(vj=>{"use strict";var PWo=vj&&vj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MWo=vj&&vj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UAe=vj&&vj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&PWo(r,e,n[o]);return MWo(r,e),r}}();Object.defineProperty(vj,"__esModule",{value:!0});vj.betaLibrariesAccessesUpdateOrCreate=LWo;var nkr=Tr(),Jse=UAe(br()),RWo=ce(),IWo=te(),okr=_r(),AWo=mr(),NWo=UAe(zt()),DWo=UAe(Qn()),jWo=UAe(eo()),$Wo=vr();function LWo(t,e,r){return new $Wo.APIPromise(FWo(t,e,r))}async function FWo(t,e,r){let n=(0,IWo.safeParse)(e,_=>jWo.LibrariesShareCreateV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,nkr.encodeJSON)("body",o.SharingIn,{explode:!0}),a={library_id:(0,nkr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,AWo.pathToFunc)("/v1/libraries/{library_id}/share")(a),u=new Headers((0,RWo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,okr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,okr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_share_create_v1",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:"PUT",baseURL:r?.serverURL,path:s,headers:u,body:i,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Jse.match(Jse.json(200,NWo.SharingOut$inboundSchema),Jse.jsonErr(422,DWo.HTTPValidationError$inboundSchema),Jse.fail("4XX"),Jse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var akr=S(zAe=>{"use strict";Object.defineProperty(zAe,"__esModule",{value:!0});zAe.Accesses=void 0;var kWo=ekr(),qWo=rkr(),BWo=ikr(),UWo=Vc(),idt=Rd(),adt=class extends UWo.ClientSDK{async list(e,r){return(0,idt.unwrapAsync)((0,qWo.betaLibrariesAccessesList)(this,e,r))}async updateOrCreate(e,r){return(0,idt.unwrapAsync)((0,BWo.betaLibrariesAccessesUpdateOrCreate)(this,e,r))}async delete(e,r){return(0,idt.unwrapAsync)((0,kWo.betaLibrariesAccessesDelete)(this,e,r))}};zAe.Accesses=adt});var lkr=S(wj=>{"use strict";var zWo=wj&&wj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VWo=wj&&wj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VAe=wj&&wj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zWo(r,e,n[o]);return VWo(r,e),r}}();Object.defineProperty(wj,"__esModule",{value:!0});wj.betaLibrariesDocumentsDelete=YWo;var HWo=VAe(ae()),skr=Tr(),Kse=VAe(br()),WWo=ce(),JWo=te(),ukr=_r(),KWo=mr(),GWo=VAe(Qn()),XWo=VAe(eo()),ZWo=vr();function YWo(t,e,r){return new ZWo.APIPromise(QWo(t,e,r))}async function QWo(t,e,r){let n=(0,JWo.safeParse)(e,_=>XWo.LibrariesDocumentsDeleteV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,skr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,skr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,KWo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}")(a),u=new Headers((0,WWo.compactMap)({Accept:"application/json"})),l=await(0,ukr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ukr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_delete_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Kse.match(Kse.nil(204,HWo.void()),Kse.jsonErr(422,GWo.HTTPValidationError$inboundSchema),Kse.fail("4XX"),Kse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var fkr=S(Sj=>{"use strict";var e3o=Sj&&Sj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t3o=Sj&&Sj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HAe=Sj&&Sj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&e3o(r,e,n[o]);return t3o(r,e),r}}();Object.defineProperty(Sj,"__esModule",{value:!0});Sj.betaLibrariesDocumentsExtractedTextSignedUrl=l3o;var r3o=HAe(ae()),ckr=Tr(),Gse=HAe(br()),n3o=ce(),o3o=te(),dkr=_r(),i3o=mr(),a3o=HAe(Qn()),s3o=HAe(eo()),u3o=vr();function l3o(t,e,r){return new u3o.APIPromise(c3o(t,e,r))}async function c3o(t,e,r){let n=(0,o3o.safeParse)(e,_=>s3o.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,ckr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,ckr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,i3o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/extracted-text-signed-url")(a),u=new Headers((0,n3o.compactMap)({Accept:"application/json"})),l=await(0,dkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,dkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_get_extracted_text_signed_url_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Gse.match(Gse.json(200,r3o.string()),Gse.jsonErr(422,a3o.HTTPValidationError$inboundSchema),Gse.fail("4XX"),Gse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var hkr=S(Cj=>{"use strict";var d3o=Cj&&Cj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f3o=Cj&&Cj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WAe=Cj&&Cj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&d3o(r,e,n[o]);return f3o(r,e),r}}();Object.defineProperty(Cj,"__esModule",{value:!0});Cj.betaLibrariesDocumentsGet=v3o;var pkr=Tr(),Xse=WAe(br()),p3o=ce(),m3o=te(),mkr=_r(),h3o=mr(),g3o=WAe(zt()),y3o=WAe(Qn()),b3o=WAe(eo()),_3o=vr();function v3o(t,e,r){return new _3o.APIPromise(w3o(t,e,r))}async function w3o(t,e,r){let n=(0,m3o.safeParse)(e,_=>b3o.LibrariesDocumentsGetV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,pkr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,pkr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,h3o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}")(a),u=new Headers((0,p3o.compactMap)({Accept:"application/json"})),l=await(0,mkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,mkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_get_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Xse.match(Xse.json(200,g3o.DocumentOut$inboundSchema),Xse.jsonErr(422,y3o.HTTPValidationError$inboundSchema),Xse.fail("4XX"),Xse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var bkr=S(xj=>{"use strict";var S3o=xj&&xj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C3o=xj&&xj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JAe=xj&&xj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&S3o(r,e,n[o]);return C3o(r,e),r}}();Object.defineProperty(xj,"__esModule",{value:!0});xj.betaLibrariesDocumentsGetSignedUrl=I3o;var x3o=JAe(ae()),gkr=Tr(),Zse=JAe(br()),T3o=ce(),O3o=te(),ykr=_r(),E3o=mr(),P3o=JAe(Qn()),M3o=JAe(eo()),R3o=vr();function I3o(t,e,r){return new R3o.APIPromise(A3o(t,e,r))}async function A3o(t,e,r){let n=(0,O3o.safeParse)(e,_=>M3o.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,gkr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,gkr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,E3o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/signed-url")(a),u=new Headers((0,T3o.compactMap)({Accept:"application/json"})),l=await(0,ykr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ykr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_get_signed_url_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Zse.match(Zse.json(200,x3o.string()),Zse.jsonErr(422,P3o.HTTPValidationError$inboundSchema),Zse.fail("4XX"),Zse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var wkr=S(Tj=>{"use strict";var N3o=Tj&&Tj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),D3o=Tj&&Tj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KAe=Tj&&Tj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&N3o(r,e,n[o]);return D3o(r,e),r}}();Object.defineProperty(Tj,"__esModule",{value:!0});Tj.betaLibrariesDocumentsList=U3o;var _kr=Tr(),Yse=KAe(br()),j3o=ce(),$3o=te(),vkr=_r(),L3o=mr(),F3o=KAe(zt()),k3o=KAe(Qn()),q3o=KAe(eo()),B3o=vr();function U3o(t,e,r){return new B3o.APIPromise(z3o(t,e,r))}async function z3o(t,e,r){let n=(0,$3o.safeParse)(e,w=>q3o.LibrariesDocumentsListV1Request$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,_kr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,L3o.pathToFunc)("/v1/libraries/{library_id}/documents")(a),u=(0,_kr.encodeFormQuery)({page:o.page,page_size:o.page_size,search:o.search,sort_by:o.sort_by,sort_order:o.sort_order}),l=new Headers((0,j3o.compactMap)({Accept:"application/json"})),c=await(0,vkr.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,vkr.resolveGlobalSecurity)(d),p={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_list_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!m.ok)return[m,{status:"invalid"}];let h=m.value,y=await t._do(h,{context:p,errorCodes:["422","4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!y.ok)return[y,{status:"request-error",request:h}];let g=y.value,b={HttpMeta:{Response:g,Request:h}},[_]=await Yse.match(Yse.json(200,F3o.ListDocumentOut$inboundSchema),Yse.jsonErr(422,k3o.HTTPValidationError$inboundSchema),Yse.fail("4XX"),Yse.fail("5XX"))(g,h,{extraFields:b});return _.ok?[_,{status:"complete",request:h,response:g}]:[_,{status:"complete",request:h,response:g}]}});var xkr=S(Oj=>{"use strict";var V3o=Oj&&Oj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),H3o=Oj&&Oj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GAe=Oj&&Oj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&V3o(r,e,n[o]);return H3o(r,e),r}}();Object.defineProperty(Oj,"__esModule",{value:!0});Oj.betaLibrariesDocumentsReprocess=Q3o;var W3o=GAe(ae()),Skr=Tr(),Qse=GAe(br()),J3o=ce(),K3o=te(),Ckr=_r(),G3o=mr(),X3o=GAe(Qn()),Z3o=GAe(eo()),Y3o=vr();function Q3o(t,e,r){return new Y3o.APIPromise(e6o(t,e,r))}async function e6o(t,e,r){let n=(0,K3o.safeParse)(e,_=>Z3o.LibrariesDocumentsReprocessV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,Skr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,Skr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,G3o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/reprocess")(a),u=new Headers((0,J3o.compactMap)({Accept:"application/json"})),l=await(0,Ckr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Ckr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_reprocess_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Qse.match(Qse.nil(204,W3o.void()),Qse.jsonErr(422,X3o.HTTPValidationError$inboundSchema),Qse.fail("4XX"),Qse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Ekr=S(Ej=>{"use strict";var t6o=Ej&&Ej.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r6o=Ej&&Ej.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XAe=Ej&&Ej.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&t6o(r,e,n[o]);return r6o(r,e),r}}();Object.defineProperty(Ej,"__esModule",{value:!0});Ej.betaLibrariesDocumentsStatus=c6o;var Tkr=Tr(),eue=XAe(br()),n6o=ce(),o6o=te(),Okr=_r(),i6o=mr(),a6o=XAe(zt()),s6o=XAe(Qn()),u6o=XAe(eo()),l6o=vr();function c6o(t,e,r){return new l6o.APIPromise(d6o(t,e,r))}async function d6o(t,e,r){let n=(0,o6o.safeParse)(e,_=>u6o.LibrariesDocumentsGetStatusV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,Tkr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,Tkr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,i6o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/status")(a),u=new Headers((0,n6o.compactMap)({Accept:"application/json"})),l=await(0,Okr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Okr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_get_status_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await eue.match(eue.json(200,a6o.ProcessingStatusOut$inboundSchema),eue.jsonErr(422,s6o.HTTPValidationError$inboundSchema),eue.fail("4XX"),eue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Rkr=S(Pj=>{"use strict";var f6o=Pj&&Pj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p6o=Pj&&Pj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZAe=Pj&&Pj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&f6o(r,e,n[o]);return p6o(r,e),r}}();Object.defineProperty(Pj,"__esModule",{value:!0});Pj.betaLibrariesDocumentsTextContent=w6o;var Pkr=Tr(),tue=ZAe(br()),m6o=ce(),h6o=te(),Mkr=_r(),g6o=mr(),y6o=ZAe(zt()),b6o=ZAe(Qn()),_6o=ZAe(eo()),v6o=vr();function w6o(t,e,r){return new v6o.APIPromise(S6o(t,e,r))}async function S6o(t,e,r){let n=(0,h6o.safeParse)(e,_=>_6o.LibrariesDocumentsGetTextContentV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,Pkr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,Pkr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,g6o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/text_content")(a),u=new Headers((0,m6o.compactMap)({Accept:"application/json"})),l=await(0,Mkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Mkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_get_text_content_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await tue.match(tue.json(200,y6o.DocumentTextContent$inboundSchema),tue.jsonErr(422,b6o.HTTPValidationError$inboundSchema),tue.fail("4XX"),tue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Akr=S(Mj=>{"use strict";var C6o=Mj&&Mj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x6o=Mj&&Mj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YAe=Mj&&Mj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&C6o(r,e,n[o]);return x6o(r,e),r}}();Object.defineProperty(Mj,"__esModule",{value:!0});Mj.betaLibrariesDocumentsUpdate=A6o;var sdt=Tr(),rue=YAe(br()),T6o=ce(),O6o=te(),Ikr=_r(),E6o=mr(),P6o=YAe(zt()),M6o=YAe(Qn()),R6o=YAe(eo()),I6o=vr();function A6o(t,e,r){return new I6o.APIPromise(N6o(t,e,r))}async function N6o(t,e,r){let n=(0,O6o.safeParse)(e,_=>R6o.LibrariesDocumentsUpdateV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,sdt.encodeJSON)("body",o.DocumentUpdateIn,{explode:!0}),a={document_id:(0,sdt.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,sdt.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,E6o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}")(a),u=new Headers((0,T6o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,Ikr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Ikr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_update_v1",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:"PUT",baseURL:r?.serverURL,path:s,headers:u,body:i,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await rue.match(rue.json(200,P6o.DocumentOut$inboundSchema),rue.jsonErr(422,M6o.HTTPValidationError$inboundSchema),rue.fail("4XX"),rue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Dkr=S(Rj=>{"use strict";var D6o=Rj&&Rj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),j6o=Rj&&Rj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eNe=Rj&&Rj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&D6o(r,e,n[o]);return j6o(r,e),r}}();Object.defineProperty(Rj,"__esModule",{value:!0});Rj.betaLibrariesDocumentsUpload=H6o;var QAe=Tr(),udt=k9(),nue=eNe(br()),$6o=ce(),L6o=te(),Nkr=_r(),F6o=mr(),k6o=eNe(zt()),q6o=eNe(Qn()),B6o=eNe(eo()),U6o=vr(),z6o=HD(),V6o=Pse();function H6o(t,e,r){return new U6o.APIPromise(W6o(t,e,r))}async function W6o(t,e,r){let n=(0,L6o.safeParse)(e,_=>B6o.LibrariesDocumentsUploadV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,z6o.isBlobLike)(o.RequestBody.file))(0,QAe.appendForm)(i,"file",o.RequestBody.file);else if((0,V6o.isReadableStream)(o.RequestBody.file.content)){let _=await(0,udt.readableStreamToArrayBuffer)(o.RequestBody.file.content),w=(0,udt.getContentTypeFromFileName)(o.RequestBody.file.fileName)||"application/octet-stream",T=new Blob([_],{type:w});(0,QAe.appendForm)(i,"file",T,o.RequestBody.file.fileName)}else{let _=(0,udt.getContentTypeFromFileName)(o.RequestBody.file.fileName)||"application/octet-stream";(0,QAe.appendForm)(i,"file",new Blob([o.RequestBody.file.content],{type:_}),o.RequestBody.file.fileName)}let a={library_id:(0,QAe.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,F6o.pathToFunc)("/v1/libraries/{library_id}/documents")(a),u=new Headers((0,$6o.compactMap)({Accept:"application/json"})),l=await(0,Nkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Nkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_upload_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await nue.match(nue.json([200,201],k6o.DocumentOut$inboundSchema),nue.jsonErr(422,q6o.HTTPValidationError$inboundSchema),nue.fail("4XX"),nue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var jkr=S(tNe=>{"use strict";Object.defineProperty(tNe,"__esModule",{value:!0});tNe.Documents=void 0;var J6o=lkr(),K6o=fkr(),G6o=hkr(),X6o=bkr(),Z6o=wkr(),Y6o=xkr(),Q6o=Ekr(),eJo=Rkr(),tJo=Akr(),rJo=Dkr(),nJo=Vc(),BA=Rd(),ldt=class extends nJo.ClientSDK{async list(e,r){return(0,BA.unwrapAsync)((0,Z6o.betaLibrariesDocumentsList)(this,e,r))}async upload(e,r){return(0,BA.unwrapAsync)((0,rJo.betaLibrariesDocumentsUpload)(this,e,r))}async get(e,r){return(0,BA.unwrapAsync)((0,G6o.betaLibrariesDocumentsGet)(this,e,r))}async update(e,r){return(0,BA.unwrapAsync)((0,tJo.betaLibrariesDocumentsUpdate)(this,e,r))}async delete(e,r){return(0,BA.unwrapAsync)((0,J6o.betaLibrariesDocumentsDelete)(this,e,r))}async textContent(e,r){return(0,BA.unwrapAsync)((0,eJo.betaLibrariesDocumentsTextContent)(this,e,r))}async status(e,r){return(0,BA.unwrapAsync)((0,Q6o.betaLibrariesDocumentsStatus)(this,e,r))}async getSignedUrl(e,r){return(0,BA.unwrapAsync)((0,X6o.betaLibrariesDocumentsGetSignedUrl)(this,e,r))}async extractedTextSignedUrl(e,r){return(0,BA.unwrapAsync)((0,K6o.betaLibrariesDocumentsExtractedTextSignedUrl)(this,e,r))}async reprocess(e,r){return(0,BA.unwrapAsync)((0,Y6o.betaLibrariesDocumentsReprocess)(this,e,r))}};tNe.Documents=ldt});var $kr=S(rNe=>{"use strict";Object.defineProperty(rNe,"__esModule",{value:!0});rNe.Libraries=void 0;var oJo=BFr(),iJo=zFr(),aJo=HFr(),sJo=KFr(),uJo=ZFr(),lJo=Vc(),oue=Rd(),cJo=akr(),dJo=jkr(),cdt=class extends lJo.ClientSDK{get documents(){return this._documents??(this._documents=new dJo.Documents(this._options))}get accesses(){return this._accesses??(this._accesses=new cJo.Accesses(this._options))}async list(e){return(0,oue.unwrapAsync)((0,sJo.betaLibrariesList)(this,e))}async create(e,r){return(0,oue.unwrapAsync)((0,oJo.betaLibrariesCreate)(this,e,r))}async get(e,r){return(0,oue.unwrapAsync)((0,aJo.betaLibrariesGet)(this,e,r))}async delete(e,r){return(0,oue.unwrapAsync)((0,iJo.betaLibrariesDelete)(this,e,r))}async update(e,r){return(0,oue.unwrapAsync)((0,uJo.betaLibrariesUpdate)(this,e,r))}};rNe.Libraries=cdt});var kkr=S(Ij=>{"use strict";var fJo=Ij&&Ij.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pJo=Ij&&Ij.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ddt=Ij&&Ij.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fJo(r,e,n[o]);return pJo(r,e),r}}();Object.defineProperty(Ij,"__esModule",{value:!0});Ij.betaAgentsCreate=vJo;var mJo=Tr(),iue=ddt(br()),hJo=ce(),gJo=te(),Lkr=_r(),yJo=mr(),Fkr=ddt(zt()),bJo=ddt(Qn()),_Jo=vr();function vJo(t,e,r){return new _Jo.APIPromise(wJo(t,e,r))}async function wJo(t,e,r){let n=(0,gJo.safeParse)(e,b=>Fkr.AgentCreationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,mJo.encodeJSON)("body",o,{explode:!0}),a=(0,yJo.pathToFunc)("/v1/agents")(),s=new Headers((0,hJo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,Lkr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Lkr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_agents_create",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await iue.match(iue.json(200,Fkr.Agent$inboundSchema),iue.jsonErr(422,bJo.HTTPValidationError$inboundSchema),iue.fail("4XX"),iue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var Bkr=S(Aj=>{"use strict";var SJo=Aj&&Aj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CJo=Aj&&Aj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nNe=Aj&&Aj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&SJo(r,e,n[o]);return CJo(r,e),r}}();Object.defineProperty(Aj,"__esModule",{value:!0});Aj.betaAgentsGet=AJo;var xJo=Tr(),aue=nNe(br()),TJo=ce(),OJo=te(),qkr=_r(),EJo=mr(),PJo=nNe(zt()),MJo=nNe(Qn()),RJo=nNe(eo()),IJo=vr();function AJo(t,e,r){return new IJo.APIPromise(NJo(t,e,r))}async function NJo(t,e,r){let n=(0,OJo.safeParse)(e,_=>RJo.AgentsApiV1AgentsGetRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={agent_id:(0,xJo.encodeSimple)("agent_id",o.agent_id,{explode:!1,charEncoding:"percent"})},s=(0,EJo.pathToFunc)("/v1/agents/{agent_id}")(a),u=new Headers((0,TJo.compactMap)({Accept:"application/json"})),l=await(0,qkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,qkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_agents_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await aue.match(aue.json(200,PJo.Agent$inboundSchema),aue.jsonErr(422,MJo.HTTPValidationError$inboundSchema),aue.fail("4XX"),aue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var zkr=S(Nj=>{"use strict";var DJo=Nj&&Nj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jJo=Nj&&Nj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uue=Nj&&Nj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&DJo(r,e,n[o]);return jJo(r,e),r}}();Object.defineProperty(Nj,"__esModule",{value:!0});Nj.betaAgentsList=HJo;var $Jo=uue(ae()),LJo=Tr(),sue=uue(br()),FJo=ce(),kJo=te(),Ukr=_r(),qJo=mr(),BJo=uue(zt()),UJo=uue(Qn()),zJo=uue(eo()),VJo=vr();function HJo(t,e,r){return new VJo.APIPromise(WJo(t,e,r))}async function WJo(t,e,r){let n=(0,kJo.safeParse)(e,_=>zJo.AgentsApiV1AgentsListRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,qJo.pathToFunc)("/v1/agents")(),s=(0,LJo.encodeFormQuery)({page:o?.page,page_size:o?.page_size}),u=new Headers((0,FJo.compactMap)({Accept:"application/json"})),l=await(0,Ukr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Ukr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_agents_list",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await sue.match(sue.json(200,$Jo.array(BJo.Agent$inboundSchema)),sue.jsonErr(422,UJo.HTTPValidationError$inboundSchema),sue.fail("4XX"),sue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Wkr=S(Dj=>{"use strict";var JJo=Dj&&Dj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KJo=Dj&&Dj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oNe=Dj&&Dj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&JJo(r,e,n[o]);return KJo(r,e),r}}();Object.defineProperty(Dj,"__esModule",{value:!0});Dj.betaAgentsUpdate=r5o;var Vkr=Tr(),lue=oNe(br()),GJo=ce(),XJo=te(),Hkr=_r(),ZJo=mr(),YJo=oNe(zt()),QJo=oNe(Qn()),e5o=oNe(eo()),t5o=vr();function r5o(t,e,r){return new t5o.APIPromise(n5o(t,e,r))}async function n5o(t,e,r){let n=(0,XJo.safeParse)(e,_=>e5o.AgentsApiV1AgentsUpdateRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,Vkr.encodeJSON)("body",o.AgentUpdateRequest,{explode:!0}),a={agent_id:(0,Vkr.encodeSimple)("agent_id",o.agent_id,{explode:!1,charEncoding:"percent"})},s=(0,ZJo.pathToFunc)("/v1/agents/{agent_id}")(a),u=new Headers((0,GJo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,Hkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Hkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_agents_update",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await lue.match(lue.json(200,YJo.Agent$inboundSchema),lue.jsonErr(422,QJo.HTTPValidationError$inboundSchema),lue.fail("4XX"),lue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Gkr=S(jj=>{"use strict";var o5o=jj&&jj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i5o=jj&&jj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iNe=jj&&jj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&o5o(r,e,n[o]);return i5o(r,e),r}}();Object.defineProperty(jj,"__esModule",{value:!0});jj.betaAgentsUpdateVersion=p5o;var Jkr=Tr(),cue=iNe(br()),a5o=ce(),s5o=te(),Kkr=_r(),u5o=mr(),l5o=iNe(zt()),c5o=iNe(Qn()),d5o=iNe(eo()),f5o=vr();function p5o(t,e,r){return new f5o.APIPromise(m5o(t,e,r))}async function m5o(t,e,r){let n=(0,s5o.safeParse)(e,w=>d5o.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={agent_id:(0,Jkr.encodeSimple)("agent_id",o.agent_id,{explode:!1,charEncoding:"percent"})},s=(0,u5o.pathToFunc)("/v1/agents/{agent_id}/version")(a),u=(0,Jkr.encodeFormQuery)({version:o.version}),l=new Headers((0,a5o.compactMap)({Accept:"application/json"})),c=await(0,Kkr.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,Kkr.resolveGlobalSecurity)(d),p={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_agents_update_version",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:"PATCH",baseURL:r?.serverURL,path:s,headers:l,query:u,body:i,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!m.ok)return[m,{status:"invalid"}];let h=m.value,y=await t._do(h,{context:p,errorCodes:["422","4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!y.ok)return[y,{status:"request-error",request:h}];let g=y.value,b={HttpMeta:{Response:g,Request:h}},[_]=await cue.match(cue.json(200,l5o.Agent$inboundSchema),cue.jsonErr(422,c5o.HTTPValidationError$inboundSchema),cue.fail("4XX"),cue.fail("5XX"))(g,h,{extraFields:b});return _.ok?[_,{status:"complete",request:h,response:g}]:[_,{status:"complete",request:h,response:g}]}});var Xkr=S(aNe=>{"use strict";Object.defineProperty(aNe,"__esModule",{value:!0});aNe.MistralAgents=void 0;var h5o=kkr(),g5o=Bkr(),y5o=zkr(),b5o=Wkr(),_5o=Gkr(),v5o=Vc(),due=Rd(),fdt=class extends v5o.ClientSDK{async create(e,r){return(0,due.unwrapAsync)((0,h5o.betaAgentsCreate)(this,e,r))}async list(e,r){return(0,due.unwrapAsync)((0,y5o.betaAgentsList)(this,e,r))}async get(e,r){return(0,due.unwrapAsync)((0,g5o.betaAgentsGet)(this,e,r))}async update(e,r){return(0,due.unwrapAsync)((0,b5o.betaAgentsUpdate)(this,e,r))}async updateVersion(e,r){return(0,due.unwrapAsync)((0,_5o.betaAgentsUpdateVersion)(this,e,r))}};aNe.MistralAgents=fdt});var Zkr=S(sNe=>{"use strict";Object.defineProperty(sNe,"__esModule",{value:!0});sNe.Beta=void 0;var w5o=Vc(),S5o=FFr(),C5o=$kr(),x5o=Xkr(),pdt=class extends w5o.ClientSDK{get conversations(){return this._conversations??(this._conversations=new S5o.Conversations(this._options))}get agents(){return this._agents??(this._agents=new x5o.MistralAgents(this._options))}get libraries(){return this._libraries??(this._libraries=new C5o.Libraries(this._options))}};sNe.Beta=pdt});var eqr=S($j=>{"use strict";var T5o=$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]}),O5o=$j&&$j.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mdt=$j&&$j.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T5o(r,e,n[o]);return O5o(r,e),r}}();Object.defineProperty($j,"__esModule",{value:!0});$j.chatComplete=N5o;var E5o=Tr(),fue=mdt(br()),P5o=ce(),M5o=te(),Ykr=_r(),R5o=mr(),Qkr=mdt(zt()),I5o=mdt(Qn()),A5o=vr();function N5o(t,e,r){return new A5o.APIPromise(D5o(t,e,r))}async function D5o(t,e,r){let n=(0,M5o.safeParse)(e,b=>Qkr.ChatCompletionRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,E5o.encodeJSON)("body",o,{explode:!0}),a=(0,R5o.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,P5o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,Ykr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Ykr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await fue.match(fue.json(200,Qkr.ChatCompletionResponse$inboundSchema),fue.jsonErr(422,I5o.HTTPValidationError$inboundSchema),fue.fail("4XX"),fue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var nqr=S(Lj=>{"use strict";var j5o=Lj&&Lj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$5o=Lj&&Lj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uNe=Lj&&Lj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&j5o(r,e,n[o]);return $5o(r,e),r}}();Object.defineProperty(Lj,"__esModule",{value:!0});Lj.chatStream=H5o;var L5o=uNe(ae()),F5o=Tr(),k5o=iB(),pue=uNe(br()),q5o=ce(),B5o=te(),tqr=_r(),U5o=mr(),rqr=uNe(zt()),z5o=uNe(Qn()),V5o=vr();function H5o(t,e,r){return new V5o.APIPromise(W5o(t,e,r))}async function W5o(t,e,r){let n=(0,B5o.safeParse)(e,b=>rqr.ChatCompletionStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,F5o.encodeJSON)("body",o,{explode:!0}),a=(0,U5o.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,q5o.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,tqr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,tqr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await pue.match(pue.sse(200,L5o.instanceof(ReadableStream).transform(b=>new k5o.EventStream(b,_=>_.data==="[DONE]"?{done:!0}:{value:rqr.CompletionEvent$inboundSchema.parse(_)}))),pue.jsonErr(422,z5o.HTTPValidationError$inboundSchema),pue.fail("4XX"),pue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var lNe=S(UA=>{"use strict";Object.defineProperty(UA,"__esModule",{value:!0});UA.getDefaultOptions=UA.defaultOptions=UA.ignoreOverride=void 0;UA.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");UA.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 J5o=t=>typeof t=="string"?{...UA.defaultOptions,name:t}:{...UA.defaultOptions,...t};UA.getDefaultOptions=J5o});var hdt=S(cNe=>{"use strict";Object.defineProperty(cNe,"__esModule",{value:!0});cNe.getRefs=void 0;var K5o=lNe(),G5o=t=>{let e=(0,K5o.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}]))}};cNe.getRefs=G5o});var uB=S(A7=>{"use strict";Object.defineProperty(A7,"__esModule",{value:!0});A7.setResponseValueAndErrors=A7.addErrorMessage=void 0;function oqr(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}A7.addErrorMessage=oqr;function X5o(t,e,r,n,o){t[e]=r,oqr(t,e,n,o)}A7.setResponseValueAndErrors=X5o});var gdt=S(dNe=>{"use strict";Object.defineProperty(dNe,"__esModule",{value:!0});dNe.parseAnyDef=void 0;function Z5o(){return{}}dNe.parseAnyDef=Z5o});var ydt=S(pNe=>{"use strict";Object.defineProperty(pNe,"__esModule",{value:!0});pNe.parseArrayDef=void 0;var Y5o=ae(),fNe=uB(),Q5o=fm();function eKo(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==Y5o.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,Q5o.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,fNe.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,fNe.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,fNe.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,fNe.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}pNe.parseArrayDef=eKo});var bdt=S(mNe=>{"use strict";Object.defineProperty(mNe,"__esModule",{value:!0});mNe.parseBigintDef=void 0;var fW=uB();function tKo(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,fW.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,fW.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,fW.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,fW.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,fW.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,fW.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,fW.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}mNe.parseBigintDef=tKo});var _dt=S(hNe=>{"use strict";Object.defineProperty(hNe,"__esModule",{value:!0});hNe.parseBooleanDef=void 0;function rKo(){return{type:"boolean"}}hNe.parseBooleanDef=rKo});var yNe=S(gNe=>{"use strict";Object.defineProperty(gNe,"__esModule",{value:!0});gNe.parseBrandedDef=void 0;var nKo=fm();function oKo(t,e){return(0,nKo.parseDef)(t.type._def,e)}gNe.parseBrandedDef=oKo});var vdt=S(bNe=>{"use strict";Object.defineProperty(bNe,"__esModule",{value:!0});bNe.parseCatchDef=void 0;var iKo=fm(),aKo=(t,e)=>(0,iKo.parseDef)(t.innerType._def,e);bNe.parseCatchDef=aKo});var wdt=S(_Ne=>{"use strict";Object.defineProperty(_Ne,"__esModule",{value:!0});_Ne.parseDateDef=void 0;var iqr=uB();function aqr(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>aqr(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 sKo(t,e)}}_Ne.parseDateDef=aqr;var sKo=(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,iqr.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,iqr.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var Sdt=S(vNe=>{"use strict";Object.defineProperty(vNe,"__esModule",{value:!0});vNe.parseDefaultDef=void 0;var uKo=fm();function lKo(t,e){return{...(0,uKo.parseDef)(t.innerType._def,e),default:t.defaultValue()}}vNe.parseDefaultDef=lKo});var Cdt=S(wNe=>{"use strict";Object.defineProperty(wNe,"__esModule",{value:!0});wNe.parseEffectsDef=void 0;var cKo=fm();function dKo(t,e){return e.effectStrategy==="input"?(0,cKo.parseDef)(t.schema._def,e):{}}wNe.parseEffectsDef=dKo});var xdt=S(SNe=>{"use strict";Object.defineProperty(SNe,"__esModule",{value:!0});SNe.parseEnumDef=void 0;function fKo(t){return{type:"string",enum:Array.from(t.values)}}SNe.parseEnumDef=fKo});var Tdt=S(CNe=>{"use strict";Object.defineProperty(CNe,"__esModule",{value:!0});CNe.parseIntersectionDef=void 0;var sqr=fm(),pKo=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function mKo(t,e){let r=[(0,sqr.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,sqr.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(pKo(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}CNe.parseIntersectionDef=mKo});var Odt=S(xNe=>{"use strict";Object.defineProperty(xNe,"__esModule",{value:!0});xNe.parseLiteralDef=void 0;function hKo(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}}xNe.parseLiteralDef=hKo});var TNe=S(Yg=>{"use strict";Object.defineProperty(Yg,"__esModule",{value:!0});Yg.parseStringDef=Yg.zodPatterns=void 0;var pW=uB(),Edt;Yg.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:()=>(Edt===void 0&&(Edt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Edt),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 gKo(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":(0,pW.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":(0,pW.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":Jx(r,"email",n.message,e);break;case"format:idn-email":Jx(r,"idn-email",n.message,e);break;case"pattern:zod":e_(r,Yg.zodPatterns.email,n.message,e);break}break;case"url":Jx(r,"uri",n.message,e);break;case"uuid":Jx(r,"uuid",n.message,e);break;case"regex":e_(r,n.regex,n.message,e);break;case"cuid":e_(r,Yg.zodPatterns.cuid,n.message,e);break;case"cuid2":e_(r,Yg.zodPatterns.cuid2,n.message,e);break;case"startsWith":e_(r,RegExp(`^${Pdt(n.value,e)}`),n.message,e);break;case"endsWith":e_(r,RegExp(`${Pdt(n.value,e)}$`),n.message,e);break;case"datetime":Jx(r,"date-time",n.message,e);break;case"date":Jx(r,"date",n.message,e);break;case"time":Jx(r,"time",n.message,e);break;case"duration":Jx(r,"duration",n.message,e);break;case"length":(0,pW.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),(0,pW.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{e_(r,RegExp(Pdt(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&Jx(r,"ipv4",n.message,e),n.version!=="v4"&&Jx(r,"ipv6",n.message,e);break}case"base64url":e_(r,Yg.zodPatterns.base64url,n.message,e);break;case"jwt":e_(r,Yg.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&e_(r,Yg.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&e_(r,Yg.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":e_(r,Yg.zodPatterns.emoji(),n.message,e);break;case"ulid":{e_(r,Yg.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Jx(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,pW.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{e_(r,Yg.zodPatterns.base64,n.message,e);break}}break}case"nanoid":e_(r,Yg.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}Yg.parseStringDef=gKo;function Pdt(t,e){return e.patternStrategy==="escape"?bKo(t):t}var yKo=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function bKo(t){let e="";for(let r=0;r<t.length;r++)yKo.has(t[r])||(e+="\\"),e+=t[r];return e}function Jx(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,pW.setResponseValueAndErrors)(t,"format",e,r,n)}function e_(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:uqr(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,pW.setResponseValueAndErrors)(t,"pattern",uqr(e,n),r,n)}function uqr(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 ENe=S(ONe=>{"use strict";Object.defineProperty(ONe,"__esModule",{value:!0});ONe.parseRecordDef=void 0;var mue=ae(),lqr=fm(),_Ko=TNe(),vKo=yNe();function wKo(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===mue.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,lqr.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,lqr.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===mue.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,_Ko.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===mue.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===mue.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===mue.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,vKo.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}ONe.parseRecordDef=wKo});var Mdt=S(PNe=>{"use strict";Object.defineProperty(PNe,"__esModule",{value:!0});PNe.parseMapDef=void 0;var cqr=fm(),SKo=ENe();function CKo(t,e){if(e.mapStrategy==="record")return(0,SKo.parseRecordDef)(t,e);let r=(0,cqr.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,cqr.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}}}PNe.parseMapDef=CKo});var Rdt=S(MNe=>{"use strict";Object.defineProperty(MNe,"__esModule",{value:!0});MNe.parseNativeEnumDef=void 0;function xKo(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}}MNe.parseNativeEnumDef=xKo});var Idt=S(RNe=>{"use strict";Object.defineProperty(RNe,"__esModule",{value:!0});RNe.parseNeverDef=void 0;function TKo(){return{not:{}}}RNe.parseNeverDef=TKo});var Adt=S(INe=>{"use strict";Object.defineProperty(INe,"__esModule",{value:!0});INe.parseNullDef=void 0;function OKo(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}INe.parseNullDef=OKo});var ANe=S(lB=>{"use strict";Object.defineProperty(lB,"__esModule",{value:!0});lB.parseUnionDef=lB.primitiveMappings=void 0;var EKo=fm();lB.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function PKo(t,e){if(e.target==="openApi3")return dqr(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in lB.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=lB.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 dqr(t,e)}lB.parseUnionDef=PKo;var dqr=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,EKo.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 Ndt=S(NNe=>{"use strict";Object.defineProperty(NNe,"__esModule",{value:!0});NNe.parseNullableDef=void 0;var fqr=fm(),pqr=ANe();function MKo(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:pqr.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[pqr.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,fqr.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,fqr.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}NNe.parseNullableDef=MKo});var Ddt=S(DNe=>{"use strict";Object.defineProperty(DNe,"__esModule",{value:!0});DNe.parseNumberDef=void 0;var cB=uB();function RKo(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,cB.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,cB.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,cB.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,cB.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,cB.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,cB.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,cB.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,cB.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}DNe.parseNumberDef=RKo});var $dt=S(jNe=>{"use strict";Object.defineProperty(jNe,"__esModule",{value:!0});jNe.parseObjectDef=void 0;var IKo=ae(),jdt=fm();function AKo(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,jdt.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,jdt.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function NKo(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 IKo.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,jdt.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:AKo(t,e)};return n.required.length||delete n.required,n}jNe.parseObjectDef=NKo});var Ldt=S($Ne=>{"use strict";Object.defineProperty($Ne,"__esModule",{value:!0});$Ne.parseOptionalDef=void 0;var mqr=fm(),DKo=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,mqr.parseDef)(t.innerType._def,e);let r=(0,mqr.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};$Ne.parseOptionalDef=DKo});var Fdt=S(FNe=>{"use strict";Object.defineProperty(FNe,"__esModule",{value:!0});FNe.parsePipelineDef=void 0;var LNe=fm(),jKo=(t,e)=>{if(e.pipeStrategy==="input")return(0,LNe.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,LNe.parseDef)(t.out._def,e);let r=(0,LNe.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,LNe.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};FNe.parsePipelineDef=jKo});var kdt=S(kNe=>{"use strict";Object.defineProperty(kNe,"__esModule",{value:!0});kNe.parsePromiseDef=void 0;var $Ko=fm();function LKo(t,e){return(0,$Ko.parseDef)(t.type._def,e)}kNe.parsePromiseDef=LKo});var qdt=S(qNe=>{"use strict";Object.defineProperty(qNe,"__esModule",{value:!0});qNe.parseSetDef=void 0;var hqr=uB(),FKo=fm();function kKo(t,e){let n={type:"array",uniqueItems:!0,items:(0,FKo.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,hqr.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,hqr.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}qNe.parseSetDef=kKo});var Udt=S(BNe=>{"use strict";Object.defineProperty(BNe,"__esModule",{value:!0});BNe.parseTupleDef=void 0;var Bdt=fm();function qKo(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,Bdt.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,Bdt.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,Bdt.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}BNe.parseTupleDef=qKo});var zdt=S(UNe=>{"use strict";Object.defineProperty(UNe,"__esModule",{value:!0});UNe.parseUndefinedDef=void 0;function BKo(){return{not:{}}}UNe.parseUndefinedDef=BKo});var Vdt=S(zNe=>{"use strict";Object.defineProperty(zNe,"__esModule",{value:!0});zNe.parseUnknownDef=void 0;function UKo(){return{}}zNe.parseUnknownDef=UKo});var Hdt=S(VNe=>{"use strict";Object.defineProperty(VNe,"__esModule",{value:!0});VNe.parseReadonlyDef=void 0;var zKo=fm(),VKo=(t,e)=>(0,zKo.parseDef)(t.innerType._def,e);VNe.parseReadonlyDef=VKo});var fm=S(HNe=>{"use strict";Object.defineProperty(HNe,"__esModule",{value:!0});HNe.parseDef=void 0;var Bi=ae(),HKo=gdt(),WKo=ydt(),JKo=bdt(),KKo=_dt(),GKo=yNe(),XKo=vdt(),ZKo=wdt(),YKo=Sdt(),QKo=Cdt(),e8o=xdt(),t8o=Tdt(),r8o=Odt(),n8o=Mdt(),o8o=Rdt(),i8o=Idt(),a8o=Adt(),s8o=Ndt(),u8o=Ddt(),l8o=$dt(),c8o=Ldt(),d8o=Fdt(),f8o=kdt(),p8o=ENe(),m8o=qdt(),h8o=TNe(),g8o=Udt(),y8o=zdt(),b8o=ANe(),_8o=Vdt(),v8o=Hdt(),w8o=lNe();function gqr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==w8o.ignoreOverride)return a}if(n&&!r){let a=S8o(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=x8o(t,t.typeName,e);return i&&T8o(t,e,i),o.jsonSchema=i,i}HNe.parseDef=gqr;var S8o=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:C8o(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}},C8o=(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("/")},x8o=(t,e,r)=>{switch(e){case Bi.ZodFirstPartyTypeKind.ZodString:return(0,h8o.parseStringDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodNumber:return(0,u8o.parseNumberDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodObject:return(0,l8o.parseObjectDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodBigInt:return(0,JKo.parseBigintDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodBoolean:return(0,KKo.parseBooleanDef)();case Bi.ZodFirstPartyTypeKind.ZodDate:return(0,ZKo.parseDateDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodUndefined:return(0,y8o.parseUndefinedDef)();case Bi.ZodFirstPartyTypeKind.ZodNull:return(0,a8o.parseNullDef)(r);case Bi.ZodFirstPartyTypeKind.ZodArray:return(0,WKo.parseArrayDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodUnion:case Bi.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,b8o.parseUnionDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodIntersection:return(0,t8o.parseIntersectionDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodTuple:return(0,g8o.parseTupleDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodRecord:return(0,p8o.parseRecordDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodLiteral:return(0,r8o.parseLiteralDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodEnum:return(0,e8o.parseEnumDef)(t);case Bi.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,o8o.parseNativeEnumDef)(t);case Bi.ZodFirstPartyTypeKind.ZodNullable:return(0,s8o.parseNullableDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodOptional:return(0,c8o.parseOptionalDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodMap:return(0,n8o.parseMapDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodSet:return(0,m8o.parseSetDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodLazy:return gqr(t.getter()._def,r);case Bi.ZodFirstPartyTypeKind.ZodPromise:return(0,f8o.parsePromiseDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodNaN:case Bi.ZodFirstPartyTypeKind.ZodNever:return(0,i8o.parseNeverDef)();case Bi.ZodFirstPartyTypeKind.ZodEffects:return(0,QKo.parseEffectsDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodAny:return(0,HKo.parseAnyDef)();case Bi.ZodFirstPartyTypeKind.ZodUnknown:return(0,_8o.parseUnknownDef)();case Bi.ZodFirstPartyTypeKind.ZodDefault:return(0,YKo.parseDefaultDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodBranded:return(0,GKo.parseBrandedDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodReadonly:return(0,v8o.parseReadonlyDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodCatch:return(0,XKo.parseCatchDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodPipeline:return(0,d8o.parsePipelineDef)(t,r);case Bi.ZodFirstPartyTypeKind.ZodFunction:case Bi.ZodFirstPartyTypeKind.ZodVoid:case Bi.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},T8o=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var Wdt=S(WNe=>{"use strict";Object.defineProperty(WNe,"__esModule",{value:!0});WNe.zodToJsonSchema=void 0;var yqr=fm(),O8o=hdt(),E8o=(t,e)=>{let r=(0,O8o.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:(0,yqr.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,yqr.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};WNe.zodToJsonSchema=E8o});var bqr=S(ti=>{"use strict";var P8o=ti&&ti.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xi=ti&&ti.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&P8o(e,t,r)};Object.defineProperty(ti,"__esModule",{value:!0});Xi(lNe(),ti);Xi(hdt(),ti);Xi(uB(),ti);Xi(fm(),ti);Xi(gdt(),ti);Xi(ydt(),ti);Xi(bdt(),ti);Xi(_dt(),ti);Xi(yNe(),ti);Xi(vdt(),ti);Xi(wdt(),ti);Xi(Sdt(),ti);Xi(Cdt(),ti);Xi(xdt(),ti);Xi(Tdt(),ti);Xi(Odt(),ti);Xi(Mdt(),ti);Xi(Rdt(),ti);Xi(Idt(),ti);Xi(Adt(),ti);Xi(Ndt(),ti);Xi(Ddt(),ti);Xi($dt(),ti);Xi(Ldt(),ti);Xi(Fdt(),ti);Xi(kdt(),ti);Xi(Hdt(),ti);Xi(ENe(),ti);Xi(qdt(),ti);Xi(TNe(),ti);Xi(Udt(),ti);Xi(zdt(),ti);Xi(ANe(),ti);Xi(Vdt(),ti);Xi(Wdt(),ti);var M8o=Wdt();ti.default=M8o.zodToJsonSchema});var vqr=S(hue=>{"use strict";Object.defineProperty(hue,"__esModule",{value:!0});hue.transformToChatCompletionRequest=I8o;hue.convertToParsedChatCompletionResponse=A8o;hue.responseFormatFromZodObject=_qr;var R8o=bqr();function I8o(t){let{responseFormat:e,...r}=t,n=_qr(e);return{...r,responseFormat:n}}function A8o(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 _qr(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,R8o.zodToJsonSchema)(t),strict:!0}}}});var Cqr=S(KNe=>{"use strict";Object.defineProperty(KNe,"__esModule",{value:!0});KNe.Chat=void 0;var wqr=eqr(),Sqr=nqr(),N8o=Vc(),JNe=Rd(),Jdt=vqr(),Kdt=class extends N8o.ClientSDK{async parse(e,r){let n=(0,Jdt.transformToChatCompletionRequest)(e),o=await(0,JNe.unwrapAsync)((0,wqr.chatComplete)(this,n,r));return(0,Jdt.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,Jdt.transformToChatCompletionRequest)(e);return(0,JNe.unwrapAsync)((0,Sqr.chatStream)(this,n,r))}async complete(e,r){return(0,JNe.unwrapAsync)((0,wqr.chatComplete)(this,e,r))}async stream(e,r){return(0,JNe.unwrapAsync)((0,Sqr.chatStream)(this,e,r))}};KNe.Chat=Kdt});var Oqr=S(Fj=>{"use strict";var D8o=Fj&&Fj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),j8o=Fj&&Fj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gdt=Fj&&Fj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&D8o(r,e,n[o]);return j8o(r,e),r}}();Object.defineProperty(Fj,"__esModule",{value:!0});Fj.classifiersClassify=U8o;var $8o=Tr(),gue=Gdt(br()),L8o=ce(),F8o=te(),xqr=_r(),k8o=mr(),Tqr=Gdt(zt()),q8o=Gdt(Qn()),B8o=vr();function U8o(t,e,r){return new B8o.APIPromise(z8o(t,e,r))}async function z8o(t,e,r){let n=(0,F8o.safeParse)(e,b=>Tqr.ClassificationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,$8o.encodeJSON)("body",o,{explode:!0}),a=(0,k8o.pathToFunc)("/v1/classifications")(),s=new Headers((0,L8o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,xqr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,xqr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"classifications_v1_classifications_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await gue.match(gue.json(200,Tqr.ClassificationResponse$inboundSchema),gue.jsonErr(422,q8o.HTTPValidationError$inboundSchema),gue.fail("4XX"),gue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var Mqr=S(kj=>{"use strict";var V8o=kj&&kj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),H8o=kj&&kj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xdt=kj&&kj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&V8o(r,e,n[o]);return H8o(r,e),r}}();Object.defineProperty(kj,"__esModule",{value:!0});kj.classifiersClassifyChat=Y8o;var W8o=Tr(),yue=Xdt(br()),J8o=ce(),K8o=te(),Eqr=_r(),G8o=mr(),Pqr=Xdt(zt()),X8o=Xdt(Qn()),Z8o=vr();function Y8o(t,e,r){return new Z8o.APIPromise(Q8o(t,e,r))}async function Q8o(t,e,r){let n=(0,K8o.safeParse)(e,b=>Pqr.ChatClassificationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,W8o.encodeJSON)("body",o,{explode:!0}),a=(0,G8o.pathToFunc)("/v1/chat/classifications")(),s=new Headers((0,J8o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,Eqr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Eqr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"chat_classifications_v1_chat_classifications_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await yue.match(yue.json(200,Pqr.ClassificationResponse$inboundSchema),yue.jsonErr(422,X8o.HTTPValidationError$inboundSchema),yue.fail("4XX"),yue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var Aqr=S(qj=>{"use strict";var eGo=qj&&qj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tGo=qj&&qj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zdt=qj&&qj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eGo(r,e,n[o]);return tGo(r,e),r}}();Object.defineProperty(qj,"__esModule",{value:!0});qj.classifiersModerate=uGo;var rGo=Tr(),bue=Zdt(br()),nGo=ce(),oGo=te(),Rqr=_r(),iGo=mr(),Iqr=Zdt(zt()),aGo=Zdt(Qn()),sGo=vr();function uGo(t,e,r){return new sGo.APIPromise(lGo(t,e,r))}async function lGo(t,e,r){let n=(0,oGo.safeParse)(e,b=>Iqr.ClassificationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,rGo.encodeJSON)("body",o,{explode:!0}),a=(0,iGo.pathToFunc)("/v1/moderations")(),s=new Headers((0,nGo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,Rqr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Rqr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await bue.match(bue.json(200,Iqr.ModerationResponse$inboundSchema),bue.jsonErr(422,aGo.HTTPValidationError$inboundSchema),bue.fail("4XX"),bue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var jqr=S(Bj=>{"use strict";var cGo=Bj&&Bj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dGo=Bj&&Bj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ydt=Bj&&Bj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cGo(r,e,n[o]);return dGo(r,e),r}}();Object.defineProperty(Bj,"__esModule",{value:!0});Bj.classifiersModerateChat=bGo;var fGo=Tr(),_ue=Ydt(br()),pGo=ce(),mGo=te(),Nqr=_r(),hGo=mr(),Dqr=Ydt(zt()),gGo=Ydt(Qn()),yGo=vr();function bGo(t,e,r){return new yGo.APIPromise(_Go(t,e,r))}async function _Go(t,e,r){let n=(0,mGo.safeParse)(e,b=>Dqr.ChatModerationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,fGo.encodeJSON)("body",o,{explode:!0}),a=(0,hGo.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,pGo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,Nqr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Nqr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"chat_moderations_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await _ue.match(_ue.json(200,Dqr.ModerationResponse$inboundSchema),_ue.jsonErr(422,gGo.HTTPValidationError$inboundSchema),_ue.fail("4XX"),_ue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var $qr=S(XNe=>{"use strict";Object.defineProperty(XNe,"__esModule",{value:!0});XNe.Classifiers=void 0;var vGo=Oqr(),wGo=Mqr(),SGo=Aqr(),CGo=jqr(),xGo=Vc(),GNe=Rd(),Qdt=class extends xGo.ClientSDK{async moderate(e,r){return(0,GNe.unwrapAsync)((0,SGo.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,GNe.unwrapAsync)((0,CGo.classifiersModerateChat)(this,e,r))}async classify(e,r){return(0,GNe.unwrapAsync)((0,vGo.classifiersClassify)(this,e,r))}async classifyChat(e,r){return(0,GNe.unwrapAsync)((0,wGo.classifiersClassifyChat)(this,e,r))}};XNe.Classifiers=Qdt});var kqr=S(Uj=>{"use strict";var TGo=Uj&&Uj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OGo=Uj&&Uj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eft=Uj&&Uj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TGo(r,e,n[o]);return OGo(r,e),r}}();Object.defineProperty(Uj,"__esModule",{value:!0});Uj.embeddingsCreate=NGo;var EGo=Tr(),vue=eft(br()),PGo=ce(),MGo=te(),Lqr=_r(),RGo=mr(),Fqr=eft(zt()),IGo=eft(Qn()),AGo=vr();function NGo(t,e,r){return new AGo.APIPromise(DGo(t,e,r))}async function DGo(t,e,r){let n=(0,MGo.safeParse)(e,b=>Fqr.EmbeddingRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,EGo.encodeJSON)("body",o,{explode:!0}),a=(0,RGo.pathToFunc)("/v1/embeddings")(),s=new Headers((0,PGo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,Lqr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Lqr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await vue.match(vue.json(200,Fqr.EmbeddingResponse$inboundSchema),vue.jsonErr(422,IGo.HTTPValidationError$inboundSchema),vue.fail("4XX"),vue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var qqr=S(ZNe=>{"use strict";Object.defineProperty(ZNe,"__esModule",{value:!0});ZNe.Embeddings=void 0;var jGo=kqr(),$Go=Vc(),LGo=Rd(),tft=class extends $Go.ClientSDK{async create(e,r){return(0,LGo.unwrapAsync)((0,jGo.embeddingsCreate)(this,e,r))}};ZNe.Embeddings=tft});var Uqr=S(zj=>{"use strict";var FGo=zj&&zj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kGo=zj&&zj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rft=zj&&zj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&FGo(r,e,n[o]);return kGo(r,e),r}}();Object.defineProperty(zj,"__esModule",{value:!0});zj.filesDelete=JGo;var qGo=Tr(),YNe=rft(br()),BGo=ce(),UGo=te(),Bqr=_r(),zGo=mr(),VGo=rft(zt()),HGo=rft(eo()),WGo=vr();function JGo(t,e,r){return new WGo.APIPromise(KGo(t,e,r))}async function KGo(t,e,r){let n=(0,UGo.safeParse)(e,b=>HGo.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,qGo.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,zGo.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,BGo.compactMap)({Accept:"application/json"})),l=await(0,Bqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Bqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await YNe.match(YNe.json(200,VGo.DeleteFileOut$inboundSchema),YNe.fail("4XX"),YNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var Vqr=S(Vj=>{"use strict";var GGo=Vj&&Vj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XGo=Vj&&Vj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nft=Vj&&Vj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&GGo(r,e,n[o]);return XGo(r,e),r}}();Object.defineProperty(Vj,"__esModule",{value:!0});Vj.filesDownload=o9o;var ZGo=nft(ae()),YGo=Tr(),QNe=nft(br()),QGo=ce(),e9o=te(),zqr=_r(),t9o=mr(),r9o=nft(eo()),n9o=vr();function o9o(t,e,r){return new n9o.APIPromise(i9o(t,e,r))}async function i9o(t,e,r){let n=(0,e9o.safeParse)(e,b=>r9o.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,YGo.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,t9o.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,QGo.compactMap)({Accept:"application/octet-stream"})),l=await(0,zqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,zqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await QNe.match(QNe.stream(200,ZGo.instanceof(ReadableStream)),QNe.fail("4XX"),QNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var Jqr=S(Hj=>{"use strict";var a9o=Hj&&Hj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s9o=Hj&&Hj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oft=Hj&&Hj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&a9o(r,e,n[o]);return s9o(r,e),r}}();Object.defineProperty(Hj,"__esModule",{value:!0});Hj.filesGetSignedUrl=m9o;var Hqr=Tr(),e1e=oft(br()),u9o=ce(),l9o=te(),Wqr=_r(),c9o=mr(),d9o=oft(zt()),f9o=oft(eo()),p9o=vr();function m9o(t,e,r){return new p9o.APIPromise(h9o(t,e,r))}async function h9o(t,e,r){let n=(0,l9o.safeParse)(e,_=>f9o.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,Hqr.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,c9o.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,Hqr.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,u9o.compactMap)({Accept:"application/json"})),c=await(0,Wqr.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,Wqr.resolveGlobalSecurity)(d),p={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!m.ok)return[m,{status:"invalid"}];let h=m.value,y=await t._do(h,{context:p,errorCodes:["4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!y.ok)return[y,{status:"request-error",request:h}];let g=y.value,[b]=await e1e.match(e1e.json(200,d9o.FileSignedURL$inboundSchema),e1e.fail("4XX"),e1e.fail("5XX"))(g,h);return b.ok?[b,{status:"complete",request:h,response:g}]:[b,{status:"complete",request:h,response:g}]}});var Gqr=S(Wj=>{"use strict";var g9o=Wj&&Wj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y9o=Wj&&Wj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ift=Wj&&Wj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&g9o(r,e,n[o]);return y9o(r,e),r}}();Object.defineProperty(Wj,"__esModule",{value:!0});Wj.filesList=T9o;var b9o=Tr(),t1e=ift(br()),_9o=ce(),v9o=te(),Kqr=_r(),w9o=mr(),S9o=ift(zt()),C9o=ift(eo()),x9o=vr();function T9o(t,e,r){return new x9o.APIPromise(O9o(t,e,r))}async function O9o(t,e,r){let n=(0,v9o.safeParse)(e,b=>C9o.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,w9o.pathToFunc)("/v1/files")(),s=(0,b9o.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,_9o.compactMap)({Accept:"application/json"})),l=await(0,Kqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Kqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await t1e.match(t1e.json(200,S9o.ListFilesOut$inboundSchema),t1e.fail("4XX"),t1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var Zqr=S(Jj=>{"use strict";var E9o=Jj&&Jj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),P9o=Jj&&Jj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aft=Jj&&Jj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&E9o(r,e,n[o]);return P9o(r,e),r}}();Object.defineProperty(Jj,"__esModule",{value:!0});Jj.filesRetrieve=$9o;var M9o=Tr(),r1e=aft(br()),R9o=ce(),I9o=te(),Xqr=_r(),A9o=mr(),N9o=aft(zt()),D9o=aft(eo()),j9o=vr();function $9o(t,e,r){return new j9o.APIPromise(L9o(t,e,r))}async function L9o(t,e,r){let n=(0,I9o.safeParse)(e,b=>D9o.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,M9o.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,A9o.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,R9o.compactMap)({Accept:"application/json"})),l=await(0,Xqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Xqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await r1e.match(r1e.json(200,N9o.RetrieveFileOut$inboundSchema),r1e.fail("4XX"),r1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var Qqr=S(Kj=>{"use strict";var F9o=Kj&&Kj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),k9o=Kj&&Kj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uft=Kj&&Kj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&F9o(r,e,n[o]);return k9o(r,e),r}}();Object.defineProperty(Kj,"__esModule",{value:!0});Kj.filesUpload=K9o;var n1e=Tr(),sft=k9(),o1e=uft(br()),q9o=ce(),B9o=te(),Yqr=_r(),U9o=mr(),z9o=uft(zt()),V9o=uft(eo()),H9o=vr(),W9o=HD(),J9o=Pse();function K9o(t,e,r){return new H9o.APIPromise(G9o(t,e,r))}async function G9o(t,e,r){let n=(0,B9o.safeParse)(e,g=>V9o.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,W9o.isBlobLike)(o.file))(0,n1e.appendForm)(i,"file",o.file);else if((0,J9o.isReadableStream)(o.file.content)){let g=await(0,sft.readableStreamToArrayBuffer)(o.file.content),b=(0,sft.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream",_=new Blob([g],{type:b});(0,n1e.appendForm)(i,"file",_,o.file.fileName)}else{let g=(0,sft.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream";(0,n1e.appendForm)(i,"file",new Blob([o.file.content],{type:g}),o.file.fileName)}o.purpose!==void 0&&(0,n1e.appendForm)(i,"purpose",o.purpose);let a=(0,U9o.pathToFunc)("/v1/files")(),s=new Headers((0,q9o.compactMap)({Accept:"application/json"})),u=await(0,Yqr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Yqr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,[y]=await o1e.match(o1e.json(200,z9o.UploadFileOut$inboundSchema),o1e.fail("4XX"),o1e.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var eBr=S(i1e=>{"use strict";Object.defineProperty(i1e,"__esModule",{value:!0});i1e.Files=void 0;var X9o=Uqr(),Z9o=Vqr(),Y9o=Jqr(),Q9o=Gqr(),e7o=Zqr(),t7o=Qqr(),r7o=Vc(),N7=Rd(),lft=class extends r7o.ClientSDK{async upload(e,r){return(0,N7.unwrapAsync)((0,t7o.filesUpload)(this,e,r))}async list(e,r){return(0,N7.unwrapAsync)((0,Q9o.filesList)(this,e,r))}async retrieve(e,r){return(0,N7.unwrapAsync)((0,e7o.filesRetrieve)(this,e,r))}async delete(e,r){return(0,N7.unwrapAsync)((0,X9o.filesDelete)(this,e,r))}async download(e,r){return(0,N7.unwrapAsync)((0,Z9o.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,N7.unwrapAsync)((0,Y9o.filesGetSignedUrl)(this,e,r))}};i1e.Files=lft});var nBr=S(Gj=>{"use strict";var n7o=Gj&&Gj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o7o=Gj&&Gj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cft=Gj&&Gj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&n7o(r,e,n[o]);return o7o(r,e),r}}();Object.defineProperty(Gj,"__esModule",{value:!0});Gj.fimComplete=d7o;var i7o=Tr(),wue=cft(br()),a7o=ce(),s7o=te(),tBr=_r(),u7o=mr(),rBr=cft(zt()),l7o=cft(Qn()),c7o=vr();function d7o(t,e,r){return new c7o.APIPromise(f7o(t,e,r))}async function f7o(t,e,r){let n=(0,s7o.safeParse)(e,b=>rBr.FIMCompletionRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,i7o.encodeJSON)("body",o,{explode:!0}),a=(0,u7o.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,a7o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,tBr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,tBr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await wue.match(wue.json(200,rBr.FIMCompletionResponse$inboundSchema),wue.jsonErr(422,l7o.HTTPValidationError$inboundSchema),wue.fail("4XX"),wue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var aBr=S(Xj=>{"use strict";var p7o=Xj&&Xj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m7o=Xj&&Xj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a1e=Xj&&Xj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&p7o(r,e,n[o]);return m7o(r,e),r}}();Object.defineProperty(Xj,"__esModule",{value:!0});Xj.fimStream=C7o;var h7o=a1e(ae()),g7o=Tr(),y7o=iB(),Sue=a1e(br()),b7o=ce(),_7o=te(),oBr=_r(),v7o=mr(),iBr=a1e(zt()),w7o=a1e(Qn()),S7o=vr();function C7o(t,e,r){return new S7o.APIPromise(x7o(t,e,r))}async function x7o(t,e,r){let n=(0,_7o.safeParse)(e,b=>iBr.FIMCompletionStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,g7o.encodeJSON)("body",o,{explode:!0}),a=(0,v7o.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,b7o.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,oBr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,oBr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Sue.match(Sue.sse(200,h7o.instanceof(ReadableStream).transform(b=>new y7o.EventStream(b,_=>_.data==="[DONE]"?{done:!0}:{value:iBr.CompletionEvent$inboundSchema.parse(_)}))),Sue.jsonErr(422,w7o.HTTPValidationError$inboundSchema),Sue.fail("4XX"),Sue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var uBr=S(s1e=>{"use strict";Object.defineProperty(s1e,"__esModule",{value:!0});s1e.Fim=void 0;var T7o=nBr(),O7o=aBr(),E7o=Vc(),sBr=Rd(),dft=class extends E7o.ClientSDK{async complete(e,r){return(0,sBr.unwrapAsync)((0,T7o.fimComplete)(this,e,r))}async stream(e,r){return(0,sBr.unwrapAsync)((0,O7o.fimStream)(this,e,r))}};s1e.Fim=dft});var fBr=S(Zj=>{"use strict";var P7o=Zj&&Zj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M7o=Zj&&Zj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dBr=Zj&&Zj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&P7o(r,e,n[o]);return M7o(r,e),r}}();Object.defineProperty(Zj,"__esModule",{value:!0});Zj.fineTuningJobsCancel=j7o;var R7o=Tr(),u1e=dBr(br()),I7o=ce(),A7o=te(),lBr=_r(),N7o=mr(),cBr=dBr(eo()),D7o=vr();function j7o(t,e,r){return new D7o.APIPromise($7o(t,e,r))}async function $7o(t,e,r){let n=(0,A7o.safeParse)(e,b=>cBr.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,R7o.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,N7o.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,I7o.compactMap)({Accept:"application/json"})),l=await(0,lBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,lBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await u1e.match(u1e.json(200,cBr.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema),u1e.fail("4XX"),u1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var mBr=S(Yj=>{"use strict";var L7o=Yj&&Yj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F7o=Yj&&Yj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fft=Yj&&Yj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&L7o(r,e,n[o]);return F7o(r,e),r}}();Object.defineProperty(Yj,"__esModule",{value:!0});Yj.fineTuningJobsCreate=W7o;var k7o=Tr(),l1e=fft(br()),q7o=ce(),B7o=te(),pBr=_r(),U7o=mr(),z7o=fft(zt()),V7o=fft(eo()),H7o=vr();function W7o(t,e,r){return new H7o.APIPromise(J7o(t,e,r))}async function J7o(t,e,r){let n=(0,B7o.safeParse)(e,g=>z7o.JobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,k7o.encodeJSON)("body",o,{explode:!0}),a=(0,U7o.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,q7o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,pBr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,pBr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,[y]=await l1e.match(l1e.json(200,V7o.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),l1e.fail("4XX"),l1e.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var bBr=S(Qj=>{"use strict";var K7o=Qj&&Qj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),G7o=Qj&&Qj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yBr=Qj&&Qj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&K7o(r,e,n[o]);return G7o(r,e),r}}();Object.defineProperty(Qj,"__esModule",{value:!0});Qj.fineTuningJobsGet=tXo;var X7o=Tr(),c1e=yBr(br()),Z7o=ce(),Y7o=te(),hBr=_r(),Q7o=mr(),gBr=yBr(eo()),eXo=vr();function tXo(t,e,r){return new eXo.APIPromise(rXo(t,e,r))}async function rXo(t,e,r){let n=(0,Y7o.safeParse)(e,b=>gBr.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,X7o.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Q7o.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,Z7o.compactMap)({Accept:"application/json"})),l=await(0,hBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,hBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await c1e.match(c1e.json(200,gBr.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema),c1e.fail("4XX"),c1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var vBr=S(e$=>{"use strict";var nXo=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]}),oXo=e$&&e$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pft=e$&&e$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nXo(r,e,n[o]);return oXo(r,e),r}}();Object.defineProperty(e$,"__esModule",{value:!0});e$.fineTuningJobsList=fXo;var iXo=Tr(),d1e=pft(br()),aXo=ce(),sXo=te(),_Br=_r(),uXo=mr(),lXo=pft(zt()),cXo=pft(eo()),dXo=vr();function fXo(t,e,r){return new dXo.APIPromise(pXo(t,e,r))}async function pXo(t,e,r){let n=(0,sXo.safeParse)(e,b=>cXo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,uXo.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,iXo.encodeFormQuery)({created_after:o?.created_after,created_before:o?.created_before,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,aXo.compactMap)({Accept:"application/json"})),l=await(0,_Br.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,_Br.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await d1e.match(d1e.json(200,lXo.JobsOut$inboundSchema),d1e.fail("4XX"),d1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var xBr=S(t$=>{"use strict";var mXo=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]}),hXo=t$&&t$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CBr=t$&&t$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mXo(r,e,n[o]);return hXo(r,e),r}}();Object.defineProperty(t$,"__esModule",{value:!0});t$.fineTuningJobsStart=wXo;var gXo=Tr(),f1e=CBr(br()),yXo=ce(),bXo=te(),wBr=_r(),_Xo=mr(),SBr=CBr(eo()),vXo=vr();function wXo(t,e,r){return new vXo.APIPromise(SXo(t,e,r))}async function SXo(t,e,r){let n=(0,bXo.safeParse)(e,b=>SBr.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,gXo.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,_Xo.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,yXo.compactMap)({Accept:"application/json"})),l=await(0,wBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,wBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await f1e.match(f1e.json(200,SBr.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema),f1e.fail("4XX"),f1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var TBr=S(p1e=>{"use strict";Object.defineProperty(p1e,"__esModule",{value:!0});p1e.Jobs=void 0;var CXo=fBr(),xXo=mBr(),TXo=bBr(),OXo=vBr(),EXo=xBr(),PXo=Vc(),Cue=Rd(),mft=class extends PXo.ClientSDK{async list(e,r){return(0,Cue.unwrapAsync)((0,OXo.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,Cue.unwrapAsync)((0,xXo.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,Cue.unwrapAsync)((0,TXo.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,Cue.unwrapAsync)((0,CXo.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,Cue.unwrapAsync)((0,EXo.fineTuningJobsStart)(this,e,r))}};p1e.Jobs=mft});var OBr=S(m1e=>{"use strict";Object.defineProperty(m1e,"__esModule",{value:!0});m1e.FineTuning=void 0;var MXo=Vc(),RXo=TBr(),hft=class extends MXo.ClientSDK{get jobs(){return this._jobs??(this._jobs=new RXo.Jobs(this._options))}};m1e.FineTuning=hft});var PBr=S(r$=>{"use strict";var IXo=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]}),AXo=r$&&r$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gft=r$&&r$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IXo(r,e,n[o]);return AXo(r,e),r}}();Object.defineProperty(r$,"__esModule",{value:!0});r$.modelsArchive=qXo;var NXo=Tr(),h1e=gft(br()),DXo=ce(),jXo=te(),EBr=_r(),$Xo=mr(),LXo=gft(zt()),FXo=gft(eo()),kXo=vr();function qXo(t,e,r){return new kXo.APIPromise(BXo(t,e,r))}async function BXo(t,e,r){let n=(0,jXo.safeParse)(e,b=>FXo.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,NXo.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,$Xo.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,DXo.compactMap)({Accept:"application/json"})),l=await(0,EBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,EBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await h1e.match(h1e.json(200,LXo.ArchiveFTModelOut$inboundSchema),h1e.fail("4XX"),h1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var RBr=S(n$=>{"use strict";var UXo=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]}),zXo=n$&&n$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g1e=n$&&n$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&UXo(r,e,n[o]);return zXo(r,e),r}}();Object.defineProperty(n$,"__esModule",{value:!0});n$.modelsDelete=YXo;var VXo=Tr(),xue=g1e(br()),HXo=ce(),WXo=te(),MBr=_r(),JXo=mr(),KXo=g1e(zt()),GXo=g1e(Qn()),XXo=g1e(eo()),ZXo=vr();function YXo(t,e,r){return new ZXo.APIPromise(QXo(t,e,r))}async function QXo(t,e,r){let n=(0,WXo.safeParse)(e,_=>XXo.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,VXo.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,JXo.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,HXo.compactMap)({Accept:"application/json"})),l=await(0,MBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,MBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await xue.match(xue.json(200,KXo.DeleteModelOut$inboundSchema),xue.jsonErr(422,GXo.HTTPValidationError$inboundSchema),xue.fail("4XX"),xue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var ABr=S(o$=>{"use strict";var eZo=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]}),tZo=o$&&o$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yft=o$&&o$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eZo(r,e,n[o]);return tZo(r,e),r}}();Object.defineProperty(o$,"__esModule",{value:!0});o$.modelsList=sZo;var Tue=yft(br()),rZo=ce(),IBr=_r(),nZo=mr(),oZo=yft(zt()),iZo=yft(Qn()),aZo=vr();function sZo(t,e){return new aZo.APIPromise(uZo(t,e))}async function uZo(t,e){let r=(0,nZo.pathToFunc)("/v1/models")(),n=new Headers((0,rZo.compactMap)({Accept:"application/json"})),o=await(0,IBr.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,IBr.resolveGlobalSecurity)(i),s={options:t._options,baseURL:e?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:e?.timeoutMs||t._options.timeoutMs||-1},e);if(!u.ok)return[u,{status:"invalid"}];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,{status:"request-error",request:l}];let d=c.value,f={HttpMeta:{Response:d,Request:l}},[p]=await Tue.match(Tue.json(200,oZo.ModelList$inboundSchema),Tue.jsonErr(422,iZo.HTTPValidationError$inboundSchema),Tue.fail("4XX"),Tue.fail("5XX"))(d,l,{extraFields:f});return p.ok?[p,{status:"complete",request:l,response:d}]:[p,{status:"complete",request:l,response:d}]}});var jBr=S(i$=>{"use strict";var lZo=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]}),cZo=i$&&i$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bft=i$&&i$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&lZo(r,e,n[o]);return cZo(r,e),r}}();Object.defineProperty(i$,"__esModule",{value:!0});i$.modelsRetrieve=yZo;var dZo=Tr(),Oue=bft(br()),fZo=ce(),pZo=te(),NBr=_r(),mZo=mr(),hZo=bft(Qn()),DBr=bft(eo()),gZo=vr();function yZo(t,e,r){return new gZo.APIPromise(bZo(t,e,r))}async function bZo(t,e,r){let n=(0,pZo.safeParse)(e,_=>DBr.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,dZo.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,mZo.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,fZo.compactMap)({Accept:"application/json"})),l=await(0,NBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,NBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Oue.match(Oue.json(200,DBr.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),Oue.jsonErr(422,hZo.HTTPValidationError$inboundSchema),Oue.fail("4XX"),Oue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var LBr=S(a$=>{"use strict";var _Zo=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]}),vZo=a$&&a$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_ft=a$&&a$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Zo(r,e,n[o]);return vZo(r,e),r}}();Object.defineProperty(a$,"__esModule",{value:!0});a$.modelsUnarchive=PZo;var wZo=Tr(),y1e=_ft(br()),SZo=ce(),CZo=te(),$Br=_r(),xZo=mr(),TZo=_ft(zt()),OZo=_ft(eo()),EZo=vr();function PZo(t,e,r){return new EZo.APIPromise(MZo(t,e,r))}async function MZo(t,e,r){let n=(0,CZo.safeParse)(e,b=>OZo.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,wZo.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,xZo.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,SZo.compactMap)({Accept:"application/json"})),l=await(0,$Br.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,$Br.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await y1e.match(y1e.json(200,TZo.UnarchiveFTModelOut$inboundSchema),y1e.fail("4XX"),y1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var UBr=S(s$=>{"use strict";var RZo=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]}),IZo=s$&&s$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BBr=s$&&s$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&RZo(r,e,n[o]);return IZo(r,e),r}}();Object.defineProperty(s$,"__esModule",{value:!0});s$.modelsUpdate=$Zo;var FBr=Tr(),b1e=BBr(br()),AZo=ce(),NZo=te(),kBr=_r(),DZo=mr(),qBr=BBr(eo()),jZo=vr();function $Zo(t,e,r){return new jZo.APIPromise(LZo(t,e,r))}async function LZo(t,e,r){let n=(0,NZo.safeParse)(e,b=>qBr.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,FBr.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,FBr.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,DZo.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,AZo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,kBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,kBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await b1e.match(b1e.json(200,qBr.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema),b1e.fail("4XX"),b1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var zBr=S(_1e=>{"use strict";Object.defineProperty(_1e,"__esModule",{value:!0});_1e.Models=void 0;var FZo=PBr(),kZo=RBr(),qZo=ABr(),BZo=jBr(),UZo=LBr(),zZo=UBr(),VZo=Vc(),D7=Rd(),vft=class extends VZo.ClientSDK{async list(e){return(0,D7.unwrapAsync)((0,qZo.modelsList)(this,e))}async retrieve(e,r){return(0,D7.unwrapAsync)((0,BZo.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,D7.unwrapAsync)((0,kZo.modelsDelete)(this,e,r))}async update(e,r){return(0,D7.unwrapAsync)((0,zZo.modelsUpdate)(this,e,r))}async archive(e,r){return(0,D7.unwrapAsync)((0,FZo.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,D7.unwrapAsync)((0,UZo.modelsUnarchive)(this,e,r))}};_1e.Models=vft});var WBr=S(u$=>{"use strict";var HZo=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]}),WZo=u$&&u$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wft=u$&&u$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&HZo(r,e,n[o]);return WZo(r,e),r}}();Object.defineProperty(u$,"__esModule",{value:!0});u$.ocrProcess=QZo;var JZo=Tr(),Eue=wft(br()),KZo=ce(),GZo=te(),VBr=_r(),XZo=mr(),HBr=wft(zt()),ZZo=wft(Qn()),YZo=vr();function QZo(t,e,r){return new YZo.APIPromise(eYo(t,e,r))}async function eYo(t,e,r){let n=(0,GZo.safeParse)(e,b=>HBr.OCRRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,JZo.encodeJSON)("body",o,{explode:!0}),a=(0,XZo.pathToFunc)("/v1/ocr")(),s=new Headers((0,KZo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,VBr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,VBr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"ocr_v1_ocr_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Eue.match(Eue.json(200,HBr.OCRResponse$inboundSchema),Eue.jsonErr(422,ZZo.HTTPValidationError$inboundSchema),Eue.fail("4XX"),Eue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var JBr=S(v1e=>{"use strict";Object.defineProperty(v1e,"__esModule",{value:!0});v1e.Ocr=void 0;var tYo=WBr(),rYo=Vc(),nYo=Rd(),Sft=class extends rYo.ClientSDK{async process(e,r){return(0,nYo.unwrapAsync)((0,tYo.ocrProcess)(this,e,r))}};v1e.Ocr=Sft});var KBr=S(w1e=>{"use strict";Object.defineProperty(w1e,"__esModule",{value:!0});w1e.Mistral=void 0;var oYo=Vc(),iYo=fDr(),aYo=SDr(),sYo=lFr(),uYo=Zkr(),lYo=Cqr(),cYo=$qr(),dYo=qqr(),fYo=eBr(),pYo=uBr(),mYo=OBr(),hYo=zBr(),gYo=JBr(),Cft=class extends oYo.ClientSDK{get models(){return this._models??(this._models=new hYo.Models(this._options))}get beta(){return this._beta??(this._beta=new uYo.Beta(this._options))}get files(){return this._files??(this._files=new fYo.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new mYo.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new sYo.Batch(this._options))}get chat(){return this._chat??(this._chat=new lYo.Chat(this._options))}get fim(){return this._fim??(this._fim=new pYo.Fim(this._options))}get agents(){return this._agents??(this._agents=new iYo.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new dYo.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new cYo.Classifiers(this._options))}get ocr(){return this._ocr??(this._ocr=new gYo.Ocr(this._options))}get audio(){return this._audio??(this._audio=new aYo.Audio(this._options))}};w1e.Mistral=Cft});var ZBr=S(eb=>{"use strict";var GBr=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]}),yYo=eb&&eb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XBr=eb&&eb.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&GBr(e,t,r)},bYo=eb&&eb.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&GBr(r,e,n[o]);return yYo(r,e),r}}();Object.defineProperty(eb,"__esModule",{value:!0});eb.HTTPClient=eb.files=void 0;XBr(vPe(),eb);eb.files=bYo(k9());var _Yo=q9();Object.defineProperty(eb,"HTTPClient",{enumerable:!0,get:function(){return _Yo.HTTPClient}});XBr(KBr(),eb)});function xft(t){let e=i=>{switch(i){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: ${i}`)}},r=(i,a)=>{let s=(u,l)=>{if(u.type==="image_url"&&(l==="user"||l==="assistant"))return{type:u.type,imageUrl:u?.image_url};if(u.type==="text")return{type:u.type,text:u?.text};throw new Error(`ChatMistralAI only supports messages of "image_url" for roles "user" and "assistant", and "text" for all others.

Received: ${JSON.stringify(i,null,2)}`)};if(typeof i=="string")return i;if(Array.isArray(i)){let u=e(a),l=[];return i.forEach(c=>{if(c.type==="text"||c.type==="image_url")l.push(s(c,u));else throw new Error('Mistral only supports types "text" or "image_url" for complex message types.')}),l}throw new Error(`Message content must be a string or an array.

Received: ${JSON.stringify(i,null,2)}`)},n=i=>{if(mc(i)&&i.tool_calls?.length)return i.tool_calls.map(a=>({...a,id:Zae(a.id??"")})).map(bV)},o=new Set;for(let i of t)"tool_call_id"in i&&typeof i.tool_call_id=="string"&&o.add(Zae(i.tool_call_id));return t.flatMap(i=>{let a=n(i),s=r(i.content,i.getType());if("tool_call_id"in i&&typeof i.tool_call_id=="string")return[{role:e(i.getType()),content:s,name:i.name,toolCallId:Zae(i.tool_call_id)}];if(mc(i)){if(a===void 0)return[{role:e(i.getType()),content:s}];{let u=a.filter(l=>o.has(Zae(l.id??"")));return u.length===0?typeof s=="string"&&s.trim()===""||Array.isArray(s)&&s.length===0?[]:[{role:e(i.getType()),content:s}]:[{role:e(i.getType()),toolCalls:u}]}}return[{role:e(i.getType()),content:s}]})}function vYo(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=Iut(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=HI(s,{returnId:!0});i.push({...u,id:u.id??_Pe().replace(/-/g,"")})}catch(u){a.push(vx(s,u.message))}return new uo({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 Au({content:o})}}function wYo(t,e){if(!t.content&&!t.toolCalls)return e?new Hr({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??_Pe().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=Iut(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 BT({content:o}):n==="assistant"?new Hr({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 $L({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new qT({content:o,additional_kwargs:i}):new kT({content:o,role:n})}function YBr(t){if(!(!t||!t.length))return t.map(e=>{if("function"in e)return{type:e.type??"function",function:e.function};if(zb(e)){let r=e.description??`Tool: ${e.name}`;return{type:"function",function:{name:e.name,description:r,parameters:Hi(e.schema)?Ii(e.schema):e.schema}}}throw new Error(`Unknown tool type passed to ChatMistral: ${JSON.stringify(e,null,2)}`)})}var QBr,eUr,Tft,tUr=v(()=>{Swr();Pwr();QBr=$(ZBr(),1),eUr=$(q9(),1);ra();aD();xm();Iz();su();nO();_V();Qv();Sy();iD();nv();Tft=class extends Vy{constructor(e){super(e??{});x(this,"lc_namespace",["langchain","chat_models","mistralai"]);x(this,"model","mistral-small-latest");x(this,"apiKey");x(this,"endpoint");x(this,"serverURL");x(this,"temperature",.7);x(this,"streaming",!1);x(this,"topP",1);x(this,"maxTokens");x(this,"safeMode",!1);x(this,"safePrompt",!1);x(this,"randomSeed");x(this,"seed");x(this,"maxRetries");x(this,"lc_serializable",!0);x(this,"streamUsage",!0);x(this,"beforeRequestHooks");x(this,"requestErrorHooks");x(this,"responseHooks");x(this,"httpClient");x(this,"presencePenalty");x(this,"frequencyPenalty");x(this,"numCompletions");let r=e?.apiKey??un("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()}static lc_name(){return"ChatMistralAI"}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?YBr(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){let n=YBr(e);return new ZN({bound:this,kwargs:{...r??{},tools:n},config:{}})}async completionWithRetry(e,r){let n=new IC({maxRetries:this.maxRetries}),o=new QBr.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=xft(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 b=g.generationInfo?.completion??0;h[b]===void 0?h[b]=g:h[b]=h[b].concat(g)}return{generations:Object.entries(h).sort(([g],[b])=>parseInt(g,10)-parseInt(b,10)).map(([g,b])=>b),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 y={text:h,message:vYo(m,l?.usage)};m.finishReason&&(y.generationInfo={finishReason:m.finishReason}),p.push(y)}return{generations:p,llmOutput:{tokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=xft(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=wYo(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 Mi({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 eUr.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"){let f;Hi(n)?(u=jC.fromZodSchema(n),f=Ii(n)):u=new ew,s=this.withConfig({response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"jsonMode"},schema:f}})}else{let f=o??"extract";if(Hi(n)){let p=Ii(n);s=this.bindTools([{type:"function",function:{name:f,description:p.description,parameters:p}}]).withConfig({tool_choice:"any",ls_structured_output_format:{kwargs:{method:"functionCalling"},schema:p}}),u=new Ow({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.bindTools([{type:"function",function:p}]).withConfig({tool_choice:"any"}),u=new Ow({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=pl.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=pl.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return gc.from([{raw:s},d])}}});var rUr=v(()=>{su();lV();Ik()});var nUr=v(()=>{xm();Iz();su();Ik();rie()});var oUr=v(()=>{tUr();rUr();nUr()});var Oft,iUr=v(()=>{su();CD();Oft=class extends iA{constructor(e){let r=e?.apiKey||un("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"}});x(this,"lc_serializable",!0);x(this,"lc_namespace",["langchain","chat_models","xai"])}static lc_name(){return"ChatXAI"}_llmType(){return"xai"}get lc_secrets(){return{apiKey:"XAI_API_KEY"}}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)}_convertCompletionsDeltaToBaseMessageChunk(e,r,n){let o=super._convertCompletionsDeltaToBaseMessageChunk(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}_convertCompletionsMessageToBaseMessage(e,r){let n=super._convertCompletionsMessageToBaseMessage(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 aUr=v(()=>{iUr()});var S1e,C1e,sUr,Eft=v(()=>{S1e="RFC3986",C1e={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},sUr="RFC1738"});function lUr(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function Mft(t,e){if(SYo(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var SYo,zA,Pft,uUr,cUr=v(()=>{Eft();SYo=Array.isArray,zA=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),Pft=1024,uUr=(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+=Pft){let u=i.length>=Pft?i.slice(s,s+Pft):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===sUr&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=zA[d];continue}if(d<2048){l[l.length]=zA[192|d>>6]+zA[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=zA[224|d>>12]+zA[128|d>>6&63]+zA[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=zA[240|d>>18]+zA[128|d>>12&63]+zA[128|d>>6&63]+zA[128|d&63]}a+=l.join("")}return a}});function OYo(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function pUr(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,y,g){let b=t,_=g,w=0,T=!1;for(;(_=_.get(Rft))!==void 0&&!T;){let I=_.get(t);if(w+=1,typeof I<"u"){if(I===w)throw new RangeError("Cyclic object value");T=!0}typeof _.get(Rft)>"u"&&(w=0)}if(typeof l=="function"?b=l(e,b):b instanceof Date?b=f?.(b):r==="comma"&&VA(b)&&(b=Mft(b,function(I){return I instanceof Date?f?.(I):I})),b===null){if(i)return u&&!h?u(e,Wm.encoder,y,"key",p):e;b=""}if(OYo(b)||lUr(b)){if(u){let I=h?e:u(e,Wm.encoder,y,"key",p);return[m?.(I)+"="+m?.(u(b,Wm.encoder,y,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let O=[];if(typeof b>"u")return O;let E;if(r==="comma"&&VA(b))h&&u&&(b=Mft(b,u)),E=[{value:b.length>0?b.join(",")||null:void 0}];else if(VA(l))E=l;else{let I=Object.keys(b);E=c?I.sort(c):I}let P=s?String(e).replace(/\./g,"%2E"):String(e),R=n&&VA(b)&&b.length===1?P+"[]":P;if(o&&VA(b)&&b.length===0)return R+"[]";for(let I=0;I<E.length;++I){let A=E[I],B=typeof A=="object"&&typeof A.value<"u"?A.value:b[A];if(a&&B===null)continue;let k=d&&s?A.replace(/\./g,"%2E"):A,q=VA(b)?typeof r=="function"?r(R,k):R:R+(d?"."+k:"["+k+"]");g.set(t,w);let Z=new WeakMap;Z.set(Rft,g),fUr(O,pUr(B,q,r,n,o,i,a,s,r==="comma"&&h&&VA(b)?null:u,l,c,d,f,p,m,h,y,Z))}return O}function EYo(t=Wm){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||Wm.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=S1e;if(typeof t.format<"u"){if(!CYo.call(C1e,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=C1e[r],o=Wm.filter;(typeof t.filter=="function"||VA(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in dUr?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=Wm.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:Wm.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Wm.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Wm.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Wm.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Wm.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Wm.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Wm.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Wm.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Wm.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Wm.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Wm.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Wm.strictNullHandling}}function Ift(t,e={}){let r=t,n=EYo(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):VA(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=dUr[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||fUr(a,pUr(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 CYo,dUr,VA,xYo,fUr,TYo,Wm,Rft,mUr=v(()=>{cUr();Eft();CYo=Object.prototype.hasOwnProperty,dUr={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},VA=Array.isArray,xYo=Array.prototype.push,fUr=function(t,e){xYo.apply(t,VA(e)?e:[e])},TYo=Date.prototype.toISOString,Wm={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:uUr,encodeValuesOnly:!1,format:S1e,formatter:C1e[S1e],indices:!1,serializeDate(t){return TYo.call(t)},skipNulls:!1,strictNullHandling:!1};Rft={}});var hUr=v(()=>{mUr()});var mW,gUr=v(()=>{mW="4.95.1"});function bUr(t,e={auto:!1}){if(yUr)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(hW)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${hW}'\``);yUr=e.auto,hW=t.kind,Aft=t.fetch,MYo=t.Request,RYo=t.Response,IYo=t.Headers,Nft=t.FormData,AYo=t.Blob,x1e=t.File,Dft=t.ReadableStream,jft=t.getMultipartRequestOptions,$ft=t.getDefaultAgent,T1e=t.fileFromPath,Lft=t.isFsReadStream}var yUr,hW,Aft,MYo,RYo,IYo,Nft,AYo,x1e,Dft,jft,$ft,T1e,Lft,Fft=v(()=>{yUr=!1});var O1e,_Ur=v(()=>{O1e=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function vUr({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 O1e(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 wUr=v(()=>{_Ur()});var SUr=v(()=>{wUr()});var kft,Pue=v(()=>{Fft();SUr();Fft();kft=()=>{hW||bUr(vUr(),{auto:!0})};kft()});var Lr,Jm,pm,dB,fB,Mue,Rue,Iue,Aue,Nue,Due,jue,$ue,j7,$7,Bw=v(()=>{Zi();Lr=class extends Error{},Jm=class t extends Lr{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 dB({message:n,cause:E1e(r)});let i=r?.error;return e===400?new Mue(e,i,n,o):e===401?new Rue(e,i,n,o):e===403?new Iue(e,i,n,o):e===404?new Aue(e,i,n,o):e===409?new Nue(e,i,n,o):e===422?new Due(e,i,n,o):e===429?new jue(e,i,n,o):e>=500?new $ue(e,i,n,o):new t(e,i,n,o)}},pm=class extends Jm{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},dB=class extends Jm{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},fB=class extends dB{constructor({message:e}={}){super({message:e??"Request timed out."})}},Mue=class extends Jm{},Rue=class extends Jm{},Iue=class extends Jm{},Aue=class extends Jm{},Nue=class extends Jm{},Due=class extends Jm{},jue=class extends Jm{},$ue=class extends Jm{},j7=class extends Lr{constructor(){super("Could not parse response content as the length limit was reached")}},$7=class extends Lr{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}});function $Yo(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 CUr(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var P1e,gW,Uw,yW,xUr=v(()=>{Bw();P1e=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},gW=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)},yW=class{constructor(){Uw.set(this,void 0),this.buffer=new Uint8Array,P1e(this,Uw,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=$Yo(this.buffer,gW(this,Uw,"f")))!=null;){if(i.carriage&&gW(this,Uw,"f")==null){P1e(this,Uw,i.index,"f");continue}if(gW(this,Uw,"f")!=null&&(i.index!==gW(this,Uw,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,gW(this,Uw,"f")-1))),this.buffer=this.buffer.slice(gW(this,Uw,"f")),P1e(this,Uw,null,"f");continue}let a=gW(this,Uw,"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),P1e(this,Uw,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 Lr(`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 Lr(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Lr("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
`):[]}};Uw=new WeakMap;yW.NEWLINE_CHARS=new Set([`
`,"\r"]);yW.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function qft(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 TUr=v(()=>{});async function*LYo(t,e){if(!t.body)throw e.abort(),new Lr("Attempted to iterate over a response with no body");let r=new Bft,n=new yW,o=qft(t.body);for await(let i of FYo(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*FYo(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=CUr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function kYo(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var HA,Bft,M1e=v(()=>{Pue();Bw();xUr();TUr();Zi();Bw();HA=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 LYo(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 Jm(void 0,s.error,void 0,Uft(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 Jm(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 yW,s=qft(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 Dft({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?.()}})}};Bft=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]=kYo(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function Hft(t,e,r){if(t=await t,EUr(t))return t;if(OUr(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=Lue(o)?[await o.arrayBuffer()]:[o];return new x1e(i,e,r)}let n=await BYo(t);if(e||(e=zYo(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new x1e(n,e,r)}async function BYo(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Lue(t))e.push(await t.arrayBuffer());else if(VYo(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${UYo(t)}`);return e}function UYo(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function zYo(t){return zft(t.name)||zft(t.filename)||zft(t.path)?.split(/[\\/]/).pop()}var OUr,EUr,Lue,qYo,zft,VYo,Wft,q0,PUr,Vft,R1e=v(()=>{Pue();Pue();OUr=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",EUr=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Lue(t),Lue=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",qYo=t=>EUr(t)||OUr(t)||Lft(t);zft=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},VYo=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Wft=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",q0=async t=>{let e=await PUr(t.body);return jft(e,t)},PUr=async t=>{let e=new Nft;return await Promise.all(Object.entries(t||{}).map(([r,n])=>Vft(e,r,n))),e},Vft=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(qYo(r)){let n=await Hft(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>Vft(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>Vft(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}}});async function DUr(t){let{response:e}=t;if(t.options.stream)return l$("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):HA.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 l$("response",e.status,e.url,e.headers,a),jUr(a,e)}let i=await e.text();return l$("response",e.status,e.url,e.headers,i),i}function jUr(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}function XYo(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}function $Ur(t){if(!t)return!0;for(let e in t)return!1;return!0}function LUr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function AUr(t,e){for(let r in e){if(!LUr(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 l$(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)NUr.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)NUr.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${t}`,...r)}}function que(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var WYo,JYo,I1e,N1e,D1e,Fue,Kft,Uft,KYo,ri,GYo,MUr,RUr,IUr,ZYo,YYo,QYo,eQo,c$,Jft,E1e,kue,NUr,tQo,FUr,rQo,A1e,kUr,Zi=v(()=>{gUr();M1e();Bw();Pue();R1e();R1e();WYo=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},JYo=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)};kft();N1e=class t extends Promise{constructor(e,r=DUr){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>jUr(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)}},D1e=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=Jft("maxRetries",r),this.timeout=Jft("timeout",n),this.httpAgent=o,this.fetch=i??Aft}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...ZYo(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${tQo()}`}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&&Lue(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:Wft(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&&Jft("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let d=n.httpAgent??this.httpAgent??$ft(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 AUr(i,a),AUr(i,r),Wft(e.body)&&hW!=="node"&&delete i["content-type"],A1e(a,"x-stainless-retry-count")===void 0&&A1e(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),A1e(a,"x-stainless-timeout")===void 0&&A1e(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 Jm.generate(e,r,n,o)}request(e,r=null){return new N1e(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}),l$("request",a,n,i.headers),n.signal?.aborted)throw new pm;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(E1e);if(l instanceof Error){if(n.signal?.aborted)throw new pm;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new fB:new dB({cause:l})}let c=Uft(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let y=`retrying, ${r} attempts remaining`;return l$(`response (error; ${y})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(y=>E1e(y).message),f=YYo(d),p=f?void 0:d;throw l$(`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 Kft(this,n,e)}buildURL(e,r){let n=eQo(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return $Ur(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 Lr(`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 c$(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 ${mW}`}},Fue=class{constructor(e,r,n,o){I1e.set(this,void 0),WYo(this,I1e,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 Lr("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 JYo(this,I1e,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(I1e=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Kft=class extends N1e{constructor(e,r,n){super(r,async o=>new n(e,o.response,await DUr(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},Uft=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),KYo={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},ri=t=>typeof t=="object"&&t!==null&&!$Ur(t)&&Object.keys(t).every(e=>LUr(KYo,e)),GYo=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":mW,"X-Stainless-OS":RUr(Deno.build.os),"X-Stainless-Arch":MUr(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":mW,"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":mW,"X-Stainless-OS":RUr(process.platform),"X-Stainless-Arch":MUr(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=XYo();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":mW,"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":mW,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};MUr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",RUr=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"),ZYo=()=>IUr??(IUr=GYo()),YYo=t=>{try{return JSON.parse(t)}catch{return}},QYo=/^[a-z][a-z0-9+.-]*:/i,eQo=t=>QYo.test(t),c$=t=>new Promise(e=>setTimeout(e,t)),Jft=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Lr(`${t} must be an integer`);if(e<0)throw new Lr(`${t} must be a positive integer`);return e},E1e=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)},kue=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};NUr=new Set(["authorization","api-key"]);tQo=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),FUr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",rQo=t=>typeof t?.get=="function",A1e=(t,e)=>{let r=e.toLowerCase();if(rQo(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},kUr=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=e.charCodeAt(o);return Array.from(new Float32Array(n.buffer))}}});var WA,ts,Kh=v(()=>{Zi();WA=class extends Fue{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}},ts=class extends Fue{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 $t,ci=v(()=>{$t=class{constructor(e){this._client=e}}});var L7,Gft=v(()=>{ci();Zi();Bue();L7=class extends $t{list(e,r={},n){return ri(r)?this.list(e,{},r):this._client.getAPIList(`/chat/completions/${e}/messages`,j1e,{query:r,...n})}}});var mB,hB,j1e,Bue=v(()=>{ci();Zi();Gft();Gft();Kh();mB=class extends $t{constructor(){super(...arguments),this.messages=new L7(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 ri(e)?this.list({},e):this._client.getAPIList("/chat/completions",hB,{query:e,...r})}del(e,r){return this._client.delete(`/chat/completions/${e}`,r)}},hB=class extends ts{},j1e=class extends ts{};mB.ChatCompletionsPage=hB;mB.Messages=L7});var d$,Xft=v(()=>{ci();Bue();Bue();d$=class extends $t{constructor(){super(...arguments),this.completions=new mB(this._client)}};d$.Completions=mB;d$.ChatCompletionsPage=hB});var qUr=v(()=>{Xft()});var BUr=v(()=>{});var F7,Zft=v(()=>{ci();F7=class extends $t{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var k7,Yft=v(()=>{ci();Zi();k7=class extends $t{create(e,r){return this._client.post("/audio/transcriptions",q0({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}}))}}});var q7,Qft=v(()=>{ci();Zi();q7=class extends $t{create(e,r){return this._client.post("/audio/translations",q0({body:e,...r,__metadata:{model:e.model}}))}}});var JA,ept=v(()=>{ci();Zft();Zft();Yft();Yft();Qft();Qft();JA=class extends $t{constructor(){super(...arguments),this.transcriptions=new k7(this._client),this.translations=new q7(this._client),this.speech=new F7(this._client)}};JA.Transcriptions=k7;JA.Translations=q7;JA.Speech=F7});var gB,bW,tpt=v(()=>{ci();Zi();Kh();gB=class extends $t{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 ri(e)?this.list({},e):this._client.getAPIList("/batches",bW,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},bW=class extends ts{};gB.BatchesPage=bW});var _W,B7,rpt=v(()=>{ci();Zi();Kh();_W=class extends $t{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 ri(e)?this.list({},e):this._client.getAPIList("/assistants",B7,{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}})}},B7=class extends ts{};_W.AssistantsPage=B7});function npt(t){return typeof t.parse=="function"}var UUr=v(()=>{});var yB,opt,ipt,apt=v(()=>{yB=t=>t?.role==="assistant",opt=t=>t?.role==="function",ipt=t=>t?.role==="tool"});var Kx,Oc,spt,$1e,L1e,Uue,zue,F1e,Vue,f$,Hue,k1e,q1e,U7,zUr,bB,B1e=v(()=>{Bw();Kx=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},Oc=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},bB=class{constructor(){spt.add(this),this.controller=new AbortController,$1e.set(this,void 0),L1e.set(this,()=>{}),Uue.set(this,()=>{}),zue.set(this,void 0),F1e.set(this,()=>{}),Vue.set(this,()=>{}),f$.set(this,{}),Hue.set(this,!1),k1e.set(this,!1),q1e.set(this,!1),U7.set(this,!1),Kx(this,$1e,new Promise((e,r)=>{Kx(this,L1e,e,"f"),Kx(this,Uue,r,"f")}),"f"),Kx(this,zue,new Promise((e,r)=>{Kx(this,F1e,e,"f"),Kx(this,Vue,r,"f")}),"f"),Oc(this,$1e,"f").catch(()=>{}),Oc(this,zue,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},Oc(this,spt,"m",zUr).bind(this))},0)}_connected(){this.ended||(Oc(this,L1e,"f").call(this),this._emit("connect"))}get ended(){return Oc(this,Hue,"f")}get errored(){return Oc(this,k1e,"f")}get aborted(){return Oc(this,q1e,"f")}abort(){this.controller.abort()}on(e,r){return(Oc(this,f$,"f")[e]||(Oc(this,f$,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Oc(this,f$,"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(Oc(this,f$,"f")[e]||(Oc(this,f$,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Kx(this,U7,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Kx(this,U7,!0,"f"),await Oc(this,zue,"f")}_emit(e,...r){if(Oc(this,Hue,"f"))return;e==="end"&&(Kx(this,Hue,!0,"f"),Oc(this,F1e,"f").call(this));let n=Oc(this,f$,"f")[e];if(n&&(Oc(this,f$,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Oc(this,U7,"f")&&!n?.length&&Promise.reject(o),Oc(this,Uue,"f").call(this,o),Oc(this,Vue,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Oc(this,U7,"f")&&!n?.length&&Promise.reject(o),Oc(this,Uue,"f").call(this,o),Oc(this,Vue,"f").call(this,o),this._emit("end")}}_emitFinal(){}};$1e=new WeakMap,L1e=new WeakMap,Uue=new WeakMap,zue=new WeakMap,F1e=new WeakMap,Vue=new WeakMap,f$=new WeakMap,Hue=new WeakMap,k1e=new WeakMap,q1e=new WeakMap,U7=new WeakMap,spt=new WeakSet,zUr=function(e){if(Kx(this,k1e,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new pm),e instanceof pm)return Kx(this,q1e,!0,"f"),this._emit("abort",e);if(e instanceof Lr)return this._emit("error",e);if(e instanceof Error){let r=new Lr(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Lr(String(e)))}});function Wue(t){return t?.$brand==="auto-parseable-response-format"}function vW(t){return t?.$brand==="auto-parseable-tool"}function VUr(t,e){return!e||!upt(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}}))}:Jue(t,e)}function Jue(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new j7;if(n.finish_reason==="content_filter")throw new $7;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>cQo(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?lQo(e,n.message.content):null}}});return{...t,choices:r}}function lQo(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 cQo(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:vW(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function HUr(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return vW(r)||r?.function.strict||!1}function upt(t){return Wue(t.response_format)?!0:t.tools?.some(e=>vW(e)||e.type==="function"&&e.function.strict===!0)??!1}function WUr(t){for(let e of t??[]){if(e.type!=="function")throw new Lr(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new Lr(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Kue=v(()=>{Bw()});var _v,tb,lpt,U1e,cpt,dpt,fpt,KUr,ppt,JUr,z7,mpt=v(()=>{Bw();UUr();apt();B1e();Kue();_v=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)},JUr=10,z7=class extends bB{constructor(){super(...arguments),tb.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),(opt(e)||ipt(e))&&e.content)this._emit("functionCallResult",e.content);else if(yB(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(yB(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 Lr("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),_v(this,tb,"m",lpt).call(this)}async finalMessage(){return await this.done(),_v(this,tb,"m",U1e).call(this)}async finalFunctionCall(){return await this.done(),_v(this,tb,"m",cpt).call(this)}async finalFunctionCallResult(){return await this.done(),_v(this,tb,"m",dpt).call(this)}async totalUsage(){return await this.done(),_v(this,tb,"m",fpt).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=_v(this,tb,"m",U1e).call(this);r&&this._emit("finalMessage",r);let n=_v(this,tb,"m",lpt).call(this);n&&this._emit("finalContent",n);let o=_v(this,tb,"m",cpt).call(this);o&&this._emit("finalFunctionCall",o);let i=_v(this,tb,"m",dpt).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",_v(this,tb,"m",fpt).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),_v(this,tb,"m",KUr).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(Jue(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=JUr}=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 Lr("missing message in ChatCompletion response");if(!m.function_call)return;let{name:h,arguments:y}=m.function_call,g=c[h];if(g){if(u&&u!==h){let T=`Invalid function_call: ${JSON.stringify(h)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,name:h,content:T});continue}}else{let T=`Invalid function_call: ${JSON.stringify(h)}. Available options are: ${d.map(O=>JSON.stringify(O.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:h,content:T});continue}let b;try{b=npt(g)?await g.parse(y):y}catch(T){this._addMessage({role:o,name:h,content:T instanceof Error?T.message:String(T)});continue}let _=await g.function(b,this),w=_v(this,tb,"m",ppt).call(this,_);if(this._addMessage({role:o,name:h,content:w}),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=JUr}=n||{},c=r.tools.map(p=>{if(vW(p)){if(!p.$callback)throw new Lr("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 Lr("missing message in ChatCompletion response");if(!h.tool_calls?.length)return;for(let y of h.tool_calls){if(y.type!=="function")continue;let g=y.id,{name:b,arguments:_}=y.function,w=d[b];if(w){if(u&&u!==b){let P=`Invalid tool_call: ${JSON.stringify(b)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:g,content:P});continue}}else{let P=`Invalid tool_call: ${JSON.stringify(b)}. Available options are: ${Object.keys(d).map(R=>JSON.stringify(R)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:P});continue}let T;try{T=npt(w)?await w.parse(_):_}catch(P){let R=P instanceof Error?P.message:String(P);this._addMessage({role:o,tool_call_id:g,content:R});continue}let O=await w.function(T,this),E=_v(this,tb,"m",ppt).call(this,O);if(this._addMessage({role:o,tool_call_id:g,content:E}),u)return}}}};tb=new WeakSet,lpt=function(){return _v(this,tb,"m",U1e).call(this).content??null},U1e=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(yB(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 Lr("stream ended without producing a ChatCompletionMessage with role=assistant")},cpt=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(yB(r)&&r?.function_call)return r.function_call;if(yB(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},dpt=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(opt(r)&&r.content!=null||ipt(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}},fpt=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},KUr=function(e){if(e.n!=null&&e.n>1)throw new Lr("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},ppt=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var Gue,GUr=v(()=>{mpt();apt();Gue=class t extends z7{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),yB(e)&&e.content&&this._emit("content",e.content)}}});function dQo(t,e=Gh.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return fQo(t.trim(),e)}var Gh,hpt,gpt,fQo,ypt,XUr=v(()=>{Gh={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},hpt=class extends Error{},gpt=class extends Error{};fQo=(t,e)=>{let r=t.length,n=0,o=f=>{throw new hpt(`${f} at position ${n}`)},i=f=>{throw new gpt(`${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"||Gh.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Gh.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Gh.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Gh.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Gh.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||Gh.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(Gh.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&&Gh.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(Gh.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Gh.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(Gh.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&Gh.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Gh.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&&!(Gh.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Gh.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()},ypt=t=>dQo(t,Gh.ALL^Gh.NUM)});function pQo(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 Lr(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:y,...g}=l,b=l.role;if(!b)throw new Lr(`missing role for choice ${d}`);if(h){let{arguments:_,name:w}=h;if(_==null)throw new Lr(`missing function_call.arguments for choice ${d}`);if(!w)throw new Lr(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:_,name:w},role:b,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return y?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:b,content:m,refusal:l.refusal??null,tool_calls:y.map((_,w)=>{let{function:T,type:O,id:E,...P}=_,{arguments:R,name:I,...A}=T||{};if(E==null)throw new Lr(`missing choices[${d}].tool_calls[${w}].id
${H1e(t)}`);if(O==null)throw new Lr(`missing choices[${d}].tool_calls[${w}].type
${H1e(t)}`);if(I==null)throw new Lr(`missing choices[${d}].tool_calls[${w}].function.name
${H1e(t)}`);if(R==null)throw new Lr(`missing choices[${d}].tool_calls[${w}].function.arguments
${H1e(t)}`);return{...P,id:E,type:O,function:{...A,name:I,arguments:R}}})}}:{...p,message:{...g,content:m,role:b,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return VUr(u,e)}function H1e(t){return JSON.stringify(t)}var V7,Ou,Km,p$,H7,_B,bpt,z1e,_pt,vpt,wpt,V1e,Spt,ZUr,W7,Cpt=v(()=>{Bw();mpt();M1e();Kue();XUr();V7=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},Ou=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)},W7=class t extends z7{constructor(e){super(),Km.add(this),p$.set(this,void 0),H7.set(this,void 0),_B.set(this,void 0),V7(this,p$,e,"f"),V7(this,H7,[],"f")}get currentChatCompletionSnapshot(){return Ou(this,_B,"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())),Ou(this,Km,"m",bpt).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)Ou(this,Km,"m",_pt).call(this,a);if(i.controller.signal?.aborted)throw new pm;return this._addChatCompletion(Ou(this,Km,"m",V1e).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Ou(this,Km,"m",bpt).call(this),this._connected();let o=HA.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(Ou(this,Km,"m",V1e).call(this)),Ou(this,Km,"m",_pt).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new pm;return this._addChatCompletion(Ou(this,Km,"m",V1e).call(this))}[(p$=new WeakMap,H7=new WeakMap,_B=new WeakMap,Km=new WeakSet,bpt=function(){this.ended||V7(this,_B,void 0,"f")},z1e=function(r){let n=Ou(this,H7,"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},Ou(this,H7,"f")[r.index]=n,n)},_pt=function(r){if(this.ended)return;let n=Ou(this,Km,"m",ZUr).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=Ou(this,Km,"m",z1e).call(this,i);i.finish_reason&&(Ou(this,Km,"m",wpt).call(this,i),a.current_tool_call_index!=null&&Ou(this,Km,"m",vpt).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(Ou(this,Km,"m",wpt).call(this,i),a.current_tool_call_index!=null&&Ou(this,Km,"m",vpt).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))}}},vpt=function(r,n){if(Ou(this,Km,"m",z1e).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=Ou(this,p$,"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:vW(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},wpt=function(r){let n=Ou(this,Km,"m",z1e).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=Ou(this,Km,"m",Spt).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}))},V1e=function(){if(this.ended)throw new Lr("stream has ended, this shouldn't happen");let r=Ou(this,_B,"f");if(!r)throw new Lr("request ended without sending any chunks");return V7(this,_B,void 0,"f"),V7(this,H7,[],"f"),pQo(r,Ou(this,p$,"f"))},Spt=function(){let r=Ou(this,p$,"f")?.response_format;return Wue(r)?r:null},ZUr=function(r){var n,o,i,a;let s=Ou(this,_B,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=V7(this,_B,{...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:O,refusal:E,...P}=p;Object.assign(h.logprobs,P),O&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...O)),E&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...E))}if(d&&(h.finish_reason=d,Ou(this,p$,"f")&&upt(Ou(this,p$,"f")))){if(d==="length")throw new j7;if(d==="content_filter")throw new $7}if(Object.assign(h,m),!c)continue;let{content:y,refusal:g,function_call:b,role:_,tool_calls:w,...T}=c;if(Object.assign(h.message,T),g&&(h.message.refusal=(h.message.refusal||"")+g),_&&(h.message.role=_),b&&(h.message.function_call?(b.name&&(h.message.function_call.name=b.name),b.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=b.arguments)):h.message.function_call=b),y&&(h.message.content=(h.message.content||"")+y,!h.message.refusal&&Ou(this,Km,"m",Spt).call(this)&&(h.message.parsed=ypt(h.message.content))),w){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:O,id:E,type:P,function:R,...I}of w){let A=(a=h.message.tool_calls)[O]??(a[O]={});Object.assign(A,I),E&&(A.id=E),P&&(A.type=P),R&&(A.function??(A.function={name:R.name??"",arguments:""})),R?.name&&(A.function.name=R.name),R?.arguments&&(A.function.arguments+=R.arguments,HUr(Ou(this,p$,"f"),A)&&(A.function.parsed_arguments=ypt(A.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 HA(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var Xue,YUr=v(()=>{Cpt();Xue=class t extends W7{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 Zue,QUr=v(()=>{ci();GUr();YUr();Cpt();Kue();Zue=class extends $t{parse(e,r){return WUr(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>Jue(n,e))}runFunctions(e,r){return e.stream?Xue.runFunctions(this._client,e,r):Gue.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?Xue.runTools(this._client,e,r):Gue.runTools(this._client,e,r)}stream(e,r){return W7.createChatCompletion(this._client,e,r)}}});var J7,ezr=v(()=>{ci();QUr();J7=class extends $t{constructor(){super(...arguments),this.completions=new Zue(this._client)}};(function(t){t.Completions=Zue})(J7||(J7={}))});var K7,xpt=v(()=>{ci();K7=class extends $t{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var G7,Tpt=v(()=>{ci();G7=class extends $t{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var vB,Opt=v(()=>{ci();xpt();xpt();Tpt();Tpt();vB=class extends $t{constructor(){super(...arguments),this.sessions=new K7(this._client),this.transcriptionSessions=new G7(this._client)}};vB.Sessions=K7;vB.TranscriptionSessions=G7});var on,zw,Qg,Ept,KA,W1e,Gx,SW,X7,wW,G1e,Vw,J1e,K1e,ele,Yue,Que,tzr,rzr,nzr,ozr,izr,azr,szr,GA,Ppt=v(()=>{Zi();M1e();Bw();B1e();on=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)},zw=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},GA=class t extends bB{constructor(){super(...arguments),Qg.add(this),Ept.set(this,[]),KA.set(this,{}),W1e.set(this,{}),Gx.set(this,void 0),SW.set(this,void 0),X7.set(this,void 0),wW.set(this,void 0),G1e.set(this,void 0),Vw.set(this,void 0),J1e.set(this,void 0),K1e.set(this,void 0),ele.set(this,void 0)}[(Ept=new WeakMap,KA=new WeakMap,W1e=new WeakMap,Gx=new WeakMap,SW=new WeakMap,X7=new WeakMap,wW=new WeakMap,G1e=new WeakMap,Vw=new WeakMap,J1e=new WeakMap,K1e=new WeakMap,ele=new WeakMap,Qg=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=HA.fromReadableStream(e,this.controller);for await(let i of o)on(this,Qg,"m",Yue).call(this,i);if(o.controller.signal?.aborted)throw new pm;return this._addRun(on(this,Qg,"m",Que).call(this))}toReadableStream(){return new HA(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)on(this,Qg,"m",Yue).call(this,l);if(u.controller.signal?.aborted)throw new pm;return this._addRun(on(this,Qg,"m",Que).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 on(this,J1e,"f")}currentRun(){return on(this,K1e,"f")}currentMessageSnapshot(){return on(this,Gx,"f")}currentRunStepSnapshot(){return on(this,ele,"f")}async finalRunSteps(){return await this.done(),Object.values(on(this,KA,"f"))}async finalMessages(){return await this.done(),Object.values(on(this,W1e,"f"))}async finalRun(){if(await this.done(),!on(this,SW,"f"))throw Error("Final run was not received.");return on(this,SW,"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)on(this,Qg,"m",Yue).call(this,s);if(a.controller.signal?.aborted)throw new pm;return this._addRun(on(this,Qg,"m",Que).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)on(this,Qg,"m",Yue).call(this,u);if(s.controller.signal?.aborted)throw new pm;return this._addRun(on(this,Qg,"m",Que).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(que(i)&&que(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(!que(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)}};Yue=function(e){if(!this.ended)switch(zw(this,J1e,e,"f"),on(this,Qg,"m",nzr).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":on(this,Qg,"m",szr).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":on(this,Qg,"m",rzr).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":on(this,Qg,"m",tzr).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},Que=function(){if(this.ended)throw new Lr("stream has ended, this shouldn't happen");if(!on(this,SW,"f"))throw Error("Final run has not been received");return on(this,SW,"f")},tzr=function(e){let[r,n]=on(this,Qg,"m",izr).call(this,e,on(this,Gx,"f"));zw(this,Gx,r,"f"),on(this,W1e,"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!=on(this,X7,"f")){if(on(this,wW,"f"))switch(on(this,wW,"f").type){case"text":this._emit("textDone",on(this,wW,"f").text,on(this,Gx,"f"));break;case"image_file":this._emit("imageFileDone",on(this,wW,"f").image_file,on(this,Gx,"f"));break}zw(this,X7,o.index,"f")}zw(this,wW,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(on(this,X7,"f")!==void 0){let o=e.data.content[on(this,X7,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,on(this,Gx,"f"));break;case"text":this._emit("textDone",o.text,on(this,Gx,"f"));break}}on(this,Gx,"f")&&this._emit("messageDone",e.data),zw(this,Gx,void 0,"f")}},rzr=function(e){let r=on(this,Qg,"m",ozr).call(this,e);switch(zw(this,ele,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==on(this,G1e,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(on(this,Vw,"f")&&this._emit("toolCallDone",on(this,Vw,"f")),zw(this,G1e,i.index,"f"),zw(this,Vw,r.step_details.tool_calls[i.index],"f"),on(this,Vw,"f")&&this._emit("toolCallCreated",on(this,Vw,"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":zw(this,ele,void 0,"f"),e.data.step_details.type=="tool_calls"&&on(this,Vw,"f")&&(this._emit("toolCallDone",on(this,Vw,"f")),zw(this,Vw,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},nzr=function(e){on(this,Ept,"f").push(e),this._emit("event",e)},ozr=function(e){switch(e.event){case"thread.run.step.created":return on(this,KA,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=on(this,KA,"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=GA.accumulateDelta(r,n.delta);on(this,KA,"f")[e.data.id]=o}return on(this,KA,"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":on(this,KA,"f")[e.data.id]=e.data;break}if(on(this,KA,"f")[e.data.id])return on(this,KA,"f")[e.data.id];throw new Error("No snapshot available")},izr=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]=on(this,Qg,"m",azr).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")},azr=function(e,r){return GA.accumulateDelta(r,e)},szr=function(e){switch(zw(this,K1e,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":zw(this,SW,e.data,"f"),on(this,Vw,"f")&&(this._emit("toolCallDone",on(this,Vw,"f")),zw(this,Vw,void 0,"f"));break;case"thread.run.cancelling":break}}});var CW,Z7,Mpt=v(()=>{ci();Zi();Kh();CW=class extends $t{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 ri(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,Z7,{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}})}},Z7=class extends ts{};CW.MessagesPage=Z7});var xW,Y7,Rpt=v(()=>{ci();Zi();Kh();xW=class extends $t{retrieve(e,r,n,o={},i){return ri(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 ri(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,Y7,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},Y7=class extends ts{};xW.RunStepsPage=Y7});var m$,Q7,Ipt=v(()=>{ci();Zi();Ppt();Zi();Rpt();Rpt();Kh();m$=class extends $t{constructor(){super(...arguments),this.steps=new xW(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 ri(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,Q7,{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 GA.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 c$(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return GA.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 GA.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},Q7=class extends ts{};m$.RunsPage=Q7;m$.Steps=xW;m$.RunStepsPage=Y7});var XA,Apt=v(()=>{ci();Zi();Ppt();Mpt();Mpt();Ipt();Ipt();XA=class extends $t{constructor(){super(...arguments),this.runs=new m$(this._client),this.messages=new CW(this._client)}create(e={},r){return ri(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 GA.createThreadAssistantStream(e,this._client.beta.threads,r)}};XA.Runs=m$;XA.RunsPage=Q7;XA.Messages=CW;XA.MessagesPage=Z7});var Xx,Npt=v(()=>{ci();rpt();ezr();rpt();Opt();Opt();Apt();Apt();Xx=class extends $t{constructor(){super(...arguments),this.realtime=new vB(this._client),this.chat=new J7(this._client),this.assistants=new _W(this._client),this.threads=new XA(this._client)}};Xx.Realtime=vB;Xx.Assistants=_W;Xx.AssistantsPage=B7;Xx.Threads=XA});var TW,Dpt=v(()=>{ci();TW=class extends $t{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var OW,jpt=v(()=>{ci();Zi();OW=class extends $t{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&l$("Request","User defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(l$("response","Decoding base64 embeddings to float32 array"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=kUr(u)}),a)))}}});var EW,eX,$pt=v(()=>{ci();Zi();Kh();EW=class extends $t{retrieve(e,r,n,o){return this._client.get(`/evals/${e}/runs/${r}/output_items/${n}`,o)}list(e,r,n={},o){return ri(n)?this.list(e,r,{},n):this._client.getAPIList(`/evals/${e}/runs/${r}/output_items`,eX,{query:n,...o})}},eX=class extends ts{};EW.OutputItemListResponsesPage=eX});var h$,tX,Lpt=v(()=>{ci();Zi();$pt();$pt();Kh();h$=class extends $t{constructor(){super(...arguments),this.outputItems=new EW(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 ri(r)?this.list(e,{},r):this._client.getAPIList(`/evals/${e}/runs`,tX,{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)}},tX=class extends ts{};h$.RunListResponsesPage=tX;h$.OutputItems=EW;h$.OutputItemListResponsesPage=eX});var ZA,PW,Fpt=v(()=>{ci();Zi();Lpt();Lpt();Kh();ZA=class extends $t{constructor(){super(...arguments),this.runs=new h$(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 ri(e)?this.list({},e):this._client.getAPIList("/evals",PW,{query:e,...r})}del(e,r){return this._client.delete(`/evals/${e}`,r)}},PW=class extends ts{};ZA.EvalListResponsesPage=PW;ZA.Runs=h$;ZA.RunListResponsesPage=tX});var wB,MW,kpt=v(()=>{ci();Zi();Zi();Bw();Zi();Kh();wB=class extends $t{create(e,r){return this._client.post("/files",q0({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return ri(e)?this.list({},e):this._client.getAPIList("/files",MW,{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 c$(r),a=await this.retrieve(e),Date.now()-i>n)throw new fB({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},MW=class extends ts{};wB.FileObjectsPage=MW});var RW,rX,qpt=v(()=>{ci();Zi();Kh();RW=class extends $t{create(e,r,n){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,rX,{body:r,method:"post",...n})}retrieve(e,r={},n){return ri(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)}},rX=class extends WA{};RW.PermissionCreateResponsesPage=rX});var SB,Bpt=v(()=>{ci();qpt();qpt();SB=class extends $t{constructor(){super(...arguments),this.permissions=new RW(this._client)}};SB.Permissions=RW;SB.PermissionCreateResponsesPage=rX});var IW,nX,Upt=v(()=>{ci();Zi();Kh();IW=class extends $t{list(e,r={},n){return ri(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,nX,{query:r,...n})}},nX=class extends ts{};IW.FineTuningJobCheckpointsPage=nX});var YA,oX,iX,zpt=v(()=>{ci();Zi();Upt();Upt();Kh();YA=class extends $t{constructor(){super(...arguments),this.checkpoints=new IW(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 ri(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",oX,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return ri(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,iX,{query:r,...n})}},oX=class extends ts{},iX=class extends ts{};YA.FineTuningJobsPage=oX;YA.FineTuningJobEventsPage=iX;YA.Checkpoints=IW;YA.FineTuningJobCheckpointsPage=nX});var Zx,Vpt=v(()=>{ci();Bpt();Bpt();zpt();zpt();Zx=class extends $t{constructor(){super(...arguments),this.jobs=new YA(this._client),this.checkpoints=new SB(this._client)}};Zx.Jobs=YA;Zx.FineTuningJobsPage=oX;Zx.FineTuningJobEventsPage=iX;Zx.Checkpoints=SB});var AW,Hpt=v(()=>{ci();Zi();AW=class extends $t{createVariation(e,r){return this._client.post("/images/variations",q0({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",q0({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}}});var CB,NW,Wpt=v(()=>{ci();Kh();CB=class extends $t{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",NW,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},NW=class extends WA{};CB.ModelsPage=NW});var DW,Jpt=v(()=>{ci();DW=class extends $t{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function uzr(t,e){return!e||!RQo(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)}:Kpt(t,e)}function Kpt(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:NQo(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:MQo(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||Gpt(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 MQo(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function RQo(t){return!!Wue(t.text?.format)}function IQo(t){return t?.$brand==="auto-parseable-tool"}function AQo(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function NQo(t,e){let r=AQo(t.tools??[],e.name);return{...e,...e,parsed_arguments:IQo(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function Gpt(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 Xpt=v(()=>{Kue()});var aX,Zpt=v(()=>{ci();Zi();Z1e();aX=class extends $t{list(e,r={},n){return ri(r)?this.list(e,{},r):this._client.getAPIList(`/responses/${e}/input_items`,X1e,{query:r,...n})}}});function jQo(t,e){return uzr(t,e)}var sX,xB,uX,Y1e,TB,Q1e,lzr,czr,dzr,fzr,eDe,pzr=v(()=>{Bw();B1e();Xpt();sX=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},xB=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)},eDe=class t extends bB{constructor(e){super(),uX.add(this),Y1e.set(this,void 0),TB.set(this,void 0),Q1e.set(this,void 0),sX(this,Y1e,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())),xB(this,uX,"m",lzr).call(this);let i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)xB(this,uX,"m",czr).call(this,a);if(i.controller.signal?.aborted)throw new pm;return xB(this,uX,"m",dzr).call(this)}[(Y1e=new WeakMap,TB=new WeakMap,Q1e=new WeakMap,uX=new WeakSet,lzr=function(){this.ended||sX(this,TB,void 0,"f")},czr=function(r){if(this.ended)return;let n=xB(this,uX,"m",fzr).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 Lr(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new Lr(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new Lr(`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 Lr(`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}},dzr=function(){if(this.ended)throw new Lr("stream has ended, this shouldn't happen");let r=xB(this,TB,"f");if(!r)throw new Lr("request ended without sending any events");sX(this,TB,void 0,"f");let n=jQo(r,xB(this,Y1e,"f"));return sX(this,Q1e,n,"f"),n},fzr=function(r){let n=xB(this,TB,"f");if(!n){if(r.type!=="response.created")throw new Lr(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=sX(this,TB,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 Lr(`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 Lr(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new Lr(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new Lr(`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 Lr(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{sX(this,TB,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=xB(this,Q1e,"f");if(!e)throw new Lr("stream ended without producing a ChatCompletion");return e}}});var OB,X1e,Z1e=v(()=>{Xpt();Zi();ci();Zpt();Zpt();pzr();Kh();OB=class extends $t{constructor(){super(...arguments),this.inputItems=new aX(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"&&Gpt(n),n))}retrieve(e,r={},n){return ri(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=>Kpt(n,e))}stream(e,r){return eDe.createResponse(this._client,e,r)}},X1e=class extends ts{};OB.InputItems=aX});var lX,Ypt=v(()=>{ci();Zi();lX=class extends $t{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,q0({body:r,...n}))}}});var EB,Qpt=v(()=>{ci();Ypt();Ypt();EB=class extends $t{constructor(){super(...arguments),this.parts=new lX(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})}};EB.Parts=lX});var mzr,hzr=v(()=>{mzr=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 PB,MB,cX,tDe=v(()=>{ci();Zi();Kh();PB=class extends $t{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 ri(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,MB,{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 c$(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`,cX,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},MB=class extends ts{},cX=class extends WA{};PB.VectorStoreFilesPage=MB;PB.FileContentResponsesPage=cX});var dX,emt=v(()=>{ci();Zi();Zi();hzr();tDe();dX=class extends $t{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 ri(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,MB,{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 c$(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 mzr(d),await this.createAndPoll(e,{file_ids:l})}}});var Hw,jW,$W,tmt=v(()=>{ci();Zi();emt();emt();tDe();tDe();Kh();Hw=class extends $t{constructor(){super(...arguments),this.files=new PB(this._client),this.fileBatches=new dX(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 ri(e)?this.list({},e):this._client.getAPIList("/vector_stores",jW,{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`,$W,{body:r,method:"post",...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},jW=class extends ts{},$W=class extends WA{};Hw.VectorStoresPage=jW;Hw.VectorStoreSearchResponsesPage=$W;Hw.Files=PB;Hw.VectorStoreFilesPage=MB;Hw.FileContentResponsesPage=cX;Hw.FileBatches=dX});var gzr=v(()=>{qUr();BUr();ept();tpt();Npt();Dpt();jpt();Fpt();kpt();Vpt();Hpt();Wpt();Jpt();Z1e();Qpt();tmt()});var yzr,Ko,bzr,_zr=v(()=>{hUr();Zi();Bw();R1e();gzr();tpt();Dpt();jpt();kpt();Hpt();Wpt();Jpt();ept();Npt();Xft();Fpt();Vpt();Z1e();Qpt();tmt();Bue();Ko=class extends D1e{constructor({baseURL:e=kue("OPENAI_BASE_URL"),apiKey:r=kue("OPENAI_API_KEY"),organization:n=kue("OPENAI_ORG_ID")??null,project:o=kue("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new Lr("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&&FUr())throw new Lr(`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 TW(this),this.chat=new d$(this),this.embeddings=new OW(this),this.files=new wB(this),this.images=new AW(this),this.audio=new JA(this),this.moderations=new DW(this),this.models=new CB(this),this.fineTuning=new Zx(this),this.vectorStores=new Hw(this),this.beta=new Xx(this),this.batches=new gB(this),this.uploads=new EB(this),this.responses=new OB(this),this.evals=new ZA(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 Ift(e,{arrayFormat:"brackets"})}};yzr=Ko;Ko.OpenAI=yzr;Ko.DEFAULT_TIMEOUT=6e5;Ko.OpenAIError=Lr;Ko.APIError=Jm;Ko.APIConnectionError=dB;Ko.APIConnectionTimeoutError=fB;Ko.APIUserAbortError=pm;Ko.NotFoundError=Aue;Ko.ConflictError=Nue;Ko.RateLimitError=jue;Ko.BadRequestError=Mue;Ko.AuthenticationError=Rue;Ko.InternalServerError=$ue;Ko.PermissionDeniedError=Iue;Ko.UnprocessableEntityError=Due;Ko.toFile=Hft;Ko.fileFromPath=T1e;Ko.Completions=TW;Ko.Chat=d$;Ko.ChatCompletionsPage=hB;Ko.Embeddings=OW;Ko.Files=wB;Ko.FileObjectsPage=MW;Ko.Images=AW;Ko.Audio=JA;Ko.Moderations=DW;Ko.Models=CB;Ko.ModelsPage=NW;Ko.FineTuning=Zx;Ko.VectorStores=Hw;Ko.VectorStoresPage=jW;Ko.VectorStoreSearchResponsesPage=$W;Ko.Beta=Xx;Ko.Batches=gB;Ko.BatchesPage=bW;Ko.Uploads=EB;Ko.Responses=OB;Ko.Evals=ZA;Ko.EvalListResponsesPage=PW;bzr=Ko});var fX,vzr=v(()=>{ra();xm();CD();_zr();Xe();fX=class extends Px{constructor(e){let{enableReasoning:r=!1,reasoningEffort:n,enablePromptCaching:o=!0,...i}=e;super(i),this.enableReasoning=r,this.reasoningEffort=n,this.enablePromptCaching=o;let a=e.configuration?.baseURL||"https://openrouter.ai/api/v1";this.isOpenRouter=a.includes("openrouter.ai"),this.openaiClient=new bzr({apiKey:e.apiKey,baseURL:a,defaultHeaders:e.configuration?.defaultHeaders,fetch:e.configuration?.fetch,dangerouslyAllowBrowser:!0})}invocationParams(e){let r=super.invocationParams(e),n=this.isOpenRouter&&this.enablePromptCaching?{...r,cache_control:{type:"ephemeral"}}:r;if(this.enableReasoning)if(this.reasoningEffort){let o=this.reasoningEffort==="minimal"?"low":this.reasoningEffort;return F(`OpenRouter reasoning enabled with effort: ${o}`),{...n,reasoning:{effort:o}}}else return F("OpenRouter reasoning enabled with max_tokens: 1024"),{...n,reasoning:{max_tokens:1024}};return n}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=this.toOpenRouterMessages(e),a=await this.openaiClient.chat.completions.create({...o,messages:i,stream:!0,stream_options:{...o.stream_options??{},include_usage:!0}}),s;for await(let u of a){u.usage&&(s=u.usage);let l=u.choices?.[0],c=l?.delta;if(!l||!c)continue;let d=this.normalizeReasoningChunk(c?.reasoning),f=this.extractReasoningDetails(l),p=this.extractDeltaContent(c.content),m=this.buildMessageChunk({rawChunk:u,delta:c,content:p,finishReason:l.finish_reason,reasoningDetails:f,reasoningText:d}),h=new Mi({message:m,text:typeof m.content=="string"?m.content:"",generationInfo:{finish_reason:l.finish_reason,system_fingerprint:u.system_fingerprint,model:u.model}});yield h,h.text&&await n?.handleLLMNewToken(h.text)}if(s&&(yield this.buildUsageGenerationChunk(s)),r.signal?.aborted)throw new Error("AbortError")}toOpenRouterMessages(e){return e.map(r=>{let n=typeof r._getType=="function"?r._getType():r.role??"user",o=n==="human"?"user":n==="ai"?"assistant":n;return r.tool_call_id?{role:"tool",content:r.content,tool_call_id:r.tool_call_id}:r.additional_kwargs?.function_call?{role:o,content:r.content,function_call:r.additional_kwargs.function_call}:r.additional_kwargs?.tool_calls?{role:o,content:r.content,tool_calls:r.additional_kwargs.tool_calls}:{role:o,content:r.content}})}buildMessageChunk(e){let{rawChunk:r,delta:n,content:o,finishReason:i,reasoningText:a,reasoningDetails:s}=e,u=this.extractToolCallChunks(n.tool_calls),l={};n.function_call&&(l.function_call=n.function_call),Array.isArray(n.tool_calls)&&(l.tool_calls=n.tool_calls);let c={};a&&(c.reasoning=a),s&&s.length>0&&(c.reasoning_details=s),Object.keys(c).length>0&&(l.delta={...l.delta,...c}),s&&s.length>0&&(l.reasoning_details=s);let d=this.buildResponseMetadata(r,i);return new Hr({content:o,additional_kwargs:l,tool_call_chunks:u,response_metadata:d,id:r.id})}normalizeReasoningChunk(e){if(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(r=>this.normalizeReasoningChunk(r)).filter(r=>!!r).join("");if(typeof e=="object"){let r=e,o=[r.output_text,r.text,r.reasoning,r.thinking,r.content].find(i=>typeof i=="string");if(typeof o=="string")return o}}}extractReasoningDetails(e){let r=e?.delta?.reasoning_details??e?.message?.reasoning_details??e?.reasoning_details;if(Array.isArray(r))return r.filter(n=>n!=null)}extractDeltaContent(e){return typeof e=="string"?e:Array.isArray(e)?e.map(r=>typeof r=="string"?r:r&&typeof r=="object"&&typeof r.text=="string"?r.text:"").join(""):""}extractToolCallChunks(e){if(Array.isArray(e))return e.map(r=>({name:r?.function?.name,args:r?.function?.arguments,id:r?.id,index:r?.index,type:"tool_call_chunk"}))}buildResponseMetadata(e,r){let n={model_provider:"openrouter"};return r&&(n.finish_reason=r),e.model&&(n.model=e.model),e.system_fingerprint&&(n.system_fingerprint=e.system_fingerprint),e.usage&&(n.usage={...e.usage},n.tokenUsage={promptTokens:e.usage.prompt_tokens,completionTokens:e.usage.completion_tokens,totalTokens:e.usage.total_tokens}),n}buildUsageGenerationChunk(e){let r={},n={},o=e.prompt_tokens_details??{};typeof o.audio_tokens=="number"&&(r.audio=o.audio_tokens),typeof o.cached_tokens=="number"&&(r.cache_read=o.cached_tokens);let i=e.completion_tokens_details??{};typeof i.audio_tokens=="number"&&(n.audio=i.audio_tokens),typeof i.reasoning_tokens=="number"&&(n.reasoning=i.reasoning_tokens);let a={input_tokens:e.prompt_tokens??0,output_tokens:e.completion_tokens??0,total_tokens:e.total_tokens??0};Object.keys(r).length>0&&(a.input_token_details=r),Object.keys(n).length>0&&(a.output_token_details=n);let s=new Hr({content:"",response_metadata:{usage:{...e}},usage_metadata:a});return new Mi({message:s,text:""})}}});function qQo(t){let e=t||globalThis.fetch;return async(r,n)=>{if(n?.body&&typeof n.body=="string")try{let o=JSON.parse(n.body),i=!1;Array.isArray(o.tools)&&(o.tools=o.tools.map(a=>{let s={};for(let[u,l]of Object.entries(a))l!=null&&(s[u]=l);return s}),i=!0),i&&(n={...n,body:JSON.stringify(o)})}catch{}return e(r,n)}}var tle,wzr=v(()=>{CD();tle=class extends Px{constructor(e){let r=e.configuration?.fetch;super({...e,useResponsesApi:!0,configuration:{...e.configuration,fetch:qQo(r)},modelKwargs:{...e.modelKwargs,text:{format:{type:"text"}}}})}}});var rDe,Szr=v(()=>{aD();Xe();ra();xm();nv();Sy();rDe=class extends Vy{constructor(e){let{modelId:r,apiKey:n,endpoint:o,streamEndpoint:i,defaultMaxTokens:a,defaultTemperature:s,defaultTopP:u,anthropicVersion:l,enableThinking:c,fetchImplementation:d,...f}=e;if(!r)throw new Error("Amazon Bedrock model identifier is required.");if(!n)throw new Error("Amazon Bedrock API key is required.");if(!o)throw new Error("Amazon Bedrock endpoint is required.");super(f);let p=typeof fetch<"u"?fetch.bind(globalThis):void 0;if(this.fetchImpl=d??p,!this.fetchImpl)throw new Error("No fetch implementation available for Amazon Bedrock requests.");f.streaming&&!i&&Ce("Amazon Bedrock streaming requested without a streaming endpoint; falling back to non-streaming mode."),this.modelName=r,this.apiKey=n,this.endpoint=o,this.streamEndpoint=i,this.defaultMaxTokens=a,this.defaultTemperature=s,this.defaultTopP=u,this.anthropicVersion=l,this.enableThinking=c??!1}_llmType(){return"amazon-bedrock"}bindTools(e){let r=Object.create(this);return r.boundTools=e,r}convertToolsToClaude(e){return e.map(r=>{let n={type:"object",properties:{}};return r.schema&&(n=Hi(r.schema)?Ii(r.schema):r.schema),{name:r.name,description:r.description||"",input_schema:n}})}extractToolCalls(e){if(!Array.isArray(e?.content))return;let r=e.content.filter(n=>n.type==="tool_use");if(r.length!==0)return r.map(n=>({id:n.id,name:n.name,args:n.input||{},type:"tool_call"}))}async _generate(e,r,n){let o=this.buildRequestBody(e,r),i=await this.fetchImpl(this.endpoint,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok){let m=await i.text();throw new Error(`Amazon Bedrock request failed with status ${i.status}: ${m}`)}let a=await i.json(),s=this.extractText(a),u=this.extractToolCalls(a);n&&s&&await n.handleLLMNewToken(s);let l=this.extractUsage(a),c=l?this.normaliseUsageMetadata(l):void 0,d={stopReason:a.stop_reason??a.stopReason,usage:l,rawResponse:a};return{generations:[{message:new uo({content:s,response_metadata:d,usage_metadata:c,tool_calls:u}),text:s,generationInfo:d}],llmOutput:d}}async*_streamResponseChunks(e,r={},n){if(!this.streamEndpoint){let p=await this._generate(e,r,n),m=p.generations[0]?.text??"";if(!m)return;let h=new Hr({content:m,response_metadata:p.llmOutput??{}});yield new Mi({message:h,text:m,generationInfo:p.llmOutput??{}});return}let o=this.buildRequestBody(e,r),i=`bedrock-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;F(`[${i}] Starting Bedrock stream request to ${this.streamEndpoint}`);let a=await this.fetchImpl(this.streamEndpoint,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o),signal:r?.signal});if(!a.ok){let p=await a.text();throw new Error(`Amazon Bedrock streaming request failed with status ${a.status}: ${p}`)}if(!a.body)throw new Error("Amazon Bedrock streaming response did not include a readable body.");let s=a.body.getReader(),u=new Uint8Array(0),l,c,d=!1,f=[];try{for(;;){let{value:p,done:m}=await s.read();if(m)break;if(!p)continue;let h=new Uint8Array(u.length+p.length);h.set(u),h.set(p,u.length),u=h;let{messages:y,remainingBytes:g}=this.parseEventStreamBuffer(u);u=new Uint8Array(g);for(let b of y){let _=this.safeJsonParse(b);if(!_){Ce(`[${i}] Failed to parse event JSON: ${b.slice(0,100)}...`);continue}let w=_;typeof _.bytes=="string"&&!_.type&&(w={type:"chunk",chunk:{bytes:_.bytes}});let T=await this.processStreamEvent(w,n,c,l);if(c=T.usage??c,l=T.stopReason??l,T.hasText||f.push(this.describeEvent(_)),T.deltaChunks.length>0)for(let O of T.deltaChunks)!(Array.isArray(O.message.content)&&O.message.content.length>0&&O.message.content[0]?.type==="thinking")&&O.text&&(d=!0),yield O;T.debugSummaries.length>0&&f.push(...T.debugSummaries)}}}catch(p){throw ie(`[${i}] Error during stream processing: ${p instanceof Error?p.message:String(p)}`),p}finally{s.releaseLock()}if((c||l)&&(yield this.buildTerminalMetadataChunk(l,c)),!d){Ce(`[${i}] Stream complete but no answer text yielded (only thinking or no content). Usage: ${JSON.stringify(c)}, stopReason: ${l}`),f.length>0&&F(`[${i}] Amazon Bedrock streaming produced no answer text. Sample events: ${f.slice(0,5).join(" | ")}`),Ce(`[${i}] Amazon Bedrock streaming returned no answer content. Falling back to non-streaming response.`);let p=await this._generate(e,r,n),m=p.generations[0]?.text??"";m&&(yield new Mi({message:new Hr({content:m,response_metadata:p.llmOutput??{}}),text:m,generationInfo:p.llmOutput??{}}))}}safeJsonParse(e){try{return JSON.parse(e)}catch{return null}}buildContentItemsFromDelta(e){if(!e||typeof e!="object")return null;let r=e.content_block_delta?.delta||e.contentBlockDelta?.delta||e.delta;if(!r||typeof r!="object")return null;let n=r.type;if(n==="thinking"||n==="thinking_delta"){let o=r.thinking;return typeof o=="string"&&o.length>0?[{type:"thinking",thinking:o}]:[{type:"thinking",thinking:""}]}if(n==="text_delta"||n==="text"){let o=r.text;if(typeof o=="string"&&o.length>0)return[{type:"text",text:o}]}return null}extractToolCallChunk(e){return!e||typeof e!="object"?null:e.type==="content_block_start"&&e.content_block?.type==="tool_use"?{id:e.content_block.id,index:e.index??0,name:e.content_block.name,args:""}:e.type==="content_block_delta"&&e.delta?.type==="input_json_delta"?{index:e.index??0,args:e.delta.partial_json||""}:null}async processStreamEvent(e,r,n,o){let i=[],a=n,s=o,u=!1,l=[];if(e?.type==="chunk"&&typeof e.chunk?.bytes=="string"){let c=this.decodeChunkBytes(e.chunk.bytes);for(let d of c){let f=this.safeJsonParse(d);if(!f){l.push(`Failed to parse inner payload: ${this.describePayload(d)}`);continue}let p=this.buildChunkMetadata(f),m=this.buildContentItemsFromDelta(f),h=this.extractToolCallChunk(f);if(h){let b=new Hr({content:"",response_metadata:p,tool_call_chunks:[h]}),_=new Mi({message:b,text:"",generationInfo:p});i.push(_),u=!0}else if(m&&m.length>0){let b=m[0]?.type==="thinking",_=b?m[0].thinking||"":m[0]?.text||"",w={};b&&_&&(w.delta={reasoning:_});let T=new Hr({content:m,response_metadata:p,...Object.keys(w).length>0?{additional_kwargs:w}:{}}),O=new Mi({message:T,text:_,generationInfo:p});i.push(O),u=!0,r&&_&&await r.handleLLMNewToken(_)}else{let b=this.extractStreamText(f);if(b){let _=new Hr({content:b,response_metadata:p}),w=new Mi({message:_,text:b,generationInfo:p});i.push(w),u=!0,r&&await r.handleLLMNewToken(b)}else if(f.type==="content_block_delta"&&f.delta?.type!=="input_json_delta"){let _=`No content in content_block_delta event: ${this.describeEvent(f)}`;l.push(_),Ce(`processStreamEvent: ${_}`)}}let y=this.extractUsage(f);y&&(a=y);let g=this.extractStopReason(f);g&&(s=g)}}else{let c=this.buildChunkMetadata(e),d=this.buildContentItemsFromDelta(e),f=this.extractToolCallChunk(e);if(f){let h=new Hr({content:"",response_metadata:c,tool_call_chunks:[f]}),y=new Mi({message:h,text:"",generationInfo:c});i.push(y),u=!0}else if(d&&d.length>0){let h=d[0]?.type==="thinking",y=h?d[0].thinking||"":d[0]?.text||"",g={};h&&y&&(g.delta={reasoning:y});let b=new Hr({content:d,response_metadata:c,...Object.keys(g).length>0?{additional_kwargs:g}:{}}),_=new Mi({message:b,text:y,generationInfo:c});i.push(_),u=!0,r&&y&&await r.handleLLMNewToken(y)}else{let h=this.extractStreamText(e);if(h){let y=new Hr({content:h,response_metadata:c}),g=new Mi({message:y,text:h,generationInfo:c});i.push(g),u=!0,r&&await r.handleLLMNewToken(h)}}let p=this.extractUsage(e);p&&(a=p);let m=this.extractStopReason(e);m&&(s=m)}return{deltaChunks:i,usage:a,stopReason:s,hasText:u,debugSummaries:l}}describeEvent(e){if(!e)return"<empty event>";let r=typeof e.type=="string"?e.type:"unknown",n=Object.keys(e).slice(0,6).join(","),o=this.stringifyForLog(e);return`${r} {${n}} -> ${o}`}describePayload(e){return e?e.length<=200?e:`${e.slice(0,200)}\u2026 (len=${e.length})`:"<empty payload>"}stringifyForLog(e){try{let r=this.sanitiseForLog(e),n=JSON.stringify(r);return n?n.length>400?`${n.slice(0,400)}\u2026 (len=${n.length})`:n:"<un-stringifiable>"}catch{return"<failed to stringify>"}}sanitiseForLog(e){if(!e||typeof e!="object")return e;if(Array.isArray(e))return e.slice(0,5).map(i=>this.sanitiseForLog(i));let r=e,n={},o=Object.entries(r);for(let i=0;i<o.length&&i<10;i+=1){let[a,s]=o[i];typeof s=="string"&&s.length>200?a==="bytes"||a==="chunk"||a==="chunk_bytes"?n[a]=`<base64 len=${s.length}>`:n[a]=`${s.slice(0,200)}\u2026 (len=${s.length})`:n[a]=this.sanitiseForLog(s)}return n}decodeChunkBytes(e){let r=this.decodeBase64ToUint8Array(e);if(!r||r.length===0)return Ce("decodeChunkBytes: Failed to decode base64 or empty bytes"),[];let n=this.findFirstNonWhitespaceByte(r);if(n===123||n===91){let a=this.decodeUtf8(r);return this.splitJsonLines(a)}let o=this.decodeEventStreamMessages(r);if(o.length>0)return o;Ce("decodeChunkBytes: EventStream decoding failed, falling back to plain UTF-8");let i=this.decodeUtf8(r);return this.splitJsonLines(i)}decodeBase64ToUint8Array(e){try{if(typeof Buffer<"u")return new Uint8Array(Buffer.from(e,"base64"));if(typeof atob=="function"){let r=atob(e),n=new Uint8Array(r.length);for(let o=0;o<r.length;o+=1)n[o]=r.charCodeAt(o);return n}return null}catch{return null}}findFirstNonWhitespaceByte(e){for(let r=0;r<e.length;r+=1){let n=e[r];if(n!==void 0&&!this.isWhitespaceByte(n))return n}return null}isWhitespaceByte(e){return e===9||e===10||e===13||e===32}decodeUtf8(e){return e.length===0?"":typeof TextDecoder<"u"?new TextDecoder().decode(e):typeof Buffer<"u"?Buffer.from(e).toString("utf-8"):""}splitJsonLines(e){return e?e.split(`
`).map(r=>r.trim()).filter(r=>r.length>0):[]}parseEventStreamBuffer(e){let r=[];if(e.length<12)return{messages:r,remainingBytes:e};let n=new DataView(e.buffer,e.byteOffset,e.byteLength),o=0;for(;o+12<=e.length;){let a=n.getUint32(o,!1),s=n.getUint32(o+4,!1);if(o+a>e.length)break;if(a<=0||s<0||s+12>a){Ce(`parseEventStreamBuffer: Invalid message structure at offset ${o}: totalLength=${a}, headersLength=${s}`);break}let u=o+12+s,l=o+a-4;if(u>l||l>e.length){Ce(`parseEventStreamBuffer: Invalid payload bounds at offset ${o}`);break}if(u<e.length){let c=e.subarray(u,l),d=this.decodeUtf8(c).trim();d.length>0&&r.push(d)}if(o+=a,a===0)break}let i=o<e.length?e.subarray(o):new Uint8Array(0);return{messages:r,remainingBytes:i}}decodeEventStreamMessages(e){let{messages:r}=this.parseEventStreamBuffer(e);return r}buildChunkMetadata(e){let r={provider:"amazon-bedrock"};typeof e?.type=="string"&&(r.event_type=e.type),e?.index!==void 0&&(r.event_index=e.index);let n=this.extractStopReason(e);n&&(r.stop_reason=n);let o=this.extractUsage(e);return o&&(r.usage=o),r}extractStreamText(e){if(!e||typeof e!="object")return null;let r=[e.delta?.thinking,e.content_block_delta?.delta?.thinking,e.contentBlockDelta?.delta?.thinking,e.delta?.reasoning_content,e.reasoning_content];for(let i of r)if(typeof i=="string"&&i.length>0)return i;let n=[e.text,e.outputText,e.completion,e.resultText,e.delta];for(let i of n)if(typeof i=="string"&&i.length>0)return i;let o=[e.delta?.text,e.delta?.output_text,e.delta?.content,e.contentBlockDelta?.delta?.text,e.contentBlockDelta?.delta?.output_text,e.contentBlockDelta?.delta?.content,e.content_block_delta?.delta?.text,e.content_block_delta?.delta?.output_text,e.content_block_delta?.delta?.content,e.message?.content,e.messageStop?.message?.content,e.message_stop?.message?.content,e.content];for(let i of o){let a=this.extractTextFromCandidate(i);if(a)return a}return null}extractTextFromCandidate(e){if(!e)return null;if(typeof e=="string")return e.length>0?e:null;if(Array.isArray(e)){let r=e.map(n=>{if(typeof n=="string")return n;if(n&&typeof n=="object"){if(typeof n.text=="string")return n.text;if(typeof n.value=="string")return n.value;if(Array.isArray(n.content))return n.content.map(o=>typeof o?.text=="string"?o.text:"").join("")}return""}).join("");return r.length>0?r:null}if(typeof e=="object"){let r=e;if(typeof r.text=="string")return r.text.length>0?r.text:null;if(r.text&&typeof r.text=="object"){let n=this.extractTextFromCandidate(r.text);if(n)return n}if(typeof r.value=="string")return r.value.length>0?r.value:null;if(Array.isArray(r.content))return this.extractTextFromCandidate(r.content);if(r.delta){let n=this.extractTextFromCandidate(r.delta);if(n)return n}if(r.message&&typeof r.message=="object"){let n=this.extractTextFromCandidate(r.message);if(n)return n}}return null}extractUsage(e){if(!(!e||typeof e!="object")){if(e.usage&&typeof e.usage=="object")return e.usage;if(e.metrics&&typeof e.metrics=="object")return e.metrics;if(e["amazon-bedrock-invocationMetrics"]&&typeof e["amazon-bedrock-invocationMetrics"]=="object")return e["amazon-bedrock-invocationMetrics"];if(e.messageStop&&typeof e.messageStop=="object")return this.extractUsage(e.messageStop);if(e.message_stop&&typeof e.message_stop=="object")return this.extractUsage(e.message_stop)}}extractStopReason(e){if(!e||typeof e!="object")return;let r=e.stop_reason||e.stopReason||e.completionReason||e.completion_reason||e.reason||e.messageStop?.stopReason||e.message_stop?.stop_reason||(e.type==="message_stop"?e.reason:void 0);return typeof r=="string"?r:void 0}buildTerminalMetadataChunk(e,r){let n=r?this.normaliseUsageMetadata(r):void 0,o={provider:"amazon-bedrock"};e&&(o.stop_reason=e),r&&(o.usage=r);let i=new Hr({content:"",response_metadata:o,usage_metadata:n});return new Mi({message:i,text:"",generationInfo:o})}normaliseUsageMetadata(e){let r=this.coerceNumber(e.inputTokens)??this.coerceNumber(e.input_tokens)??this.coerceNumber(e.inputTokenCount)??this.coerceNumber(e.promptTokens)??this.coerceNumber(e.prompt_tokens)??0,n=this.coerceNumber(e.outputTokens)??this.coerceNumber(e.output_tokens)??this.coerceNumber(e.outputTokenCount)??this.coerceNumber(e.completionTokens)??this.coerceNumber(e.completion_tokens)??0,o=this.coerceNumber(e.totalTokens)??this.coerceNumber(e.total_tokens)??r+n;return{input_tokens:r,output_tokens:n,total_tokens:o}}coerceNumber(e){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){let r=Number(e);return Number.isFinite(r)?r:void 0}}convertImageContent(e){try{let r=e.match(/^data:([^;]+);base64,(.+)$/);if(!r)return null;let[,n,o]=r;return!n||!o||!n.startsWith("image/")?null:{type:"image",source:{type:"base64",media_type:n,data:o}}}catch(r){return ie("Error converting image content:",r),null}}buildRequestBody(e,r){let n=[],o=[];e.forEach(l=>{let c=l._getType();if(c==="system"){let p=this.normaliseMessageContent(l),m=typeof p=="string"?p:"";m&&o.push(m);return}if(c==="tool"){let p=l,m=typeof p.content=="string"?p.content:JSON.stringify(p.content);n.push({role:"user",content:[{type:"tool_result",tool_use_id:p.tool_call_id,content:m}]});return}if(c==="ai"){let m=l.tool_calls;if(m&&m.length>0){let h=[],y=this.normaliseMessageContent(l);typeof y=="string"&&y&&h.push({type:"text",text:y});for(let g of m)h.push({type:"tool_use",id:g.id||`tool_${Date.now()}`,name:g.name,input:g.args});h.length>0&&n.push({role:"assistant",content:h});return}}let d=this.normaliseMessageContent(l);if(!d)return;let f=[];if(typeof d=="string")f.push({type:"text",text:d});else if(Array.isArray(d))for(let p of d)if(p.type==="text"&&typeof p.text=="string")f.push({type:"text",text:p.text});else if(p.type==="image_url"&&p.image_url?.url){let m=this.convertImageContent(p.image_url.url);m&&f.push(m)}else p.type==="image"&&p.source&&f.push(p);f.length>0&&n.push({role:c==="ai"?"assistant":"user",content:f})});let i=r?.maxTokens??this.defaultMaxTokens,a=r?.temperature??this.defaultTemperature,s=r?.topP??this.defaultTopP,u={messages:n};return this.boundTools&&this.boundTools.length>0&&(u.tools=this.convertToolsToClaude(this.boundTools)),o.length>0&&(u.system=o.join(`

`)),i!==void 0&&(u.max_tokens=i),this.anthropicVersion&&(u.anthropic_version=this.anthropicVersion),this.enableThinking?(u.thinking=(m=>m&&parseInt(m[1],10)>=7?{type:"adaptive"}:{type:"enabled",budget_tokens:2048})(String(this.modelName||"").match(/claude-opus-4-(\d+)/)),u.temperature=1,F("[BedrockChatModel] Enabled thinking mode for Claude model with temperature=1")):a!==void 0&&(u.temperature=a),s!==void 0&&(u.top_p=s),u}normaliseMessageContent(e){let{content:r}=e;return typeof r=="string"?r:Array.isArray(r)?r.some(o=>typeof o=="object"&&o!==null&&(o.type==="image_url"||o.type==="image"))?r.map(o=>{if(typeof o=="string")return{type:"text",text:o};if(typeof o=="object"&&o!==null){if(o.type==="text"||o.type==="image_url"||o.type==="image")return o;if("text"in o&&typeof o.text=="string")return{type:"text",text:o.text};if("content"in o&&typeof o.content=="string")return{type:"text",text:o.content}}return null}).filter(o=>o!==null):r.map(o=>{if(typeof o=="string")return o;if(typeof o=="object"&&o!==null){if("text"in o&&typeof o.text=="string")return o.text;if("content"in o&&typeof o.content=="string")return o.content}return""}).join(""):typeof r=="object"&&r!==null&&"text"in r?r.text??"":""}extractText(e){return typeof e?.outputText=="string"?e.outputText:Array.isArray(e?.content)?e.content.map(r=>{if(!r)return"";if(typeof r=="string")return r;if(typeof r=="object"){if(typeof r.text=="string")return r.text;if(r.text&&typeof r.text=="object"&&"text"in r.text)return r.text.text??""}return""}).join(""):typeof e?.completion=="string"?e.completion:typeof e?.resultText=="string"?e.resultText:""}}});function rmt(t){return t instanceof B0||t instanceof Error&&t.name==="AuthCancelledError"}var B0,nmt=v(()=>{B0=class t extends Error{constructor(r="Authentication cancelled by user."){super(r);this.name="AuthCancelledError";Object.setPrototypeOf(this,t.prototype)}}});var rle,Czr,BQo,UQo,zQo,omt,VQo,HQo,xzr,WQo,g$,nDe=v(()=>{Qe();BC();rle=require("obsidian");nmt();Czr="Iv1.b507a08c87ecfe98",BQo="https://github.com/login/device/code",UQo="https://github.com/login/oauth/access_token",zQo="https://api.github.com/copilot_internal/v2/token",omt="https://api.githubcopilot.com",VQo=`${omt}/models`,HQo=60*1e3,xzr=60*60*1e3,WQo=3,g$=class t{constructor(){this.abortController=null;this.refreshPromise=null;this.refreshAttempts=0;this.modelPolicyTermsCache=new Map;this.authGeneration=0}static getInstance(){return t.instance||(t.instance=new t),t.instance}getAuthState(){let e=ee(),r=!!e.githubCopilotAccessToken,n=!!e.githubCopilotToken,o=e.githubCopilotTokenExpiresAt,a=!(typeof o=="number"&&o>0)||o<Date.now();return n&&!a||n&&r?{status:"authenticated"}:r?{status:"pending"}:{status:"idle"}}isAuthenticated(){return this.getAuthState().status==="authenticated"}async startDeviceCodeFlow(){let e=new URLSearchParams({client_id:Czr,scope:"read:user"}).toString(),r=await(0,rle.requestUrl)({url:BQo,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:e,throw:!1}),n=this.getRequestUrlJson(r);if(r.status!==200){let i=typeof n.error_description=="string"?n.error_description:typeof n.error=="string"?n.error:"";throw new Error(i?`Failed to get device code: ${i}`:`Failed to get device code: ${r.status}`)}if(typeof n.device_code!="string"||typeof n.user_code!="string"||typeof n.expires_in!="number")throw new Error("Invalid device code response from GitHub");let o=typeof n.verification_uri=="string"?n.verification_uri:typeof n.verification_uri_complete=="string"?n.verification_uri_complete:null;if(!o)throw new Error("Invalid device code response from GitHub: missing verification URI");return{deviceCode:n.device_code,userCode:n.user_code,verificationUri:o,expiresIn:n.expires_in,interval:typeof n.interval=="number"&&n.interval>0?n.interval:5}}async pollForAccessToken(e,r,n,o){let i=this.authGeneration;this.abortPolling();let a=new AbortController;this.abortController=a;let s=Date.now()+n*1e3,u=0;try{for(;Date.now()<s;){if(a.signal.aborted||this.authGeneration!==i)throw new B0;if(u++,o?.(u),await this.delay(r*1e3,a.signal),a.signal.aborted||this.authGeneration!==i)throw new B0;let l=new URLSearchParams({client_id:Czr,device_code:e,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}).toString(),c=await(0,rle.requestUrl)({url:UQo,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:l,throw:!1});if(a.signal.aborted||this.authGeneration!==i)throw new B0;let d=this.getRequestUrlJson(c);if(c.status!==200){let f=typeof d.error_description=="string"?d.error_description:typeof d.error=="string"?d.error:`HTTP ${c.status}`;throw new Error(`Token request failed: ${f}`)}if(typeof d.access_token=="string"&&d.access_token){if(a.signal.aborted||this.authGeneration!==i)throw new B0;return A_({githubCopilotAccessToken:d.access_token}),d.access_token}if(d.error!=="authorization_pending"){if(d.error==="slow_down"){r+=5;continue}if(d.error==="device_code_expired"||d.error==="expired_token")throw new Error("Device code expired. Please restart authentication.");if(d.error==="access_denied")throw new Error("Authorization denied by user.");if(typeof d.error=="string"&&d.error)throw new Error(typeof d.error_description=="string"&&d.error_description?d.error_description:d.error)}}throw new Error("Device code expired. Please restart authentication.")}finally{this.abortController===a&&(this.abortController=null)}}async fetchCopilotToken(e){let r=this.authGeneration,n=e||ee().githubCopilotAccessToken;if(!n)throw new Error("No GitHub access token available");n=await kn(n);let o=await(0,rle.requestUrl)({url:zQo,method:"GET",headers:{Authorization:`Bearer ${n}`,Accept:"application/json"},throw:!1});if(this.authGeneration!==r)throw new B0("Authentication was reset during token refresh.");let i=this.getRequestUrlJson(o);if(o.status!==200){let u=typeof i.message=="string"?i.message:typeof i.error=="string"?i.error:"";throw new Error(u?`Failed to get Copilot token: ${o.status} (${u})`:`Failed to get Copilot token: ${o.status}`)}let a=i.token;if(!a||typeof a!="string")throw new Error("Invalid response from Copilot API: missing or invalid token");let s=this.parseCopilotTokenExpiresAt(i);if(this.authGeneration!==r)throw new B0("Authentication was reset during token refresh.");return A_({githubCopilotToken:a,githubCopilotTokenExpiresAt:s}),a}async getValidCopilotToken(){let e=ee(),r=e.githubCopilotTokenExpiresAt,o=!(typeof r=="number"&&r>0)||r<Date.now()+HQo;if(e.githubCopilotToken&&!o)return this.refreshAttempts=0,await kn(e.githubCopilotToken);if(!e.githubCopilotAccessToken)throw new Error("Not authenticated with GitHub Copilot. Please set up authentication first.");if(this.refreshAttempts>=WQo)throw this.refreshAttempts=0,new Error("Failed to refresh Copilot token after multiple attempts. Please try reconnecting.");return this.refreshPromise?this.refreshPromise:(this.refreshAttempts++,this.refreshPromise=this.fetchCopilotToken().finally(()=>{this.refreshPromise=null}),this.refreshPromise)}buildCopilotHeaders(e){return{"Content-Type":"application/json",Authorization:`Bearer ${e}`,"User-Agent":"GitHubCopilotChat/0.38.2026022001","Editor-Version":"vscode/1.110.0","Editor-Plugin-Version":"copilot-chat/0.38.2026022001","Copilot-Integration-Id":"vscode-chat","Openai-Intent":"conversation-panel","X-GitHub-Api-Version":"2025-05-01"}}abortPolling(){this.abortController&&(this.abortController.abort(),this.abortController=null)}resetAuth(){this.authGeneration++,this.abortPolling(),this.refreshPromise=null,this.refreshAttempts=0,this.modelPolicyTermsCache.clear(),A_({githubCopilotAccessToken:"",githubCopilotToken:"",githubCopilotTokenExpiresAt:0})}async listModels(){let e=async i=>await(0,rle.requestUrl)({url:VQo,method:"GET",headers:{...this.buildCopilotHeaders(i),Accept:"application/json","Openai-Intent":"model-access"},throw:!1}),r=await this.getValidCopilotToken(),n=await e(r);if(n.status===401&&(this.clearCopilotToken(),r=await this.getValidCopilotToken(),n=await e(r)),n.status!==200)throw new Error(`Failed to list models: ${n.status}`);let o=this.getRequestUrlJson(n);return this.modelPolicyTermsCache.clear(),o.data?.forEach(i=>{i.policy?.terms&&this.modelPolicyTermsCache.set(i.id,i.policy.terms)}),o}getPolicyTerms(e){return this.modelPolicyTermsCache.get(e)}clearCopilotToken(){A_({githubCopilotToken:"",githubCopilotTokenExpiresAt:0})}buildCopilotRequestHeaders(e){return this.buildCopilotHeaders(e)}invalidateCopilotToken(){this.clearCopilotToken()}getRequestUrlJson(e){if(typeof e.json=="string")try{return JSON.parse(e.json)}catch{return e.json}return e.json}parseCopilotTokenExpiresAt(e){if(!e||typeof e!="object")return Date.now()+xzr;let r=e,n=this.parseExpiresAtValue(r.expires_at);if(n!==null)return n;let o=r.expires_in,i=typeof o=="number"?o:typeof o=="string"?Number(o):Number.NaN;return Number.isFinite(i)&&i>0?Date.now()+i*1e3:Date.now()+xzr}parseExpiresAtValue(e){if(typeof e=="number")return!Number.isFinite(e)||e<=0?null:e>1e12?e:e*1e3;if(typeof e=="string"){let r=e.trim();if(!r)return null;let n=Number(r);if(Number.isFinite(n)&&n>0)return n>1e12?n:n*1e3;let o=Date.parse(r);if(!Number.isNaN(o)&&o>0)return o}return null}delay(e,r){return r?r.aborted?Promise.reject(new B0):new Promise((n,o)=>{let i=()=>{clearTimeout(a),o(new B0)},a=setTimeout(()=>{r.removeEventListener("abort",i),n()},e);r.addEventListener("abort",i,{once:!0})}):new Promise(n=>setTimeout(n,e))}}});function KQo(t){return typeof t=="string"?t:t==null?"":Array.isArray(t)?t.map(e=>typeof e=="string"?e:e&&typeof e=="object"&&typeof e.text=="string"?e.text:"").join(""):typeof t=="object"&&typeof t.text=="string"?t.text:""}var JQo,oDe,Tzr=v(()=>{CD();nDe();Dt();JQo=4;oDe=class t extends iA{constructor(r){let{fetchImplementation:n,configuration:o,apiKey:i,...a}=r,s=g$.getInstance(),u=n??o?.fetch??fetch,l=t.buildAuthedFetch(s,u);super({...a,apiKey:i||"copilot-dynamic-token",streamUsage:!1,configuration:{...o??{},baseURL:o?.baseURL??omt,fetch:l}});this.lc_serializable=!1;this.lc_namespace=["langchain","chat_models","github_copilot"]}static buildAuthedFetch(r,n){return async(o,i={})=>{let a=typeof o=="string"?o:typeof Request<"u"&&o instanceof Request?o.url:o.toString(),s=async c=>{let d=r.buildCopilotRequestHeaders(c),f=new Headers(i.headers);for(let[p,m]of Object.entries(d))f.set(p,m);return n(a,{...i,headers:f})},u=await r.getValidCopilotToken(),l=await s(u);if(l.status===401){try{await l.body?.cancel()}catch{}r.invalidateCopilotToken(),u=await r.getValidCopilotToken(),l=await s(u)}return l}}_llmType(){return"github-copilot"}_convertCompletionsDeltaToBaseMessageChunk(r,n,o){return!r.role&&!o&&(o="assistant"),r.content=KQo(r.content),super._convertCompletionsDeltaToBaseMessageChunk(r,n,o)}async getNumTokens(r){let n=tF(r);return n?Math.ceil(n.length/JQo):0}}});var imt={};En(imt,{default:()=>U0,normalizeAzureUrl:()=>Ezr});function Ezr(t){if(!t)return{baseUrl:void 0,apiVersion:void 0};let e;try{e=new URL(t)}catch{return{baseUrl:t,apiVersion:void 0}}let r=e.searchParams.get("api-version")||void 0;e.search="";let n=e.toString().replace(/\/+$/,"");return n=n.replace(/\/(chat\/completions|embeddings)$/,""),{baseUrl:n,apiVersion:r}}var Ozr,GQo,pd,U0,LW=v(()=>{na();gr();BC();Xe();id();Qe();Dt();uie();Hvr();att();rv();Jvr();btt();wwr();oUr();Dtt();CD();aUr();OS();Ozr=require("obsidian");vzr();wzr();Szr();Tzr();sV.prototype.getNumTokens=async t=>{let e=typeof t=="string"?t:t.map(r=>typeof r=="string"?r:r.text??"").join("");return Math.ceil(e.length/4)};GQo={openai:Px,"azure openai":Px,anthropic:tut,cohereai:ott,google:gtt,xai:Oft,openrouterai:fX,ollama:Att,"lm-studio":fX,groq:Rut,"3rd party (openai-format)":Px,siliconflow:Px,"copilot-plus":fX,mistralai:Tft,deepseek:rut,"amazon-bedrock":rDe,"github-copilot":oDe};pd=class pd{constructor(){this.providerApiKeyMap={openai:()=>ee().openAIApiKey,google:()=>ee().googleApiKey,"azure openai":()=>ee().azureOpenAIApiKey,anthropic:()=>ee().anthropicApiKey,cohereai:()=>ee().cohereApiKey,openrouterai:()=>ee().openRouterAiApiKey,groq:()=>ee().groqApiKey,xai:()=>ee().xaiApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>ee().plusLicenseKey,mistralai:()=>ee().mistralApiKey,deepseek:()=>ee().deepseekApiKey,"amazon-bedrock":()=>ee().amazonBedrockApiKey,siliconflow:()=>ee().siliconflowApiKey,"github-copilot":()=>ee().githubCopilotToken||ee().githubCopilotAccessToken};this.buildModelMap(),ml(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return pd.instance||(pd.instance=new pd),pd.instance}getTemperatureForModel(e,r,n){if(!e.isThinkingEnabled)return e.isOSeries||e.isGPT5?pd.REASONING_MODEL_TEMPERATURE:r.temperature??n.temperature}async getModelConfig(e){let r=ee(),n=e.name,o=kJ(n),{isThinkingEnabled:i}=o,a=this.getTemperatureForModel(o,e,r),s=e.maxTokens??r.maxTokens,u={modelName:n,streaming:e.stream??!0,maxRetries:3,maxConcurrency:3,enableCors:e.enableCors,...!i&&a!==void 0?{temperature:a}:{}},c={openai:{modelName:n,apiKey:await kn(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?hl:void 0,organization:await kn(e.openAIOrgId||r.openAIOrgId)},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},anthropic:{anthropicApiKey:await kn(e.apiKey||r.anthropicApiKey),model:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?hl:void 0},...i&&{thinking:{type:"enabled",budget_tokens:pd.ANTHROPIC_THINKING_BUDGET_TOKENS}}},"azure openai":await(async()=>{let m=Ezr(e.baseUrl);return{modelName:e.baseUrl?n:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,apiKey:await kn(e.apiKey||r.azureOpenAIApiKey),configuration:{baseURL:m.baseUrl||`https://${e.azureOpenAIApiInstanceName||r.azureOpenAIApiInstanceName}.openai.azure.com/openai/deployments/${e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName}`,defaultQuery:{"api-version":m.apiVersion||e.azureOpenAIApiVersion||r.azureOpenAIApiVersion||"2024-05-01-preview"},defaultHeaders:{"Content-Type":"application/json","api-key":await kn(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?hl:void 0},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)}})(),cohereai:{apiKey:await kn(e.apiKey||r.cohereApiKey),model:n},google:{apiKey:await kn(e.apiKey||r.googleApiKey),model:n,safetySettings:[{category:dV.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:fV.BLOCK_NONE},{category:dV.HARM_CATEGORY_HATE_SPEECH,threshold:fV.BLOCK_NONE},{category:dV.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:fV.BLOCK_NONE},{category:dV.HARM_CATEGORY_HARASSMENT,threshold:fV.BLOCK_NONE}],baseUrl:e.baseUrl},xai:{apiKey:await kn(e.apiKey||r.xaiApiKey),model:n},openrouterai:{modelName:n,apiKey:await kn(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?hl:void 0,defaultHeaders:{"HTTP-Referer":"https://obsidiancopilot.com","X-Title":"Obsidian Copilot"}},enableReasoning:e.capabilities?.includes("reasoning")??!1,reasoningEffort:e.capabilities?.includes("reasoning")&&e.reasoningEffort?e.reasoningEffort:void 0,enablePromptCaching:e.enablePromptCaching??!0},groq:{apiKey:await kn(e.apiKey||r.groqApiKey),model:n},ollama:{model:n,baseUrl:e.baseUrl||"http://localhost:11434",headers:{Authorization:`Bearer ${await kn(e.apiKey||"default-key")}`},think:e.capabilities?.includes("reasoning")??!1,repeatPenalty:1.1,numCtx:e.numCtx??UJ},"lm-studio":{modelName:n,apiKey:e.apiKey||"default-key",streamUsage:e.streamUsage??!1,configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?hl:void 0},enableReasoning:e.capabilities?.includes("reasoning")??!1,reasoningEffort:e.capabilities?.includes("reasoning")&&e.reasoningEffort?e.reasoningEffort:void 0},"3rd party (openai-format)":{modelName:n,apiKey:await kn(e.apiKey||r.openAIApiKey),streamUsage:e.streamUsage??!1,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?hl:void 0,defaultHeaders:{"dangerously-allow-browser":"true"}},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},siliconflow:{modelName:n,apiKey:await kn(e.apiKey||r.siliconflowApiKey),configuration:{baseURL:e.baseUrl||qC.siliconflow.host,fetch:e.enableCors?hl:void 0},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},"copilot-plus":{modelName:n,apiKey:await kn(r.plusLicenseKey),configuration:{baseURL:i1,fetch:hl}},mistralai:{model:n,apiKey:await kn(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl},deepseek:{modelName:n,apiKey:await kn(e.apiKey||r.deepseekApiKey),configuration:{baseURL:e.baseUrl||qC.deepseek.host,fetch:e.enableCors?hl:void 0}},"amazon-bedrock":{},"github-copilot":{modelName:n,fetchImplementation:e.enableCors?Rge:void 0}}[e.provider]||{};e.provider==="amazon-bedrock"&&(c=await this.buildBedrockConfig(e,n,r,s,a));let d=this.getProviderSpecificParams(e.provider,e);return{...u,...c,...d,...{maxTokens:s}}}getOpenAISpecialConfig(e,r,n,o){let i=ee(),a=kJ(e),s=this.getTemperatureForModel(a,o||{},i),u={maxTokens:r,temperature:s};if((a.isOSeries||a.isGPT5)&&o?.reasoningEffort&&(u.reasoning={effort:o.reasoningEffort},a.isGPT5&&o?.verbosity&&o?.provider!=="azure openai")){let l=o.verbosity;u.text={verbosity:l}}return u}async buildBedrockConfig(e,r,n,o,i){let a=e.apiKey||n.amazonBedrockApiKey;if(!a)throw new Error("Amazon Bedrock API key is not configured. Provide a key in Settings > API Keys or the model definition.");let s=await kn(a),u=e.bedrockRegion?.trim(),l=n.amazonBedrockRegion?.trim(),c=u||l||"us-east-1",d=e.baseUrl?.trim(),p=(d?d.replace(/\/+$/,""):void 0)||`https://bedrock-runtime.${c}.amazonaws.com`,m=encodeURIComponent(r),h=`${p}/model/${m}/invoke`,y=`${p}/model/${m}/invoke-with-response-stream`,g=e.enableCors?hl:void 0,_=/(^|\.)anthropic\./.test(r)?"bedrock-2023-05-31":void 0,w=e.capabilities?.includes("reasoning")??!1;return{modelName:r,modelId:r,apiKey:s,endpoint:h,streamEndpoint:y,defaultMaxTokens:o,defaultTemperature:i,defaultTopP:e.topP,anthropicVersion:_,enableThinking:w,fetchImplementation:g,streaming:e.stream??!0}}getProviderSpecificParams(e,r){let n={};return r.topP!==void 0&&["openai","azure openai","anthropic","google","openrouterai","ollama","lm-studio","3rd party (openai-format)","mistralai","deepseek","siliconflow"].includes(e)&&(n.topP=r.topP),r.frequencyPenalty!==void 0&&["openai","azure openai","openrouterai","ollama","lm-studio","3rd party (openai-format)","mistralai","deepseek","siliconflow"].includes(e)&&(n.frequencyPenalty=r.frequencyPenalty),n}buildModelMap(){let e=ee().activeModels;pd.modelMap={};let r=pd.modelMap;(e??aO).forEach(o=>{if(o.enabled){if(!Object.values(Mb).contains(o.provider)){console.warn(`Unknown provider: ${o.provider} for model: ${o.name}`);return}let i=this.getProviderConstructor(o),a=this.hasProviderCredentials(o),s=no(o);r[s]={hasApiKey:a,AIConstructor:i,vendor:o.provider}}})}hasProviderCredentials(e){if(e.provider==="amazon-bedrock"){let n=ee();return!!(e.apiKey||n.amazonBedrockApiKey)}let r=this.providerApiKeyMap[e.provider];return r?!!(e.apiKey||r()):!!e.apiKey}getProviderConstructor(e){let r=GQo[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(!pd.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return pd.chatModel}isModelConfigValid(e,r){let n=no(e),o=pd.modelMap[n];return!(!o||!o.hasApiKey||e.plusExclusive&&!Dbr())}resolveModelForTemperatureOverride(){let e=ee();try{let r=j_();if(r){let n=PS(r,e.activeModels);if(this.isModelConfigValid(n,e))return n}}catch{}for(let r of e.activeModels)if(r.enabled&&!r.believerExclusive&&this.isModelConfigValid(r,e))return r;throw new Error("No valid chat model available for temperature override. Please check your API key settings and ensure at least one model is properly configured.")}async getChatModelWithTemperature(e){let n={...this.resolveModelForTemperatureOverride(),temperature:e};return await this.createModelInstance(n)}async setChatModel(e){try{let r=await this.createModelInstance(e);pd.chatModel=r,kJ(e.name).isGPT5&&(e.provider==="openai"||e.provider==="3rd party (openai-format)")&&F(`Chat model set with Responses API for GPT-5: ${e.name}`)}catch(r){throw ie(r),r}}async createModelInstance(e){let r=no(e),n=pd.modelMap[r];if(!n)throw new Error(`No model found for: ${r}`);if(!n.hasApiKey){let u=`API key is not provided for the model: ${r}.`;throw e.provider==="copilot-plus"?new y4("Copilot Plus license key is not configured. Please enter your license key in the Copilot Plus section at the top of Basic Settings."):new nte(u)}let o=await this.getModelConfig(e),i=kJ(e.name),a={...o};if(i.isGPT5&&(n.vendor==="openai"||n.vendor==="3rd party (openai-format)")&&(a.useResponsesApi=!0,F(`Enabling Responses API for GPT-5 model: ${e.name} (${n.vendor})`)),e.provider==="lm-studio"&&e.useResponsesApi!==!1){let u=new tle(a);return F(`[ChatModelManager] Using Responses API for LM Studio model: ${e.name}`),u}return new n.AIConstructor(a)}validateChatModel(e){return e!=null}estimateTokens(e){return e?Math.ceil(e.length/4):0}async countTokens(e){return pd.chatModel?.getNumTokens(e)??this.estimateTokens(e)}validateCurrentModel(){if(!pd.chatModel)return;let e=j_();if(!e)return;pd.modelMap[e]?.hasApiKey||(pd.chatModel=null,F("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=kJ(e.name),f={maxTokens:c.isThinkingEnabled?4096:30},p={...l,...f};c.isGPT5&&(e.provider==="openai"||e.provider==="3rd party (openai-format)")&&(p.useResponsesApi=!0),await(e.provider==="lm-studio"&&e.useResponsesApi!==!1?new tle(p):new(this.getProviderConstructor(o))(p)).invoke([{role:"user",content:"hello"}],{timeout:8e3})};try{return await r(!1),!0}catch(n){console.log("First ping attempt failed, trying with CORS...");try{return await r(!0),new Ozr.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: `+Wr(n)+`
with CORS Error: `+Wr(o);throw new Error(i)}}}findModelByName(e){return ee().activeModels.find(n=>n.name===e)}};pd.ANTHROPIC_THINKING_BUDGET_TOKENS=2048,pd.REASONING_MODEL_TEMPERATURE=1;U0=pd});var umt={};En(umt,{TieredLexicalRetriever:()=>Yx});async function XQo(){try{if(!amt){let e=await Promise.resolve().then(()=>(LW(),imt));amt=()=>e.default.getInstance()}return amt().getChatModel()}catch{return null}}var smt,amt,Yx,pX=v(()=>{Xe();Qe();Dt();OD();o9();smt=require("obsidian");oae();cH();amt=null;Yx=class extends fA{constructor(r,n){super();this.app=r;this.options=n;this.lc_namespace=["tiered_lexical_retriever"];this.lastQueryExpansion=null;this.searchCore=new OEe(r,XQo),this.chunkManager=lq(r)}getLastQueryExpansion(){return this.lastQueryExpansion}async getRelevantDocuments(r,n){try{let i=ES(r,this.app.vault).map(f=>f.basename),a=[...new Set([...this.options.salientTerms,...i])];ee().debug&&F("TieredLexicalRetriever: Starting search",{query:r,salientTerms:a,maxK:this.options.maxK});let s=ee(),u=await this.searchCore.retrieve(r,{maxResults:this.options.maxK,salientTerms:a,enableLexicalBoosts:s.enableLexicalBoosts,preExpandedQuery:this.options.preExpandedQuery}),l=u.results;this.lastQueryExpansion=u.queryExpansion;let c=await this.convertToDocuments(l),d=this.sortResults(c);return ee().debug&&F("TieredLexicalRetriever: Search complete",{totalResults:d.length,searchResults:l.length}),d}catch(o){return Ce("TieredLexicalRetriever: Error during search",o),[]}}async convertToDocuments(r){let n=[];for(let o of r)try{if(o.id.includes("#")){let[a]=o.id.split("#"),s=this.app.vault.getAbstractFileByPath(a);if(!s||!(s instanceof smt.TFile))continue;let u="",l=this.chunkManager;if(typeof l.getChunkText=="function"?u=await l.getChunkText(o.id):typeof l.getChunkTextSync=="function"&&(u=l.getChunkTextSync(o.id)||""),!u)continue;let c=this.app.metadataCache.getFileCache(s);n.push(new Yl({pageContent:u,metadata:{path:a,chunkId:o.id,title:s.basename,mtime:s.stat.mtime,ctime:s.stat.ctime,tags:c?.tags?.map(d=>d.tag)||[],score:o.score,rerank_score:o.score,engine:o.engine||"chunk-v3",includeInContext:o.score>(this.options.minSimilarityScore||.1),explanation:o.explanation,isChunk:!0}}))}else{let a=this.app.vault.getAbstractFileByPath(o.id);if(!a||!(a instanceof smt.TFile))continue;let s=await this.app.vault.cachedRead(a);if(!s)continue;let u=this.app.metadataCache.getFileCache(a);n.push(new Yl({pageContent:s,metadata:{path:o.id,title:a.basename,mtime:a.stat.mtime,ctime:a.stat.ctime,tags:u?.tags?.map(l=>l.tag)||[],score:o.score,rerank_score:o.score,engine:o.engine||"v3",includeInContext:o.score>(this.options.minSimilarityScore||.1),explanation:o.explanation,isChunk:!1}}))}}catch(i){Ce(`TieredLexicalRetriever: Failed to convert result ${o.id}`,i)}return F(`TieredLexicalRetriever: Converted ${n.length} results to Documents`),n}sortResults(r){return r.sort((n,o)=>{let i=n.metadata.score||0,s=(o.metadata.score||0)-i;if(Math.abs(s)>.01)return s;if(n.metadata.isChunk&&o.metadata.isChunk&&n.metadata.path===o.metadata.path){let u=parseInt(n.metadata.chunkId?.split("#")[1]||"0"),l=parseInt(o.metadata.chunkId?.split("#")[1]||"0");return u-l}return s})}}});var Pzr={};En(Pzr,{MergedSemanticRetriever:()=>FW});var RB,FW,lmt=v(()=>{PEe();cH();pX();OD();o9();RB=class RB extends fA{constructor(r,n,o){super();this.app=r;this.options=n;this.lc_namespace=["merged_semantic_retriever"];this.originalMaxK=Math.max(1,n.maxK),this.returnAll=!!n.returnAll;let i=this.returnAll?Pl:Math.min(this.originalMaxK*2,Pl),a={...n,maxK:i,returnAll:this.returnAll};this.lexicalRetriever=new Yx(r,a);let s=this.returnAll?Pl:Math.min(this.originalMaxK*2,Pl);this.semanticRetriever=o||new hae({minSimilarityScore:n.minSimilarityScore??.1,maxK:s,salientTerms:n.salientTerms,timeRange:n.timeRange,textWeight:n.textWeight,returnAll:this.returnAll,useRerankerThreshold:n.useRerankerThreshold})}async getRelevantDocuments(r){let[n,o]=await Promise.all([this.lexicalRetriever.getRelevantDocuments(r),this.semanticRetriever.getRelevantDocuments(r)]),i=new Map;for(let u of n)this.insertResult(i,u,"lexical");for(let u of o)this.insertResult(i,u,"semantic");let a=Array.from(i.values()).sort((u,l)=>(l.metadata?.score??0)-(u.metadata?.score??0)),s=this.returnAll?Pl:this.originalMaxK;return a.slice(0,s)}insertResult(r,n,o){let i=this.getDocumentKey(n),a=this.decorateDocument(n,o),s=r.get(i);if(!s){r.set(i,a);return}let u=s.metadata?.source,l=this.getDocumentScore(s),c=this.getDocumentScore(a);if(o==="lexical"){(u!=="lexical"||c>l)&&r.set(i,a);return}u!=="lexical"&&c>l&&r.set(i,a)}getDocumentKey(r){let n=r.metadata??{};return n.chunkId||n.path||n.id||n.title||`${r.pageContent.slice(0,64)}::${r.pageContent.length}`}decorateDocument(r,n){let o={...r.metadata??{},source:n},i=this.extractBaseScore(o),a=n==="lexical"?RB.LEXICAL_WEIGHT:RB.SEMANTIC_WEIGHT,s=i*a;return n==="lexical"&&this.hasTagMatch(o)&&(s*=RB.TAG_MATCH_BOOST),o.score=s,o.rerank_score=s,new Yl({pageContent:r.pageContent,metadata:o})}extractBaseScore(r){let n=[r?.rerank_score,r?.score];for(let o of n)if(typeof o=="number"&&!Number.isNaN(o))return o;return 0}getDocumentScore(r){let n=r.metadata?.score;return typeof n=="number"&&!Number.isNaN(n)?n:0}hasTagMatch(r){let n=r?.explanation;if(!n)return!1;let o=n.lexicalMatches;return Array.isArray(o)?o.some(i=>i?.field==="tags"):!1}};RB.LEXICAL_WEIGHT=1,RB.SEMANTIC_WEIGHT=1,RB.TAG_MATCH_BOOST=1.1;FW=RB});var Rzr={};En(Rzr,{FilterRetriever:()=>IB});var Mzr,IB,aDe=v(()=>{Xe();Qe();Wb();Dt();OD();Mzr=require("obsidian");cH();IB=class{constructor(e,r){this.app=e;this.options=r}async getRelevantDocuments(e){if(this.options.timeRange)return this.getTimeRangeDocuments(e);let r=ES(e,this.app.vault),n=await this.getTitleMatches(r),o=await this.getTagMatches(this.resolveTagTerms(e));return this.combineGuaranteedMatches(n,o)}hasTimeRange(){return this.options.timeRange!==void 0}async getTimeRangeDocuments(e){if(!this.options.timeRange)return[];let{startTime:r,endTime:n}=this.options.timeRange,o=this.generateDailyNoteDateRange(r,n);ee().debug&&F("FilterRetriever: Generated daily note titles",{startTime:new Date(r).toISOString(),endTime:new Date(n).toISOString(),titlesCount:o.length,firstTitle:o[0],lastTitle:o[o.length-1]});let{inclusions:i,exclusions:a}=Zl(),s=o.join(", "),u=ES(s,this.app.vault).filter(g=>fu(g,i,a)),c=(await this.getTitleMatches(u)).map(g=>(g.metadata.includeInContext=!0,g)),d=this.app.vault.getMarkdownFiles().filter(g=>fu(g,i,a)),f=[],p=this.options.returnAll?Pl:Math.min(this.options.maxK,Pl);for(let g of d)if(g.stat.mtime>=r&&g.stat.mtime<=n){if(u.some(b=>b.path===g.path))continue;if(f.length>=p)break;try{let b=await this.app.vault.cachedRead(g),_=this.app.metadataCache.getFileCache(g),w=(Date.now()-g.stat.mtime)/(1e3*60*60*24),T=Math.max(.3,Math.min(1,1-w/30));f.push(new Yl({pageContent:b,metadata:{path:g.path,title:g.basename,mtime:g.stat.mtime,ctime:g.stat.ctime,tags:_?.tags?.map(O=>O.tag)||[],includeInContext:!0,score:T,rerank_score:T,source:"time-filtered"}}))}catch(b){Ce(`FilterRetriever: Failed to read file ${g.path}`,b)}}let m=new Map;for(let g of c)m.set(g.metadata.path,g);for(let g of f)m.has(g.metadata.path)||m.set(g.metadata.path,{...g,metadata:{...g.metadata,includeInContext:!0}});let h=this.options.returnAll?Pl:this.options.maxK,y=Array.from(m.values()).sort((g,b)=>{let _=g.metadata.score||0;return(b.metadata.score||0)-_}).slice(0,h);return ee().debug&&F("FilterRetriever: Time range search complete",{timeRange:this.options.timeRange,dailyNotesFound:u.length,timeFilteredDocs:f.length,totalResults:y.length}),y}resolveTagTerms(e){let r=new Set;for(let n of this.options.salientTerms??[])typeof n=="string"&&n.startsWith("#")&&r.add(n.toLowerCase());if(r.size===0)for(let n of this.extractTagsFromQuery(e))r.add(n);return Array.from(r)}extractTagsFromQuery(e){if(!e)return[];let r=null;try{r=e.match(/#[\p{L}\p{N}_/-]+/gu)}catch{r=e.match(/#[a-z0-9_/-]+/g)}if(!r)return[];let n=new Set;for(let o of r){let i=o.trim();i.length<=1||n.add(i.toLowerCase())}return Array.from(n)}generateDailyNoteDateRange(e,r){let n=[],o=new Date(e),i=new Date(r),a=365;Math.ceil((r-e)/(1e3*60*60*24))>a&&(Ce(`FilterRetriever: Date range exceeds ${a} days, limiting to recent ${a} days`),o.setTime(i.getTime()-a*24*60*60*1e3));let u=new Date(o);for(;u<=i;)n.push(`[[${u.toLocaleDateString("en-CA")}]]`),u.setDate(u.getDate()+1);return n}async getTitleMatches(e){let r=[];for(let n of e)if(!tae(n))try{let o=await this.app.vault.cachedRead(n),i=this.app.metadataCache.getFileCache(n);r.push(new Yl({pageContent:o,metadata:{path:n.path,title:n.basename,mtime:n.stat.mtime,ctime:n.stat.ctime,tags:i?.tags?.map(a=>a.tag)||[],includeInContext:!0,score:1,rerank_score:1,source:"title-match"}}))}catch(o){Ce(`FilterRetriever: Failed to read title-matched file ${n.path}`,o)}return r}async getTagMatches(e){if(e.length===0)return[];let{inclusions:r,exclusions:n}=Zl(),o=this.app.vault.getMarkdownFiles(),i=[],a=this.options.returnAll?Pl:this.options.maxK;for(let s of o){if(i.length>=a)break;if(!fu(s,r,n)||tae(s))continue;let u=this.app.metadataCache.getFileCache(s);if(!u)continue;let l=(0,Mzr.getAllTags)(u)??[];if(!(l.length===0||!l.some(d=>{let f=d.toLowerCase();return e.some(p=>f===p||f.startsWith(p+"/"))})))try{let d=await this.app.vault.cachedRead(s);i.push(new Yl({pageContent:d,metadata:{path:s.path,title:s.basename,mtime:s.stat.mtime,ctime:s.stat.ctime,tags:l,includeInContext:!0,score:1,rerank_score:1,source:"tag-match"}}))}catch(d){Ce(`FilterRetriever: Failed to read tag-matched file ${s.path}`,d)}}return i}combineGuaranteedMatches(...e){let r=new Set,n=[];for(let o of e)for(let i of o)r.has(i.metadata.path)||(r.add(i.metadata.path),n.push(i));return n}}});var Izr={};En(Izr,{mergeFilterAndSearchResults:()=>mX});function mX(t,e){let r=new Set;for(let o of t)o.metadata?.path&&r.add(o.metadata.path);let n=e.filter(o=>{let i=o.metadata?.path;return!i||!r.has(i)});return{filterResults:t,searchResults:n}}var sDe=v(()=>{});var T4r=S((Imt,Amt)=>{(function(t,e){typeof Imt=="object"&&typeof Amt<"u"?Amt.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(Imt,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 FB=S((Nmt,Dmt)=>{(function(t,e){typeof Nmt=="object"&&typeof Dmt<"u"?Dmt.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(Nmt,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,y={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(B){var k=["th","st","nd","rd"],q=B%100;return"["+B+(k[(q-20)%10]||k[q]||k[0])+"]"}},g=function(B,k,q){var Z=String(B);return!Z||Z.length>=k?B:""+Array(k+1-Z.length).join(q)+B},b={s:g,z:function(B){var k=-B.utcOffset(),q=Math.abs(k),Z=Math.floor(q/60),V=q%60;return(k<=0?"+":"-")+g(Z,2,"0")+":"+g(V,2,"0")},m:function B(k,q){if(k.date()<q.date())return-B(q,k);var Z=12*(q.year()-k.year())+(q.month()-k.month()),V=k.clone().add(Z,l),Y=q-V<0,X=k.clone().add(Z+(Y?-1:1),l);return+(-(Z+(q-V)/(Y?V-X:X-V))||0)},a:function(B){return B<0?Math.ceil(B)||0:Math.floor(B)},p:function(B){return{M:l,y:d,w:u,d:s,D:f,h:a,m:i,s:o,ms:n,Q:c}[B]||String(B||"").toLowerCase().replace(/s$/,"")},u:function(B){return B===void 0}},_="en",w={};w[_]=y;var T="$isDayjsObject",O=function(B){return B instanceof I||!(!B||!B[T])},E=function B(k,q,Z){var V;if(!k)return _;if(typeof k=="string"){var Y=k.toLowerCase();w[Y]&&(V=Y),q&&(w[Y]=q,V=Y);var X=k.split("-");if(!V&&X.length>1)return B(X[0])}else{var W=k.name;w[W]=k,V=W}return!Z&&V&&(_=V),V||!Z&&_},P=function(B,k){if(O(B))return B.clone();var q=typeof k=="object"?k:{};return q.date=B,q.args=arguments,new I(q)},R=b;R.l=E,R.i=O,R.w=function(B,k){return P(B,{locale:k.$L,utc:k.$u,x:k.$x,$offset:k.$offset})};var I=function(){function B(q){this.$L=E(q.locale,null,!0),this.parse(q),this.$x=this.$x||q.x||{},this[T]=!0}var k=B.prototype;return k.parse=function(q){this.$d=function(Z){var V=Z.date,Y=Z.utc;if(V===null)return new Date(NaN);if(R.u(V))return new Date;if(V instanceof Date)return new Date(V);if(typeof V=="string"&&!/Z$/i.test(V)){var X=V.match(m);if(X){var W=X[2]-1||0,re=(X[7]||"0").substring(0,3);return Y?new Date(Date.UTC(X[1],W,X[3]||1,X[4]||0,X[5]||0,X[6]||0,re)):new Date(X[1],W,X[3]||1,X[4]||0,X[5]||0,X[6]||0,re)}}return new Date(V)}(q),this.init()},k.init=function(){var q=this.$d;this.$y=q.getFullYear(),this.$M=q.getMonth(),this.$D=q.getDate(),this.$W=q.getDay(),this.$H=q.getHours(),this.$m=q.getMinutes(),this.$s=q.getSeconds(),this.$ms=q.getMilliseconds()},k.$utils=function(){return R},k.isValid=function(){return this.$d.toString()!==p},k.isSame=function(q,Z){var V=P(q);return this.startOf(Z)<=V&&V<=this.endOf(Z)},k.isAfter=function(q,Z){return P(q)<this.startOf(Z)},k.isBefore=function(q,Z){return this.endOf(Z)<P(q)},k.$g=function(q,Z,V){return R.u(q)?this[Z]:this.set(V,q)},k.unix=function(){return Math.floor(this.valueOf()/1e3)},k.valueOf=function(){return this.$d.getTime()},k.startOf=function(q,Z){var V=this,Y=!!R.u(Z)||Z,X=R.p(q),W=function(N,z){var H=R.w(V.$u?Date.UTC(V.$y,z,N):new Date(V.$y,z,N),V);return Y?H:H.endOf(s)},re=function(N,z){return R.w(V.toDate()[N].apply(V.toDate("s"),(Y?[0,0,0,0]:[23,59,59,999]).slice(z)),V)},ue=this.$W,le=this.$M,L=this.$D,J="set"+(this.$u?"UTC":"");switch(X){case d:return Y?W(1,0):W(31,11);case l:return Y?W(1,le):W(0,le+1);case u:var ne=this.$locale().weekStart||0,D=(ue<ne?ue+7:ue)-ne;return W(Y?L-D:L+(6-D),le);case s:case f:return re(J+"Hours",0);case a:return re(J+"Minutes",1);case i:return re(J+"Seconds",2);case o:return re(J+"Milliseconds",3);default:return this.clone()}},k.endOf=function(q){return this.startOf(q,!1)},k.$set=function(q,Z){var V,Y=R.p(q),X="set"+(this.$u?"UTC":""),W=(V={},V[s]=X+"Date",V[f]=X+"Date",V[l]=X+"Month",V[d]=X+"FullYear",V[a]=X+"Hours",V[i]=X+"Minutes",V[o]=X+"Seconds",V[n]=X+"Milliseconds",V)[Y],re=Y===s?this.$D+(Z-this.$W):Z;if(Y===l||Y===d){var ue=this.clone().set(f,1);ue.$d[W](re),ue.init(),this.$d=ue.set(f,Math.min(this.$D,ue.daysInMonth())).$d}else W&&this.$d[W](re);return this.init(),this},k.set=function(q,Z){return this.clone().$set(q,Z)},k.get=function(q){return this[R.p(q)]()},k.add=function(q,Z){var V,Y=this;q=Number(q);var X=R.p(Z),W=function(le){var L=P(Y);return R.w(L.date(L.date()+Math.round(le*q)),Y)};if(X===l)return this.set(l,this.$M+q);if(X===d)return this.set(d,this.$y+q);if(X===s)return W(1);if(X===u)return W(7);var re=(V={},V[i]=e,V[a]=r,V[o]=t,V)[X]||1,ue=this.$d.getTime()+q*re;return R.w(ue,this)},k.subtract=function(q,Z){return this.add(-1*q,Z)},k.format=function(q){var Z=this,V=this.$locale();if(!this.isValid())return V.invalidDate||p;var Y=q||"YYYY-MM-DDTHH:mm:ssZ",X=R.z(this),W=this.$H,re=this.$m,ue=this.$M,le=V.weekdays,L=V.months,J=V.meridiem,ne=function(z,H,oe,Q){return z&&(z[H]||z(Z,Y))||oe[H].slice(0,Q)},D=function(z){return R.s(W%12||12,z,"0")},N=J||function(z,H,oe){var Q=z<12?"AM":"PM";return oe?Q.toLowerCase():Q};return Y.replace(h,function(z,H){return H||function(oe){switch(oe){case"YY":return String(Z.$y).slice(-2);case"YYYY":return R.s(Z.$y,4,"0");case"M":return ue+1;case"MM":return R.s(ue+1,2,"0");case"MMM":return ne(V.monthsShort,ue,L,3);case"MMMM":return ne(L,ue);case"D":return Z.$D;case"DD":return R.s(Z.$D,2,"0");case"d":return String(Z.$W);case"dd":return ne(V.weekdaysMin,Z.$W,le,2);case"ddd":return ne(V.weekdaysShort,Z.$W,le,3);case"dddd":return le[Z.$W];case"H":return String(W);case"HH":return R.s(W,2,"0");case"h":return D(1);case"hh":return D(2);case"a":return N(W,re,!0);case"A":return N(W,re,!1);case"m":return String(re);case"mm":return R.s(re,2,"0");case"s":return String(Z.$s);case"ss":return R.s(Z.$s,2,"0");case"SSS":return R.s(Z.$ms,3,"0");case"Z":return X}return null}(z)||X.replace(":","")})},k.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},k.diff=function(q,Z,V){var Y,X=this,W=R.p(Z),re=P(q),ue=(re.utcOffset()-this.utcOffset())*e,le=this-re,L=function(){return R.m(X,re)};switch(W){case d:Y=L()/12;break;case l:Y=L();break;case c:Y=L()/3;break;case u:Y=(le-ue)/6048e5;break;case s:Y=(le-ue)/864e5;break;case a:Y=le/r;break;case i:Y=le/e;break;case o:Y=le/t;break;default:Y=le}return V?Y:R.a(Y)},k.daysInMonth=function(){return this.endOf(l).$D},k.$locale=function(){return w[this.$L]},k.locale=function(q,Z){if(!q)return this.$L;var V=this.clone(),Y=E(q,Z,!0);return Y&&(V.$L=Y),V},k.clone=function(){return R.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()},B}(),A=I.prototype;return P.prototype=A,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",l],["$y",d],["$D",f]].forEach(function(B){A[B[1]]=function(k){return this.$g(k,B[0],B[1])}}),P.extend=function(B,k){return B.$i||(B(k,I,P),B.$i=!0),P},P.locale=E,P.isDayjs=O,P.unix=function(B){return P(1e3*B)},P.en=w[_],P.Ls=w,P.p={},P})});function Wht(t,e){let r=new Set;for(let n of e)t.has(n)&&r.add(n);return r}function fHr(t,e){let r=new Set(t);for(let n of e)r.add(n);return r}function xce(t,e){let r=new Set(t);for(let n of e)r.delete(n);return r}var pHr=v(()=>{});var Jht={};En(Jht,{SequentialChain:()=>Boi,SimpleSequentialChain:()=>Uoi});function Tce(t){return Array.from(t).map(e=>`"${e}"`).join(", ")}var Boi,Uoi,Kht=v(()=>{ZX();pHr();Boi=class mHr extends nb{constructor(r){super(r);x(this,"chains");x(this,"inputVariables");x(this,"outputVariables");x(this,"returnAll");if(this.chains=r.chains,this.inputVariables=r.inputVariables,this.outputVariables=r.outputVariables??[],this.outputVariables.length>0&&r.returnAll)throw new Error("Either specify variables to return using `outputVariables` or use `returnAll` param. Cannot apply both conditions at the same time.");this.returnAll=r.returnAll??!1,this._validateChains()}static lc_name(){return"SequentialChain"}get inputKeys(){return this.inputVariables}get outputKeys(){return this.outputVariables}_validateChains(){if(this.chains.length===0)throw new Error("Sequential chain must have at least one chain.");let r=this.memory?.memoryKeys??[],n=new Set(this.inputKeys),o=new Set(r),i=Wht(n,o);if(i.size>0)throw new Error(`The following keys: ${Tce(i)} are overlapping between memory and input keys of the chain variables. This can lead to unexpected behaviour. Please use input and memory keys that don't overlap.`);let a=fHr(n,o);for(let s of this.chains){let u=xce(new Set(s.inputKeys),a);if(s.memory&&(u=xce(u,new Set(s.memory.memoryKeys))),u.size>0)throw new Error(`Missing variables for chain "${s._chainType()}": ${Tce(u)}. Only got the following variables: ${Tce(a)}.`);let l=new Set(s.outputKeys),c=Wht(a,l);if(c.size>0)throw new Error(`The following output variables for chain "${s._chainType()}" are overlapping: ${Tce(c)}. This can lead to unexpected behaviour.`);for(let d of l)a.add(d)}if(this.outputVariables.length===0)if(this.returnAll){let s=xce(a,n);this.outputVariables=Array.from(s)}else this.outputVariables=this.chains[this.chains.length-1].outputKeys;else{let s=xce(new Set(this.outputVariables),new Set(a));if(s.size>0)throw new Error(`The following output variables were expected to be in the final chain output but were not found: ${Tce(s)}.`)}}async _call(r,n){let o={},i=r,a=0;for(let u of this.chains){a+=1,o=await u.call(i,n?.getChild(`step_${a}`));for(let l of Object.keys(o))i[l]=o[l]}let s={};for(let u of this.outputVariables)s[u]=i[u];return s}_chainType(){return"sequential_chain"}static async deserialize(r){let n=[],o=r.input_variables,i=r.output_variables,a=r.chains;for(let s of a){let u=await nb.deserialize(s);n.push(u)}return new mHr({chains:n,inputVariables:o,outputVariables:i})}serialize(){let r=[];for(let n of this.chains)r.push(n.serialize());return{_type:this._chainType(),input_variables:this.inputVariables,output_variables:this.outputVariables,chains:r}}},Uoi=class hHr extends nb{constructor(r){super(r);x(this,"chains");x(this,"inputKey","input");x(this,"outputKey","output");x(this,"trimOutputs");this.chains=r.chains,this.trimOutputs=r.trimOutputs??!1,this._validateChains()}static lc_name(){return"SimpleSequentialChain"}get inputKeys(){return[this.inputKey]}get outputKeys(){return[this.outputKey]}_validateChains(){for(let r of this.chains){if(r.inputKeys.filter(n=>!r.memory?.memoryKeys.includes(n)).length!==1)throw new Error(`Chains used in SimpleSequentialChain should all have one input, got ${r.inputKeys.length} for ${r._chainType()}.`);if(r.outputKeys.length!==1)throw new Error(`Chains used in SimpleSequentialChain should all have one output, got ${r.outputKeys.length} for ${r._chainType()}.`)}}async _call(r,n){let o=r[this.inputKey],i=0;for(let a of this.chains)i+=1,o=(await a.call({[a.inputKeys[0]]:o,signal:r.signal},n?.getChild(`step_${i}`)))[a.outputKeys[0]],this.trimOutputs&&(o=o.trim()),await n?.handleText(o);return{[this.outputKey]:o}}_chainType(){return"simple_sequential_chain"}static async deserialize(r){let n=[],o=r.chains;for(let i of o){let a=await nb.deserialize(i);n.push(a)}return new hHr({chains:n})}serialize(){let r=[];for(let n of this.chains)r.push(n.serialize());return{_type:this._chainType(),chains:r}}}});var dje={};En(dje,{MapReduceDocumentsChain:()=>yHr,RefineDocumentsChain:()=>_Hr,StuffDocumentsChain:()=>cje});var cje,yHr,_Hr,Oce=v(()=>{ZX();QW();TS();cje=class gHr extends nb{constructor(r){super(r);x(this,"llmChain");x(this,"inputKey","input_documents");x(this,"documentVariableName","context");this.llmChain=r.llmChain,this.documentVariableName=r.documentVariableName??this.documentVariableName,this.inputKey=r.inputKey??this.inputKey}static lc_name(){return"StuffDocumentsChain"}get inputKeys(){return[this.inputKey,...this.llmChain.inputKeys].filter(r=>r!==this.documentVariableName)}get outputKeys(){return this.llmChain.outputKeys}_prepInputs(r){if(!(this.inputKey in r))throw new Error(`Document key ${this.inputKey} not found.`);let{[this.inputKey]:n,...o}=r,a=n.map(({pageContent:s})=>s).join(`

`);return{...o,[this.documentVariableName]:a}}async _call(r,n){return await this.llmChain.call(this._prepInputs(r),n?.getChild("combine_documents"))}_chainType(){return"stuff_documents_chain"}static async deserialize(r){if(!r.llm_chain)throw new Error("Missing llm_chain");return new gHr({llmChain:await Qh.deserialize(r.llm_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize()}}},yHr=class bHr extends nb{constructor(r){super(r);x(this,"llmChain");x(this,"inputKey","input_documents");x(this,"documentVariableName","context");x(this,"returnIntermediateSteps",!1);x(this,"maxTokens",3e3);x(this,"maxIterations",10);x(this,"ensureMapStep",!1);x(this,"combineDocumentChain");this.llmChain=r.llmChain,this.combineDocumentChain=r.combineDocumentChain,this.documentVariableName=r.documentVariableName??this.documentVariableName,this.ensureMapStep=r.ensureMapStep??this.ensureMapStep,this.inputKey=r.inputKey??this.inputKey,this.maxTokens=r.maxTokens??this.maxTokens,this.maxIterations=r.maxIterations??this.maxIterations,this.returnIntermediateSteps=r.returnIntermediateSteps??!1}static lc_name(){return"MapReduceDocumentsChain"}get inputKeys(){return[this.inputKey,...this.combineDocumentChain.inputKeys]}get outputKeys(){return this.combineDocumentChain.outputKeys}async _call(r,n){if(!(this.inputKey in r))throw new Error(`Document key ${this.inputKey} not found.`);let{[this.inputKey]:o,...i}=r,a=o,s=[];for(let c=0;c<this.maxIterations;c+=1){let d=a.map(h=>({[this.documentVariableName]:h.pageContent,...i}));if(c!==0||!this.ensureMapStep){let h=await this.combineDocumentChain.llmChain.prompt.format(this.combineDocumentChain._prepInputs({[this.combineDocumentChain.inputKey]:a,...i}));if(await this.combineDocumentChain.llmChain._getNumTokens(h)<this.maxTokens)break}let p=await this.llmChain.apply(d,n?Array.from({length:d.length},(h,y)=>n.getChild(`map_${y+1}`)):void 0),{outputKey:m}=this.llmChain;this.returnIntermediateSteps&&(s=s.concat(p.map(h=>h[m]))),a=p.map(h=>({pageContent:h[m],metadata:{}}))}let u={[this.combineDocumentChain.inputKey]:a,...i},l=await this.combineDocumentChain.call(u,n?.getChild("combine_documents"));return this.returnIntermediateSteps?{...l,intermediateSteps:s}:l}_chainType(){return"map_reduce_documents_chain"}static async deserialize(r){if(!r.llm_chain)throw new Error("Missing llm_chain");if(!r.combine_document_chain)throw new Error("Missing combine_document_chain");return new bHr({llmChain:await Qh.deserialize(r.llm_chain),combineDocumentChain:await cje.deserialize(r.combine_document_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),combine_document_chain:this.combineDocumentChain.serialize()}}},_Hr=class vHr extends nb{constructor(r){super(r);x(this,"llmChain");x(this,"inputKey","input_documents");x(this,"outputKey","output_text");x(this,"documentVariableName","context");x(this,"initialResponseName","existing_answer");x(this,"refineLLMChain");x(this,"documentPrompt",this.defaultDocumentPrompt);this.llmChain=r.llmChain,this.refineLLMChain=r.refineLLMChain,this.documentVariableName=r.documentVariableName??this.documentVariableName,this.inputKey=r.inputKey??this.inputKey,this.outputKey=r.outputKey??this.outputKey,this.documentPrompt=r.documentPrompt??this.documentPrompt,this.initialResponseName=r.initialResponseName??this.initialResponseName}static lc_name(){return"RefineDocumentsChain"}get defaultDocumentPrompt(){return new Ku({inputVariables:["page_content"],template:"{page_content}"})}get inputKeys(){return[...new Set([this.inputKey,...this.llmChain.inputKeys,...this.refineLLMChain.inputKeys])].filter(r=>r!==this.documentVariableName&&r!==this.initialResponseName)}get outputKeys(){return[this.outputKey]}async _constructInitialInputs(r,n){let o={page_content:r.pageContent,...r.metadata},i={};return this.documentPrompt.inputVariables.forEach(u=>{i[u]=o[u]}),{...{[this.documentVariableName]:await this.documentPrompt.format({...i})},...n}}async _constructRefineInputs(r,n){let o={page_content:r.pageContent,...r.metadata},i={};this.documentPrompt.inputVariables.forEach(u=>{i[u]=o[u]});let a={[this.documentVariableName]:await this.documentPrompt.format({...i})};return{[this.initialResponseName]:n,...a}}async _call(r,n){if(!(this.inputKey in r))throw new Error(`Document key ${this.inputKey} not found.`);let{[this.inputKey]:o,...i}=r,a=o,s=await this._constructInitialInputs(a[0],i),u=await this.llmChain.predict({...s},n?.getChild("answer")),l=[u];for(let c=1;c<a.length;c+=1){let f={...await this._constructRefineInputs(a[c],u),...i};u=await this.refineLLMChain.predict({...f},n?.getChild("refine")),l.push(u)}return{[this.outputKey]:u}}_chainType(){return"refine_documents_chain"}static async deserialize(r){let n=r.llm_chain;if(!n)throw new Error("Missing llm_chain");let o=r.refine_llm_chain;if(!o)throw new Error("Missing refine_llm_chain");return new vHr({llmChain:await Qh.deserialize(n),refineLLMChain:await Qh.deserialize(o)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),refine_llm_chain:this.refineLLMChain.serialize()}}}});var fje=v(()=>{DL()});function Pce(t){return t._modelType()==="base_chat_model"}var wHr,Ece,SHr=v(()=>{wHr=class{async getPromptAsync(t,e){return this.getPrompt(t).partial(e?.partialVariables??{})}},Ece=class extends wHr{constructor(e,r=[]){super();x(this,"defaultPrompt");x(this,"conditionals");this.defaultPrompt=e,this.conditionals=r}getPrompt(e){for(let[r,n]of this.conditionals)if(r(e))return n;return this.defaultPrompt}}});var xHr=v(()=>{fje()});var THr=v(()=>{gat();fje()});var pje=v(()=>{zo();fje();SHr();xHr();THr()});var zoi,Voi,Hoi,Woi,OHr,EHr=v(()=>{TS();pje();zoi=new Ku({template:`Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.

{context}

Question: {question}
Helpful Answer:`,inputVariables:["context","question"]}),Voi=`Use the following pieces of context to answer the users question. 
If you don't know the answer, just say that you don't know, don't try to make up an answer.
----------------
{context}`,Hoi=[$C.fromTemplate(Voi),rw.fromTemplate("{question}")],Woi=Eb.fromMessages(Hoi),OHr=new Ece(zoi,[[Pce,Woi]])});var PHr=v(()=>{TS();pje()});var MHr=v(()=>{TS();pje()});function RHr(t,e={}){let{prompt:r=OHr.getPrompt(t),verbose:n}=e,o=new Qh({prompt:r,llm:t,verbose:n});return new cje({llmChain:o,verbose:n})}var IHr=v(()=>{QW();Oce();EHr();PHr();MHr()});var NHr={};En(NHr,{VectorDBQAChain:()=>Joi});var Joi,DHr=v(()=>{ZX();IHr();Joi=class AHr extends nb{constructor(r){super(r);x(this,"k",4);x(this,"inputKey","query");x(this,"vectorstore");x(this,"combineDocumentsChain");x(this,"returnSourceDocuments",!1);this.vectorstore=r.vectorstore,this.combineDocumentsChain=r.combineDocumentsChain,this.inputKey=r.inputKey??this.inputKey,this.k=r.k??this.k,this.returnSourceDocuments=r.returnSourceDocuments??this.returnSourceDocuments}static lc_name(){return"VectorDBQAChain"}get inputKeys(){return[this.inputKey]}get outputKeys(){return this.combineDocumentsChain.outputKeys.concat(this.returnSourceDocuments?["sourceDocuments"]:[])}async _call(r,n){if(!(this.inputKey in r))throw new Error(`Question key ${this.inputKey} not found.`);let o=r[this.inputKey],i=await this.vectorstore.similaritySearch(o,this.k,r.filter,n?.getChild("vectorstore")),a={question:o,input_documents:i},s=await this.combineDocumentsChain.call(a,n?.getChild("combine_documents"));return this.returnSourceDocuments?{...s,sourceDocuments:i}:s}_chainType(){return"vector_db_qa"}static async deserialize(r,n){if(!("vectorstore"in n))throw new Error("Need to pass in a vectorstore to deserialize VectorDBQAChain");let{vectorstore:o}=n;if(!r.combine_documents_chain)throw new Error("VectorDBQAChain must have combine_documents_chain in serialized data");return new AHr({combineDocumentsChain:await nb.deserialize(r.combine_documents_chain),k:r.k,vectorstore:o})}serialize(){return{_type:this._chainType(),combine_documents_chain:this.combineDocumentsChain.serialize(),k:this.k}}static fromLLM(r,n,o){let i=RHr(r);return new this({vectorstore:n,combineDocumentsChain:i,...o})}}});var jHr,$Hr,Koi,LHr,FHr=v(()=>{TS();jHr=`You are given the below API Documentation:
{api_docs}
Using this documentation, generate the full API url to call for answering the user question.
You should build the API url in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.

Question:{question}
API url:`,$Hr=new Ku({inputVariables:["api_docs","question"],template:jHr}),Koi=`${jHr} {api_url}

Here is the response from the API:

{api_response}

Summarize this response to answer the original question.

Summary:`,LHr=new Ku({inputVariables:["api_docs","question","api_url","api_response"],template:Koi})});var qHr={};En(qHr,{APIChain:()=>Goi});var Goi,BHr=v(()=>{ZX();QW();FHr();Goi=class kHr extends nb{constructor(r){super(r);x(this,"apiAnswerChain");x(this,"apiRequestChain");x(this,"apiDocs");x(this,"headers",{});x(this,"inputKey","question");x(this,"outputKey","output");this.apiRequestChain=r.apiRequestChain,this.apiAnswerChain=r.apiAnswerChain,this.apiDocs=r.apiDocs,this.inputKey=r.inputKey??this.inputKey,this.outputKey=r.outputKey??this.outputKey,this.headers=r.headers??this.headers}get inputKeys(){return[this.inputKey]}get outputKeys(){return[this.outputKey]}async _call(r,n){let o=r[this.inputKey],i=await this.apiRequestChain.predict({question:o,api_docs:this.apiDocs},n?.getChild("request")),s=await(await fetch(i,{headers:this.headers})).text(),u=await this.apiAnswerChain.predict({question:o,api_docs:this.apiDocs,api_url:i,api_response:s},n?.getChild("response"));return{[this.outputKey]:u}}_chainType(){return"api_chain"}static async deserialize(r){let{api_request_chain:n,api_answer_chain:o,api_docs:i}=r;if(!n)throw new Error("LLMChain must have api_request_chain");if(!o)throw new Error("LLMChain must have api_answer_chain");if(!i)throw new Error("LLMChain must have api_docs");return new kHr({apiAnswerChain:await Qh.deserialize(o),apiRequestChain:await Qh.deserialize(n),apiDocs:i})}serialize(){return{_type:this._chainType(),api_answer_chain:this.apiAnswerChain.serialize(),api_request_chain:this.apiRequestChain.serialize(),api_docs:this.apiDocs}}static fromLLMAndAPIDocs(r,n,o={}){let{apiUrlPrompt:i=$Hr,apiResponsePrompt:a=LHr}=o,s=new Qh({prompt:i,llm:r}),u=new Qh({prompt:a,llm:r});return new this({apiAnswerChain:u,apiRequestChain:s,apiDocs:n,...o})}}});var nb,ZX=v(()=>{Qv();rv();xm();BL();nb=class extends tie{get lc_namespace(){return["langchain","chains",this._chainType()]}constructor(t,e,r){if(arguments.length===1&&typeof t=="object"&&!("saveContext"in t)){let{memory:n,callbackManager:o,...i}=t;super({...i,callbacks:o??i.callbacks}),this.memory=n}else super({verbose:e,callbacks:r}),this.memory=t}_selectMemoryInputs(t){let e={...t};return"signal"in e&&delete e.signal,"timeout"in e&&delete e.timeout,e}async invoke(t,e){let r=vi(e),n=await this._formatValues(t),i=await(await Cm.configure(r?.callbacks,this.callbacks,r?.tags,this.tags,r?.metadata,this.metadata,{verbose:this.verbose}))?.handleChainStart(this.toJSON(),n,void 0,void 0,void 0,void 0,r?.runName),a;try{if(n.signal){let s;a=await Promise.race([this._call(n,i,r),new Promise((u,l)=>{s=()=>{l(new Error("AbortError"))},n.signal?.addEventListener("abort",s)})]).finally(()=>{n.signal&&s&&n.signal.removeEventListener("abort",s)})}else a=await this._call(n,i,r)}catch(s){throw await i?.handleChainError(s),s}return this.memory!=null&&await this.memory.saveContext(this._selectMemoryInputs(t),a),await i?.handleChainEnd(a),Object.defineProperty(a,Z6,{value:i?{runId:i?.runId}:void 0,configurable:!0}),a}_validateOutputs(t){let e=this.outputKeys.filter(r=>!(r in t));if(e.length)throw new Error(`Missing output keys: ${e.join(", ")} from chain ${this._chainType()}`)}async prepOutputs(t,e,r=!1){return this._validateOutputs(e),this.memory&&await this.memory.saveContext(t,e),r?e:{...t,...e}}serialize(){throw new Error("Method not implemented.")}async run(t,e){let r=this.inputKeys.filter(s=>!this.memory?.memoryKeys.includes(s));if(!(r.length<=1))throw new Error(`Chain ${this._chainType()} expects multiple inputs, cannot use 'run' `);let o=r.length?{[r[0]]:t}:{},i=await this.call(o,e),a=Object.keys(i);if(a.length===1)return i[a[0]];throw new Error("return values have multiple keys, `run` only supported when one key currently")}async _formatValues(t){let e={...t};if(e.timeout&&!e.signal&&(e.signal=AbortSignal.timeout(e.timeout),delete e.timeout),this.memory!=null){let r=await this.memory.loadMemoryVariables(this._selectMemoryInputs(t));for(let[n,o]of Object.entries(r))e[n]=o}return e}async call(t,e,r){let n={tags:r,...qL(e)};return this.invoke(t,n)}async apply(t,e){return Promise.all(t.map(async(r,n)=>this.call(r,e?.[n])))}static async deserialize(t,e={}){switch(t._type){case"llm_chain":{let{LLMChain:r}=await Promise.resolve().then(()=>(QW(),UHr));return r.deserialize(t)}case"sequential_chain":{let{SequentialChain:r}=await Promise.resolve().then(()=>(Kht(),Jht));return r.deserialize(t)}case"simple_sequential_chain":{let{SimpleSequentialChain:r}=await Promise.resolve().then(()=>(Kht(),Jht));return r.deserialize(t)}case"stuff_documents_chain":{let{StuffDocumentsChain:r}=await Promise.resolve().then(()=>(Oce(),dje));return r.deserialize(t)}case"map_reduce_documents_chain":{let{MapReduceDocumentsChain:r}=await Promise.resolve().then(()=>(Oce(),dje));return r.deserialize(t)}case"refine_documents_chain":{let{RefineDocumentsChain:r}=await Promise.resolve().then(()=>(Oce(),dje));return r.deserialize(t)}case"vector_db_qa":{let{VectorDBQAChain:r}=await Promise.resolve().then(()=>(DHr(),NHr));return r.deserialize(t,e)}case"api_chain":{let{APIChain:r}=await Promise.resolve().then(()=>(BHr(),qHr));return r.deserialize(t)}default:throw new Error(`Invalid prompt type in config: ${t._type}`)}}}});var zHr,VHr=v(()=>{nO();zHr=class extends d4{constructor(){super(...arguments);x(this,"lc_namespace",["langchain","output_parsers","default"]);x(this,"lc_serializable",!0)}static lc_name(){return"NoOpOutputParser"}parse(e){return Promise.resolve(e)}getFormatInstructions(){return""}}});var UHr={};En(UHr,{LLMChain:()=>Qh});function Xoi(t){return typeof t._llmType=="function"}function mje(t){if(Xoi(t))return t;if("bound"in t&&Ti.isRunnable(t.bound))return mje(t.bound);if("runnable"in t&&"fallbacks"in t&&Ti.isRunnable(t.runnable))return mje(t.runnable);if("default"in t&&Ti.isRunnable(t.default))return mje(t.default);throw new Error("Unable to extract BaseLanguageModel from llmLike object.")}var Qh,QW=v(()=>{ZX();VHr();TS();Qv();rv();Qh=class HHr extends nb{constructor(r){super(r);x(this,"lc_serializable",!0);x(this,"prompt");x(this,"llm");x(this,"llmKwargs");x(this,"outputKey","text");x(this,"outputParser");if(this.prompt=r.prompt,this.llm=r.llm,this.llmKwargs=r.llmKwargs,this.outputKey=r.outputKey??this.outputKey,this.outputParser=r.outputParser??new zHr,this.prompt.outputParser){if(r.outputParser)throw new Error("Cannot set both outputParser and prompt.outputParser");this.outputParser=this.prompt.outputParser}}static lc_name(){return"LLMChain"}get inputKeys(){return this.prompt.inputVariables}get outputKeys(){return[this.outputKey]}getCallKeys(){return"callKeys"in this.llm?this.llm.callKeys:[]}_selectMemoryInputs(r){let n=super._selectMemoryInputs(r),o=this.getCallKeys();for(let i of o)i in r&&delete n[i];return n}async _getFinalOutput(r,n,o){let i;return this.outputParser?i=await this.outputParser.parseResultWithPrompt(r,n,o?.getChild()):i=r[0].text,i}call(r,n){return super.call(r,n)}async _call(r,n){let o={...r},i={...this.llmKwargs},a=this.getCallKeys();for(let c of a)c in r&&i&&(i[c]=r[c],delete o[c]);let s=await this.prompt.formatPromptValue(o);if("generatePrompt"in this.llm){let{generations:c}=await this.llm.generatePrompt([s],i,n?.getChild());return{[this.outputKey]:await this._getFinalOutput(c[0],s,n)}}let l=await(this.outputParser?this.llm.pipe(this.outputParser):this.llm).invoke(s,n?.getChild());return{[this.outputKey]:l}}async predict(r,n){return(await this.call(r,n))[this.outputKey]}_chainType(){return"llm"}static async deserialize(r){let{llm:n,prompt:o}=r;if(!n)throw new Error("LLMChain must have llm");if(!o)throw new Error("LLMChain must have prompt");return new HHr({llm:await sV.deserialize(n),prompt:await oO.deserialize(o)})}serialize(){let r="serialize"in this.llm?this.llm.serialize():void 0;return{_type:`${this._chainType()}_chain`,llm:r,prompt:this.prompt.serialize()}}_getNumTokens(r){return mje(this.llm).getNumTokens(r)}}});function hde(t){if(!t)return!1;let e=t.view;return!e||typeof e!="object"?!1:typeof e.getViewType=="function"&&t.view.getViewType()===C3}function OZ(t){let e=t.view?.webview;if(!e||typeof e!="object"||typeof e.executeJavaScript!="function")throw new Hyt("Web Viewer webview is unavailable. The view may not be fully initialized.");return e}var C3,J$e,Qw,H$e,W$e,Hyt,hU,EZ=v(()=>{C3="webviewer",J$e={OPEN:"webviewer:open",SAVE_TO_VAULT:"webviewer:save-to-vault"},Qw=class t extends Error{constructor(e){super(e),this.name="WebViewerError",Object.setPrototypeOf(this,t.prototype)}},H$e=class t extends Qw{constructor(e){super(e),this.name="WebViewerUnsupportedError",Object.setPrototypeOf(this,t.prototype)}},W$e=class t extends Qw{constructor(e){super(e),this.name="WebViewerLeafNotFoundError",Object.setPrototypeOf(this,t.prototype)}},Hyt=class t extends Qw{constructor(e){super(e),this.name="WebviewUnavailableError",Object.setPrototypeOf(this,t.prototype)}},hU=class t extends Qw{constructor(e){super(e),this.name="WebViewerTimeoutError",Object.setPrototypeOf(this,t.prototype)}}});function Zci(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])}return t}function Gyt(t,e){return Array(e+1).join(t)}function u8r(t){return t.replace(/^\n*/,"")}function l8r(t){for(var e=t.length;e>0&&t[e-1]===`
`;)e--;return t.substring(0,e)}function c8r(t){return l8r(u8r(t))}function Xyt(t){return Zyt(t,Yci)}function f8r(t){return Zyt(t,d8r)}function Qci(t){return m8r(t,d8r)}function edi(t){return Zyt(t,p8r)}function tdi(t){return m8r(t,p8r)}function Zyt(t,e){return e.indexOf(t.nodeName)>=0}function m8r(t,e){return t.getElementsByTagName&&e.some(function(r){return t.getElementsByTagName(r).length})}function K$e(t){return t?t.replace(/(\n+\s*)+/g,`
`):""}function h8r(t){this.options=t,this._keep=[],this._remove=[],this.blankRule={replacement:t.blankReplacement},this.keepReplacement=t.keepReplacement,this.defaultRule={replacement:t.defaultReplacement},this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}function Wyt(t,e,r){for(var n=0;n<t.length;n++){var o=t[n];if(rdi(o,e,r))return o}}function rdi(t,e,r){var n=t.filter;if(typeof n=="string"){if(n===e.nodeName.toLowerCase())return!0}else if(Array.isArray(n)){if(n.indexOf(e.nodeName.toLowerCase())>-1)return!0}else if(typeof n=="function"){if(n.call(t,e,r))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function ndi(t){var e=t.element,r=t.isBlock,n=t.isVoid,o=t.isPre||function(d){return d.nodeName==="PRE"};if(!(!e.firstChild||o(e))){for(var i=null,a=!1,s=null,u=a8r(s,e,o);u!==e;){if(u.nodeType===3||u.nodeType===4){var l=u.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!a&&l[0]===" "&&(l=l.substr(1)),!l){u=Jyt(u);continue}u.data=l,i=u}else if(u.nodeType===1)r(u)||u.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,a=!1):n(u)||o(u)?(i=null,a=!0):i&&(a=!1);else{u=Jyt(u);continue}var c=a8r(s,u,o);s=u,u=c}i&&(i.data=i.data.replace(/ $/,""),i.data||Jyt(i))}}function Jyt(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function a8r(t,e,r){return t&&t.parentNode===e||r(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}function odi(){var t=Yyt.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function idi(){var t=function(){};return adi()?t.prototype.parseFromString=function(e){var r=new window.ActiveXObject("htmlfile");return r.designMode="on",r.open(),r.write(e),r.close(),r}:t.prototype.parseFromString=function(e){var r=document.implementation.createHTMLDocument("");return r.open(),r.write(e),r.close(),r},t}function adi(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{Yyt.ActiveXObject&&(t=!0)}return t}function udi(t,e){var r;if(typeof t=="string"){var n=ldi().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");r=n.getElementById("turndown-root")}else r=t.cloneNode(!0);return ndi({element:r,isBlock:Xyt,isVoid:f8r,isPre:e.preformattedCode?cdi:null}),r}function ldi(){return Kyt=Kyt||new sdi,Kyt}function cdi(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function ddi(t,e){return t.isBlock=Xyt(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=fdi(t),t.flankingWhitespace=pdi(t,e),t}function fdi(t){return!f8r(t)&&!edi(t)&&/^\s*$/i.test(t.textContent)&&!Qci(t)&&!tdi(t)}function pdi(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var r=mdi(t.textContent);return r.leadingAscii&&s8r("left",t,e)&&(r.leading=r.leadingNonAscii),r.trailingAscii&&s8r("right",t,e)&&(r.trailing=r.trailingNonAscii),{leading:r.leading,trailing:r.trailing}}function mdi(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function s8r(t,e,r){var n,o,i;return t==="left"?(n=e.previousSibling,o=/ $/):(n=e.nextSibling,o=/^ /),n&&(n.nodeType===3?i=o.test(n.nodeValue):r.preformattedCode&&n.nodeName==="CODE"?i=!1:n.nodeType===1&&!Xyt(n)&&(i=o.test(n.textContent))),i}function G$e(t){if(!(this instanceof G$e))return new G$e(t);var e={rules:sb,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:"  ",preformattedCode:!1,blankReplacement:function(r,n){return n.isBlock?`

`:""},keepReplacement:function(r,n){return n.isBlock?`

`+n.outerHTML+`

`:n.outerHTML},defaultReplacement:function(r,n){return n.isBlock?`

`+r+`

`:r}};this.options=Zci({},e,t),this.rules=new h8r(this.options)}function g8r(t){var e=this;return hdi.call(t.childNodes,function(r,n){n=new ddi(n,e.options);var o="";return n.nodeType===3?o=n.isCode?n.nodeValue:e.escape(n.nodeValue):n.nodeType===1&&(o=bdi.call(e,n)),y8r(r,o)},"")}function ydi(t){var e=this;return this.rules.forEach(function(r){typeof r.append=="function"&&(t=y8r(t,r.append(e.options)))}),t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function bdi(t){var e=this.rules.forNode(t),r=g8r.call(this,t),n=t.flankingWhitespace;return(n.leading||n.trailing)&&(r=r.trim()),n.leading+e.replacement(r,t,this.options)+n.trailing}function y8r(t,e){var r=l8r(t),n=u8r(e),o=Math.max(t.length-r.length,e.length-n.length),i=`

`.substring(0,o);return r+i+n}function _di(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}var Yci,d8r,p8r,sb,Yyt,sdi,Kyt,hdi,gdi,b8r,_8r=v(()=>{Yci=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];d8r=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];p8r=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];sb={};sb.paragraph={filter:"p",replacement:function(t){return`

`+t+`

`}};sb.lineBreak={filter:"br",replacement:function(t,e,r){return r.br+`
`}};sb.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,r){var n=Number(e.nodeName.charAt(1));if(r.headingStyle==="setext"&&n<3){var o=Gyt(n===1?"=":"-",t.length);return`

`+t+`
`+o+`

`}else return`

`+Gyt("#",n)+" "+t+`

`}};sb.blockquote={filter:"blockquote",replacement:function(t){return t=c8r(t).replace(/^/gm,"> "),`

`+t+`

`}};sb.list={filter:["ul","ol"],replacement:function(t,e){var r=e.parentNode;return r.nodeName==="LI"&&r.lastElementChild===e?`
`+t:`

`+t+`

`}};sb.listItem={filter:"li",replacement:function(t,e,r){var n=r.bulletListMarker+"   ",o=e.parentNode;if(o.nodeName==="OL"){var i=o.getAttribute("start"),a=Array.prototype.indexOf.call(o.children,e);n=(i?Number(i)+a:a+1)+".  "}var s=/\n$/.test(t);return t=c8r(t)+(s?`
`:""),t=t.replace(/\n/gm,`
`+" ".repeat(n.length)),n+t+(e.nextSibling?`
`:"")}};sb.indentedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,r){return`

    `+e.firstChild.textContent.replace(/\n/g,`
    `)+`

`}};sb.fencedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="fenced"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,r){for(var n=e.firstChild.getAttribute("class")||"",o=(n.match(/language-(\S+)/)||[null,""])[1],i=e.firstChild.textContent,a=r.fence.charAt(0),s=3,u=new RegExp("^"+a+"{3,}","gm"),l;l=u.exec(i);)l[0].length>=s&&(s=l[0].length+1);var c=Gyt(a,s);return`

`+c+o+`
`+i.replace(/\n$/,"")+`
`+c+`

`}};sb.horizontalRule={filter:"hr",replacement:function(t,e,r){return`

`+r.hr+`

`}};sb.inlineLink={filter:function(t,e){return e.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e){var r=e.getAttribute("href");r&&(r=r.replace(/([()])/g,"\\$1"));var n=K$e(e.getAttribute("title"));return n&&(n=' "'+n.replace(/"/g,'\\"')+'"'),"["+t+"]("+r+n+")"}};sb.referenceLink={filter:function(t,e){return e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e,r){var n=e.getAttribute("href"),o=K$e(e.getAttribute("title"));o&&(o=' "'+o+'"');var i,a;switch(r.linkReferenceStyle){case"collapsed":i="["+t+"][]",a="["+t+"]: "+n+o;break;case"shortcut":i="["+t+"]",a="["+t+"]: "+n+o;break;default:var s=this.references.length+1;i="["+t+"]["+s+"]",a="["+s+"]: "+n+o}return this.references.push(a),i},references:[],append:function(t){var e="";return this.references.length&&(e=`

`+this.references.join(`
`)+`

`,this.references=[]),e}};sb.emphasis={filter:["em","i"],replacement:function(t,e,r){return t.trim()?r.emDelimiter+t+r.emDelimiter:""}};sb.strong={filter:["strong","b"],replacement:function(t,e,r){return t.trim()?r.strongDelimiter+t+r.strongDelimiter:""}};sb.code={filter:function(t){var e=t.previousSibling||t.nextSibling,r=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!r},replacement:function(t){if(!t)return"";t=t.replace(/\r?\n|\r/g," ");for(var e=/^`|^ .*?[^ ].* $|`$/.test(t)?" ":"",r="`",n=t.match(/`+/gm)||[];n.indexOf(r)!==-1;)r=r+"`";return r+e+t+e+r}};sb.image={filter:"img",replacement:function(t,e){var r=K$e(e.getAttribute("alt")),n=e.getAttribute("src")||"",o=K$e(e.getAttribute("title")),i=o?' "'+o+'"':"";return n?"!["+r+"]("+n+i+")":""}};h8r.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;return(e=Wyt(this.array,t,this.options))||(e=Wyt(this._keep,t,this.options))||(e=Wyt(this._remove,t,this.options))?e:this.defaultRule},forEach:function(t){for(var e=0;e<this.array.length;e++)t(this.array[e],e)}};Yyt=typeof window<"u"?window:{};sdi=odi()?Yyt.DOMParser:idi();hdi=Array.prototype.reduce,gdi=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];G$e.prototype={turndown:function(t){if(!_di(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=g8r.call(this,new udi(t,this.options));return ydi.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this.use(t[e]);else if(typeof t=="function")t(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(t,e){return this.rules.add(t,e),this},keep:function(t){return this.rules.keep(t),this},remove:function(t){return this.rules.remove(t),this},escape:function(t){return gdi.reduce(function(e,r){return e.replace(r[0],r[1])},t)}};b8r=G$e});function PZ(t){return typeof t=="object"&&t!==null}function MZ(t){if(typeof t=="string")return t;if(t==null)return"";try{return String(t)}catch{return""}}function C8r(t){return t instanceof Error?t.message:MZ(t)}async function vdi(t){await new Promise(e=>setTimeout(e,t))}async function x8r(t,e,r,n){let o=Date.now();for(;;){if(t())return;if(Date.now()-o>=e)throw new Qw(`${n} timed out after ${e}ms`);await vdi(r)}}function v8r(t,e){let r=(t??"").trim();if(!r)return"";if(!e)return r;try{return new URL(r,e).href}catch{return r}}function w8r(t){let e=(t??"").trim();return e?/[\s)]/.test(e)?`<${e}>`:e:""}function wdi(t){let e=new b8r({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",fence:"```",emDelimiter:"*",strongDelimiter:"**",linkStyle:"inlined"});return e.remove(["script","style","noscript"]),e.addRule("webviewer-link",{filter:"a",replacement:(r,n)=>{let o=n,i=o.getAttribute("href")??"",a=w8r(v8r(i,t)),s=r?.trim()||o.textContent||a;return a?`[${s}](${a})`:s}}),e.addRule("webviewer-image",{filter:"img",replacement:(r,n)=>{let o=n,i=o.getAttribute("alt")??"",a=o.getAttribute("src")??"",s=w8r(v8r(a,t));return s?`![${i}](${s})`:""}}),e}function Qyt(t,e){if(!t.trim())return"";let r=wdi(e),i=new DOMParser().parseFromString(`<div>${t}</div>`,"text/html").body.firstElementChild;return i?r.turndown(i).replace(/\n{3,}/g,`

`).trim():""}function ebt(t){let e=t.commands;return!e||!PZ(e)||typeof e.executeCommandById!="function"?null:e}function T8r(t,e){let r=ebt(t);if(!r)return!1;if(r.commands){if(r.commands instanceof Map)return r.commands.has(e);if(typeof r.commands=="object")return e in r.commands}return typeof r.listCommands=="function"?r.listCommands().some(o=>o.id===e):!1}function O8r(t,e){return t.workspace.getLeavesOfType(C3).includes(e)}function S8r(t){if(!PZ(t)||t.enabled!==!0)return null;let e=t.instance;if(!e||!PZ(e))return null;let r=e;return typeof r.openUrl=="function"||typeof r.handleOpenUrl=="function"?r:null}function E8r(t,e){let r=t.internalPlugins;if(!r||!PZ(r))return null;let n=r.plugins;if(!n)return null;let o=n instanceof Map?n.get(C3):PZ(n)?n[C3]:null;if(o){let a=S8r(o);if(a)return a}let i;if(n instanceof Map)i=Array.from(n.values());else if(PZ(n))i=Object.values(n);else return e&&e(),null;for(let a of i){let s=S8r(a);if(s)return s}return null}var X$e=v(()=>{_8r();EZ()});function RZ(t){return{url:typeof t.view?.url=="string"?t.view.url:"",title:typeof t.view?.title=="string"?t.view.title:"",faviconUrl:typeof t.view?.faviconUrl=="string"?t.view.faviconUrl:"",mode:t.view?.mode==="reader"?"reader":"webview"}}async function P8r(t,e={}){let{signal:r}=e;if(r?.aborted)throw new hU("Operation was aborted");try{let n=Promise.resolve(t.view.getReaderModeContent());if(!r){let i=await n;return typeof i?.md=="string"?i.md:""}let o=await new Promise((i,a)=>{let s=()=>{a(new hU("Operation was aborted"))};r.addEventListener("abort",s,{once:!0}),n.then(u=>{r.removeEventListener("abort",s),i(u)}).catch(u=>{r.removeEventListener("abort",s),a(u)})});return typeof o?.md=="string"?o.md:""}catch(n){throw n instanceof hU||ie("Failed to get reader mode content:",n),n}}async function Z$e(t,e=!0){let r=OZ(t),n='(() => { try { return window.getSelection?.()?.toString?.() ?? ""; } catch { return ""; } })()';try{let o=await r.executeJavaScript(n),i=MZ(o);return e?i.trim():i}catch(o){throw ie("Failed to get selected text:",o),o}}async function Y$e(t){let e=OZ(t),r="";try{r=typeof e.getURL=="function"?e.getURL():""}catch{r=t.view?.url??""}let n=`(() => {
  const sel = window.getSelection();
  if (!sel || sel.rangeCount === 0 || sel.isCollapsed) return "";
  const div = document.createElement("div");
  for (let i = 0; i < sel.rangeCount; i++) div.appendChild(sel.getRangeAt(i).cloneContents());
  return div.innerHTML;
})()`,o="";try{let i=await e.executeJavaScript(n);o=MZ(i)}catch(i){throw ie("Failed to get selection HTML:",i),i}try{return Qyt(o,r)}catch(i){throw ie("Failed to convert HTML to Markdown:",i),i}}async function M8r(t){let e=OZ(t),r="";try{r=typeof e.getURL=="function"?e.getURL():""}catch{r=t.view?.url??""}let n=`(() => {
    const clone = document.body.cloneNode(true);
    clone.querySelectorAll('script, style, noscript').forEach(el => el.remove());
    return clone.innerHTML;
  })()`,o="";try{let i=await e.executeJavaScript(n);o=MZ(i)}catch(i){throw ie("Failed to get page HTML:",i),i}try{return Qyt(o,r)}catch(i){throw ie("Failed to convert page HTML to Markdown:",i),i}}async function R8r(t,e=!0){let r=OZ(t),n=e?'(() => { try { return document.documentElement?.outerHTML ?? ""; } catch { return ""; } })()':'(() => { try { return document.body?.outerHTML ?? ""; } catch { return ""; } })()';try{let o=await r.executeJavaScript(n);return MZ(o)}catch(o){throw ie("Failed to get HTML:",o),o}}function Q$e(t){try{let e=new URL(t),r=e.hostname.replace(/^www\./,"").replace(/^m\./,"");return r==="youtube.com"&&e.pathname==="/watch"?e.searchParams.get("v"):r==="youtu.be"&&e.pathname.length>1?e.pathname.slice(1).split("/")[0]:(r==="youtube.com"&&e.pathname.startsWith("/shorts/")||r==="youtube.com"&&e.pathname.startsWith("/embed/"))&&e.pathname.split("/")[2]||null}catch{return null}}function I8r(t){return Q$e(t)!==null}function Sdi(t){if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.videoId=="string"&&typeof e.title=="string"&&typeof e.channel=="string"&&(e.description===void 0||typeof e.description=="string")&&(e.uploadDate===void 0||typeof e.uploadDate=="string")&&(e.duration===void 0||typeof e.duration=="string")&&(e.genre===void 0||typeof e.genre=="string")&&Array.isArray(e.transcript)&&e.transcript.every(r=>typeof r=="object"&&r!==null&&typeof r.timestamp=="string"&&typeof r.text=="string")}async function A8r(t,e={}){let r=OZ(t),{timeoutMs:n=1e4}=e,o=Math.ceil(n/500),i="";try{i=typeof r.getURL=="function"?r.getURL():""}catch{i=""}i||(i=t.view?.url??"");let a=Q$e(i);if(!a)throw new Error("Not a YouTube video page");let s=`(async () => {
    const videoId = ${JSON.stringify(a)};

    // =========================================================================
    // Step 1: Extract video metadata from JSON-LD (structured data)
    // JSON-LD is more reliable than DOM selectors as it's machine-readable
    // =========================================================================
    let title = '';
    let channel = '';
    let description = '';
    let uploadDate = '';
    let duration = '';
    let genre = '';

    // Helper to extract fields from a VideoObject schema
    const extractVideoObject = (data) => {
      if (!data || data['@type'] !== 'VideoObject') return;
      if (!title && data.name && typeof data.name === 'string') {
        title = data.name;
      }
      if (!description && data.description && typeof data.description === 'string') {
        description = data.description;
      }
      if (!uploadDate && data.uploadDate && typeof data.uploadDate === 'string') {
        uploadDate = data.uploadDate;
      }
      // JSON-LD duration is ISO 8601 format (e.g., "PT12M34S"), convert to readable format
      if (!duration && data.duration && typeof data.duration === 'string') {
        const match = data.duration.match(/PT(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)S)?/);
        if (match) {
          const h = match[1] ? match[1] + ':' : '';
          const m = match[2] || '0';
          const s = match[3] || '0';
          duration = h + (h ? m.padStart(2, '0') : m) + ':' + s.padStart(2, '0');
        }
      }
      if (!genre && data.genre) {
        genre = Array.isArray(data.genre) ? data.genre.join(', ') : String(data.genre);
      }
      // author can be string, object {name}, or array [{name}]
      if (!channel && data.author) {
        const author = data.author;
        if (typeof author === 'string') {
          channel = author;
        } else if (Array.isArray(author) && author[0]?.name) {
          channel = String(author[0].name);
        } else if (author?.name) {
          channel = String(author.name);
        }
      }
    };

    // Parse all JSON-LD scripts, handling various formats (@graph, array, single object)
    const ldJsonEls = document.querySelectorAll('script[type="application/ld+json"]');
    for (const el of ldJsonEls) {
      try {
        const data = JSON.parse(el.textContent || '');
        if (Array.isArray(data)) {
          for (const item of data) {
            extractVideoObject(item);
          }
        } else if (data['@graph'] && Array.isArray(data['@graph'])) {
          for (const item of data['@graph']) {
            extractVideoObject(item);
          }
        } else {
          extractVideoObject(data);
        }
        // Stop if we have all essential fields
        if (title && channel && description) break;
      } catch {}
    }

    // =========================================================================
    // Step 2: Fallback to DOM selectors for missing metadata
    // =========================================================================
    if (!title) {
      title = document.querySelector('h1.ytd-watch-metadata yt-formatted-string')?.textContent?.trim()
           || document.querySelector('#title h1')?.textContent?.trim() || '';
    }
    if (!channel) {
      channel = document.querySelector('#owner #channel-name a')?.textContent?.trim()
             || document.querySelector('#channel-name a')?.textContent?.trim()
             || document.querySelector('#channel-name')?.textContent?.trim() || '';
    }
    if (!duration) {
      duration = document.querySelector('#ytd-player .ytp-time-duration')?.textContent?.trim() || '';
    }

    // =========================================================================
    // Step 3: Find or open the transcript panel
    // Reason: YouTube has two coexisting transcript panel DOM structures:
    // - Classic ("In this video"): ytd-transcript-segment-renderer
    // - Modern ("Transcript"): transcript-segment-view-model
    // YouTube selects the panel type server-side per video. We must support both.
    // All segment queries are scoped to the panel to avoid false matches.
    // =========================================================================

    // Reason: Find panel by checking for transcript segment elements inside it,
    // rather than relying on fragile target-id strings that YouTube changes.
    // Prefer visible panels to avoid picking up hidden/stale panels YouTube
    // leaves in the DOM during page transitions.
    const findTranscriptPanel = () => {
      const panels = document.querySelectorAll('ytd-engagement-panel-section-list-renderer');
      for (const panel of panels) {
        const hasSegments = panel.querySelector('ytd-transcript-segment-renderer')
                         || panel.querySelector('transcript-segment-view-model');
        if (!hasSegments) continue;
        const style = window.getComputedStyle(panel);
        if (style.display !== 'none' && style.visibility !== 'hidden') return panel;
      }
      return null;
    };

    // Reason: Auto-detect classic vs modern layout and use the correct selectors
    // for each. Queries are scoped to the panel to prevent matching unrelated UI.
    const extractFromPanel = (panel) => {
      const classicSegs = panel.querySelectorAll('ytd-transcript-segment-renderer');
      if (classicSegs.length > 0) {
        return [...classicSegs].map(seg => ({
          timestamp: seg.querySelector('.segment-timestamp')?.textContent?.trim() || '',
          text: seg.querySelector('yt-formatted-string.segment-text, .segment-text')?.textContent?.trim() || ''
        })).filter(t => t.timestamp && t.text);
      }
      const modernSegs = panel.querySelectorAll('transcript-segment-view-model');
      if (modernSegs.length > 0) {
        return [...modernSegs].map(seg => ({
          timestamp: seg.querySelector('.ytwTranscriptSegmentViewModelTimestamp')?.textContent?.trim() || '',
          text: [...seg.querySelectorAll('span.yt-core-attributed-string')].map(s => s.textContent || '').join('').trim() || ''
        })).filter(t => t.timestamp && t.text);
      }
      return null;
    };

    let panel = findTranscriptPanel();
    let needClose = false;

    if (!panel) {
      const btn = document.querySelector('ytd-video-description-transcript-section-renderer button')
                || document.querySelector('ytd-video-description-transcript-section-renderer [role="button"]');
      if (btn) {
        btn.click();
        needClose = true;

        // Poll for the panel container to appear (not individual segments)
        for (let i = 0; i < ${o}; i++) {
          await new Promise(r => setTimeout(r, 500));
          panel = findTranscriptPanel();
          if (panel) break;
        }
      }
    }

    // =========================================================================
    // Step 4: Extract transcript segments from the panel
    // =========================================================================

    // Reason: Close via captured panel element rather than hardcoded target-id.
    // This is resilient to YouTube changing the target-id string.
    const closePanel = () => {
      if (!needClose || !panel) return;
      const closeBtn = panel.querySelector('#visibility-button button')
                    || panel.querySelector('#visibility-button [role="button"]');
      if (closeBtn) closeBtn.click();
    };

    try {
      const transcript = panel ? (extractFromPanel(panel) || []) : [];
      return { videoId, title, channel, description, uploadDate, duration, genre, transcript };
    } finally {
      closePanel();
    }
  })()`,u=await r.executeJavaScript(s);if(!Sdi(u))throw new Error("Invalid transcript data structure");return u}async function N8r(t,e,r={}){let{preferCommand:n=!0,focusLeafBeforeCommand:o=!0}=r;if(n)try{return await e(J$e.SAVE_TO_VAULT,{leaf:t,focusLeaf:o}),F("Saved via webviewer:save-to-vault command"),{method:"command"}}catch(i){Ce("save-to-vault command failed, falling back:",i)}try{return await Promise.resolve(t.view.saveAsMarkdown()),F("Saved via view.saveAsMarkdown()"),{method:"view.saveAsMarkdown"}}catch(i){throw ie("Failed to save Web Viewer page:",i),i}}var tbt=v(()=>{Xe();EZ();X$e()});function ub(t){if(typeof t!="string")return null;let e=t.trim();return e||null}function IZ(t){if(typeof t!="string")return null;let e=t.trim();if(!e)return null;try{let r=new URL(e);r.hash="",(r.protocol==="http:"&&r.port==="80"||r.protocol==="https:"&&r.port==="443")&&(r.port=""),r.pathname!=="/"&&(r.pathname=r.pathname.replace(/\/+$/,""));let n=Array.from(r.searchParams.entries());return n.length>0?(n.sort(([o,i],[a,s])=>o!==a?o.localeCompare(a):i.localeCompare(s)),r.search=`?${new URLSearchParams(n).toString()}`):r.search="",r.toString()}catch{return e}}function j8r(t){return ub(t)??void 0}function rbt(t){let e=ub(t.url);if(!e)return null;let r=j8r(t.title),n=j8r(t.faviconUrl);return{url:e,title:r,faviconUrl:n,isLoaded:t.isLoaded,isActive:t.isActive?!0:void 0}}function x3(t){let e=new Map;for(let r of t){let n=rbt(r);if(!n)continue;let o=e.get(n.url);if(!o){e.set(n.url,n);continue}e.set(n.url,{...o,title:n.title??o.title,faviconUrl:n.faviconUrl??o.faviconUrl,isLoaded:n.isLoaded??o.isLoaded,isActive:o.isActive||n.isActive?!0:void 0})}return Array.from(e.values())}function $8r(t){let e=x3(t),r=!1;return e.map(n=>{if(!n.isActive)return n;if(!r)return r=!0,n;let{isActive:o,...i}=n;return i})}var AZ=v(()=>{});var Cdi,eLe,L8r=v(()=>{Xe();X$e();EZ();AZ();Cdi=["did-finish-load","page-favicon-updated","page-title-updated"],eLe=class t{constructor(e){this.lastActiveLeaf=null;this.activeWebTabState={activeWebTabForMentions:null,activeOrLastWebTab:null};this.activeWebTabLeaf=null;this.activeWebTabListeners=new Set;this.activeWebTabTrackingRefs=null;this.activeWebTabTrackingPreserveViewTypes=[];this.webviewLoadListeners=new Map;this.webviewLoadCallbacks=new Set;this.cancelScheduledWebviewLoadNotify=null;this.app=e.app,this.isSupportedPlatform=e.isSupportedPlatform,this.getActiveLeaf=e.getActiveLeaf,this.getLeaves=e.getLeaves,this.getPageInfo=e.getPageInfo}getLastActiveLeaf(){let e=this.lastActiveLeaf;return!e||!hde(e)?(this.lastActiveLeaf=null,null):O8r(this.app,e)?e:(this.lastActiveLeaf=null,null)}findLeafByUrl(e,r={}){let n=e.trim();if(!n)return null;let o=this.getLeaves();for(let c of o)if(c?.view?.url===n)return c;let i=IZ(n);if(!i)return null;let a=[];for(let c of o){let d=c?.view?.url;if(!d)continue;IZ(d)===i&&a.push(c)}if(a.length===0)return null;if(a.length===1)return a[0];let s=(r.title??"").trim();if(s){let c=s.toLowerCase(),d=[];for(let f of a)try{let m=(this.getPageInfo(f).title||"").trim();m&&m.toLowerCase()===c&&d.push(f)}catch{}if(d.length===1)return d[0];if(d.length>1){let f=this.getActiveLeaf();if(f&&d.includes(f))return f;let p=this.getLastActiveLeaf();return p&&d.includes(p)?p:(Ce("[WebViewerStateManager] Multiple leaves matched URL + title; returning first match.",{url:n,title:s,matches:d.length}),d[0])}}let u=this.getActiveLeaf();if(u&&a.includes(u))return u;let l=this.getLastActiveLeaf();return l&&a.includes(l)?l:(Ce("[WebViewerStateManager] Multiple leaves matched URL; returning first match as fallback.",{url:n,matches:a.length}),a[0])}getActiveWebTabState(){return this.activeWebTabState}subscribeActiveWebTabState(e){return this.activeWebTabListeners.add(e),()=>{this.activeWebTabListeners.delete(e)}}subscribeToWebviewLoad(e){return this.webviewLoadCallbacks.add(e),()=>{this.webviewLoadCallbacks.delete(e)}}startActiveWebTabTracking(e={}){this.activeWebTabTrackingRefs&&this.stopActiveWebTabTracking(),this.activeWebTabTrackingPreserveViewTypes=[...e.preserveOnViewTypes??[]];let r=this.app.workspace.on("active-leaf-change",o=>{try{hde(o)&&(this.lastActiveLeaf=o)}catch(i){Ce("WebViewerStateManager failed to track active leaf:",i)}this.recomputeActiveWebTabState({trigger:"active-leaf-change",activeLeaf:o}),this.subscribeToWebviewLoadEvents()}),n=this.app.workspace.on("layout-change",()=>{this.recomputeActiveWebTabState({trigger:"layout-change"}),this.subscribeToWebviewLoadEvents()});return this.activeWebTabTrackingRefs={activeLeafRef:r,layoutRef:n},this.recomputeActiveWebTabState({trigger:"active-leaf-change",activeLeaf:this.app.workspace.activeLeaf??null}),this.subscribeToWebviewLoadEvents(),this.activeWebTabTrackingRefs}subscribeToWebviewLoadEvents(){if(!this.isSupportedPlatform()){this.cleanupWebviewLoadListeners();return}try{let e=this.getLeaves(),r=new Set;for(let o of e){let i=o.view?.webview;if(i&&typeof i.addEventListener=="function"&&typeof i.removeEventListener=="function"){r.add(i);let a=this.webviewLoadListeners.get(i);if(a&&a.leaf===o)continue;if(a){for(let l of a.events)i.removeEventListener(l,a.handler);this.webviewLoadListeners.delete(i)}let s=()=>{this.recomputeActiveWebTabState({trigger:"webview-metadata",loadedLeaf:o}),this.scheduleWebviewLoadCallbackNotification()},u={leaf:o,handler:s,events:Cdi};for(let l of u.events)i.addEventListener(l,s);this.webviewLoadListeners.set(i,u)}}let n=[];for(let o of this.webviewLoadListeners.keys())r.has(o)||n.push(o);for(let o of n){let i=this.webviewLoadListeners.get(o);if(i){try{for(let a of i.events)o.removeEventListener(a,i.handler)}catch{}this.webviewLoadListeners.delete(o)}}}catch{}}cleanupWebviewLoadListeners(){for(let[e,{handler:r,events:n}]of this.webviewLoadListeners)try{if(typeof e.removeEventListener=="function")for(let o of n)e.removeEventListener(o,r)}catch{}this.webviewLoadListeners.clear()}scheduleWebviewLoadCallbackNotification(){if(this.cancelScheduledWebviewLoadNotify)return;let e=r=>{if(typeof window<"u"&&typeof window.requestAnimationFrame=="function"){let o=window.requestAnimationFrame(()=>r());return()=>window.cancelAnimationFrame(o)}let n=window.setTimeout(r,0);return()=>window.clearTimeout(n)};this.cancelScheduledWebviewLoadNotify=e(()=>{this.cancelScheduledWebviewLoadNotify=null,this.notifyWebviewLoadCallbacks()})}notifyWebviewLoadCallbacks(){for(let e of this.webviewLoadCallbacks)try{e()}catch{}}stopActiveWebTabTracking(){this.activeWebTabTrackingRefs=null,this.cleanupWebviewLoadListeners(),this.cancelScheduledWebviewLoadNotify?.(),this.cancelScheduledWebviewLoadNotify=null,this.activeWebTabState={activeWebTabForMentions:null,activeOrLastWebTab:null},this.activeWebTabLeaf=null,this.lastActiveLeaf=null,this.activeWebTabTrackingPreserveViewTypes=[]}recomputeActiveWebTabState(e){if(!this.isSupportedPlatform()){this.setActiveWebTabState({activeWebTabForMentions:null,activeOrLastWebTab:null}),this.activeWebTabLeaf=null;return}let r=this.getActiveLeaf();if(e.trigger==="webview-metadata"){let a=e.loadedLeaf;if(!(a===this.activeWebTabLeaf||a===r))return}let n=this.activeWebTabLeaf,o=this.activeWebTabState.activeWebTabForMentions;if(r)n=r,o=this.toWebTabContext(r);else if(e.trigger==="active-leaf-change"){let a=e.activeLeaf?.view?.getViewType();!!(a&&this.activeWebTabTrackingPreserveViewTypes.includes(a))||(n=null,o=null)}if(e.trigger!=="webview-metadata"&&n&&(this.getLeaves().includes(n)||(n=null,o=null)),e.trigger==="layout-change")n&&(o=this.toWebTabContext(n));else if(e.trigger==="webview-metadata"){let a=e.loadedLeaf;n=a,o=this.toWebTabContext(a)}this.activeWebTabLeaf=n;let i=this.computeActiveOrLastWebTabContext();this.setActiveWebTabState({activeWebTabForMentions:o,activeOrLastWebTab:i})}computeActiveOrLastWebTabContext(){try{let e=this.getActiveLeaf()??this.getLastActiveLeaf();return e?this.toWebTabContext(e):null}catch{return null}}toWebTabContext(e){try{let r=this.getPageInfo(e),n=(r.url||"").trim();if(!n)return null;let o=(r.title||"").trim(),i=(r.faviconUrl||"").trim();return{url:n,title:o||void 0,faviconUrl:i||void 0}}catch{return null}}setActiveWebTabState(e){let r=this.activeWebTabState;t.areWebTabContextsEqual(r.activeWebTabForMentions,e.activeWebTabForMentions)&&t.areWebTabContextsEqual(r.activeOrLastWebTab,e.activeOrLastWebTab)||(this.activeWebTabState=e,this.notifyActiveWebTabListeners())}notifyActiveWebTabListeners(){for(let e of this.activeWebTabListeners)try{e(this.activeWebTabState)}catch(r){Ce("[WebViewerStateManager] Error in Active Web Tab listener:",r)}}static areWebTabContextsEqual(e,r){return e===r?!0:!e||!r?!1:e.url===r.url&&e.title===r.title&&e.faviconUrl===r.faviconUrl}}});var F8r,tLe,k8r=v(()=>{F8r=require("obsidian");Xe();tbt();X$e();L8r();EZ();tLe=class{constructor(e){this.internalPluginApi=null;this.internalApiWarned=!1;this.app=e,this.stateManager=new eLe({app:e,isSupportedPlatform:()=>this.isSupportedPlatform(),getActiveLeaf:()=>this.getActiveLeaf(),getLeaves:()=>this.getLeaves(),getPageInfo:r=>RZ(r)})}isSupportedPlatform(){return F8r.Platform.isDesktopApp===!0}getAvailability(){let e=this.isSupportedPlatform()?"desktop":"mobile";return this.isSupportedPlatform()?this.getLeaves().length>0?{supported:!0,available:!0,platform:e}:this.getInternalPluginApi()?{supported:!0,available:!0,platform:e}:T8r(this.app,J$e.OPEN)?{supported:!0,available:!0,platform:e,reason:"No Web Viewer leaves open, but Web Viewer commands are registered."}:{supported:!0,available:!1,platform:e,reason:"Web Viewer does not appear available."}:{supported:!1,available:!1,platform:e,reason:"Web Viewer is not supported on mobile platforms."}}assertAvailable(){let e=this.getAvailability();if(!e.supported)throw new H$e(e.reason??"Web Viewer unsupported.");if(!e.available)throw new Qw(e.reason??"Web Viewer is not available.")}getLeaves(){return this.isSupportedPlatform()?this.app.workspace.getLeavesOfType(C3):[]}getActiveLeaf(){let e=this.app.workspace.activeLeaf;return hde(e)?e:null}getLastActiveLeaf(){return this.stateManager.getLastActiveLeaf()}async resolveLeaf(e={}){this.assertAvailable();let{strategy:r="active-or-last",focus:n=!1,requireWebviewReady:o=!1,timeoutMs:i=15e3}=e,a=this.getActiveLeaf();if(a)return n&&this.app.workspace.setActiveLeaf(a,{focus:!0}),o&&await this.waitForWebviewReady(a,i),a;if(r==="active-or-last"||r==="active-or-last-or-any"){let s=this.getLastActiveLeaf();if(s)return n&&this.app.workspace.setActiveLeaf(s,{focus:!0}),o&&await this.waitForWebviewReady(s,i),s}if(r==="active-or-last-or-any"){let s=this.getLeaves()[0];if(s)return n&&this.app.workspace.setActiveLeaf(s,{focus:!0}),o&&await this.waitForWebviewReady(s,i),s}throw new W$e("No Web Viewer leaf found.")}async waitForWebviewReady(e,r){let n=e.view;n.webviewMounted===void 0||n.webviewFirstLoadFinished===void 0||n.webviewMounted&&n.webviewFirstLoadFinished||await x8r(()=>!!(n.webviewMounted&&n.webviewFirstLoadFinished),r,100,"Waiting for Web Viewer webview ready")}findLeafByUrl(e,r={}){return this.stateManager.findLeafByUrl(e,r)}getActiveWebTabState(){return this.stateManager.getActiveWebTabState()}subscribeActiveWebTabState(e){return this.stateManager.subscribeActiveWebTabState(e)}subscribeToWebviewLoad(e){return this.stateManager.subscribeToWebviewLoad(e)}startActiveWebTabTracking(e={}){return this.stateManager.startActiveWebTabTracking(e)}stopActiveWebTabTracking(){this.stateManager.stopActiveWebTabTracking()}async executeCommand(e,r={}){let n=ebt(this.app);if(!n)throw new Qw("Command manager unavailable.");let{leaf:o,focusLeaf:i=!1}=r;o&&i&&this.app.workspace.setActiveLeaf(o,{focus:!0});try{if(n.executeCommandById(e)===!1)throw new Qw(`Command returned false: ${e}`)}catch(a){throw ie(`Failed to execute command ${e}:`,a),new Qw(`Failed to execute command ${e}: ${C8r(a)}`)}}getInternalPluginApi(){if(this.internalPluginApi)return this.internalPluginApi;let e=E8r(this.app,()=>{this.internalApiWarned||(this.internalApiWarned=!0,Ce("[WebViewerService] internalPlugins.plugins has unexpected structure. Web Viewer integration may not work correctly."))});return e&&(this.internalPluginApi=e),e}getPageInfo(e){return RZ(e)}async getReaderModeMarkdown(e,r){return P8r(e,r)}async getSelectedText(e,r=!0){return Z$e(e,r)}async getSelectedMarkdown(e){return Y$e(e)}async getPageMarkdown(e){return M8r(e)}async getHtml(e,r=!0){return R8r(e,r)}getYouTubeVideoId(e){return Q$e(e)}isYouTubeVideoUrl(e){return I8r(e)}async getYouTubeTranscript(e,r){return A8r(e,r)}async saveToVault(e,r={}){return N8r(e,(n,o)=>this.executeCommand(n,o),r)}}});var B8r={};En(B8r,{getWebViewerMarkdown:()=>xdi,getWebViewerPageInfo:()=>Edi,getWebViewerSelectedMarkdown:()=>Odi,getWebViewerSelectedText:()=>Tdi,getWebViewerService:()=>md,resolveWebViewerLeaf:()=>NZ,saveWebViewerToVault:()=>Pdi,startActiveWebTabTracking:()=>nbt});function md(t){let e=q8r.get(t);if(e)return e;let r=new tLe(t);return q8r.set(t,r),r}function nbt(t,e){return md(t).startActiveWebTabTracking(e)}async function NZ(t,e){return md(t).resolveLeaf(e)}async function xdi(t,e){let r=await NZ(t,e);return md(t).getReaderModeMarkdown(r)}async function Tdi(t,e=!0,r){let n=await NZ(t,r);return md(t).getSelectedText(n,e)}async function Odi(t,e){let r=await NZ(t,e);return md(t).getSelectedMarkdown(r)}async function Edi(t,e){let r=await NZ(t,e);return md(t).getPageInfo(r)}async function Pdi(t,e,r){let n=await NZ(t,{...r,focus:!0});return md(t).saveToVault(n,e)}var q8r,T3=v(()=>{k8r();q8r=new WeakMap});var ofe=S((pQr,WFe)=>{((t,e)=>{typeof define=="function"&&define.amd?define([],e):typeof WFe=="object"&&WFe.exports?WFe.exports=e():t.fuzzysort=e()})(pQr,t=>{"use strict";var e=(L,J)=>{if(!L||!J)return W;var ne=p(L);Z(J)||(J=f(J));var D=ne.bitflags;return(D&J._bitflags)!==D?W:h(ne,J)},r=(L,J,ne)=>{if(!L)return ne?.all?m(J,ne):X;var D=p(L),N=D.bitflags,z=D.containsSpace,H=c(ne?.threshold||0),oe=ne?.limit||V,Q=0,de=0,fe=J.length;function De(so){Q<oe?(le.add(so),++Q):(++de,so._score>le.peek()._score&&le.replaceTop(so))}if(ne?.key)for(var st=ne.key,Le=0;Le<fe;++Le){var Bt=J[Le],Pt=q(Bt,st);if(Pt&&(Z(Pt)||(Pt=f(Pt)),(N&Pt._bitflags)===N)){var Nt=h(D,Pt);Nt!==W&&(Nt._score<H||(Nt.obj=Bt,De(Nt)))}}else if(ne?.keys){var $e=ne.keys,Fr=$e.length;e:for(var Le=0;Le<fe;++Le){var Bt=J[Le];{for(var ft=0,Ve=0;Ve<Fr;++Ve){var st=$e[Ve],Pt=q(Bt,st);if(!Pt){B[Ve]=re;continue}Z(Pt)||(Pt=f(Pt)),B[Ve]=Pt,ft|=Pt._bitflags}if((N&ft)!==N)continue}if(z)for(let An=0;An<D.spaceSearches.length;An++)I[An]=Y;for(var Ve=0;Ve<Fr;++Ve){if(Pt=B[Ve],Pt===re){k[Ve]=re;continue}if(k[Ve]=h(D,Pt,!1,z),k[Ve]===W){k[Ve]=re;continue}if(z)for(let _i=0;_i<D.spaceSearches.length;_i++){if(A[_i]>-1e3&&I[_i]>Y){var Rt=(I[_i]+A[_i])/4;Rt>I[_i]&&(I[_i]=Rt)}A[_i]>I[_i]&&(I[_i]=A[_i])}}if(z){for(let An=0;An<D.spaceSearches.length;An++)if(I[An]===Y)continue e}else{var ze=!1;for(let An=0;An<Fr;An++)if(k[An]._score!==Y){ze=!0;break}if(!ze)continue}var He=new s(Fr);for(let An=0;An<Fr;An++)He[An]=k[An];if(z){var We=0;for(let An=0;An<D.spaceSearches.length;An++)We+=I[An]}else{var We=Y;for(let _i=0;_i<Fr;_i++){var Nt=He[_i];if(Nt._score>-1e3&&We>Y){var Rt=(We+Nt._score)/4;Rt>We&&(We=Rt)}Nt._score>We&&(We=Nt._score)}}if(He.obj=Bt,He._score=We,ne?.scoreFn){if(We=ne.scoreFn(He),!We)continue;We=c(We),He._score=We}We<H||De(He)}}else for(var Le=0;Le<fe;++Le){var Pt=J[Le];if(Pt&&(Z(Pt)||(Pt=f(Pt)),(N&Pt._bitflags)===N)){var Nt=h(D,Pt);Nt!==W&&(Nt._score<H||De(Nt))}}if(Q===0)return X;for(var Jt=new Array(Q),Le=Q-1;Le>=0;--Le)Jt[Le]=le.poll();return Jt.total=Q+de,Jt},n=(L,J="<b>",ne="</b>")=>{for(var D=typeof J=="function"?J:void 0,N=L.target,z=N.length,H=L.indexes,oe="",Q=0,de=0,fe=!1,De=[],st=0;st<z;++st){var Le=N[st];if(H[de]===st){if(++de,fe||(fe=!0,D?(De.push(oe),oe=""):oe+=J),de===H.length){D?(oe+=Le,De.push(D(oe,Q++)),oe="",De.push(N.substr(st+1))):oe+=Le+ne+N.substr(st+1);break}}else fe&&(fe=!1,D?(De.push(D(oe,Q++)),oe=""):oe+=ne);oe+=Le}return D?De:oe},o=L=>{typeof L=="number"?L=""+L:typeof L!="string"&&(L="");var J=b(L);return u(L,{_targetLower:J._lower,_targetLowerCodes:J.lowerCodes,_bitflags:J.bitflags})},i=()=>{T.clear(),O.clear()};class a{get indexes(){return this._indexes.slice(0,this._indexes.len).sort((J,ne)=>J-ne)}set indexes(J){return this._indexes=J}highlight(J,ne){return n(this,J,ne)}get score(){return l(this._score)}set score(J){this._score=c(J)}}class s extends Array{get score(){return l(this._score)}set score(J){this._score=c(J)}}var u=(L,J)=>{let ne=new a;return ne.target=L,ne.obj=J.obj??W,ne._score=J._score??Y,ne._indexes=J._indexes??[],ne._targetLower=J._targetLower??"",ne._targetLowerCodes=J._targetLowerCodes??W,ne._nextBeginningIndexes=J._nextBeginningIndexes??W,ne._bitflags=J._bitflags??0,ne},l=L=>L===Y?0:L>1?L:Math.E**(((-L+1)**.04307-1)*-2),c=L=>L===0?Y:L>1?L:1-Math.pow(Math.log(L)/-2+1,1/.04307),d=L=>{typeof L=="number"?L=""+L:typeof L!="string"&&(L=""),L=L.trim();var J=b(L),ne=[];if(J.containsSpace){var D=L.split(/\s+/);D=[...new Set(D)];for(var N=0;N<D.length;N++)if(D[N]!==""){var z=b(D[N]);ne.push({lowerCodes:z.lowerCodes,_lower:D[N].toLowerCase(),containsSpace:!1})}}return{lowerCodes:J.lowerCodes,_lower:J._lower,containsSpace:J.containsSpace,bitflags:J.bitflags,spaceSearches:ne}},f=L=>{if(L.length>999)return o(L);var J=T.get(L);return J!==void 0||(J=o(L),T.set(L,J)),J},p=L=>{if(L.length>999)return d(L);var J=O.get(L);return J!==void 0||(J=d(L),O.set(L,J)),J},m=(L,J)=>{var ne=[];ne.total=L.length;var D=J?.limit||V;if(J?.key)for(var N=0;N<L.length;N++){var z=L[N],H=q(z,J.key);if(H!=W){Z(H)||(H=f(H));var oe=u(H.target,{_score:H._score,obj:z});if(ne.push(oe),ne.length>=D)return ne}}else if(J?.keys)for(var N=0;N<L.length;N++){for(var z=L[N],Q=new s(J.keys.length),de=J.keys.length-1;de>=0;--de){var H=q(z,J.keys[de]);if(!H){Q[de]=re;continue}Z(H)||(H=f(H)),H._score=Y,H._indexes.len=0,Q[de]=H}if(Q.obj=z,Q._score=Y,ne.push(Q),ne.length>=D)return ne}else for(var N=0;N<L.length;N++){var H=L[N];if(H!=W&&(Z(H)||(H=f(H)),H._score=Y,H._indexes.len=0,ne.push(H),ne.length>=D))return ne}return ne},h=(L,J,ne=!1,D=!1)=>{if(ne===!1&&L.containsSpace)return y(L,J,D);for(var N=L._lower,z=L.lowerCodes,H=z[0],oe=J._targetLowerCodes,Q=z.length,de=oe.length,Le=0,fe=0,De=0;;){var st=H===oe[fe];if(st){if(E[De++]=fe,++Le,Le===Q)break;H=z[Le]}if(++fe,fe>=de)return W}var Le=0,Bt=!1,Pt=0,Nt=J._nextBeginningIndexes;Nt===W&&(Nt=J._nextBeginningIndexes=w(J.target)),fe=E[0]===0?0:Nt[E[0]-1];var $e=0;if(fe!==de)for(;;)if(fe>=de){if(Le<=0||(++$e,$e>200))break;--Le;var Fr=P[--Pt];fe=Nt[Fr]}else{var st=z[Le]===oe[fe];if(st){if(P[Pt++]=fe,++Le,Le===Q){Bt=!0;break}++fe}else fe=Nt[fe]}var ft=Q<=1?-1:J._targetLower.indexOf(N,E[0]),Ve=!!~ft,Rt=Ve?ft===0||J._nextBeginningIndexes[ft-1]===ft:!1;if(Ve&&!Rt){for(var ze=0;ze<Nt.length;ze=Nt[ze])if(!(ze<=ft)){for(var He=0;He<Q&&z[He]===J._targetLowerCodes[ze+He];He++);if(He===Q){ft=ze,Rt=!0;break}}}var We=An=>{for(var _i=0,Nl=0,Vi=1;Vi<Q;++Vi)An[Vi]-An[Vi-1]!==1&&(_i-=An[Vi],++Nl);var g_=An[Q-1]-An[0]-(Q-1);if(_i-=(12+g_)*Nl,An[0]!==0&&(_i-=An[0]*An[0]*.2),!Bt)_i*=1e3;else{for(var mg=1,Vi=Nt[0];Vi<de;Vi=Nt[Vi])++mg;mg>24&&(_i*=(mg-24)*10)}return _i-=(de-Q)/2,Ve&&(_i/=1+Q*Q*1),Rt&&(_i/=1+Q*Q*1),_i-=(de-Q)/2,_i};if(Bt)if(Rt){for(var ze=0;ze<Q;++ze)E[ze]=ft+ze;var Jt=E,so=We(E)}else var Jt=P,so=We(P);else{if(Ve)for(var ze=0;ze<Q;++ze)E[ze]=ft+ze;var Jt=E,so=We(Jt)}J._score=so;for(var ze=0;ze<Q;++ze)J._indexes[ze]=Jt[ze];J._indexes.len=Q;let au=new a;return au.target=J.target,au._score=J._score,au._indexes=J._indexes,au},y=(L,J,ne)=>{for(var D=new Set,N=0,z=W,H=0,oe=L.spaceSearches,Q=oe.length,de=0,fe=()=>{for(let Rt=de-1;Rt>=0;Rt--)J._nextBeginningIndexes[R[Rt*2+0]]=R[Rt*2+1]},De=!1,Ve=0;Ve<Q;++Ve){A[Ve]=Y;var st=oe[Ve];if(z=h(st,J),ne){if(z===W)continue;De=!0}else if(z===W)return fe(),W;var Le=Ve===Q-1;if(!Le){var Bt=z._indexes,Pt=!0;for(let ze=0;ze<Bt.len-1;ze++)if(Bt[ze+1]-Bt[ze]!==1){Pt=!1;break}if(Pt){var Nt=Bt[Bt.len-1]+1,$e=J._nextBeginningIndexes[Nt-1];for(let ze=Nt-1;ze>=0&&$e===J._nextBeginningIndexes[ze];ze--)J._nextBeginningIndexes[ze]=Nt,R[de*2+0]=ze,R[de*2+1]=$e,de++}}N+=z._score/Q,A[Ve]=z._score/Q,z._indexes[0]<H&&(N-=(H-z._indexes[0])*2),H=z._indexes[0];for(var Fr=0;Fr<z._indexes.len;++Fr)D.add(z._indexes[Fr])}if(ne&&!De)return W;fe();var ft=h(L,J,!0);if(ft!==W&&ft._score>N){if(ne)for(var Ve=0;Ve<Q;++Ve)A[Ve]=ft._score/Q;return ft}ne&&(z=J),z._score=N;var Ve=0;for(let Rt of D)z._indexes[Ve++]=Rt;return z._indexes.len=Ve,z},g=L=>L.replace(/\p{Script=Latin}+/gu,J=>J.normalize("NFD")).replace(/[\u0300-\u036f]/g,""),b=L=>{L=g(L);for(var J=L.length,ne=L.toLowerCase(),D=[],N=0,z=!1,H=0;H<J;++H){var oe=D[H]=ne.charCodeAt(H);if(oe===32){z=!0;continue}var Q=oe>=97&&oe<=122?oe-97:oe>=48&&oe<=57?26:oe<=127?30:31;N|=1<<Q}return{lowerCodes:D,bitflags:N,containsSpace:z,_lower:ne}},_=L=>{for(var J=L.length,ne=[],D=0,N=!1,z=!1,H=0;H<J;++H){var oe=L.charCodeAt(H),Q=oe>=65&&oe<=90,de=Q||oe>=97&&oe<=122||oe>=48&&oe<=57,fe=Q&&!N||!z||!de;N=Q,z=de,fe&&(ne[D++]=H)}return ne},w=L=>{L=g(L);for(var J=L.length,ne=_(L),D=[],N=ne[0],z=0,H=0;H<J;++H)N>H?D[H]=N:(N=ne[++z],D[H]=N===void 0?J:N);return D},T=new Map,O=new Map,E=[],P=[],R=[],I=[],A=[],B=[],k=[],q=(L,J)=>{var ne=L[J];if(ne!==void 0)return ne;if(typeof J=="function")return J(L);var D=J;Array.isArray(J)||(D=J.split("."));for(var N=D.length,z=-1;L&&++z<N;)L=L[D[z]];return L},Z=L=>typeof L=="object"&&typeof L._bitflags=="number",V=1/0,Y=-V,X=[];X.total=0;var W=null,re=o(""),ue=L=>{var J=[],ne=0,D={},N=z=>{for(var H=0,oe=J[H],Q=1;Q<ne;){var de=Q+1;H=Q,de<ne&&J[de]._score<J[Q]._score&&(H=de),J[H-1>>1]=J[H],Q=1+(H<<1)}for(var fe=H-1>>1;H>0&&oe._score<J[fe]._score;fe=(H=fe)-1>>1)J[H]=J[fe];J[H]=oe};return D.add=z=>{var H=ne;J[ne++]=z;for(var oe=H-1>>1;H>0&&z._score<J[oe]._score;oe=(H=oe)-1>>1)J[H]=J[oe];J[H]=z},D.poll=z=>{if(ne!==0){var H=J[0];return J[0]=J[--ne],N(),H}},D.peek=z=>{if(ne!==0)return J[0]},D.replaceTop=z=>{J[0]=z,N()},D},le=ue();return{single:e,go:r,prepare:o,cleanup:i}})});var Ynn={};En(Ynn,{ContextCompactor:()=>wSt});var wSt,Qnn=v(()=>{Xe();LW();ra();wSt=class t{constructor(){this.MIN_ITEM_SIZE=5e4;this.MAX_CONCURRENCY=3;this.TEMPERATURE=.1;this.MAX_ITEM_SIZE=5e5;this.BLOCK_TYPES=["note_context","active_note","url_content","selected_text","embedded_note","embedded_pdf","web_tab_context","active_web_tab","youtube_video_context"];this.PROMPT=`Summarize the following content, preserving:
- Key concepts and main ideas
- Important facts, names, and dates
- Technical details relevant for Q&A

Keep the summary concise but information-dense. Output only the summary.

Title: {title}
Path: {path}

Content:
{content}

Summary:`;this.URL_BASED_TYPES=["url_content","web_tab_context","active_web_tab","youtube_video_context"];this.chatModelManager=U0.getInstance()}static getInstance(){return t.instance||(t.instance=new t),t.instance}async compact(e){let r=e.length;F(`[ContextCompactor] Starting compaction of ${r} chars`);let n=this.parseItems(e);if(n.length===0)return this.noOpResult(e);let o=await this.summarizeItems(n);if(o.size===0)return this.noOpResult(e);let i=this.rebuild(e,n,o);return F(`[ContextCompactor] Done: ${r} -> ${i.length} chars (${((1-i.length/r)*100).toFixed(0)}% reduction)`),{content:i,wasCompacted:!0,originalCharCount:r,compactedCharCount:i.length,itemsProcessed:n.length,itemsSummarized:o.size}}noOpResult(e){return{content:e,wasCompacted:!1,originalCharCount:e.length,compactedCharCount:e.length,itemsProcessed:0,itemsSummarized:0}}parseItems(e){let r=[];for(let n of this.BLOCK_TYPES){let o=new RegExp(`<${n}>[\\s\\S]*?<\\/${n}>`,"g"),i;for(;(i=o.exec(e))!==null;){let a=this.parseBlock(i[0],n,i.index);a&&r.push(a)}}return r.sort((n,o)=>n.startIndex-o.startIndex),r.filter((n,o)=>!r.some((i,a)=>o!==a&&i.startIndex<=n.startIndex&&i.endIndex>=n.endIndex))}parseBlock(e,r,n){let o=l=>new RegExp(`<${l}>([^<]*)</${l}>`).exec(e)?.[1]||"",i=()=>/<content>([\s\S]*?)<\/content>/.exec(e)?.[1]||"",a=o("path")||o("url"),s=o("title")||a.split("/").pop()||"Untitled",u=i();return{type:r,path:a,title:s,content:u,metadata:{ctime:o("ctime"),mtime:o("mtime")},originalXml:e,startIndex:n,endIndex:n+e.length}}async summarizeItems(e){let r=new Map,n=e.map((o,i)=>({index:i,item:o})).filter(({item:o})=>o.content.length>=this.MIN_ITEM_SIZE);if(n.length===0)return r;F(`[ContextCompactor] Summarizing ${n.length} items`);for(let o=0;o<n.length;o+=this.MAX_CONCURRENCY){let i=n.slice(o,o+this.MAX_CONCURRENCY);(await Promise.all(i.map(async({index:s,item:u})=>{try{return{index:s,summary:await this.summarize(u)}}catch(l){return F(`[ContextCompactor] Failed to summarize item ${s}:`,l),{index:s,summary:null}}}))).forEach(({index:s,summary:u})=>{u&&r.set(s,u)})}return r.size<n.length*.5?(F("[ContextCompactor] High failure rate, aborting compaction"),new Map):r}async summarize(e){let r=e.content;r.length>this.MAX_ITEM_SIZE&&(r=r.slice(0,this.MAX_ITEM_SIZE)+`
[TRUNCATED]`);let n=this.PROMPT.replace("{title}",e.title).replace("{path}",e.path).replace("{content}",r),i=await(await this.chatModelManager.getChatModelWithTemperature(this.TEMPERATURE)).invoke([new Au(n)]);return typeof i.content=="string"?i.content.trim():""}rebuild(e,r,n){let o=e;return Array.from(n.keys()).sort((i,a)=>a-i).forEach(i=>{let a=r[i],s=n.get(i),u=this.buildBlock(a,s);o=o.slice(0,a.startIndex)+u+o.slice(a.endIndex)}),o}buildBlock(e,r){let n=[`<${e.type}>`];if(e.title&&n.push(`<title>${e.title}</title>`),e.path){let o=this.URL_BASED_TYPES.includes(e.type)?"url":"path";n.push(`<${o}>${e.path}</${o}>`)}return e.metadata.ctime&&n.push(`<ctime>${e.metadata.ctime}</ctime>`),e.metadata.mtime&&n.push(`<mtime>${e.metadata.mtime}</mtime>`),n.push(`<content>[SUMMARIZED]
${r}</content>`),n.push(`</${e.type}>`),n.join(`
`)}}});var $0i={};En($0i,{default:()=>cBe});module.exports=wpe($0i);aA();na();Xe();var qbr=$(oH()),ZG=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)||(F("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,qbr.MD5)(n).toString()}getCachePath(e){return`${this.cacheDir}/${e}.md`}async get(e){try{let r=this.memoryCache.get(e);if(r)return F("Memory cache hit for file:",e),r.content;let n=this.getCachePath(e);if(await app.vault.adapter.exists(n)){F("File cache hit:",e);let o=await app.vault.adapter.read(n),i,a=o.trim();if(a.startsWith("{")&&a.endsWith("}")||a.startsWith("[")&&a.endsWith("]"))try{i=JSON.parse(o)}catch{i=o}else i=o;let s={content:i,timestamp:Date.now()};return this.memoryCache.set(e,s),s.content}return F("Cache miss for file:",e),null}catch(r){return ie("Error reading from file cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCachePath(e),o=Date.now(),i={content:r,timestamp:o};this.memoryCache.set(e,i);let a;typeof r=="string"?a=r:a=JSON.stringify(r,null,2),await app.vault.adapter.write(n,a),F("Cached file content:",e)}catch(n){ie("Error writing to file cache:",n)}}async remove(e){try{this.memoryCache.delete(e);let r=this.getCachePath(e);await app.vault.adapter.exists(r)&&(await app.vault.adapter.remove(r),F("Removed file from cache:",e))}catch(r){ie("Error removing file from cache:",r)}}async clear(){try{if(this.memoryCache.clear(),await app.vault.adapter.exists(this.cacheDir)){let e=await app.vault.adapter.list(this.cacheDir);F("Clearing file cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){ie("Error clearing file cache:",e)}}};Xe();Wb();Qe();var Vbr=$(oH()),tEe=require("obsidian"),Hbr=$(YG());oat();var dq=class dq{constructor(){this.cacheDir=".copilot/project-context-cache";this.memoryCache=new Map;this.projectMutexMap=new Map;this.mutexCreationMutex=new nH;this.handleFileEvent=e=>{e instanceof tEe.TFile&&this.debouncedHandleFileChange(e)};this.handleFileChange=async e=>{try{if(e.extension!=="md")return;let n=ee().projectList||[];for(let o of n){let{inclusions:i,exclusions:a}=Zl({inclusions:o.contextSource.inclusions,exclusions:o.contextSource.exclusions,isProject:!0});fu(e,i,a,!0)&&(await this.invalidateMarkdownContext(o),F(`Invalidated markdown context for project ${o.name} due to file change: ${e.path}`))}}catch(r){ie("Error handling file change for project context cache:",r)}};this.debouncedHandleFileChange=(0,Hbr.default)(e=>{this.handleFileChange(e)},dq.DEBOUNCE_DELAY,{leading:!0,trailing:!0});this.vault=app.vault,this.fileCache=ZG.getInstance(),this.initializeEventListeners()}static getInstance(){return dq.instance||(dq.instance=new dq),dq.instance}cleanup(){this.debouncedHandleFileChange.cancel(),this.vault.off("create",this.handleFileEvent),this.vault.off("modify",this.handleFileEvent),this.vault.off("delete",this.handleFileEvent),this.vault.off("rename",this.handleFileEvent),this.projectMutexMap.clear()}initializeEventListeners(){this.vault.on("create",this.handleFileEvent),this.vault.on("modify",this.handleFileEvent),this.vault.on("delete",this.handleFileEvent),this.vault.on("rename",this.handleFileEvent)}async ensureCacheDir(){await this.vault.adapter.exists(this.cacheDir)||(F("Creating project context cache directory:",this.cacheDir),await this.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){return(0,Vbr.MD5)(e.id).toString()}getCachePath(e){return`${this.cacheDir}/${e}.json`}async getOrCreateProjectMutex(e){let r=e.id,n=this.projectMutexMap.get(r);return n||await this.mutexCreationMutex.runExclusive(async()=>{let o=this.projectMutexMap.get(r);if(o)return o;let i=new nH;return this.projectMutexMap.set(r,i),F(`Created new mutex for project: ${e.name} (ID: ${r})`),i})}async get(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);if(n)return F("Memory cache hit for project:",e.name),n;let o=this.getCachePath(r);if(await this.vault.adapter.exists(o)){F("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 F("Cache miss for project:",e.name),null}catch(r){return ie("Error reading from project context cache:",r),null}}async getOrInitializeCache(e){let r=await this.get(e);if(r)return F(`[getOrInitializeCache] Project ${e.name}: Existing cache found. MarkdownNeedsReload: ${r.markdownNeedsReload}`),r;F(`[getOrInitializeCache] Project ${e.name}: No existing cache found, building fresh context.`);let n=this.createEmptyCache();return await this.setWithoutMutex(e,n),n}getSync(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);return n?(F("Memory cache hit for project:",e.name),n):(F("Memory cache miss for project:",e.name),null)}catch(r){return ie("Error reading from project context memory cache:",r),null}}async set(e,r){let n=await this.getOrCreateProjectMutex(e);return n.isLocked()&&F(`Waiting for project cache lock for project: ${e.name}`),await n.runExclusive(async()=>(F(`Acquired cache lock for project: ${e.name}`),await this.setWithoutMutex(e,r)))}async setWithoutMutex(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);F("Caching context for project:",e.name);let i=JSON.parse(JSON.stringify(r));this.memoryCache.set(n,i),await this.vault.adapter.write(o,JSON.stringify(i))}catch(n){throw ie("Error writing to project context cache:",n),n}}createEmptyCache(){return{markdownContext:"",webContexts:{},youtubeContexts:{},fileContexts:{},timestamp:Date.now(),markdownNeedsReload:!0}}async clearAllCache(){try{let e=new Set;for(let r of Array.from(this.memoryCache.values()))if(r?.fileContexts)for(let n in r.fileContexts)r.fileContexts[n]?.cacheKey&&e.add(r.fileContexts[n].cacheKey);if(this.memoryCache.clear(),await this.vault.adapter.exists(this.cacheDir)){let r=await this.vault.adapter.list(this.cacheDir);F("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);F(`Cleared ${e.size} file content cache entries associated with projects`)}catch(e){ie("Error clearing project context cache:",e)}}async clearForProject(e){try{F(`[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){F(`[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++):Ce(`[clearForProject] Project ${e.name}: Skipped removing FileCache entry for file ${s} due to missing cacheKey.`)}F(`[clearForProject] Project ${e.name}: Attempted to clear ${o} entries from FileCache.`)}}else F(`[clearForProject] Project ${e.name}: No fileContexts found in existing project cache to clear from FileCache.`);this.memoryCache.delete(r),F(`[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),F(`[clearForProject] Project ${e.name}: Successfully removed main project cache file: ${i}`)):F(`[clearForProject] Project ${e.name}: Main project cache file not found (already deleted or never existed): ${i}`),this.projectMutexMap.delete(e.id),F(`[clearForProject] Cleaned up mutex for project: ${e.name}`),F(`[clearForProject] Completed for project: ${e.name}`)}catch(r){ie(`[clearForProject] Error for project ${e.name} (ID: ${e.id}):`,r)}}async invalidateMarkdownContext(e,r=!1){await this.updateCacheSafely(e,n=>{n.markdownContext="",n.markdownNeedsReload=!0,r&&(n.webContexts={},n.youtubeContexts={},F(`Flagged Web/YouTube contexts for full reload for project ${e.name}`));let o=this.cleanupFileReferencesInCache(e,n);return F(`Invalidated markdown context for project ${e.name}`),o},!0)}async updateMarkdownContext(e,r){return await this.updateCacheSafely(e,n=>(n.markdownContext=r,n.markdownNeedsReload=!1,F(`Updated markdown context for project ${e.name}`),n))}async clearMarkdownContext(e){await this.updateCacheSafely(e,r=>(r.markdownContext="",r.markdownNeedsReload=!0,r))}async getOrReuseFileContext(e,r){try{let n=await this.getFileContext(e,r);if(n)return n;let o=await this.searchOtherProjectsForFile(r);return o?(await this.associateCacheWithProject(e,r,o.cacheKey),F(`Reused cached content from other project for: ${r} in project ${e.name}`),o.content):null}catch(n){return ie(`Error in getOrReuseFileContext for ${r} in project ${e.name}:`,n),null}}async getFileContext(e,r){try{if(!r||typeof r!="string")return ie("Error getting file context: filePath is invalid.",{project:e.name,filePath:r}),null;let n=await this.get(e);if(!n||!n.fileContexts||!n.fileContexts[r])return null;let o=n.fileContexts[r];if(!o||!o.cacheKey||typeof o.cacheKey!="string"||o.cacheKey.trim()==="")return Ce(`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"?(Ce(`cacheKey is not a string for filePath: ${r} in project ${e.name}. Treating as cache miss.`,{project:e.name,filePath:r,cacheKey:i}),null):await this.fileCache.get(i)}catch(n){return ie(`Error getting file context for ${r} in project ${e.name}:`,n),null}}async setFileContext(e,r,n){return await this.updateCacheSafelyAsync(e,async o=>{o.fileContexts||(o.fileContexts={});let i=this.vault.getAbstractFileByPath(r);if(!(i instanceof tEe.TFile))throw new Error(`File not found: ${r}`);let a=this.fileCache.getCacheKey(i,e.id);return await this.fileCache.set(a,n),o.fileContexts[r]={timestamp:Date.now(),cacheKey:a},F(`Added/updated file context for ${r} in project ${e.name}`),o})}async removeFileContext(e,r){return await this.updateCacheSafelyAsync(e,async n=>{if(n.fileContexts&&n.fileContexts[r]){let{cacheKey:o}=n.fileContexts[r];delete n.fileContexts[r],await this.fileCache.remove(o),F(`Removed file context for ${r} in project ${e.name}`)}return n})}async searchOtherProjectsForFile(e){try{let n=ee().projectList||[];if(n.length===0)return null;F(`Searching other projects for file: ${e}`);for(let o of n){let i=await this.get(o);if(!(!i||!i.fileContexts)&&i.fileContexts[e]){let{cacheKey:a}=i.fileContexts[e];if(!a)continue;let s=await this.fileCache.get(a);if(s)return F(`Found content for file ${e} in project ${o.name}`),{content:s,cacheKey:a}}}return F(`No content found in any project for file: ${e}`),null}catch(r){return ie(`Error searching other projects for file ${e}:`,r),null}}async associateCacheWithProject(e,r,n){return await this.updateCacheSafelyAsync(e,async o=>(o.fileContexts||(o.fileContexts={}),o.fileContexts[r]={timestamp:Date.now(),cacheKey:n},F(`Associated cache with project ${e.name} for file: ${r}`),o))}cleanupFileReferencesInCache(e,r){if(!r.fileContexts)return r;let{inclusions:n,exclusions:o}=Zl({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 tEe.TFile)||!fu(u,n,o,!0)?i++:a[s]=r.fileContexts[s]}return i>0&&(r.fileContexts=a,F(`Removed ${i} file references from project ${e.name} that no longer match inclusion patterns`)),r}async cleanupProjectFileReferences(e){F(`[cleanupProjectFileReferences] Starting for project: ${e.name}`);try{await this.updateCacheSafely(e,r=>this.cleanupFileReferencesInCache(e,r),!0)}catch(r){ie(`Error cleaning up project file references for ${e.name}:`,r)}}async updateProjectFilesFromPatterns(e,r){try{F(`[updateProjectFilesFromPatterns] Starting for project: ${e.name}`),r.fileContexts||(r.fileContexts={});let{inclusions:n,exclusions:o}=Zl({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=this.vault.getFiles(),a=0;for(let s of i)if(fu(s,n,o,!0)){if(r.fileContexts[s.path])continue;let u=this.fileCache.getCacheKey(s,e.id);r.fileContexts[s.path]={timestamp:Date.now(),cacheKey:u},a++}a>0&&F(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${a} new file references to context (in memory).`),F(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(n){ie(`[updateProjectFilesFromPatterns] Error for project ${e.name}:`,n)}return r}updateProjectMarkdownFilesFromPatterns(e,r,n){try{r.fileContexts||(r.fileContexts={});let o=n.filter(a=>a.extension==="md"),i=0;for(let a of o){if(r.fileContexts[a.path])continue;let s=this.fileCache.getCacheKey(a,e.id);r.fileContexts[a.path]={timestamp:Date.now(),cacheKey:s},i++}i>0&&F(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${i} new file references to context (in memory).`),F(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total markdown fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(o){ie(`[updateProjectFilesFromPatterns] Error for project ${e.name}:`,o)}return r}async removeWebUrls(e,r){r.length&&await this.updateCacheSafely(e,n=>{if(n.webContexts){for(let o of r)n.webContexts[o]&&delete n.webContexts[o];F(`Removed web contexts for URLs ${r.join(", ")} in project ${e.name}`)}return n})}async updateWebUrl(e,r,n){return await this.updateCacheSafely(e,o=>(o.webContexts||(o.webContexts={}),o.webContexts[r]=n,F(`Updated web context for URL ${r} in project ${e.name}`),o))}async removeYoutubeUrls(e,r){r.length&&await this.updateCacheSafely(e,n=>{if(n.youtubeContexts){for(let o of r)n.youtubeContexts[o]&&delete n.youtubeContexts[o];F(`removeYoutubeUrls: Removed YouTube contexts for URLs ${r.join(", ")} in project ${e.name}`)}return n})}async updateYoutubeUrl(e,r,n){return await this.updateCacheSafely(e,o=>(o.youtubeContexts||(o.youtubeContexts={}),o.youtubeContexts[r]=n,F(`Updated YouTube context for URL ${r} in project ${e.name}`),o))}async updateCacheSafely(e,r,n=!1){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>{try{let i=await this.get(e);if(!i){if(n)return;throw new Error(`Project: ${e.name} context cache not found, please invoke getOrInitializeCache method before invoke update context cache`)}let a=r(i);await this.setWithoutMutex(e,a)}catch(i){throw ie(`Error updating cache for project ${e.name}:`,i),i}})}async updateCacheSafelyAsync(e,r,n=!1){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>{try{let i=await this.get(e);if(!i){if(n)return;throw new Error(`Project: ${e.name} context cache not found, please invoke getOrInitializeCache method before invoke update context cache`)}let a=await r(i);await this.setWithoutMutex(e,a)}catch(i){throw ie(`Error updating cache for project ${e.name}:`,i),i}})}async setCacheSafely(e,r){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>(F(`External safe set for project: ${e.name}`),await this.setWithoutMutex(e,r)))}};dq.DEBOUNCE_DELAY=5e3;var Iw=dq;rd();gr();Xe();Xe();Dt();eEe();var sH=require("obsidian"),cA=class{static async isImageUrl(e,r){try{let n,o=!1;try{let i=new URL(e),a=i.pathname,s=a.lastIndexOf("."),u=a.lastIndexOf("/");if(s>u&&s>-1&&(n=a.substring(s+1).toLowerCase()),n&&!this.IMAGE_EXTENSIONS.some(c=>c.toLowerCase()===`.${n}`))return ie(`Unsupported image format from URL path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;try{let c=(await hl(e,{method:"HEAD",headers:{}})).headers.get("content-type");return c?.startsWith("image/")?!0:(console.warn(`HEAD request succeeded for ${e} but Content-Type (${c}) is not image/*.`),!1)}catch(l){console.warn(`HEAD request failed for URL: ${e}. Proceeding to heuristic check.`,l);let c=i.searchParams,f=[c.has("w")||c.has("width"),c.has("h")||c.has("height"),c.has("format"),c.has("fit"),c.has("quality"),i.pathname.includes("/image/"),i.pathname.includes("/images/"),i.pathname.includes("/img/"),c.has("auto"),c.has("crop")].filter(Boolean).length;return f>=2?(ie(`Identified as image based on URL heuristics (indicator count: ${f}): ${e}`),!0):!1}}catch{o=!0;let i=e.lastIndexOf(".");if(i>-1)n=e.substring(i+1).toLowerCase();else return!1}if(o)if(n&&this.IMAGE_EXTENSIONS.some(i=>i.toLowerCase()===`.${n}`)){let i=r.getAbstractFileByPath(e);return i instanceof sH.TFile?i.stat.size>this.MAX_IMAGE_SIZE?(ie(`Vault file too large: ${i.stat.size} bytes for path: ${e}`),!1):!0:(ie(`File with image extension not found in vault: ${e}.`),!1)}else return n&&ie(`Unsupported image format for potential vault path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;return ie(`Could not determine image status for URL/path: ${e}`),!1}catch(n){return ie(`Unexpected error in isImageUrl for "${e}":`,n),!1}}static async handleVaultImage(e,r){try{if(e.stat.size>this.MAX_IMAGE_SIZE)return ie(`Image too large: ${e.stat.size} bytes, skipping: ${e.path}`),null;let n=await r.readBinary(e),o=await this.getMimeType(n,e.extension);if(!o.startsWith("image/"))return ie(`Invalid MIME type: ${o}, skipping: ${e.path}`),null;let i=cq(n);return`data:${o};base64,${i}`}catch(n){return ie("Error processing vault image:",n),null}}static async handleWebImage(e){try{let r=await hl(e,{method:"GET",headers:{}});if(!r.ok)return ie(`Failed to fetch image: ${r.statusText}, URL: ${e}`),null;let n=r.headers.get("content-type");if(!n?.startsWith("image/"))return ie(`Invalid content type: ${n}, URL: ${e}`),null;let o=await r.arrayBuffer();if(o.byteLength>this.MAX_IMAGE_SIZE)return ie(`Image too large: ${o.byteLength} bytes, URL: ${e}`),null;let i=cq(o);return`data:${n};base64,${i}`}catch(r){return ie("Error converting web image to base64:",r),null}}static async handleLocalImage(e,r){try{let n=decodeURIComponent(e.replace("app://","")),o=r.getAbstractFileByPath(n);if(!o||!(o instanceof sH.TFile))return ie(`Local image not found: ${n}`),null;if(o.stat.size>this.MAX_IMAGE_SIZE)return ie(`Image too large: ${o.stat.size} bytes, path: ${n}`),null;let i=await r.readBinary(o),a=await this.getMimeType(i,o.extension);if(!a.startsWith("image/"))return ie(`Invalid MIME type: ${a}, path: ${n}`),null;let s=cq(i);return`data:${a};base64,${s}`}catch(n){return ie("Error processing local image:",n),null}}static async imageToBase64(e,r){if(e.startsWith("data:"))return e;if(e.startsWith("attachment:")){let o=e.substring(11),i=r.getAbstractFileByPath(o);return i instanceof sH.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 sH.TFile?await this.handleVaultImage(n,r):await this.handleWebImage(e)}static async convertToBase64(e,r){let n=await this.imageToBase64(e,r);return n?{type:"image_url",image_url:{url:n}}:(ie(`Failed to convert image to base64: ${e}`),null)}static async getMimeType(e,r){let n=new Uint8Array(e.slice(0,4));if(n[0]===255&&n[1]===216)return"image/jpeg";if(n[0]===137&&n[1]===80)return"image/png";if(n[0]===71&&n[1]===73)return"image/gif";if(n[0]===82&&n[1]===73)return"image/webp";if(n[0]===66&&n[1]===77)return"image/bmp";if(n[0]===60&&n[1]===115)throw new Error("SVG files are not supported");let o=this.MIME_TYPES[r.toLowerCase()];if(!o){let i=`Unsupported image extension: ${r}`;throw ie(i),new Error(i)}return o}};cA.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],cA.MAX_IMAGE_SIZE=3*1024*1024,cA.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp"};var uH=class t{static async processUrlBatch(e,r,n){try{let i=(await Promise.all(e.map(s=>t.processSingleUrl(s,r,n)))).filter(s=>s!==null),a=r.map(s=>`Image read failed for: ${s}`);return{successfulImages:i,failureDescriptions:a}}catch(o){return ie("Error processing URL batch:",o),{successfulImages:[],failureDescriptions:e.map(i=>`Image read failed for: ${i}`)}}}static async processSingleUrl(e,r,n){try{if(!await cA.isImageUrl(e,n))return null;let o=await cA.convertToBase64(e,n);return o||(r.push(e),null)}catch(o){return ie(`Failed to process image: ${e}`,o),r.push(e),null}}static async processChatImageBatch(e,r,n){try{let o=e.filter(u=>u.type==="image_url"&&!!u.image_url?.url),a=(await Promise.all(o.map(u=>t.processChatSingleImage(u,r,n)))).filter(u=>u!==null),s=r.map(u=>`Image read failed for: ${u}`);return{successfulImages:a,failureDescriptions:s}}catch(o){ie("Error processing chat image batch:",o);let i=e.filter(a=>a.type==="image_url"&&!!a.image_url?.url).map(a=>a.image_url.url);return{successfulImages:[],failureDescriptions:i.map(a=>`Image read failed for: ${a}`)}}}static async processChatSingleImage(e,r,n){try{let o=await cA.convertToBase64(e.image_url.url,n);return o||(r.push(e.image_url.url),null)}catch(o){return ie(`Failed to process chat image: ${e.image_url.url}`,o),r.push(e.image_url.url),null}}static showFailedImagesNotice(e){e.length>0&&new sH.Notice(`Failed to process images:
${e.join(`
`)}`)}};aA();BC();Xe();Qe();var rfo="https://api.firecrawl.dev/v2/search",nfo="https://api.perplexity.ai/chat/completions",Jbr="https://api.supadata.ai/v1/transcript",ofo=2e3,Wbr=6e4;function Kbr(){let t=ee();switch(t.selfHostSearchProvider){case"perplexity":return!!t.perplexityApiKey;case"firecrawl":default:return!!t.firecrawlApiKey}}async function ifo(t,e){let r=Date.now(),n=await fetch(rfo,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({query:t,limit:5})});if(!n.ok){let c=await n.text();throw new Error(`Firecrawl search failed (${n.status}): ${c}`)}let i=(await n.json())?.data,a=Array.isArray(i)?i:Array.isArray(i?.web)?i.web:[],s=[],u=[];for(let c of a){let d=c.title||"Untitled",f=c.description||"",p=c.url||"";s.push(`### ${d}
${f}
Source: ${p}`),p&&u.push(p)}let l=Date.now()-r;return F(`[selfHostWebSearch] Firecrawl: ${a.length} results in ${l}ms`),{content:s.join(`

`),citations:u}}async function afo(t,e){let r=await fetch(nfo,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({model:"sonar",messages:[{role:"user",content:t}]})});if(!r.ok){let a=await r.text();throw new Error(`Perplexity Sonar search failed (${r.status}): ${a}`)}let n=await r.json(),o=n?.choices?.[0]?.message?.content??"",i=Array.isArray(n?.citations)?n.citations:[];return{content:o,citations:i}}async function Gbr(t){let e=ee();switch(e.selfHostSearchProvider){case"perplexity":return afo(t,await kn(e.perplexityApiKey));case"firecrawl":default:return ifo(t,await kn(e.firecrawlApiKey))}}async function rEe(t){let e=Date.now(),r=await kn(ee().supadataApiKey),n=`${Jbr}?url=${encodeURIComponent(t)}&mode=auto&text=true`,o=await fetch(n,{method:"GET",headers:{"x-api-key":r,Accept:"application/json"}});if(o.status===200){let a=await o.json(),s=Date.now()-e;return F(`[selfHostYoutube4llm] transcript received in ${s}ms`),{response:{transcript:a.content||""},elapsed_time_ms:s}}if(o.status===201||o.status===202){let s=(await o.json()).job_id;if(!s)throw new Error("Supadata returned async status but no job_id");return await sfo(s,r,e)}let i=await o.text();throw new Error(`Supadata transcript request failed (${o.status}): ${i}`)}async function sfo(t,e,r){let n=Date.now()+Wbr,o=`${Jbr}/${t}`;for(;Date.now()<n;){await new Promise(s=>setTimeout(s,ofo));let i=await fetch(o,{method:"GET",headers:{"x-api-key":e,Accept:"application/json"}});if(i.status===200){let s=await i.json(),u=Date.now()-r;return F(`[selfHostYoutube4llm] async transcript completed in ${u}ms`),{response:{transcript:s.content||""},elapsed_time_ms:u}}if(i.status===202)continue;let a=await i.text();throw ie(`[selfHostYoutube4llm] poll failed (${i.status}): ${a}`),new Error(`Supadata poll failed (${i.status}): ${a}`)}throw new Error(`Supadata transcript timed out after ${Wbr}ms`)}Dt();Xe();id();Qe();var QG=class t{constructor(){this.mentions=new Map,this.brevilabsClient=Xl.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)}async processUrl(e){try{return await this.brevilabsClient.url4llm(e)}catch(r){let n=Wr(r);return ie(`Error processing URL ${e}: ${n}`),{response:e,elapsed_time_ms:0,error:n}}}async processYoutubeUrl(e){try{return{transcript:(Wy()&&ee().supadataApiKey?await rEe(e):await this.brevilabsClient.youtube4llm(e)).response.transcript}}catch(r){let n=Wr(r);return ie(`Error processing YouTube URL ${e}: ${n}`),{transcript:"",error:n}}}async processTwitterUrl(e){try{return await this.brevilabsClient.twitter4llm(e)}catch(r){let n=Wr(r);return ie(`Error processing Twitter URL ${e}: ${n}`),{response:e,elapsed_time_ms:0,error:n}}}async processUrlList(e){let r="",n=[],o={};if(e.length===0)return{urlContext:r,imageUrls:n,processedErrorUrls:o};let i=e.map(async s=>{if(await cA.isImageUrl(s,app.vault))return n.push(s),{type:"image",url:s};if(wNt(s)){let l=this.mentions.get(s);if(!l||l.error){let c=await this.processYoutubeUrl(s);this.mentions.set(s,{type:"youtube",original:s,processed:c.transcript,error:c.error})}return{type:"youtube",data:this.mentions.get(s)}}if(SNt(s)){let l=this.mentions.get(s);if(!l||l.error){let c=await this.processTwitterUrl(s);this.mentions.set(s,{type:"twitter",original:s,processed:c.response,error:c.error})}return{type:"twitter",data:this.mentions.get(s)}}let u=this.mentions.get(s);if(!u||u.error){let l=await this.processUrl(s);this.mentions.set(s,{type:"url",original:s,processed:l.response,error:l.error})}return{type:"url",data:this.mentions.get(s)}});return(await Promise.all(i)).forEach(s=>{if(s.type==="image")return;let u=s.data;u&&(u.processed&&(s.type==="youtube"?r+=`

<youtube_video_context>
<url>${u.original}</url>
<content>
${u.processed}
</content>
</youtube_video_context>`:s.type==="twitter"?r+=`

<twitter_content>
<url>${u.original}</url>
<content>
${u.processed}
</content>
</twitter_content>`:r+=`

<url_content>
<url>${u.original}</url>
<content>
${u.processed}
</content>
</url_content>`),u.error&&(o[u.original]=u.error))}),{urlContext:r,imageUrls:n,processedErrorUrls:o}}async processUrls(e){let r=this.extractUrls(e);return this.processUrlList(r)}getMentions(){return this.mentions}clearMentions(){this.mentions.clear()}};Wb();Qe();Xe();var Xbr=$(oH()),nEe=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)||(F("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,Xbr.MD5)(r).toString();return F("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)){F("Cache hit for PDF:",e.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return F("Cache miss for PDF:",e.path),null}catch(r){return ie("Error reading from PDF cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);F("Caching PDF response for:",e.path),await app.vault.adapter.write(o,JSON.stringify(r))}catch(n){ie("Error writing to PDF cache:",n)}}async clear(){try{if(await app.vault.adapter.exists(this.cacheDir)){let e=await app.vault.adapter.list(this.cacheDir);F("Clearing PDF cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){ie("Error clearing PDF cache:",e)}}};Xe();DG();u0();id();Qe();Xe();Dt();async function Zbr(t,e,r,n){let o=n?.trim();if(o&&t.extension!=="md"&&!(!e||e.startsWith("[Error:")))try{await ql(o);let i=`${o}/${t.basename}.md`;if(await r.adapter.exists(i)){let s=await r.adapter.read(i);if(s&&!s.startsWith(`<!-- source: ${t.path} -->`)){let u=t.path.replace(/\.[^.]+$/,"").replace(/[/\\]/g,"__");if(i=`${o}/${u}.md`,await r.adapter.exists(i)){let l=await r.adapter.read(i);if(l&&!l.startsWith(`<!-- source: ${t.path} -->`)){Ce(`Skipping converted doc output for ${t.path}: collision at ${i}`);return}}}}let a=`<!-- source: ${t.path} -->
${e}`;if(await r.adapter.exists(i)&&await r.adapter.read(i)===a)return;await r.adapter.write(i,a),F(`Saved converted doc output: ${i}`)}catch(i){ie(`Failed to save converted doc output for ${t.path}:`,i)}}function ED(t){if(!t||typeof t!="object")return!1;let e=t.message||t.toString();return e.includes("Request rate limit exceeded")||e.includes("RATE_LIMIT_EXCEEDED")||e.includes("429")||t.status===429}function Ybr(t){let r=(t?.message||t?.toString()||"").match(/Try again in ([\d\w\s]+)/);return r?r[1]:"some time"}var t_r=require("obsidian");var Qbr=require("obsidian");var iEe,e_r,oEe=class{constructor(e){this.vault=e;PBe(this,iEe)}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 Qbr.TFile?await this.vault.read(l):"";return{...u,content:c}}return u.type==="text"?{...u,content:u.text??""}:{...u,content:""}})),a=[...o];z0t(this,iEe,e_r).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}};iEe=new WeakSet,e_r=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"})}};async function fq(t,e,r){let n=ee().convertedDocOutputFolder??"";await Zbr(t,e,r,n)}var aEe=class{constructor(){this.miyoClient=new l0}async parsePdf(e,r){let n=ee();if(!n.enableMiyo||e.extension.toLowerCase()!=="pdf")return null;try{let o=await this.miyoClient.resolveBaseUrl(Mx(n)),i=r.getName(),a=await this.miyoClient.parseDoc(o,i,e.path);return typeof a.text!="string"||a.text.trim().length===0?{error:"Miyo parse-doc returned empty text"}:(F(`[SelfHostPdfParser] Parsed PDF via Miyo: ${e.path}`),{content:a.text})}catch(o){let i=o instanceof Error?o.message:String(o);return Ce(`[SelfHostPdfParser] Failed to parse ${e.path} via Miyo parse-doc: ${i}`),{error:i}}}},Aat=class{constructor(){this.supportedExtensions=["md","base"]}async parseFile(e,r){return await r.read(e)}},sEe=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=nEe.getInstance(),this.selfHostPdfParser=new aEe}async parseFile(e,r){try{F("Parsing PDF file:",e.path);let n=await this.pdfCache.get(e);if(n)return F("Using cached PDF content for:",e.path),await fq(e,n.response,r),n.response;let o=ee();if(Wy()&&o.enableMiyo&&e.extension.toLowerCase()==="pdf"){let s=await this.selfHostPdfParser.parsePdf(e,r);if(s&&"content"in s)return await this.pdfCache.set(e,{response:s.content,elapsed_time_ms:0}),await fq(e,s.content,r),s.content;if(s&&"error"in s)return Ce(`[PDFParser] Miyo parse failed for ${e.path}: ${s.error}`),`[Error: Could not extract content from PDF ${e.basename}. ${s.error}]`}let i=await r.readBinary(e);F("Calling pdf4llm API for:",e.path);let a=await this.brevilabsClient.pdf4llm(i);return await this.pdfCache.set(e,a),await fq(e,a.response,r),a.response}catch(n){return ie(`Error extracting content from PDF ${e.path}:`,n),`[Error: Could not extract content from PDF ${e.basename}]`}}async clearCache(){F("Clearing PDF cache"),await this.pdfCache.clear()}},Nat=class{constructor(){this.supportedExtensions=["canvas"]}async parseFile(e,r){try{F("Parsing Canvas file:",e.path);let n=new oEe(r),o=await n.load(e);return n.buildPrompt(o)}catch(n){return ie(`Error parsing Canvas file ${e.path}:`,n),`[Error: Could not parse Canvas file ${e.basename}]`}}},e9=class e9{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=Iw.getInstance(),this.selfHostPdfParser=new aEe,this.currentProject=r}static resetRateLimitNoticeTimer(){e9.lastRateLimitNoticeTime=0}async parseFile(e,r){try{if(F(`[Docs4LLMParser] Project ${this.currentProject?.name}: Parsing ${e.extension} file: ${e.path}`),!this.currentProject)throw ie("[Docs4LLMParser] No project context for parsing file: ",e.path),new Error("No project context provided for file parsing");let n=await this.projectContextCache.getOrReuseFileContext(this.currentProject,e.path);if(n)return F(`[Docs4LLMParser] Project ${this.currentProject.name}: Using cached content for: ${e.path}`),await fq(e,n,r),n;if(F(`[Docs4LLMParser] Project ${this.currentProject.name}: Cache miss for: ${e.path}. Proceeding to API call.`),Wy()&&ee().enableMiyo&&e.extension.toLowerCase()==="pdf"){let s=await this.selfHostPdfParser.parsePdf(e,r);if(s&&"content"in s)return await this.projectContextCache.setFileContext(this.currentProject,e.path,s.content),await fq(e,s.content,r),F(`[Docs4LLMParser] Project ${this.currentProject.name}: Parsed PDF via Miyo: ${e.path}`),s.content;if(s&&"error"in s)throw new Error(`Miyo failed to parse ${e.basename}: ${s.error}`)}let o=await r.readBinary(e);F(`[Docs4LLMParser] Project ${this.currentProject.name}: Calling docs4llm API for: ${e.path}`);let i=await this.brevilabsClient.docs4llm(o,e.extension);if(!i||!i.response)throw new Error("Empty response from docs4llm API");let a="";if(typeof i.response=="string")a=i.response;else if(Array.isArray(i.response)){let s=[];for(let u of i.response)u.content&&(u.content.md?s.push(u.content.md):u.content.text&&s.push(u.content.text));a=s.join(`

`)}else typeof i.response=="object"?i.response.md?a=i.response.md:i.response.text?a=i.response.text:i.response.content?a=i.response.content:a=JSON.stringify(i.response,null,2):a=String(i.response);return await this.projectContextCache.setFileContext(this.currentProject,e.path,a),await fq(e,a,r),F(`[Docs4LLMParser] Project ${this.currentProject.name}: Successfully processed and cached: ${e.path}`),a}catch(n){throw ie(`[Docs4LLMParser] Project ${this.currentProject?.name}: Error processing file ${e.path}:`,n),ED(n)&&this.showRateLimitNotice(n),n}}showRateLimitNotice(e){let r=Date.now();if(r-e9.lastRateLimitNoticeTime<6e4)return;e9.lastRateLimitNoticeTime=r;let n=Ybr(e);new t_r.Notice(`\u26A0\uFE0F Rate limit exceeded for document processing. Please try again in ${n}. Having fewer non-markdown files in the project will help.`,1e4)}async clearCache(){F("Cache clearing is now handled at the project level")}};e9.lastRateLimitNoticeTime=0;var lae=e9,pq=class{constructor(e,r,n=!1,o=null){this.parsers=new Map;this.registerParser(new Aat),this.registerParser(new lae(e,o)),n||this.registerParser(new sEe(e)),this.registerParser(new Nat)}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 sEe&&await e.clearCache()}};Dt();t1();var e3=require("obsidian");aA();na();rd();gr();gr();Xe();Dt();var PD=class{constructor(e){this.chainManager=e}async handleResponse(e,r,n,o,i,a,s,u){if((e||u?.wasTruncated)&&!(n.signal.aborted&&n.signal.reason==="new-chat")){let p=r.contextEnvelope?.layers.find(g=>g.id==="L5_USER")?.text||r.originalMessage||r.message,m=s||e||"[Response truncated - no content generated]";await this.chainManager.memoryManager.saveContext({input:p},{output:m});let y={message:e||(u?.wasTruncated?"_[The response was truncated before any content could be generated. Try increasing the max tokens limit.]_":""),sender:ow,isVisible:!0,timestamp:vg(new Date),sources:a,responseMetadata:u};o(y),i("")}else n.signal.reason==="new-chat"&&i("");let c=this.chainManager.memoryManager.getMemory().chatHistory.messages;F(`Chat memory updated:
`,{turns:Array.isArray(c)?c.length:0});let d=2e3;try{let{parseToolCallMarkers:f}=await Promise.resolve().then(()=>(Fat(),r_r)),m=f(e).segments.map(y=>y.type==="text"?y.content:"").join("").trim();m||(m=e||"");let h=m.length>d?m.slice(0,d)+"... (truncated)":m;F(`Final AI response (truncated):
`,h)}catch{let f=typeof e=="string"?e:String(e??""),p=f.length>d?f.slice(0,d)+"... (truncated)":f;F(`Final AI response (truncated):
`,p)}return e}async handleError(e,r){let n=Wr(e);ie("Error during LLM invocation:",n);let o=e?.response?.data?.error||n,i=o?.code||n,a="";e?.message?.includes("Invalid license key")?a="Invalid Copilot Plus license key. Please check your license key in settings.":i==="model_not_found"?a="You do not have access to this model or the model does not exist, please check with your API provider.":a=`${i}`,ie(o),r(this.enhancedErrorMsg(a,n,e))}enhancedErrorMsg(e,r,n){let o=e.search("Troubleshooting URL");return e=o!==-1?e.slice(0,o):e,this.isAuthenticationError(n,r)&&(e=`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: `+e),e}isAuthenticationError(e,r){let n=e?.response,o=n?.data?.error??e?.error,i=n?.status??o?.status,a=typeof i=="string"?Number.parseInt(i,10):i,s=typeof o=="object"&&o!==null?o:void 0,u=(typeof s?.message=="string"?s.message:r).toLowerCase(),l=typeof s?.code=="string"?s.code.toLowerCase():"",c=typeof s?.type=="string"?s.type.toLowerCase():"";return a===401?!0:["api key","apikey","unauthorized","authentication","invalid authentication"].some(f=>u.includes(f)||l.includes(f)||c.includes(f))}};gr();Xe();var dA=class{static convert(e,r={}){let{includeSystemMessage:n=!0,mergeUserContent:o=!0,debug:i=!1}=r,a=[],s=e.layers.find(f=>f.id==="L1_SYSTEM"),u=e.layers.find(f=>f.id==="L2_PREVIOUS"),l=e.layers.find(f=>f.id==="L3_TURN"),c=e.layers.find(f=>f.id==="L4_STRIP"),d=e.layers.find(f=>f.id==="L5_USER");if(n&&s&&s.text){let f=[s.text];u&&u.text&&(f.push(`
## Context Library

The following notes are available for reference:

`+u.text),i&&F("[LayerToMessagesConverter] Added L2 (cumulative context) to system")),a.push({role:"system",content:f.join(`
`)}),i&&F("[LayerToMessagesConverter] Added L1 (System) + L2 (Cumulative) as stable prefix")}if(c&&c.text&&i&&F("[LayerToMessagesConverter] L4 (Strip) found but skipped (using LangChain memory)"),o){let f=[];if(l&&l.segments.length>0&&u){let p=new Set(u.segments.map(y=>y.id)),m=[],h=[];for(let y of l.segments)p.has(y.id)?m.push(y.id):h.push(y);if(m.length>0||h.length>0){let y=[];m.length>0&&y.push(`Context attached to this message:
`+m.map(g=>`- ${g}`).join(`
`)+`

Find them in the Context Library in the system prompt above.`),h.length>0&&y.push(h.map(g=>g.content).join(`
`)),f.push(y.join(`

`)),i&&F(`[LayerToMessagesConverter] Added L3: ${m.length} references, ${h.length} new items`)}}else l&&l.text&&(f.push(l.text),i&&F("[LayerToMessagesConverter] Added L3 (all new context)"));f.length>0&&d&&d.text&&f.push(`---

[User query]:`),d&&d.text&&(f.push(d.text),i&&F("[LayerToMessagesConverter] Added L5 (user message)")),f.length>0&&a.push({role:"user",content:f.join(`

`)})}else l&&l.text&&a.push({role:"user",content:l.text}),d&&d.text&&a.push({role:"user",content:d.text});return i&&(F(`[LayerToMessagesConverter] Converted envelope to ${a.length} messages`),a.forEach((f,p)=>{let m=f.content.substring(0,100);F(`  Message ${p+1} [${f.role}]: ${m}...`)})),a}static extractUserContent(e){let r=e.layers.find(i=>i.id==="L3_TURN"),n=e.layers.find(i=>i.id==="L5_USER"),o=[];return r&&r.text&&o.push(r.text),n&&n.text&&o.push(n.text),o.join(`

`)}static extractFullContext(e){let r=e.layers.find(a=>a.id==="L2_PREVIOUS"),n=e.layers.find(a=>a.id==="L3_TURN"),o=e.layers.find(a=>a.id==="L5_USER"),i=[];return r&&r.text&&i.push(r.text),n&&n.text&&i.push(n.text),o&&o.text&&i.push(o.text),i.join(`

`)}static extractSystemMessage(e){return e.layers.find(n=>n.id==="L1_SYSTEM")?.text||""}static getLayerHashes(e){return e.layerHashes}};Xe();Qe();Dt();Xe();function kat(t){let e=[];for(let r of t)if(r){if(typeof r._getType=="function"){let n=r._getType();n==="human"?e.push({role:"user",content:r.content}):n==="ai"&&e.push({role:"assistant",content:r.content})}else if(r.content!==void 0){let n=mfo(r);n&&e.push({role:n,content:r.content})}}return e}function mfo(t){return t.role==="human"||t.role==="user"||t.sender==="user"?"user":t.role==="ai"||t.role==="assistant"||t.sender==="AI"?"assistant":null}function hfo(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(r=>r.type==="text").map(r=>r.text||"").join(" ")||"[Image content]":String(t||"")}function n_r(t){return t.map(e=>({role:e.role,content:hfo(e.content)}))}async function mq(t,e){let n=(await t.loadMemoryVariables({})).history||[],o=n.length?kat(n):[];for(let u of o)e.push({role:u.role,content:u.content});let i=0;for(let u of e)typeof u.content=="string"&&u.role==="system"&&(i+=u.content.length);let a=0;for(let u of o)typeof u.content=="string"&&(a+=u.content.length);let s=i+a;return s>2e6&&F("[Token Budget] Large payload detected (excluding user message):",{"L1+L2 (system)":`${Math.round(i/4e3)}k tokens`,"L4 (history)":`${Math.round(a/4e3)}k tokens (${o.length} msgs)`,total:`${Math.round(s/4e3)}k tokens`}),o}Xe();var Uc=class t{constructor(){this.tools=new Map}static getInstance(){return t.instance||(t.instance=new t),t.instance}register(e){this.tools.set(e.metadata.id,e)}registerAll(e){e.forEach(r=>this.register(r))}getAllTools(){return Array.from(this.tools.values())}getEnabledTools(e,r){let n=[];for(let[o,i]of this.tools){let{metadata:a,tool:s}=i;if(a.isAlwaysEnabled){(!a.requiresVault||r)&&n.push(s);continue}e.has(o)&&(!a.requiresVault||r)&&n.push(s)}return n}getToolsByCategory(){let e=new Map;for(let r of this.tools.values()){let n=r.metadata.category;e.has(n)||e.set(n,[]),e.get(n).push(r)}return e}getConfigurableTools(){return Array.from(this.tools.values()).filter(e=>!e.metadata.isAlwaysEnabled)}getCopilotCommandMappings(){let e=new Map;for(let r of this.tools.values()){let n=r.metadata.copilotCommands;if(n)for(let o of n){let i=o.toLowerCase();e.has(i)||e.set(i,r)}}return e}getToolMetadata(e){return this.tools.get(e)?.metadata}getToolDefinition(e){return this.tools.get(e)}clear(){this.tools.clear()}};var t9=null;function gfo(t){let e=new WeakSet;return JSON.stringify(t,(r,n)=>{if(typeof n=="object"&&n!==null){if(e.has(n))return"[Circular]";e.add(n)}return typeof n=="bigint"?n.toString():n},2)}function yfo(t,e){let r=[];e&&(r.push(`msg:${e.messageId??"N/A"} | conv:${e.conversationId??"N/A"} | v${e.version}`),r.push(""));let n=Uc.getInstance(),o=new Set(n.getAllTools().map(c=>c.tool.name)),i=c=>{let d=[],f=/<(\w+)>([\s\S]*?)<\/\1>/g,p;for(;(p=f.exec(c))!==null;){let m=p[1],h=p[2];if(o.has(m)){let y=h.length>200?h.substring(0,200).trim()+"...[truncated]":h.trim();d.push({tool:m,preview:y})}}return d},a=c=>typeof c.content=="string"?c.content:Array.isArray(c.content)?c.content.filter(f=>f.type==="text").map(f=>f.text).join(`
`):"",s=Array.isArray(t)?t:[],u=0;for(let c=0;c<s.length;c++){let d=s[c],f=a(d);if(d.role==="system"){r.push("\u2501\u2501\u2501 SYSTEM MESSAGE \u2501\u2501\u2501"),r.push("");let p=e?.layers.find(h=>h.id==="L1_SYSTEM"),m=e?.layers.find(h=>h.id==="L2_PREVIOUS");if(p&&f.includes(p.text)){let h=p.hash.substring(0,8);r.push(`\u{1F512} L1_SYSTEM (${h}) [CACHEABLE]`);let y=f.indexOf(p.text)+p.text.length,g=p.text.length>300?p.text.substring(0,300)+"...[truncated]":p.text;if(r.push(g),r.push(""),m&&m.text){let w=m.hash.substring(0,8);r.push(`\u{1F512} L2_PREVIOUS (${w}) [CACHEABLE]`);let T=m.text.length>300?m.text.substring(0,300)+"...[truncated]":m.text;r.push(T),r.push("")}let b=f.substring(y),_=i(b);if(_.length>0){r.push("--- PER-TURN ADDITIONS (not cached) ---"),r.push("");for(let w of _)r.push(`\u{1F4E6} TOOL: ${w.tool} (turn-specific RAG)`),r.push(w.preview),r.push("")}}else{let h=i(f);if(h.length>0){let y=f.match(/<(\w+)>/);if(y){let g=f.substring(0,y.index);if(g.trim()){let b=g.length>300?g.substring(0,300)+"...[truncated]":g;r.push(b),r.push("")}}r.push("--- PER-TURN ADDITIONS (not cached) ---"),r.push("");for(let g of h)r.push(`\u{1F4E6} TOOL: ${g.tool}`),r.push(g.preview),r.push("")}else{let y=f.length>300?f.substring(0,300)+"...[truncated]":f;r.push(y),r.push("")}}}else(d.role==="user"||d.role==="assistant")&&c<s.length-1&&u++}u>0&&(r.push("\u2501\u2501\u2501 CHAT HISTORY (L4) \u2501\u2501\u2501"),r.push(""),r.push(`${u} message(s)`),r.push(""));let l=s[s.length-1];if(l&&l.role==="user"){r.push("\u2501\u2501\u2501 USER MESSAGE \u2501\u2501\u2501"),r.push("");let c=a(l),d=i(c);if(d.length>0){r.push("--- PER-TURN TOOL RESULTS ---"),r.push("");for(let m of d)r.push(`\u{1F4E6} TOOL: ${m.tool}`),r.push(m.preview),r.push("")}let f=e?.layers.find(m=>m.id==="L3_TURN"),p=e?.layers.find(m=>m.id==="L5_USER");if(f&&f.text&&c.includes(f.text)){let m=f.hash.substring(0,8);r.push(`\u26A1 L3_TURN (${m})`);let h=f.text.length>300?f.text.substring(0,300)+"...[truncated]":f.text;r.push(h),r.push("")}if(p&&p.text&&c.includes(p.text)){let m=p.hash.substring(0,8);r.push(`\u26A1 L5_USER (${m})`),r.push(p.text),r.push("")}}return r.join(`
`)}function hq(t){let{messages:e,modelName:r,contextEnvelope:n}=t;try{t9={timestamp:new Date().toISOString(),modelName:r,serializedMessages:gfo(e),messagesArray:e,contextEnvelope:n}}catch{t9={timestamp:new Date().toISOString(),modelName:r,serializedMessages:String(e),messagesArray:e,contextEnvelope:n}}}function r9(){t9=null}async function uEe(){if(!t9)return;let{timestamp:t,modelName:e,serializedMessages:r,messagesArray:n,contextEnvelope:o}=t9,i=[`### Prompt \u2014 ${t}${e?` \u2014 ${e}`:""}`,"","**Actual Messages Sent to LLM:**","","```json",r,"```",""],a=yfo(n,o);i.push("**Layered Context Metadata:**"),i.push(""),i.push("```"),i.push(a),i.push("```"),i.push(""),xge(i),t9=null}function o_r(t){let e=t.response_metadata||{};return e.finish_reason==="length"?{wasTruncated:!0,message:"Response truncated due to token limit"}:e.stop_reason==="max_tokens"?{wasTruncated:!0,message:"Response truncated due to max_tokens limit"}:e.finishReason==="MAX_TOKENS"||e.finish_reason==="MAX_TOKENS"?{wasTruncated:!0,message:"Response truncated due to MAX_TOKENS limit"}:{wasTruncated:!1,message:null}}function i_r(t){let e=t.response_metadata||{};return e.tokenUsage?{inputTokens:e.tokenUsage.promptTokens,outputTokens:e.tokenUsage.completionTokens,totalTokens:e.tokenUsage.totalTokens}:e.usage?{inputTokens:e.usage.input_tokens||e.usage.inputTokens||e.usage.inputTokenCount||e.usage.prompt_tokens,outputTokens:e.usage.output_tokens||e.usage.outputTokens||e.usage.outputTokenCount||e.usage.completion_tokens,totalTokens:e.usage.total_tokens||e.usage.totalTokens||(e.usage.input_tokens||e.usage.inputTokenCount||0)+(e.usage.output_tokens||e.usage.outputTokenCount||0)}:t.usage_metadata?{inputTokens:t.usage_metadata.input_tokens,outputTokens:t.usage_metadata.output_tokens,totalTokens:t.usage_metadata.total_tokens}:null}function bfo(t){return`<errorChunk>${t}</errorChunk>`}function lEe(t,e){let r=bfo(t);return e?`${e}
${r}`:`
${r}`}ra();Xe();function cEe(t,e,r){return new Kv({content:r,tool_call_id:t,name:e})}function cae(){let t=Date.now(),e=Math.random().toString(36).substring(2,11);return`call_${t}_${e}`}function a_r(t,e){let r=e.index??0,n=t.get(r)||{name:"",args:""};e.id&&(n.id=e.id);let o=e.name??e.functionCall?.name;o&&(n.name+=o),e.args&&(n.args+=e.args),t.set(r,n)}function dEe(t){let e=[];for(let r of t.values()){if(!r.name)continue;let n={};if(r.args)try{n=JSON.parse(r.args)}catch{ie(`[ToolCall] Failed to parse args for tool "${r.name}": ${r.args}`),n={}}e.push({id:r.id||cae(),name:r.name,args:n})}return e}function s_r(t,e){return new uo({content:t,tool_calls:e.map(r=>({id:r.id,name:r.name,args:r.args,type:"tool_call"}))})}Xe();var _fo=["<|im_end|>","<|im_start|>","<|eot_id|>","<|start_header_id|>","<|end_header_id|>","<end_of_turn>","<start_of_turn>","<|end|>","<|assistant|>","<|user|>","<|system|>","</s>","[INST]","[/INST]","<|endoftext|>","<|end\u2581of\u2581sentence|>","<|END_OF_TURN_TOKEN|>","<|START_OF_TURN_TOKEN|>"],vfo=new RegExp(_fo.map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),"g");function qat(t){return t.replace(vfo,"")}var iv=class{constructor(e,r=!1){this.updateCurrentAiMessage=e;this.excludeThinking=r;this.hasOpenThinkBlock=!1;this.fullResponse="";this.errorResponse="";this.wasTruncated=!1;this.tokenUsage=null;this.hasHandledTextLevelThinkTag=!1;this.excludedThinkBlockStart=-1;this.toolCallChunks=new Map;this.accumulatedToolCalls=[];F(`[ThinkBlockStreamer] Created with excludeThinking=${r}`)}handleTextLevelThinkTags(){if(this.excludeThinking){this.handleExcludedThinkTags();return}let e=this.fullResponse.includes("</think>"),r=this.fullResponse.includes("<think>");e&&!r&&!this.hasHandledTextLevelThinkTag&&(this.hasHandledTextLevelThinkTag=!0,Ce("Detected </think> closing tag without opening <think> tag. This may indicate a misconfigured chat template in LM Studio. Adding opening tag."),this.fullResponse="<think>"+this.fullResponse)}handleExcludedThinkTags(){if(this.excludedThinkBlockStart>=0){let n=this.fullResponse.indexOf("</think>",this.excludedThinkBlockStart);if(n!==-1){let o=this.fullResponse.substring(0,this.excludedThinkBlockStart),i=this.fullResponse.substring(n+8);this.fullResponse=(o+i).trimStart(),this.excludedThinkBlockStart=-1}else this.fullResponse=this.fullResponse.substring(0,this.excludedThinkBlockStart);return}let e=this.fullResponse.indexOf("<think>");if(e!==-1){this.excludedThinkBlockStart=e;let n=this.fullResponse.indexOf("</think>",e);if(n!==-1){let o=this.fullResponse.substring(0,e),i=this.fullResponse.substring(n+8);this.fullResponse=(o+i).trimStart(),this.excludedThinkBlockStart=-1}else this.fullResponse=this.fullResponse.substring(0,e);return}let r=this.fullResponse.indexOf("</think>");r!==-1&&(this.fullResponse=this.fullResponse.substring(r+8).trimStart())}handleClaudeChunk(e){let r="",n=!1;for(let o of e)switch(o.type){case"text":r+=o.text;break;case"thinking":if(n=!0,this.excludeThinking)break;this.hasOpenThinkBlock||(this.fullResponse+=`
<think>`,this.hasOpenThinkBlock=!0),o.thinking!==void 0&&(this.fullResponse+=o.thinking),this.updateCurrentAiMessage(this.fullResponse);break}return r&&this.hasOpenThinkBlock&&(this.fullResponse+="</think>",this.hasOpenThinkBlock=!1),r&&(this.fullResponse+=qat(r)),n}handleDeepseekChunk(e){return typeof e.content=="string"&&(this.fullResponse+=qat(e.content)),e.additional_kwargs?.reasoning_content?(this.excludeThinking||(this.hasOpenThinkBlock||(this.fullResponse+=`
<think>`,this.hasOpenThinkBlock=!0),e.additional_kwargs.reasoning_content!==void 0&&(this.fullResponse+=e.additional_kwargs.reasoning_content)),!0):!1}handleOpenRouterChunk(e){return e.additional_kwargs?.delta?.reasoning?(this.excludeThinking||(this.hasOpenThinkBlock||(this.fullResponse+=`
<think>`,this.hasOpenThinkBlock=!0),this.fullResponse+=e.additional_kwargs.delta.reasoning),!0):(typeof e.content=="string"&&e.content&&this.hasOpenThinkBlock&&(this.fullResponse+="</think>",this.hasOpenThinkBlock=!1),typeof e.content=="string"&&e.content&&(this.fullResponse+=e.content),!1)}handleToolCallChunks(e){let r=e.tool_call_chunks;if(!(!r||!Array.isArray(r)))for(let n of r){let o=n.index??0,i=this.toolCallChunks.get(o)||{name:"",args:""};n.id&&(i.id=n.id),n.name&&(i.name+=n.name),n.args&&(i.args+=n.args),this.toolCallChunks.set(o,i)}}processChunk(e){o_r(e).wasTruncated&&(this.wasTruncated=!0);let n=i_r(e);n&&(this.tokenUsage=n),this.handleToolCallChunks(e);let o=Array.isArray(e.content)||e.additional_kwargs?.delta?.reasoning||e.additional_kwargs?.reasoning_details&&Array.isArray(e.additional_kwargs.reasoning_details)&&e.additional_kwargs.reasoning_details.length>0||e.additional_kwargs?.reasoning_content;this.hasOpenThinkBlock&&!o&&(this.fullResponse+="</think>",this.hasOpenThinkBlock=!1),Array.isArray(e.content)?this.handleClaudeChunk(e.content):e.additional_kwargs?.reasoning_content?this.handleDeepseekChunk(e):o?this.handleOpenRouterChunk(e):this.handleDeepseekChunk(e),this.handleTextLevelThinkTags(),this.updateCurrentAiMessage(this.fullResponse)}processErrorChunk(e){this.errorResponse=lEe(e)}getToolCalls(){return this.accumulatedToolCalls.length>0?this.accumulatedToolCalls:dEe(this.toolCallChunks)}hasToolCalls(){return this.toolCallChunks.size>0||this.accumulatedToolCalls.length>0}setToolCalls(e){this.accumulatedToolCalls=e}buildAIMessage(){let e=this.getToolCalls();return s_r(this.fullResponse,e)}close(){return this.hasOpenThinkBlock&&(this.fullResponse+="</think>"),this.handleTextLevelThinkTags(),this.errorResponse&&(this.fullResponse+=this.errorResponse),this.updateCurrentAiMessage(this.fullResponse),{content:this.fullResponse,wasTruncated:this.wasTruncated,tokenUsage:this.tokenUsage}}};na();var dae=class extends PD{async constructMessages(e){if(!e.contextEnvelope)throw new Error("[LLMChainRunner] Context envelope is required but not available. Cannot proceed with LLM chain.");F("[LLMChainRunner] Using envelope-based context");let r=dA.convert(e.contextEnvelope,{includeSystemMessage:!0,mergeUserContent:!0,debug:!1}),n=[],o=r.find(s=>s.role==="system");o&&n.push(o);let i=this.chainManager.memoryManager.getMemory();await mq(i,n);let a=r.find(s=>s.role==="user");if(a)if(e.content&&Array.isArray(e.content)){let s=e.content.map(u=>u.type==="text"?{...u,text:a.content}:u);n.push({role:"user",content:s})}else n.push(a);return n}async run(e,r,n,o,i){let a=ee(),s=j_(),u=!1;try{u=!PS(s,a.activeModels).capabilities?.includes("reasoning")}catch(f){F("Could not determine model capabilities, defaulting to include thinking blocks",f)}let l=new iv(n,u);try{let f=await this.constructMessages(e),m=this.chainManager.chatModelManager.getChatModel()?.modelName;hq({messages:f,modelName:m,contextEnvelope:e.contextEnvelope}),F(`Final Request to AI:
`,f);let h=await Ib(()=>this.chainManager.chatModelManager.getChatModel().stream(f,{signal:r.signal}));for await(let y of h){if(r.signal.aborted){F("Stream iteration aborted",{reason:r.signal.reason});break}l.processChunk(y)}}catch(f){f.name==="AbortError"||r.signal.aborted?F("Stream aborted by user",{reason:r.signal.reason}):await this.handleError(f,l.processErrorChunk.bind(l))}let c=l.close(),d={wasTruncated:c.wasTruncated,tokenUsage:c.tokenUsage??void 0};return r.signal.aborted&&r.signal.reason==="new-chat"?(n(""),""):(await this.handleResponse(c.content,e,r,o,n,void 0,void 0,d),c.content)}};gr();Dt();async function fEe(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 Ib(async()=>{let o=await Vg.instance.getCurrentChainManager().chatModelManager.getChatModelWithTemperature(0),i="",a=await o.stream([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]);for await(let u of a)i+=tF(u.content);let s=lte(i);return Nge(s)})}Xe();Xe();id();u0();Qe();Xe();Dt();OD();o9();var pEe=class extends fA{constructor(r,n,o){super();this.lc_namespace=["self_host_retriever"];this.app=r,this.backend=n,this.options={...o,minSimilarityScore:o.minSimilarityScore??.01,salientTerms:o.salientTerms??[],returnAll:o.returnAll??!1}}async getRelevantDocuments(r,n){try{if(!await this.backend.isAvailable())return Ce("SelfHostRetriever: Backend is not available"),[];let a=ES(r,this.app.vault).map(f=>f.basename),s=[...new Set([...this.options.salientTerms||[],...a])],u=this.buildFilter(),l=this.options.returnAll?100:this.options.maxK,c=await this.backend.search(r,{limit:l,minScore:this.options.minSimilarityScore,filter:u});F(`SelfHostRetriever: Found ${c.length} results for query "${r.substring(0,50)}..."`);let d=this.convertToDocuments(c);return s.length>0?this.boostBySalientTerms(d,s):d}catch(o){return Ce(`SelfHostRetriever: Search failed: ${o}`),[]}}buildFilter(){let r={};return this.options.timeRange&&(r.mtime={gte:this.options.timeRange.startTime,lte:this.options.timeRange.endTime}),this.options.tagTerms&&this.options.tagTerms.length>0&&(r.tags={containsAny:this.options.tagTerms}),Object.keys(r).length>0?r:void 0}convertToDocuments(r){return r.map(n=>new Yl({pageContent:n.content,metadata:{...n.metadata,score:n.score,rerank_score:n.score,id:n.id,source:"self_host"}}))}boostBySalientTerms(r,n){return r.map(a=>{let s=a.pageContent.toLowerCase(),u=(a.metadata?.title||"").toLowerCase();if(n.some(c=>s.includes(c.toLowerCase())||u.includes(c.toLowerCase()))){let c=(a.metadata?.score||0)*1.1;return new Yl({pageContent:a.pageContent,metadata:{...a.metadata,score:c,rerank_score:c,salientBoost:!0}})}return a}).sort((a,s)=>(s.metadata?.score||0)-(a.metadata?.score||0))}getBackend(){return this.backend}};OD();o9();Xe();DG();u0();Qe();cH();var EEe=class extends fA{constructor(r,n){super();this.app=r;this.options=n;this.lc_namespace=["miyo_semantic_retriever"];this.client=new l0,this.returnAll=!!n.returnAll,this.maxK=Math.max(1,n.maxK),this.minSimilarityScore=n.minSimilarityScore??.1}async getRelevantDocuments(r,n){let o=await this.searchMiyo(r),i=this.deduplicateResults(o);return ee().debug&&this.logDebugInfo(r,o,i),i}async searchMiyo(r){try{let n=await this.client.resolveBaseUrl(Mx(ee())),o=this.returnAll?Pl:this.maxK,i=this.buildSearchFilters();ee().debug&&F("MiyoSemanticRetriever: search params:",{baseUrl:n,limit:o,maxK:this.maxK,minSimilarityScore:this.minSimilarityScore,returnAll:this.returnAll,filters:i});let a=ee().miyoSearchAll?void 0:tq(this.app),u=(await this.client.search(n,a,r,o,i)).results||[],l=u.filter(c=>this.isScoreAboveThreshold(c));return ee().debug&&F(`MiyoSemanticRetriever: received ${u.length} results, ${l.length} after threshold`),l.map(c=>this.toDocument(c))}catch(n){return Ce(`MiyoSemanticRetriever: search failed: ${n}`),[]}}buildSearchFilters(){if(!this.options.timeRange)return;let{startTime:r,endTime:n}=this.options.timeRange;return[{field:"mtime",gte:r,lte:n}]}toDocument(r){let n=NG(this.app,r.path),o=r.metadata??{},i=o.chunkId||(r.chunk_index!==void 0?`${n}#${r.chunk_index}`:void 0),a=typeof r.score=="number"?r.score.toFixed(2):"?";return new Yl({pageContent:r.chunk_text??"",metadata:{...o,score:r.score,explanation:`miyo ${a}`,path:n,mtime:r.mtime,ctime:r.ctime,title:r.title??"",id:r.id,embeddingModel:r.embedding_model,tags:r.tags??[],extension:r.extension,created_at:r.created_at,nchars:r.nchars,chunkId:i}})}isScoreAboveThreshold(r){let n=r.score;return typeof n!="number"||Number.isNaN(n)?!0:n>=this.minSimilarityScore}deduplicateResults(r){let n=new Map,o=i=>{let a=this.getDocumentKey(i);n.has(a)||n.set(a,i)};return r.forEach(o),ee().debug&&n.size!==r.length&&F(`MiyoSemanticRetriever: deduplicated semantic results from ${r.length} to ${n.size}`),Array.from(n.values())}logDebugInfo(r,n,o){F("*** MIYO SEMANTIC RETRIEVER DEBUG INFO: ***"),F("Query: ",r),F("Semantic Chunks: ",n),F("Deduplicated Chunks: ",o);let i=n.reduce((a,s)=>{let u=s.metadata?.score;return typeof u=="number"&&!Number.isNaN(u)?Math.max(a,u):a},0);F("Max Miyo Score: ",i)}getDocumentKey(r){let n=r.metadata??{};return n.chunkId||n.path||n.id||n.title||`${r.pageContent.slice(0,64)}::${r.pageContent.length}`}};lmt();cH();pX();function iDe(t){return{minSimilarityScore:t.minSimilarityScore??.1,maxK:t.maxK,salientTerms:t.salientTerms??[],timeRange:t.timeRange,textWeight:t.textWeight,returnAll:t.returnAll??!1,useRerankerThreshold:t.useRerankerThreshold,tagTerms:t.tagTerms??[]}}var ey=class ey{static registerSelfHostedBackend(e){ey.selfHostedBackend=e,F("RetrieverFactory: Self-hosted backend registered")}static clearSelfHostedBackend(){ey.selfHostedBackend=null,F("RetrieverFactory: Self-hosted backend cleared")}static hasSelfHostedBackend(){return ey.selfHostedBackend!==null}static async createRetriever(e,r,n){let o=n?{...ee(),...n}:ee(),i=iDe(r);if(ey.shouldUseMiyo(o)){let s=ey.createMiyoRetriever(e,r);return F("RetrieverFactory: Using MiyoSemanticRetriever (standalone)"),{retriever:s,type:"semantic",reason:"Miyo search is enabled"}}if(Wy()){if(o.selfHostUrl){let u=await ey.getSelfHostedBackend(o);if(u){let l=new pEe(e,u,i);return F("RetrieverFactory: Using self-host mode backend"),{retriever:l,type:"self_hosted",reason:"Self-host mode is enabled and backend is available"}}Ce("RetrieverFactory: Self-host mode backend unavailable, falling back")}else F("RetrieverFactory: Self-host mode enabled but URL not configured, falling back");if(o.enableSemanticSearchV3){let u=new FW(e,i);return F("RetrieverFactory: Using MergedSemanticRetriever (semantic search fallback for self-host mode)"),{retriever:u,type:"semantic",reason:"Self-host mode fallback to semantic search"}}let s=new Yx(e,i);return F("RetrieverFactory: Using TieredLexicalRetriever (lexical search fallback for self-host mode)"),{retriever:s,type:"lexical",reason:"Self-host mode fallback to lexical search (semantic disabled)"}}if(o.enableSemanticSearchV3){let s=new FW(e,i);return F("RetrieverFactory: Using MergedSemanticRetriever (semantic search)"),{retriever:s,type:"semantic",reason:"Semantic search is enabled"}}let a=new Yx(e,i);return F("RetrieverFactory: Using TieredLexicalRetriever (lexical search)"),{retriever:a,type:"lexical",reason:"Default lexical search"}}static createLexicalRetriever(e,r){return new Yx(e,iDe(r))}static createSemanticRetriever(e,r){return ey.shouldUseMiyo(ee())?ey.createMiyoRetriever(e,r):new FW(e,iDe(r))}static async getSelfHostedBackend(e){if(ey.selfHostedBackend)try{if(await ey.selfHostedBackend.isAvailable())return ey.selfHostedBackend;Ce("RetrieverFactory: Registered backend is not available")}catch(r){Ce("RetrieverFactory: Error checking backend availability:",r)}return Ce("RetrieverFactory: No self-hosted backend available. Register a VectorSearchBackend implementation via RetrieverFactory.registerSelfHostedBackend()"),null}static getRetrieverType(e){let r=e?{...ee(),...e}:ee();return ey.shouldUseMiyo(r)?"semantic":Wy()&&r.selfHostUrl&&ey.selfHostedBackend?"self_hosted":r.enableSemanticSearchV3?"semantic":"lexical"}static shouldUseMiyo(e){return kh(e)}static isMiyoActive(){return ey.shouldUseMiyo(ee())}static createMiyoRetriever(e,r){let n=iDe(r),o=n.returnAll?Pl:Math.min(n.maxK*2,Pl);return new EEe(e,{...n,maxK:o})}};ey.selfHostedBackend=null;var Qx=ey;aDe();sDe();Xat();Qe();Dt();var Nzr=`CITATION RULES:
1. START with [^1] and increment sequentially ([^1], [^2], [^3], etc.) with NO gaps
2. BE SELECTIVE: ONLY cite when introducing NEW factual claims, specific data, or direct quotes from sources
3. IMPORTANT: Do NOT cite every sentence or bullet point. This creates clutter and poor readability.
4. DO NOT cite for:
   - General knowledge or common facts
   - Your own analysis or synthesis
   - Transitional or concluding statements
   - Every single sentence (AVOID CITATION CLUTTER - aim for 1-3 citations per paragraph maximum)
5. Citations are for SOURCE ATTRIBUTION, not for proving every statement
6. GOOD: One citation per key concept. BAD: Citation after every sentence.
7. Place citations immediately after the specific claim: "The study found X [^1]" not "The study found X. [^1]"
8. Do not reuse any bracketed numbers that appear inside the source content itself
9. If multiple source chunks come from the same document, cite each relevant chunk separately (e.g., [^1] and [^2] can both be from the same document title)
10. End with '#### Sources' section containing: [^n]: [[Title]] (one per line, matching citation order)`,ZQo=`WEB CITATION RULES:
1. START with [^1] and increment sequentially ([^1], [^2], [^3], etc.) with NO gaps
2. Cite ONLY when introducing new factual claims, statistics, or direct quotes from the search results
3. After every cited claim, place the corresponding footnote immediately after the sentence ("The study found X [^1]")
4. End with '#### Sources' and provide definitions EXACTLY in this format: [^n]: [Short Title](URL)

IMPORTANT: Each source definition must follow this exact pattern:
- Start with [^n]: (where n is the citation number)
- Follow with [Title](URL) where Title is SHORT (2-5 words) and wrapped in square brackets
- Example: [^1]: [Paul Graham Essay](https://paulgraham.com/wealth.html)
- DO NOT write long descriptions - keep titles concise`;function Dzr(t,e=!0){return e?`

<guidance>
${Nzr}

IMAGE INCLUSION:
When the retrieved documents contain relevant images (in formats like ![alt](image.png) or ![[image.png]]), include them in your response at appropriate locations using their exact original markdown format from the source.

Source Catalog (for reference only):
${t.join(`
`)}
</guidance>`:`

<guidance>
IMAGE INCLUSION:
When the retrieved documents contain relevant images (in formats like ![alt](image.png) or ![[image.png]]), include them in your response at appropriate locations using their exact original markdown format from the source.

Source Catalog (for reference only):
${t.join(`
`)}
</guidance>`}function jzr(t,e=!0){return e?`

${Nzr}

Source Catalog (for reference only):
${t}`:""}function $zr(t){return t?"REMINDER: End your response with an '#### Sources' section listing each cited source as [^n]: [[Title]], numbered sequentially from [^1].":null}var YQo=20;function uDe(t,e,r=!0){if(!r||!e?.length||!t)return t||"";if(QQo(t))return t;let n=e.slice(0,YQo).map((o,i)=>{let a=(o.title||o.path||"Untitled").replace(/^\[\[|\]\]$/g,"");return`[^${i+1}]: [[${a}]]`}).join(`
`);return`${t}

#### Sources:

${n}`}function hX(t){if(!t)return"";let e=t.replace(/\[\^\d+\]/g,"");return e=e.replace(/\[(\d+(?:\s*,\s*\d+)*)\](?!\()/g,""),e=e.replace(/^\s*\[\^\d+\]:.*$/gm,""),e}function QQo(t){let e=t||"",r=/(^|\n)\s*#{1,6}\s*Sources\b/i.test(e),n=/(^|\n)\s*Sources\s*(?:[:-]\s*)?(\n|$)/i.test(e),o=/<summary[^>]*>\s*Sources\s*<\/summary>/i.test(e),i=/(^|\n)\s*\[\^\d+\]:\s*/.test(e);return r||n||o||i}function Lzr(t){let e=t||"";return/\[\^\d+\]/.test(e)}function Fzr(t=!0){return t?`

${ZQo}`:""}function eei(t){let e=/([\s\S]*?)\n+(?:####\s*)?Sources\s*:?\s*\n+([\s\S]*)$/i,r=t.match(e);if(r)return{mainContent:r[1],sourcesBlock:(r[2]||"").trim()};let n=t.match(/([\s\S]*?)\n+---+\s*\n+([\s\S]*)$/);if(n){let i=(n[2]||"").trim();if(i.length>0&&i.split(`
`).every(s=>!s.trim()||/^\[\^\d+\]:/.test(s.trim())))return{mainContent:n[1],sourcesBlock:i}}let o=t.match(/([\s\S]*?)\n{2,}(\[\^\d+\]:[\s\S]*)$/);if(o){let i=(o[2]||"").trim();if(i.split(`
`).every(s=>!s.trim()||/^\[\^\d+\]:/.test(s.trim())))return{mainContent:o[1],sourcesBlock:i}}return null}function tei(t){return t.includes(`
`)||(t=t.replace(/\s*\[(\d+)\]\s*/g,`
[$1] `),t=t.replace(/\s+(\d+)\.\s/g,`
$1. `),t=t.trim()),t}function rei(t){return t.split(`
`).map(e=>e.trim()).filter(e=>/^\[\^\d+\]:/.test(e))}function nei(t,e){let r=new Map,n=new Set,o=[],i=/\[\^(\d+)\]/g,a;for(;(a=i.exec(t))!==null;){let s=parseInt(a[1],10);n.has(s)||(n.add(s),o.push(s))}if(o.length>0)o.forEach((s,u)=>r.set(s,u+1));else{let s=1;for(let u of e){let l=u.match(/^\[\^(\d+)\]:/);if(l){let c=parseInt(l[1],10);r.has(c)||r.set(c,s++)}}}return r}function oei(t,e){let r=t,n;do n=!1,r=r.replace(/\[\^(\d+)\]/g,(o,i)=>{let a=parseInt(i,10),u=`[${e.get(a)??a}]`;return u!==o&&(n=!0),u}),r=r.replace(/\[\^(\d+(?:\s*,\s*\^?\d+)*)\]/g,(o,i)=>{let s=`[${i.split(",").map(u=>{let l=u.trim().replace(/^\^/,""),c=parseInt(l,10);return e.get(c)??c}).sort((u,l)=>u-l).map(u=>u.toString()).join(", ")}]`;return s!==o&&(n=!0),s});while(n);return r=r.replace(/\[(\d+)\]\./g,"[$1]"),r}function iei(t,e){let r=[];return t.split(`
`).forEach(n=>{let o=n.match(/^\[\^(\d+)\]:\s*(.*)$/);if(!o)return;let i=parseInt(o[1],10),a=e.get(i)??i,s=o[2].match(/\[([^\]]+)\]\(([^)]+)\)/),u=o[2].match(/\[\[(.*?)\]\]/),l;if(s)l=`<a href="${s[2]}">${s[1]}</a>`;else if(u)l=`[[${u[1]}]]`;else{let c=o[2].match(/^(.*?)\]\s*\(([^)]+)\)\s*$/);if(c){let d=c[1].trim();l=`<a href="${c[2].trim()}">${d}</a>`}else l=o[2].replace(/\s*\([^)]*\)\s*$/,"")}r[a-1]=l}),r}function aei(t){let e=[],r=new Set,n=new Map;return t.forEach((o,i)=>{if(!o)return;let a=o.match(/\[\[(.*?)\]\]/),s=a?a[1].toLowerCase():o.toLowerCase();if(!r.has(s))r.add(s),e.push(o),n.set(i+1,e.length);else{let u=e.findIndex(l=>{let c=l.match(/\[\[(.*?)\]\]/);return(c?c[1].toLowerCase():l.toLowerCase())===s});u>=0&&n.set(i+1,u+1)}}),{uniqueItems:e,consolidationMap:n}}function sei(t,e){return e.size===0?t:t.replace(/\[(\d+(?:\s*,\s*\d+)*)\]/g,(r,n)=>{let o=n.split(/\s*,\s*/),i=new Set,a=[];for(let s of o){let u=e.get(parseInt(s,10))||parseInt(s,10);i.has(u)||(i.add(u),a.push(u))}return`[${a.join(", ")}]`})}function uei(t){let e=t,r;do r=e,e=e.replace(/\[(\d+(?:\s*,\s*\d+)*)\](?:\s*(?:and|,)\s*|\s*)\[(\d+(?:\s*,\s*\d+)*)\]/g,(n,o,i)=>{let a=new Set(o.split(/\s*,\s*/).map(u=>u.trim()));return i.split(/\s*,\s*/).map(u=>u.trim()).every(u=>a.has(u))?`[${[...a].join(", ")}]`:n});while(e!==r);return e}function lei(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function cei(t){return t!=null}function dei(t){let e=t.split(`
`),r=[];return e.forEach(n=>{let o=n.trim();if(!o)return;let i=o.replace(/^<li>/i,"").replace(/<\/li>$/i,"").replace(/^[-*]\s*/,"").trim();if(!i)return;let a=i.match(/\[([^\]]+)\]\(([^)]+)\)/),s=i.match(/\[\[(.*?)\]\]/),u;a?u=`<a href="${a[2]}">${a[1]}</a>`:s?u=`[[${s[1]}]]`:u=lei(i),r.push({index:r.length+1,html:u})}),r}function Azr(t,e){let r=e.filter(o=>o.html.trim().length>0);if(r.length===0)return t;let n=r.map(({index:o,html:i})=>`<li class="copilot-sources__item"><span class="copilot-sources__index">[${o}]</span><span class="copilot-sources__text">${i}</span></li>`).join(`
`);return`${t}

<br/>
<details class="copilot-sources"><summary class="copilot-sources__summary">Sources</summary>
<ul class="copilot-sources__list">
${n}
</ul>
</details>`}function fei(t){return t.replace(/\[(\d+(?:\s*,\s*\d+)*)\](?!\()/g,'<span class="copilot-citation-ref">[$1]</span>')}function kzr(t,e=!0){if(!e)return t;let r=eei(t);if(!r)return t;let{mainContent:n,sourcesBlock:o}=r;o=tei(o);let i=rei(o);if(i.length===0){let d=dei(o);return Azr(n,d)}let a=nei(n,i);n=oei(n,a);let s=iei(o,a),{uniqueItems:u,consolidationMap:l}=aei(s);l.size>0&&(n=sei(n,l),n=uei(n),s=u),n=fei(n);let c=s.map((d,f)=>d?{index:f+1,html:d}:null).filter(cei);return Azr(n,c)}function lDe(t){return t.map(e=>{let r=e.title||e.path||"Untitled",n=e.path||r;return`- [[${r}]] (${n})`})}na();var nle=class extends PD{async run(e,r,n,o,i){let a=ee(),s=j_(),u=!1;try{u=!PS(s,a.activeModels).capabilities?.includes("reasoning")}catch(p){F("Could not determine model capabilities, defaulting to include thinking blocks",p)}let l=new iv(n,u);try{let p=e.contextEnvelope;if(!p)throw new Error("[VaultQA] Context envelope is required but not available. Cannot proceed with VaultQA chain.");let h=p.layers.find(oe=>oe.id==="L5_USER")?.text||e.message,y=this.extractTagTerms(h);F("[VaultQA] Extracted tags before condensing:",y);let g=this.chainManager.memoryManager.getMemory(),b=await g.loadMemoryVariables({}),_=Mge(b),w=h;_.length>0&&(F("[VaultQA] Condensing query with chat history for better retrieval"),w=await fEe(h,_),F("[VaultQA] Standalone question:",w));let T=ee(),O=y.length>0,P=await new IB(app,{salientTerms:O?[...y]:[],maxK:T.maxSourceChunks,returnAll:O}).getRelevantDocuments(w),R=Qx.isMiyoActive(),I=await Qx.createRetriever(app,{minSimilarityScore:.01,maxK:T.maxSourceChunks,salientTerms:O?[...y]:[],tagTerms:y,returnAll:O},R?{enableMiyo:!1,enableSemanticSearchV3:!1}:{}),A=I.retriever;F(`VaultQA: Using ${I.type} retriever - ${I.reason}`);let B=await A.getRelevantDocuments(w),{filterResults:k,searchResults:q}=mX(P,B),Z=[...k,...q],V=Z.length>T.maxSourceChunks,Y=Z.slice(0,T.maxSourceChunks);this.chainManager.storeRetrieverDocuments(Y);let X=Y.map(oe=>{let Q=oe.metadata?.title||"Untitled",de=oe.metadata?.path||Q;return`<${e3e}>
<title>${Q}</title>
<path>${de}</path>
<content>
${hX(oe.pageContent)}
</content>
</${e3e}>`}).join(`

`),W=[],re=this.chainManager.chatModelManager.getChatModel(),ue=Y.slice(0,Math.max(5,Math.min(20,Y.length))).map(oe=>({title:oe.metadata?.title||oe.metadata?.path||"Untitled",path:oe.metadata?.path||oe.metadata?.title||""})),le=lDe(ue).join(`
`),L=V?`

IMPORTANT: The retrieval limit of ${T.maxSourceChunks} documents was reached. ${Z.length-T.maxSourceChunks} additional matching documents were omitted. Inform the user: "Note: The retrieval cap was reached \u2014 some matching documents were not included. Upgrade to Copilot Plus for more complete answers."`:"",J=`

Answer the question based only on the following context:
`+X+jzr(le,T.enableInlineCitations)+L;F("[VaultQA] Using envelope-based context construction with LayerToMessagesConverter");let ne=dA.convert(p,{includeSystemMessage:!0,mergeUserContent:!0,debug:!1}),D=ne.find(oe=>oe.role==="system");D&&W.push({role:ute(re),content:D.content}),await mq(g,W);let N=ne.find(oe=>oe.role==="user");if(N){let oe=J+`

`+N.content;if(e.content&&Array.isArray(e.content)){let Q=e.content.map(de=>de.type==="text"?{...de,text:oe}:de);W.push({role:"user",content:Q})}else W.push({role:"user",content:oe})}let z=re?.modelName;hq({messages:W,modelName:z,contextEnvelope:e.contextEnvelope}),F(`Final Request to AI:
`,W);let H=await Ib(()=>this.chainManager.chatModelManager.getChatModel().stream(W,{signal:r.signal}));for await(let oe of H){if(r.signal.aborted){F("VaultQA stream iteration aborted",{reason:r.signal.reason});break}l.processChunk(oe)}}catch(p){p.name==="AbortError"||r.signal.aborted?F("VaultQA stream aborted by user",{reason:r.signal.reason}):await this.handleError(p,l.processErrorChunk.bind(l))}let c=l.close(),d={wasTruncated:c.wasTruncated,tokenUsage:c.tokenUsage??void 0};if(r.signal.aborted&&r.signal.reason==="new-chat")return n(""),"";let f=this.addSourcestoResponse(c.content);return await this.handleResponse(f,e,r,o,n,void 0,void 0,d),f}addSourcestoResponse(e){let r=ee();if(!Lzr(e))return e;let n=this.chainManager.getRetrievedDocuments(),o=_Nt(n).map(i=>({title:i}));return uDe(e,o,r.enableInlineCitations)}extractTagTerms(e){return a9(e)}};var gX=["@vault","@websearch","@composer","@memory"];gr();Xe();id();Qe();Qe();gr();Xe();LC();LC();Qe();var Ww=QL(),AB=yc([]),cmt=yc(""),qzr=yc(!1);function cDe(){return I_(AB,{store:Ww})}function Bzr(){return e1(cmt,{store:Ww})}function yX(){return Ww.get(AB)}function kW(){return Ww.get(cmt)}function dDe(t){Ww.set(AB,t)}function qW(t){let e=Ww.get(AB),r=e.findIndex(n=>n.title===t.title);if(r!==-1){let n=[...e];n[r]=t,Ww.set(AB,n)}else Ww.set(AB,[...e,t])}function bX(t){let e=Ww.get(AB);Ww.set(AB,e.filter(r=>r.title!==t))}function NB(t){Ww.set(cmt,t)}function ole(t){Ww.set(qzr,t)}function ile(){return Ww.get(qzr)}var dmt=new Set;function DB(t){dmt.add(t)}function jB(t){dmt.delete(t)}function y$(t){return dmt.has(t)}function fDe(){return ee().defaultSystemPromptTitle}function Uzr(){let t=yX(),e=kW();if(e){let n=t.find(o=>o.title===e);if(n)return n.content}let r=fDe();if(r){let n=t.find(o=>o.title===r);if(n)return n.content}return""}function zzr(){let t=fDe();NB(t)}function fmt(){ole(!1),NB("")}function pDe(){return Uzr()||ee()?.userSystemPrompt||""}function b$(){let t=pDe();if(ile())return t;let r=RNt;return t?`${r}
<user_custom_instructions>
${t}
</user_custom_instructions>`:r}async function _$(t){let e=b$();if(!t)return F("No UserMemoryManager provided to getSystemPromptWithMemory"),e;let r=await t.getUserMemoryPrompt();return r?`${r}
${e}`:e}var _X=require("obsidian");zr();Xe();Qe();function eT(){}eT.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(w){return w=a.postProcess(w,o),i?(setTimeout(function(){i(w)},0),!0):w}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(Vzr(a,m[0].lastComponent,r,e,a.useLongestToken));var y=-1/0,g=1/0;function b(){for(var w=Math.max(y,-c);w<=Math.min(g,c);w+=2){var T=void 0,O=m[w-1],E=m[w+1];O&&(m[w-1]=void 0);var P=!1;if(E){var R=E.oldPos-w;P=E&&0<=R&&R<u}var I=O&&O.oldPos+1<l;if(!P&&!I){m[w]=void 0;continue}if(!I||P&&O.oldPos<E.oldPos?T=a.addToPath(E,!0,!1,0,o):T=a.addToPath(O,!1,!0,1,o),h=a.extractCommon(T,r,e,w,o),T.oldPos+1>=l&&h+1>=u)return s(Vzr(a,T.lastComponent,r,e,a.useLongestToken));m[w]=T,T.oldPos+1>=l&&(g=Math.min(g,w-1)),h+1>=u&&(y=Math.max(y,w+1))}c++}if(i)(function w(){setTimeout(function(){if(c>d||Date.now()>p)return i();b()||w()},0)})();else for(;c<=d&&Date.now()<=p;){var _=b();if(_)return _}},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 Vzr(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 zps=new eT;function Hzr(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 Wzr(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 pmt(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 mmt(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 ale(t,e){return pmt(t,e,"")}function mDe(t,e){return mmt(t,e,"")}function Jzr(t,e){return e.slice(0,pei(t,e))}function pei(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 hDe="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}",mei=new RegExp("[".concat(hDe,"]+|\\s+|[^").concat(hDe,"]"),"ug"),yDe=new eT;yDe.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};yDe.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(mei)||[];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};yDe.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};yDe.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)&&Kzr(r,o,n,i),r=i,n=null,o=null)}),(n||o)&&Kzr(r,o,n,null),t};function Kzr(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=Hzr(o,a);t.value=mmt(t.value,a,u),e.value=ale(e.value,u),r.value=ale(r.value,u)}if(n){var l=Wzr(i,s);n.value=pmt(n.value,s,l),e.value=mDe(e.value,l),r.value=mDe(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=Hzr(c,d);e.value=ale(e.value,p);var m=Wzr(ale(c,p),f);e.value=mDe(e.value,m),n.value=pmt(n.value,c,m),t.value=mmt(t.value,c,c.slice(0,c.length-m.length))}else if(n){var h=n.value.match(/^\s*/)[0],y=e.value.match(/\s*$/)[0],g=Jzr(y,h);e.value=mDe(e.value,g)}else if(t){var b=t.value.match(/\s*$/)[0],_=e.value.match(/^\s*/)[0],w=Jzr(b,_);e.value=ale(e.value,w)}}var hei=new eT;hei.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(hDe,"]+|[^\\S\\n\\r]+|[^").concat(hDe,"]"),"ug");return t.match(e)||[]};function gei(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 bDe=new eT;bDe.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};bDe.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))),eT.prototype.equals.call(this,t,e,r)};function Gzr(t,e,r){var n=gei(r,{ignoreWhitespace:!0});return bDe.diff(t,e,n)}var yei=new eT;yei.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};var bei=new eT;bei.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};function hmt(t){"@babel/helpers - typeof";return hmt=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},hmt(t)}var sle=new eT;sle.useLongestToken=!0;sle.tokenize=bDe.tokenize;sle.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(gmt(t,null,null,o),o,"  ")};sle.equals=function(t,e,r){return eT.prototype.equals.call(sle,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};function gmt(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]=gmt(t[i],e,r,n,o);return e.pop(),r.pop(),a}if(t&&t.toJSON&&(t=t.toJSON()),hmt(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]=gmt(t[u],e,r,n,u);e.pop(),r.pop()}else a=t;return a}var gDe=new eT;gDe.tokenize=function(t){return t.slice()};gDe.join=gDe.removeEmpty=function(t){return t};function Xzr(t,e,r){return gDe.diff(t,e,r)}Mr();var v$=require("obsidian"),Lt=$(K()),Yzr=$(Im());xn();var ule=$(K());zr();var tT=ule.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 ule.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:Se("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},ule.createElement("div",{className:Se("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")}))});tT.displayName="SettingSwitch";function Zzr(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}Dt();function _ei(t,e){let r=o=>o.split(/(\s+)/).filter(Boolean);return Xzr(r(t),r(e)).map(o=>({value:o.value.join(""),added:o.added,removed:o.removed}))}function lle(t){let e=t.split(`
`);return e.length>0&&e[e.length-1]===""&&e.pop(),e}function Qzr(t){let e=[],r=0;for(;r<t.length;){let n=t[r];if(!n.added&&!n.removed)lle(n.value).forEach(o=>{e.push({original:o,modified:o,isUnchanged:!0})}),r++;else if(n.removed){let o=t[r+1];if(o?.added){let i=lle(n.value),a=lle(o.value),s=Math.max(i.length,a.length);for(let u=0;u<s;u++)e.push({original:i[u]??null,modified:a[u]??null,isUnchanged:!1});r+=2}else lle(n.value).forEach(i=>{e.push({original:i,modified:null,isUnchanged:!1})}),r++}else n.added&&lle(n.value).forEach(o=>{e.push({original:null,modified:o,isUnchanged:!1})}),r++}return e}var e4r=(0,Lt.memo)(({original:t,modified:e,side:r})=>{let n=_ei(t,e);return Lt.default.createElement("span",null,n.map((o,i)=>{if(r==="original"){if(o.removed)return Lt.default.createElement("span",{key:i,className:"tw-bg-error tw-text-error"},o.value);if(o.added)return null}else{if(o.added)return Lt.default.createElement("span",{key:i,className:"tw-bg-success tw-text-success"},o.value);if(o.removed)return null}return Lt.default.createElement("span",{key:i},o.value)}))});e4r.displayName="WordDiffSpan";var cle=(0,Lt.memo)(({row:t,side:e})=>{let r=e==="original"?t.original:t.modified,n=e==="original"?t.modified:t.original;return r===null?Lt.default.createElement("span",{className:"tw-text-muted"},"\xA0"):t.isUnchanged?Lt.default.createElement("span",{className:"tw-text-normal"},r||"\xA0"):n!==null?Lt.default.createElement(e4r,{original:t.original,modified:t.modified,side:e}):Lt.default.createElement("span",{className:e==="original"?"tw-bg-error tw-text-error":"tw-bg-success tw-text-success"},r||"\xA0")});cle.displayName="DiffCell";var dle="obsidian-copilot-apply-view",_De=class extends v$.ItemView{constructor(r){super(r);this.root=null;this.state=null;this.result=null}getViewType(){return dle}getDisplayText(){return"Preview Changes"}async setState(r){this.state=r,this.render()}async onOpen(){this.render()}async onClose(){this.root&&(this.root.unmount(),this.root=null),this.state?.resultCallback?.(this.result?this.result:"aborted")}render(){if(!this.state)return;let r=this.containerEl.children[1];r.empty();let n=r.createDiv();this.root||(this.root=(0,Yzr.createRoot)(n)),this.root.render(Lt.default.createElement(vei,{app:this.app,state:this.state,close:o=>{this.result=o,this.leaf.detach()}}))}},t4r=(0,Lt.memo)(({block:t})=>{let e=(0,Lt.useMemo)(()=>Qzr(t),[t]);return Lt.default.createElement("div",{className:"tw-grid tw-grid-cols-2 tw-gap-2"},Lt.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-2"},e.map((r,n)=>Lt.default.createElement("div",{key:n,className:"tw-whitespace-pre-wrap tw-font-mono tw-text-sm"},Lt.default.createElement(cle,{row:r,side:"original"})))),Lt.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-2"},e.map((r,n)=>Lt.default.createElement("div",{key:n,className:"tw-whitespace-pre-wrap tw-font-mono tw-text-sm"},Lt.default.createElement(cle,{row:r,side:"modified"})))))});t4r.displayName="SideBySideBlock";var r4r=(0,Lt.memo)(({block:t})=>{let e=t.some(n=>n.added||n.removed),r=(0,Lt.useMemo)(()=>Qzr(t),[t]);return e?Lt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Lt.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-2"},Lt.default.createElement("div",{className:"tw-mb-1 tw-text-xs tw-font-medium tw-text-muted"},"Original"),Lt.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-font-mono tw-text-sm"},r.map((n,o)=>n.original!==null?Lt.default.createElement("div",{key:o},Lt.default.createElement(cle,{row:n,side:"original"})):null))),Lt.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-2"},Lt.default.createElement("div",{className:"tw-mb-1 tw-text-xs tw-font-medium tw-text-muted"},"Modified"),Lt.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-font-mono tw-text-sm"},r.map((n,o)=>n.modified!==null?Lt.default.createElement("div",{key:o},Lt.default.createElement(cle,{row:n,side:"modified"})):null)))):Lt.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm tw-text-normal"},t.map((n,o)=>Lt.default.createElement("span",{key:o},n.value)))});r4r.displayName="SplitBlock";var vei=({app:t,state:e,close:r})=>{let n=e.simple??!1,[o,i]=(0,Lt.useState)(()=>e.changes.map(b=>({...b,accepted:null}))),[a,s]=(0,Lt.useState)(()=>ee().diffViewMode??"split"),u=b=>{s(b),Re("diffViewMode",b)},l=Zzr(o),c=(0,Lt.useRef)([]);if(!e||!e.changes)return ie("Invalid state:",e),Lt.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col tw-items-center tw-justify-center"},Lt.default.createElement("div",{className:"tw-text-error"},"Error: Invalid state - missing changes"),Lt.default.createElement(me,{onClick:()=>r("failed"),className:"tw-mt-4"},"Close"));let d=async()=>{try{let b=o.map(w=>w.accepted===null?{...w,accepted:!0}:w),_=await m(b);r(_?"accepted":"failed")}catch(b){ie("Error applying changes:",b),new v$.Notice(`Error applying changes: ${b.message}`),r("failed")}},f=async()=>{try{let b=o.map(w=>w.accepted===null?{...w,accepted:!1}:w),_=await m(b,!1);r(_?"rejected":"failed")}catch(b){ie("Error applying changes:",b),new v$.Notice(`Error applying changes: ${b.message}`),r("failed")}},p=async b=>{let _=t.vault.getAbstractFileByPath(b);if(_)return _;if(b.includes("/")){let w=b.split("/").slice(0,-1).join("/");await ql(w)}return await t.vault.create(b,"")},m=async(b,_=!0)=>{let w=b.filter(O=>O.added?O.accepted===!0:O.removed?O.accepted===!1:!0).map(O=>O.value).join(""),T=await p(e.path);return!T||!(T instanceof v$.TFile)?(ie("Error in getting file",e.path),new v$.Notice("Failed to create file"),!1):(await t.vault.modify(T,w),_&&new v$.Notice("Changes applied successfully"),!0)},h=b=>{if(!l)return;let _=-1;for(let w=b+1;w<l.length;w++){let T=l[w],O=T.some(P=>P.added||P.removed),E=T.some(P=>(P.added||P.removed)&&P.accepted===null);if(O&&E){_=w;break}}_!==-1&&c.current[_]&&c.current[_]?.scrollIntoView({behavior:"smooth",block:"center"})},y=b=>{i(_=>{let w=[..._],T=l?.[b];return T&&T.forEach(O=>{let E=w.findIndex(P=>P===O);E!==-1&&(w[E]={...w[E],accepted:!0})}),w}),setTimeout(()=>h(b),0)},g=b=>{i(_=>{let w=[..._],T=l?.[b];return T&&T.forEach(O=>{let E=w.findIndex(P=>P===O);E!==-1&&(w[E]={...w[E],accepted:!1})}),w}),setTimeout(()=>h(b),0)};return Lt.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},Lt.default.createElement("div",{className:"tw-fixed tw-bottom-4 tw-left-1/2 tw-z-[9999] tw-flex tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-secondary tw-p-2 tw-shadow-lg"},Lt.default.createElement(me,{variant:"destructive",size:"sm",onClick:f},Lt.default.createElement(Ho,{className:"tw-size-4"}),"Reject"),Lt.default.createElement(me,{variant:"success",size:"sm",onClick:d},Lt.default.createElement(Yu,{className:"tw-size-4"}),"Accept")),Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-border-b tw-border-solid tw-border-border tw-p-2"},Lt.default.createElement("div",{className:"tw-text-sm tw-font-medium"},e.path),Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Lt.default.createElement("span",{className:Se("tw-text-xs",a==="split"?"tw-font-medium tw-text-normal":"tw-text-muted")},"Split"),Lt.default.createElement(tT,{checked:a==="side-by-side",onCheckedChange:b=>u(b?"side-by-side":"split")}),Lt.default.createElement("span",{className:Se("tw-text-xs",a==="side-by-side"?"tw-font-medium tw-text-normal":"tw-text-muted")},"Side-by-side"))),Lt.default.createElement("div",{className:"tw-flex-1 tw-overflow-auto tw-p-2"},l?.map((b,_)=>{let w=b.some(O=>O.added||O.removed),T=w?b.every(O=>!O.added&&!O.removed||O.accepted===!0)?"accepted":b.every(O=>!O.added&&!O.removed||O.accepted===!1)?"rejected":"undecided":"unchanged";return Lt.default.createElement("div",{key:_,ref:O=>c.current[_]=O,className:Se("tw-mb-4 tw-overflow-hidden tw-rounded-md")},T==="accepted"?Lt.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"},b.filter(O=>!O.removed).map((O,E)=>Lt.default.createElement("div",{key:E},O.value))):T==="rejected"?Lt.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"},b.filter(O=>!O.added).map((O,E)=>Lt.default.createElement("div",{key:E},O.value))):a==="side-by-side"?Lt.default.createElement(t4r,{block:b}):Lt.default.createElement(r4r,{block:b}),!n&&w&&T==="undecided"&&Lt.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"},Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Lt.default.createElement(me,{variant:"destructive",size:"sm",onClick:()=>g(_)},Lt.default.createElement(Ho,{className:"tw-size-4"}),"Reject"),Lt.default.createElement(me,{variant:"success",size:"sm",onClick:()=>y(_)},Lt.default.createElement(Yu,{className:"tw-size-4"}),"Accept"))),!n&&w&&(T==="accepted"||T==="rejected")&&Lt.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"},Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Lt.default.createElement("div",{className:"tw-mr-2 tw-text-sm tw-font-medium"},T==="accepted"?Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-success"},Lt.default.createElement(Yu,{className:"tw-size-4"}),Lt.default.createElement("div",null,"Accepted")):Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-error"},Lt.default.createElement(Ho,{className:"tw-size-4"}),Lt.default.createElement("div",null,"Rejected"))),Lt.default.createElement(me,{variant:"secondary",size:"sm",onClick:()=>{i(O=>{let E=[...O],P=l?.[_];return P&&P.forEach(R=>{let I=E.findIndex(A=>A===R);I!==-1&&(E[I]={...E[I],accepted:null})}),E})}},"Revert"))))})))};Bee();Bee();eq();function rs(t){return AG(async e=>{let r=await t.func(e);return typeof r=="string"?r:JSON.stringify(r)},{name:t.name,description:t.description,schema:t.schema})}var dms={emptyParams:Ae.object({}),stringParam:t=>Ae.string().describe(t),numberParam:t=>Ae.number().describe(t),booleanParam:t=>Ae.boolean().describe(t),optionalString:t=>Ae.string().optional().describe(t),nonEmptyString:t=>Ae.string().min(1).describe(t),url:t=>Ae.string().url().describe(t),email:t=>Ae.string().email().describe(t)};Dt();Qe();Xe();async function o4r(t){let e=app.vault.getAbstractFileByPath(t);if(e&&e instanceof _X.TFile)return e;if(e&&!(e instanceof _X.TFile))throw new Error(`Path "${t}" exists but is not a file`);try{let r=t.includes("/")?t.split("/").slice(0,-1).join("/"):"";if(r&&await ql(r),e=app.vault.getAbstractFileByPath(t),e&&e instanceof _X.TFile)return e;if(e=await app.vault.create(t,""),!(e instanceof _X.TFile))throw new Error(`Failed to create file: unexpected type returned for "${t}"`);return e}catch(r){throw new Error(`Failed to get or create file "${t}": ${r.message}`)}}async function i4r(t,e,r=!1){let n=await o4r(t),o=app.workspace.getActiveFile();n&&(!o||o.path!==t)&&await app.workspace.getLeaf().openFile(n);let i="";n&&(i=await app.vault.read(n));let a=Gzr(i,e,{newlineIsToken:!0});return new Promise(s=>{app.workspace.getLeaf(!0).setViewState({type:dle,active:!0,state:{changes:a,path:t,simple:r,resultCallback:l=>{s(l)}}})})}var wei=Ae.object({path:Ae.string().describe(`(Required) The path to the file to write to. 
          The path must end with explicit file extension, such as .md or .canvas .
          Prefer to create new files in existing folders or root folder unless the user's request specifies otherwise.
          The path must be relative to the root of the vault.`),content:Ae.union([Ae.string(),Ae.object({}).passthrough()]).describe(`(Required) The content to write to the file. Can be either a string or an object.
          ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions. 
          You MUST include ALL parts of the file, even if they haven't been modified.

          # For string content
          * Use when writing text files like .md, .txt, etc.
          
          # For object content  
          * Use when writing structured data files like .json, .canvas, etc.
          * The object will be automatically converted to JSON string format
          
          # Canvas JSON Format (JSON Canvas spec 1.0)
          Required node fields: id, type, x, y, width, height
          Node types: "text" (needs text), "file" (needs file), "link" (needs url), "group" (optional label)
          Optional node fields: color (hex #FF0000 or preset "1"-"6"), subpath (file nodes, starts with #)
          Required edge fields: id, fromNode, toNode
          Optional edge fields: fromSide/toSide ("top"/"right"/"bottom"/"left"), fromEnd/toEnd ("none"/"arrow"), color, label
          All IDs must be unique. Edge nodes must reference existing node IDs.
          
          Example:
          {
            "nodes": [
              {"id": "1", "type": "text", "text": "Hello", "x": 0, "y": 0, "width": 200, "height": 50},
              {"id": "2", "type": "file", "file": "note.md", "subpath": "#heading", "x": 250, "y": 0, "width": 200, "height": 100, "color": "2"},
              {"id": "3", "type": "group", "label": "Group", "x": 0, "y": 100, "width": 300, "height": 150}
            ],
            "edges": [
              {"id": "e1-2", "fromNode": "1", "toNode": "2", "fromSide": "right", "toSide": "left", "color": "3", "label": "links to"}
            ]
          }`),confirmation:Ae.preprocess(t=>{if(typeof t=="string"){let e=t.trim().toLowerCase();if(e==="true")return!0;if(e==="false")return!1}return t},Ae.boolean()).optional().default(!0).describe("(Optional) Hint for confirmation preference. Note: preview is always shown unless the user has enabled auto-accept in settings.")}),SDe=rs({name:"writeFile",description:`Request to write content to a file at the specified path and show the changes in a Change Preview UI.

      # Steps to find the the target path
      1. Extract the target file information from user message and find out the file path from the context.
      2. If target file is not specified, use the active note as the target file.
      3. If still failed to find the target file or the file path, ask the user to specify the target file.
      `,schema:wei,func:async({path:t,content:e,confirmation:r=!0})=>{let n=KWe(t);n!==t&&(Ce(`Filename too long, truncated for filesystem compatibility: "${t}" \u2192 "${n}"`),t=n);let o=typeof e=="string"?e:JSON.stringify(e,null,2);if(ee().autoAcceptEdits)try{let u=await o4r(t);return await app.vault.modify(u,o),{result:"accepted",message:"File changes applied without preview. Do not retry or attempt alternative approaches to modify this file in response to the current user request."}}catch(u){return{result:"failed",message:`Error writing to file without preview: ${u?.message||u}`}}let s=await i4r(t,o);return{result:s,message:`File change result: ${s}. Do not retry or attempt alternative approaches to modify this file in response to the current user request.`}}}),Sei=Ae.object({path:Ae.string().describe("(Required) The path of the file to modify (relative to the root of the vault and include the file extension)."),oldText:Ae.string().describe(`(Required) The exact text to find and replace. Must match the file content exactly, including whitespace and indentation.
Fuzzy matching handles minor differences like trailing spaces or smart quotes, but the overall structure must be correct.
To make the match unique, include enough surrounding context lines (not just the changed line).`),newText:Ae.string().describe("(Required) The new text to replace the old text with. Can be empty string to delete the old text.")});function ymt(t){return t.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function wDe(t){return t.normalize("NFKC").split(`
`).map(e=>e.trimEnd()).join(`
`).replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/[\u2010-\u2015\u2212]/g,"-").replace(/[\u00A0\u2002-\u200A\u202F\u205F\u3000]/g," ")}function vDe(t,e){if(!e)return 0;let r=0,n=0;for(;(n=t.indexOf(e,n))!==-1;)r++,n+=1;return r}function Cei(t){return t.charCodeAt(0)===65279?{content:t.slice(1),hasBOM:!0}:{content:t,hasBOM:!1}}function xei(t,e,r){let n=vDe(t,e);if(n>0)return{found:!0,occurrences:n,workingContent:t,workingSearch:e,workingReplace:r,usedFuzzyMatch:!1};let o=wDe(t),i=wDe(e),a=vDe(o,i);if(a>0)return{found:!0,occurrences:a,workingContent:o,workingSearch:i,workingReplace:r,usedFuzzyMatch:!0};if(e.endsWith(`
`)){let s=e.slice(0,-1),u=r.endsWith(`
`)?r.slice(0,-1):r,l=vDe(t,s);if(l>0)return{found:!0,occurrences:l,workingContent:t,workingSearch:s,workingReplace:u,usedFuzzyMatch:!1};let c=wDe(s),d=vDe(o,c);if(d>0)return{found:!0,occurrences:d,workingContent:o,workingSearch:c,workingReplace:u,usedFuzzyMatch:!0}}return{found:!1,occurrences:0,workingContent:o,workingSearch:i,workingReplace:r,usedFuzzyMatch:!0}}function n4r(t,e,r){let n=r,o=0;for(let i=0;i<e.length;i++){let a=e[i].length,s=t[i]??"",u=s.length;if(n<=a){if(n===a)return o+u;let l=0,c=0;for(;c<s.length&&l<n;){let d=s[c].normalize("NFKC").length;if(l+d>n)break;l+=d,c++}return o+c}n-=a+1,o+=u+1}return o}function Tei(t,e,r){let{content:n,hasBOM:o}=Cei(t),i=(n.match(/\r\n/g)||[]).length,a=(n.match(/(?<!\r)\n/g)||[]).length,s=i>a,u=ymt(n),l=ymt(e),c=ymt(r),d=xei(u,l,c);if(!d.found)return{ok:!1,reason:"NOT_FOUND"};if(d.occurrences>1)return{ok:!1,reason:"AMBIGUOUS",occurrences:d.occurrences};let f,p;if(d.usedFuzzyMatch){let h=u.split(`
`),y=d.workingContent.split(`
`),g=d.workingContent.indexOf(d.workingSearch);if(f=n4r(h,y,g),p=n4r(h,y,g+d.workingSearch.length),f>=p)return{ok:!1,reason:"NOT_FOUND"};if(wDe(u.substring(f,p))!==d.workingSearch)return{ok:!1,reason:"NOT_FOUND"}}else f=u.indexOf(d.workingSearch),p=f+d.workingSearch.length;let m=u.substring(0,f)+d.workingReplace+u.substring(p);return s&&(m=m.replace(/\n/g,`\r
`)),o&&(m="\uFEFF"+m),{ok:!0,content:m}}var a4r=rs({name:"editFile",description:"Request to make a targeted change to an existing file by specifying the exact text to find and its replacement. Use this tool for precise, surgical edits to specific parts of a file.",schema:Sei,func:async({path:t,oldText:e,newText:r})=>{let n=KWe(t),o=app.vault.getAbstractFileByPath(n);if(!o||!(o instanceof _X.TFile))return{result:"failed",message:`File not found at path: ${n}. Please check the file path and try again.`};try{let i=await app.vault.read(o),a=Tei(i,e,r);if(!a.ok)return a.reason==="NOT_FOUND"?{result:"failed",message:`Could not find the specified text in ${n}. The oldText must match the file content \u2014 try including more surrounding context lines to locate the right spot.`}:{result:"failed",message:`Found ${a.occurrences} occurrences of the search text in ${n}. The text must be unique \u2014 add more surrounding context to make it unambiguous.`};let s=a.content;if(i===s)return{result:"accepted",message:`No changes made to ${n}. The replacement produced identical content. Use writeFile if the file needs a broader rewrite.`};if(ee().autoAcceptEdits)return await app.vault.modify(o,s),{result:"accepted",message:"File changes applied without preview. Do not retry or attempt alternative approaches to modify this file in response to the current user request."};let l=await i4r(n,s,!0);return{result:l,message:`File change result: ${l}. Do not retry or attempt alternative approaches to modify this file in response to the current user request.`}}catch(i){return{result:"failed",message:`Error modifying ${n}: ${i}. Please check the file path and try again.`}}}});Xe();var bmt=t=>{switch(t){case"@vault":return"Search through your vault for relevant information";case"@websearch":return"Search the web for information";case"@composer":return"Edit existing notes or create new notes.";case"@memory":return"Save information to user memory";default:return""}},w$=class{static async callTool(e,r){if(!e)throw new Error("Tool is undefined");let n=await e.call(r);return n??(Ce(`[ToolCall] Tool "${e.name}" returned null/undefined`),null)}};function s4r(t){let e=t.trim();if(!e)return"note";let r=e.match(/^\[\[([\s\S]+?)\]\]$/),n=r?r[1]:e,[o="",i=""]=n.split("|"),a=i.trim();if(a.length>0)return a;let s=o.trim(),[u]=s.split("#"),l=(u||s).trim()||e,c=l.split("/").filter(Boolean),d=c.length>0?c[c.length-1]:l;return d.replace(/\.[^/.]+$/,"")||d||"note"}var u4r=180;function Oei(t){let e=t.trim();return e.length<=u4r?e:`${e.slice(0,u4r)}\u2026`}function Eei(t){if(!t||typeof t!="object")return null;let e=typeof t.status=="string"?t.status:null,r=typeof t.message=="string"&&t.message.trim().length>0?Oei(t.message):null,n=typeof t.notePath=="string"?t.notePath:"",i=(typeof t.noteTitle=="string"&&t.noteTitle.trim().length>0?t.noteTitle.trim():s4r(n))||s4r(n);if(e==="invalid_path")return r??`\u26A0\uFE0F Invalid note path "${i}"`;if(e==="not_found")return r??`\u26A0\uFE0F Note "${i}" not found`;if(e==="not_unique"){let c=Array.isArray(t.candidates)?t.candidates.length:0;return r||(c>0?`\u26A0\uFE0F Multiple matches for "${i}" (${c} candidates)`:`\u26A0\uFE0F Multiple matches for "${i}"`)}if(e==="empty")return r??`\u26A0\uFE0F "${i}" contains no readable content`;if(e==="out_of_range"){if(r)return r;let c=typeof t.totalChunks=="number"&&Number.isFinite(t.totalChunks)?t.totalChunks:null,d=typeof t.chunkIndex=="number"&&Number.isFinite(t.chunkIndex)?t.chunkIndex:null;if(d!==null&&c!==null){let f=Math.max(c-1,0);return`\u26A0\uFE0F Chunk ${d} exceeds available range (max index ${f})`}return"\u26A0\uFE0F Requested chunk is out of range"}let a=typeof t.chunkIndex=="number"&&Number.isFinite(t.chunkIndex)?t.chunkIndex:0,s=typeof t.totalChunks=="number"&&Number.isFinite(t.totalChunks)?t.totalChunks:null,u=!!t.hasMore,l=[`\u2705 Read "${i||"note"}"`];return s&&s>0?l.push(`chunk ${a+1} of ${s}`):l.push(`chunk ${a+1}`),u&&l.push("more available"),l.join(" \xB7 ")}var S$=class{static format(e,r){try{let n=r;if(typeof n=="string"&&n.startsWith("ENC:"))try{n=decodeURIComponent(n.slice(4))}catch{}let o;try{o=JSON.parse(n)}catch{o=n}switch(e){case"localSearch":return this.formatLocalSearch(o);case"webSearch":return this.formatWebSearch(o);case"youtubeTranscription":return this.formatYoutubeTranscription(o);case"writeFile":return this.formatWriteToFile(o);case"editFile":return this.formatReplaceInFile(o);case"readNote":return this.formatReadNote(o);default:return r}}catch{return r}}static formatLocalSearchDocuments(e){if(!Array.isArray(e)||e.length===0)return`\u{1F4DA} Found 0 relevant notes

No matching notes found.`;let r=e.length,n=e.slice(0,10),o=n.some(s=>typeof s?.rerank_score=="number"||typeof s?.score=="number"||s?.source),i=n.map((s,u)=>o?this.formatSearchItem(s,u):this.formatBasicSearchItem(s,u)).join(`

`),a=r>10?`

... and ${r-10} more results`:"";return`\u{1F4DA} Found ${r} relevant notes

Top results:

${i}${a}`}static formatLocalSearch(e){if(typeof e=="string"){let n=e.match(/<localSearch[^>]*>([\s\S]*)<\/localSearch>/);if(n){let o=n[1].trim(),i=o.match(/<document>/g);if((i?i.length:0)===0)return`\u{1F4DA} Found 0 relevant notes

No matching notes found.`;let s=[],u=/<document>([\s\S]*?)<\/document>/g,l;for(;(l=u.exec(o))!==null;){let c=l[1],d=c.match(/<title>([\s\S]*?)<\/title>/),f=c.match(/<path>([\s\S]*?)<\/path>/),p=c.match(/<modified>([\s\S]*?)<\/modified>/),m=(d?.[1]||"Untitled").trim(),h=(f?.[1]||"").trim(),y=(p?.[1]||"").trim();s.push({title:m,path:h,mtime:y||null})}return this.formatLocalSearchDocuments(s)}}let r=this.parseSearchResults(e);return Array.isArray(r)?r.length===0?typeof e=="string"&&!e.includes("<localSearch")&&!e.includes('"type":"local_search"')?e:`\u{1F4DA} Found 0 relevant notes

No matching notes found.`:this.formatLocalSearchDocuments(r):typeof e=="string"?e:JSON.stringify(e,null,2)}static parseSearchResults(e){if(typeof e=="object"&&e!==null)return e.type==="local_search"&&Array.isArray(e.documents)?e.documents:[];if(typeof e=="string"){try{let r=JSON.parse(e);if(r&&r.type==="local_search"&&Array.isArray(r.documents))return r.documents}catch{}return[]}return[]}static formatSearchItem(e,r){let n=e.path?.split("/").pop()?.replace(/\.md$/,"")||e.title||"Untitled",o=e.rerank_score||e.score||0,i=typeof o=="number"?o.toFixed(4):o,a=e.source==="time-filtered"?"Recency":"Relevance",s=[`${r+1}. ${n}`];if(e.source==="time-filtered"){if(e.mtime)try{let l=new Date(e.mtime),c=isNaN(l.getTime())?String(e.mtime):l.toISOString();s.push(`   \u{1F552} Modified: ${c}${e.includeInContext?" \u2713":""}`)}catch{s.push(`   \u{1F552} Modified: ${String(e.mtime)}${e.includeInContext?" \u2713":""}`)}}else e.source==="title-match"?s.push(`   \u{1F516} Title match${e.includeInContext?" \u2713":""}`):s.push(`   \u{1F4CA} ${a}: ${i}${e.includeInContext?" \u2713":""}`);let u=this.extractContentSnippet(e.content);return u&&s.push(`   \u{1F4AC} "${u}${e.content?.length>150?"...":""}"`),e.path&&!e.path.endsWith(`/${n}.md`)&&s.push(`   \u{1F4C1} ${e.path}`),s.join(`
`)}static formatBasicSearchItem(e,r){let n=e.title||e.path||`Result ${r+1}`,o=[`${r+1}. ${n}`],i=e.mtime||e.modified||e.modified_at||e.updated_at;return i&&o.push(`   \u{1F552} Modified: ${String(i)}`),e.path&&e.path!==n&&o.push(`   \u{1F4C1} ${e.path}`),o.join(`
`)}static extractContentSnippet(e,r=150){return e?(e.match(/NOTE BLOCK CONTENT:\s*([\s\S]*)/)?.[1]||e).substring(0,r).replace(/\s+/g," ").trim():""}static formatWebSearch(e){if(Array.isArray(e)&&e.length>0&&e[0].type==="web_search"){let r=["\u{1F310} Web Search Results"],n=e[0];return n.content&&(r.push(""),r.push(n.content)),n.citations&&n.citations.length>0&&(r.push(""),r.push("Sources:"),n.citations.forEach((o,i)=>{r.push(`[${i+1}] ${o}`)})),n.instruction&&(r.push(""),r.push(`Note: ${n.instruction}`)),r.join(`
`)}if(typeof e=="string"){let r=e.split(`
`),n=["\u{1F310} Web Search Results"],o=!1,i=[],a=[];for(let s of r){if(s.includes("Sources:")){o=!0;continue}o?a.push(s):s.includes("Here are the web search results")||i.push(s)}return i.length>0&&(n.push(""),n.push(...i.filter(s=>s.trim()))),a.length>0&&(n.push(""),n.push("Sources:"),a.forEach(s=>{s.trim()&&n.push(s)})),n.join(`
`)}return e}static formatYoutubeTranscription(e){let r;if(typeof e=="string")try{r=JSON.parse(e)}catch{return e}else if(typeof e=="object")r=e;else return String(e);if(r.success===!1)return`\u{1F4FA} YouTube Transcription Failed

${r.message}`;if(r.results&&Array.isArray(r.results)){let n=[`\u{1F4FA} YouTube Transcripts (${r.total_urls} video${r.total_urls>1?"s":""})`];n.push("");for(let o of r.results){if(o.success){n.push(`\u{1F4F9} Video: ${o.url}`),n.push("");let i=o.transcript.split(`
`),a=0;for(let s of i)if(s.trim()&&(s.match(/^\[(\d+:\d+)\]/)?(a>0&&n.push(""),n.push(`\u23F0 ${s}`)):n.push(`   ${s.trim()}`),a++,a>30)){n.push(""),n.push("... (transcript truncated for display)");break}o.elapsed_time_ms&&(n.push(""),n.push(`Processing time: ${(o.elapsed_time_ms/1e3).toFixed(1)}s`))}else n.push(`\u274C Failed to transcribe: ${o.url}`),n.push(`   ${o.message}`);n.push(""),n.push("---"),n.push("")}return n.join(`
`).trimEnd()}if(r.transcript){let n=["\u{1F4FA} YouTube Transcript"];n.push("");let o=r.transcript.split(`
`),i=0;for(let a of o)if(a.trim()&&(a.match(/^\[(\d+:\d+)\]/)?(i>0&&n.push(""),n.push(`\u23F0 ${a}`)):n.push(`   ${a.trim()}`),i++,i>50)){n.push(""),n.push("... (transcript truncated for display)");break}return r.elapsed_time_ms&&(n.push(""),n.push(`Processing time: ${(r.elapsed_time_ms/1e3).toFixed(1)}s`)),n.join(`
`)}return typeof e=="object"?JSON.stringify(e,null,2):String(e)}static formatWriteToFile(e){let r=typeof e=="object"?e.result:e,n=String(r).toLowerCase();return n.includes("accepted")?"\u2705 File change: accepted":n.includes("rejected")?"\u274C File change: rejected":typeof e=="object"&&e.message?e.message:String(r)}static formatReplaceInFile(e){let r=String(typeof e=="object"?e.result??"":e),n=typeof e=="object"?e.diff:void 0;return r.toLowerCase().includes("accepted")&&n?`\u2705 Edit accepted
\`\`\`diff
${n}
\`\`\``:r.toLowerCase().includes("accepted")?"\u2705 Edit accepted":r.toLowerCase().includes("rejected")?"\u274C Edit rejected":typeof e=="object"&&e.message?e.message:r}static formatReadNote(e){let r=e;if(typeof e=="string")try{r=JSON.parse(e)}catch{r=null}let n=Eei(r);return n||(typeof e=="string"?e:JSON.stringify(e,null,2))}};Qe();var l4r=require("obsidian"),Pei="obsidian",Mei=["/Applications/Obsidian.app/Contents/MacOS/obsidian","/Applications/Obsidian.app/Contents/MacOS/Obsidian"],Rei=15e3,Iei=1048576;function _mt(){let t=l4r.Platform;return!!(t.isDesktopApp??t.isDesktop)}function Aei(){let t=globalThis;if(typeof t.require!="function")throw new Error("Node require is unavailable in this runtime. Obsidian CLI commands require the desktop app.");return t.require}function Nei(){let e=Aei()("child_process");if(typeof e.execFile!="function")throw new Error("Failed to resolve child_process.execFile");return e.execFile}function Dei(t){return t.replace(/\n/g,"\\n").replace(/\t/g,"\\t")}function jei(){let e=globalThis.process?.env;return e?[e.OBSIDIAN_CLI_BINARY,e.OBSIDIAN_CLI_PATH].map(n=>n?.trim()||"").filter(Boolean):[]}function $ei(t){let e=t?.trim();if(e)return[e];let r=[...jei(),Pei,...Mei];return Array.from(new Set(r.map(n=>n.trim()).filter(Boolean)))}function Lei(t){let e=[],r=t.vault?.trim();r&&e.push(`vault=${r}`),e.push(t.command);let n=Object.entries(t.params||{});n.sort(([o],[i])=>o.localeCompare(i));for(let[o,i]of n)if(i!=null){if(typeof i=="boolean"){i&&e.push(o);continue}e.push(`${o}=${Dei(String(i))}`)}return e}function Fei(t){return typeof t=="number"?t:null}async function kei(t,e,r,n,o,i,a){let s=Date.now();return await new Promise(u=>{t(r,n,{timeout:o,maxBuffer:i,windowsHide:!0},(l,c,d)=>{let f=Date.now()-s;if(l){u({command:e,args:n,binary:r,attemptedBinaries:[...a],ok:!1,stdout:c||"",stderr:d||"",exitCode:Fei(l.code),errorCode:l.code??null,signal:l.signal??null,durationMs:f});return}u({command:e,args:n,binary:r,attemptedBinaries:[...a],ok:!0,stdout:c||"",stderr:d||"",exitCode:0,errorCode:null,signal:null,durationMs:f})})})}async function C$(t){let e=t.command?.trim();if(!e)throw new Error("Obsidian CLI command is required");if(!_mt())throw new Error("Obsidian CLI commands are only supported in desktop Obsidian.");let r=Lei({...t,command:e}),n=t.timeoutMs??Rei,o=t.maxBufferBytes??Iei,i=Nei(),a=$ei(t.binary),s=[],u=null;for(let l of a){s.push(l);let c=await kei(i,e,l,r,n,o,s);if(u=c,c.ok||c.errorCode!=="ENOENT")return c}if(u)return u;throw new Error("Obsidian CLI execution failed before process spawn.")}async function c4r(t){return await C$({command:"daily:read",vault:t})}async function d4r(t){return await C$({command:"random:read",vault:t})}Wb();function qei(t){return"children"in t&&"path"in t}function Bei(t){return"path"in t&&!("children"in t)}function Uei(t){let e=t.split(".");return e.length>1&&e.pop()?.toLowerCase()||""}function vmt(t,e=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=Zl();for(let u of t.children)if(Bei(u)){if(fu(u,i,a)){e&&r.push(u.name);let l=Uei(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(qei(u)){let l=vmt(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 f4r=t=>rs({name:"getFileTree",description:"Get the file tree as a nested structure of folders and files",schema:Ae.object({}),func:async()=>{let e=vmt(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=vmt(t,!1);return r+JSON.stringify(o)}return r+n}});var vX=require("obsidian");Xe();Qe();Dt();ra();var $B=class{constructor(e){this.recentConversationsContent="";this.savedMemoriesContent="";this.isUpdatingMemory=!1;this.app=e}async loadMemory(){try{let e=this.app.vault.getAbstractFileByPath(this.getRecentConversationFilePath());e instanceof vX.TFile?this.recentConversationsContent=await this.app.vault.read(e):(this.recentConversationsContent="",F("[UserMemoryManager] Recent Conversations file not found, skipping memory load"));let r=this.app.vault.getAbstractFileByPath(this.getSavedMemoriesFilePath());r instanceof vX.TFile?this.savedMemoriesContent=await this.app.vault.read(r):(this.savedMemoriesContent="",F("[UserMemoryManager] Saved Memories file not found, skipping saved memory load"))}catch(e){ie("[UserMemoryManager] Error reading memory files:",e),this.recentConversationsContent="",this.savedMemoriesContent=""}}addRecentConversation(e,r){if(!ee().enableRecentConversations){Ce("[UserMemoryManager] Recent history referencing is disabled, skipping analysis");return}if(e.length===0){Ce("[UserMemoryManager] No messages to analyze for user memory");return}this.updateMemory(e,r).catch(o=>{ie("[UserMemoryManager] Background user memory operation failed:",o)})}async updateSavedMemory(e,r){if(!ee().enableSavedMemory)return{error:"Saved memory is disabled, skipping save"};if(!e||e.trim()==="")return{error:"No content provided for saved memory"};if(!r)return{error:"No chat model available, skipping save"};try{return await this.ensureMemoryFolderExists(),await this.updateSavedMemoryFile(this.getSavedMemoriesFilePath(),e,r)}catch(o){return{error:"Error saving memory: "+o.message}}}async getUserMemoryPrompt(){await this.loadMemory();try{let e=ee(),r="";return e.enableRecentConversations&&this.recentConversationsContent&&(r+=`<recent_conversations>
        ${this.recentConversationsContent}
        </recent_conversations>

        The current time is ${this.getTimestamp()}.
        <recent_conversations> are the recent conversations between you and the user. 
        You can use it to provide more context for your responses. 
        Only use the recent conversations if they are relevant to the current conversation.`),e.enableSavedMemory&&this.savedMemoriesContent&&(r+=`<saved_memories>
        ${this.savedMemoriesContent}
        </saved_memories>

        <saved_memories> are important memories that the user explicitly asked you to remember. 
        Use these memories to provide more personalized and contextually relevant responses.`),r.length>0?r:null}catch(e){return ie("[UserMemoryManager] Error reading user memory content:",e),null}}getTimestamp(){let e=new Date,r=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0");return`${r}-${n}-${o} ${i}:${a}`}async createConversationSection(e,r){let{title:n,summary:o}=await this.extractTitleAndSummary(e,r),i=this.getTimestamp(),a=`## ${n}
`;return a+=`**Time:** ${i}
`,a+=`**Summary:** ${o}
`,a}async updateMemory(e,r){if(this.isUpdatingMemory){F("[UserMemoryManager] Memory update already in progress, skipping.");return}this.isUpdatingMemory=!0;try{if(await this.ensureMemoryFolderExists(),!r){ie("[UserMemoryManager] No chat model available, skipping memory update");return}if(e.length===0){F("[UserMemoryManager] No messages available, skipping memory update");return}let n=await this.createConversationSection(e,r);await this.addToRecentConversationsFile(this.getRecentConversationFilePath(),n)}catch(n){ie("[UserMemoryManager] Error analyzing chat messages for user memory:",n)}finally{this.isUpdatingMemory=!1}}async ensureMemoryFolderExists(){let r=ee().memoryFolderName;await ql(r)}getRecentConversationFilePath(){return`${ee().memoryFolderName}/Recent Conversations.md`}getSavedMemoriesFilePath(){return`${ee().memoryFolderName}/Saved Memories.md`}async updateSavedMemoryFile(e,r,n){let o=this.app.vault.getAbstractFileByPath(e),i=o instanceof vX.TFile?await this.app.vault.read(o):"";if(!n)return{error:"No chat model available, skipping memory update"};let a=`You maintain a user's long-term personal memory list as concise bullet points.

    You task is to update the user's memory list with the new statement.
Rules:
- Keep only stable, evergreen facts or preferences that will help future conversations.
- Remove duplicates and near-duplicates by merging them into one concise statement.
- If the new statement conflicts with older ones, keep the most recent truth and remove obsolete/conflicting entries.
- Prefer short, specific, and unambiguous phrasing.
- Preserve the language used in the input memories.
- Output only the memory content with each as a bullet point.


# OUTPUT FORMAT
Return the updated memory list with each as a bullet point.
- memory item 1
- memory item 2
- memory item 3
...
`,s=`<current_memories>
${i.trim()}
</current_memories>

<new_statement>
${r.trim()}
</new_statement>
`,u=[new v_(a),new Au(s)],l=null;try{l=(await n.invoke(u)).text??""}catch(c){return{error:"LLM call failed while updating saved memories: "+c.message}}return l==null||l.trim()===""?{error:"Empty content returned from LLM"}:(o instanceof vX.TFile?await this.app.vault.modify(o,l):await this.app.vault.create(e,l),{content:l})}async addToRecentConversationsFile(e,r){let n=this.app.vault.getAbstractFileByPath(e);if(n instanceof vX.TFile){let o=await this.app.vault.read(n),i;if(o.trim()==="")i=`${r.trim()}
`;else{let a=this.parseExistingConversations(o);a.push(r);let u=ee().maxRecentConversations;a.length>u&&a.splice(0,a.length-u),i=`${a.map(c=>c.trim()).join(`

`)}
`}await this.app.vault.modify(n,i)}else{let o=`${r.trim()}
`;await this.app.vault.create(e,o)}}parseExistingConversations(e){let r=e.split(`
`),n=[],o=[];for(let i of r)i.trim().startsWith("## ")?(o.length>0&&n.push(o.join(`
`).trim()),o=[i]):o.length>0&&o.push(i);return o.length>0&&n.push(o.join(`
`).trim()),n}extractJsonFromResponse(e){let r=e.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/);if(r)return r[1].trim();let n=e.match(/\{[\s\S]*\}/);return n?n[0]:e}async extractTitleAndSummary(e,r){let n=e.map(s=>`${s.sender}: ${s.message}`).join(`

`),o=`Your task is to analyze a conversation and generate both a title and a summary.

# OUTPUT FORMAT
You must return your response in the following JSON format:
{
  "title": "Brief 2-8 word title capturing the main user intent",
  "summary": "2-3 sentence summary at most including key details (e.g. user facts mentioned entities), and key conclusions if there are any."
}

# RULES
* Use the same language as the conversation`,i=`<conversation_text>
${n}
</conversation_text>

Generate a title and summary for this conversation:`,a=[new v_(o),new Au(i)];try{let u=(await r.invoke(a)).text,l=this.extractJsonFromResponse(u);try{let c=JSON.parse(l);return{title:c.title||"Untitled Conversation",summary:c.summary||"No summary available"}}catch(c){return ie("[UserMemoryManager] Failed to parse LLM response as JSON:",c),{title:"Untitled Conversation",summary:"Summary generation failed"}}}catch(s){return ie("[UserMemoryManager] Failed to extract title and summary:",s),{title:"Untitled Conversation",summary:"Summary generation failed"}}}};Xe();LW();var zei=Ae.object({statement:Ae.string().min(1).describe("The user statement for explicitly updating saved memories")}),CDe=rs({name:"updateMemory",description:"Update the user memory when the user explicitly asks to update the memory",schema:zei,func:async({statement:t})=>{try{let e=new $B(app),r=U0.getInstance().getChatModel(),n=await e.updateSavedMemory(t,r);return n.error?{success:!1,message:n.error}:{success:!0,message:`Memory updated successfully into ${e.getSavedMemoriesFilePath()}: ${n.content}`}}catch(e){return ie("[updateMemoryTool] Error updating memory:",e),{success:!1,message:`Failed to save memory: ${e.message}`}}}});var fle=require("obsidian");Xe();var wmt=200;function xDe(t){return t.replace(/\\/g,"/").toLowerCase()}function Vei(t){return t.replace(/\.[^/.]+$/,"")}function Hei(t,e){if(e.length===0)return!1;let n=xDe(t).split("/").filter(Boolean);if(n.length<e.length)return!1;let o=n.slice(-e.length);for(let i=0;i<e.length;i+=1){let a=e[i];if(!a)return!1;let s=o[i];if(i===o.length-1){let u=Vei(s);if(!s.includes(a)&&!u.includes(a))return!1}else if(!s.includes(a))return!1}return!0}function Smt(t){return/\.[^/]+$/.test(t)}async function Wei(t){let e=b=>{let _=app.vault.getAbstractFileByPath(b);return _ instanceof fle.TFile?_:null},r=t.trim(),n=r.match(/^\s*\[\[([\s\S]+?)\]\]\s*$/),i=(n?n[1]:r).trim(),[a]=i.split("|"),[s]=a.split("#"),u=s.trim(),l=Array.from(new Set([r,i,u].map(b=>b.trim()).filter(Boolean)));for(let b of l){let _=e(b);if(_)return{type:"resolved",file:_};if(!Smt(b))for(let w of[".md",".canvas"]){let T=e(`${b}${w}`);if(T)return{type:"resolved",file:T}}}let c=app.metadataCache,d=u.trim();if(c&&d){let b=new Set([d]);if(!Smt(d))for(let _ of[".md",".canvas"])b.add(`${d}${_}`);for(let _ of b){let w=c.getFirstLinkpathDest?.(_,"");if(w instanceof fle.TFile)return{type:"resolved",file:w}}}if(!d)return{type:"not_found"};let f=app.vault.getMarkdownFiles?.()??[];if(f.length===0)return{type:"not_found"};let p=xDe(d),m=new Set([p]);if(!Smt(d))for(let b of[".md",".canvas"])m.add(xDe(`${d}${b}`));for(let b of f){let _=xDe(b.path);if(m.has(_))return{type:"resolved",file:b}}let h=d.split("/").pop();if(h){let b=h.toLowerCase(),_=f.filter(w=>w.basename.toLowerCase()===b);if(_.length===1)return{type:"resolved",file:_[0]};if(_.length>1)return{type:"not_unique",matches:_}}let y=p.split("/").filter(Boolean);if(y.length===0)return{type:"not_found"};let g=f.filter(b=>Hei(b.path,y));return g.length===1?{type:"resolved",file:g[0]}:g.length>1?{type:"not_unique",matches:g}:{type:"not_found"}}async function Jei(t){try{return await app.vault.read(t)}catch(e){return Ce(`readNote: failed to read ${t.path}`,e),""}}function Kei(){let t=new Map,e=app.vault.getMarkdownFiles?.()??[];for(let r of e)if(r instanceof fle.TFile){let n=t.get(r.basename)??[];n.push(r),t.set(r.basename,n)}return t}function Gei(t,e,r){let n=t.trim();if(!n)return[];let o=new Map,i=app.metadataCache.getFirstLinkpathDest?.(n,e);if(i instanceof fle.TFile&&o.set(i.path,i),!/\.[^./]+$/.test(n)){let a=n.split("/").pop()??n,s=r.get(a)??[];for(let u of s)o.set(u.path,u)}return Array.from(o.values())}function Xei(t,e){if(!t)return[];let r=/\[\[([^\]]+)\]\]/g,n=new Map,o=null,i;for(;(i=r.exec(t))!==null;){if(i.index>0&&t[i.index-1]==="!")continue;let a=i[1]?.trim();if(!a)continue;let[s,u]=a.split("|"),[l,c]=s.split("#"),d=l?.trim();if(!d)continue;let f=`${d}|${u??""}|${c??""}`;if(n.has(f))continue;o||(o=Kei());let p=Gei(d,e.path,o);n.set(f,{linkText:d,displayText:u?.trim()||d,section:c?.trim()||void 0,candidates:p.map(m=>({path:m.path,title:m.basename})),unresolved:p.length===0?!0:void 0})}return Array.from(n.values())}function Zei(t,e){let r=e.split(/\r?\n/),n=r.length===1&&r[0]===""?0:r.length;if(n===0)return[{id:`${t.path}#L1-1`,notePath:t.path,chunkIndex:0,content:"",heading:""}];let o=Math.ceil(n/wmt),i=[];for(let a=0;a<o;a++){let s=a*wmt,u=Math.min((a+1)*wmt,n),l=r.slice(s,u),c=l.find(f=>/^#+\s+/.test(f.trim())),d=c?c.trim().replace(/^#+\s+/,""):"";i.push({id:`${t.path}#L${s+1}-${u}`,notePath:t.path,chunkIndex:a,content:l.join(`
`).trimEnd(),heading:d})}return i}var Yei=Ae.object({notePath:Ae.string().min(1).describe("Full path to the note (relative to the vault root) that needs to be read, such as 'Projects/plan.md'."),chunkIndex:Ae.preprocess(t=>{if(typeof t=="string"){let e=t.trim();if(e.length===0)return;let r=Number(e);return Number.isFinite(r)?r:t}return t},Ae.number().int().min(0)).optional().describe("0-based chunk index to read. Omit to read the first chunk.")}),p4r=rs({name:"readNote",description:"Read a single note in search v3 sized chunks. Use only when you already know the exact note path and need its contents.",schema:Yei,func:async({notePath:t,chunkIndex:e=0})=>{let r=t.trim();if(r.startsWith("/"))return{notePath:r,status:"invalid_path",message:"Provide the note path relative to the vault root without a leading slash."};let n=await Wei(r);if(n.type==="not_found")return Ce(`readNote: note not found or not a file (${r})`),{notePath:r,status:"not_found",message:`Note "${r}" was not found or is not a readable file.`};if(n.type==="not_unique")return Ce(`readNote: ambiguous note path "${r}" matched multiple files`,n.matches.map(f=>f.path)),{notePath:r,status:"not_unique",message:`Multiple notes match "${r}". Provide a more specific path.`,candidates:n.matches.map(f=>({path:f.path,title:f.basename}))};let o=n.file,i=o.path,a=await Jei(o),s=Zei(o,a),u=s.length;if(u===0)return{notePath:i,status:"empty",message:`No readable content was found in "${i}".`};if(e>=u)return{notePath:i,status:"out_of_range",message:`Chunk index ${e} exceeds available chunks (last index ${u-1}).`,totalChunks:u};let l=s[e];F(`readNote: returning chunk ${l.chunkIndex} of ${u} for ${i}`);let c=l.chunkIndex<u-1,d=Xei(l.content,o);return{notePath:i,noteTitle:o.basename,heading:l.heading,chunkId:l.id,chunkIndex:l.chunkIndex,totalChunks:u,hasMore:c,nextChunkIndex:c?l.chunkIndex+1:null,content:l.content,mtime:o.stat.mtime,linkedNotes:d.length>0?d:void 0}}});function TDe(t,e,r,n){let o=t.trim();return o.length>0?o:r==="ENOENT"?`CLI binary not found. Tried: ${n.length>0?n.join(", "):"unknown"}. Ensure Obsidian CLI is installed or set OBSIDIAN_CLI_BINARY/OBSIDIAN_CLI_PATH.`:r!==null?`Obsidian CLI failed with error code ${String(r)}`:e!==null?`Obsidian CLI failed with exit code ${e}`:"Obsidian CLI command failed for an unknown reason"}function BW(t){throw new Error(TDe(t.stderr,t.exitCode,t.errorCode,t.attemptedBinaries))}var Xms=rs({name:"obsidianDailyRead",description:"Read the current daily note via Obsidian CLI and return the note content as plain text.",schema:Ae.object({vault:Ae.string().optional().describe("Optional vault name to target. Omit to use the active/default vault resolution from Obsidian CLI.")}),func:async({vault:t})=>{let e=await c4r(t);if(!e.ok)throw new Error(`Failed to read daily note via Obsidian CLI: ${TDe(e.stderr,e.exitCode,e.errorCode,e.attemptedBinaries)}`);return{type:"obsidian_cli_daily_read",command:e.command,vault:t||null,content:e.stdout,durationMs:e.durationMs}}}),m4r=rs({name:"obsidianRandomRead",description:"Read a random note via Obsidian CLI and return the note content as plain text.",schema:Ae.object({vault:Ae.string().optional().describe("Optional vault name to target. Omit to use the active/default vault resolution from Obsidian CLI.")}),func:async({vault:t})=>{let e=await d4r(t);if(!e.ok)throw new Error(`Failed to read random note via Obsidian CLI: ${TDe(e.stderr,e.exitCode,e.errorCode,e.attemptedBinaries)}`);return{type:"obsidian_cli_random_read",command:e.command,vault:t||null,content:e.stdout,durationMs:e.durationMs}}});function wX(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>e!=="command"&&e!=="vault"&&r!==void 0))}var Qei=Ae.object({command:Ae.enum(["daily","daily:read","daily:path"]).describe("daily \u2014 create today's daily note (applies configured template). daily:read \u2014 read today's daily note content. daily:path \u2014 get the vault-relative file path."),vault:Ae.string().optional().describe("Optional vault name to target. Omit to use the active vault.")}),h4r=rs({name:"obsidianDailyNote",description:"Create or read today's daily note, or get its vault path, via the official Obsidian CLI. Use readNote for reading specific notes by path. Use obsidianRandomRead for picking a random note.",schema:Qei,func:async t=>{let{command:e,vault:r}=t,n=wX(t),o=await C$({command:e,vault:r,params:n});o.ok||BW(o);let i=e==="daily:read"?o.stdout:o.stdout.trim();return{type:"obsidian_cli_daily_note",command:o.command,vault:r??null,content:i,durationMs:o.durationMs}}}),eti=Ae.object({command:Ae.enum(["properties","property:read"]).describe("properties \u2014 list property names vault-wide or key-value pairs for a specific note. property:read \u2014 read a single property value from a note."),name:Ae.string().optional().describe("For property:read: the property name to read (required). For properties vault-wide: filter to this property name."),file:Ae.string().optional().describe("Target file by name (without extension)."),path:Ae.string().optional().describe("Target file by vault-relative path."),counts:Ae.boolean().optional().describe("Include occurrence counts alongside property names (vault-wide mode)."),sort:Ae.string().optional().describe("Sort order for vault-wide listing. Use 'count' to sort by occurrence count."),total:Ae.boolean().optional().describe("Return only the total property count."),vault:Ae.string().optional().describe("Optional vault name to target. Omit to use the active vault.")}),g4r=rs({name:"obsidianProperties",description:"Read frontmatter properties from your vault via the official Obsidian CLI: list all property names used vault-wide, or read specific property values from a note.",schema:eti,func:async t=>{let{command:e,vault:r}=t;if(e==="property:read"&&!t.name)throw new Error("name is required for property:read");let n=wX(t),o=await C$({command:e,vault:r,params:n});return o.ok||BW(o),{type:"obsidian_cli_properties",command:o.command,vault:r??null,content:o.stdout.trim(),durationMs:o.durationMs}}}),tti=Ae.object({command:Ae.literal("tasks").describe('Must be exactly "tasks". Lists tasks across the vault with optional filters.'),file:Ae.string().optional().describe("Filter tasks by file name."),path:Ae.string().optional().describe("Filter tasks by vault-relative file path."),todo:Ae.boolean().optional().describe("Show only incomplete (todo) tasks."),done:Ae.boolean().optional().describe("Show only completed tasks."),status:Ae.string().optional().describe("Filter by a specific status character (e.g. '/' for in-progress)."),daily:Ae.boolean().optional().describe("Show tasks from today's daily note only."),verbose:Ae.boolean().optional().describe("Group tasks by file with line numbers."),total:Ae.boolean().optional().describe("Return only the total task count."),vault:Ae.string().optional().describe("Optional vault name to target. Omit to use the active vault.")}),y4r=rs({name:"obsidianTasks",description:"List tasks across your vault via the official Obsidian CLI with filters for completion status, file, daily note, and more.",schema:tti,func:async t=>{let{command:e,vault:r}=t,n=wX(t),o=await C$({command:e,vault:r,params:n});return o.ok||BW(o),{type:"obsidian_cli_tasks",command:o.command,vault:r??null,content:o.stdout.trim(),durationMs:o.durationMs}}}),rti=Ae.object({command:Ae.enum(["backlinks","links","orphans","unresolved"]).describe("backlinks \u2014 list notes that link TO a given file. links \u2014 list outgoing links FROM a file. orphans \u2014 list files with no incoming links. unresolved \u2014 list wikilinks that don't resolve to any file."),file:Ae.string().optional().describe("Target file by name (for backlinks and links commands)."),path:Ae.string().optional().describe("Target file by vault-relative path (for backlinks and links commands)."),counts:Ae.boolean().optional().describe("Include link counts per source file (for backlinks and unresolved)."),verbose:Ae.boolean().optional().describe("Include source file for each entry (for unresolved)."),total:Ae.boolean().optional().describe("Return only the count."),all:Ae.boolean().optional().describe("Include non-markdown files such as images and PDFs (for orphans)."),vault:Ae.string().optional().describe("Optional vault name to target. Omit to use the active vault.")}),b4r=rs({name:"obsidianLinks",description:"Query the vault link graph via the official Obsidian CLI: list backlinks to a file, outgoing links from a file, orphaned notes with no incoming links, or unresolved wikilinks.",schema:rti,func:async t=>{let{command:e,vault:r}=t,n=wX(t),o=await C$({command:e,vault:r,params:n});return o.ok||BW(o),{type:"obsidian_cli_links",command:o.command,vault:r??null,content:o.stdout.trim(),durationMs:o.durationMs}}}),nti=Ae.object({command:Ae.enum(["templates","template:read"]).describe("templates \u2014 list all available template names. template:read \u2014 read a template's content with variable resolution."),name:Ae.string().optional().describe("Template name to read. Required for template:read."),vault:Ae.string().optional().describe("Optional vault name to target. Omit to use the active vault.")}),_4r=rs({name:"obsidianTemplates",description:"List available templates or read template content via the official Obsidian CLI. Use before creating notes to find the right template.",schema:nti,func:async t=>{let{command:e,vault:r}=t;if(e==="template:read"&&!t.name)throw new Error("name is required for template:read");let n=wX(t),o=await C$({command:e,vault:r,params:n});return o.ok||BW(o),{type:"obsidian_cli_templates",command:o.command,vault:r??null,content:o.stdout.trim(),durationMs:o.durationMs}}}),oti=Ae.object({command:Ae.enum(["bases","base:views","base:query","base:create"]).describe("bases \u2014 list all Base files in the vault. base:views \u2014 list views defined in a Base file. base:query \u2014 query data from a Base view. base:create \u2014 create a new item (row) in a Base."),file:Ae.string().optional().describe("Target Base file by name (without extension). Used for base:views, base:query, and base:create."),path:Ae.string().optional().describe("Target Base file by vault-relative path. Alternative to file= for base:views, base:query, and base:create."),view:Ae.string().optional().describe("View name. For base:query: view to query. For base:create: view to add item to."),name:Ae.string().optional().describe("New file name for the created item. For base:create only."),content:Ae.string().optional().describe("Initial content for the created item. For base:create only."),format:Ae.string().optional().describe("Output format for base:query (e.g., 'csv'). Omit for default text output."),total:Ae.boolean().optional().describe("Return only the count."),vault:Ae.string().optional().describe("Optional vault name to target. Omit to use the active vault.")}),iti=["base:views","base:query","base:create"],v4r=rs({name:"obsidianBases",description:"Interact with Obsidian Base (database) files via the official Obsidian CLI: list all bases, list views in a base, query data from a base view, or create a new item in a base.",schema:oti,func:async t=>{let{command:e,vault:r}=t;if(iti.includes(e)&&!t.file&&!t.path)throw new Error(`file or path is required for ${e}`);let n=wX(t),o=await C$({command:e,vault:r,params:n});return o.ok||BW(o),{type:"obsidian_cli_bases",command:o.command,vault:r??null,content:o.stdout.trim(),durationMs:o.durationMs}}});gr();aA();Xe();u0();id();Qe();Xe();id();Qe();Dt();async function Cmt(t,e,r){try{if(!t||!t.name)return{toolName:t?.name||"unknown",result:"Error: Invalid tool call - missing tool name",success:!1};let o=e.find(c=>c.name===t.name);if(!o){let c=e.map(d=>d.name).join(", ");return{toolName:t.name,result:`Error: Tool '${t.name}' not found. Available tools: ${c}. Make sure you have the tool enabled in the Agent settings.`,success:!1}}let a=Uc.getInstance().getToolMetadata(t.name);if(a?.isPlusOnly&&!await m0()&&!Wy())return{toolName:t.name,result:`Error: ${ODe(t.name)} requires a Copilot Plus subscription`,success:!1};let s={...t.args};a?.requiresUserMessageContent&&r&&(s._userMessageContent=r);let u=12e4;typeof a?.timeoutMs=="number"&&(u=a.timeoutMs);let l;return!u||u===1/0?l=await w$.callTool(o,s):l=await Promise.race([w$.callTool(o,s),new Promise((c,d)=>setTimeout(()=>d(new Error(`Tool execution timed out after ${u}ms`)),u))]),l==null?(Ce(`Tool ${t.name} returned null/undefined result`),{toolName:t.name,result:JSON.stringify({message:"Tool executed but returned no result",status:"empty"}),success:!0}):{toolName:t.name,result:typeof l=="string"?l:JSON.stringify(l),success:!0}}catch(o){let i=Wr(o);return i.includes("schema")?ie(`[ToolCall] Schema validation failed for "${t.name}". Args: ${JSON.stringify(t.args,null,2)}`):ie(`[ToolCall] Error executing "${t.name}": ${i}`),{toolName:t.name,result:`Error: ${i}`,success:!1}}}function ODe(t){return t==="localSearch"?ee().enableSemanticSearchV3?"vault search (semantic)":"vault search (index-free)":{webSearch:"web search",getFileTree:"file tree",getCurrentTime:"current time",getTimeRangeMs:"time range",getTimeInfoByEpoch:"time info",convertTimeBetweenTimezones:"timezone converter",startPomodoro:"pomodoro timer",pomodoroTool:"pomodoro timer",youtubeTranscription:"YouTube transcription",indexVault:"vault indexing",indexTool:"index",writeFile:"file editor",editFile:"file editor",obsidianDailyNote:"daily note (CLI)",obsidianRandomRead:"random note (CLI)",obsidianProperties:"properties (CLI)",obsidianTasks:"tasks (CLI)",obsidianLinks:"links (CLI)",obsidianTemplates:"templates (CLI)",obsidianBases:"bases (CLI)"}[t]||t}function xmt(t){return{localSearch:"\u{1F50D}",webSearch:"\u{1F310}",getFileTree:"\u{1F4C1}",getCurrentTime:"\u{1F552}",getTimeRangeMs:"\u{1F4C5}",getTimeInfoByEpoch:"\u{1F570}\uFE0F",convertTimeBetweenTimezones:"\u{1F30D}",youtubeTranscription:"\u{1F4FA}",indexVault:"\u{1F4DA}",indexTool:"\u{1F4DA}",writeFile:"\u270F\uFE0F",editFile:"\u{1F504}",readNote:"\u{1F50D}",obsidianDailyNote:"\u{1F4C5}",obsidianRandomRead:"\u{1F3B2}",obsidianProperties:"\u{1F3F7}\uFE0F",obsidianTasks:"\u2705",obsidianLinks:"\u{1F517}",obsidianTemplates:"\u{1F4C4}",obsidianBases:"\u{1F5C4}\uFE0F"}[t]||"\u{1F527}"}function Tmt(t,e){let r=ODe(t.name),n=xmt(t.name),o=Object.keys(t.args).length>0?JSON.stringify(t.args,null,2):"(no parameters)";F(`${n} [Iteration ${e}] ${r.toUpperCase()}`),F("Parameters:",o),F("---")}function Omt(t,e){if(t==="localSearch")return;let r=ODe(t),n=xmt(t),o=e.success?"\u2705 SUCCESS":"\u274C FAILED";F(`${n} ${r.toUpperCase()} RESULT: ${o}`);let i=300,a=String(e.result??"");a.length>i?F(`Result: ${a.substring(0,i)}... (truncated, ${a.length} chars total)`):a.length>0&&F("Result:",a)}function LB(t){let e=new Map;for(let r of t){let n=r.path||r.title,o=e.get(n);(!o||r.score>o.score)&&e.set(n,r)}return Array.from(e.values()).sort((r,n)=>n.score-r.score)}pX();aDe();cH();sDe();function ati(t){let e=new Set,r=[],n=o=>{if(typeof o!="string")return;let i=o.toLowerCase().trim();i&&!e.has(i)&&(e.add(i),r.push(o.trim()))};return t.originalQuery&&typeof t.originalQuery=="string"&&n(t.originalQuery),(t.salientTerms||[]).forEach(n),(t.expandedQueries||[]).forEach(n),r}var Pmt=Ae.object({query:Ae.string().min(1).describe("The search query to find relevant notes"),salientTerms:Ae.array(Ae.string()).describe("Keywords extracted from the user's query for BM25 full-text search. Must be from original query."),timeRange:Ae.object({startTime:Ae.number().optional().describe("Start time as epoch milliseconds"),endTime:Ae.number().optional().describe("End time as epoch milliseconds")}).optional().describe("Optional time range filter. Use epoch milliseconds from getTimeRangeMs result."),_preExpandedQuery:Ae.object({originalQuery:Ae.string(),salientTerms:Ae.array(Ae.string()),expandedQueries:Ae.array(Ae.string()),recallTerms:Ae.array(Ae.string())}).optional().describe("Internal: pre-expanded query data injected by the system to avoid double expansion")});async function Emt({timeRange:t,query:e,salientTerms:r,forceLexical:n=!1,preExpandedQuery:o}){let i=ee(),a=r.filter(I=>I.startsWith("#")),s=a.length>0?a:(()=>{try{return[...e.matchAll(/#[\p{L}\p{N}_/-]+/gu)].map(I=>I[0])}catch{return[...e.matchAll(/#[a-z0-9_/-]+/gi)].map(I=>I[0])}})(),u=s.length>0,l=t!==void 0||u,c=l?Pl:i.maxSourceChunks;F(`lexicalSearch effectiveMaxK: ${c} (expanded: ${l}), forceLexical: ${n}`);let d=o?{...o,queries:[o.originalQuery,...o.expandedQueries||[]].filter(Boolean)}:void 0,f=new IB(app,{salientTerms:r,timeRange:t,maxK:c,returnAll:l}),p=await f.getRelevantDocuments(e);F(`lexicalSearch filterRetriever returned ${p.length} filter docs`);let m=[],h;if(!f.hasTimeRange()){let I={minSimilarityScore:l?0:.1,maxK:c,salientTerms:r,textWeight:$ge,returnAll:l,useRerankerThreshold:.5,tagTerms:s,preExpandedQuery:d},A,B;if(n)A=Qx.createLexicalRetriever(app,I),B="lexical (forced)";else{let k=await Qx.createRetriever(app,I);A=k.retriever,B=k.type}if(F(`lexicalSearch using ${B} retriever`),m=await A.getRelevantDocuments(e),A instanceof Yx){let k=A.getLastQueryExpansion();k&&(h={originalQuery:k.originalQuery,salientTerms:k.salientTerms,expandedQueries:k.expandedQueries,recallTerms:ati(k)})}}let{filterResults:y,searchResults:g}=mX(p,m),b=(I,A)=>({title:I.metadata.title||"Untitled",content:I.pageContent,path:I.metadata.path||"",score:I.metadata.rerank_score??I.metadata.score??0,rerank_score:I.metadata.rerank_score??I.metadata.score??0,includeInContext:I.metadata.includeInContext??!0,source:I.metadata.source,mtime:I.metadata.mtime??null,ctime:I.metadata.ctime??null,chunkId:I.metadata.chunkId??null,isChunk:I.metadata.isChunk??!1,explanation:I.metadata.explanation??null,isFilterResult:A,matchType:A?I.metadata.source||"filter":void 0}),_=y.map(I=>b(I,!0)),w=g.map(I=>b(I,!1));F(`lexicalSearch found ${_.length} filter + ${w.length} search documents for query: "${e}"`),t&&F(`Time range search from ${new Date(t.startTime).toISOString()} to ${new Date(t.endTime).toISOString()}`);let T=w.map(I=>({title:I.title||I.path||"Untitled",path:I.path||I.title||"",score:I.rerank_score||I.score||0})),O=LB(T),E=new Map;for(let I of w){let A=(I.path||I.title).toLowerCase(),B=E.get(A);(!B||(I.rerank_score||0)>(B.rerank_score||0))&&E.set(A,I)}let P=O.map(I=>E.get((I.path||I.title).toLowerCase())).filter(Boolean);return{type:"local_search",documents:[..._,...P].slice(0,c),queryExpansion:h}}var Ehs=rs({name:"lexicalSearch",description:"Search for notes using lexical/keyword-based search",schema:Pmt,func:async({timeRange:t,query:e,salientTerms:r})=>{let n=Mmt(t);return await Emt({timeRange:n,query:e,salientTerms:r})}}),Phs=rs({name:"semanticSearch",description:"Search for notes using semantic/meaning-based search with embeddings",schema:Pmt,func:async({timeRange:t,query:e,salientTerms:r})=>{let n=Mmt(t),o=ee(),i=r.filter(h=>h.startsWith("#")),a=n!==void 0||i.length>0,s=a?Pl:o.maxSourceChunks;F(`semanticSearch effectiveMaxK: ${s} (expanded: ${a})`);let l=await new(await Promise.resolve().then(()=>(PEe(),Yat))).HybridRetriever({minSimilarityScore:a?0:.1,maxK:s,salientTerms:r,timeRange:n,textWeight:$ge,returnAll:a,useRerankerThreshold:.5}).getRelevantDocuments(e);F(`semanticSearch found ${l.length} documents for query: "${e}"`),n&&F(`Time range search from ${new Date(n.startTime).toISOString()} to ${new Date(n.endTime).toISOString()}`);let c=l.map(h=>{let y=h.metadata.rerank_score??h.metadata.score??0;return{title:h.metadata.title||"Untitled",content:h.pageContent,path:h.metadata.path||"",score:y,rerank_score:y,includeInContext:h.metadata.includeInContext??!0,source:h.metadata.source,mtime:h.metadata.mtime??null,ctime:h.metadata.ctime??null,chunkId:h.metadata.chunkId??null,isChunk:h.metadata.isChunk??!1,explanation:h.metadata.explanation??null}}),d=c.map(h=>({title:h.title||h.path||"Untitled",path:h.path||h.title||"",score:h.rerank_score||h.score||0})),f=LB(d),p=new Map;for(let h of c){let y=(h.path||h.title).toLowerCase(),g=p.get(y);(!g||(h.rerank_score||0)>(g.rerank_score||0))&&p.set(y,h)}return{type:"local_search",documents:f.map(h=>p.get((h.path||h.title).toLowerCase())).filter(Boolean)}}});function Mmt(t){if(!t)return;let{startTime:e,endTime:r}=t;if(!e||!r||e<=0||r<=0){F("localSearch: Ignoring invalid time range (missing, zero, or negative values)");return}if(e>r){F("localSearch: Ignoring inverted time range (start > end)");return}return{startTime:e,endTime:r}}async function sti({query:t,salientTerms:e,timeRange:r}){let n=e.filter(p=>p.startsWith("#")),o=r!==void 0||n.length>0,i=o?Pl:ee().maxSourceChunks,a=new IB(app,{salientTerms:e,timeRange:r,maxK:i,returnAll:o}),s=await a.getRelevantDocuments(t),u=[];a.hasTimeRange()||(u=await Qx.createMiyoRetriever(app,{minSimilarityScore:o?0:.1,maxK:i,salientTerms:e,textWeight:$ge,returnAll:o,useRerankerThreshold:.5,tagTerms:n}).getRelevantDocuments(t)),F(`miyoSearch: ${s.length} filter + ${u.length} miyo docs for query: "${t}"`);let{filterResults:l,searchResults:c}=mX(s,u),d=(p,m)=>({title:p.metadata.title||"Untitled",content:p.pageContent,path:p.metadata.path||"",score:p.metadata.rerank_score??p.metadata.score??0,rerank_score:p.metadata.rerank_score??p.metadata.score??0,includeInContext:p.metadata.includeInContext??!0,source:p.metadata.source,mtime:p.metadata.mtime??null,ctime:p.metadata.ctime??null,chunkId:p.metadata.chunkId??null,isChunk:p.metadata.isChunk??!1,explanation:p.metadata.explanation??null,isFilterResult:m,matchType:m?p.metadata.source||"filter":void 0});return{type:"local_search",documents:[...l.map(p=>d(p,!0)),...c.map(p=>d(p,!1))].slice(0,i)}}var EDe=rs({name:"localSearch",description:"Search for notes in the vault based on query, salient terms, and optional time range",schema:Pmt,func:async({timeRange:t,query:e,salientTerms:r,_preExpandedQuery:n})=>{let o=Mmt(t);if(Qx.isMiyoActive())return F("localSearch: Using Miyo search path"),await sti({query:e,salientTerms:r,timeRange:o});let i=r.filter(u=>u.startsWith("#"));if(o!==void 0||i.length>0)return F("localSearch: Forcing lexical search (time range or tags present)"),await Emt({timeRange:o,query:e,salientTerms:r,forceLexical:!0,preExpandedQuery:n});let s=Qx.getRetrieverType();return F(`localSearch: Using ${s} retriever via factory`),await Emt({timeRange:o,query:e,salientTerms:r,preExpandedQuery:n})}}),Mhs=rs({name:"indexVault",description:"Index the vault to the Copilot index",schema:Ae.object({}),func:async()=>{let t=ee();if(t.enableSemanticSearchV3)try{let r=await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().indexVaultToVectorStore(),n=kh(t),o=n?`Requested a Miyo folder scan for this vault.
`:`Semantic search index refreshed with ${r} documents.
`;return{success:!0,message:n?o+"Miyo will handle chunking and indexing for the registered folder.":o+`Semantic search index has been refreshed with ${r} documents.`,documentCount:r}}catch(e){return{success:!1,message:`Failed to index with semantic search: ${e.message}`}}else return{success:!0,message:"Tiered lexical retriever uses on-demand indexing. No manual indexing required."}}}),uti=Ae.object({query:Ae.string().min(1).describe("The search query to search the internet"),chatHistory:Ae.array(Ae.object({role:Ae.enum(["user","assistant"]),content:Ae.string()})).describe("Previous conversation turns for context (usually empty array)")}),PDe=rs({name:"webSearch",description:"Search the INTERNET (NOT vault notes) when user explicitly asks for web/online information",schema:uti,func:async({query:t,chatHistory:e})=>{try{let r=await fEe(t,e),n,o;if(Wy()&&Kbr()){let a=await Gbr(r);n=a.content,o=a.citations}else{let a=await Xl.getInstance().webSearch(r);n=a.response.choices[0].message.content,o=a.response.citations||[]}return[{type:"web_search",content:n,citations:o,instruction:Fzr()}]}catch(r){return console.error(`Error processing web search query ${t}:`,r),{error:`Web search failed: ${r}`}}}});var Rmt=5e5,lti=500,w4r=50,cti=Ae.object({includeInline:Ae.boolean().optional().describe("Include inline tags in addition to frontmatter tags. Defaults to true."),maxEntries:Ae.number().int().min(1).max(5e3).optional().describe("Maximum number of tag entries to return, sorted by occurrences. Responses are capped at ~500KB.")}).describe("Parameters for retrieving the tag list.");function dti(){return typeof app>"u"||!app?.metadataCache?null:app.metadataCache}function S4r(t){let e={};if(!t)return e;for(let[r,n]of Object.entries(t)){let o=r?.trim();if(!o)continue;let i=o.replace(/^#+/,"").trim().toLowerCase();if(!i)continue;let a=`#${i}`;if(a==="#")continue;let s=Number.isFinite(n)?Math.max(0,Math.floor(n)):0;e[a]=(e[a]||0)+s}return e}function fti(t,e,r){let n=t,o=S4r(n.getFrontmatterTags?.()),i=e?S4r(n.getTags?.()):{},a=new Set([...Object.keys(o),...e?Object.keys(i):[]]),s=[],u=0;for(let c of a){let d=o[c]??0,f=e?Math.max(0,i[c]??0):0,p=0,m=d;e&&(f>=d?(p=f-d,m=f):f>0&&(p=f,m=d+p)),m!==0&&(u+=m,s.push({tag:c,occurrences:m,frontmatterOccurrences:d,inlineOccurrences:p}))}s.sort((c,d)=>d.occurrences===c.occurrences?c.tag.localeCompare(d.tag):d.occurrences-c.occurrences);let l=s.slice(0,r);return{totalUniqueTags:s.length,returnedTagCount:l.length,totalOccurrences:u,includedSources:e?["frontmatter","inline"]:["frontmatter"],truncated:l.length<s.length,tags:l}}function pti(t){let e=t,r=JSON.stringify(e);if(r.length<=Rmt)return e;let n=e.tags.length;for(;r.length>Rmt&&n>w4r;)n=Math.max(w4r,Math.floor(n/2)),e={...e,tags:t.tags.slice(0,n),returnedTagCount:n,truncated:!0},r=JSON.stringify(e);return r.length>Rmt?{totalUniqueTags:t.totalUniqueTags,returnedTagCount:0,totalOccurrences:t.totalOccurrences,includedSources:t.includedSources,truncated:!0,tags:[],note:"Tag list exceeded the size limit. Request a narrower scope or specify a smaller maxEntries value."}:e}function C4r(t){return`A JSON object lists the vault tags and their occurrence counts:
* totalUniqueTags: number of unique tags indexed across the vault
* returnedTagCount: number of tag entries included in this response
* totalOccurrences: total tag occurrences across included sources
* includedSources: sources represented in the counts (frontmatter, inline)
* truncated: whether the list was shortened due to limits
* tags: array of tag objects { tag, occurrences, frontmatterOccurrences, inlineOccurrences }
${JSON.stringify(t)}`}var x4r=()=>rs({name:"getTagList",description:"Get the list of tags in the vault with occurrence statistics.",schema:cti,func:async t=>{let e=dti(),r=t?.includeInline??!0,n=t?.maxEntries??lti;if(!e)return C4r({totalUniqueTags:0,returnedTagCount:0,totalOccurrences:0,includedSources:r?["frontmatter","inline"]:["frontmatter"],truncated:!1,tags:[],note:"Metadata cache is unavailable. Try again after the vault finishes indexing."});let o=fti(e,r,n),i=pti(o);return C4r(i)}});var P4r=$(T4r(),1),ple=$(FB(),1);var ns;(function(t){t[t.AM=0]="AM",t[t.PM=1]="PM"})(ns||(ns={}));var mm;(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"})(mm||(mm={}));var Jw;(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"})(Jw||(Jw={}));function O4r(t,e){e=e.add(1,"day"),UW(t,e),SX(t,e)}function rT(t,e){t.assign("day",e.date()),t.assign("month",e.month()+1),t.assign("year",e.year())}function MDe(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",ns.AM):t.assign("meridiem",ns.PM)}function UW(t,e){t.imply("day",e.date()),t.imply("month",e.month()+1),t.imply("year",e.year())}function SX(t,e){t.imply("hour",e.hour()),t.imply("minute",e.minute()),t.imply("second",e.second()),t.imply("millisecond",e.millisecond())}var jmt=$(FB(),1);var mti={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=>E4r(t,Jw.MARCH,mm.SUNDAY,2),dstEnd:t=>E4r(t,Jw.OCTOBER,mm.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=>kB(t,Jw.MARCH,mm.SUNDAY,2,2),dstEnd:t=>kB(t,Jw.NOVEMBER,mm.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=>kB(t,Jw.MARCH,mm.SUNDAY,2,2),dstEnd:t=>kB(t,Jw.NOVEMBER,mm.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=>kB(t,Jw.MARCH,mm.SUNDAY,2,2),dstEnd:t=>kB(t,Jw.NOVEMBER,mm.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=>kB(t,Jw.MARCH,mm.SUNDAY,2,2),dstEnd:t=>kB(t,Jw.NOVEMBER,mm.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 kB(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 E4r(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 RDe(t,e,r={}){if(t==null)return null;if(typeof t=="number")return t;let n=r[t]??mti[t];return n==null?null:typeof n=="number"?n:e==null?null:(0,jmt.default)(e).isAfter(n.dstStart(e.getFullYear()))&&!(0,jmt.default)(e).isAfter(n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}ple.default.extend(P4r.default);var qB=class{constructor(e){e=e??new Date,e instanceof Date?this.instant=e:(this.instant=e.instant??new Date,this.timezoneOffset=RDe(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}},os=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,ple.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,ple.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,ple.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?(MDe(o,n),rT(o,n),e.timezoneOffset!==null&&o.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(SX(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}},x$=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 os(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 $mt(t,e,r="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${t}${n}(?:${r}${n}){0,10}`}function hti(t){let e;return t instanceof Array?e=[...t]:t instanceof Map?e=Array.from(t.keys()):e=Object.keys(t),e}function ty(t){return`(?:${hti(t).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var M4r=$(FB(),1);function IDe(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function BB(t,e,r){let n=(0,M4r.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 kmt={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},qmt={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},z0={...qmt,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},Lmt={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},Fmt={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},I4r={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"},mle={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",...I4r},A4r=`(?:${ty(Lmt)}|[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 gti(t){let e=t.toLowerCase();return Lmt[e]!==void 0?Lmt[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 CX=`(?:${ty(Fmt)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;function xX(t){let e=t.toLowerCase();return Fmt[e]!==void 0?Fmt[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}var UB="(?:[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 zB(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 IDe(e)}var N4r=`(${A4r})\\s{0,3}(${ty(mle)})`,R4r=new RegExp(N4r,"i"),yti=`(${A4r})\\s{0,3}(${ty(I4r)})`,D4r="\\s{0,5},?(?:\\s*and)?\\s{0,5}",T$=$mt("(?:(?:about|around)\\s{0,3})?",N4r,D4r),VB=$mt("(?:(?:about|around)\\s{0,3})?",yti,D4r);function V0(t){let e={},r=t,n=R4r.exec(r);for(;n;)bti(e,n),r=r.substring(n[0].length).trim(),n=R4r.exec(r);return Object.keys(e).length==0?null:e}function bti(t,e){if(e[0].match(/^[a-zA-Z]+$/))return;let r=gti(e[1]),n=mle[e[2].toLowerCase()];t[n]=r}var ru=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 _ti=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${T$})(?=\\W|$)`,"i"),vti=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${T$})(?=\\W|$)`,"i"),wti=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${VB})(?=\\W|$)`,"i"),hle=class extends ru{constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?wti:e.option.forwardDate?_ti:vti}innerExtract(e,r){if(r[0].match(/^for\s*the\s*\w+/))return null;let n=V0(r[1]);return n?os.createRelativeFromReference(e.reference,n):null}};var Sti=new RegExp(`(?:on\\s{0,3})?(${CX})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${CX}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${ty(z0)})(?:(?:-|/|,?\\s{0,3})(${UB}(?!\\w)))?(?=\\W|$)`,"i"),j4r=1,$4r=2,Cti=3,L4r=4,gle=class extends ru{innerPattern(){return Sti}innerExtract(e,r){let n=e.createParsingResult(r.index,r[0]),o=z0[r[Cti].toLowerCase()],i=xX(r[j4r]);if(i>31)return r.index=r.index+r[j4r].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[L4r]){let a=zB(r[L4r]);n.start.assign("year",a)}else{let a=BB(e.refDate,i,o);n.start.imply("year",a)}if(r[$4r]){let a=xX(r[$4r]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};var xti=new RegExp(`(${ty(z0)})(?:-|/|\\s*,?\\s*)(${CX})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${CX})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${UB}))?(?=\\W|$)(?!\\:\\d)`,"i"),Tti=1,F4r=2,Bmt=3,Umt=4,yle=class extends ru{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return xti}innerExtract(e,r){let n=z0[r[Tti].toLowerCase()],o=xX(r[F4r]);if(o>31||this.shouldSkipYearLikeDate&&!r[Bmt]&&!r[Umt]&&r[F4r].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[Umt]){let u=zB(r[Umt]);i.assign("year",u)}else{let u=BB(e.refDate,o,n);i.imply("year",u)}if(!r[Bmt])return i;let a=xX(r[Bmt]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}};var Oti=new RegExp(`((?:in)\\s*)?(${ty(z0)})\\s*(?:[,-]?\\s*(${UB})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),Eti=1,Pti=2,k4r=3,ble=class extends ru{innerPattern(){return Oti}innerExtract(e,r){let n=r[Pti].toLowerCase();if(r[0].length<=3&&!qmt[n])return null;let o=e.createParsingResult(r.index+(r[Eti]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=z0[n];if(o.start.assign("month",i),r[k4r]){let a=zB(r[k4r]);o.start.assign("year",a)}else{let a=BB(e.refDate,1,i);o.start.imply("year",a)}return o}};var Mti=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${ty(z0)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),Rti=1,Iti=2,q4r=3,Ati=4,_le=class extends ru{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return Mti}innerExtract(e,r){let n=parseInt(r[Rti]),o=parseInt(r[Ati]),i=r[q4r]?parseInt(r[q4r]):z0[r[Iti].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 Nti=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),Dti=1,jti=2,vle=class extends ru{innerPattern(){return Nti}innerExtract(e,r){let n=parseInt(r[jti]),o=parseInt(r[Dti]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}};function $ti(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 Lti(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 B4r=2,TX=3,ADe=4,NDe=5,wle=6,DDe=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[B4r]);if(s>100){if(this.strictMode||r[TX]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[TX]!=null){if(r[TX].length==1&&!r[wle])return null;i=parseInt(r[TX])}if(i>=60)return null;if(s>12&&(a=ns.PM),r[wle]!=null){if(s>12)return null;let u=r[wle][0].toLowerCase();u=="a"&&(a=ns.AM,s==12&&(s=0)),u=="p"&&(a=ns.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",ns.AM):o.imply("meridiem",ns.PM),r[NDe]!=null){let u=parseInt(r[NDe].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[ADe]!=null){let u=parseInt(r[ADe]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(e,r,n){let o=e.createParsingComponents();if(r[NDe]!=null){let u=parseInt(r[NDe].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[ADe]!=null){let u=parseInt(r[ADe]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[B4r]),a=0,s=-1;if(r[TX]!=null?a=parseInt(r[TX]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=ns.PM),r[wle]!=null){if(i>12)return null;let u=r[wle][0].toLowerCase();u=="a"&&(s=ns.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=ns.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==ns.AM?(n.start.imply("meridiem",ns.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",ns.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",ns.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",ns.PM)):i>12?o.imply("meridiem",ns.PM):i<=12&&o.imply("meridiem",ns.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=$ti(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=Lti(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}};var Sle=class extends DDe{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",ns.PM)):o<6&&n.assign("meridiem",ns.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",ns.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",ns.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}};function HB(t){let e={};for(let r in t)e[r]=-t[r];return e}function U4r(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 Fti=new RegExp(`(${T$})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),kti=new RegExp(`(${VB})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),Cle=class extends ru{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?kti:Fti}innerExtract(e,r){let n=V0(r[1]);if(!n)return null;let o=HB(n);return os.createRelativeFromReference(e.reference,o)}};var qti=new RegExp(`(${T$})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),Bti=new RegExp(`(${VB})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),Uti=1,xle=class extends ru{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?Bti:qti}innerExtract(e,r){let n=V0(r[Uti]);return n?os.createRelativeFromReference(e.reference,n):null}};var jDe=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},H0=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 Tle=class extends H0{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 Ole=class extends Tle{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}};function zmt(t,e){let r=t.clone(),n=t.start,o=e.start;if(r.start=z4r(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=z4r(i,a);if(t.end==null&&s.date().getTime()<r.start.date().getTime()){let u=s.dayjs().add(1,"day");s.isCertain("day")?rT(s,u):UW(s,u)}r.end=s}return r}function z4r(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")==ns.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 Ele=class extends H0{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()?zmt(r,n):zmt(n,r);return o.index=r.index,o.text=r.text+e+n.text,o}};var OX=class extends Ele{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}};var zti=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),Ple=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=zti.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=RDe(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 Vti=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),Hti=1,Wti=2,Jti=3,Mle=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=Vti.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[Wti]),s=parseInt(i[Jti]||"0"),u=a*60+s;u>14*60||(i[Hti]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}};var WB=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 V4r=$(FB(),1);var Rle=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,V4r.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),UW(n.start,o),n.end&&n.end.isOnlyTime()&&(UW(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),UW(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 Ile=class extends jDe{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 Kti=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"),Gti=1,Xti=2,Zti=3,H4r=4,Yti=5,W4r=6,J4r=7,Qti=8,K4r=9,G4r=10,Ale=class extends ru{innerPattern(){return Kti}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[Gti]),month:parseInt(r[Xti]),day:parseInt(r[Zti])});if(r[H4r]!=null&&(n.assign("hour",parseInt(r[H4r])),n.assign("minute",parseInt(r[Yti])),r[W4r]!=null&&n.assign("second",parseInt(r[W4r])),r[J4r]!=null&&n.assign("millisecond",parseInt(r[J4r])),r[Qti]!=null)){let o=0;if(r[K4r]){let i=parseInt(r[K4r]),a=0;r[G4r]!=null&&(a=parseInt(r[G4r])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}};var Nle=class extends H0{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 X4r(t,e=!1){return t.parsers.unshift(new Ale),t.refiners.unshift(new Nle),t.refiners.unshift(new Mle),t.refiners.unshift(new WB),t.refiners.push(new Ple),t.refiners.push(new WB),t.refiners.push(new Rle),t.refiners.push(new Ile(e)),t}var l2r=$(FB(),1);var EX=$(FB(),1);function Z4r(t){let e=(0,EX.default)(t.instant),r=new os(t,{});return rT(r,e),MDe(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function Y4r(t){let e=(0,EX.default)(t.instant),r=new os(t,{});return rT(r,e),SX(r,e),r.addTag("casualReference/today"),r}function Q4r(t){return eri(t,1).addTag("casualReference/yesterday")}function eri(t,e){return t2r(t,-e)}function e2r(t){return t2r(t,1).addTag("casualReference/tomorrow")}function t2r(t,e){let r=(0,EX.default)(t.instant),n=new os(t,{});return r=r.add(e,"day"),rT(n,r),SX(n,r),n}function r2r(t,e=22){let r=(0,EX.default)(t.instant),n=new os(t,{});return rT(n,r),n.imply("hour",e),n.imply("meridiem",ns.PM),n.addTag("casualReference/tonight"),n}function n2r(t,e=20){let r=new os(t,{});return r.imply("meridiem",ns.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function o2r(t){let e=new os(t,{}),r=(0,EX.default)(t.instant);return r.hour()>2&&O4r(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function i2r(t,e=6){let r=new os(t,{});return r.imply("meridiem",ns.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function a2r(t,e=15){let r=new os(t,{});return r.imply("meridiem",ns.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function s2r(t){let e=new os(t,{});return e.imply("meridiem",ns.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var tri=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,Dle=class extends ru{innerPattern(e){return tri}innerExtract(e,r){let n=(0,l2r.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=Z4r(e.reference);break;case"today":i=Y4r(e.reference);break;case"yesterday":i=Q4r(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=e2r(e.reference);break;case"tonight":i=r2r(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),rT(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}};var rri=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,jle=class extends ru{innerPattern(){return rri}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=a2r(e.reference);break;case"evening":case"night":n=n2r(e.reference);break;case"midnight":n=o2r(e.reference);break;case"morning":n=i2r(e.reference);break;case"noon":case"midday":n=s2r(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}};function c2r(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=nri(n,e,r),i=new os(t);return i=U4r(i,{day:o}),i.assign("weekday",e),i}function nri(t,e,r){let n=t.getDay();switch(r){case"this":return $De(t,e);case"last":return d2r(t,e);case"next":return n==mm.SUNDAY?e==mm.SUNDAY?7:e:n==mm.SATURDAY?e==mm.SATURDAY?7:e==mm.SUNDAY?8:1+e:e<n&&e!=mm.SUNDAY?$De(t,e):$De(t,e)+7}return ori(t,e)}function ori(t,e){let r=d2r(t,e),n=$De(t,e);return n<-r?n:r}function $De(t,e){let r=t.getDay(),n=e-r;return n<0&&(n+=7),n}function d2r(t,e){let r=t.getDay(),n=e-r;return n>=0&&(n-=7),n}var iri=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${ty(kmt)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),ari=1,sri=2,uri=3,$le=class extends ru{innerPattern(){return iri}innerExtract(e,r){let n=r[sri].toLowerCase(),o=kmt[n],i=r[ari],a=r[uri],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"),c2r(e.reference,o,u)}};var f2r=$(FB(),1);var lri=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${ty(mle)})(?=\\s*)(?=\\W|$)`,"i"),cri=1,dri=2,Lle=class extends ru{innerPattern(){return lri}innerExtract(e,r){let n=r[cri].toLowerCase(),o=r[dri].toLowerCase(),i=mle[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,os.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,os.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,f2r.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 fri=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"),pri=1,mri=5,p2r=2,m2r=3,Vmt=4,Fle=class{constructor(e){this.groupNumberMonth=e?m2r:p2r,this.groupNumberDay=e?p2r:m2r}pattern(){return fri}extract(e,r){let n=r.index+r[pri].length,o=r.index+r[0].length-r[mri].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[Vmt]&&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[Vmt]){let l=parseInt(r[Vmt]),c=IDe(l);a.start.assign("year",c)}else{let l=BB(e.refDate,u,s);a.start.imply("year",l)}return a}};var hri=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${T$})(?=\\W|$)`,"i"),gri=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${VB})(?=\\W|$)`,"i"),kle=class extends ru{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?hri:gri}innerExtract(e,r){let n=r[1].toLowerCase(),o=V0(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=HB(o);break}return os.createRelativeFromReference(e.reference,o)}};function yri(t){return t.text.match(/^[+-]/i)!=null}function h2r(t){return t.text.match(/^-/i)!=null}var qle=class extends H0{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?yri(n)||h2r(n):!1}mergeResults(e,r,n,o){let i=V0(n.text);h2r(n)&&(i=HB(i));let a=os.createRelativeFromReference(new qB(r.start.date()),i);return new x$(r.reference,r.index,`${r.text}${e}${n.text}`,a)}};function g2r(t){return t.text.match(/\s+(before|from)$/i)!=null}function bri(t){return t.text.match(/\s+(after|since)$/i)!=null}var Ble=class extends H0{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!g2r(r)&&!bri(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=V0(r.text);g2r(r)&&(o=HB(o));let i=os.createRelativeFromReference(new qB(n.start.date()),o);return new x$(n.reference,r.index,`${r.text}${e}${n.text}`,i)}};var _ri=new RegExp(`^\\s*(${UB})`,"i"),vri=1,Ule=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=_ri.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=zB(i[vri]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}};var zW=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new Dle),r.parsers.push(new jle),r.parsers.push(new ble),r.parsers.push(new Lle),r.parsers.push(new kle),r}createConfiguration(e=!0,r=!1){let n=X4r({parsers:[new Fle(r),new hle(e),new gle,new yle(r),new $le,new vle,new Sle(e),new Cle(e),new xle(e)],refiners:[new OX]},e);return n.parsers.unshift(new _le(e)),n.refiners.unshift(new Ble),n.refiners.unshift(new qle),n.refiners.unshift(new WB),n.refiners.push(new OX),n.refiners.push(new Ule),n.refiners.push(new Ole),n}};var PX=class t{constructor(e){this.defaultConfig=new zW,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 Hmt(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 x$?c=l:l instanceof os?(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}},Hmt=class{constructor(e,r,n){this.text=e,this.reference=new qB(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof os?e:new os(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 x$(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 Wmt=new zW,y2r=new PX(Wmt.createCasualConfiguration(!1)),wri=new PX(Wmt.createConfiguration(!0,!1)),Nbs=new PX(Wmt.createCasualConfiguration(!0));var b2r=y2r;function Jmt(t,e,r){return b2r.parse(t,e,r)}function _2r(t,e,r){return b2r.parseDate(t,e,r)}var O$=class extends Error{},LDe=class extends O${constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},FDe=class extends O${constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},kDe=class extends O${constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},nT=class extends O${},MX=class extends O${constructor(e){super(`Invalid unit ${e}`)}},Jc=class extends O${},oT=class extends O${constructor(){super("Zone is an abstract class")}};var Qt="numeric",iT="short",Kw="long",JB={year:Qt,month:Qt,day:Qt},zle={year:Qt,month:iT,day:Qt},Kmt={year:Qt,month:iT,day:Qt,weekday:iT},Vle={year:Qt,month:Kw,day:Qt},Hle={year:Qt,month:Kw,day:Qt,weekday:Kw},Wle={hour:Qt,minute:Qt},Jle={hour:Qt,minute:Qt,second:Qt},Kle={hour:Qt,minute:Qt,second:Qt,timeZoneName:iT},Gle={hour:Qt,minute:Qt,second:Qt,timeZoneName:Kw},Xle={hour:Qt,minute:Qt,hourCycle:"h23"},Zle={hour:Qt,minute:Qt,second:Qt,hourCycle:"h23"},Yle={hour:Qt,minute:Qt,second:Qt,hourCycle:"h23",timeZoneName:iT},Qle={hour:Qt,minute:Qt,second:Qt,hourCycle:"h23",timeZoneName:Kw},ece={year:Qt,month:Qt,day:Qt,hour:Qt,minute:Qt},tce={year:Qt,month:Qt,day:Qt,hour:Qt,minute:Qt,second:Qt},rce={year:Qt,month:iT,day:Qt,hour:Qt,minute:Qt},nce={year:Qt,month:iT,day:Qt,hour:Qt,minute:Qt,second:Qt},Gmt={year:Qt,month:iT,day:Qt,weekday:iT,hour:Qt,minute:Qt},oce={year:Qt,month:Kw,day:Qt,hour:Qt,minute:Qt,timeZoneName:iT},ice={year:Qt,month:Kw,day:Qt,hour:Qt,minute:Qt,second:Qt,timeZoneName:iT},ace={year:Qt,month:Kw,day:Qt,weekday:Kw,hour:Qt,minute:Qt,timeZoneName:Kw},sce={year:Qt,month:Kw,day:Qt,weekday:Kw,hour:Qt,minute:Qt,second:Qt,timeZoneName:Kw};var vv=class{get type(){throw new oT}get name(){throw new oT}get ianaName(){return this.name}get isUniversal(){throw new oT}offsetName(e,r){throw new oT}formatOffset(e,r){throw new oT}offset(e){throw new oT}equals(e){throw new oT}get isValid(){throw new oT}};var Xmt=null,KB=class t extends vv{static get instance(){return Xmt===null&&(Xmt=new t),Xmt}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return BDe(e,r,n)}formatOffset(e,r){return GB(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var zDe={};function xri(t){return zDe[t]||(zDe[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"})),zDe[t]}var Tri={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Ori(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 Eri(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o<r.length;o++){let{type:i,value:a}=r[o],s=Tri[i];i==="era"?n[s]=a:_n(s)||(n[s]=parseInt(a,10))}return n}var UDe={},rb=class t extends vv{static create(e){return UDe[e]||(UDe[e]=new t(e)),UDe[e]}static resetCache(){UDe={},zDe={}}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 BDe(e,r,n,this.name)}formatOffset(e,r){return GB(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=xri(this.name),[o,i,a,s,u,l,c]=n.formatToParts?Eri(n,r):Ori(n,r);s==="BC"&&(o=-Math.abs(o)+1);let f=RX({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 v2r={};function Pri(t,e={}){let r=JSON.stringify([t,e]),n=v2r[r];return n||(n=new Intl.ListFormat(t,e),v2r[r]=n),n}var Zmt={};function Ymt(t,e={}){let r=JSON.stringify([t,e]),n=Zmt[r];return n||(n=new Intl.DateTimeFormat(t,e),Zmt[r]=n),n}var Qmt={};function Mri(t,e={}){let r=JSON.stringify([t,e]),n=Qmt[r];return n||(n=new Intl.NumberFormat(t,e),Qmt[r]=n),n}var eht={};function Rri(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=eht[o];return i||(i=new Intl.RelativeTimeFormat(t,e),eht[o]=i),i}var uce=null;function Iri(){return uce||(uce=new Intl.DateTimeFormat().resolvedOptions().locale,uce)}var w2r={};function Ari(t){let e=w2r[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,w2r[t]=e}return e}function Nri(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=Ymt(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=Ymt(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function Dri(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function jri(t){let e=[];for(let r=1;r<=12;r++){let n=$n.utc(2009,r,1);e.push(t(n))}return e}function $ri(t){let e=[];for(let r=1;r<=7;r++){let n=$n.utc(2016,11,13+r);e.push(t(n))}return e}function VDe(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function Lri(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 tht=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=Mri(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):IX(e,3);return Ec(r,this.padTo)}}},rht=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&&rb.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=Ymt(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()}},nht=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&HDe()&&(this.rtf=Rri(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):S2r(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},Fri={firstDay:1,minimalDays:4,weekend:[6,7]},Fs=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||Ls.defaultLocale,s=a||(i?"en-US":Iri()),u=r||Ls.defaultNumberingSystem,l=n||Ls.defaultOutputCalendar,c=lce(o)||Ls.defaultWeekSettings;return new t(s,u,l,c,a)}static resetCache(){uce=null,Zmt={},Qmt={},eht={}}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]=Nri(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=Dri(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=Lri(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,lce(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 VDe(this,e,oht,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=jri(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return VDe(this,e,iht,()=>{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]=$ri(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return VDe(this,void 0,()=>aht,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[$n.utc(2016,11,13,9),$n.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return VDe(this,e,sht,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[$n.utc(-40,1,1),$n.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 tht(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new rht(e,this.intl,r)}relFormatter(e={}){return new nht(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Pri(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:WDe()?Ari(this.locale):Fri}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 lht=null,Xh=class t extends vv{static get utcInstance(){return lht===null&&(lht=new t(0)),lht}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(VW(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${GB(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${GB(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return GB(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 AX=class extends vv{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 aT(t,e){let r;if(_n(t)||t===null)return e;if(t instanceof vv)return t;if(C2r(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?KB.instance:n==="utc"||n==="gmt"?Xh.utcInstance:Xh.parseSpecifier(n)||rb.create(t)}else return sT(t)?Xh.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new AX(t)}var cht={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"},x2r={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]},kri=cht.hanidec.replace(/[\[|\]]/g,"").split("");function T2r(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(cht.hanidec)!==-1)e+=kri.indexOf(t[r]);else for(let o in x2r){let[i,a]=x2r[o];n>=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}var NX={};function O2r(){NX={}}function W0({numberingSystem:t},e=""){let r=t||"latn";return NX[r]||(NX[r]={}),NX[r][e]||(NX[r][e]=new RegExp(`${cht[r]}${e}`)),NX[r][e]}var E2r=()=>Date.now(),P2r="system",M2r=null,R2r=null,I2r=null,A2r=60,N2r,D2r=null,Ls=class{static get now(){return E2r}static set now(e){E2r=e}static set defaultZone(e){P2r=e}static get defaultZone(){return aT(P2r,KB.instance)}static get defaultLocale(){return M2r}static set defaultLocale(e){M2r=e}static get defaultNumberingSystem(){return R2r}static set defaultNumberingSystem(e){R2r=e}static get defaultOutputCalendar(){return I2r}static set defaultOutputCalendar(e){I2r=e}static get defaultWeekSettings(){return D2r}static set defaultWeekSettings(e){D2r=lce(e)}static get twoDigitCutoffYear(){return A2r}static set twoDigitCutoffYear(e){A2r=e%100}static get throwOnInvalid(){return N2r}static set throwOnInvalid(e){N2r=e}static resetCaches(){Fs.resetCache(),rb.resetCache(),$n.resetCache(),O2r()}};var Zh=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var j2r=[0,31,59,90,120,151,181,212,243,273,304,334],$2r=[0,31,60,91,121,152,182,213,244,274,305,335];function J0(t,e){return new Zh("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function JDe(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 L2r(t,e,r){return r+(WW(t)?$2r:j2r)[e-1]}function F2r(t,e){let r=WW(t)?$2r:j2r,n=r.findIndex(i=>i<e),o=e-r[n];return{month:n+1,day:o}}function KDe(t,e){return(t-e+7)%7+1}function cce(t,e=4,r=1){let{year:n,month:o,day:i}=t,a=L2r(n,o,i),s=KDe(JDe(n,o,i),r),u=Math.floor((a-s+14-e)/7),l;return u<1?(l=n-1,u=HW(l,e,r)):u>HW(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...fce(t)}}function dht(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=KDe(JDe(n,1,e),r),s=XB(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=XB(l)):u>s?(l=n+1,u-=XB(n)):l=n;let{month:c,day:d}=F2r(l,u);return{year:l,month:c,day:d,...fce(t)}}function GDe(t){let{year:e,month:r,day:n}=t,o=L2r(e,r,n);return{year:e,ordinal:o,...fce(t)}}function fht(t){let{year:e,ordinal:r}=t,{month:n,day:o}=F2r(e,r);return{year:e,month:n,day:o,...fce(t)}}function pht(t,e){if(!_n(t.localWeekday)||!_n(t.localWeekNumber)||!_n(t.localWeekYear)){if(!_n(t.weekday)||!_n(t.weekNumber)||!_n(t.weekYear))throw new nT("Cannot mix locale-based week fields with ISO-based week fields");return _n(t.localWeekday)||(t.weekday=t.localWeekday),_n(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),_n(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 k2r(t,e=4,r=1){let n=dce(t.weekYear),o=Gw(t.weekNumber,1,HW(t.weekYear,e,r)),i=Gw(t.weekday,1,7);return n?o?i?!1:J0("weekday",t.weekday):J0("week",t.weekNumber):J0("weekYear",t.weekYear)}function q2r(t){let e=dce(t.year),r=Gw(t.ordinal,1,XB(t.year));return e?r?!1:J0("ordinal",t.ordinal):J0("year",t.year)}function mht(t){let e=dce(t.year),r=Gw(t.month,1,12),n=Gw(t.day,1,DX(t.year,t.month));return e?r?n?!1:J0("day",t.day):J0("month",t.month):J0("year",t.year)}function hht(t){let{hour:e,minute:r,second:n,millisecond:o}=t,i=Gw(e,0,23)||e===24&&r===0&&n===0&&o===0,a=Gw(r,0,59),s=Gw(n,0,59),u=Gw(o,0,999);return i?a?s?u?!1:J0("millisecond",o):J0("second",n):J0("minute",r):J0("hour",e)}function _n(t){return typeof t>"u"}function sT(t){return typeof t=="number"}function dce(t){return typeof t=="number"&&t%1===0}function C2r(t){return typeof t=="string"}function U2r(t){return Object.prototype.toString.call(t)==="[object Date]"}function HDe(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function WDe(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function z2r(t){return Array.isArray(t)?t:[t]}function ght(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 V2r(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function ZB(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function lce(t){if(t==null)return null;if(typeof t!="object")throw new Jc("Week settings must be an object");if(!Gw(t.firstDay,1,7)||!Gw(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Gw(e,1,7)))throw new Jc("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Gw(t,e,r){return dce(t)&&t>=e&&t<=r}function qri(t,e){return t-e*Math.floor(t/e)}function Ec(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function E$(t){if(!(_n(t)||t===null||t===""))return parseInt(t,10)}function YB(t){if(!(_n(t)||t===null||t===""))return parseFloat(t)}function pce(t){if(!(_n(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function IX(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function WW(t){return t%4===0&&(t%100!==0||t%400===0)}function XB(t){return WW(t)?366:365}function DX(t,e){let r=qri(e-1,12)+1,n=t+(e-r)/12;return r===2?WW(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function RX(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 B2r(t,e,r){return-KDe(JDe(t,1,e),r)+e-1}function HW(t,e=4,r=1){let n=B2r(t,e,r),o=B2r(t+1,e,r);return(XB(t)-n+o)/7}function mce(t){return t>99?t:t>Ls.twoDigitCutoffYear?1900+t:2e3+t}function BDe(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 VW(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 yht(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Jc(`Invalid unit value ${t}`);return e}function jX(t,e){let r={};for(let n in t)if(ZB(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=yht(o)}return r}function GB(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}${Ec(r,2)}:${Ec(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${Ec(r,2)}${Ec(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function fce(t){return V2r(t,["hour","minute","second","millisecond"])}var Bri=["January","February","March","April","May","June","July","August","September","October","November","December"],bht=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Uri=["J","F","M","A","M","J","J","A","S","O","N","D"];function oht(t){switch(t){case"narrow":return[...Uri];case"short":return[...bht];case"long":return[...Bri];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 _ht=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],vht=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],zri=["M","T","W","T","F","S","S"];function iht(t){switch(t){case"narrow":return[...zri];case"short":return[...vht];case"long":return[..._ht];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var aht=["AM","PM"],Vri=["Before Christ","Anno Domini"],Hri=["BC","AD"],Wri=["B","A"];function sht(t){switch(t){case"narrow":return[...Wri];case"short":return[...Hri];case"long":return[...Vri];default:return null}}function H2r(t){return aht[t.hour<12?0:1]}function W2r(t,e){return iht(e)[t.weekday-1]}function J2r(t,e){return oht(e)[t.month-1]}function K2r(t,e){return sht(e)[t.year<0?0:1]}function S2r(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 G2r(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var Jri={D:JB,DD:zle,DDD:Vle,DDDD:Hle,t:Wle,tt:Jle,ttt:Kle,tttt:Gle,T:Xle,TT:Zle,TTT:Yle,TTTT:Qle,f:ece,ff:rce,fff:oce,ffff:ace,F:tce,FF:nce,FFF:ice,FFFF:sce},Yh=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 Jri[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 Ec(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?H2r(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,m)=>n?J2r(e,p):i(m?{month:p}:{month:p,day:"numeric"},"month"),l=(p,m)=>n?W2r(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?K2r(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 G2r(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 G2r(i,o(s))}};var Z2r=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function LX(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function FX(...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 kX(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 Y2r(...t){return(e,r)=>{let n={},o;for(o=0;o<t.length;o++)n[t[o]]=E$(e[r+o]);return[n,null,r+o]}}var Q2r=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Kri=`(?:${Q2r.source}?(?:\\[(${Z2r.source})\\])?)?`,wht=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,eVr=RegExp(`${wht.source}${Kri}`),Sht=RegExp(`(?:T${eVr.source})?`),Gri=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Xri=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Zri=/(\d{4})-?(\d{3})/,Yri=Y2r("weekYear","weekNumber","weekDay"),Qri=Y2r("year","ordinal"),eni=/(\d{4})-(\d\d)-(\d\d)/,tVr=RegExp(`${wht.source} ?(?:${Q2r.source}|(${Z2r.source}))?`),tni=RegExp(`(?: ${tVr.source})?`);function $X(t,e,r){let n=t[e];return _n(n)?r:E$(n)}function rni(t,e){return[{year:$X(t,e),month:$X(t,e+1,1),day:$X(t,e+2,1)},null,e+3]}function qX(t,e){return[{hours:$X(t,e,0),minutes:$X(t,e+1,0),seconds:$X(t,e+2,0),milliseconds:pce(t[e+3])},null,e+4]}function hce(t,e){let r=!t[e]&&!t[e+1],n=VW(t[e+1],t[e+2]),o=r?null:Xh.instance(n);return[{},o,e+3]}function gce(t,e){let r=t[e]?rb.create(t[e]):null;return[{},r,e+1]}var nni=RegExp(`^T?${wht.source}$`),oni=/^-?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 ini(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(YB(r)),months:f(YB(n)),weeks:f(YB(o)),days:f(YB(i)),hours:f(YB(a)),minutes:f(YB(s)),seconds:f(YB(u),u==="-0"),milliseconds:f(pce(l),d)}]}var ani={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 Cht(t,e,r,n,o,i,a){let s={year:e.length===2?mce(E$(e)):E$(e),month:bht.indexOf(r)+1,day:E$(n),hour:E$(o),minute:E$(i)};return a&&(s.second=E$(a)),t&&(s.weekday=t.length>3?_ht.indexOf(t)+1:vht.indexOf(t)+1),s}var sni=/^(?:(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 uni(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=Cht(e,o,n,r,i,a,s),p;return u?p=ani[u]:l?p=0:p=VW(c,d),[f,new Xh(p)]}function lni(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var cni=/^(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$/,dni=/^(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$/,fni=/^(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 X2r(t){let[,e,r,n,o,i,a,s]=t;return[Cht(e,o,n,r,i,a,s),Xh.utcInstance]}function pni(t){let[,e,r,n,o,i,a,s]=t;return[Cht(e,s,r,n,o,i,a),Xh.utcInstance]}var mni=LX(Gri,Sht),hni=LX(Xri,Sht),gni=LX(Zri,Sht),yni=LX(eVr),rVr=FX(rni,qX,hce,gce),bni=FX(Yri,qX,hce,gce),_ni=FX(Qri,qX,hce,gce),vni=FX(qX,hce,gce);function nVr(t){return kX(t,[mni,rVr],[hni,bni],[gni,_ni],[yni,vni])}function oVr(t){return kX(lni(t),[sni,uni])}function iVr(t){return kX(t,[cni,X2r],[dni,X2r],[fni,pni])}function aVr(t){return kX(t,[oni,ini])}var wni=FX(qX);function sVr(t){return kX(t,[nni,wni])}var Sni=LX(eni,tni),Cni=LX(tVr),xni=FX(qX,hce,gce);function uVr(t){return kX(t,[Sni,rVr],[Cni,xni])}var lVr="Invalid Duration",dVr={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}},Tni={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},...dVr},K0=146097/400,BX=146097/4800,Oni={years:{quarters:4,months:12,weeks:K0/7,days:K0,hours:K0*24,minutes:K0*24*60,seconds:K0*24*60*60,milliseconds:K0*24*60*60*1e3},quarters:{months:3,weeks:K0/28,days:K0/4,hours:K0*24/4,minutes:K0*24*60/4,seconds:K0*24*60*60/4,milliseconds:K0*24*60*60*1e3/4},months:{weeks:BX/7,days:BX,hours:BX*24,minutes:BX*24*60,seconds:BX*24*60*60,milliseconds:BX*24*60*60*1e3},...dVr},JW=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Eni=JW.slice(0).reverse();function QB(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 Pc(n)}function fVr(t,e){let r=e.milliseconds??0;for(let n of Eni.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function cVr(t,e){let r=fVr(t,e)<0?-1:1;JW.reduceRight((n,o)=>{if(_n(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),JW.reduce((n,o)=>{if(_n(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function Pni(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var Pc=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?Oni:Tni;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Fs.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 Jc(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:jX(e,t.normalizeUnit),loc:Fs.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(sT(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Jc(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=aVr(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]=sVr(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 Jc("need to specify a reason the Duration is invalid");let n=e instanceof Zh?e:new Zh(e,r);if(Ls.throwOnInvalid)throw new kDe(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 MX(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?Yh.create(this.loc,n).formatDurationFromString(this,e):lVr}toHuman(e={}){if(!this.isValid)return lVr;let r=JW.map(n=>{let o=this.values[n];return _n(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+=IX(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},$n.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?fVr(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 JW)(ZB(r.values,o)||ZB(this.values,o))&&(n[o]=r.get(o)+this.get(o));return QB(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]=yht(e(this.values[n],n));return QB(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...jX(e,t.normalizeUnit)};return QB(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 QB(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return cVr(this.matrix,e),QB(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Pni(this.normalize().shiftToAll().toObject());return QB(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 JW)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;sT(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else sT(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 cVr(this.matrix,r),QB(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 QB(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 JW)if(!r(this.values[n],e.values[n]))return!1;return!0}};var UX="Invalid Interval";function Mni(t,e){return!t||!t.isValid?P$.invalid("missing or invalid start"):!e||!e.isValid?P$.invalid("missing or invalid end"):e<t?P$.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 P$=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 Jc("need to specify a reason the Interval is invalid");let n=e instanceof Zh?e:new Zh(e,r);if(Ls.throwOnInvalid)throw new FDe(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=zX(e),o=zX(r),i=Mni(n,o);return i??new t({start:n,end:o})}static after(e,r){let n=Pc.fromDurationLike(r),o=zX(e);return t.fromDateTimes(o,o.plus(n))}static before(e,r){let n=Pc.fromDurationLike(r),o=zX(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=$n.fromISO(n,r),a=i.isValid}catch{a=!1}let s,u;try{s=$n.fromISO(o,r),u=s.isValid}catch{u=!1}if(a&&u)return t.fromDateTimes(i,s);if(a){let l=Pc.fromISO(o,r);if(l.isValid)return t.after(i,l)}else if(u){let l=Pc.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(zX).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=Pc.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()})`:UX}[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=JB,r={}){return this.isValid?Yh.create(this.s.loc.clone(r),e).formatInterval(this):UX}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:UX}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:UX}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:UX}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:UX}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):Pc.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var M$=class{static hasDST(e=Ls.defaultZone){let r=$n.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return rb.isValidZone(e)}static normalizeZone(e){return aT(e,Ls.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||Fs.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||Fs.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||Fs.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Fs.create(r,n,i)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Fs.create(r,n,i)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||Fs.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||Fs.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Fs.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return Fs.create(r,null,"gregory").eras(e)}static features(){return{relative:HDe(),localeWeek:WDe()}}};function pVr(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(Pc.fromMillis(n).as("days"))}function Rni(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=pVr(u,l);return(c-c%7)/7}],["days",pVr]],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 mVr(t,e,r,n){let[o,i,a,s]=Rni(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=Pc.fromObject(i,n);return l.length>0?Pc.fromMillis(u,n).shiftTo(...l).plus(c):c}var Ini="missing Intl.DateTimeFormat.formatToParts support";function Hs(t,e=r=>r){return{regex:t,deser:([r])=>e(T2r(r))}}var Ani="\xA0",yVr=`[ ${Ani}]`,bVr=new RegExp(yVr,"g");function Nni(t){return t.replace(/\./g,"\\.?").replace(bVr,yVr)}function hVr(t){return t.replace(/\./g,"").replace(bVr," ").toLowerCase()}function uT(t,e){return t===null?null:{regex:RegExp(t.map(Nni).join("|")),deser:([r])=>t.findIndex(n=>hVr(r)===hVr(n))+e}}function gVr(t,e){return{regex:t,deser:([,r,n])=>VW(r,n),groups:e}}function XDe(t){return{regex:t,deser:([e])=>e}}function Dni(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function jni(t,e){let r=W0(e),n=W0(e,"{2}"),o=W0(e,"{3}"),i=W0(e,"{4}"),a=W0(e,"{6}"),s=W0(e,"{1,2}"),u=W0(e,"{1,3}"),l=W0(e,"{1,6}"),c=W0(e,"{1,9}"),d=W0(e,"{2,4}"),f=W0(e,"{4,6}"),p=y=>({regex:RegExp(Dni(y.val)),deser:([g])=>g,literal:!0}),h=(y=>{if(t.literal)return p(y);switch(y.val){case"G":return uT(e.eras("short"),0);case"GG":return uT(e.eras("long"),0);case"y":return Hs(l);case"yy":return Hs(d,mce);case"yyyy":return Hs(i);case"yyyyy":return Hs(f);case"yyyyyy":return Hs(a);case"M":return Hs(s);case"MM":return Hs(n);case"MMM":return uT(e.months("short",!0),1);case"MMMM":return uT(e.months("long",!0),1);case"L":return Hs(s);case"LL":return Hs(n);case"LLL":return uT(e.months("short",!1),1);case"LLLL":return uT(e.months("long",!1),1);case"d":return Hs(s);case"dd":return Hs(n);case"o":return Hs(u);case"ooo":return Hs(o);case"HH":return Hs(n);case"H":return Hs(s);case"hh":return Hs(n);case"h":return Hs(s);case"mm":return Hs(n);case"m":return Hs(s);case"q":return Hs(s);case"qq":return Hs(n);case"s":return Hs(s);case"ss":return Hs(n);case"S":return Hs(u);case"SSS":return Hs(o);case"u":return XDe(c);case"uu":return XDe(s);case"uuu":return Hs(r);case"a":return uT(e.meridiems(),0);case"kkkk":return Hs(i);case"kk":return Hs(d,mce);case"W":return Hs(s);case"WW":return Hs(n);case"E":case"c":return Hs(r);case"EEE":return uT(e.weekdays("short",!1),1);case"EEEE":return uT(e.weekdays("long",!1),1);case"ccc":return uT(e.weekdays("short",!0),1);case"cccc":return uT(e.weekdays("long",!0),1);case"Z":case"ZZ":return gVr(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return gVr(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return XDe(/[a-z_+-/]{1,256}?/i);case" ":return XDe(/[^\S\n\r]/);default:return p(y)}})(t)||{invalidReason:Ini};return h.token=t,h}var $ni={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 Lni(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=$ni[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function Fni(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function kni(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(ZB(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 qni(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 _n(t.z)||(r=rb.create(t.z)),_n(t.Z)||(r||(r=new Xh(t.Z)),n=t.Z),_n(t.q)||(t.M=(t.q-1)*3+1),_n(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),_n(t.u)||(t.S=pce(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}var xht=null;function Bni(){return xht||(xht=$n.fromMillis(1555555555555)),xht}function Uni(t,e){if(t.literal)return t;let r=Yh.macroTokenToFormatOpts(t.val),n=Eht(r,e);return n==null||n.includes(void 0)?t:n}function Tht(t,e){return Array.prototype.concat(...t.map(r=>Uni(r,e)))}var yce=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=Tht(Yh.parseFormat(r),e),this.units=this.tokens.map(n=>jni(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=Fni(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=kni(e,this.regex,this.handlers),[o,i,a]=n?qni(n):[null,null,void 0];if(ZB(n,"a")&&ZB(n,"H"))throw new nT("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 Oht(t,e,r){return new yce(t,r).explainFromTokens(e)}function _Vr(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=Oht(t,e,r);return[n,o,i,a]}function Eht(t,e){if(!t)return null;let n=Yh.create(e,t).dtFormatter(Bni()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>Lni(a,t,i))}var Pht="Invalid DateTime",vVr=864e13;function bce(t){return new Zh("unsupported zone",`the zone "${t.name}" is not supported`)}function Mht(t){return t.weekData===null&&(t.weekData=cce(t.c)),t.weekData}function Rht(t){return t.localWeekData===null&&(t.localWeekData=cce(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function KW(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new $n({...r,...e,old:r})}function EVr(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 ZDe(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 QDe(t,e,r){return EVr(RX(t),e,r)}function wVr(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,DX(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=Pc.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=RX(i),[u,l]=EVr(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function VX(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=$n.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return $n.invalid(new Zh("unparsable",`the input "${o}" can't be parsed as ${n}`))}function YDe(t,e,r=!0){return t.isValid?Yh.create(Fs.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Iht(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=Ec(t.c.year,r?6:4),e?(n+="-",n+=Ec(t.c.month),n+="-",n+=Ec(t.c.day)):(n+=Ec(t.c.month),n+=Ec(t.c.day)),n}function SVr(t,e,r,n,o,i){let a=Ec(t.c.hour);return e?(a+=":",a+=Ec(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=Ec(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=Ec(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=Ec(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=Ec(Math.trunc(-t.o/60)),a+=":",a+=Ec(Math.trunc(-t.o%60))):(a+="+",a+=Ec(Math.trunc(t.o/60)),a+=":",a+=Ec(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}var PVr={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},zni={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Vni={ordinal:1,hour:0,minute:0,second:0,millisecond:0},MVr=["year","month","day","hour","minute","second","millisecond"],Hni=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Wni=["year","ordinal","hour","minute","second","millisecond"];function Jni(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 MX(t);return e}function CVr(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Jni(t)}}function Kni(t){return tje[t]||(eje===void 0&&(eje=Ls.now()),tje[t]=t.offset(eje)),tje[t]}function xVr(t,e){let r=aT(e.zone,Ls.defaultZone);if(!r.isValid)return $n.invalid(bce(r));let n=Fs.fromObject(e),o,i;if(_n(t.year))o=Ls.now();else{for(let u of MVr)_n(t[u])&&(t[u]=PVr[u]);let a=mht(t)||hht(t);if(a)return $n.invalid(a);let s=Kni(r);[o,i]=QDe(t,s,r)}return new $n({ts:o,zone:r,loc:n,o:i})}function TVr(t,e,r){let n=_n(r.round)?!0:r.round,o=(a,s)=>(a=IX(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 OVr(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 eje,tje={},$n=class t{constructor(e){let r=e.zone||Ls.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new Zh("invalid input"):null)||(r.isValid?null:bce(r));this.ts=_n(e.ts)?Ls.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=sT(e.o)&&!e.old?e.o:r.offset(this.ts);o=ZDe(this.ts,s),n=Number.isNaN(o.year)?new Zh("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=e.loc||Fs.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]=OVr(arguments),[n,o,i,a,s,u,l]=r;return xVr({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=OVr(arguments),[n,o,i,a,s,u,l]=r;return e.zone=Xh.utcInstance,xVr({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=U2r(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let o=aT(r.zone,Ls.defaultZone);return o.isValid?new t({ts:n,zone:o,loc:Fs.fromObject(r)}):t.invalid(bce(o))}static fromMillis(e,r={}){if(sT(e))return e<-vVr||e>vVr?t.invalid("Timestamp out of range"):new t({ts:e,zone:aT(r.zone,Ls.defaultZone),loc:Fs.fromObject(r)});throw new Jc(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(sT(e))return new t({ts:e*1e3,zone:aT(r.zone,Ls.defaultZone),loc:Fs.fromObject(r)});throw new Jc("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=aT(r.zone,Ls.defaultZone);if(!n.isValid)return t.invalid(bce(n));let o=Fs.fromObject(r),i=jX(e,CVr),{minDaysInFirstWeek:a,startOfWeek:s}=pht(i,o),u=Ls.now(),l=_n(r.specificOffset)?n.offset(u):r.specificOffset,c=!_n(i.ordinal),d=!_n(i.year),f=!_n(i.month)||!_n(i.day),p=d||f,m=i.weekYear||i.weekNumber;if((p||c)&&m)throw new nT("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new nT("Can't mix ordinal dates with month/day");let h=m||i.weekday&&!p,y,g,b=ZDe(u,l);h?(y=Hni,g=zni,b=cce(b,a,s)):c?(y=Wni,g=Vni,b=GDe(b)):(y=MVr,g=PVr);let _=!1;for(let I of y){let A=i[I];_n(A)?_?i[I]=g[I]:i[I]=b[I]:_=!0}let w=h?k2r(i,a,s):c?q2r(i):mht(i),T=w||hht(i);if(T)return t.invalid(T);let O=h?dht(i,a,s):c?fht(i):i,[E,P]=QDe(O,l,n),R=new t({ts:E,zone:n,o:P,loc:o});return i.weekday&&p&&e.weekday!==R.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${R.toISO()}`):R.isValid?R:t.invalid(R.invalid)}static fromISO(e,r={}){let[n,o]=nVr(e);return VX(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=oVr(e);return VX(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=iVr(e);return VX(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(_n(e)||_n(r))throw new Jc("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=Fs.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=_Vr(a,e,r);return c?t.invalid(c):VX(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]=uVr(e);return VX(n,o,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Jc("need to specify a reason the DateTime is invalid");let n=e instanceof Zh?e:new Zh(e,r);if(Ls.throwOnInvalid)throw new LDe(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=Eht(e,Fs.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(e,r={}){return Tht(Yh.parseFormat(e),Fs.fromObject(r)).map(o=>o.val).join("")}static resetCache(){eje=void 0,tje={}}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?Mht(this).weekYear:NaN}get weekNumber(){return this.isValid?Mht(this).weekNumber:NaN}get weekday(){return this.isValid?Mht(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Rht(this).weekday:NaN}get localWeekNumber(){return this.isValid?Rht(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Rht(this).weekYear:NaN}get ordinal(){return this.isValid?GDe(this.c).ordinal:NaN}get monthShort(){return this.isValid?M$.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?M$.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?M$.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?M$.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=RX(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=ZDe(u,a),d=ZDe(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[KW(this,{ts:u}),KW(this,{ts:l})]:[this]}get isInLeapYear(){return WW(this.year)}get daysInMonth(){return DX(this.year,this.month)}get daysInYear(){return this.isValid?XB(this.year):NaN}get weeksInWeekYear(){return this.isValid?HW(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?HW(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:o}=Yh.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(e=0,r={}){return this.setZone(Xh.instance(e),r)}toLocal(){return this.setZone(Ls.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=aT(e,Ls.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]=QDe(a,i,e)}return KW(this,{ts:o,zone:e})}else return t.invalid(bce(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return KW(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=jX(e,CVr),{minDaysInFirstWeek:n,startOfWeek:o}=pht(r,this.loc),i=!_n(r.weekYear)||!_n(r.weekNumber)||!_n(r.weekday),a=!_n(r.ordinal),s=!_n(r.year),u=!_n(r.month)||!_n(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new nT("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new nT("Can't mix ordinal dates with month/day");let d;i?d=dht({...cce(this.c,n,o),...r},n,o):_n(r.ordinal)?(d={...this.toObject(),...r},_n(r.day)&&(d.day=Math.min(DX(d.year,d.month),d.day))):d=fht({...GDe(this.c),...r});let[f,p]=QDe(d,this.o,this.zone);return KW(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=Pc.fromDurationLike(e);return KW(this,wVr(this,r))}minus(e){if(!this.isValid)return this;let r=Pc.fromDurationLike(e).negate();return KW(this,wVr(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=Pc.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?Yh.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):Pht}toLocaleString(e=JB,r={}){return this.isValid?Yh.create(this.loc.clone(r),e).formatDateTime(this):Pht}toLocaleParts(e={}){return this.isValid?Yh.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=Iht(this,a);return s+="T",s+=SVr(this,a,r,n,o,i),s}toISODate({format:e="extended"}={}){return this.isValid?Iht(this,e==="extended"):null}toISOWeekDate(){return YDe(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":"")+SVr(this,a==="extended",r,e,n,i):null}toRFC2822(){return YDe(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return YDe(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Iht(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")),YDe(this,o,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Pht}[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 Pc.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=z2r(r).map(Pc.normalizeUnit),a=e.valueOf()>this.valueOf(),s=a?this:e,u=a?e:this,l=mVr(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?P$.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),TVr(r,this.plus(n),{...e,numeric:"always",units:o,unit:i})}toRelativeCalendar(e={}){return this.isValid?TVr(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 Jc("min requires all arguments be DateTimes");return ght(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Jc("max requires all arguments be DateTimes");return ght(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=Fs.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return Oht(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=Fs.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new yce(i,e)}static fromFormatParser(e,r,n={}){if(_n(e)||_n(r))throw new Jc("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=Fs.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!a.equals(r.locale))throw new Jc(`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):VX(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return JB}static get DATE_MED(){return zle}static get DATE_MED_WITH_WEEKDAY(){return Kmt}static get DATE_FULL(){return Vle}static get DATE_HUGE(){return Hle}static get TIME_SIMPLE(){return Wle}static get TIME_WITH_SECONDS(){return Jle}static get TIME_WITH_SHORT_OFFSET(){return Kle}static get TIME_WITH_LONG_OFFSET(){return Gle}static get TIME_24_SIMPLE(){return Xle}static get TIME_24_WITH_SECONDS(){return Zle}static get TIME_24_WITH_SHORT_OFFSET(){return Yle}static get TIME_24_WITH_LONG_OFFSET(){return Qle}static get DATETIME_SHORT(){return ece}static get DATETIME_SHORT_WITH_SECONDS(){return tce}static get DATETIME_MED(){return rce}static get DATETIME_MED_WITH_SECONDS(){return nce}static get DATETIME_MED_WITH_WEEKDAY(){return Gmt}static get DATETIME_FULL(){return oce}static get DATETIME_FULL_WITH_SECONDS(){return ice}static get DATETIME_HUGE(){return ace}static get DATETIME_HUGE_WITH_SECONDS(){return sce}};function zX(t){if($n.isDateTime(t))return t;if(t&&t.valueOf&&sT(t.valueOf()))return $n.fromJSDate(t);if(t&&typeof t=="object")return $n.fromObject(t);throw new Jc(`Unknown datetime argument: ${t}, of type ${typeof t}`)}function Aht(t){let e=t.match(/^(?:UTC|GMT)?([-+]?\d{1,2})(?::(\d{2}))?$/i);if(!e)throw new Error(`Invalid timezone offset format: ${t}. Use formats like '+8', '-5', '+5:30', 'UTC+8', 'GMT-5'`);let r=parseInt(e[1]),n=parseInt(e[2]||"0");if(Math.abs(r)>14||n>=60)throw new Error(`Invalid timezone offset: ${t}. Hours must be between -14 and +14, minutes must be less than 60`);let o=r>=0?"+":"",i=n>0?`:${n.toString().padStart(2,"0")}`:"";return`UTC${o}${r}${i}`}async function Gni(t){let e=$n.now();if(t)try{let i=Aht(t),a=e.setZone(i);if(!a.isValid)throw new Error(`Failed to apply timezone offset: ${t}`);e=a}catch(i){throw new Error(`${i.message}`)}let r=e.toJSDate(),n=e.offset,o=e.offsetNameShort||"Unknown";return{epoch:Math.floor(r.getTime()),isoString:r.toISOString(),userLocaleString:e.toLocaleString($n.DATETIME_FULL),localDateString:e.toISODate()||"",timezoneOffset:n,timezone:o}}var RVr=rs({name:"getCurrentTime",description:"Get the current time in local timezone or at a specified UTC offset. Returns epoch time, ISO string, and formatted strings.",schema:Ae.object({timezoneOffset:Ae.string().optional().describe(`Optional UTC offset. IMPORTANT: Must be a numeric offset, NOT a timezone name.

EXAMPLES OF CORRECT USAGE:
- "what time is it" \u2192 No parameter (uses local time)
- "what time is it in Tokyo" \u2192 timezoneOffset: "+9"
- "what time is it in Beijing" \u2192 timezoneOffset: "+8"
- "what time is it in New York" \u2192 timezoneOffset: "-5" (or "-4" during DST)
- "what time is it in Mumbai" \u2192 timezoneOffset: "+5:30"

SUPPORTED FORMATS:
- Simple: "+8", "-5", "+5:30"
- With prefix: "UTC+8", "GMT-5", "UTC+5:30"

COMMON TIMEZONE OFFSETS:
- Tokyo: UTC+9
- Beijing/Singapore: UTC+8
- Mumbai: UTC+5:30
- Dubai: UTC+4
- London: UTC+0 (UTC+1 during BST)
- New York: UTC-5 (UTC-4 during DST)
- Los Angeles: UTC-8 (UTC-7 during DST)`)}),func:async({timezoneOffset:t})=>Gni(t)}),IVr={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,sept:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12};function Xni(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 Zni(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 Yni(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=Jmt(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=$n.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 Qni(t,e){let r=t.match(/^(jan|january|feb|february|mar|march|apr|april|may|jun|june|jul|july|aug|august|sep|sept|september|oct|october|nov|november|dec|december)$/i);if(!r)return;let n=IVr[r[1]],o=e.year;n>e.month&&o--;let i=$n.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 eoi(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=$n.fromObject({year:n,month:1,day:1}),i=$n.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 toi(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=$n.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 roi(t,e){let r=t.match(/^(jan|january|feb|february|mar|march|apr|april|may|jun|june|jul|july|aug|august|sep|sept|september|oct|october|nov|november|dec|december)\s+(\d{4})$/i);if(!r)return;let n=IVr[r[1].toLowerCase()],o=parseInt(r[2]),i=$n.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 noi(t){let e=$n.now(),r=t.toLowerCase().replace("@vault","").trim(),n=Xni(r,e)||Zni(r,e)||Yni(r,e)||Qni(r,e)||roi(r,e)||toi(r,e)||eoi(r,e);if(n)return{startTime:n.start.toMillis(),endTime:n.end.toMillis()};let o=Jmt(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=$n.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?$n.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:i.toMillis(),endTime:a.toMillis()}}console.warn(`Unable to parse time expression: ${t}`)}function ooi(t){let e=t.toJSDate(),r=t.offset,n=t.offsetNameShort||"Unknown";return{epoch:Math.floor(e.getTime()),isoString:e.toISOString(),userLocaleString:t.toLocaleString($n.DATETIME_FULL),localDateString:t.toISODate()||"",timezoneOffset:r,timezone:n}}var AVr=rs({name:"getTimeRangeMs",description:"Convert natural language time expressions to date ranges for use with localSearch",schema:Ae.object({timeExpression:Ae.string().describe(`Natural language time expression to convert to a date range.

COMMON EXPRESSIONS:
- Relative past: "yesterday", "last week", "last month", "last year"
- Relative ranges: "this week", "this month", "this year"
- Specific dates: "July 1", "July 1 2023", "2023-07-01"
- Date ranges: "from July 1 to July 15", "between May and June"
- Time periods: "last 7 days", "past 30 days", "previous 3 months"

IMPORTANT: This tool is typically used as the first step before localSearch when searching notes by time.

EXAMPLE WORKFLOW:
1. User: "what did I do last week"
2. First call getTimeRangeMs with timeExpression: "last week"
3. Then use the returned time range with localSearch`)}),func:async({timeExpression:t})=>{let e=noi(t);return e||{error:`Unable to parse time expression: ${t}`}}});function ioi(t){let e=t.toString().length===10?t*1e3:t,r=$n.fromMillis(e);return ooi(r)}var NVr=rs({name:"getTimeInfoByEpoch",description:"Convert a Unix timestamp (in seconds or milliseconds) to detailed time information",schema:Ae.object({epoch:Ae.number().describe("Unix timestamp in seconds or milliseconds")}),func:async({epoch:t})=>ioi(t)});async function aoi(t,e,r){let n=Aht(e),o=Aht(r);try{let i=$n.now().setZone(n),a=_2r(t,i.toJSDate());if(!a)throw new Error(`Could not parse time: ${t}`);let s=$n.fromJSDate(a,{zone:n}),u=s.setZone(o);if(!u.isValid)throw new Error("Invalid timezone conversion");let l=u.toJSDate(),c=u.offset;return{epoch:Math.floor(l.getTime()),isoString:l.toISOString(),userLocaleString:u.toLocaleString($n.DATETIME_FULL),localDateString:u.toISODate()||"",timezoneOffset:c,timezone:u.offsetNameShort||o,originalTime:s.toLocaleString($n.TIME_SIMPLE)+" "+s.offsetNameShort,convertedTime:u.toLocaleString($n.TIME_SIMPLE)+" "+u.offsetNameShort}}catch(i){throw new Error(`Failed to convert time: ${i.message}`)}}var DVr=rs({name:"convertTimeBetweenTimezones",description:"Convert a specific time from one timezone to another using UTC offsets",schema:Ae.object({time:Ae.string().describe(`Time to convert. Supports various formats:
- 12-hour: "6pm", "3:30 PM", "11:45 am"
- 24-hour: "18:00", "15:30", "23:45"
- Relative: "noon", "midnight"`),fromOffset:Ae.string().describe(`Source UTC offset. Must be numeric, not timezone name.
Examples: "-8" for PT, "+0" for London, "+8" for Beijing`),toOffset:Ae.string().describe(`Target UTC offset. Must be numeric, not timezone name.
Examples: "+9" for Tokyo, "-5" for NY, "+5:30" for Mumbai

EXAMPLE USAGE:
- "what time is 6pm PT in Tokyo" \u2192 time: "6pm", fromOffset: "-8", toOffset: "+9"
- "convert 3:30 PM EST to London time" \u2192 time: "3:30 PM", fromOffset: "-5", toOffset: "+0"
- "what is 9am Beijing time in New York" \u2192 time: "9am", fromOffset: "+8", toOffset: "-5"`)}),func:async({time:t,fromOffset:e,toOffset:r})=>aoi(t,e,r)});aA();id();Qe();Dt();var jVr=5e4,$Vr=rs({name:"youtubeTranscription",description:"Get transcripts of YouTube videos when the user provides YouTube URLs",schema:Ae.object({_userMessageContent:Ae.string().optional().describe("Internal: user message content injected by the system")}),func:async t=>{let{_userMessageContent:e}=t;if(typeof e!="string")return{success:!1,message:"Invalid input: User message must be a string"};if(e.length>jVr)return{success:!1,message:`Input too long: Maximum allowed length is ${jVr} characters`};let r=CNt(e);if(r.length===0)return{success:!1,message:"No YouTube URLs found in the user prompt. URLs must be in the user prompt instead of the context notes."};let n=await Promise.all(r.map(async i=>{try{let a=Wy()&&ee().supadataApiKey?await rEe(i):await Xl.getInstance().youtube4llm(i);return a.response.transcript?{url:i,success:!0,transcript:a.response.transcript,elapsed_time_ms:a.elapsed_time_ms}:{url:i,success:!1,message:"Transcript not available. Only English videos with auto transcript enabled are supported"}}catch(a){return console.error(`Error transcribing YouTube video ${i}:`,a),{url:i,success:!1,message:"An error occurred while transcribing the YouTube video"}}}));return{success:n.some(i=>i.success),results:n,total_urls:r.length}}});var soi=[{tool:EDe,metadata:{id:"localSearch",displayName:"Vault Search",description:"Search through your vault notes",category:"search",copilotCommands:["@vault"],customPromptInstructions:`For localSearch (searching notes based on their contents in the vault):
- You MUST always provide both "query" (string) and "salientTerms" (array of strings)
- salientTerms MUST be extracted from the user's original query - never invent new terms
- They are keywords used for BM25 full-text search to find notes containing those exact words
- Treat every token that begins with "#" as a high-priority salient term. Keep the leading "#" and the full tag hierarchy (e.g., "#project/phase1").
- Include tagged terms alongside other meaningful words; never strip hashes or rewrite tags into plain words.
- Extract meaningful content words from the query (nouns, verbs, names, etc.)
- Exclude common words like "what", "I", "do", "the", "a", etc.
- Exclude time expressions like "last month", "yesterday", "last week"
- Preserve the original language - do NOT translate terms to English

Evaluating search results and re-searching:
- Results include a relevance quality summary: high (score \u22650.7), medium (0.3-0.7), low (<0.3)
- If most results are low relevance or miss key concepts from the user's question:
  1. Try searching again with synonyms or related terms
  2. Use more specific phrasing if query was too broad
  3. Use more general phrasing if query was too narrow
- Example: "machine learning algorithms" returned low results \u2192 try "ML models", "neural networks", or "AI techniques"

Examples:
- Query "piano learning practice" \u2192 query: "piano learning practice", salientTerms: ["piano", "learning", "practice"]
- Query "#projectx status update" \u2192 query: "#projectx status update", salientTerms: ["#projectx", "status", "update"]
- Query "\u94A2\u7434\u5B66\u4E60" (Chinese) \u2192 query: "\u94A2\u7434\u5B66\u4E60", salientTerms: ["\u94A2\u7434", "\u5B66\u4E60"] (preserve original language)

For time-based searches (e.g., "what did I do last week"):
1. First call getTimeRangeMs with timeExpression: "last week"
2. Then use localSearch with the returned timeRange, query matching the user's question, and salientTerms: [] (empty for generic time queries)

For time-based searches with meaningful terms (e.g., "python debugging notes from yesterday"):
1. First call getTimeRangeMs with timeExpression: "yesterday"
2. Then use localSearch with the returned timeRange, query: "python debugging notes", salientTerms: ["python", "debugging", "notes"]

For broad searches:
- If the user wants a comprehensive list, use getFileTree to get all note titles as reference. This helps verify search completeness and identify notes the search may have missed.`}},{tool:PDe,metadata:{id:"webSearch",displayName:"Web Search",description:"Search the INTERNET (NOT vault notes) when user explicitly asks for web/online information",category:"search",copilotCommands:["@websearch","@web"],customPromptInstructions:`For webSearch:
- ONLY use when the user's query contains explicit web-search intent like:
  * "web search", "internet search", "online search"
  * "Google", "search online", "look up online", "search the web"
- Always provide an empty chatHistory array

Example: "search the web for python tutorials" \u2192 query: "python tutorials", chatHistory: []`}},{tool:RVr,metadata:{id:"getCurrentTime",displayName:"Get Current Time",description:"Get the current time in any timezone",category:"time",isAlwaysEnabled:!0,customPromptInstructions:`For time queries (IMPORTANT: Always use UTC offsets, not timezone names):

- If the user mentions a specific city, country, or timezone name (e.g., "Tokyo", "Japan", "JST"), you MUST convert it to the correct UTC offset and pass it via the timezoneOffset parameter (e.g., "+9").
- Only omit timezoneOffset when the user asks for the current local time without naming any location or timezone.
- If you cannot confidently determine the offset from the user request, ask the user to clarify before calling the tool.

Examples:
- "what time is it" (local time) \u2192 call with no parameters
- "what time is it in Tokyo" (UTC+9) \u2192 timezoneOffset: "+9"
- "what time is it in New York" (UTC-5 or UTC-4 depending on DST) \u2192 timezoneOffset: "-5"`}},{tool:NVr,metadata:{id:"getTimeInfoByEpoch",displayName:"Get Time Info",description:"Convert epoch timestamp to human-readable format",category:"time",isAlwaysEnabled:!0}},{tool:AVr,metadata:{id:"getTimeRangeMs",displayName:"Get Time Range",description:"Convert time expressions to date ranges",category:"time",isAlwaysEnabled:!0,customPromptInstructions:`For time-based queries:
- Use this tool to convert time expressions like "last week", "yesterday", "last month" to proper time ranges
- This is typically the first step before using localSearch with a time range

Example: For "last week" \u2192 timeExpression: "last week"`}},{tool:DVr,metadata:{id:"convertTimeBetweenTimezones",displayName:"Convert Timezones",description:"Convert time between different timezones",category:"time",isAlwaysEnabled:!0,customPromptInstructions:`For timezone conversions:

Example: "what time is 6pm PT in Tokyo" (PT is UTC-8 or UTC-7, Tokyo is UTC+9) \u2192 time: "6pm", fromOffset: "-8", toOffset: "+9"`}},{tool:p4r,metadata:{id:"readNote",displayName:"Read Note",description:"Read a specific note in sequential chunks using its own line-chunking logic.",category:"file",requiresVault:!0,isAlwaysEnabled:!0,customPromptInstructions:`For readNote:
- Decide based on the user's request: only call this tool when the question requires reading note content.
- If the user asks about a note title that is already mentioned in the current or previous turns of the conversation, or linked in <active_note> or <note_context> blocks, call readNote directly\u2014do not use localSearch to look it up. Even if the note title mention is partial but similar to what you have seen in the context, try to infer the correct note path from context. Skip the tool when a note is irrelevant to the user query.
- If the user asks about notes linked from that note, read the original note first, then follow the "linkedNotes" paths returned in the tool result to inspect those linked notes.
- Always start with chunk 0 (omit chunkIndex or set it to 0). Only request the next chunk if the previous chunk did not answer the question.
- Pass vault-relative paths without a leading slash. If a call fails, adjust the path (for example, add ".md" or use an alternative candidate) and retry only if necessary.
- Every tool result may include a "linkedNotes" array. If the user needs information from those linked notes, call readNote again with one of the provided candidate paths, starting again at chunk 0. Do not expand links you don't need.
- Stop calling readNote as soon as you have the required information.
- Always call getFileTree to get the exact note path if it is not provided in the context before calling readNote.

Examples:
- First chunk: notePath: "Projects/launch-plan.md" (chunkIndex omitted or 0)
- Next chunk: notePath: "Projects/launch-plan.md", chunkIndex: 1`}},{tool:SDe,metadata:{id:"writeFile",displayName:"Write to File",description:"Create or rewrite files in your vault",category:"file",requiresVault:!0,timeoutMs:0,copilotCommands:["@composer"],customPromptInstructions:`For writeFile:
- NEVER display the file content directly in your response
- Always pass the complete file content to the tool
- Include the full path to the file
- You MUST explicitly call writeFile for any intent of updating or creating files
- Do not call writeFile tool again if the result is not accepted
- Do not call writeFile tool if no change needs to be made
- Always create new notes in root folder or folders the user explicitly specifies
- When creating a new note in a folder, you MUST use getFileTree to get the exact folder path first
Examples:
- Basic: path: "path/to/note.md", content: "FULL CONTENT OF THE NOTE"
- Skip confirmation: path: "path/to/note.md", content: "FULL CONTENT", confirmation: false`}},{tool:a4r,metadata:{id:"editFile",displayName:"Edit File",description:"Make a targeted, single-match edit to an existing file",category:"file",requiresVault:!0,timeoutMs:0,customPromptInstructions:`For editFile:
- Use for targeted edits; use writeFile for major rewrites or new files
- oldText must uniquely identify the location \u2014 include surrounding context lines if needed
- The tool automatically handles minor whitespace/quote differences (fuzzy matching)
- Call once per edit; for multiple edits call the tool multiple times

Example: Add "Bob Johnson" to attendees in notes/meeting.md:
path: "notes/meeting.md"
oldText: "## Attendees\\n- John Smith\\n- Jane Doe"
newText: "## Attendees\\n- John Smith\\n- Jane Doe\\n- Bob Johnson"`}},{tool:$Vr,metadata:{id:"youtubeTranscription",displayName:"YouTube Transcription",description:"Get transcripts from YouTube videos",category:"media",isPlusOnly:!0,requiresUserMessageContent:!0,customPromptInstructions:`For youtubeTranscription:
- Use when user provides YouTube URLs
- No parameters needed - the tool will process URLs from the conversation`}}];function uoi(t){Uc.getInstance().register({tool:f4r(t.getRoot()),metadata:{id:"getFileTree",displayName:"File Tree",description:"Browse vault file structure",category:"file",isAlwaysEnabled:!0,requiresVault:!0,isBackground:!0,customPromptInstructions:`For getFileTree:
- Use to browse the vault's file structure including paths of notes and folders
- Always call this tool to explore the exact path of notes or folders when you are not given the exact path.
- DO NOT use this tool to look up note contents or metadata - use localSearch or readNote instead.
- No parameters needed

Example queries that should use getFileTree:
- "Create a new note in the projects folder" \u2192 call getFileTree to get the exact folder path
- "Create a new note using the quick note template" \u2192 call getFileTree to look up the template path
- "How many files are in the projects folder" \u2192 call getFileTree to list all files`}})}function loi(){Uc.getInstance().register({tool:x4r(),metadata:{id:"getTagList",displayName:"Tag List",description:"List vault tags with occurrence statistics",category:"file",isAlwaysEnabled:!0,requiresVault:!0,isBackground:!0,customPromptInstructions:`For getTagList:
- Use to inspect existing tags before suggesting new ones or reorganizing notes.
- Omit parameters to include both frontmatter and inline tags.
- Set includeInline to false when you only need frontmatter-defined tags.
- Use maxEntries to limit output for very large vaults.

Examples:
- Default (all tags): call with no parameters
- Frontmatter only: includeInline: false`}})}function coi(){Uc.getInstance().register({tool:CDe,metadata:{id:"updateMemory",displayName:"Update Memory",description:"Save information to user memory when the user explicitly asks to remember something or update the memory",category:"memory",copilotCommands:["@memory"],isAlwaysEnabled:!0,customPromptInstructions:`For updateMemory:
- Use this tool to update the memory when the user explicitly asks to update the memory
- DO NOT use for general information - only for personal facts, preferences, or specific things the user wants stored

Example: statement: "I'm studying Japanese and I'm preparing for JLPT N3"`}})}function doi(){let t=Uc.getInstance();t.register({tool:h4r,metadata:{id:"obsidianDailyNote",displayName:"Daily Note",description:"Create or read today's daily note, or get its path",category:"cli",requiresVault:!0,customPromptInstructions:`For obsidianDailyNote:
- Use for daily note operations: creating, reading content, or getting the file path.
- Use readNote for reading specific notes by path. Use obsidianDailyNote only for today's daily note.
- daily \u2014 create today's daily note. Applies the user's configured daily note template automatically. Use this when the user asks to create or set up today's daily note.
- daily:read \u2014 read today's daily note content.
- daily:path \u2014 get the vault-relative file path (useful for follow-up readNote calls).
- For past or future daily notes (e.g. "yesterday's daily note"): NEVER ask the user for the date \u2014 use the time tools. Workflow: (1) call getCurrentTime to resolve the date, (2) call daily:path to discover the date format and folder, (3) call obsidianTemplates with command=templates to list available template names, then call template:read with the name that matches (e.g. "Daily Note Template"), (4) use writeFile to create the note at the resolved path with the template content, replacing variables like {{date}} with the target date. If templates returns an error or no daily template is found, ask the user for their template path and use readNote to read it.
- To add content to a daily note, use writeFile or editFile.
- Use \\n for newlines and \\t for tabs in content strings.
- For arbitrary file writes beyond daily notes, use writeFile or editFile instead.
- If the user names a specific vault, pass it using the vault parameter.`}}),t.register({tool:m4r,metadata:{id:"obsidianRandomRead",displayName:"Random Note",description:"Read a random note using the official Obsidian CLI",category:"cli",requiresVault:!0,customPromptInstructions:`For obsidianRandomRead:
- Use when the user explicitly asks for a random note or random note content.
- If the user names a specific vault, pass it using the vault parameter.
- Do not use when the user asks for a specific note; use readNote/getFileTree for specific targets.`}}),t.register({tool:g4r,metadata:{id:"obsidianProperties",displayName:"Properties",description:"Read frontmatter properties from notes or list all property names in the vault",category:"cli",requiresVault:!0,customPromptInstructions:`For obsidianProperties:
- Use to inspect frontmatter properties across the vault or within a specific note.
- properties (no file/path): list all property names used vault-wide. Add counts=true for occurrence counts. Add sort=count to sort by frequency.
- properties with file= or path=: list that note's key-value property pairs.
- property:read: read a single property value from a specific note. Requires name parameter.
- file= resolves like a wikilink (name only, no path or extension). path= uses exact vault-relative path.
- Do not use for full note content \u2014 use readNote for that.
- To modify properties, use writeFile or editFile to update the frontmatter YAML.`}}),t.register({tool:y4r,metadata:{id:"obsidianTasks",displayName:"Tasks",description:"List tasks across the vault with filters for status, file, and daily note",category:"cli",requiresVault:!0,customPromptInstructions:`For obsidianTasks:
- ALWAYS use this tool when the user asks about tasks, todos, or checkboxes. Do NOT use localSearch for task queries.
- Use to list and filter tasks across the vault.
- todo=true: show only incomplete tasks. done=true: show only completed tasks.
- status="x": filter by specific status character (e.g., "/" for in-progress, "x" for done, " " for open).
- daily=true: show tasks from today's daily note only.
- verbose=true: group tasks by file with line numbers.
- total=true: return only the task count.
- file= resolves like a wikilink (name only). path= uses exact vault-relative path.
- For time-based task queries (e.g. "tasks from last month"): use verbose=true to get tasks grouped by file, then filter results by file dates or daily note filenames to match the time range.`}}),t.register({tool:b4r,metadata:{id:"obsidianLinks",displayName:"Links",description:"Query the vault link graph: backlinks, outgoing links, orphans, unresolved",category:"cli",requiresVault:!0,customPromptInstructions:`For obsidianLinks:
- Use to explore the vault's link graph.
- backlinks: list notes that link TO a given file. Use file= or path= to target a note. Add counts=true for link counts.
- links: list outgoing links FROM a given file. Use file= or path= to target a note.
- orphans: list all notes with no incoming links. Use total=true for just the count. Add all=true to include non-markdown files.
- unresolved: list wikilinks that don't resolve to any existing file. Use counts=true for occurrence counts, verbose=true to see source files.
- file= resolves like a wikilink (name only). path= uses exact vault-relative path. Without either, targets the active file.`}}),t.register({tool:_4r,metadata:{id:"obsidianTemplates",displayName:"Templates",description:"List available templates or read template content",category:"cli",requiresVault:!0,customPromptInstructions:`For obsidianTemplates:
- Use 'templates' to list all available templates when you need to find the right template for a task.
- Use 'template:read' with a template name to get its content with variables resolved. Requires name parameter.
- This is useful for creating daily notes from templates \u2014 read the template first, then use writeFile to populate the note.`}}),t.register({tool:v4r,metadata:{id:"obsidianBases",displayName:"Bases",description:"List Base files, views, query data, or create new items in Obsidian Bases",category:"cli",requiresVault:!0,customPromptInstructions:`For obsidianBases:
- Use to explore and manage structured data in Obsidian Base (.base) database files.
- bases: list all Base files in the vault. Use total=true for just the count.
- base:views: list the views defined in a Base file. Requires file= or path=.
- base:query: query data from a specific Base view. Requires file= or path=, optionally view= and format= (e.g., format=csv).
- base:create: create a new item (row) in a Base. Requires file= or path=. Optional: view= (target view), name= (file name for the item), content= (initial note content).
  - The created item appears as a new note that matches the Base's filter criteria.
  - Use base:query first to understand the Base's structure and existing data before creating items.
  - If the Base filters by a specific tag or folder, ensure the new item will match those filters.

Base file YAML reference (for creating new .base files with writeFile):
- filters: MUST be either a single string OR an object with and/or/not keys. NEVER use a bare YAML list.
  - Single filter: filters: 'file.hasTag("book")'
  - Multiple filters: filters: { and: ['file.hasTag("book")', 'status == "reading"'] }
  - Negation: filters: { not: ['file.hasTag("archived")'] }
  - Bare lists like "filters: - 'expr'" are INVALID and will cause parse errors.
- formulas: computed properties. Functions: date(), now(), today(), if(cond, true, false), duration(). Duration fields: .days, .hours, .minutes. Example: days_left: 'if(due, (date(due) - today()).days, "")'
- properties: display config per property (displayName, width, hidden).
- views: table (default), cards, list, or map. Each view can have its own filters, order (property display list), groupBy, summaries.
- Property types: note properties (from frontmatter), file properties (file.name, file.mtime, file.ctime, file.tags, file.links, file.backlinks), formula properties (formula.my_formula).
- YAML quoting: single-quote formulas containing double quotes: 'if(done, "Yes", "No")'. Quote strings with special chars (:, {, }, [, ]).
- Embed in notes with ![[MyBase.base]] or ![[MyBase.base#View Name]].
- VALIDATION: After creating or editing a .base file, ALWAYS call obsidianBases with base:views to verify it parses correctly. If it returns an error, fix the YAML with writeFile and re-validate. Do not stop until validation passes.`}})}function HX(t){let e=Uc.getInstance(),r=ee(),n=e.getToolMetadata("getFileTree")!==void 0,o=t!==void 0,i=e.getToolMetadata("updateMemory")!==void 0,a=r.enableSavedMemory;(e.getAllTools().length===0||n!==o||i!==a)&&(e.clear(),e.registerAll(soi),t&&(uoi(t),loi()),r.enableSavedMemory&&coi(),_mt()&&doi())}Dt();Dt();var rje=class{constructor(e,r){this.toolManager=e;this.writeFileTool=r;this.buffer=""}findCompleteBlock(e){let r=/<writeFile>[\s\S]*?<\/writeFile>/,n=e.match(r);return!n||n.index===void 0?null:{block:n[0],endIdx:n.index+n[0].length}}async*processChunk(e){let r="";if(Array.isArray(e.content))for(let o of e.content)o.type==="text"&&o.text!=null&&(r+=o.text);else e.content!=null&&(r=e.content);r&&(this.buffer+=r),yield e;let n=this.findCompleteBlock(this.buffer);for(;n;){let{block:o,endIdx:i}=n,a=o.match(/<path>([\s\S]*?)<\/path>/),s=o.match(/<content>([\s\S]*?)<\/content>/),u=a?a[1].trim():void 0,l=s?s[1].trim():void 0;try{let c=await this.toolManager.callTool(this.writeFileTool,{path:u,content:l}),d=S$.format("writeFile",c);yield{...e,content:`
${d}
`}}catch(c){yield{...e,content:`
Error: ${c?.message||c}
`}}this.buffer=this.buffer.substring(i),n=this.findCompleteBlock(this.buffer)}}};Xe();function LVr(t){if(!Array.isArray(t)||t.length===0)return{high:0,medium:0,low:0,total:0,averageScore:0};let e=0,r=0,n=0,o=0;for(let i of t){let a=i.rerank_score??i.score??0;o+=a,a>=.7?e++:a>=.3?r++:n++}return{high:e,medium:r,low:n,total:t.length,averageScore:o/t.length}}function FVr(t){let e=[];return t.high>0&&e.push(`${t.high} high`),t.medium>0&&e.push(`${t.medium} medium`),t.low>0&&e.push(`${t.low} low`),e.length===0?"[Relevance: no results]":`[Relevance: ${e.join(", ")}]`}function Nht(t){if(!Array.isArray(t))return"";let e=t.filter(n=>n.includeInContext!==!1);return e.length===0?"No relevant documents found.":e.map((n,o)=>{let i=n.title||"Untitled",a=n.path||"",s=n.__sourceId||n.collection_name||n.source_id||o+1,u=null;if(n.mtime){let l=new Date(n.mtime);isNaN(l.getTime())||(u=l.toISOString())}return`<document>
<id>${s}</id>
<title>${i}</title>${a&&a!==i?`
<path>${a}</path>`:""}${u?`
<modified>${u}</modified>`:""}
<content>
${n.content||""}
</content>
</document>`}).filter(n=>n.length>0).join(`

`)}function kVr(t){try{let e=JSON.parse(t);return Array.isArray(e)?Nht(e):"Invalid search results format."}catch(e){return Ce("Failed to format localSearch result string:",e),"Error processing search results."}}function qVr(t){return Array.isArray(t)?t.map(e=>({title:e.title||e.path||"Untitled",path:e.path||e.title||"",score:e.rerank_score||e.score||0,explanation:e.explanation||null})):[]}function nje(t){if(typeof t=="number"){let e=new Date(t);return isNaN(e.getTime())?"":e.toISOString()}if(typeof t=="string"){let e=new Date(t);return isNaN(e.getTime())?"":e.toISOString()}return""}function foi(t){if(!t)return"";let e=[];try{if(Array.isArray(t.lexicalMatches)&&t.lexicalMatches.length>0){let r=new Set,n=new Set;for(let a of t.lexicalMatches)a?.field&&r.add(String(a.field)),a?.query&&n.add(String(a.query));let o=Array.from(r).join("/"),i=Array.from(n).slice(0,3).join(", ");e.push(`Lexical(${o}): ${i}${n.size>3?", ...":""}`)}if(typeof t.semanticScore=="number"&&t.semanticScore>0&&e.push(`Semantic: ${(t.semanticScore*100).toFixed(1)}%`),t.folderBoost&&typeof t.folderBoost.boostFactor=="number"){let r=t.folderBoost,n=r.folder||"root";e.push(`Folder +${r.boostFactor.toFixed(2)} (${n})`)}if(t.graphConnections&&typeof t.graphConnections=="object"){let r=t.graphConnections,n=[];r.backlinks>0&&n.push(`${r.backlinks} backlinks`),r.coCitations>0&&n.push(`${r.coCitations} co-cites`),r.sharedTags>0&&n.push(`${r.sharedTags} tags`),typeof r.score=="number"?e.push(`Graph ${r.score.toFixed(1)}${n.length?` (${n.join(", ")})`:""}`):n.length&&e.push(`Graph (${n.join(", ")})`)}if(t.graphBoost&&typeof t.graphBoost.boostFactor=="number"&&!t.graphConnections){let r=t.graphBoost;e.push(`Graph +${r.boostFactor.toFixed(2)} (${r.connections} connections)`)}typeof t.baseScore=="number"&&typeof t.finalScore=="number"&&t.baseScore!==t.finalScore&&e.push(`Score: ${t.baseScore.toFixed(4)}\u2192${t.finalScore.toFixed(4)}`)}catch{}return e.join(" | ")}function BVr(t,e,r=1){let n=r,o=[];if(t.length>0){let i=t.map(a=>{let s=a.__sourceId||n++,u=a.title||"Untitled",l=a.path||"",c=a.matchType||a.source||"filter",d=nje(a.mtime);return`<document>
<id>${s}</id>
<title>${u}</title>
<path>${l}</path>
<matchType>${c}</matchType>${d?`
<modified>${d}</modified>`:""}
<content>
${a.content||""}
</content>
</document>`}).join(`

`);o.push(`<filterResults>
${i}
</filterResults>`)}if(e.length>0){let i=e.map(a=>{let s=a.__sourceId||n++,u=a.title||"Untitled",l=a.path||"",c=nje(a.mtime);return`<document>
<id>${s}</id>
<title>${u}</title>${l&&l!==u?`
<path>${l}</path>`:""}${c?`
<modified>${c}</modified>`:""}
<content>
${a.content||""}
</content>
</document>`}).join(`

`);o.push(`<searchResults>
${i}
</searchResults>`)}return o.length===0?"No relevant documents found.":o.join(`

`)}var poi=new Set(["time-filtered","tag-match"]);function UVr(t){return!Array.isArray(t)||t.length===0?!1:t.every(e=>e.source!=null&&poi.has(e.source))}function zVr(t){return Array.isArray(t)?t.some(e=>e.source==="time-filtered"):!1}function Dht(t,e=300){if(!Array.isArray(t)||t.length===0)return"";let r=t.map(n=>{let o=n.title||"Untitled",i=n.path||"",a=nje(n.mtime),u=hX(n.content||"").slice(0,e),l=i?`
<path>${i}</path>`:"",c=a?`
<modified>${a}</modified>`:"",d=u?`
<snippet>${u}</snippet>`:"";return`<file>
<title>${o}</title>${l}${c}${d}
</file>`}).join(`
`);return`<additionalMatches count="${t.length}" note="These results contain titles and metadata only. To read the full content of a note, call the readNote tool with its path.">
${r}
</additionalMatches>`}function VVr(t){if(!Array.isArray(t)||t.length===0){F("Search Results: (none)");return}let e=0,r=t.map(u=>{let l=nje(u.mtime),c=typeof u.rerank_score=="number"?u.rerank_score:u.score||0,d=(Number.isFinite(c)?c:0).toFixed(4),f=u.chunkId||u.path||"",p=foi(u.explanation),m=u.includeInContext!==!1;return m&&e++,{path:f,in:m?"Y":"",mtime:l,score:d,explanation:p}}),n=r.length;F(`Search Results (debug table): ${n} rows; in-context ${e}/${n}`),sNt(r,["path","in","mtime","score","explanation"]);let o=u=>String(u||"").replace(/\|/g,"\\|"),i="| PATH | IN | MTIME | SCORE | EXPLANATION |",a="| --- | :-: | --- | ---: | --- |",s=r.map(u=>`| ${o(u.path)} | ${u.in} | ${u.mtime||""} | ${u.score} | ${o(u.explanation)} |`);xge(["",`Results: ${n} rows; in-context ${e}/${n}`,"",i,a,...s,""])}function HVr(t,e){return[t,e].map(n=>n?.trim()).filter(n=>!!n).join(`

`)}function WVr(t,e){let r=t?`
${t}
`:"";return`<localSearch${e?` timeRange="${e}"`:""}>${r}</localSearch>`}function jht(t,e){let r=t.trim();return r?`${r}

${e}`:e}function JVr(t,e){let r=e.trim();return!r||t.includes(r)?t:jht(t,`[User query]:
${r}`)}function KVr(t,e){let r=e?.trim();if(!r)return t;let o=t.lastIndexOf("[User query]:");if(o===-1){let s=t.trimEnd(),u=s.length>0?`

`:"";return`${s}${u}${r}`}let i=t.slice(0,o).trimEnd(),a=t.slice(o).trimStart();return`${i}

${r}

${a}`}function GVr(t){let e=[],r=0;for(;r<t.length;){let n=t.indexOf("![",r);if(n===-1)break;let o=goi(t,n+2);if(o===null){r=n+2;continue}let i=o+1;for(;i<t.length&&oje(t[i]);)i++;if(t[i]!=="("){r=i;continue}let a=yoi(t,i);if(a===null){r=i+1;continue}let s=moi(t.slice(i+1,a));s&&e.push(s),r=a+1}return e}function moi(t){let e=t.trim();if(e.length===0)return null;if(e.startsWith("<")){let n=boi(e,0);if(n===null)return null;let o=e.slice(1,n).trim();return o.length>0?o:null}let r=hoi(e).trim();return r.length>0?r:null}function hoi(t){let e=t.trimEnd();if(e.length===0)return"";let r=e[e.length-1];if(r==='"'||r==="'"){let o=_oi(e,r,e.length-1);if(o!==null){let i=e.slice(0,o);if(i.length>0&&oje(i[i.length-1]))return i.trimEnd()}}if(r===")"){let n=voi(e);if(n!==null){let o=e.slice(0,n);if(o.length>0&&oje(o[o.length-1]))return o.trimEnd()}}return e}function goi(t,e){let r=e,n=0;for(;r<t.length;){let o=t[r];if(o==="\\"){r+=2;continue}if(o==="["){n++,r++;continue}if(o==="]"){if(n===0)return r;n--,r++;continue}r++}return null}function yoi(t,e){let r=e+1,n=1,o=!0,i=!1;for(;r<t.length;){let a=t[r];if(i){if(a==="\\"){r+=2;continue}if(a===">"){i=!1,o=!1,r++;continue}r++;continue}if(o){if(oje(a)){r++;continue}if(a==="<"){i=!0,r++;continue}o=!1}if(a==="\\"){r+=2;continue}if(a==="("){n++,r++;continue}if(a===")"){if(n--,n===0)return r;r++;continue}r++}return null}function boi(t,e){for(let r=e+1;r<t.length;r++){let n=t[r];if(n==="\\"){r++;continue}if(n===">")return r}return null}function _oi(t,e,r){for(let n=r-1;n>=0;n--)if(t[n]===e&&!XVr(t,n))return n;return null}function voi(t){if(t.length===0||t[t.length-1]!==")")return null;let e=0;for(let r=t.length-1;r>=0;r--){let n=t[r];if(!((n===")"||n==="(")&&XVr(t,r))){if(n===")"){e++;continue}if(n==="("&&(e--,e===0))return r}}return null}function XVr(t,e){let r=0;for(let n=e-1;n>=0&&t[n]==="\\";n--)r++;return r%2===1}function oje(t){return t===" "||t==="	"||t===`
`||t==="\r"}function Mc(t){return typeof t!="string"?"":t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function ZVr(t){return typeof t!="string"?"":t.replace(/&apos;/g,"'").replace(/&quot;/g,'"').replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&")}ra();na();var QA=class extends PD{constructor(){super(...arguments);this.lastCitationSources=null}getAvailableToolsForPlanning(){let r=Uc.getInstance();return r.getAllTools().length===0&&HX(this.chainManager.app?.vault),r.getAllTools().map(o=>o.tool).filter(o=>o.name==="getCurrentTime"||o.name==="convertTimeBetweenTimezones"||o.name==="getTimeInfoByEpoch"||o.name==="getTimeRangeMs"||o.name==="getFileTree")}async planToolCalls(r,n){let o=this.getAvailableToolsForPlanning();if(typeof n.bindTools!="function")return Ce("[CopilotPlus] Model does not support native tool calling, skipping tool planning"),{toolCalls:[],salientTerms:this.extractSalientTermsFromQuery(r)};let i=n.bindTools(o),s=[{role:ute(n),content:`You are a helpful AI assistant. Analyze the user's message and determine if any tools should be called.

Guidelines:
- Use tools when the user's request requires external information or computation
- For time-related queries, use getTimeRangeMs to convert time expressions to timestamps
- For file structure queries, use getFileTree to explore the vault
- If no tools are needed, respond with your analysis

After analyzing, extract key search terms from the user's message that would be useful for searching notes:
- Extract meaningful nouns, topics, and specific concepts
- Preserve the EXACT words and language from the user's message (works for any language)
- Exclude time expressions (those are handled by tools)

Include your extracted terms as: [SALIENT_TERMS: term1, term2, term3]`},{role:"user",content:r}];F("[CopilotPlus] Requesting tool planning with native tool calling...");let u;{let p=await Ib(()=>i.stream(s)),m;for await(let h of p)m=m?m.concat(h):h;if(!m)throw new Error("[CopilotPlus] Received empty response from planning model");u=new uo({content:m.content,tool_calls:m.tool_calls,additional_kwargs:m.additional_kwargs})}let l=u.tool_calls||[],c=typeof u.content=="string"?u.content:String(u.content);F("[CopilotPlus] Native tool calls:",l.length);let{salientTerms:d}=this.extractPlanningFieldsFromResponse(c,r),f=[];for(let p of l){let m=o.find(h=>h.name===p.name);m?(f.push({tool:m,args:p.args}),F(`[CopilotPlus] Tool call: ${p.name}`,p.args)):Ce(`[CopilotPlus] Tool '${p.name}' not found in available tools`)}return{toolCalls:f,salientTerms:d}}extractPlanningFieldsFromResponse(r,n){let o,i=r.match(/\[SALIENT_TERMS:\s*([^\]]+?)\s*\]/i);if(i){let a=i[1].split(",").map(s=>s.trim()).filter(s=>s.length>0);o=a.length>0?a:this.extractSalientTermsFromQuery(n)}else o=this.extractSalientTermsFromQuery(n);return{salientTerms:o}}extractSalientTermsFromQuery(r){return r.split(/[\s\p{P}]+/u).filter(n=>n.length>=3).slice(0,10)}async processAtCommands(r,n,o){let i=r.toLowerCase(),a=this.removeAtCommands(r),s=[...n];if(i.includes("@vault")&&(s.some(l=>l.tool.name==="localSearch")||s.push({tool:EDe,args:{query:a,salientTerms:o.salientTerms,timeRange:o.timeRange}})),(i.includes("@websearch")||i.includes("@web"))&&!s.some(l=>l.tool.name==="webSearch")){let c=await Vg.instance.getCurrentChainManager().memoryManager.getMemory().loadMemoryVariables({}),d=Mge(c);s.push({tool:PDe,args:{query:a,chatHistory:d}})}return i.includes("@memory")&&(s.some(l=>l.tool.name==="updateMemory")||s.push({tool:CDe,args:{statement:a}})),s}removeAtCommands(r){return r.split(" ").filter(n=>!gX.includes(n.toLowerCase())).join(" ").trim()}async processImageUrls(r){let n=[],o=await uH.processUrlBatch(r,n,this.chainManager.app.vault);return uH.showFailedImagesNotice(n),o}async processChatInputImages(r){let n=[],o=await uH.processChatImageBatch(r,n,this.chainManager.app.vault);return uH.showFailedImagesNotice(n),o}async extractImagesFromContextBlock(r,n){let i=new RegExp(`<${n.tagName}>([\\s\\S]*?)<\\/${n.tagName}>`).exec(r);if(!i)return[];let a=i[1],u=/<content>([\s\S]*?)<\/content>/.exec(a),l=u?ZVr(u[1]):"";if(!l)return[];let d=new RegExp(`<${n.identifierTag}>(.*?)<\\/${n.identifierTag}>`).exec(a),f=d?d[1]:void 0;F(`[CopilotPlus] Extracting images from ${n.displayName}:`,f||`no ${n.identifierTag}`);let p=n.useForResolution?f:void 0;return this.extractEmbeddedImages(l,p)}async extractEmbeddedImages(r,n){let o=/!\[\[(.*?\.(png|jpg|jpeg|gif|webp|bmp|svg))\]\]/g,i=[],a=[...r.matchAll(o)];for(let u of a){let l=u[1];if(n){let c=app.metadataCache.getFirstLinkpathDest(l,n);c?i.push(c.path):(Ce(`Could not resolve embedded image: ${l} from source: ${n}`),i.push(l))}else i.push(l)}let s=GVr(r);for(let u of s){if(!u)continue;if(u.match(/^https?:\/\//)){i.push(u);continue}let l=u.replace(/^\.\//,"").replace(/^\//,"");if(n){let c=app.metadataCache.getFirstLinkpathDest(l,n);c?i.push(c.path):i.push(l)}else i.push(l)}return i}async buildMessageContent(r,n){let o=[],i=[],a=ee(),s=[];if(a.passMarkdownImages){let d=n.contextEnvelope;if(!d)throw new Error("[CopilotPlus] Context envelope is required but not available. Cannot extract images.");let f=d.layers.find(p=>p.id==="L3_TURN");if(f){let p=[{tagName:"active_note",identifierTag:"path",displayName:"active note",useForResolution:!0},{tagName:"active_web_tab",identifierTag:"url",displayName:"active web tab",useForResolution:!1}];for(let m of p){let h=await this.extractImagesFromContextBlock(f.text,m);h.length>0&&s.push({urls:h,type:"embedded"})}}}for(let d of s){let f=await this.processImageUrls(d.urls);i.push(...f.successfulImages),o.push(...f.failureDescriptions)}let u=n.content;if(u&&u.length>0){let d=await this.processChatInputImages(u);i.push(...d.successfulImages),o.push(...d.failureDescriptions)}let l=r;o.length>0&&(l=`${r}

Note: 
${o.join(`
`)}
`);let c=[{type:"text",text:l}];return i.length>0&&c.push(...i),c}hasCapability(r,n){let o=r.modelName||r.model||"";return this.chainManager.chatModelManager.findModelByName(o)?.capabilities?.includes(n)??!1}isMultimodalModel(r){return this.hasCapability(r,"vision")}appendComposerInstructionsIfNeeded(r,n){if(!n.message||!n.message.includes("@composer"))return r;let o=`<OUTPUT_FORMAT>
${INt}
</OUTPUT_FORMAT>`;return`${r}

${o}`}async streamMultimodalResponse(r,n,o,i,a,s,u){let l=this.chainManager.memoryManager.getMemory(),c=this.chainManager.chatModelManager.getChatModel(),d=this.isMultimodalModel(c),f=[],p=n.contextEnvelope;if(!p)throw new Error("[CopilotPlus] Context envelope is required but not available. Cannot proceed with CopilotPlus chain.");F("[CopilotPlus] Using envelope-based context construction");let m=dA.convert(p,{includeSystemMessage:!0,mergeUserContent:!0,debug:!1}),h=m.find(w=>w.role==="system");h&&f.push({role:ute(c),content:h.content}),await mq(l,f);let y=m.find(w=>w.role==="user");if(y){let w,T=o.length>0,O=P=>{let R="[User query]:";if(P.includes(R))return P;let I=P.trimEnd(),A=[];I.length>0&&A.push(I);let B=s.trim()||n.originalMessage?.trim()||"";return B.length>0?A.push(`${R}
${B}`):A.push(R),A.join(`

`)};if(T){let P=this.formatAllToolOutputs(o),R=O(y.content);w=jht(P,R);let I=$zr(ee().enableInlineCitations);I&&(w=KVr(w,I))}else w=O(y.content);if(r.includes("<OUTPUT_FORMAT>")&&!w.includes("<OUTPUT_FORMAT>")){let P=r.match(/<OUTPUT_FORMAT>[\s\S]*?<\/OUTPUT_FORMAT>/);P&&(w+=`

`+P[0])}let E=d?await this.buildMessageContent(w,n):w;f.push({role:"user",content:E})}F("Final request to AI",{messages:f.length});let g=c?.modelName;hq({messages:f,modelName:g,contextEnvelope:n.contextEnvelope});let b=new rje(w$,SDe),_=await Ib(()=>this.chainManager.chatModelManager.getChatModel().stream(f,{signal:i.signal}));for await(let w of _){if(i.signal.aborted){F("CopilotPlus multimodal stream iteration aborted",{reason:i.signal.reason});break}for await(let T of b.processChunk(w))a.processChunk(T)}}async run(r,n,o,i,a){let{updateLoadingMessage:s}=a,u=this.chainManager.chatModelManager.getChatModel(),c=!this.hasCapability(u,"reasoning"),d=new iv(o,c),f=[];if(!await m0({isCopilotPlus:!0})){await this.handleError(new Error("Invalid license key"),d.processErrorChunk.bind(d));let _=d.close().content;return this.handleResponse(_,r,n,i,o,void 0)}try{F("==== Step 1: Planning tools ====");let _,w=r.contextEnvelope;if(!w)throw new Error("[CopilotPlus] Context envelope is required but not available. Cannot proceed with CopilotPlus chain.");let O=w.layers.find(k=>k.id==="L5_USER")?.text||r.originalMessage||"";try{let k=this.chainManager.chatModelManager.getChatModel(),q=await this.planToolCalls(O,k),Z,V=q.toolCalls.find(X=>X.tool.name==="getTimeRangeMs");if(V){let X=await w$.callTool(V.tool,V.args),W=re=>re?.startTime?.epoch!==void 0&&re?.endTime?.epoch!==void 0?{startTime:re.startTime.epoch,endTime:re.endTime.epoch}:re;if(typeof X=="string")try{let re=JSON.parse(X);re.error||(Z=W(re))}catch{Ce("[CopilotPlus] Failed to parse getTimeRangeMs result:",X)}else X&&!X.error&&(Z=W(X));F("[CopilotPlus] Executed getTimeRangeMs, result:",Z)}let Y=q.toolCalls.filter(X=>X.tool.name==="getFileTree"&&ZJ()?(F("Skipping getFileTree in project mode"),!1):X.tool.name==="getTimeRangeMs"&&Z?(F("Skipping getTimeRangeMs - already executed during planning"),!1):!0);_=await this.processAtCommands(O,Y,{salientTerms:q.salientTerms,timeRange:Z})}catch(k){return this.handleResponse(pNt(k),r,n,i,o)}let E=r.contextEnvelope?.layers.find(k=>k.id==="L5_USER")?.text,P=this.removeAtCommands(E||r.originalMessage||r.message),{toolOutputs:R,sources:I}=await this.executeToolCalls(_,s);f=I;let A=R.filter(k=>k.output!=null),B=this.appendComposerInstructionsIfNeeded(P,r);F("Invoking LLM with envelope-based context construction"),await this.streamMultimodalResponse(B,r,A,n,d,P,s)}catch(_){s?.(iw.DEFAULT),_.name==="AbortError"||n.signal.aborted?F("CopilotPlus stream aborted by user",{reason:n.signal.reason}):await this.handleError(_,d.processErrorChunk.bind(d))}if(n.signal.aborted&&n.signal.reason==="new-chat")return o(""),"";let m=d.close(),h=m.content,y={wasTruncated:m.wasTruncated,tokenUsage:m.tokenUsage??void 0},g=ee(),b=this.lastCitationSources&&this.lastCitationSources.length>0?this.lastCitationSources:(f||[]).map(_=>({title:_.title,path:_.path}));return h=uDe(h,b,g.enableInlineCitations),await this.handleResponse(h,r,n,i,o,f,void 0,y),h}async executeToolCalls(r,n){let o=[],i=[],a=r.some(s=>s.tool.name==="localSearch");for(let s of r){if(s.tool.name==="getFileTree"&&a){F("Skipping getFileTree since localSearch is already active");continue}F(`Step 2: Calling tool: ${s.tool.name}`),s.tool.name==="localSearch"?n?.(iw.READING_FILES):s.tool.name==="webSearch"?n?.(iw.SEARCHING_WEB):s.tool.name==="getFileTree"&&n?.(iw.READING_FILE_TREE);let u=await w$.callTool(s.tool,s.args);if(s.tool.name==="localSearch"){let c={result:typeof u=="string"?u:JSON.stringify(u),success:u!=null},d=this.getTimeExpression(r),f=this.processLocalSearchResult(c,d);i.push(...f.sources),o.push({tool:s.tool.name,output:f.formattedForLLM})}else o.push({tool:s.tool.name,output:u})}return{toolOutputs:o,sources:LB(i)}}getTimeExpression(r){let n=r.find(o=>o.tool.name==="getTimeRangeMs");return n?n.args.timeExpression:""}prepareLocalSearchResult(r,n){let o=ee(),i=r.filter(R=>R.includeInContext!==!1),a=LVr(i),s=FVr(a),u=UVr(i),l=zVr(i),c,d;if(l){let R=[...i].sort((I,A)=>(A.mtime||0)-(I.mtime||0));c=R.slice(0,o.maxSourceChunks),d=R.slice(o.maxSourceChunks)}else u?(c=[],d=i):i.length>o.maxSourceChunks?(c=i.slice(0,o.maxSourceChunks),d=i.slice(o.maxSourceChunks)):(c=i,d=[]);let f=c.reduce((R,I)=>R+(I.content?.length||0),0),p=c;if(f>n3e){let R=n3e/f;F("Truncating document contents to fit context length. Truncation ratio:",R),p=c.map(I=>({...I,content:I.content?.slice(0,Math.floor((I.content?.length||0)*R))||""}))}let m=p.map((R,I)=>({...R,__sourceId:I+1,content:hX(R.content||"")})),h=m.filter(R=>R.isFilterResult===!0),y=m.filter(R=>R.isFilterResult!==!0),b=h.length>0?BVr(h,y):c.length===0&&d.length>0?Dht(d):Nht(m);c.length>0&&d.length>0?(l?F(`Time-dominant search: ${c.length} recent notes (full content), ${d.length} older notes (metadata-only)`):F(`Two-tier search: ${c.length} full-content docs, ${d.length} metadata-only docs`),b=`${b}

${Dht(d)}`):u&&F(`Tag-only search: ${d.length} notes (metadata-only)`);let _=m.slice(0,Math.min(20,m.length)).map(R=>({title:R.title||R.path||"Untitled",path:R.path||R.title||""})),w=lDe(_);this.lastCitationSources=m.slice(0,Math.min(20,m.length)).map(R=>({title:R.title||R.path||"Untitled",path:R.path||void 0}));let T=Dzr(w,o.enableInlineCitations).trim(),E=HVr("Answer the question based only on the following context:",b),P=T?`${s}

${E}

${T}`:`${s}

${E}`;return WVr(P,n)}processLocalSearchResult(r,n){let o=[],i,a;if(!r.success)return i=`<localSearch>
Search failed.
</localSearch>`,a=`Search failed: ${r.result}`,{formattedForLLM:i,formattedForDisplay:a,sources:o};try{let s=JSON.parse(r.result),u=s&&typeof s=="object"&&s.type==="local_search"&&Array.isArray(s.documents)?s.documents:null;if(!Array.isArray(u))return i=`<localSearch>
Invalid search results format.
</localSearch>`,a="Search results were in an unexpected format.",{formattedForLLM:i,formattedForDisplay:a,sources:o};VVr(u),o=qVr(u),i=this.prepareLocalSearchResult(u,n||""),a=S$.format("localSearch",i)}catch(s){Ce("Failed to parse localSearch results:",s);let u=kVr(r.result);i=n?`<localSearch timeRange="${n}">
${u}
</localSearch>`:`<localSearch>
${u}
</localSearch>`,a=S$.format("localSearch",i)}return{formattedForLLM:i,formattedForDisplay:a,sources:o}}async getSystemPrompt(){return _$(this.chainManager.userMemoryManager)}formatAllToolOutputs(r){return r.length===0?"":`# Additional context:

`+r.map(o=>{let i=o.output;return typeof i!="string"&&(i=JSON.stringify(i)),`<${o.tool}>
${i}
</${o.tool}>`}).join(`

`)}};var _ce=class extends QA{};gr();Xe();id();Qe();Dt();ra();Xe();function qht(t){return t.map(e=>e.content).filter(e=>e&&e.trim().length>0).join(`

`)}var GW=class{constructor(e){this.modelName=e}buildToolSpecificInstructions(e){let r=[];for(let o of e)o.customPromptInstructions&&r.push(o.customPromptInstructions);let n=this.buildCopilotCommandInstructions(e);return n&&r.push(n),r.length>0?r.join(`

`):""}buildCopilotCommandInstructions(e){let r=[];for(let n of e)if(!(!n.copilotCommands||n.copilotCommands.length===0))for(let o of n.copilotCommands)r.push(`- ${o}: call the tool named ${n.id}`);return r.length===0?null:["When the user explicitly includes a Copilot command alias (e.g., @vault) in their message, treat it as a direct request to call the mapped tool before proceeding.","Honor these aliases exactly (case-insensitive):",...r,"If the referenced tool is unavailable, explain that the command cannot be fulfilled instead of ignoring it."].join(`
`)}enhanceSystemPrompt(e,r,n,o){let i=this.buildSystemPromptSections(e,r,n,o);return qht(i)}buildSystemPromptSections(e,r,n,o){let i=o||[],a=this.buildToolSpecificInstructions(i).trim(),u=[{id:"base-system-prompt",label:"System prompt with memory",source:"src/system-prompts/systemPromptBuilder.ts#getSystemPromptWithMemory",content:e.trimEnd()},{id:"autonomous-agent-intro",label:"Autonomous agent introduction",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#BaseModelAdapter.buildSystemPromptSections",content:`# Autonomous Agent Mode

You are now in autonomous agent mode. You can use tools to gather information and complete tasks step by step.

Tools are provided via native function calling - use them when needed to complete tasks.
`}],l=r.trim();return l.length>0&&u.push({id:"tool-descriptions",label:"Tool descriptions (native tool calling via bindTools)",source:"Native tool calling - schemas provided via bindTools()",content:`Available tools:
${l}`}),u.push({id:"tool-usage-guidelines",label:"Tool usage guidelines",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#BaseModelAdapter.buildSystemPromptSections",content:`# Tool Usage Guidelines

## Time-based Queries
When users ask about temporal periods (e.g., "what did I do last month", "show me notes from last week"), you MUST:
1. First call getTimeRangeMs to convert the time expression to a proper time range
2. Then use localSearch with the timeRange parameter from step 1
3. For salientTerms, ONLY use words that exist in the user's original query (excluding time expressions)

Example for "what did I do last month":
1. Call getTimeRangeMs with timeExpression: "last month"
2. Use localSearch with query matching the user's question
3. salientTerms: [] - empty because "what", "I", "do" are not meaningful search terms

Example for "meetings about project X last week":
1. Call getTimeRangeMs with timeExpression: "last week"
2. Use localSearch with query "meetings about project X"
3. salientTerms: ["meetings", "project", "X"] - these words exist in the original query

## File-related Queries

### Handle ambiguity in folder/note paths
When user mentions a folder name (e.g., "meetings folder") or a note name (e.g., "meeting note template") without providing an exact path,
you MUST first call getFileTree to find the folder or notes best matching the user's query.
If multiple results or no result, you should ask the user to provide a more specific path.
`}),a.length>0&&u.push({id:"tool-specific-instructions",label:"Tool-specific instructions",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#BaseModelAdapter.buildToolSpecificInstructions",content:a}),u.push({id:"general-guidelines",label:"General guidelines",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#BaseModelAdapter.buildSystemPromptSections",content:`## Answer Source Priority (CRITICAL)
You are the user's personal knowledge assistant. Always ground your answers in real sources rather than your own training data. Follow this priority chain:

1. **Explicit context first.** If the user has attached notes, documents, URLs, YouTube transcripts, tweets, or any other content to the conversation, use that content as your primary source. The user added it for a reason.
2. **Vault second.** For any question that could plausibly be answered by the user's notes, search the vault (localSearch). The user's own writing, meeting notes, journal entries, and saved references are highly valuable.
3. **Web third.** If the vault has no relevant results, or the question is about external/current information the vault is unlikely to contain, search the web.
4. **Your own knowledge last.** Only fall back on your training data when all of the above have been exhausted or are clearly inapplicable (e.g., explaining a general concept, writing code, or creative tasks that don't need source material).

When in doubt, search the vault. It is always better to check and find nothing than to skip the search and miss relevant notes.

## General Guidelines
- NEVER mention tool names like "localSearch", "webSearch", etc. in your responses. Use natural language like "searching your vault", "searching the web", etc.

You can use multiple tools in sequence. After each tool execution, you'll receive the results and can decide whether to use more tools or provide your final response.

Always explain your reasoning before using tools. Be conversational and clear about what you're doing.
When you've gathered enough information, provide your final response without any tool calls.

## Citation Integrity (CRITICAL)
- ONLY cite sources from tools you ACTUALLY called and received results from
- NEVER fabricate or hallucinate search results, web searches, or any tool outputs
- If you did not call a tool, do not claim you did or cite results from it
- Each citation must correspond to a real document or result returned by a tool in this conversation`}),u}enhanceUserMessage(e,r){return e}needsSpecialHandling(){return!1}},$ht=class extends GW{isGPT5Model(){return this.modelName.includes("gpt-5")||this.modelName.includes("gpt5")}buildSystemPromptSections(e,r,n,o){let i=super.buildSystemPromptSections(e,r,n,o),a=n||[],s=a.includes("writeFile")||a.includes("editFile"),u=[];this.isGPT5Model()?u.push(`GPT-5 SPECIFIC RULES:
- Use maximum 2 tool calls initially, then provide an answer
- Call each tool ONCE per unique query
- For optional parameters: OMIT them entirely if not needed (don't pass empty strings/null)
- For localSearch: OMIT timeRange if not doing time-based search`):u.push("CRITICAL FOR GPT MODELS: You MUST use tools when the user's request requires them. Do not just describe what you plan to do - actually call the tools."),s&&u.push(`\u{1F6A8} FILE EDITING WITH COMPOSER TOOLS \u{1F6A8}

When user asks you to edit or modify a file, you MUST:
1. Determine if it's a small edit (use editFile) or major rewrite (use writeFile)
2. Call the tool immediately - do not just describe what you plan to do

For editFile, pass the exact text to find and its replacement:
- path: vault-relative file path
- oldText: exact text to find (include surrounding context lines to make it unique)
- newText: replacement text (empty string to delete)

\u274C WRONG: "I'll help you add item 4 to the list. Let me update that for you." [No tool call = FAILURE]
\u2705 CORRECT: Actually call editFile or writeFile with proper parameters`),u.push("FINAL REMINDER FOR GPT MODELS: If the user asks you to search, find, edit, or modify anything, you MUST call the appropriate tool immediately. Do not wait for another turn.");let l=u.join(`

`);return i.push({id:"gpt-specific-guidelines",label:"GPT-specific guidance",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#GPTModelAdapter.buildSystemPromptSections",content:l}),i}enhanceUserMessage(e,r){return r?this.getBaseEnhancement(e,r):e}getBaseEnhancement(e,r){if(!r)return e;let n=e.toLowerCase(),o=n.includes("find")||n.includes("search")||n.includes("my notes"),i=n.includes("edit")||n.includes("modify")||n.includes("update")||n.includes("change")||n.includes("fix")||n.includes("add")||n.includes("typo");return o?`${e}

REMINDER: Call the localSearch tool now.`:i?`${e}

\u{1F6A8} GPT REMINDER: Use editFile for small edits (oldText/newText parameters) or writeFile for full rewrites.`:e}needsSpecialHandling(){return!0}},Lht=class extends GW{isThinkingModel(){return this.modelName.includes("claude-3-7-sonnet")||this.modelName.includes("claude-sonnet-4")||this.modelName.includes("claude-3.7-sonnet")||this.modelName.includes("claude-4-sonnet")||this.modelName.includes("claude-opus-4")}isClaudeSonnet4(){return this.modelName.includes("claude-sonnet-4")||this.modelName.includes("claude-4-sonnet")||this.modelName.includes("claude-sonnet-4-20250514")}buildSystemPromptSections(e,r,n,o){let i=super.buildSystemPromptSections(e,r,n,o);if(!this.isThinkingModel())return i;let a=[`IMPORTANT FOR CLAUDE THINKING MODELS:
- You are a thinking model with internal reasoning capability
- Your thinking process will be automatically wrapped in <think> tags - do not manually add thinking tags
- Call tools AFTER your thinking is complete
- Do not provide final answers before using tools - use tools first, then provide your response based on the results

CORRECT FLOW FOR THINKING MODELS:
1. Think through the problem (this happens automatically)
2. Use tools to gather information
3. Wait for tool results
4. Provide final response based on gathered information

INCORRECT: Providing a final answer before using tools
CORRECT: Using tools first, then providing answer based on results`];return this.isClaudeSonnet4()&&a.push(`\u{1F6A8} CRITICAL INSTRUCTIONS FOR CLAUDE SONNET 4 - AUTONOMOUS AGENT MODE \u{1F6A8}

\u26A0\uFE0F  WARNING: You have a specific tendency to write complete responses immediately after tool calls. This BREAKS the autonomous agent pattern!

\u{1F504} CORRECT AUTONOMOUS AGENT ITERATION PATTERN:
1. User asks question
2. Brief sentence about what you'll do (1 sentence max)
3. Use tools to gather information
4. \u270B STOP after tool calls - Do not write anything else
5. Wait for tool results (system provides them)
6. Evaluate results and either: Use more tools OR provide final answer

\u2705 IDEAL RESPONSE FLOW:
- Brief action statement (1 sentence)
- Tool calls
- STOP (wait for results)
- Brief transition statement (1 sentence)
- More tool calls OR final answer

\u{1F3AF} CORRECT PATTERN:
I'll search your vault for piano practice information.
[Call localSearch tool]
[RESPONSE ENDS HERE - NO MORE TEXT]

\u274C WRONG PATTERN (DO NOT DO THIS):
[Call tool]
Based on the search results, here's a complete practice plan...
[This is FORBIDDEN - you haven't received results yet!]

\u{1F511} KEY UNDERSTANDING FOR CLAUDE 4:
- Brief 1-sentence explanations BEFORE tool calls are good
- Each response is ONE STEP in a multi-step process
- After tool calls, STOP and wait for the system to provide results
- Your thinking is automatically handled in <think> blocks

\u26A1 AUTONOMOUS AGENT RULES FOR CLAUDE 4:
1. If you need tools: Brief sentence + tool calls, then STOP
2. If you receive tool results: Evaluate if you need more tools
3. If you need more tools: Brief sentence + more tool calls, then STOP
4. If you have enough info: THEN provide your final response

REMEMBER: One brief sentence before tools is perfect. Nothing after tool calls.`),i.push({id:"claude-thinking-guidelines",label:"Claude thinking model guidance",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#ClaudeModelAdapter.buildSystemPromptSections",content:a.join(`

`)}),i}needsSpecialHandling(){return this.isThinkingModel()}},Fht=class extends GW{buildSystemPromptSections(e,r,n,o){let i=super.buildSystemPromptSections(e,r,n,o),u=[`\u{1F6A8} CRITICAL INSTRUCTIONS FOR GEMINI - AUTONOMOUS AGENT MODE \u{1F6A8}

You MUST use tools to complete tasks. DO NOT ask the user questions about how to proceed.
${(n||[]).includes("localSearch")?`
When the user mentions "my notes" or "my vault", use the localSearch tool.

\u274C WRONG:
"Let's start by searching your notes. What kind of information should I look for?"

\u2705 CORRECT: Call localSearch immediately with the user's topic as the query`:""}`.trim()];return u.push(`GEMINI SPECIFIC RULES:
1. When user mentions "my notes" about X \u2192 use localSearch with query "X"
2. DO NOT ask clarifying questions about search terms
3. DO NOT wait for permission to use tools
4. Use tools based on the user's request

\u{1F6A8} CRITICAL: SEQUENTIAL vs PARALLEL TOOL CALLS \u{1F6A8}

When one tool's OUTPUT is needed as INPUT to another tool, you MUST make them in SEPARATE responses:
1. Call the FIRST tool
2. STOP and wait for the result
3. In the NEXT response, use the result from step 1 in the SECOND tool call

\u274C WRONG (DO NOT DO THIS):
User: "Recap my last week"
- Call getTimeRangeMs AND localSearch together with made-up timeRange values
- This is WRONG because you're hallucinating the timeRange values!

\u2705 CORRECT (DO THIS):
User: "Recap my last week"
- FIRST: Call getTimeRangeMs with timeExpression "last week"
- WAIT for result
- SECOND: Call localSearch using the actual timeRange from the result

RULE: NEVER make up or guess parameter values. If you need a tool's output, call that tool FIRST, then WAIT for the result.

Remember: The user has already told you what to do. Execute it NOW with the available tools.`),i.push({id:"gemini-specific-guidelines",label:"Gemini-specific guidance",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#GeminiModelAdapter.buildSystemPromptSections",content:u.join(`

`)}),i}enhanceUserMessage(e,r){return r?`${e}

REMINDER: Use the tools immediately. Do not ask questions. For "my notes", use localSearch.`:e}needsSpecialHandling(){return!0}},kht=class extends GW{buildSystemPromptSections(e,r,n,o){let i=super.buildSystemPromptSections(e,r,n,o);return i.push({id:"copilot-plus-guidelines",label:"Copilot Plus model guidance",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#CopilotPlusModelAdapter.buildSystemPromptSections",content:`\u{1F6A8} CRITICAL: NO HALLUCINATED TOOL CALLS OR SOURCES \u{1F6A8}

You are a Copilot Plus model. You MUST follow these rules strictly:

## Tool Call Integrity
- You can ONLY reference results from tools you have ACTUALLY called in this conversation
- NEVER claim to have performed a web search unless you called the webSearch tool AND received results
- NEVER claim to have searched notes unless you called localSearch AND received results
- If you want to search the web, you MUST call the webSearch tool first - do not make up results

## Citation Rules
- Every citation [1], [2], etc. MUST correspond to a real source returned by a tool
- Do NOT invent sources like "General web search results for X" unless webSearch was actually called
- If you only called localSearch, your citations can ONLY reference notes from that search
- Count your actual tool calls - if you only made 1 tool call, you cannot have citations from multiple different tools

## Before Writing Citations
Ask yourself: "Did I actually call this tool and receive this result?"
- If YES: You may cite it
- If NO: Do NOT cite it or claim you did

REMEMBER: It is better to say "I only searched your notes, not the web" than to fabricate web search results.

## Formatting Guidelines
- AVOID using markdown tables - they often render poorly in chat interfaces
- Instead of tables, use bullet points, numbered lists, or simple formatted text
- Only use tables when the user explicitly requests tabular format`}),i}needsSpecialHandling(){return!0}},vce=class{static createAdapter(e){let r=(e.modelName||e.model||"").toLowerCase();if(F(`Creating model adapter for: ${r}`),r.includes("gpt")){let n=new $ht(r);return n.isGPT5Model()?F("Using GPTModelAdapter with GPT-5 specific enhancements"):F("Using GPTModelAdapter"),n}return r.includes("claude")?(F("Using ClaudeModelAdapter"),new Lht(r)):r.includes("gemini")||r.includes("google/gemini")?(F("Using GeminiModelAdapter"),new Fht(r)):r.includes("copilot-plus")?(F("Using CopilotPlusModelAdapter"),new kht(r)):(F("Using BaseModelAdapter (default)"),new GW(r))}};function YVr(t){let e=["find","search","look for","look up","my notes","in my vault","from my vault","check the web","search online","from the internet","current time","what time","timer","youtube","video","transcript"],r=t.toLowerCase();return e.some(n=>r.includes(n))}function woi(t){let{systemSections:e,rawHistory:r,adapterName:n,originalUserMessage:o,enhancedUserMessage:i}=t,a=[...e];if(r&&r.length>0){let u=kat(r);if(u.length>0){let c=n_r(u).map((d,f)=>`${f+1}. ${d.role.toUpperCase()}
${d.content}`);a.push({id:"chat-history",label:"Restored chat history from memory",source:"src/LLMProviders/chainRunner/utils/chatHistoryUtils.ts#processRawChatHistory",content:c.join(`

`)})}}a.push({id:"user-original-message",label:"Original user message",source:"Chat input",content:o});let s=i===o?" (unchanged)":"";return a.push({id:"user-enhanced-message",label:`User message after ${n}.enhanceUserMessage${s}`,source:`src/LLMProviders/chainRunner/utils/modelAdapter.ts#${n}.enhanceUserMessage`,content:i}),a}function Soi(t){return t.map(e=>`${`[Section: ${e.label} | Source: ${e.source}]`}
${e.content}`).join(`

`)}function QVr(t){let e=woi(t),r=Soi(e),n=qht(t.systemSections);return{sections:e,annotatedPrompt:r,systemPrompt:n}}async function Coi(t){let{chainManager:e,adapter:r,basePrompt:n,toolDescriptions:o,toolNames:i,toolMetadata:a,userMessage:s}=t,u=r.buildSystemPromptSections(n,o,i,a),c=await e.memoryManager.getMemory().loadMemoryVariables({}),d=Array.isArray(c.history)?c.history:[],f=s.originalMessage||s.message,p=YVr(s.message),m=r.enhanceUserMessage(s.message,p);return QVr({systemSections:u,rawHistory:d,adapterName:r.constructor?.name||"ModelAdapter",originalUserMessage:f,enhancedUserMessage:m})}async function xoi(t){return _$(t.userMemoryManager)}async function eHr(t){let{chainManager:e,adapter:r,availableTools:n,toolDescriptions:o,userMessage:i}=t,a=Uc.getInstance(),s=n.map(c=>c.name),u=n.map(c=>a.getToolMetadata(c.name)).filter(c=>c!==void 0),l=await xoi(e);return Coi({chainManager:e,adapter:r,basePrompt:l,toolDescriptions:o,toolNames:s,toolMetadata:u,userMessage:i})}function tHr(){return{status:"idle",startTime:null,elapsedSeconds:0,steps:[]}}function Bht(t){if(t.status==="idle")return"";let e=JSON.stringify(t.steps.map(r=>r.summary));return`<!--AGENT_REASONING:${t.status}:${t.elapsedSeconds}:${e}-->`}function wce(t){let e=t.match(/<!--AGENT_REASONING:(\w+):(\d+):(.+?)-->/);if(!e)return null;let[r,n,o,i]=e,a=[];try{a=JSON.parse(i)}catch{a=[]}return{hasReasoning:!0,status:n,elapsedSeconds:parseInt(o,10),steps:a,contentAfter:t.replace(r,"").trim()}}function rHr(t,e,r,n){if(!e.success)return`${Uht(t,n)} failed`;switch(t){case"localSearch":{if(r&&r.count>0){let o=r.titles.slice(0,3),i=r.count-o.length,a=`Found ${r.count} note${r.count!==1?"s":""}: ${o.join(", ")}`;return i>0&&(a+=` +${i} more`),a}return"No matching notes found"}case"webSearch":return"Retrieved web search results";case"getTimeRangeMs":return"Calculated time range";case"readFile":return"Read file content";case"readNote":{let o=n?.notePath;return o?`Read "${o.split("/").pop()?.replace(/\.md$/i,"")||o}"`:"Read note content"}case"createNote":return"Created new note";case"appendToNote":return"Appended to note";case"editNote":return"Edited note";case"deleteNote":return"Deleted note";case"youtubeTranscript":case"youtubeTranscription":return"Fetched video transcript";case"fetchUrl":return"Fetched URL content";case"getFileTree":return"Retrieved vault file tree";case"getTagList":return"Retrieved vault tags";case"getCurrentTime":return"Got current time";case"getTimeInfoByEpoch":return"Converted timestamp";case"convertTimeBetweenTimezones":return"Converted timezone";case"obsidianDailyNote":{let o=n?.command,i=n?.vault,a=i&&i.trim().length>0?` from "${i}"`:"";return o==="daily:path"?`Got daily note path${a}`:`Loaded today's daily note${a}`}case"obsidianRandomRead":{let o=n?.vault;return o&&o.trim().length>0?`Loaded a random note from "${o}"`:"Loaded a random note"}case"obsidianProperties":{if(n?.command==="property:read"){let i=n?.name;return i?`Read property "${i}"`:"Read property"}return"Listed vault properties"}case"obsidianTasks":return"Listed vault tasks";case"obsidianLinks":{let o=n?.command;return o==="backlinks"?"Listed backlinks":o==="links"?"Listed outgoing links":o==="orphans"?"Listed orphaned notes":o==="unresolved"?"Listed unresolved links":"Queried link graph"}case"obsidianTemplates":{if(n?.command==="template:read"){let i=n?.name;return i?`Read template "${i}"`:"Read template"}return"Listed templates"}case"obsidianBases":{let o=n?.command;return o==="base:views"?"Listed base views":o==="base:query"?"Queried base data":"Listed bases"}case"indexVault":return"Indexed vault";case"updateMemory":return"Updated memory";case"writeFile":case"editFile":{let o=n?.path,i=o?o.split("/").pop()||o:"file",a=e.result||"";return a.includes('"rejected"')||a.includes("rejected")?`Edit rejected for "${i}"`:a.includes('"failed"')||a.includes("Error")?`Edit failed for "${i}"`:t==="writeFile"?`Wrote to "${i}"`:`Edited "${i}"`}default:return"Done"}}function Uht(t,e,r){switch(t){case"localSearch":{if(r&&r.recallTerms&&r.recallTerms.length>0){let o=r.recallTerms.filter(i=>typeof i=="string"&&i.trim().length>0&&!i.includes("[object ")&&i!=="[object Object]");if(o.length>0){let i=o.slice(0,6).map(u=>`"${u}"`).join(", "),a=o.length-6,s=a>0?` +${a} more`:"";return`Searching notes for ${i}${s}`}}let n=e?.query;return n?`Searching notes for "${n.length>50?n.slice(0,50)+"...":n}"`:"Searching notes"}case"webSearch":{let n=e?.query;return n?`Searching web for "${n.length>30?n.slice(0,30)+"...":n}"`:"Searching the web"}case"getTimeRangeMs":return"Calculating time range";case"readFile":{let n=e?.path;return n?`Reading "${n.split("/").pop()||n}"`:"Reading file"}case"readNote":{let n=e?.notePath;return n?`Reading "${n.split("/").pop()?.replace(/\.md$/i,"")||n}"`:"Reading note"}case"createNote":return"Creating new note";case"appendToNote":return"Appending to note";case"editNote":return"Editing note";case"deleteNote":return"Deleting note";case"youtubeTranscript":case"youtubeTranscription":return"Fetching video transcript";case"fetchUrl":return"Fetching URL content";case"getFileTree":return"Browsing vault file tree";case"getTagList":return"Loading vault tags";case"getCurrentTime":return"Getting current time";case"getTimeInfoByEpoch":return"Converting timestamp";case"convertTimeBetweenTimezones":return"Converting timezone";case"obsidianDailyNote":{let n=e?.command,o=e?.vault,i=o&&o.trim().length>0?` from "${o}"`:"";return n==="daily:path"?`Getting daily note path${i}`:`Reading today's daily note${i}`}case"obsidianRandomRead":{let n=e?.vault;return n&&n.trim().length>0?`Reading a random note from "${n}"`:"Reading a random note"}case"obsidianProperties":{if(e?.command==="property:read"){let o=e?.name;return o?`Reading property "${o}"`:"Reading property"}return"Listing vault properties"}case"obsidianTasks":return"Listing vault tasks";case"obsidianLinks":{let n=e?.command;return n==="backlinks"?"Listing backlinks":n==="links"?"Listing outgoing links":n==="orphans"?"Listing orphaned notes":n==="unresolved"?"Listing unresolved links":"Querying link graph"}case"obsidianTemplates":{if(e?.command==="template:read"){let o=e?.name;return o?`Reading template "${o}"`:"Reading template"}return"Listing templates"}case"obsidianBases":{let n=e?.command;return n==="base:views"?"Listing base views":n==="base:query"?"Querying base data":"Listing bases"}case"indexVault":return"Indexing vault";case"updateMemory":return"Saving to memory";case"writeFile":{let n=e?.path;return n?`Writing to "${n.split("/").pop()||n}"`:"Writing to file"}case"editFile":{let n=e?.path;return n?`Editing "${n.split("/").pop()||n}"`:"Editing file"}default:return"Processing"}}function Toi(t,e){return t.length>e?t.slice(0,e-3)+"...":t}function nHr(t){if(!t||t.trim().length===0)return null;let e=t.trim().split(`
`)[0];return Toi(e,100)}function Ooi(t,e){let r=new Set(t.toLowerCase().split(/\s+/).filter(Boolean)),n=new Set(e.toLowerCase().split(/\s+/).filter(Boolean));if(r.size===0&&n.size===0)return 1;if(r.size===0||n.size===0)return 0;let o=0;for(let u of r)n.has(u)&&o++;let i=r.size+n.size-o,a=o/i,s=o/Math.min(r.size,n.size);return Math.max(a,s)}function zht(t,e,r=.6){for(let n of e)if(Ooi(t,n)>=r)return n;return null}var Eoi=/^(user|assistant|system)\s*$/;function oHr(t){return t&&t.split(`
`).filter(e=>!Eoi.test(e)).join(`
`)}var iHr=`## Agent Behavior
- You have a limited number of tool calls. Use them wisely.
- NEVER search for the same or very similar query twice. If results were insufficient, try substantially different terms.
- After 1-2 searches, synthesize an answer from the results you have. Do not keep searching unless the results are clearly insufficient.
- If you have enough information to answer, respond directly without calling any more tools.`,Sce=class extends QA{constructor(){super(...arguments);this.llmFormattedMessages=[];this.lastDisplayedContent="";this.reasoningState=tHr();this.reasoningTimerInterval=null;this.accumulatedContent="";this.allReasoningSteps=[];this.abortHandledByTimer=!1}getAvailableTools(){let r=ee(),n=Uc.getInstance();n.getAllTools().length===0&&HX(this.chainManager.app?.vault);let o=new Set(r.autonomousAgentEnabledToolIds||[]);return n.getEnabledTools(o,!!this.chainManager.app?.vault)}startReasoningTimer(r,n){this.reasoningState={status:"reasoning",startTime:Date.now(),elapsedSeconds:0,steps:[]},this.accumulatedContent="",this.allReasoningSteps=[],this.abortHandledByTimer=!1;let o=["Understanding your question","Analyzing your request","Processing your query","Thinking about this","Considering your question","Working on this","Pondering the possibilities","Diving into your request","Let me think about this","Exploring your question","Getting my thoughts together","Examining the details","Looking into this","Mulling this over","On it","Firing up the neurons","Connecting the dots","Brewing some ideas","Spinning up the gears","Warming up the engines","Crunching the details","Putting on my thinking cap","Consulting my notes","Gathering my thoughts","Rolling up my sleeves"],i=o[Math.floor(Math.random()*o.length)];this.addReasoningStep(i),this.reasoningTimerInterval=setInterval(()=>{if(n?.signal.aborted&&this.reasoningState.status==="reasoning"){this.stopReasoningTimer(),this.reasoningState.status="complete",this.abortHandledByTimer=!0;let a=this.buildReasoningBlockMarkup(),s="The response was interrupted.",u=a?a+`

`+s:s;r(u);return}if(this.reasoningState.startTime&&this.reasoningState.status==="reasoning"){this.reasoningState.elapsedSeconds=Math.floor((Date.now()-this.reasoningState.startTime)/1e3);let a=this.buildReasoningBlockMarkup(),s=a?a+(this.accumulatedContent?`

`+this.accumulatedContent:""):this.accumulatedContent;r(s)}},100)}addReasoningStep(r,n,o=!1){let i={timestamp:Date.now(),summary:r,toolName:n};this.allReasoningSteps.push(i),!o&&(this.reasoningState.steps.push(i),this.reasoningState.steps.length>4&&this.reasoningState.steps.shift())}stopReasoningTimer(){this.reasoningTimerInterval&&(clearInterval(this.reasoningTimerInterval),this.reasoningTimerInterval=null),this.reasoningState.status="collapsed"}buildReasoningBlockMarkup(){if(this.reasoningState.status==="complete"||this.reasoningState.status==="collapsed"){let r={...this.reasoningState,steps:this.allReasoningSteps};return Bht(r)}return Bht(this.reasoningState)}static async generateSystemPrompt(r,n,o){let i=await _$(o),a=Uc.getInstance(),u=r.map(c=>a.getToolMetadata(c.name)).filter(c=>c!==void 0).filter(c=>c.customPromptInstructions).map(c=>`For ${c.displayName}: ${c.customPromptInstructions}`).join(`
`),l=[i];return u&&l.push(`## Tool Guidelines
${u}`),l.push(iHr),l.join(`

`)}async buildToolPromptDebugReport(r){let n=this.getAvailableTools(),o=vce.createAdapter(this.chainManager.chatModelManager.getChatModel()),i=n.map(a=>`${a.name}: ${a.description}`).join(`
`);return eHr({chainManager:this.chainManager,adapter:o,availableTools:n,toolDescriptions:i,userMessage:r})}applyCiCOrderingToLocalSearchResult(r,n){return JVr(r,n)}async run(r,n,o,i,a){this.llmFormattedMessages=[],this.lastDisplayedContent="";let s=await m0({isAutonomousAgent:!0}),u=this.chainManager.chatModelManager.getChatModel(),l=vce.createAdapter(u),c=new iv(o,!0);if(!s){await this.handleError(new Error("Invalid license key"),c.processErrorChunk.bind(c));let m=c.close().content;return this.handleResponse(m,r,n,i,o,void 0)}let d=u?.modelName;if(!r.contextEnvelope)throw new Error("[Agent] Context envelope is required but not available. Cannot proceed with autonomous agent.");F("[Agent] Using native tool calling with ReAct pattern");let p=await this.prepareAgentConversation(r,u,a.updateLoadingMessage);try{this.startReasoningTimer(o,n);let m=await this.runReActLoop({boundModel:p.loopDeps.boundModel,chatModel:u,tools:p.loopDeps.availableTools,messages:p.messages,originalPrompt:p.originalUserPrompt,abortController:n,updateCurrentAiMessage:o,processLocalSearchResult:p.loopDeps.processLocalSearchResult,applyCiCOrderingToLocalSearchResult:p.loopDeps.applyCiCOrderingToLocalSearchResult,adapter:l});if(this.abortHandledByTimer)return this.lastDisplayedContent="","";let h=LB(m.sources);return p.messages.length>0&&hq({messages:[...p.messages],modelName:d,contextEnvelope:r.contextEnvelope}),await this.handleResponse(m.finalResponse,r,n,i,o,h.length>0?h:void 0,this.llmFormattedMessages.join(`

`),m.responseMetadata),this.lastDisplayedContent="",m.finalResponse}catch(m){if(this.stopReasoningTimer(),m.name==="AbortError"||n.signal.aborted)return F("Autonomous agent stream aborted by user",{reason:n.signal.reason}),"";ie("Autonomous agent failed, falling back to regular Plus mode:",m);try{return await new QA(this.chainManager).run(r,n,o,i,a)}catch(h){ie("Fallback to regular Plus mode also failed:",h),this.lastDisplayedContent&&c.processChunk({content:this.lastDisplayedContent});let y=Wr(m),g=`

Fallback to regular Plus mode also failed: `+Wr(h);await this.handleError(new Error(y+g),c.processErrorChunk.bind(c));let b=c.close().content;return this.handleResponse(b,r,n,i,o,void 0,b)}}}async prepareAgentConversation(r,n,o){let i=[],a=this.getAvailableTools(),s=n.modelName||n.model||"unknown";if(typeof n.bindTools!="function")throw new Error(`Model ${s} does not support native tool calling (bindTools not available). Agent mode requires a model with tool calling support.`);let u=n.bindTools(a),l={availableTools:a,boundModel:u,processLocalSearchResult:this.processLocalSearchResult.bind(this),applyCiCOrderingToLocalSearchResult:this.applyCiCOrderingToLocalSearchResult.bind(this)},c=r.contextEnvelope,d=dA.convert(c,{includeSystemMessage:!0,mergeUserContent:!0,debug:!1}),f=this.chainManager.memoryManager.getMemory(),p=d.find(E=>E.role==="system"),m=Uc.getInstance(),y=a.map(E=>m.getToolMetadata(E.name)).filter(E=>E!==void 0).filter(E=>E.customPromptInstructions).map(E=>`For ${E.displayName}: ${E.customPromptInstructions}`).join(`
`),g=[p?.content||"",y?`
## Tool Guidelines
${y}`:"",iHr].filter(Boolean).join(`

`);g&&i.push(new v_({content:g}));let w=c.layers.find(E=>E.id==="L5_USER")?.text||""||r.originalMessage||r.message,T=[];await mq(f,T);for(let E of T)E.role==="user"?i.push(new Au(E.content)):i.push(new uo(E.content));let O=d.find(E=>E.role==="user");if(O){let P=this.isMultimodalModel(n)?await this.buildMessageContent(O.content,r):O.content;i.push(new Au(P))}return{messages:i,collectedSources:[],originalUserPrompt:w,loopDeps:l}}async runReActLoop(r){let{boundModel:n,tools:o,messages:i,originalPrompt:a,abortController:s,updateCurrentAiMessage:u,processLocalSearchResult:l,applyCiCOrderingToLocalSearchResult:c}=r,d=ee().autonomousAgentMaxIterations,f=[],p=Date.now(),m=[],h=0,y=0,g;for(;y<d&&!s.signal.aborted;){let E=Date.now()-p;if(E>=o3e){Ce(`Agent loop timed out after ${Math.round(E/1e3)}s`);break}y++;let{content:P,aiMessage:R,streamingResult:I}=await this.streamModelResponse(n,i,s,u);g={wasTruncated:I.wasTruncated,tokenUsage:I.tokenUsage??void 0};let A=P?.trim();F(`[Agent] Iteration ${y} model output:`,A?A.slice(0,200):"(empty)");let B=R.tool_calls||[];if(F(`[Agent] Iteration ${y}: ${B.length} tool call(s)`),B.length===0){F(`[Agent] Iteration ${y}: Final response (no tool calls)`),this.stopReasoningTimer(),this.reasoningState.status="complete",i.push(R);let X=P;if(!X||X.trim()===""){let J=R.tool_call_chunks??[];Ce(`[Agent] Empty response detected (iteration ${y}). Content length: ${P?.length??0}, tool_call_chunks from model: ${J.length}, parsed tool_calls: ${B.length}. This may indicate tool calls were dropped or the model produced only thinking tokens.`),X="The model did not produce a response. Please try again or switch to a different model."}let W=this.buildReasoningBlockMarkup(),re=20,ue=5,le="";for(let J=0;J<X.length&&!s.signal.aborted;J+=re){le+=X.slice(J,J+re);let ne=W?W+`

`+le:le;u(ne),J+re<X.length&&await new Promise(D=>setTimeout(D,ue))}let L=W?W+`

`+X:X;return u(L),{finalResponse:L,sources:f,responseMetadata:g}}let k=oHr(P),q=new uo({content:k,tool_calls:R.tool_calls});if(i.push(q),y>1&&k&&k.trim().length>0){let X=nHr(k);X&&this.addReasoningStep(X)}let Z=[],V=[],Y=[];for(let X of B){if(X.name==="localSearch"){let W=X.args?.query;if(W){let re=zht(W,m)??zht(W,V);if(re){F(`[Agent] Dedup: "${W}" (similar to: "${re}")`),i.push(cEe(X.id||cae(),X.name,`You already searched for a similar query: "${re}". Synthesize your answer from existing results.`));continue}V.push(W),Y.push(W)}else Y.push(null)}else Y.push(null);Z.push(X)}for(let X=0;X<Z.length;X++){let W=Z[X];if(s.signal.aborted)break;let re={name:W.name,args:W.args},ue=Uht(W.name,re.args);this.addReasoningStep(ue,W.name),Tmt(re,y);let le=await Cmt(re,o,a),L;if(W.name==="localSearch"&&le.success){let D=l(le);f.push(...D.sources),L={titles:D.sources.map(N=>N.title),count:D.sources.length},le.result=c(D.formattedForLLM,a||"")}if(Omt(W.name,le),W.name==="localSearch"&&le.success){let D=Y[X];D&&m.push(D)}let J=rHr(W.name,le,L,re.args);(!le.success||L)&&this.addReasoningStep(J,W.name);let ne=cEe(W.id||cae(),W.name,le.result);i.push(ne)}if(Z.length===0&&B.length>0){if(h++,F(`[Agent] All ${B.length} tool call(s) skipped as duplicates (${h} consecutive)`),h>=2){F("[Agent] Model stuck in search loop, forcing synthesis without tools"),this.addReasoningStep("Synthesizing answer from search results"),i.push(new Au(`You have already searched and found relevant results. Do not call any tools. Answer the following question now based ONLY on the search results above:

`+a));let X=await this.streamModelResponse(r.chatModel,i,s,u);g={wasTruncated:X.streamingResult.wasTruncated,tokenUsage:X.streamingResult.tokenUsage??void 0},this.stopReasoningTimer(),this.reasoningState.status="complete";let W=this.buildReasoningBlockMarkup(),re=X.content||"Unable to synthesize a response from the search results.",ue=W?W+`

`+re:re;return u(ue),{finalResponse:ue,sources:f,responseMetadata:g}}}else h=0}this.stopReasoningTimer(),this.reasoningState.status="complete";let b=this.buildReasoningBlockMarkup();if(s.signal.aborted){if(F("Agent reasoning interrupted by user"),this.abortHandledByTimer)return{finalResponse:"",sources:f,responseMetadata:g};let E="The response was interrupted.";return{finalResponse:b?b+`

`+E:E,sources:f,responseMetadata:g}}let _=Date.now()-p,w=_>=o3e;w?Ce(`Agent loop timed out after ${Math.round(_/1e3)}s`):Ce(`Agent reached max iterations (${d})`);let T=w?"I've reached the time limit for reasoning. Here's what I found so far based on the search results.":"I've reached the maximum number of tool calls. Here's what I found so far based on the search results.";return{finalResponse:b?b+`

`+T:T,sources:f,responseMetadata:g}}async streamModelResponse(r,n,o,i){let a=new Map,s=new iv(()=>{},!0),u="";try{let l=await Ib(()=>r.stream(n,{signal:o.signal}));for await(let y of l){if(o.signal.aborted)break;if(y.response_metadata?.finish_reason==="MALFORMED_FUNCTION_CALL")throw Ce("Backend returned MALFORMED_FUNCTION_CALL - falling back to non-agent mode"),new Error("MALFORMED_FUNCTION_CALL: Model does not support native tool calling");let b=y.tool_call_chunks;if(b&&Array.isArray(b))for(let w of b)a_r(a,w);let _=typeof y.content=="string"?y.content:"";_&&(u+=_),s.processChunk(y)}let c=s.close(),d=c.content,f=u.trim(),p=d.trim();f&&!p&&F(`[Agent] Model produced content that was entirely stripped (likely think blocks): ${f.slice(0,300)}`);let m=dEe(a),h=new uo({content:d,tool_calls:m.map(y=>({id:y.id,name:y.name,args:y.args,type:"tool_call"}))});return{content:d,aiMessage:h,streamingResult:c}}catch(l){if(ie(`Stream error: ${l.message}`),l.name==="AbortError"||o.signal.aborted){let c=s.close();return{content:c.content,aiMessage:new uo({content:c.content}),streamingResult:c}}throw l}}};Xe();Qe();Dt();OS();TS();var eWr=require("obsidian");LW();var WX=[{tag:"note_context",sourceType:"note",recoverable:!0,sourceExtractor:"path"},{tag:"active_note",sourceType:"note",recoverable:!0,sourceExtractor:"path"},{tag:"embedded_note",sourceType:"note",recoverable:!0,sourceExtractor:"path"},{tag:"vault_note",sourceType:"note",recoverable:!0,sourceExtractor:"path"},{tag:"retrieved_document",sourceType:"note",recoverable:!0,sourceExtractor:"path"},{tag:"url_content",sourceType:"url",recoverable:!0,sourceExtractor:"url"},{tag:"web_tab_context",sourceType:"url",recoverable:!0,sourceExtractor:"url"},{tag:"active_web_tab",sourceType:"url",recoverable:!0,sourceExtractor:"url"},{tag:"youtube_video_context",sourceType:"youtube",recoverable:!0,sourceExtractor:"url"},{tag:"twitter_content",sourceType:"url",recoverable:!0,sourceExtractor:"url"},{tag:"embedded_pdf",sourceType:"pdf",recoverable:!0,sourceExtractor:"name"},{tag:"selected_text",sourceType:"selected_text",recoverable:!1,sourceExtractor:null},{tag:"web_selected_text",sourceType:"selected_text",recoverable:!1,sourceExtractor:null},{tag:"localSearch",sourceType:"note",recoverable:!0,sourceExtractor:null}],ije=new Map;for(let t of WX)ije.set(t.tag,t);function XW(t){return ije.get(t)?.sourceType??"unknown"}function aje(t){return ije.get(t)?.recoverable??!1}function JX(t,e){let r=ije.get(e);if(!r?.sourceExtractor)return"";let n=r.sourceExtractor;return new RegExp(`<${n}>([^<]+)</${n}>`).exec(t)?.[1]??""}function Cce(t){let e=/<content>([\s\S]*?)<\/content>/.exec(t);return e?e[1]:t}var Xw={previewCharsPerSection:500,maxSections:20,verbatimThreshold:5e3};function ZW(t,e=500,r=20){let n=t.split(/(?=^#{1,6}\s+)/m).filter(s=>s.trim());if(n.length<=1)return Vht(t,e*4);let o=n.slice(0,r),i=n.length>r,a=o.map(s=>{let u=s.trim().split(`
`),l=u[0],c=u.slice(1).join(`
`).trim();return c.length<=e?s.trim():`${l}
${Vht(c,e)}`}).join(`

`);return i?`${a}

[... ${n.length-r} more sections omitted ...]`:a}function Vht(t,e){if(t.length<=e)return t;let r=t.slice(0,e),n=/[.!?]\s+/g,o=-1,i;for(;(i=n.exec(r))!==null;)i.index>e*.5&&(o=i.index+1);if(o>0)return r.slice(0,o)+" ...";let a=r.lastIndexOf(`

`);if(a>e*.5)return r.slice(0,a)+`

...`;let s=r.lastIndexOf(" ");return s>e*.8?r.slice(0,s)+" ...":r+"..."}function sje(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Poi(){return["localSearch","note_context","active_note","retrieved_document","url_content","youtube_video_context"].map(e=>({pattern:new RegExp(`<${e}[^>]*>[\\s\\S]*?</${e}>`,"g"),tag:e}))}var Moi=Poi(),KX="Tool 'readNote' result: ";function Roi(t,e){if(t[e]!=="{")return null;let r=0,n=!1,o=!1;for(let i=e;i<t.length;i++){let a=t[i];if(o){o=!1;continue}if(a==="\\"&&n){o=!0;continue}if(a==='"'){n=!n;continue}if(!n){if(a==="{")r++;else if(a==="}"&&(r--,r===0))return{json:t.slice(e,i+1),endPos:i+1}}}return null}function YW(t,e={}){return Array.isArray(t)?t.map(r=>r.type==="text"&&typeof r.text=="string"?{...r,text:aHr(r.text,e)}:r):typeof t=="string"?aHr(t,e):t}function aHr(t,e={}){let r=e.verbatimThreshold??Xw.verbatimThreshold,n=t;for(let{pattern:o,tag:i}of Moi)o.lastIndex=0,n=n.replace(o,a=>a.length<r?a:Aoi(a,i,e));return n=Ioi(n,r,e),n}function Ioi(t,e,r){let n="",o=0;for(;o<t.length;){let i=t.indexOf(KX,o);if(i===-1){n+=t.slice(o);break}n+=t.slice(o,i);let a=i+KX.length,s=Roi(t,a);if(!s){n+=KX,o=a;continue}try{let u=JSON.parse(s.json);if(u.content&&u.content.length>e){let l=Doi(u,r);n+=`${KX}${JSON.stringify(l)}`}else n+=KX+s.json}catch{n+=KX+s.json}o=s.endPos}return n}function Aoi(t,e,r={}){if(!aje(e))return t;if(e==="localSearch")return Noi(t,r);let n=JX(t,e),o=Cce(t),i=XW(e),a=r.previewCharsPerSection??Xw.previewCharsPerSection,s=r.maxSections??Xw.maxSections,u=ZW(o,a,s);return`<prior_context source="${sje(n)}" type="${i}">
${u}
</prior_context>`}function Noi(t,e={}){let r=e.previewCharsPerSection??Xw.previewCharsPerSection,n=/<document>([\s\S]*?)<\/document>/g,o=[],i;for(;(i=n.exec(t))!==null;){let s=i[1],u=/<path>([^<]+)<\/path>/.exec(s),l=/<title>([^<]+)<\/title>/.exec(s),c=/<content>([\s\S]*?)<\/content>/.exec(s),d=u?.[1]??"",f=l?.[1]??d.split("/").pop()??"Untitled",p=c?.[1]??"",m=p.length>r?p.slice(0,r)+"...":p;o.push({path:d,title:f,preview:m.trim()})}if(o.length===0){let s=Cce(t);return`<prior_context source="localSearch" type="note">
${ZW(s,r,e.maxSections??Xw.maxSections)}
</prior_context>`}let a=o.map((s,u)=>`${u+1}. [[${s.title}]] (${s.path})
   ${s.preview}`).join(`

`);return`<prior_context source="localSearch" type="note">
[${o.length} search results - use localSearch to re-query]

${a}
</prior_context>`}function Doi(t,e={}){let{content:r,notePath:n,noteTitle:o,...i}=t;if(!r||typeof r!="string")return t;let a=e.previewCharsPerSection??Xw.previewCharsPerSection,s=e.maxSections??Xw.maxSections,u=ZW(r,a,s);return{...i,notePath:n,noteTitle:o,content:`[COMPACTED - use readNote to get full content]

${u}`,_wasCompacted:!0}}Qe();hge();TS();var joi=`Progressively summarize the lines of conversation provided, adding onto the previous summary returning a new summary.

EXAMPLE
Current summary:
The human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good.

New lines of conversation:
Human: Why do you think artificial intelligence is a force for good?
AI: Because artificial intelligence will help humans reach their full potential.

New summary:
The human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good because it will help humans reach their full potential.
END OF EXAMPLE

Current summary:
{summary}

New lines of conversation:
{new_lines}

New summary:`,sHr=new Ku({inputVariables:["summary","new_lines"],template:joi}),$oi=`You are an assistant to a human, powered by a large language model trained by OpenAI.

You are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.

You are constantly learning and improving, and your capabilities are constantly evolving. You are able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. You have access to some personalized information provided by the human in the Context section below. Additionally, you are able to generate your own text based on the input you receive, allowing you to engage in discussions and provide explanations and descriptions on a wide range of topics.

Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.

Context:
{entities}

Current conversation:
{history}
Last line:
Human: {input}
You:`,uHr=new Ku({inputVariables:["entities","history","input"],template:$oi}),Loi=`You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guideline, a proper noun is generally capitalized. You should definitely extract all names and places.

The conversation history is provided just in case of a coreference (e.g. "What do you know about him" where "him" is defined in a previous line) -- ignore items mentioned there that are not in the last line.

Return the output as a single comma-separated list, or NONE if there is nothing of note to return (e.g. the user is just issuing a greeting or having a simple conversation).

EXAMPLE
Conversation history:
Person #1: my name is Jacob. how's it going today?
AI: "It's going great! How about you?"
Person #1: good! busy working on Langchain. lots to do.
AI: "That sounds like a lot of work! What kind of things are you doing to make Langchain better?"
Last line:
Person #1: i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff.
Output: Jacob,Langchain
END OF EXAMPLE

EXAMPLE
Conversation history:
Person #1: how's it going today?
AI: "It's going great! How about you?"
Person #1: good! busy working on Langchain. lots to do.
AI: "That sounds like a lot of work! What kind of things are you doing to make Langchain better?"
Last line:
Person #1: i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff. I'm working with Person #2.
Output: Langchain, Person #2
END OF EXAMPLE

Conversation history (for reference only):
{history}
Last line of conversation (for extraction):
Human: {input}

Output:`,lHr=new Ku({inputVariables:["history","input"],template:Loi}),Foi=`You are an AI assistant helping a human keep track of facts about relevant people, places, and concepts in their life. Update and add to the summary of the provided entity in the "Entity" section based on the last line of your conversation with the human. If you are writing the summary for the first time, return a single sentence.
The update should only include facts that are relayed in the last line of conversation about the provided entity, and should only contain facts about the provided entity.

If there is no new information about the provided entity or the information is not worth noting (not an important or relevant fact to remember long-term), output the exact string "UNCHANGED" below.

Full conversation history (for context):
{history}

Entity to summarize:
{entity}

Existing summary of {entity}:
{summary}

Last line of conversation:
Human: {input}
Updated summary (or the exact string "UNCHANGED" if there is no new information about {entity} above):`,cHr=new Ku({inputVariables:["entity","summary","history","input"],template:Foi});hge();zo();DL();mS();LL();ra();var koi=class extends b_{addUserMessage(t){return this.addMessage(new Au(t))}addAIMessage(t){return this.addMessage(new uo(t))}async addMessages(t){for(let e of t)await this.addMessage(e)}clear(){throw new Error("Not implemented.")}},uje=class extends koi{constructor(e){super(...arguments);x(this,"lc_namespace",["langchain","stores","message","in_memory"]);x(this,"messages",[]);this.messages=e??[]}async getMessages(){return this.messages}async addMessage(e){this.messages.push(e)}async clear(){this.messages=[]}};zo();var GX=class{},dHr=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},XX=(t,e)=>{let r=dHr(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},lje=(t,e)=>{let r=dHr(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};function Hht(t,e){let r=Object.keys(t).filter(n=>!e.includes(n)&&n!=="stop");if(r.length!==1)throw new Error(`One input key expected, but got ${r.length}`);return r[0]}var qoi={};OJ(qoi,{BaseChatMemory:()=>t_});var t_=class extends GX{constructor(e){super();x(this,"chatHistory");x(this,"returnMessages",!1);x(this,"inputKey");x(this,"outputKey");this.chatHistory=e?.chatHistory??new uje,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(XX(e,this.inputKey)),await this.chatHistory.addAIMessage(lje(r,this.outputKey))}async clear(){await this.chatHistory.clear()}};QW();ra();var Mce=class extends t_{constructor(e){let{returnMessages:r,inputKey:n,outputKey:o,chatHistory:i,humanPrefix:a,aiPrefix:s,llm:u,prompt:l,summaryChatMessageClass:c}=e;super({returnMessages:r,inputKey:n,outputKey:o,chatHistory:i});x(this,"memoryKey","history");x(this,"humanPrefix","Human");x(this,"aiPrefix","AI");x(this,"llm");x(this,"prompt",sHr);x(this,"summaryChatMessageClass",v_);this.memoryKey=e?.memoryKey??this.memoryKey,this.humanPrefix=a??this.humanPrefix,this.aiPrefix=s??this.aiPrefix,this.llm=u,this.prompt=l??this.prompt,this.summaryChatMessageClass=c??this.summaryChatMessageClass}async predictNewSummary(e,r){let n=Ll(e,this.humanPrefix,this.aiPrefix);return await new Qh({llm:this.llm,prompt:this.prompt}).predict({summary:r,new_lines:n})}},WHr=class extends Mce{constructor(e){super(e);x(this,"buffer","")}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){return this.returnMessages?{[this.memoryKey]:[new this.summaryChatMessageClass(this.buffer)]}:{[this.memoryKey]:this.buffer}}async saveContext(e,r){await super.saveContext(e,r);let n=await this.chatHistory.getMessages();this.buffer=await this.predictNewSummary(n.slice(-2),this.buffer)}async clear(){await super.clear(),this.buffer=""}};ra();var JHr=class extends Mce{constructor(e){super(e);x(this,"movingSummaryBuffer","");x(this,"maxTokenLimit",2e3);this.maxTokenLimit=e?.maxTokenLimit??this.maxTokenLimit}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){let r=await this.chatHistory.getMessages();this.movingSummaryBuffer&&(r=[new this.summaryChatMessageClass(this.movingSummaryBuffer),...r]);let n;return this.returnMessages?n=r:n=Ll(r,this.humanPrefix,this.aiPrefix),{[this.memoryKey]:n}}async saveContext(e,r){await super.saveContext(e,r),await this.prune()}async prune(){let e=await this.chatHistory.getMessages();this.movingSummaryBuffer&&(e=[new this.summaryChatMessageClass(this.movingSummaryBuffer),...e]);let r=await this.llm.getNumTokens(Ll(e,this.humanPrefix,this.aiPrefix));if(r>this.maxTokenLimit){let n=[];for(;r>this.maxTokenLimit;){let o=e.shift();o&&(n.push(o),r=await this.llm.getNumTokens(Ll(e,this.humanPrefix,this.aiPrefix)))}this.movingSummaryBuffer=await this.predictNewSummary(n,this.movingSummaryBuffer)}}async clear(){await super.clear(),this.movingSummaryBuffer=""}};ra();var hje=class extends t_{constructor(e){super({chatHistory:e?.chatHistory,returnMessages:e?.returnMessages??!1,inputKey:e?.inputKey,outputKey:e?.outputKey});x(this,"humanPrefix","Human");x(this,"aiPrefix","AI");x(this,"memoryKey","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]:Ll(r,this.humanPrefix,this.aiPrefix)}}};ra();var gje=class extends t_{constructor(e){super({returnMessages:e?.returnMessages??!1,chatHistory:e?.chatHistory,inputKey:e?.inputKey,outputKey:e?.outputKey});x(this,"humanPrefix","Human");x(this,"aiPrefix","AI");x(this,"memoryKey","history");x(this,"k",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]:Ll(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}};wWe();OD();var KHr=class extends GX{constructor(e){super();x(this,"vectorStoreRetriever");x(this,"inputKey");x(this,"memoryKey");x(this,"returnDocs");x(this,"metadata");this.vectorStoreRetriever=e.vectorStoreRetriever,this.inputKey=e.inputKey,this.memoryKey=e.memoryKey??"memory",this.returnDocs=e.returnDocs??!1,this.metadata=e.metadata}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){let r=XX(e,this.inputKey),n=await this.vectorStoreRetriever.invoke(r);return{[this.memoryKey]:this.returnDocs?n:Qee(n)}}async saveContext(e,r){let n=typeof this.metadata=="function"?this.metadata(e,r):this.metadata,o=Object.entries(e).filter(([i])=>i!==this.memoryKey).concat(Object.entries(r)).map(([i,a])=>`${i}: ${a}`).join(`
`);await this.vectorStoreRetriever.addDocuments([new Yl({pageContent:o,metadata:n})])}};QW();DL();var GHr=class extends b_{};var XHr=class extends GHr{constructor(){super();x(this,"lc_namespace",["langchain","stores","entity","in_memory"]);x(this,"store");this.store=Object.create(null)}async get(e,r){return e in this.store?this.store[e]:r}async set(e,r){this.store[e]=r}async delete(e){delete this.store[e]}async exists(e){return e in this.store}async clear(){this.store=Object.create(null)}};ra();var ZHr=class extends t_{constructor(e){super({chatHistory:e.chatHistory,returnMessages:e.returnMessages??!1,inputKey:e.inputKey,outputKey:e.outputKey});x(this,"entityExtractionChain");x(this,"entitySummarizationChain");x(this,"entityStore");x(this,"entityCache",[]);x(this,"k",3);x(this,"chatHistoryKey","history");x(this,"llm");x(this,"entitiesKey","entities");x(this,"humanPrefix");x(this,"aiPrefix");this.llm=e.llm,this.humanPrefix=e.humanPrefix,this.aiPrefix=e.aiPrefix,this.chatHistoryKey=e.chatHistoryKey??this.chatHistoryKey,this.entitiesKey=e.entitiesKey??this.entitiesKey,this.entityExtractionChain=new Qh({llm:this.llm,prompt:e.entityExtractionPrompt??lHr}),this.entitySummarizationChain=new Qh({llm:this.llm,prompt:e.entitySummarizationPrompt??cHr}),this.entityStore=e.entityStore??new XHr,this.entityCache=e.entityCache??this.entityCache,this.k=e.k??this.k}get memoryKeys(){return[this.chatHistoryKey]}get memoryVariables(){return[this.entitiesKey,this.chatHistoryKey]}async loadMemoryVariables(e){let r=this.inputKey??Hht(e,this.memoryVariables),n=await this.chatHistory.getMessages(),o=Ll(n.slice(-this.k*2),this.humanPrefix,this.aiPrefix),i=await this.entityExtractionChain.predict({history:o,input:e[r]}),a=i.trim()==="NONE"?[]:i.split(",").map(l=>l.trim()),s={};for(let l of a)s[l]=await this.entityStore.get(l,"No current information known.");this.entityCache=[...a];let u=this.returnMessages?n.slice(-this.k*2):o;return{[this.chatHistoryKey]:u,[this.entitiesKey]:s}}async saveContext(e,r){await super.saveContext(e,r);let n=this.inputKey??Hht(e,this.memoryVariables),o=await this.chatHistory.getMessages(),i=Ll(o.slice(-this.k*2),this.humanPrefix,this.aiPrefix),a=e[n];for(let s of this.entityCache){let u=await this.entityStore.get(s,"No current information known."),l=await this.entitySummarizationChain.predict({summary:u,entity:s,history:i,input:a});l.trim()!=="UNCHANGED"&&await this.entityStore.set(s,l.trim())}}async clear(){await super.clear(),await this.entityStore.clear()}};var YHr=class extends t_{constructor(e){super({chatHistory:e?.chatHistory,returnMessages:e?.returnMessages??!1,inputKey:e?.inputKey,outputKey:e?.outputKey});x(this,"humanPrefix","Human");x(this,"aiPrefix","AI");x(this,"memoryKey","history");x(this,"memories",[]);this.memories=e?.memories??this.memories,this.humanPrefix=e?.humanPrefix??this.humanPrefix,this.aiPrefix=e?.aiPrefix??this.aiPrefix,this.memoryKey=e?.memoryKey??this.memoryKey,this.checkRepeatedMemoryVariable(),this.checkInputKey()}checkRepeatedMemoryVariable(){let e=[];for(let r of this.memories){let n=e.filter(o=>r.memoryKeys.includes(o));if(n.length>0)throw new Error(`The same variables ${[...n]} are found in multiple memory objects, which is not allowed by CombinedMemory.`);e.push(...r.memoryKeys)}}checkInputKey(){for(let e of this.memories)e.chatHistory!==void 0&&e.inputKey===void 0&&console.warn(`When using CombinedMemory, input keys should be set so the input is known. Was not set on ${e}.`)}async loadMemoryVariables(e){let r={};for(let n of this.memories){let o=await n.loadMemoryVariables(e);r={...r,...o}}return r}async saveContext(e,r){for(let n of this.memories)await n.saveContext(e,r)}async clear(){for(let e of this.memories)typeof e.clear=="function"&&await e.clear()}get memoryKeys(){let e=[];for(let r of this.memories)e.push(...r.memoryKeys);return e}};ra();var QHr=class extends t_{constructor(e){super(e);x(this,"humanPrefix","Human");x(this,"aiPrefix","AI");x(this,"memoryKey","history");x(this,"maxTokenLimit",2e3);x(this,"llm");this.llm=e.llm,this.humanPrefix=e?.humanPrefix??this.humanPrefix,this.aiPrefix=e?.aiPrefix??this.aiPrefix,this.memoryKey=e?.memoryKey??this.memoryKey,this.maxTokenLimit=e?.maxTokenLimit??this.maxTokenLimit}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){let r=await this.chatHistory.getMessages();return this.returnMessages?{[this.memoryKey]:r}:{[this.memoryKey]:Ll(r,this.humanPrefix,this.aiPrefix)}}async saveContext(e,r){await super.saveContext(e,r);let n=await this.chatHistory.getMessages(),o=await this.llm.getNumTokens(Ll(n,this.humanPrefix,this.aiPrefix));if(o>this.maxTokenLimit){let i=[];for(;o>this.maxTokenLimit;)i.push(n.shift()),o=await this.llm.getNumTokens(Ll(n,this.humanPrefix,this.aiPrefix))}}};ra();var Zoi={};OJ(Zoi,{BaseChatMemory:()=>t_,BaseConversationSummaryMemory:()=>Mce,BaseMemory:()=>GX,BufferMemory:()=>hje,BufferWindowMemory:()=>gje,ChatMessageHistory:()=>uje,CombinedMemory:()=>YHr,ConversationSummaryBufferMemory:()=>JHr,ConversationSummaryMemory:()=>WHr,ConversationTokenBufferMemory:()=>QHr,ENTITY_MEMORY_CONVERSATION_TEMPLATE:()=>uHr,EntityMemory:()=>ZHr,VectorStoreRetrieverMemory:()=>KHr,getBufferString:()=>Ll,getInputValue:()=>XX,getOutputValue:()=>lje});var Rce=class t{constructor(){this.initMemory(),ml(()=>{let e=this.memory?.chatHistory;this.initMemory(e)})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initMemory(e){let r=ee().contextTurns;this.memory=new gje({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){let n=typeof r=="string"?YW(r):{...r,output:YW(r.output)};this.debug&&console.log("Saving to memory - Input:",e,"Output (compacted):",n),await this.memory.saveContext(e,n)}};Qe();TS();na();var Ice=class t{constructor(){this.initChatPrompt(),this.initQAPrompt(),ml(()=>{this.initChatPrompt(),this.initQAPrompt()}),XJ(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initChatPrompt(){let e=b$(),r=Gu();r&&ZJ()&&(e=r.systemPrompt);let n=this.escapeTemplateString(e);this.chatPrompt=Eb.fromMessages([$C.fromTemplate(n),new QN("history"),rw.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=Eb.fromMessages([$C.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 Ace=class{constructor(e){this.retrievedDocuments=[];this.pendingModelError=null;this.app=e,this.memoryManager=Rce.getInstance(),this.chatModelManager=U0.getInstance(),this.promptManager=Ice.getInstance(),this.userMemoryManager=new $B(e),this.initialize(),ml(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.pendingModelError)throw this.pendingModelError;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 NJ(e)}}validateChainInitialization(){(!this.chain||!mNt(this.chain))&&(F("Reinitializing chat chain after detecting missing or unsupported instance."),this.createChainWithNewModel({},!1))}storeRetrieverDocuments(e){this.retrievedDocuments=e}async createChainWithNewModel(e={},r=!0){let n,o=UC(),i=Gu();if(!(o==="project"&&!i))try{if(n=o==="project"?i?.projectModelKey:j_(),!n)throw new NJ("No model key found. Please select a model in settings.");if(r){let a=PS(n,ee().activeModels);if(a||(console.error("Resetting default model. No model configuration found for: ",n),a=aO[0],n=a.name+"|"+a.provider),o==="project"&&!a.projectEnabled){let u=ee().activeModels.find(l=>l.enabled&&l.projectEnabled);if(u)a=u,n=u.name+"|"+u.provider,new eWr.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,...i?.modelConfigs};await this.chatModelManager.setChatModel(s),this.pendingModelError=null}this.setChain(o,e),F(`Setting model to ${n}`)}catch(a){this.pendingModelError=a instanceof Error?a:new Error(String(a)),ie(`createChainWithNewModel failed: ${a}`),F(`modelKey: ${n||j_()}`)}}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=dte.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),S4("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=ee(),s=a.enableSemanticSearchV3?new(await Promise.resolve().then(()=>(PEe(),Yat))).HybridRetriever({minSimilarityScore:.01,maxK:a.maxSourceChunks,salientTerms:[]}):new(await Promise.resolve().then(()=>(pX(),umt))).TieredLexicalRetriever(app,{minSimilarityScore:.01,maxK:a.maxSourceChunks,salientTerms:[],textWeight:void 0,returnAll:!1,useRerankerThreshold:void 0});this.retrievalChain=dte.createConversationalRetrievalChain({llm:n,retriever:s,systemMessage:b$()},this.storeRetrieverDocuments.bind(this),ee().debug),S4("vault_qa"),ee().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=dte.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),S4("copilot_plus");break}case"project":{await this.initializeQAChain(r),this.chain=dte.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),S4("project");break}default:this.validateChainType(e);break}}getChainRunner(){let e=UC(),r=ee();switch(e){case"llm_chain":return new dae(this);case"vault_qa":return new nle(this);case"copilot_plus":return r.enableAutonomousAgent?new Sce(this):new QA(this);case"project":return new _ce(this);default:throw new Error(`Unsupported chain type: ${e}`)}}async initializeQAChain(e){e.refreshIndex&&ee().enableSemanticSearchV3&&await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().indexVaultToVectorStore(!1)}async runChain(e,r,n,o,i={}){let{ignoreSystemMessage:a=!1}=i,s=e.contextEnvelope?.layers.find(c=>c.id==="L5_USER")?.text;F(`Step 0: Initial user message:
`,s||e.originalMessage||e.message),this.validateChatModel(),this.validateChainInitialization();let u=this.chatModelManager.getChatModel();if(a||ste(u)){let c=Eb.fromMessages([new QN("history"),rw.fromTemplate("{input}")]);ste(u)&&(c=Eb.fromMessages([[Zs,b$()||""],c])),this.createChainWithNewModel({prompt:c},!1)}return await this.getChainRunner().run(e,r,n,o,i)}};na();Xe();Qe();Dt();var yje=class t{constructor(e){this.app=e}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}clearAllLoadStates(){f1t({success:[],failed:[],processingFiles:[],total:[]})}async executeWithProcessTracking(e,r,n){this.setFileOrUrlStartProcess(e);try{let o=await n();return this.setFileOrUrlProcessSuccessful(e),o}catch(o){let i=ED(o)?"Rate limit exceeded. (Rate limit: 50 files or 100MB per 3 hours, whichever is reached first)":Wr(o);throw this.setFileOrUrlProcessFailed(e,r,i),o}}setFileOrUrlStartProcess(e){jo.set(vte,r=>{let n={...r};return n.failed.find(o=>o.path===e)&&(n.failed=n.failed.filter(o=>o.path!==e)),n.success.includes(e)&&(n.success=n.success.filter(o=>o!==e)),n.processingFiles.includes(e)||(n.processingFiles=[...n.processingFiles,e]),n.total.includes(e)||(n.total=[...n.total,e]),n})}setFileOrUrlProcessSuccessful(e){mO("processingFiles",r=>r.filter(n=>n!==e)),mO("success",r=>r.includes(e)?r:[...r,e])}setFileOrUrlProcessFailed(e,r,n){mO("processingFiles",o=>o.filter(i=>i!==e)),mO("failed",o=>{if(!o.find(a=>a.path===e)){let a={path:e,type:r,error:n,timestamp:Date.now()};return[...o,a]}return o})}preComputeAllItems(e,r){F(`[preComputeAllItems] Starting pre-computation for project: ${e.name}`);let n=[];n.push(...r.map(a=>a.path));let o=e.contextSource?.webUrls?.trim()||"";if(o){let a=o.split(`
`).filter(s=>s.trim());n.push(...a)}let i=e.contextSource?.youtubeUrls?.trim()||"";if(i){let a=i.split(`
`).filter(s=>s.trim());n.push(...a)}if(n.length>0){let a=[...new Set([...n])];mO("total",s=>a),F(`[preComputeAllItems] Project ${e.name}: Added ${n.length} items to tracking (${a.length} total unique items)`)}}markAllCachedItemsAsSuccess(e,r,n){F(`[markAllCachedItemsAsSuccess] Starting for project: ${e.name||"default"}`);let o=e.contextSource?.webUrls?.trim()||"";if(o){let s=o.split(`
`).filter(u=>u.trim()).filter(u=>r.webContexts[u]);s.forEach(u=>{this.markCachedItemAsSuccess(u)}),s.length>0&&F(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached Web URLs as successful`)}let i=e.contextSource?.youtubeUrls?.trim()||"";if(i){let s=i.split(`
`).filter(u=>u.trim()).filter(u=>r.youtubeContexts[u]);s.forEach(u=>{this.markCachedItemAsSuccess(u)}),s.length>0&&F(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached YouTube URLs as successful`)}if(r.fileContexts){let a=new Set(n.filter(u=>u.extension==="md").map(u=>u.path)),s=Object.keys(r.fileContexts).filter(u=>a.has(u));s.forEach(u=>{this.markCachedItemAsSuccess(u)}),s.length>0&&F(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached files that match current project patterns as successful.`)}}markCachedItemAsSuccess(e){mO("total",r=>r.includes(e)?r:[...r,e]),mO("success",r=>r.includes(e)?r:[...r,e])}makeItemFailed(e,r,n){mO("total",o=>o.includes(e)?o:[...o,e]),mO("failed",o=>{if(!o.find(a=>a.path===e)){let a={path:e,type:r,error:n,timestamp:Date.now()};return[...o,a]}return o})}};var Vg=class t{constructor(e,r){this.projectUsageTimestampsManager=new MJ;this.app=e,this.plugin=r,this.currentProjectId=null,this.chainMangerInstance=new Ace(e),this.projectContextCache=Iw.getInstance(),this.fileParserManager=new pq(Xl.getInstance(),this.app.vault,!0,null),this.loadTracker=yje.getInstance(this.app),s1t(async()=>{await this.getCurrentChainManager().createChainWithNewModel()}),u1t(async()=>{if(ZJ())return;let n=ee(),o=n.enableSemanticSearchV3&&n.indexVaultToVectorStore==="ON MODE SWITCH"&&(UC()==="vault_qa"||UC()==="copilot_plus");await this.getCurrentChainManager().createChainWithNewModel({refreshIndex:o})}),XJ(async n=>{await this.switchProject(n)}),this.setupProjectListChangeMonitor()}setupProjectListChangeMonitor(){ml(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&&this.hasMeaningfulProjectConfigChange(a,i)&&(await this.compareAndUpdateCache(a,i),this.currentProjectId===i.id&&await Promise.all([this.loadProjectContext(i,!0),this.getCurrentChainManager().createChainWithNewModel()]))}})}hasMeaningfulProjectConfigChange(e,r){let n={...e,UsageTimestamps:0},o={...r,UsageTimestamps:0};return JSON.stringify(n)!==JSON.stringify(o)}static getInstance(e,r){return t.instance||(t.instance=new t(e,r)),t.instance}getCurrentChainManager(){return this.chainMangerInstance}getCurrentProjectId(){return this.currentProjectId}touchProjectUsageTimestamps(e){this.projectUsageTimestampsManager.touch(e.id);let r=ee().projectList||[],n=r.find(i=>i.id===e.id);if(!n)return;let o=this.projectUsageTimestampsManager.shouldPersist(e.id,n.UsageTimestamps);o!==null&&(Re("projectList",r.map(i=>i.id===e.id?{...i,UsageTimestamps:o}:i)),this.projectUsageTimestampsManager.markPersisted(e.id,o))}getProjectUsageTimestampsManager(){return this.projectUsageTimestampsManager}async switchProject(e){try{if(this.loadTracker.clearAllLoadStates(),fO(!0),F("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 pq(Xl.getInstance(),this.app.vault,!0,e),await this.loadProjectContext(e),this.refreshChatView(),this.touchProjectUsageTimestamps(e),F(`Switched to project: ${e.name}`)}catch(r){throw ie(`Failed to switch project: ${r}`),r}finally{fO(!1)}}async saveCurrentProjectMessage(){await this.plugin.autosaveCurrentChat()}async loadNextProjectMessage(){await this.plugin.chatUIState.handleProjectSwitch()}async loadProjectContext(e,r=!1){r&&(this.loadTracker.clearAllLoadStates(),fO(!0));try{if(!e.contextSource)return Ce(`[loadProjectContext] Project ${e.name}: No contextSource. Aborting.`),null;F(`[loadProjectContext] Starting for project: ${e.name}`);let n=await this.projectContextCache.getOrInitializeCache(e),o=this.getProjectAllFiles(e);this.loadTracker.preComputeAllItems(e,o),this.loadTracker.markAllCachedItemsAsSuccess(e,n,o);let[i]=await Promise.all([this.processMarkdownFiles(e,n,o),this.processWebUrls(e,n),this.processYoutubeUrls(e,n)]);return i.timestamp=Date.now(),await this.projectContextCache.setCacheSafely(e,i),await this.processNonMarkdownFiles(e,o),F(`[loadProjectContext] Completed for project: ${e.name}.`),i}catch(n){throw ie(`[loadProjectContext] Failed for project ${e.name}:`,n),n}finally{r&&fO(!1)}}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),F(`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());await this.projectContextCache.removeWebUrls(r,f.filter(m=>!p.includes(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());await this.projectContextCache.removeYoutubeUrls(r,f.filter(m=>!p.includes(m)))}}catch(n){ie(`Error comparing project configurations: ${n}`)}}refreshChatView(){let e=this.app.workspace.getLeavesOfType(Du)[0]?.view;e&&e.updateView()}async getProjectContext(e){let r=ee().projectList.find(o=>o.id===e);if(!r)return Ce(`[getProjectContext] Project not found for ID: ${e}`),null;F(`[getProjectContext] Getting context for project: ${r.name} (ID: ${e})`);let n=this.projectContextCache.getSync(r);if(!n||n.markdownNeedsReload){n?F(`[getProjectContext] Project ${r.name}: Markdown needs reload. Triggering full load.`):F(`[getProjectContext] Project ${r.name}: Memory cache miss. Triggering full load.`);let o=await this.loadProjectContext(r,!0);if(!o)return ie(`[getProjectContext] Project ${r.name}: loadProjectContext returned null.`),null;n=o}else F(`[getProjectContext] Project ${r.name}: Memory cache hit and markdown OK. Using existing context.`);return this.formatProjectContextWithFiles(n,r)}async formatProjectContextWithFiles(e,r){let n=[];if(e.markdownContext&&n.push(`## Markdown Files
${e.markdownContext}`),Object.keys(e.webContexts).length>0&&n.push(`## Web Content
${Object.values(e.webContexts).join(`

`)}`),Object.keys(e.youtubeContexts).length>0&&n.push(`## YouTube Content
${Object.values(e.youtubeContexts).join(`

`)}`),Object.keys(e.fileContexts).length>0){let o=Object.entries(e.fileContexts).filter(([i])=>i.split(".").pop()?.toLowerCase()!=="md");if(o.length>0){let i=o.map(async([s,u])=>{let l=s.split("/"),c=l[l.length-1],d=c.split(".").pop()||"",f=await this.projectContextCache.getOrReuseFileContext(r,s)||"[Content not available]";return`[[${c}]]
path: ${s}
type: ${d}
modified: ${new Date(u.timestamp).toISOString()}

${f}`}),a=await Promise.all(i);a.length>0&&n.push(`## Other Files
${a.join(`

`)}`)}}return`
# Project Context
The following information is the relevant context for this project. Use this information to inform your responses when appropriate:

<ProjectContext>
${n.join(`

`)}
</ProjectContext>
`}formatProjectContext(e){let r=[];if(e.markdownContext&&r.push(`## Markdown Files
${e.markdownContext}`),Object.keys(e.webContexts).length>0&&r.push(`## Web Content
${Object.values(e.webContexts).join(`

`)}`),Object.keys(e.youtubeContexts).length>0&&r.push(`## YouTube Content
${Object.values(e.youtubeContexts).join(`

`)}`),Object.keys(e.fileContexts).length>0){let n="";for(let[o,i]of Object.entries(e.fileContexts)){let a=o.split("/"),s=a[a.length-1],u=s.split(".").pop()||"";n+=`[[${s}]]
path: ${o}
type: ${u}
modified: ${new Date(i.timestamp).toISOString()}

`}n&&r.push(`## Other Files
${n}`)}return`
# Project Context
The following information is the relevant context for this project. Use this information to inform your responses when appropriate:

<ProjectContext>
${r.join(`

`)}
</ProjectContext>
`}async processMarkdownFiles(e,r,n){if(F(`[processMarkdownFiles] Starting for project: ${e.name}`),r.markdownNeedsReload||!r.markdownContext||!r.markdownContext.trim()){F(`[processMarkdownFiles] Project ${e.name}: Processing markdown content.`);let o=await this.processMarkdownFileContext(n);this.projectContextCache.updateProjectMarkdownFilesFromPatterns(e,r,n),r.markdownContext=o,r.markdownNeedsReload=!1,F(`[processMarkdownFiles] Project ${e.name}: Markdown content updated.`)}else F(`[processMarkdownFiles] Project ${e.name}: Markdown content already up-to-date.`);return F(`[processMarkdownFiles] Completed for project: ${e.name}. Total fileContexts: ${Object.keys(r.fileContexts||{}).length}`),r}async processMarkdownFileContext(e){let r=e.filter(o=>o.extension==="md");F(`Found ${r.length} markdown files to process for project context`);let n=await Promise.all(r.map(async o=>{let i="",a="";try{let[s,u]=await this.loadTracker.executeWithProcessTracking(o.path,"md",async()=>Promise.all([this.app.vault.adapter.stat(o.path),this.app.vault.read(o)]));a=`[[${o.basename}]]
path: ${o.path}
type: ${o.extension}
created: ${s?new Date(s.ctime).toISOString():"unknown"}
modified: ${s?new Date(s.mtime).toISOString():"unknown"}`,i=u,F(`Completed processing markdown file: ${o.path}`)}catch(s){ie(`Error processing file ${o.path}: ${s}`),i=`[Error: ${Wr(s)}]`}return`${a}

${i}`}));return F("All markdown files processed for project context"),n.join(`

`)}async processWebUrls(e,r){F(`[processWebUrls] Starting for project: ${e.name}`);let n=e.contextSource?.webUrls?.trim()||"";if(!n)return Object.keys(r.webContexts).length>0&&(F(`[processWebUrls] Project ${e.name}: Clearing all Web contexts as none are configured.`),r.webContexts={}),r;let o=n.split(`
`).filter(c=>c.trim());F(`[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&&F(`[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){F(`[processWebUrls] Project ${e.name}: Removing ${s.length} obsolete Web URL contexts.`);for(let c of s)delete r.webContexts[c]}let u=a.map(async c=>{let d=await this.processWebUrlContext(c);return d&&F(`[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&&Ce(`[processWebUrls] Project ${e.name}: Fetched empty content for Web URL: ${c.url}`)}),F(`[processWebUrls] Completed for project: ${e.name}. Total Web contexts: ${Object.keys(r.webContexts).length}`),r}async processYoutubeUrls(e,r){F(`[processYoutubeUrls] Starting for project: ${e.name}`);let n=e.contextSource?.youtubeUrls?.trim()||"";if(!n)return Object.keys(r.youtubeContexts).length>0&&(F(`[processYoutubeUrls] Project ${e.name}: Clearing all YouTube contexts as none are configured.`),r.youtubeContexts={}),r;let o=n.split(`
`).filter(c=>c.trim());F(`[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&&F(`[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){F(`[processYoutubeUrls] Project ${e.name}: Removing ${s.length} obsolete YouTube URL contexts.`);for(let c of s)delete r.youtubeContexts[c]}let u=a.map(async c=>{let d=await this.processYoutubeUrlContext(c);return d&&F(`[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&&Ce(`[processYoutubeUrls] Project ${e.name}: Fetched empty transcript for YouTube URL: ${c.url}`)}),F(`[processYoutubeUrls] Completed for project: ${e.name}. Total YouTube contexts: ${Object.keys(r.youtubeContexts).length}`),r}async processWebUrlContext(e){if(!e?.trim())return"";try{let r=QG.getInstance(),{urlContext:n}=await this.loadTracker.executeWithProcessTracking(e,"web",async()=>{let o=await r.processUrls(e);if(o.processedErrorUrls[e])throw new Error(o.processedErrorUrls[e]);return o});return n||""}catch(r){return ie(`Failed to process web URL: ${r}`),""}}async processYoutubeUrlContext(e){if(!e?.trim())return"";try{let r=await this.loadTracker.executeWithProcessTracking(e,"youtube",async()=>Xl.getInstance().youtube4llm(e));return r.response.transcript?`

YouTube transcript from ${e}:
${r.response.transcript}`:""}catch(r){return ie(`Failed to process YouTube URL ${e}: ${r}`),new e3.Notice(`Failed to process YouTube URL ${e}: ${Wr(r)}`),""}}async processNonMarkdownFiles(e,r){let n=r.filter(i=>i.extension!=="md");if(F(`[loadProjectContext] Project ${e.name}: Checking for non-markdown processing: ${n.length} files .`),n.length<=0)return;this.fileParserManager=new pq(Xl.getInstance(),this.app.vault,!0,e);let o=0;for(let i of n){let a=i.path;if(this.fileParserManager.supportsExtension(i.extension))try{await this.loadTracker.executeWithProcessTracking(a,"nonMd",async()=>{let s=await this.projectContextCache.getOrReuseFileContext(e,a);s?(await fq(i,s,this.app.vault),o++):(F(`[loadProjectContext] Project ${e.name}: Parsing/caching new/updated file: ${a}`),await this.fileParserManager.parseFile(i,this.app.vault),o++)})}catch(s){if(ie(`[loadProjectContext] Project ${e.name}: Error parsing file ${a}:`,s),ED(s))throw s}}o>0&&F(`[loadProjectContext] Project ${e.name}: Processed and cached ${o} non-markdown files.`)}async retryFailedItem(e){try{if(!this.currentProjectId){Ce("[retryFailedItem] No current project, aborting retry");return}let r=ee().projectList.find(n=>n.id===this.currentProjectId);if(!r){ie(`[retryFailedItem] Current project not found: ${this.currentProjectId}`);return}switch(F(`[retryFailedItem] Starting retry for ${e.type} item: ${e.path}`),e.type){case"web":await this.retryWebUrl(r,e.path);break;case"youtube":await this.retryYoutubeUrl(r,e.path);break;case"md":await this.retryMarkdownFile(r,e.path);break;case"nonMd":await this.retryNonMarkdownFile(r,e.path);break;default:Ce(`[retryFailedItem] Unknown item type: ${e.type}`);return}F(`[retryFailedItem] Successfully retried ${e.type} item: ${e.path}`),new e3.Notice(`Retry successful: ${e.path}`)}catch(r){ie(`[retryFailedItem] Failed to retry ${e.type} item ${e.path}:`,r),new e3.Notice(`Retry failed: ${Wr(r)}`)}}async retryWebUrl(e,r){let n=await this.processWebUrlContext(r);if(!n){Ce(`[retryWebUrl] Project ${e.name}: Fetched empty content for Web URL: ${r}`);return}F(`[retryWebUrl] Project ${e.name}: Successfully fetched content for URL: ${r.substring(0,50)}...`),await this.projectContextCache.updateWebUrl(e,r,n)}async retryYoutubeUrl(e,r){let n=await this.processYoutubeUrlContext(r);if(!n){Ce(`[retryYoutubeUrl] Project ${e.name}: Fetched empty transcript for YouTube URL: ${r}`);return}F(`[retryYoutubeUrl] Project ${e.name}: Successfully fetched transcript for YouTube URL: ${r.substring(0,50)}...`),await this.projectContextCache.updateYoutubeUrl(e,r,n)}async retryMarkdownFile(e,r){let n=this.app.vault.getAbstractFileByPath(r);if(!(n instanceof e3.TFile)||n.extension!=="md")throw new Error(`File not found or not a markdown file: ${r}`);try{await this.loadTracker.executeWithProcessTracking(n.path,"md",async()=>{}),F(`[retryMarkdownFile] Successfully reprocessed markdown file: ${r}`),await this.projectContextCache.invalidateMarkdownContext(e)}catch(o){throw ie(`[retryMarkdownFile] Error processing file ${r}: ${o}`),o}}async retryNonMarkdownFile(e,r){let n=this.app.vault.getAbstractFileByPath(r);if(!(n instanceof e3.TFile)||n.extension==="md")throw new Error(`File not found or is a markdown file: ${r}`);if(!this.fileParserManager.supportsExtension(n.extension))throw new Error(`Unsupported file extension: ${n.extension}`);try{await this.loadTracker.executeWithProcessTracking(r,"nonMd",async()=>this.fileParserManager.parseFile(n,this.app.vault)),F(`[retryNonMarkdownFile] Successfully reprocessed non-markdown file: ${r}`)}catch(o){throw ie(`[retryNonMarkdownFile] Error processing file ${r}: ${o}`),o}}getProjectAllFiles(e){let{inclusions:r,exclusions:n}=Zl({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0});return this.app.vault.getFiles().filter(o=>fu(o,r,n,!0))}onunload(){this.projectContextCache.cleanup()}};na();h4();Xe();var DWr=require("obsidian");xn();var bje=$(K());zr();var ni=bje.forwardRef(({className:t,type:e,...r},n)=>bje.createElement("input",{type:e,className:Se("!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}));ni.displayName="Input";var vje=$(K());var sWr=$(K(),1);var oWr=$(K(),1),iii=$(yu(),1);var Gm=$(K(),1);var Qoi=$(K(),1);function tWr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function rWr(...t){return e=>{let r=!1,n=t.map(o=>{let i=tWr(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():tWr(t[o],null)}}}}var _je=$(wt(),1);function nWr(t){let e=eii(t),r=Gm.forwardRef((n,o)=>{let{children:i,...a}=n,s=Gm.Children.toArray(i),u=s.find(rii);if(u){let l=u.props.children,c=s.map(d=>d===u?Gm.Children.count(l)>1?Gm.Children.only(null):Gm.isValidElement(l)?l.props.children:null:d);return(0,_je.jsx)(e,{...a,ref:o,children:Gm.isValidElement(l)?Gm.cloneElement(l,void 0,c):null})}return(0,_je.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function eii(t){let e=Gm.forwardRef((r,n)=>{let{children:o,...i}=r;if(Gm.isValidElement(o)){let a=oii(o),s=nii(i,o.props);return o.type!==Gm.Fragment&&(s.ref=n?rWr(n,a):a),Gm.cloneElement(o,s)}return Gm.Children.count(o)>1?Gm.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var tii=Symbol("radix.slottable");function rii(t){return Gm.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===tii}function nii(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function oii(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 iWr=$(wt(),1),aii=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],aWr=aii.reduce((t,e)=>{let r=nWr(`Primitive.${e}`),n=oWr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,iWr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var uWr=$(wt(),1),sii="Label",lWr=sWr.forwardRef((t,e)=>(0,uWr.jsx)(aWr.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));lWr.displayName=sii;var Ght=lWr;_be();zr();var lii=R5("tw-text-sm tw-font-medium tw-leading-none peer-disabled:tw-cursor-not-allowed peer-disabled:tw-opacity-70"),uc=vje.forwardRef(({className:t,...e},r)=>vje.createElement(Ght,{ref:r,className:Se(lii(),t),...e}));uc.displayName=Ght.displayName;var YX=$(K());var r_=$(K(),1);var dWr=$(K(),1);function cWr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Xht(...t){return e=>{let r=!1,n=t.map(o=>{let i=cWr(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():cWr(t[o],null)}}}}function Nce(...t){return dWr.useCallback(Xht(...t),t)}var R$=$(K(),1),fWr=$(wt(),1);function pWr(t,e=[]){let r=[];function n(i,a){let s=R$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=R$.useMemo(()=>m,Object.values(m));return(0,fWr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=R$.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=>R$.createContext(a));return function(s){let u=s?.[t]||i;return R$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,cii(o,...e)]}function cii(...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 R$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var EOs=!!(typeof window<"u"&&window.document&&window.document.createElement);function Zht(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var G0=$(K(),1);var mWr=$(K(),1),t3=globalThis?.document?mWr.useLayoutEffect:()=>{};var wje=$(K(),1);var dii=G0[" useInsertionEffect ".trim().toString()]||t3;function hWr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=fii({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=G0.useRef(t!==void 0);G0.useEffect(()=>{let d=c.current;d!==s&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}let l=G0.useCallback(c=>{if(s){let d=pii(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function fii({defaultProp:t,onChange:e}){let[r,n]=G0.useState(t),o=G0.useRef(r),i=G0.useRef(e);return dii(()=>{i.current=e},[e]),G0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function pii(t){return typeof t=="function"}var IOs=Symbol("RADIX:SYNC_STATE");var Sje=$(K(),1);function gWr(t){let e=Sje.useRef({value:t,previous:t});return Sje.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var yWr=$(K(),1);function bWr(t){let[e,r]=yWr.useState(void 0);return t3(()=>{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 wv=$(K(),1);var _Wr=$(K(),1);function mii(t,e){return _Wr.useReducer((r,n)=>e[r][n]??r,t)}var Yht=t=>{let{present:e,children:r}=t,n=hii(e),o=typeof r=="function"?r({present:n.isPresent}):wv.Children.only(r),i=Nce(n.ref,gii(o));return typeof r=="function"||n.isPresent?wv.cloneElement(o,{ref:i}):null};Yht.displayName="Presence";function hii(t){let[e,r]=wv.useState(),n=wv.useRef(null),o=wv.useRef(t),i=wv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=mii(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return wv.useEffect(()=>{let l=Cje(n.current);i.current=s==="mounted"?l:"none"},[s]),t3(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Cje(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),t3(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Cje(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=Cje(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:wv.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function Cje(t){return t?.animationName||"none"}function gii(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 wWr=$(K(),1),Sii=$(yu(),1);var Xm=$(K(),1);var xje=$(wt(),1);function vWr(t){let e=yii(t),r=Xm.forwardRef((n,o)=>{let{children:i,...a}=n,s=Xm.Children.toArray(i),u=s.find(_ii);if(u){let l=u.props.children,c=s.map(d=>d===u?Xm.Children.count(l)>1?Xm.Children.only(null):Xm.isValidElement(l)?l.props.children:null:d);return(0,xje.jsx)(e,{...a,ref:o,children:Xm.isValidElement(l)?Xm.cloneElement(l,void 0,c):null})}return(0,xje.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function yii(t){let e=Xm.forwardRef((r,n)=>{let{children:o,...i}=r;if(Xm.isValidElement(o)){let a=wii(o),s=vii(i,o.props);return o.type!==Xm.Fragment&&(s.ref=n?Xht(n,a):a),Xm.cloneElement(o,s)}return Xm.Children.count(o)>1?Xm.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var bii=Symbol("radix.slottable");function _ii(t){return Xm.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===bii}function vii(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function wii(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 SWr=$(wt(),1),Cii=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Tje=Cii.reduce((t,e)=>{let r=vWr(`Primitive.${e}`),n=wWr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,SWr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Zw=$(wt(),1),Oje="Checkbox",[xii,ZOs]=pWr(Oje),[Tii,Qht]=xii(Oje);function Oii(t){let{__scopeCheckbox:e,checked:r,children:n,defaultChecked:o,disabled:i,form:a,name:s,onCheckedChange:u,required:l,value:c="on",internal_do_not_use_render:d}=t,[f,p]=hWr({prop:r,defaultProp:o??!1,onChange:u,caller:Oje}),[m,h]=r_.useState(null),[y,g]=r_.useState(null),b=r_.useRef(!1),_=m?!!a||!!m.closest("form"):!0,w={checked:f,disabled:i,setChecked:p,control:m,setControl:h,name:s,form:a,value:c,hasConsumerStoppedPropagationRef:b,required:l,defaultChecked:eU(o)?!1:o,isFormControl:_,bubbleInput:y,setBubbleInput:g};return(0,Zw.jsx)(Tii,{scope:e,...w,children:Eii(d)?d(w):n})}var CWr="CheckboxTrigger",xWr=r_.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:r,...n},o)=>{let{control:i,value:a,disabled:s,checked:u,required:l,setControl:c,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=Qht(CWr,t),h=Nce(o,c),y=r_.useRef(u);return r_.useEffect(()=>{let g=i?.form;if(g){let b=()=>d(y.current);return g.addEventListener("reset",b),()=>g.removeEventListener("reset",b)}},[i,d]),(0,Zw.jsx)(Tje.button,{type:"button",role:"checkbox","aria-checked":eU(u)?"mixed":u,"aria-required":l,"data-state":PWr(u),"data-disabled":s?"":void 0,disabled:s,value:a,...n,ref:h,onKeyDown:Zht(e,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:Zht(r,g=>{d(b=>eU(b)?!0:!b),m&&p&&(f.current=g.isPropagationStopped(),f.current||g.stopPropagation())})})});xWr.displayName=CWr;var Eje=r_.forwardRef((t,e)=>{let{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:a,disabled:s,value:u,onCheckedChange:l,form:c,...d}=t;return(0,Zw.jsx)(Oii,{__scopeCheckbox:r,checked:o,defaultChecked:i,disabled:s,required:a,onCheckedChange:l,name:n,form:c,value:u,internal_do_not_use_render:({isFormControl:f})=>(0,Zw.jsxs)(Zw.Fragment,{children:[(0,Zw.jsx)(xWr,{...d,ref:e,__scopeCheckbox:r}),f&&(0,Zw.jsx)(EWr,{__scopeCheckbox:r})]})})});Eje.displayName=Oje;var TWr="CheckboxIndicator",egt=r_.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=Qht(TWr,r);return(0,Zw.jsx)(Yht,{present:n||eU(i.checked)||i.checked===!0,children:(0,Zw.jsx)(Tje.span,{"data-state":PWr(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});egt.displayName=TWr;var OWr="CheckboxBubbleInput",EWr=r_.forwardRef(({__scopeCheckbox:t,...e},r)=>{let{control:n,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:a,required:s,disabled:u,name:l,value:c,form:d,bubbleInput:f,setBubbleInput:p}=Qht(OWr,t),m=Nce(r,p),h=gWr(i),y=bWr(n);r_.useEffect(()=>{let b=f;if(!b)return;let _=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(_,"checked").set,O=!o.current;if(h!==i&&T){let E=new Event("click",{bubbles:O});b.indeterminate=eU(i),T.call(b,eU(i)?!1:i),b.dispatchEvent(E)}},[f,h,i,o]);let g=r_.useRef(eU(i)?!1:i);return(0,Zw.jsx)(Tje.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??g.current,required:s,disabled:u,name:l,value:c,form:d,...e,tabIndex:-1,ref:m,style:{...e.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});EWr.displayName=OWr;function Eii(t){return typeof t=="function"}function eU(t){return t==="indeterminate"}function PWr(t){return eU(t)?"indeterminate":t?"checked":"unchecked"}Mr();zr();var Uu=YX.forwardRef(({className:t,...e},r)=>YX.createElement(Eje,{ref:r,className:Se("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},YX.createElement(egt,{className:Se("tw-flex tw-items-center tw-justify-center tw-text-current")},YX.createElement(Yu,{className:"tw-size-4"}))));Uu.displayName=Eje.displayName;var X0=$(K());zr();var n_=X0.forwardRef(({className:t,value:e,...r},n)=>{let o=X0.useRef(null),i=X0.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);X0.useLayoutEffect(()=>{i()},[e,i]),X0.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 X0.createElement("textarea",{className:Se("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})});n_.displayName="Textarea";var ks=$(K()),jWr=$(Im());Qe();var eN=$(K());Dt();Mr();gr();var tgt=({capabilities:t=[],iconSize:e=16})=>eN.default.createElement(eN.default.Fragment,null,t.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return eN.default.createElement(ex,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return eN.default.createElement(S1,{key:n,className:"tw-text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return eN.default.createElement(_l,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),rgt=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return eN.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-1"},eN.default.createElement("span",{className:"tw-truncate tw-text-sm hover:tw-text-normal"},r),t.capabilities&&t.capabilities.length>0&&eN.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-0.5"},eN.default.createElement(tgt,{capabilities:t.capabilities,iconSize:e})))},MWr=t=>{let e=t.displayName||t.name,r=`(${wg(t.provider)})`;return`${e} ${r}`},QX=t=>{let e=t.displayName||t.name,r=`(${wg(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}`};zr();Mr();Xe();var tN=$(K());function RWr(){return tN.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},tN.default.createElement("li",null,tN.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{}")," represents the selected text."),tN.default.createElement("li",null,tN.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),tN.default.createElement("li",null,tN.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),tN.default.createElement("li",null,tN.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{#tag1, #tag2}")," represents ALL notes with ANY of the specified tags in their property (an OR operation)."))}var ngt="{copilot-selection}";var rN={title:"",content:"",showInContextMenu:!0,showInSlashMenu:!0,order:0,modelKey:"",lastUsedMs:0},I$="copilot-command-context-menu-enabled",A$="copilot-command-slash-enabled",nN="copilot-command-context-menu-order",N$="copilot-command-model-key",D$="copilot-command-last-used",IWr=[{title:"Fix grammar and spelling",content:"Fix the grammar and spelling of {}. Preserve all formatting, line breaks, and special characters. Do not add or remove any content. Return only the corrected text.",showInContextMenu:!0,showInSlashMenu:!0,order:1e3,modelKey:"",lastUsedMs:0},{title:"Translate to Chinese",content:`Translate {} into Chinese:
    1. Preserve the meaning and tone
    2. Maintain appropriate cultural context
    3. Keep formatting and structure
    Return only the translated text.`,showInContextMenu:!0,showInSlashMenu:!0,order:1010,modelKey:"",lastUsedMs:0},{title:"Summarize",content:"Create a bullet-point summary of {}. Each bullet point should capture a key point. Return only the bullet-point summary.",showInContextMenu:!0,showInSlashMenu:!0,order:1020,modelKey:"",lastUsedMs:0},{title:"Simplify",content:"Simplify {} to a 6th-grade reading level (ages 11-12). Use simple sentences, common words, and clear explanations. Maintain the original key concepts. Return only the simplified text.",showInContextMenu:!0,showInSlashMenu:!0,order:1030,modelKey:"",lastUsedMs:0},{title:"Explain like I am 5",content:`Explain {} in simple terms that a 5-year-old would understand:
    1. Use basic vocabulary
    2. Include simple analogies
    3. Break down complex concepts
    Return only the simplified explanation.`,showInContextMenu:!0,showInSlashMenu:!0,order:1040,modelKey:"",lastUsedMs:0},{title:"Emojify",content:`Add relevant emojis to enhance {}. Follow these rules:
    1. Insert emojis at natural breaks in the text
    2. Never place two emojis next to each other
    3. Keep all original text unchanged
    4. Choose emojis that match the context and tone
    Return only the emojified text.`,showInContextMenu:!0,showInSlashMenu:!0,order:1050,modelKey:"",lastUsedMs:0},{title:"Make shorter",content:`Reduce {} to half its length while preserving these elements:
    1. Main ideas and key points
    2. Essential details
    3. Original tone and style
    Return only the shortened text.`,showInContextMenu:!0,showInSlashMenu:!0,order:1060,modelKey:"",lastUsedMs:0},{title:"Make longer",content:`Expand {} to twice its length by:
    1. Adding relevant details and examples
    2. Elaborating on key points
    3. Maintaining the original tone and style
    Return only the expanded text.`,showInContextMenu:!0,showInSlashMenu:!0,order:1070,modelKey:"",lastUsedMs:0},{title:"Generate table of contents",content:"Generate a hierarchical table of contents for {}. Use appropriate heading levels (H1, H2, H3, etc.). Include page numbers if present. Return only the table of contents.",showInContextMenu:!1,showInSlashMenu:!1,order:1080,modelKey:"",lastUsedMs:0},{title:"Generate glossary",content:'Create a glossary of important terms, concepts, and phrases from {}. Format each entry as "Term: Definition". Sort entries alphabetically. Return only the glossary.',showInContextMenu:!1,showInSlashMenu:!1,order:1090,modelKey:"",lastUsedMs:0},{title:"Remove URLs",content:"Remove all URLs from {}. Preserve all other content and formatting. URLs may be in various formats (http, https, www). Return only the text with URLs removed.",showInContextMenu:!1,showInSlashMenu:!1,order:1100,modelKey:"",lastUsedMs:0},{title:"Rewrite as tweet",content:`Rewrite {} as a single tweet with these requirements:
    1. Maximum 280 characters
    2. Use concise, impactful language
    3. Maintain the core message
    Return only the tweet text.`,showInContextMenu:!1,showInSlashMenu:!1,order:1110,modelKey:"",lastUsedMs:0},{title:"Rewrite as tweet thread",content:`Convert {} into a Twitter thread following these rules:
    1. Each tweet must be under 240 characters
    2. Start with "THREAD START" on its own line
    3. Separate tweets with "

---

"
    4. End with "THREAD END" on its own line
    5. Make content engaging and clear
    Return only the formatted thread.`,showInContextMenu:!1,showInSlashMenu:!1,order:1120,modelKey:"",lastUsedMs:0},{title:"Clip YouTube Transcript",content:`
Based on the YouTube video information and transcript provided in the context, generate a complete Obsidian note in the following format.

IMPORTANT: If no YouTube video context is found, remind the user to:
1. Open a YouTube video in Web Viewer (or use @ to select a YouTube web tab)
2. Then use this command again

Generate the note with this exact structure:

---
title: "<video title>"
description: "<first 200 chars of description>"
channel: "<channel name>"
url: "<video url>"
duration: "<duration>"
published: <upload date in YYYY-MM-DD format>
thumbnailUrl: "<YouTube thumbnail URL: i.ytimg.com/vi/VIDEO_ID/maxresdefault.jpg with https protocol>"
genre:
  - "<genre>"
watched:
---
![<video title>](<video url>)

> [!summary]- Description
> <full video description, preserve line breaks>

## Summary

<Brief 2-3 paragraph summary of the video content>

## Key Takeaways

<List 5-8 key takeaways as bullet points>

## Mindmap

CRITICAL Mermaid mindmap syntax rules - MUST follow exactly:
- Root node format: root(Topic Name) - use round brackets, NO double brackets
- Child nodes: just plain text, no brackets needed
- Do NOT use quotes, parentheses, brackets, or any special characters in text
- Do NOT use icons or emojis
- Keep all node text short and simple - max 3-4 words per node
- Use only letters, numbers, and spaces

Example of CORRECT syntax:
\`\`\`mermaid
mindmap
  root(Video Main Topic)
    First Theme
      Detail one
      Detail two
    Second Theme
      Detail three
    Third Theme
\`\`\`

## Notable Quotes

<List 5-10 notable quotes from the transcript. Format each as:>
- [<timestamp>: <quote text>](<video_url>&t=<seconds>s)

Return only the markdown content without any explanations or comments.`,showInContextMenu:!1,showInSlashMenu:!0,order:1130,modelKey:"",lastUsedMs:0},{title:"Clip Web Page",content:`
Based on the web page content provided in the context (from Obsidian Web Clipper or Web Viewer), generate a complete Obsidian note.

IMPORTANT: If no web page context is found, remind the user to:
1. Open a web page in Web Viewer (or use @ to select a web tab)
2. Or open a note clipped by Obsidian Web Clipper
3. Then use this command again

Generate the note with this exact structure:

---
title: "<page title>"
source: "<page url>"
description: "<brief description>"
tags:
  - "clippings"
---

## Summary

<Brief 2-3 paragraph summary of the page content>

## Key Takeaways

<List 5-8 key takeaways as bullet points>

## Mindmap

CRITICAL Mermaid mindmap syntax rules - MUST follow exactly:
- Root node format: root(Topic Name) - use round brackets, NO double brackets
- Child nodes: just plain text, no brackets needed
- Do NOT use quotes, parentheses, brackets, or any special characters in text
- Keep all node text short and simple - max 3-4 words per node

\`\`\`mermaid
mindmap
  root(Main Topic)
    Theme One
      Detail
    Theme Two
      Detail
\`\`\`

## Notable Quotes

<List 3-5 notable quotes from the content, if any>

Return only the markdown content without any explanations or comments.`,showInContextMenu:!1,showInSlashMenu:!0,order:1140,modelKey:"",lastUsedMs:0}];Xe();var eZ=require("obsidian");Qe();LC();LC();var r3=QL(),n3=yc([]),ogt=new Set;function o3(t){ogt.add(t)}function i3(t){ogt.delete(t)}function Dce(t){return ogt.has(t)}function jce(t){let e=r3.get(n3);r3.set(n3,e.filter(r=>r.title!==t))}function a3(t,e){let r=r3.get(n3),n;(e?r.findIndex(i=>i.title===e):-1)!==-1?n=r.map(i=>i.title===e?t:i):n=[...r,t],r3.set(n3,n)}function Pje(t){r3.set(n3,t)}function Mje(){return I_(n3,{store:r3})}function Sv(){return r3.get(n3)}fte();Dt();t1();gr();function Rje(t,e,r){let n=t.trim();return n?t!==n?"Command name cannot have leading or trailing spaces":r&&t===r?null:/[#<>:"/\\|?*[\]^\x00-\x1F]/g.test(n)?'Command name contains invalid characters. Avoid using: < > : " / \\ | ? * [ ] ^':e.some(i=>i.title.toLowerCase()===n.toLowerCase())?"A command with this name already exists":null:"Command name cannot be empty"}function tZ(t){return encodeURIComponent(t.toLowerCase())}function tU(){return(0,eZ.normalizePath)(ee().customPromptsFolder)}function rZ(t){return`${tU()}/${t}.md`}function nZ(t){if(!(t instanceof eZ.TFile)||t.extension!=="md")return!1;let e=tU();return!(!t.path.startsWith(e+"/")||t.path.slice(e.length+1).includes("/"))}function AWr(t){return app.metadataCache.getFileCache(t)?.frontmatter?.[nN]!=null}async function $ce(t){let e=await app.vault.read(t),r=jJ(e),n=app.metadataCache.getFileCache(t),o=n?.frontmatter?.[I$]??rN.showInContextMenu,i=n?.frontmatter?.[A$]??rN.showInSlashMenu,a=n?.frontmatter?.[D$]??rN.lastUsedMs,s=n?.frontmatter?.[nN]??rN.order,u=n?.frontmatter?.[N$]??rN.modelKey;return{title:t.basename,modelKey:u,content:r,showInContextMenu:o,showInSlashMenu:i,order:s,lastUsedMs:a}}async function Ije(){let t=app.vault.getFiles().filter(r=>nZ(r)),e=await Promise.all(t.map($ce));return Pje(e),e}function Lce(t){return iO(t,"manual",{getName:e=>e.title,getCreatedAtMs:()=>0,getLastUsedAtMs:()=>0,getManualOrder:e=>e.order})}function Mii(t){return iO(t,"recent",{getName:e=>e.title,getCreatedAtMs:()=>0,getLastUsedAtMs:e=>e.lastUsedMs})}function Rii(t){return iO(t,"name",{getName:e=>e.title,getCreatedAtMs:()=>0,getLastUsedAtMs:()=>0})}function Aje(t){switch(ee().promptSortStrategy){case"timestamp":return Mii(t);case"alphabetical":return Rii(t);case"manual":return Lce(t);default:return t}}async function Fce(t,e,r=!1){let o=(await kce(t,e,app.vault,app.workspace.getActiveFile())).processedPrompt;if(o.includes(`{${N_}}`)||r)return o;let i=o.indexOf(ngt);return i===-1?e.trim()?o+`

<`+N_+">"+e+"</"+N_+">":o:o.slice(0,i)+e+o.slice(i+ngt.length)}var Iii=/\{(?!copilot-selection\}|\[\[)([^}]+)\}/g;async function Aii(t,e,r){let n=new Map,o=new Set,i;for(;(i=Iii.exec(t))!==null;){let a=i[1].trim(),s={content:"",files:[]},u=a.toLowerCase();if(u==="activenote")if(r){let l=await $J(r,e);l&&(s.content=`<${_4}>
<path>${r.path}</path>
## ${Pge(r)}

${l}
</${_4}>`,s.files.push(r))}else new eZ.Notice("No active note found.");else{if(u==="activewebtab")continue;if(a.startsWith("#")){let l=a.slice(1).split(",").map(f=>f.trim()),c=await Oge(e,l),d=[];for(let f of c){let p=await $J(f,e);p&&(d.push(`<${_4}>
<path>${f.path}</path>
## ${Pge(f)}

${p}
</${_4}>`),s.files.push(f))}s.content=d.join(`

`)}else{let l=bNt(a),c=await ite(e,l),d=[];for(let f of c){let p=await $J(f,e);p&&(d.push(`<${_4}>
<path>${f.path}</path>
## ${Pge(f)}

${p}
</${_4}>`),s.files.push(f))}s.content=d.join(`

`)}}s.content?(n.set(a,s.content),s.files.forEach(l=>o.add(l))):u!=="activenote"&&u!=="activewebtab"&&(a.startsWith('"')||Ce(`No notes found for variable: ${a}`))}return{variablesMap:n,includedFiles:o}}async function kce(t,e,r,n,o=!1){let i=ee(),a=new Set;if(!i.enableCustomPromptTemplating)return!o&&t.includes("{}")&&!e&&n&&a.add(n),{processedPrompt:t+`

`,includedFiles:Array.from(a)};let{variablesMap:s,includedFiles:u}=await Aii(t,r,n);u.forEach(p=>a.add(p));let l=t,c="",d=null;!o&&l.includes("{}")&&(l=l.replace(/\{\}/g,`{${N_}}`),e?c+=`<${N_}>
${e}
</${N_}>`:n?(d=await $J(n,r),c+=`<${N_} type="active_note">
${d||""}
</${N_}>`,a.add(n)):c+=`<${N_}>
(No selected text or active note available)
</${N_}>`);for(let[p,m]of s.entries())p.toLowerCase()==="activenote"&&d!==null||(c?c+=`

<${mte} name="${p}">
${m}
</${mte}>`:c+=`<${mte} name="${p}">
${m}
</${mte}>`);let f=yNt(l,r);for(let p of f)if(!a.has(p)){let m=await $J(p,r);if(m){let h=await r.adapter.stat(p.path),y=h?new Date(h.ctime).toISOString():"Unknown",g=h?new Date(h.mtime).toISOString():"Unknown",b=`<${pte}>
<title>${p.basename}</title>
<path>${p.path}</path>
<ctime>${y}</ctime>
<mtime>${g}</mtime>
<content>
${m}
</content>
</${pte}>`;c&&(c+=`

`),c+=`${b}`,a.add(p)}}return{processedPrompt:c?`${l}

${c}`:`${l}

`,includedFiles:Array.from(a)}}function NWr(t,e){let n=`${t} (copy)`,o=1;for(;e.some(i=>i.title.toLowerCase()===n.toLowerCase());)o++,n=`${t} (copy ${o})`;return n}function Nje(){let e=Sv().reduce((r,n)=>r>n.order?r:n.order,0);return e===Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+10}async function igt(t,e){try{o3(t.path),await app.fileManager.processFrontMatter(t,r=>{r[I$]==null&&(r[I$]=e.showInContextMenu),r[A$]==null&&(r[A$]=e.showInSlashMenu),r[nN]==null&&(r[nN]=e.order),r[N$]==null&&(r[N$]=e.modelKey),r[D$]==null&&(r[D$]=e.lastUsedMs)})}finally{i3(t.path)}}function Nii({commands:t,command:e,onConfirm:r,onCancel:n}){let i=kr().activeModels.filter(f=>f.enabled).map(f=>({label:MWr(f),value:no(f)})),[a,s]=(0,ks.useState)(e),[u,l]=(0,ks.useState)({}),c=(f,p)=>{s(m=>({...m,[f]:p})),l(m=>({...m,[f]:void 0}))},d=()=>{let f={},p=Rje(a.title,t,e.title);if(p&&(f.title=p),a.content.trim()||(f.content="Prompt is required"),Object.keys(f).length>0){l(f);return}r(a)};return ks.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},ks.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},ks.default.createElement(uc,{htmlFor:"title"},"Name"),ks.default.createElement(ni,{id:"title",value:a.title,onChange:f=>c("title",f.target.value),placeholder:"Enter command name"}),u.title&&ks.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.title)),ks.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},ks.default.createElement(uc,{htmlFor:"content"},"Prompt"),ks.default.createElement(RWr,null),ks.default.createElement(n_,{id:"content",value:a.content,onChange:f=>c("content",f.target.value),placeholder:"Enter command prompt",className:"tw-min-h-[200px]"}),u.content&&ks.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.content)),ks.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},ks.default.createElement(uc,{htmlFor:"modelKey"},"Model (Optional)"),ks.default.createElement("div",{className:"tw-group tw-relative tw-w-full"},ks.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)){ie(`Model ${p} not found`),c("modelKey","");return}c("modelKey",f.target.value)},className:Se("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")},ks.default.createElement("option",{value:""},"Inherit from chat model"),i.map(f=>ks.default.createElement("option",{key:f.value,value:f.value.toString()},f.label))),ks.default.createElement("div",{className:Se("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")},ks.default.createElement(Ji,{className:"tw-size-4"})))),ks.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ks.default.createElement(Uu,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),ks.default.createElement(uc,{htmlFor:"showInContextMenu"},"Show in context menu")),ks.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ks.default.createElement(Uu,{id:"showInSlashMenu",checked:a.showInSlashMenu,onCheckedChange:f=>c("showInSlashMenu",f)}),ks.default.createElement(uc,{htmlFor:"showInSlashMenu"},"Show in slash menu")),ks.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},ks.default.createElement(me,{variant:"secondary",onClick:n},"Cancel"),ks.default.createElement(me,{variant:"default",onClick:d},"Save")))}var rU=class extends DWr.Modal{constructor(r,n,o,i){super(r);this.commands=n;this.command=o;this.onUpdate=i;this.setTitle("Edit Command")}onOpen(){let{contentEl:r}=this;this.root=(0,jWr.createRoot)(r);let n=o=>{this.onUpdate(o),this.close()};this.root.render(ks.default.createElement(Nii,{commands:this.commands,command:this.command,onConfirm:n,onCancel:()=>this.close()}))}onClose(){this.root.unmount()}};var qce=require("obsidian");OS();Dt();var Zm=class t{static getInstance(){return t.instance||(t.instance=new t),t.instance}async createCommand(e,r={}){let n={skipStoreUpdate:!1,autoOrder:!0,...r},o=rZ(e.title);try{o3(o);let i=e.order;n.autoOrder&&(i=Nje()),e={...e,order:i};let a=tU();await ql(a);let s=app.vault.getAbstractFileByPath(o);!s||!(s instanceof qce.TFile)?s=await app.vault.create(o,e.content):await app.vault.modify(s,e.content),await app.fileManager.processFrontMatter(s,u=>{u[I$]=e.showInContextMenu,u[A$]=e.showInSlashMenu,u[nN]=e.order,u[N$]=e.modelKey,u[D$]=e.lastUsedMs}),n.skipStoreUpdate||a3(e,e.title)}finally{i3(o)}}async recordUsage(e){this.updateCommand({...e,lastUsedMs:Date.now()},e.title)}async updateCommand(e,r,n=!1){let o=rZ(e.title),i=rZ(r),a=e.title!==r;try{o3(o),a&&o3(i),n||a3(e,r);let s=app.vault.getAbstractFileByPath(o);if(a){if(app.vault.getAbstractFileByPath(o))throw new qo("Error saving custom prompt. Please check if the title already exists.");let l=app.vault.getAbstractFileByPath(i);l instanceof qce.TFile&&(await app.vault.rename(l,o),s=app.vault.getAbstractFileByPath(o))}s||(await this.createCommand(e,{skipStoreUpdate:n,autoOrder:!0}),s=app.vault.getAbstractFileByPath(rZ(e.title))),s instanceof qce.TFile&&(await app.vault.modify(s,e.content),await app.fileManager.processFrontMatter(s,u=>{u[I$]=e.showInContextMenu,u[A$]=e.showInSlashMenu,u[nN]=e.order,u[N$]=e.modelKey,u[D$]=e.lastUsedMs}))}finally{i3(o),a&&i3(i)}}async updateCommands(e){Pje(e),await Promise.all(e.map(r=>this.updateCommand(r,r.title,!0)))}async reorderCommands(e){let r=[...e];for(let n=0;n<r.length;n++)r[n]={...r[n],order:n*10};await this.updateCommands(r)}async deleteCommand(e){let r=rZ(e.title);try{o3(r),jce(e.title);let n=app.vault.getAbstractFileByPath(r);n instanceof qce.TFile&&await app.vault.delete(n)}finally{i3(r)}}};var Dje=`
You are an AI assistant designed to execute user instructions with precision. Your responses should be:

- Direct and focused: Address only what is explicitly requested
- Concise: Avoid unnecessary elaboration unless the user asks for details
- Context-aware: When text is selected or highlighted, treat it as the primary target for any requested action
- Action-oriented: Prioritize completing the task over explaining the process

Key principles:

- Follow instructions literally and completely
- Assume selected/highlighted text is the focus unless told otherwise
- Use all provided context: Consider any additional information, examples, or constraints the user provides to better complete the task
- Add explanations only when explicitly requested or when clarification is essential
- Maintain the user's preferred format and style

Response format: Match the format implied by the user's request (e.g., if they ask for a list, provide a list; if they ask for a rewrite, provide only the rewritten text).
`;function jje(t,e){if(!e)return t;let r=t.includes("{}"),n=/\{activenote\}/i.test(t),o=[];return r||o.push("{}"),n||o.push("{activeNote}"),o.length>0?t+`

${o.join(`

`)}`:t}na();var agt=$(K());zr();function sgt({onMouseDown:t,className:e}){return agt.createElement("div",{className:Se("tw-flex tw-h-4 tw-items-center tw-justify-center","tw-cursor-grab active:tw-cursor-grabbing","hover:tw-bg-[color-mix(in_srgb,var(--background-modifier-hover)_20%,transparent)]",e),onMouseDown:t},agt.createElement("div",{className:"tw-h-[5px] tw-w-16 tw-rounded-sm tw-bg-[color-mix(in_srgb,var(--text-muted)_40%,transparent)] hover:tw-bg-[color-mix(in_srgb,var(--text-muted)_65%,transparent)]"}))}var ugt=$(K());Mr();zr();xn();function lgt({onClose:t,className:e}){return ugt.createElement(me,{className:Se("tw-absolute tw-right-2 tw-top-1 tw-rounded tw-p-1 tw-text-normal",e),variant:"ghost2",onClick:t,title:"Close","aria-label":"Close"},ugt.createElement(Ho,{className:"tw-size-4"}))}var $je=$(K());Mr();zr();function cgt({icon:t,label:e,className:r}){let n=t===null?null:t!==void 0?t:$je.createElement(DF,{className:"tw-size-4 tw-text-muted"});return $je.createElement("div",{className:Se("tw-flex tw-flex-none tw-items-center tw-justify-center tw-gap-2","tw-px-4 tw-py-2",r)},n,$je.createElement("span",{className:"tw-truncate tw-text-sm tw-font-medium tw-text-normal"},e))}var hm=$(K());zr();Mr();xn();var s3=$(K());function $Wr({content:t,renderMarkdown:e,className:r}){let n=s3.useRef(null),o=s3.useRef(0);return s3.useEffect(()=>{let i=n.current;if(!i)return;let a=++o.current,s=i.ownerDocument.createElement("div");i.innerHTML="",e(t,s).then(()=>{a===o.current&&(i.replaceChildren(...Array.from(s.childNodes)),s.classList.contains("markdown-rendered")&&i.classList.add("markdown-rendered"))}).catch(()=>{a===o.current&&(i.textContent=t)})},[t,e]),s3.createElement("div",{ref:n,className:r})}function dgt({state:t,editable:e=!1,value:r,onChange:n,placeholder:o="Ready to generate...",className:i,minHeight:a="180px",disableAutoGrow:s=!1,renderMarkdown:u}){let l=hm.useRef(null),[c,d]=hm.useState(!1),f=t.type==="result"&&!t.isStreaming,p=!!u&&f&&!c,m=t.type==="loading"||t.type==="result"&&t.isStreaming;hm.useEffect(()=>{m&&d(!1)},[m]),hm.useEffect(()=>{t.type==="result"&&t.isStreaming&&l.current&&(l.current.scrollTop=l.current.scrollHeight)},[t]);let h="",y=!0;if(t.type==="idle"?(h="",y=!0):t.type==="loading"?(h="loading...",y=!0):t.type==="result"&&(h=e&&r!==void 0?r:t.text,y=t.isStreaming||!e),p&&u){let b=e&&r!==void 0?r:t.text;return hm.createElement("div",{className:Se("tw-flex tw-min-h-0 tw-flex-1 tw-flex-col tw-px-4 tw-py-2",i)},hm.createElement("div",{className:"tw-relative tw-min-h-0 tw-flex-1 tw-overflow-auto tw-rounded-md tw-border tw-border-solid tw-px-3 tw-py-2"},hm.createElement($Wr,{content:b,renderMarkdown:u,className:"tw-pr-6 tw-text-sm"}),e&&hm.createElement(me,{variant:"ghost2",size:"icon",className:"tw-absolute tw-right-1 tw-top-1 tw-size-6 tw-opacity-60 hover:tw-opacity-100",onClick:()=>d(!0),title:"Edit content"},hm.createElement(NF,{className:"tw-size-3"}))))}let g=!!u&&f&&c;return s?hm.createElement("div",{className:Se("tw-flex tw-min-h-0 tw-flex-1 tw-flex-col tw-px-4 tw-py-2",i)},hm.createElement("div",{className:"tw-relative tw-min-h-0 tw-flex-1"},hm.createElement("textarea",{ref:l,value:h,onChange:b=>n?.(b.target.value),placeholder:o,disabled:y,className:Se("tw-min-w-fit tw-overflow-auto tw-border-solid","tw-absolute tw-inset-0 tw-w-full tw-resize-none tw-rounded-md tw-border tw-bg-transparent tw-py-2 tw-pl-3 tw-pr-8 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",y&&"tw-cursor-default tw-opacity-70")}),g&&hm.createElement(me,{variant:"ghost2",size:"icon",className:"tw-absolute tw-right-2 tw-top-2 tw-z-[1] tw-size-6 tw-opacity-60 hover:tw-opacity-100",onClick:()=>d(!1),title:"Preview rendered content"},hm.createElement(bre,{className:"tw-size-3"})))):hm.createElement("div",{className:Se("tw-flex-1 tw-px-4 tw-py-2",i)},hm.createElement(n_,{ref:l,value:h,onChange:b=>n?.(b.target.value),placeholder:o,disabled:y,className:Se("tw-min-h-[120px] tw-resize-y",y&&"tw-cursor-default tw-opacity-70"),style:{minHeight:a}}))}var oZ=$(K());zr();xn();Mr();function fgt({value:t,onChange:e,onSubmit:r,onClear:n,placeholder:o="Enter follow-up instructions...",className:i,showClear:a=!0,disabled:s=!1,hint:u,autoFocus:l=!1}){let c=d=>{let f=d.nativeEvent;if(!(f.isComposing||f.keyCode===229)&&d.key==="Enter"&&!d.shiftKey&&!d.metaKey&&!d.ctrlKey&&!d.altKey){if(!r)return;d.preventDefault(),r()}};return oZ.createElement("div",{className:Se("tw-relative tw-flex-none tw-px-4 tw-py-2",i)},oZ.createElement(n_,{value:t,onChange:d=>e(d.target.value),onKeyDown:c,placeholder:o,disabled:s,autoFocus:l,className:"tw-min-h-[36px] tw-resize-none tw-py-2 tw-pr-8"}),u&&oZ.createElement("span",{className:"tw-pointer-events-none tw-absolute tw-bottom-4 tw-right-6 tw-text-xs tw-text-muted"},u),a&&t&&n&&!u&&oZ.createElement(me,{type:"button",variant:"ghost2",size:"fit",onClick:n,disabled:s,className:"tw-absolute tw-right-6 tw-top-4 tw-text-muted","aria-label":"Clear input"},oZ.createElement(Ho,{className:"tw-size-4"})))}var Yw=$(K()),pgt=require("obsidian");zr();xn();function mgt({state:t,onStop:e,onCopy:r,onInsert:n,onReplace:o,onSubmit:i,onCancel:a,showInsertReplace:s=!0,showSubmitCancel:u=!1,className:l}){return Yw.createElement("div",{className:Se("tw-flex tw-items-center tw-gap-2",l)},t==="loading"&&Yw.createElement(me,{variant:"secondary",size:"sm",onClick:e},"Stop"),t==="result"&&s&&Yw.createElement(Yw.Fragment,null,r&&Yw.createElement(me,{size:"sm",variant:"secondary",onClick:r,title:"Copy to clipboard"},"Copy"),Yw.createElement(me,{size:"sm",variant:"secondary",onClick:n,title:`Insert below selection (${pgt.Platform.isMacOS?"\u2318":"Ctrl"}+Shift+Enter)`},"Insert"),Yw.createElement(me,{size:"sm",onClick:o,title:`Replace selection (${pgt.Platform.isMacOS?"\u2318":"Ctrl"}+Enter)`},"Replace")),u&&t!=="loading"&&Yw.createElement(Yw.Fragment,null,Yw.createElement(me,{variant:"secondary",size:"sm",onClick:a},"Cancel"),Yw.createElement(me,{size:"sm",onClick:i},"Submit")))}var Ws=$(K());zr();var Kc=$(K());function Lje(t,e,r){return Math.min(Math.max(t,e),r)}function Fje(t={}){let{initialPosition:e={x:0,y:0},bounds:r="window",dragRef:n,getPosition:o,onPositionChange:i,writeToDom:a=!0}=t,[s,u]=(0,Kc.useState)(e),[l,c]=(0,Kc.useState)(!1),d=(0,Kc.useRef)(null),f=n??d,p=(0,Kc.useRef)(e),m=(0,Kc.useRef)({x:0,y:0}),h=(0,Kc.useRef)(null),y=(0,Kc.useRef)(null),g=(0,Kc.useRef)(null),b=(0,Kc.useRef)(!0),_=(0,Kc.useRef)(null),w=(0,Kc.useCallback)(R=>{if(!a)return;let I=f.current;if(!I)return;let A=`${R.x}px`,B=`${R.y}px`;I.style.left!==A&&(I.style.left=A),I.style.top!==B&&(I.style.top=B)},[f,a]),T=(0,Kc.useCallback)(R=>{let I=R.x,A=R.y,B=f.current;if(r==="window"&&B){let q=B.ownerDocument?.defaultView??window,Z=B.getBoundingClientRect(),V=q.innerWidth-Z.width,Y=q.innerHeight-Z.height;I=Lje(I,0,Math.max(0,V)),A=Lje(A,0,Math.max(0,Y))}else if(r==="parent"&&B?.parentElement){let q=B.getBoundingClientRect(),Z=B.parentElement.getBoundingClientRect(),V=Z.left,Y=Z.top,X=Z.right-q.width,W=Z.bottom-q.height;I=Lje(I,V,Math.max(V,X)),A=Lje(A,Y,Math.max(Y,W))}let k={x:I,y:A};return p.current=k,w(k),i?.(k),k},[r,f,w,i]),O=(0,Kc.useCallback)(()=>{if(y.current!=null)return;let R=f.current?.ownerDocument?.defaultView??window;y.current=R.requestAnimationFrame(()=>{y.current=null;let I=h.current;I&&(h.current=null,T(I))})},[T,f]),E=(0,Kc.useCallback)(R=>{let I=p.current,A=typeof R=="function"?R(I):R;p.current=A,u(A),w(A),i?.(A)},[w,i]),P=(0,Kc.useCallback)(R=>{if(R.button!==0||(R.preventDefault(),g.current))return;c(!0);let I=o?o():p.current;p.current=I,w(I),m.current={x:R.clientX-I.x,y:R.clientY-I.y};let A=f.current?.ownerDocument??document,B=A.defaultView??window,k=A.body;_.current={userSelect:k.style.userSelect,cursor:k.style.cursor},k.style.userSelect="none",k.style.cursor="grabbing";let q=Y=>{h.current={x:Y.clientX-m.current.x,y:Y.clientY-m.current.y},O()},Z=Y=>{if(g.current!==Z)return;A.removeEventListener("mousemove",q,!0),A.removeEventListener("mouseup",V,!0),y.current!=null&&(B.cancelAnimationFrame(y.current),y.current=null);let X=h.current;h.current=null;let W=X?T(X):p.current,re=_.current;re?(k.style.userSelect=re.userSelect,k.style.cursor=re.cursor,_.current=null):(k.style.userSelect="",k.style.cursor=""),g.current=null,Y&&b.current&&(u(W),c(!1))},V=()=>{Z(!0)};g.current=Z,A.addEventListener("mousemove",q,!0),A.addEventListener("mouseup",V,!0)},[T,f,o,O,w]);return(0,Kc.useEffect)(()=>()=>{b.current=!1,g.current?.(!1)},[]),(0,Kc.useLayoutEffect)(()=>{w(p.current)}),{position:s,setPosition:E,isDragging:l,dragRef:f,handleMouseDown:P}}var ob=$(K());function LWr(t){let{enabled:e=!0,getRect:r,getConstraints:n,onResize:o}=t,[i,a]=(0,ob.useState)(!1),s=(0,ob.useRef)(null),u=(0,ob.useRef)(null),l=(0,ob.useRef)(null),c=(0,ob.useRef)(null),d=(0,ob.useRef)(null),f=(0,ob.useRef)(o);(0,ob.useEffect)(()=>{f.current=o},[o]);let p=(0,ob.useRef)(n);(0,ob.useEffect)(()=>{p.current=n},[n]);let m=(0,ob.useCallback)(h=>y=>{if(!e)return;let g=r();if(!g)return;let _=y.currentTarget?.ownerDocument??document;u.current=_,l.current=_.defaultView??window,s.current={direction:h,startClientX:y.clientX,startClientY:y.clientY,width:g.width,height:g.height,left:g.left,top:g.top,right:g.right},a(!0),y.preventDefault(),y.stopPropagation()},[e,r]);return(0,ob.useEffect)(()=>{if(!i)return;let h=s.current;if(!h)return;let y=h.direction,g=y==="right"?"ew-resize":y==="bottom"?"ns-resize":y==="bottom-left"?"nesw-resize":"nwse-resize",b=u.current??document,_=l.current??window,w=b.body,T=w.style.cursor,O=w.style.userSelect;w.style.cursor=g,w.style.userSelect="none";let E=()=>{c.current!==null&&(_.cancelAnimationFrame(c.current),c.current=null)},P=()=>{let k=d.current;k&&(d.current=null,f.current(k))},R=()=>{c.current===null&&(c.current=_.requestAnimationFrame(()=>{c.current=null,P()}))},I=k=>{let q=s.current;if(!q)return;let Z=k.clientX-q.startClientX,V=k.clientY-q.startClientY,Y=p.current?.()??{minWidth:0,minHeight:0},X=Y.minWidth,W=Y.minHeight,re=Y.maxWidth??Number.POSITIVE_INFINITY,ue=Y.maxHeight??Number.POSITIVE_INFINITY,le=q.width,L=q.height,J,ne;(y==="right"||y==="bottom-right")&&(le=Math.min(re,Math.max(X,q.width+Z))),y==="bottom-left"&&(le=Math.min(re,Math.max(X,q.width-Z)),J=q.right-le,ne=q.top),(y==="bottom"||y==="bottom-right"||y==="bottom-left")&&(L=Math.min(ue,Math.max(W,q.height+V))),d.current=J===void 0?{width:le,height:L}:{width:le,height:L,x:J,y:ne},R()},A=()=>{E(),P(),b.removeEventListener("mousemove",I,!0),b.removeEventListener("mouseup",B,!0),w.style.cursor=T,w.style.userSelect=O,s.current=null,a(!1)},B=()=>{A()};return b.addEventListener("mousemove",I,!0),b.addEventListener("mouseup",B,!0),()=>{E(),d.current=null,s.current=null,b.removeEventListener("mousemove",I,!0),b.removeEventListener("mouseup",B,!0),w.style.cursor=T,w.style.userSelect=O}},[i]),{isResizing:i,handleResizeStart:m}}var kWr="data-copilot-draggable-modal",FWr=`[${kWr}="true"]`;function hgt({open:t,onClose:e,children:r,className:n,initialPosition:o,width:i="min(500px, 90vw)",resizable:a=!1,minHeight:s=260,closeOnEscapeFromOutside:u=!1,anchorBottom:l}){let{position:c,setPosition:d,dragRef:f,handleMouseDown:p,isDragging:m}=Fje({initialPosition:o||{x:typeof window<"u"?(window.innerWidth-500)/2:100,y:typeof window<"u"?(window.innerHeight-400)/2:100},bounds:null}),h=(0,Ws.useRef)(!1),y=(0,Ws.useRef)(null),g=(0,Ws.useCallback)(A=>{let B=A.currentTarget.ownerDocument,k=A.clientX,q=A.clientY;y.current?.();let Z=()=>{B.removeEventListener("mousemove",V,!0),B.removeEventListener("mouseup",Y,!0),y.current===Z&&(y.current=null)},V=X=>{Math.abs(X.clientX-k)<2&&Math.abs(X.clientY-q)<2||(h.current=!0,Z())},Y=()=>Z();B.addEventListener("mousemove",V,!0),B.addEventListener("mouseup",Y,!0),y.current=Z,p(A)},[p]);(0,Ws.useEffect)(()=>{t&&(y.current?.(),y.current=null,h.current=!1,_(null),T(null),o&&d(o))},[t]),(0,Ws.useEffect)(()=>()=>{y.current?.(),y.current=null},[]);let[b,_]=(0,Ws.useState)(null),[w,T]=(0,Ws.useState)(null);(0,Ws.useLayoutEffect)(()=>{if(!t||!a||b!==null&&w!==null)return;let A=f.current;if(!A)return;let B=A.getBoundingClientRect(),k=typeof window<"u"?Math.floor(window.innerHeight*.85):B.height;b===null&&_(Math.min(k,Math.max(s,B.height))),w===null&&T(B.width)},[t,a,b,w,s,f]),(0,Ws.useEffect)(()=>{!a||b===null||b<s&&_(s)},[a,s,b]),(0,Ws.useLayoutEffect)(()=>{if(l===void 0||h.current||b===null)return;let A=Math.max(12,l-b);Math.abs(c.y-A)<1||d({x:c.x,y:A})},[l,b,c.x,c.y,d]),(0,Ws.useLayoutEffect)(()=>{if(l!==void 0||h.current||b===null)return;let B=(f.current?.ownerDocument?.defaultView??window).innerHeight-12-b,k=Math.max(12,Math.min(c.y,B));Math.abs(c.y-k)<1||d({x:c.x,y:k})},[l,b,c.x,c.y,d,f]);let O=(0,Ws.useCallback)(()=>f.current?.getBoundingClientRect()??null,[f]),E=(0,Ws.useCallback)(()=>{let A=typeof window<"u"?Math.floor(window.innerHeight*.85):Number.POSITIVE_INFINITY;return{minWidth:300,minHeight:s,maxHeight:A}},[s]),P=(0,Ws.useCallback)(A=>{h.current=!0,_(B=>B===A.height?B:A.height),T(B=>B===A.width?B:A.width),typeof A.x=="number"&&d(B=>B.x===A.x?B:{...B,x:A.x})},[d]),{isResizing:R,handleResizeStart:I}=LWr({enabled:a,getRect:O,getConstraints:E,onResize:P});return(0,Ws.useEffect)(()=>{if(!t)return;let A=f.current?.ownerDocument??document,B=k=>{if(k.key!=="Escape"||k.defaultPrevented)return;let q=f.current;if(!q)return;let Z=A.activeElement,V=Z instanceof Element?Z.closest(FWr):null;if(V){if(V!==q)return;k.preventDefault(),k.stopPropagation(),e();return}if(!u)return;let Y=Array.from(A.querySelectorAll(FWr));Y[Y.length-1]===q&&(k.preventDefault(),k.stopPropagation(),e())};return A.addEventListener("keydown",B),()=>{A.removeEventListener("keydown",B)}},[t,e,f,u]),t?Ws.default.createElement("div",{ref:f,[kWr]:"true",className:Se("tw-fixed tw-z-popover","tw-flex tw-flex-col","tw-border tw-border-solid tw-border-border tw-bg-primary",a?"tw-rounded-t-lg tw-shadow-2xl":"tw-rounded-lg tw-shadow-2xl","tw-max-h-[85vh]",a&&"tw-group",m&&"tw-cursor-grabbing tw-select-none",R&&"tw-select-none",n),style:{left:c.x,top:c.y,width:a&&w!==null?w:i,...a&&b!==null?{height:b}:{}}},Ws.default.createElement("div",{className:"tw-relative tw-flex-none"},Ws.default.createElement(sgt,{onMouseDown:g}),Ws.default.createElement(lgt,{onClose:e})),Ws.default.createElement("div",{className:"tw-flex tw-min-h-0 tw-flex-1 tw-flex-col tw-overflow-hidden"},r),a&&Ws.default.createElement(Ws.default.Fragment,null,Ws.default.createElement("div",{className:"tw-absolute tw-bottom-0 tw-left-0 tw-h-1 tw-w-full tw-cursor-ns-resize",onMouseDown:I("bottom")}),Ws.default.createElement("div",{className:"quick-ask-resize-indicator-left tw-absolute tw-bottom-0 tw-left-0 tw-size-3 tw-cursor-nesw-resize",onMouseDown:I("bottom-left")}),Ws.default.createElement("div",{className:"quick-ask-resize-indicator-right tw-absolute tw-bottom-0 tw-right-0 tw-z-[10] tw-size-3 tw-cursor-nwse-resize",onMouseDown:I("bottom-right")}))):null}var Dii=$(K());zr();xn();var ab=$(K()),k$e=$(K());Mr();var WKr=require("obsidian");var a_=$(K());xn();var zu=$(K());var sh=$(K(),1);var PPs=!!(typeof window<"u"&&window.document&&window.document.createElement);function Bce(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var jii=$(K(),1);function qWr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function kje(...t){return e=>{let r=!1,n=t.map(o=>{let i=qWr(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():qWr(t[o],null)}}}}var j$=$(K(),1),BWr=$(wt(),1);function UWr(t,e=[]){let r=[];function n(i,a){let s=j$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=j$.useMemo(()=>m,Object.values(m));return(0,BWr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=j$.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=>j$.createContext(a));return function(s){let u=s?.[t]||i;return j$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,$ii(o,...e)]}function $ii(...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 j$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Z0=$(K(),1);var zWr=$(K(),1),qje=globalThis?.document?zWr.useLayoutEffect:()=>{};var Bje=$(K(),1);var Lii=Z0[" useInsertionEffect ".trim().toString()]||qje;function VWr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=Fii({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=Z0.useRef(t!==void 0);Z0.useEffect(()=>{let d=c.current;d!==s&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}let l=Z0.useCallback(c=>{if(s){let d=kii(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function Fii({defaultProp:t,onChange:e}){let[r,n]=Z0.useState(t),o=Z0.useRef(r),i=Z0.useRef(e);return Lii(()=>{i.current=e},[e]),Z0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function kii(t){return typeof t=="function"}var DPs=Symbol("RADIX:SYNC_STATE");var WWr=$(K(),1),Hii=$(yu(),1);var Ym=$(K(),1);var Uje=$(wt(),1);function HWr(t){let e=qii(t),r=Ym.forwardRef((n,o)=>{let{children:i,...a}=n,s=Ym.Children.toArray(i),u=s.find(Uii);if(u){let l=u.props.children,c=s.map(d=>d===u?Ym.Children.count(l)>1?Ym.Children.only(null):Ym.isValidElement(l)?l.props.children:null:d);return(0,Uje.jsx)(e,{...a,ref:o,children:Ym.isValidElement(l)?Ym.cloneElement(l,void 0,c):null})}return(0,Uje.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function qii(t){let e=Ym.forwardRef((r,n)=>{let{children:o,...i}=r;if(Ym.isValidElement(o)){let a=Vii(o),s=zii(i,o.props);return o.type!==Ym.Fragment&&(s.ref=n?kje(n,a):a),Ym.cloneElement(o,s)}return Ym.Children.count(o)>1?Ym.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Bii=Symbol("radix.slottable");function Uii(t){return Ym.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Bii}function zii(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Vii(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 JWr=$(wt(),1),Wii=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],KWr=Wii.reduce((t,e)=>{let r=HWr(`Primitive.${e}`),n=WWr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,JWr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Gr=$(K(),1);var qPs=!!(typeof window<"u"&&window.document&&window.document.createElement);function Gc(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var nU=$(K(),1);var $$=$(K(),1),GWr=$(wt(),1);function XWr(t,e=[]){let r=[];function n(i,a){let s=$$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=$$.useMemo(()=>m,Object.values(m));return(0,GWr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=$$.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=>$$.createContext(a));return function(s){let u=s?.[t]||i;return $$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Jii(o,...e)]}function Jii(...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 $$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var YWr=$(K(),1);function ZWr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function ggt(...t){return e=>{let r=!1,n=t.map(o=>{let i=ZWr(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():ZWr(t[o],null)}}}}function ygt(...t){return YWr.useCallback(ggt(...t),t)}var Qm=$(K(),1);var zje=$(wt(),1);function bgt(t){let e=Kii(t),r=Qm.forwardRef((n,o)=>{let{children:i,...a}=n,s=Qm.Children.toArray(i),u=s.find(Xii);if(u){let l=u.props.children,c=s.map(d=>d===u?Qm.Children.count(l)>1?Qm.Children.only(null):Qm.isValidElement(l)?l.props.children:null:d);return(0,zje.jsx)(e,{...a,ref:o,children:Qm.isValidElement(l)?Qm.cloneElement(l,void 0,c):null})}return(0,zje.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Kii(t){let e=Qm.forwardRef((r,n)=>{let{children:o,...i}=r;if(Qm.isValidElement(o)){let a=Yii(o),s=Zii(i,o.props);return o.type!==Qm.Fragment&&(s.ref=n?ggt(n,a):a),Qm.cloneElement(o,s)}return Qm.Children.count(o)>1?Qm.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Gii=Symbol("radix.slottable");function Xii(t){return Qm.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Gii}function Zii(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Yii(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 Vje=$(wt(),1),Qii=$(K(),1);var eai=$(wt(),1);function oU(t){let e=t+"CollectionProvider",[r,n]=XWr(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=h=>{let{scope:y,children:g}=h,b=nU.default.useRef(null),_=nU.default.useRef(new Map).current;return(0,Vje.jsx)(o,{scope:y,itemMap:_,collectionRef:b,children:g})};a.displayName=e;let s=t+"CollectionSlot",u=bgt(s),l=nU.default.forwardRef((h,y)=>{let{scope:g,children:b}=h,_=i(s,g),w=ygt(y,_.collectionRef);return(0,Vje.jsx)(u,{ref:w,children:b})});l.displayName=s;let c=t+"CollectionItemSlot",d="data-radix-collection-item",f=bgt(c),p=nU.default.forwardRef((h,y)=>{let{scope:g,children:b,..._}=h,w=nU.default.useRef(null),T=ygt(y,w),O=i(c,g);return nU.default.useEffect(()=>(O.itemMap.set(w,{ref:w,..._}),()=>void O.itemMap.delete(w))),(0,Vje.jsx)(f,{[d]:"",ref:T,children:b})});p.displayName=c;function m(h){let y=i(t+"CollectionConsumer",h);return nU.default.useCallback(()=>{let b=y.collectionRef.current;if(!b)return[];let _=Array.from(b.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((O,E)=>_.indexOf(O.ref.current)-_.indexOf(E.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:l,ItemSlot:p},m,n]}var e3r=$(K(),1);function QWr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Uce(...t){return e=>{let r=!1,n=t.map(o=>{let i=QWr(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():QWr(t[o],null)}}}}function iU(...t){return e3r.useCallback(Uce(...t),t)}var L$=$(K(),1),t3r=$(wt(),1);function r3r(t,e=[]){let r=[];function n(i,a){let s=L$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=L$.useMemo(()=>m,Object.values(m));return(0,t3r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=L$.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=>L$.createContext(a));return function(s){let u=s?.[t]||i;return L$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,tai(o,...e)]}function tai(...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 L$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Hje=$(K(),1),rai=$(wt(),1),nai=Hje.createContext(void 0);function n3r(t){let e=Hje.useContext(nai);return t||e||"ltr"}var Rc=$(K(),1);var rMs=!!(typeof window<"u"&&window.document&&window.document.createElement);function Wje(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var s3r=$(K(),1),u3r=$(yu(),1);var eh=$(K(),1);var i3r=$(K(),1);function o3r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function _gt(...t){return e=>{let r=!1,n=t.map(o=>{let i=o3r(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():o3r(t[o],null)}}}}function vgt(...t){return i3r.useCallback(_gt(...t),t)}var Jje=$(wt(),1);function a3r(t){let e=oai(t),r=eh.forwardRef((n,o)=>{let{children:i,...a}=n,s=eh.Children.toArray(i),u=s.find(aai);if(u){let l=u.props.children,c=s.map(d=>d===u?eh.Children.count(l)>1?eh.Children.only(null):eh.isValidElement(l)?l.props.children:null:d);return(0,Jje.jsx)(e,{...a,ref:o,children:eh.isValidElement(l)?eh.cloneElement(l,void 0,c):null})}return(0,Jje.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function oai(t){let e=eh.forwardRef((r,n)=>{let{children:o,...i}=r;if(eh.isValidElement(o)){let a=uai(o),s=sai(i,o.props);return o.type!==eh.Fragment&&(s.ref=n?_gt(n,a):a),eh.cloneElement(o,s)}return eh.Children.count(o)>1?eh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var iai=Symbol("radix.slottable");function aai(t){return eh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===iai}function sai(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function uai(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 l3r=$(wt(),1),lai=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wgt=lai.reduce((t,e)=>{let r=a3r(`Primitive.${e}`),n=s3r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,l3r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function c3r(t,e){t&&u3r.flushSync(()=>t.dispatchEvent(e))}var iZ=$(K(),1);function Sgt(t){let e=iZ.useRef(t);return iZ.useEffect(()=>{e.current=t}),iZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var f3r=$(K(),1);var aZ=$(K(),1);function d3r(t){let e=aZ.useRef(t);return aZ.useEffect(()=>{e.current=t}),aZ.useMemo(()=>(...r)=>e.current?.(...r),[])}function p3r(t,e=globalThis?.document){let r=d3r(t);f3r.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 xgt=$(wt(),1),cai="DismissableLayer",Cgt="dismissableLayer.update",dai="dismissableLayer.pointerDownOutside",fai="dismissableLayer.focusOutside",m3r,g3r=Rc.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),lT=Rc.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Rc.useContext(g3r),[c,d]=Rc.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Rc.useState({}),m=vgt(e,E=>d(E)),h=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(y),b=c?h.indexOf(c):-1,_=l.layersWithOutsidePointerEventsDisabled.size>0,w=b>=g,T=hai(E=>{let P=E.target,R=[...l.branches].some(I=>I.contains(P));!w||R||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),O=gai(E=>{let P=E.target;[...l.branches].some(I=>I.contains(P))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return p3r(E=>{b===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Rc.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(m3r=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),h3r(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=m3r)}},[c,f,r,l]),Rc.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),h3r())},[c,l]),Rc.useEffect(()=>{let E=()=>p({});return document.addEventListener(Cgt,E),()=>document.removeEventListener(Cgt,E)},[]),(0,xgt.jsx)(wgt.div,{...u,ref:m,style:{pointerEvents:_?w?"auto":"none":void 0,...t.style},onFocusCapture:Wje(t.onFocusCapture,O.onFocusCapture),onBlurCapture:Wje(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:Wje(t.onPointerDownCapture,T.onPointerDownCapture)})});lT.displayName=cai;var pai="DismissableLayerBranch",mai=Rc.forwardRef((t,e)=>{let r=Rc.useContext(g3r),n=Rc.useRef(null),o=vgt(e,n);return Rc.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,xgt.jsx)(wgt.div,{...t,ref:o})});mai.displayName=pai;function hai(t,e=globalThis?.document){let r=Sgt(t),n=Rc.useRef(!1),o=Rc.useRef(()=>{});return Rc.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){y3r(dai,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 gai(t,e=globalThis?.document){let r=Sgt(t),n=Rc.useRef(!1);return Rc.useEffect(()=>{let o=i=>{i.target&&!n.current&&y3r(fai,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 h3r(){let t=new CustomEvent(Cgt);document.dispatchEvent(t)}function y3r(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?c3r(o,i):o.dispatchEvent(i)}var _3r=$(K(),1),Tgt=0;function aU(){_3r.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??b3r()),document.body.insertAdjacentElement("beforeend",t[1]??b3r()),Tgt++,()=>{Tgt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Tgt--}},[])}function b3r(){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 Y0=$(K(),1);var w3r=$(K(),1);function v3r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ogt(...t){return e=>{let r=!1,n=t.map(o=>{let i=v3r(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():v3r(t[o],null)}}}}function S3r(...t){return w3r.useCallback(Ogt(...t),t)}var x3r=$(K(),1),Sai=$(yu(),1);var th=$(K(),1);var Kje=$(wt(),1);function C3r(t){let e=yai(t),r=th.forwardRef((n,o)=>{let{children:i,...a}=n,s=th.Children.toArray(i),u=s.find(_ai);if(u){let l=u.props.children,c=s.map(d=>d===u?th.Children.count(l)>1?th.Children.only(null):th.isValidElement(l)?l.props.children:null:d);return(0,Kje.jsx)(e,{...a,ref:o,children:th.isValidElement(l)?th.cloneElement(l,void 0,c):null})}return(0,Kje.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function yai(t){let e=th.forwardRef((r,n)=>{let{children:o,...i}=r;if(th.isValidElement(o)){let a=wai(o),s=vai(i,o.props);return o.type!==th.Fragment&&(s.ref=n?Ogt(n,a):a),th.cloneElement(o,s)}return th.Children.count(o)>1?th.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var bai=Symbol("radix.slottable");function _ai(t){return th.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===bai}function vai(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function wai(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 T3r=$(wt(),1),Cai=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],O3r=Cai.reduce((t,e)=>{let r=C3r(`Primitive.${e}`),n=x3r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,T3r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var sZ=$(K(),1);function Egt(t){let e=sZ.useRef(t);return sZ.useEffect(()=>{e.current=t}),sZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var I3r=$(wt(),1),Pgt="focusScope.autoFocusOnMount",Mgt="focusScope.autoFocusOnUnmount",E3r={bubbles:!1,cancelable:!0},xai="FocusScope",F$=Y0.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Y0.useState(null),l=Egt(o),c=Egt(i),d=Y0.useRef(null),f=S3r(e,h=>u(h)),p=Y0.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Y0.useEffect(()=>{if(n){let b=function(O){if(p.paused||!s)return;let E=O.target;s.contains(E)?d.current=E:sU(d.current,{select:!0})},_=function(O){if(p.paused||!s)return;let E=O.relatedTarget;E!==null&&(s.contains(E)||sU(d.current,{select:!0}))},w=function(O){if(document.activeElement===document.body)for(let P of O)P.removedNodes.length>0&&sU(s)};var h=b,y=_,g=w;document.addEventListener("focusin",b),document.addEventListener("focusout",_);let T=new MutationObserver(w);return s&&T.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",_),T.disconnect()}}},[n,s,p.paused]),Y0.useEffect(()=>{if(s){M3r.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(Pgt,E3r);s.addEventListener(Pgt,l),s.dispatchEvent(g),g.defaultPrevented||(Tai(Rai(A3r(s)),{select:!0}),document.activeElement===h&&sU(s))}return()=>{s.removeEventListener(Pgt,l),setTimeout(()=>{let g=new CustomEvent(Mgt,E3r);s.addEventListener(Mgt,c),s.dispatchEvent(g),g.defaultPrevented||sU(h??document.body,{select:!0}),s.removeEventListener(Mgt,c),M3r.remove(p)},0)}}},[s,l,c,p]);let m=Y0.useCallback(h=>{if(!r&&!n||p.paused)return;let y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(y&&g){let b=h.currentTarget,[_,w]=Oai(b);_&&w?!h.shiftKey&&g===w?(h.preventDefault(),r&&sU(_,{select:!0})):h.shiftKey&&g===_&&(h.preventDefault(),r&&sU(w,{select:!0})):g===b&&h.preventDefault()}},[r,n,p.paused]);return(0,I3r.jsx)(O3r.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});F$.displayName=xai;function Tai(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(sU(n,{select:e}),document.activeElement!==r)return}function Oai(t){let e=A3r(t),r=P3r(e,t),n=P3r(e.reverse(),t);return[r,n]}function A3r(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 P3r(t,e){for(let r of t)if(!Eai(r,{upTo:e}))return r}function Eai(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 Pai(t){return t instanceof HTMLInputElement&&"select"in t}function sU(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Pai(t)&&e&&t.select()}}var M3r=Mai();function Mai(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=R3r(t,e),t.unshift(e)},remove(e){t=R3r(t,e),t[0]?.resume()}}}function R3r(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function Rai(t){return t.filter(e=>e.tagName!=="A")}var Rgt=$(K(),1);var N3r=$(K(),1),zce=globalThis?.document?N3r.useLayoutEffect:()=>{};var Iai=Rgt[" useId ".trim().toString()]||(()=>{}),Aai=0;function Igt(t){let[e,r]=Rgt.useState(Iai());return zce(()=>{t||r(n=>n??String(Aai++))},[t]),t||(e?`radix-${e}`:"")}var xv=$(K(),1);var $3r=["top","right","bottom","left"];var oN=Math.min,o_=Math.max,Hce=Math.round,Wce=Math.floor,cT=t=>({x:t,y:t}),Nai={left:"right",right:"left",bottom:"top",top:"bottom"},Dai={start:"end",end:"start"};function Xje(t,e,r){return o_(t,oN(e,r))}function iN(t,e){return typeof t=="function"?t(e):t}function aN(t){return t.split("-")[0]}function u3(t){return t.split("-")[1]}function Zje(t){return t==="x"?"y":"x"}function Yje(t){return t==="y"?"height":"width"}var jai=new Set(["top","bottom"]);function dT(t){return jai.has(aN(t))?"y":"x"}function Qje(t){return Zje(dT(t))}function L3r(t,e,r){r===void 0&&(r=!1);let n=u3(t),o=Qje(t),i=Yje(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=Vce(a)),[a,Vce(a)]}function F3r(t){let e=Vce(t);return[Gje(t),e,Gje(e)]}function Gje(t){return t.replace(/start|end/g,e=>Dai[e])}var D3r=["left","right"],j3r=["right","left"],$ai=["top","bottom"],Lai=["bottom","top"];function Fai(t,e,r){switch(t){case"top":case"bottom":return r?e?j3r:D3r:e?D3r:j3r;case"left":case"right":return e?$ai:Lai;default:return[]}}function k3r(t,e,r,n){let o=u3(t),i=Fai(aN(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(Gje)))),i}function Vce(t){return t.replace(/left|right|bottom|top/g,e=>Nai[e])}function kai(t){return{top:0,right:0,bottom:0,left:0,...t}}function Agt(t){return typeof t!="number"?kai(t):{top:t,right:t,bottom:t,left:t}}function l3(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 q3r(t,e,r){let{reference:n,floating:o}=t,i=dT(e),a=Qje(e),s=Yje(a),u=aN(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(u3(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var z3r=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}=q3r(l,n,u),f=n,p={},m=0;for(let h=0;h<s.length;h++){let{name:y,fn:g}=s[h],{x:b,y:_,data:w,reset:T}=await g({x:c,y:d,initialPlacement:n,placement:f,strategy:o,middlewareData:p,rects:l,platform:a,elements:{reference:t,floating:e}});c=b??c,d=_??d,p={...p,[y]:{...p[y],...w}},T&&m<=50&&(m++,typeof T=="object"&&(T.placement&&(f=T.placement),T.rects&&(l=T.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:o}):T.rects),{x:c,y:d}=q3r(l,f,u)),h=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}};async function uZ(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}=iN(e,t),m=Agt(p),y=s[f?d==="floating"?"reference":"floating":d],g=l3(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(y)))==null||r?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:l,rootBoundary:c,strategy:u})),b=d==="floating"?{x:n,y:o,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),w=await(i.isElement==null?void 0:i.isElement(_))?await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1}:{x:1,y:1},T=l3(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:_,strategy:u}):b);return{top:(g.top-T.top+m.top)/w.y,bottom:(T.bottom-g.bottom+m.bottom)/w.y,left:(g.left-T.left+m.left)/w.x,right:(T.right-g.right+m.right)/w.x}}var V3r=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}=iN(t,e)||{};if(l==null)return{};let d=Agt(c),f={x:r,y:n},p=Qje(o),m=Yje(p),h=await a.getDimensions(l),y=p==="y",g=y?"top":"left",b=y?"bottom":"right",_=y?"clientHeight":"clientWidth",w=i.reference[m]+i.reference[p]-f[p]-i.floating[m],T=f[p]-i.reference[p],O=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l)),E=O?O[_]:0;(!E||!await(a.isElement==null?void 0:a.isElement(O)))&&(E=s.floating[_]||i.floating[m]);let P=w/2-T/2,R=E/2-h[m]/2-1,I=oN(d[g],R),A=oN(d[b],R),B=I,k=E-h[m]-A,q=E/2-h[m]/2+P,Z=Xje(B,q,k),V=!u.arrow&&u3(o)!=null&&q!==Z&&i.reference[m]/2-(q<B?I:A)-h[m]/2<0,Y=V?q<B?q-B:q-k:0;return{[p]:f[p]+Y,data:{[p]:Z,centerOffset:q-Z-Y,...V&&{alignmentOffset:Y}},reset:V}}});var H3r=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,...y}=iN(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};let g=aN(o),b=dT(s),_=aN(s)===s,w=await(u.isRTL==null?void 0:u.isRTL(l.floating)),T=f||(_||!h?[Vce(s)]:F3r(s)),O=m!=="none";!f&&O&&T.push(...k3r(s,h,m,w));let E=[s,...T],P=await uZ(e,y),R=[],I=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&R.push(P[g]),d){let q=L3r(o,a,w);R.push(P[q[0]],P[q[1]])}if(I=[...I,{placement:o,overflows:R}],!R.every(q=>q<=0)){var A,B;let q=(((A=i.flip)==null?void 0:A.index)||0)+1,Z=E[q];if(Z&&(!(d==="alignment"?b!==dT(Z):!1)||I.every(X=>dT(X.placement)===b?X.overflows[0]>0:!0)))return{data:{index:q,overflows:I},reset:{placement:Z}};let V=(B=I.filter(Y=>Y.overflows[0]<=0).sort((Y,X)=>Y.overflows[1]-X.overflows[1])[0])==null?void 0:B.placement;if(!V)switch(p){case"bestFit":{var k;let Y=(k=I.filter(X=>{if(O){let W=dT(X.placement);return W===b||W==="y"}return!0}).map(X=>[X.placement,X.overflows.filter(W=>W>0).reduce((W,re)=>W+re,0)]).sort((X,W)=>X[1]-W[1])[0])==null?void 0:k[0];Y&&(V=Y);break}case"initialPlacement":V=s;break}if(o!==V)return{reset:{placement:V}}}return{}}}};function B3r(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function U3r(t){return $3r.some(e=>t[e]>=0)}var W3r=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=iN(t,e);switch(n){case"referenceHidden":{let i=await uZ(e,{...o,elementContext:"reference"}),a=B3r(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:U3r(a)}}}case"escaped":{let i=await uZ(e,{...o,altBoundary:!0}),a=B3r(i,r.floating);return{data:{escapedOffsets:a,escaped:U3r(a)}}}default:return{}}}}};var J3r=new Set(["left","top"]);async function qai(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=aN(r),s=u3(r),u=dT(r)==="y",l=J3r.has(a)?-1:1,c=i&&u?-1:1,d=iN(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 K3r=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 qai(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}}}}},G3r=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:y=>{let{x:g,y:b}=y;return{x:g,y:b}}},...u}=iN(t,e),l={x:r,y:n},c=await uZ(e,u),d=dT(aN(o)),f=Zje(d),p=l[f],m=l[d];if(i){let y=f==="y"?"top":"left",g=f==="y"?"bottom":"right",b=p+c[y],_=p-c[g];p=Xje(b,p,_)}if(a){let y=d==="y"?"top":"left",g=d==="y"?"bottom":"right",b=m+c[y],_=m-c[g];m=Xje(b,m,_)}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}}}}}},X3r=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}=iN(t,e),c={x:r,y:n},d=dT(o),f=Zje(d),p=c[f],m=c[d],h=iN(s,e),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){let _=f==="y"?"height":"width",w=i.reference[f]-i.floating[_]+y.mainAxis,T=i.reference[f]+i.reference[_]-y.mainAxis;p<w?p=w:p>T&&(p=T)}if(l){var g,b;let _=f==="y"?"width":"height",w=J3r.has(aN(o)),T=i.reference[d]-i.floating[_]+(w&&((g=a.offset)==null?void 0:g[d])||0)+(w?0:y.crossAxis),O=i.reference[d]+i.reference[_]+(w?0:((b=a.offset)==null?void 0:b[d])||0)-(w?y.crossAxis:0);m<T?m=T:m>O&&(m=O)}return{[f]:p,[d]:m}}}},Z3r=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}=iN(t,e),c=await uZ(e,l),d=aN(o),f=u3(o),p=dT(o)==="y",{width:m,height:h}=i.floating,y,g;d==="top"||d==="bottom"?(y=d,g=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(g=d,y=f==="end"?"top":"bottom");let b=h-c.top-c.bottom,_=m-c.left-c.right,w=oN(h-c[y],b),T=oN(m-c[g],_),O=!e.middlewareData.shift,E=w,P=T;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(P=_),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(E=b),O&&!f){let I=o_(c.left,0),A=o_(c.right,0),B=o_(c.top,0),k=o_(c.bottom,0);p?P=m-2*(I!==0||A!==0?I+A:o_(c.left,c.right)):E=h-2*(B!==0||k!==0?B+k:o_(c.top,c.bottom))}await u({...e,availableWidth:P,availableHeight:E});let R=await a.getDimensions(s.floating);return m!==R.width||h!==R.height?{reset:{rects:!0}}:{}}}};function e$e(){return typeof window<"u"}function d3(t){return Q3r(t)?(t.nodeName||"").toLowerCase():"#document"}function Cv(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function fT(t){var e;return(e=(Q3r(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Q3r(t){return e$e()?t instanceof Node||t instanceof Cv(t).Node:!1}function Q0(t){return e$e()?t instanceof Element||t instanceof Cv(t).Element:!1}function pT(t){return e$e()?t instanceof HTMLElement||t instanceof Cv(t).HTMLElement:!1}function Y3r(t){return!e$e()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Cv(t).ShadowRoot}var Bai=new Set(["inline","contents"]);function lZ(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=eC(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!Bai.has(o)}var Uai=new Set(["table","td","th"]);function e6r(t){return Uai.has(d3(t))}var zai=[":popover-open",":modal"];function Jce(t){return zai.some(e=>{try{return t.matches(e)}catch{return!1}})}var Vai=["transform","translate","scale","rotate","perspective"],Hai=["transform","translate","scale","rotate","perspective","filter"],Wai=["paint","layout","strict","content"];function t$e(t){let e=r$e(),r=Q0(t)?eC(t):t;return Vai.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||Hai.some(n=>(r.willChange||"").includes(n))||Wai.some(n=>(r.contain||"").includes(n))}function t6r(t){let e=k$(t);for(;pT(e)&&!f3(e);){if(t$e(e))return e;if(Jce(e))return null;e=k$(e)}return null}function r$e(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var Jai=new Set(["html","body","#document"]);function f3(t){return Jai.has(d3(t))}function eC(t){return Cv(t).getComputedStyle(t)}function Kce(t){return Q0(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function k$(t){if(d3(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Y3r(t)&&t.host||fT(t);return Y3r(e)?e.host:e}function r6r(t){let e=k$(t);return f3(e)?t.ownerDocument?t.ownerDocument.body:t.body:pT(e)&&lZ(e)?e:r6r(e)}function c3(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=r6r(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=Cv(o);if(i){let s=n$e(a);return e.concat(a,a.visualViewport||[],lZ(o)?o:[],s&&r?c3(s):[])}return e.concat(o,c3(o,[],r))}function n$e(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function a6r(t){let e=eC(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=pT(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=Hce(r)!==i||Hce(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function Dgt(t){return Q0(t)?t:t.contextElement}function cZ(t){let e=Dgt(t);if(!pT(e))return cT(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=a6r(e),a=(i?Hce(r.width):r.width)/n,s=(i?Hce(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var Kai=cT(0);function s6r(t){let e=Cv(t);return!r$e()||!e.visualViewport?Kai:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Gai(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Cv(t)?!1:e}function p3(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=Dgt(t),a=cT(1);e&&(n?Q0(n)&&(a=cZ(n)):a=cZ(t));let s=Gai(i,r,n)?s6r(i):cT(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=Cv(i),p=n&&Q0(n)?Cv(n):n,m=f,h=n$e(m);for(;h&&n&&p!==m;){let y=cZ(h),g=h.getBoundingClientRect(),b=eC(h),_=g.left+(h.clientLeft+parseFloat(b.paddingLeft))*y.x,w=g.top+(h.clientTop+parseFloat(b.paddingTop))*y.y;u*=y.x,l*=y.y,c*=y.x,d*=y.y,u+=_,l+=w,m=Cv(h),h=n$e(m)}}return l3({width:c,height:d,x:u,y:l})}function o$e(t,e){let r=Kce(t).scrollLeft;return e?e.left+r:p3(fT(t)).left+r}function u6r(t,e){let r=t.getBoundingClientRect(),n=r.left+e.scrollLeft-o$e(t,r),o=r.top+e.scrollTop;return{x:n,y:o}}function Xai(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=fT(n),s=e?Jce(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=cT(1),c=cT(0),d=pT(n);if((d||!d&&!i)&&((d3(n)!=="body"||lZ(a))&&(u=Kce(n)),pT(n))){let p=p3(n);l=cZ(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?u6r(a,u):cT(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 Zai(t){return Array.from(t.getClientRects())}function Yai(t){let e=fT(t),r=Kce(t),n=t.ownerDocument.body,o=o_(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=o_(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+o$e(t),s=-r.scrollTop;return eC(n).direction==="rtl"&&(a+=o_(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}var n6r=25;function Qai(t,e){let r=Cv(t),n=fT(t),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let c=r$e();(!c||c&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}let l=o$e(n);if(l<=0){let c=n.ownerDocument,d=c.body,f=getComputedStyle(d),p=c.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(n.clientWidth-d.clientWidth-p);m<=n6r&&(i-=m)}else l<=n6r&&(i+=l);return{width:i,height:a,x:s,y:u}}var esi=new Set(["absolute","fixed"]);function tsi(t,e){let r=p3(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=pT(t)?cZ(t):cT(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 o6r(t,e,r){let n;if(e==="viewport")n=Qai(t,r);else if(e==="document")n=Yai(fT(t));else if(Q0(e))n=tsi(e,r);else{let o=s6r(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return l3(n)}function l6r(t,e){let r=k$(t);return r===e||!Q0(r)||f3(r)?!1:eC(r).position==="fixed"||l6r(r,e)}function rsi(t,e){let r=e.get(t);if(r)return r;let n=c3(t,[],!1).filter(s=>Q0(s)&&d3(s)!=="body"),o=null,i=eC(t).position==="fixed",a=i?k$(t):t;for(;Q0(a)&&!f3(a);){let s=eC(a),u=t$e(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&esi.has(o.position)||lZ(a)&&!u&&l6r(t,a))?n=n.filter(c=>c!==a):o=s,a=k$(a)}return e.set(t,n),n}function nsi(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?Jce(e)?[]:rsi(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=o6r(e,c,o);return l.top=o_(d.top,l.top),l.right=oN(d.right,l.right),l.bottom=oN(d.bottom,l.bottom),l.left=o_(d.left,l.left),l},o6r(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function osi(t){let{width:e,height:r}=a6r(t);return{width:e,height:r}}function isi(t,e,r){let n=pT(e),o=fT(e),i=r==="fixed",a=p3(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=cT(0);function l(){u.x=o$e(o)}if(n||!n&&!i)if((d3(e)!=="body"||lZ(o))&&(s=Kce(e)),n){let p=p3(e,!0,i,e);u.x=p.x+e.clientLeft,u.y=p.y+e.clientTop}else o&&l();i&&!n&&o&&l();let c=o&&!n&&!i?u6r(o,s):cT(0),d=a.left+s.scrollLeft-u.x-c.x,f=a.top+s.scrollTop-u.y-c.y;return{x:d,y:f,width:a.width,height:a.height}}function Ngt(t){return eC(t).position==="static"}function i6r(t,e){if(!pT(t)||eC(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return fT(t)===r&&(r=r.ownerDocument.body),r}function c6r(t,e){let r=Cv(t);if(Jce(t))return r;if(!pT(t)){let o=k$(t);for(;o&&!f3(o);){if(Q0(o)&&!Ngt(o))return o;o=k$(o)}return r}let n=i6r(t,e);for(;n&&e6r(n)&&Ngt(n);)n=i6r(n,e);return n&&f3(n)&&Ngt(n)&&!t$e(n)?r:n||t6r(t)||r}var asi=async function(t){let e=this.getOffsetParent||c6r,r=this.getDimensions,n=await r(t.floating);return{reference:isi(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ssi(t){return eC(t).direction==="rtl"}var d6r={convertOffsetParentRelativeRectToViewportRelativeRect:Xai,getDocumentElement:fT,getClippingRect:nsi,getOffsetParent:c6r,getElementRects:asi,getClientRects:Zai,getDimensions:osi,getScale:cZ,isElement:Q0,isRTL:ssi};function f6r(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function usi(t,e){let r=null,n,o=fT(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 l=t.getBoundingClientRect(),{left:c,top:d,width:f,height:p}=l;if(s||e(),!f||!p)return;let m=Wce(d),h=Wce(o.clientWidth-(c+f)),y=Wce(o.clientHeight-(d+p)),g=Wce(c),_={rootMargin:-m+"px "+-h+"px "+-y+"px "+-g+"px",threshold:o_(0,oN(1,u))||1},w=!0;function T(O){let E=O[0].intersectionRatio;if(E!==u){if(!w)return a();E?a(!1,E):n=setTimeout(()=>{a(!1,1e-7)},1e3)}E===1&&!f6r(l,t.getBoundingClientRect())&&a(),w=!1}try{r=new IntersectionObserver(T,{..._,root:o.ownerDocument})}catch{r=new IntersectionObserver(T,_)}r.observe(t)}return a(!0),i}function jgt(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=Dgt(t),c=o||i?[...l?c3(l):[],...c3(e)]:[];c.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});let d=l&&s?usi(l,r):null,f=-1,p=null;a&&(p=new ResizeObserver(g=>{let[b]=g;b&&b.target===l&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var _;(_=p)==null||_.observe(e)})),r()}),l&&!u&&p.observe(l),p.observe(e));let m,h=u?p3(t):null;u&&y();function y(){let g=p3(t);h&&!f6r(h,g)&&r(),h=g,m=requestAnimationFrame(y)}return r(),()=>{var g;c.forEach(b=>{o&&b.removeEventListener("scroll",r),i&&b.removeEventListener("resize",r)}),d?.(),(g=p)==null||g.disconnect(),p=null,u&&cancelAnimationFrame(m)}}var p6r=K3r;var m6r=G3r,h6r=H3r,g6r=Z3r,y6r=W3r,$gt=V3r;var b6r=X3r,Lgt=(t,e,r)=>{let n=new Map,o={platform:d6r,...r},i={...o.platform,_c:n};return z3r(t,e,{...o,platform:i})};var gm=$(K(),1),v6r=$(K(),1),w6r=$(yu(),1),lsi=typeof document<"u",csi=function(){},i$e=lsi?v6r.useLayoutEffect:csi;function a$e(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(!a$e(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)&&!a$e(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function S6r(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function _6r(t,e){let r=S6r(t);return Math.round(e*r)/r}function Fgt(t){let e=gm.useRef(t);return i$e(()=>{e.current=t}),e}function C6r(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]=gm.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=gm.useState(n);a$e(f,n)||p(n);let[m,h]=gm.useState(null),[y,g]=gm.useState(null),b=gm.useCallback(X=>{X!==O.current&&(O.current=X,h(X))},[]),_=gm.useCallback(X=>{X!==E.current&&(E.current=X,g(X))},[]),w=i||m,T=a||y,O=gm.useRef(null),E=gm.useRef(null),P=gm.useRef(c),R=u!=null,I=Fgt(u),A=Fgt(o),B=Fgt(l),k=gm.useCallback(()=>{if(!O.current||!E.current)return;let X={placement:e,strategy:r,middleware:f};A.current&&(X.platform=A.current),Lgt(O.current,E.current,X).then(W=>{let re={...W,isPositioned:B.current!==!1};q.current&&!a$e(P.current,re)&&(P.current=re,w6r.flushSync(()=>{d(re)}))})},[f,e,r,A,B]);i$e(()=>{l===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(X=>({...X,isPositioned:!1})))},[l]);let q=gm.useRef(!1);i$e(()=>(q.current=!0,()=>{q.current=!1}),[]),i$e(()=>{if(w&&(O.current=w),T&&(E.current=T),w&&T){if(I.current)return I.current(w,T,k);k()}},[w,T,k,I,R]);let Z=gm.useMemo(()=>({reference:O,floating:E,setReference:b,setFloating:_}),[b,_]),V=gm.useMemo(()=>({reference:w,floating:T}),[w,T]),Y=gm.useMemo(()=>{let X={position:r,left:0,top:0};if(!V.floating)return X;let W=_6r(V.floating,c.x),re=_6r(V.floating,c.y);return s?{...X,transform:"translate("+W+"px, "+re+"px)",...S6r(V.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:W,top:re}},[r,s,V.floating,c.x,c.y]);return gm.useMemo(()=>({...c,update:k,refs:Z,elements:V,floatingStyles:Y}),[c,k,Z,V,Y])}var dsi=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?$gt({element:n.current,padding:o}).fn(r):{}:n?$gt({element:n,padding:o}).fn(r):{}}}},x6r=(t,e)=>({...p6r(t),options:[t,e]}),T6r=(t,e)=>({...m6r(t),options:[t,e]}),O6r=(t,e)=>({...b6r(t),options:[t,e]}),E6r=(t,e)=>({...h6r(t),options:[t,e]}),P6r=(t,e)=>({...g6r(t),options:[t,e]});var M6r=(t,e)=>({...y6r(t),options:[t,e]});var R6r=(t,e)=>({...dsi(t),options:[t,e]});var L6r=$(K(),1);var D6r=$(K(),1),bsi=$(yu(),1);var rh=$(K(),1);var fsi=$(K(),1);function I6r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function A6r(...t){return e=>{let r=!1,n=t.map(o=>{let i=I6r(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():I6r(t[o],null)}}}}var s$e=$(wt(),1);function N6r(t){let e=psi(t),r=rh.forwardRef((n,o)=>{let{children:i,...a}=n,s=rh.Children.toArray(i),u=s.find(hsi);if(u){let l=u.props.children,c=s.map(d=>d===u?rh.Children.count(l)>1?rh.Children.only(null):rh.isValidElement(l)?l.props.children:null:d);return(0,s$e.jsx)(e,{...a,ref:o,children:rh.isValidElement(l)?rh.cloneElement(l,void 0,c):null})}return(0,s$e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function psi(t){let e=rh.forwardRef((r,n)=>{let{children:o,...i}=r;if(rh.isValidElement(o)){let a=ysi(o),s=gsi(i,o.props);return o.type!==rh.Fragment&&(s.ref=n?A6r(n,a):a),rh.cloneElement(o,s)}return rh.Children.count(o)>1?rh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var msi=Symbol("radix.slottable");function hsi(t){return rh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===msi}function gsi(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function ysi(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 j6r=$(wt(),1),_si=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$6r=_si.reduce((t,e)=>{let r=N6r(`Primitive.${e}`),n=D6r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,j6r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var kgt=$(wt(),1),vsi="Arrow",F6r=L6r.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,kgt.jsx)($6r.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,kgt.jsx)("polygon",{points:"0,0 30,0 15,10"})})});F6r.displayName=vsi;var k6r=F6r;var B6r=$(K(),1);function q6r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function qgt(...t){return e=>{let r=!1,n=t.map(o=>{let i=q6r(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():q6r(t[o],null)}}}}function Bgt(...t){return B6r.useCallback(qgt(...t),t)}var q$=$(K(),1),U6r=$(wt(),1);function z6r(t,e=[]){let r=[];function n(i,a){let s=q$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=q$.useMemo(()=>m,Object.values(m));return(0,U6r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=q$.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=>q$.createContext(a));return function(s){let u=s?.[t]||i;return q$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Ssi(o,...e)]}function Ssi(...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 q$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var H6r=$(K(),1),Psi=$(yu(),1);var nh=$(K(),1);var u$e=$(wt(),1);function V6r(t){let e=Csi(t),r=nh.forwardRef((n,o)=>{let{children:i,...a}=n,s=nh.Children.toArray(i),u=s.find(Tsi);if(u){let l=u.props.children,c=s.map(d=>d===u?nh.Children.count(l)>1?nh.Children.only(null):nh.isValidElement(l)?l.props.children:null:d);return(0,u$e.jsx)(e,{...a,ref:o,children:nh.isValidElement(l)?nh.cloneElement(l,void 0,c):null})}return(0,u$e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Csi(t){let e=nh.forwardRef((r,n)=>{let{children:o,...i}=r;if(nh.isValidElement(o)){let a=Esi(o),s=Osi(i,o.props);return o.type!==nh.Fragment&&(s.ref=n?qgt(n,a):a),nh.cloneElement(o,s)}return nh.Children.count(o)>1?nh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var xsi=Symbol("radix.slottable");function Tsi(t){return nh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===xsi}function Osi(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Esi(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 W6r=$(wt(),1),Msi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ugt=Msi.reduce((t,e)=>{let r=V6r(`Primitive.${e}`),n=H6r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,W6r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var dZ=$(K(),1);function J6r(t){let e=dZ.useRef(t);return dZ.useEffect(()=>{e.current=t}),dZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var K6r=$(K(),1),Gce=globalThis?.document?K6r.useLayoutEffect:()=>{};var G6r=$(K(),1);function X6r(t){let[e,r]=G6r.useState(void 0);return Gce(()=>{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 uU=$(wt(),1);var zgt="Popper",[Z6r,tC]=z6r(zgt),[Rsi,Y6r]=Z6r(zgt),Q6r=t=>{let{__scopePopper:e,children:r}=t,[n,o]=xv.useState(null);return(0,uU.jsx)(Rsi,{scope:e,anchor:n,onAnchorChange:o,children:r})};Q6r.displayName=zgt;var eJr="PopperAnchor",tJr=xv.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=Y6r(eJr,r),a=xv.useRef(null),s=Bgt(e,a),u=xv.useRef(null);return xv.useEffect(()=>{let l=u.current;u.current=n?.current||a.current,l!==u.current&&i.onAnchorChange(u.current)}),n?null:(0,uU.jsx)(Ugt.div,{...o,ref:s})});tJr.displayName=eJr;var Vgt="PopperContent",[Isi,Asi]=Z6r(Vgt),rJr=xv.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,y=Y6r(Vgt,r),[g,b]=xv.useState(null),_=Bgt(e,N=>b(N)),[w,T]=xv.useState(null),O=X6r(w),E=O?.width??0,P=O?.height??0,R=n+(i!=="center"?"-"+i:""),I=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},A=Array.isArray(l)?l:[l],B=A.length>0,k={padding:I,boundary:A.filter(Dsi),altBoundary:B},{refs:q,floatingStyles:Z,placement:V,isPositioned:Y,middlewareData:X}=C6r({strategy:"fixed",placement:R,whileElementsMounted:(...N)=>jgt(...N,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[x6r({mainAxis:o+P,alignmentAxis:a}),u&&T6r({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?O6r():void 0,...k}),u&&E6r({...k}),P6r({...k,apply:({elements:N,rects:z,availableWidth:H,availableHeight:oe})=>{let{width:Q,height:de}=z.reference,fe=N.floating.style;fe.setProperty("--radix-popper-available-width",`${H}px`),fe.setProperty("--radix-popper-available-height",`${oe}px`),fe.setProperty("--radix-popper-anchor-width",`${Q}px`),fe.setProperty("--radix-popper-anchor-height",`${de}px`)}}),w&&R6r({element:w,padding:s}),jsi({arrowWidth:E,arrowHeight:P}),f&&M6r({strategy:"referenceHidden",...k})]}),[W,re]=iJr(V),ue=J6r(m);Gce(()=>{Y&&ue?.()},[Y,ue]);let le=X.arrow?.x,L=X.arrow?.y,J=X.arrow?.centerOffset!==0,[ne,D]=xv.useState();return Gce(()=>{g&&D(window.getComputedStyle(g).zIndex)},[g]),(0,uU.jsx)("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:Y?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[X.transformOrigin?.x,X.transformOrigin?.y].join(" "),...X.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,uU.jsx)(Isi,{scope:r,placedSide:W,onArrowChange:T,arrowX:le,arrowY:L,shouldHideArrow:J,children:(0,uU.jsx)(Ugt.div,{"data-side":W,"data-align":re,...h,ref:_,style:{...h.style,animation:Y?void 0:"none"}})})})});rJr.displayName=Vgt;var nJr="PopperArrow",Nsi={top:"bottom",right:"left",bottom:"top",left:"right"},oJr=xv.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=Asi(nJr,n),a=Nsi[i.placedSide];return(0,uU.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,uU.jsx)(k6r,{...o,ref:r,style:{...o.style,display:"block"}})})});oJr.displayName=nJr;function Dsi(t){return t!==null}var jsi=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]=iJr(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 iJr(t){let[e,r="center"]=t.split("-");return[e,r]}var B$=Q6r,U$=tJr,lU=rJr,cU=oJr;var d$e=$(K(),1),mJr=$(yu(),1);var lJr=$(K(),1),Usi=$(yu(),1);var oh=$(K(),1);var $si=$(K(),1);function aJr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function sJr(...t){return e=>{let r=!1,n=t.map(o=>{let i=aJr(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():aJr(t[o],null)}}}}var c$e=$(wt(),1);function uJr(t){let e=Lsi(t),r=oh.forwardRef((n,o)=>{let{children:i,...a}=n,s=oh.Children.toArray(i),u=s.find(ksi);if(u){let l=u.props.children,c=s.map(d=>d===u?oh.Children.count(l)>1?oh.Children.only(null):oh.isValidElement(l)?l.props.children:null:d);return(0,c$e.jsx)(e,{...a,ref:o,children:oh.isValidElement(l)?oh.cloneElement(l,void 0,c):null})}return(0,c$e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Lsi(t){let e=oh.forwardRef((r,n)=>{let{children:o,...i}=r;if(oh.isValidElement(o)){let a=Bsi(o),s=qsi(i,o.props);return o.type!==oh.Fragment&&(s.ref=n?sJr(n,a):a),oh.cloneElement(o,s)}return oh.Children.count(o)>1?oh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Fsi=Symbol("radix.slottable");function ksi(t){return oh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Fsi}function qsi(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Bsi(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 cJr=$(wt(),1),zsi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dJr=zsi.reduce((t,e)=>{let r=uJr(`Primitive.${e}`),n=lJr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,cJr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var fJr=$(K(),1),pJr=globalThis?.document?fJr.useLayoutEffect:()=>{};var hJr=$(wt(),1),Vsi="Portal",mT=d$e.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=d$e.useState(!1);pJr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?mJr.default.createPortal((0,hJr.jsx)(dJr.div,{...n,ref:e}),a):null});mT.displayName=Vsi;var Tv=$(K(),1);var gJr=$(K(),1);function Hsi(t,e){return gJr.useReducer((r,n)=>e[r][n]??r,t)}var fZ=t=>{let{present:e,children:r}=t,n=Wsi(e),o=typeof r=="function"?r({present:n.isPresent}):Tv.Children.only(r),i=iU(n.ref,Jsi(o));return typeof r=="function"||n.isPresent?Tv.cloneElement(o,{ref:i}):null};fZ.displayName="Presence";function Wsi(t){let[e,r]=Tv.useState(),n=Tv.useRef(null),o=Tv.useRef(t),i=Tv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=Hsi(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Tv.useEffect(()=>{let l=f$e(n.current);i.current=s==="mounted"?l:"none"},[s]),zce(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=f$e(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),zce(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=f$e(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=f$e(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{c.clearTimeout(l),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:Tv.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function f$e(t){return t?.animationName||"none"}function Jsi(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 yJr=$(K(),1),bJr=$(yu(),1);var ih=$(K(),1);var p$e=$(wt(),1);function m$e(t){let e=Ksi(t),r=ih.forwardRef((n,o)=>{let{children:i,...a}=n,s=ih.Children.toArray(i),u=s.find(Xsi);if(u){let l=u.props.children,c=s.map(d=>d===u?ih.Children.count(l)>1?ih.Children.only(null):ih.isValidElement(l)?l.props.children:null:d);return(0,p$e.jsx)(e,{...a,ref:o,children:ih.isValidElement(l)?ih.cloneElement(l,void 0,c):null})}return(0,p$e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Ksi(t){let e=ih.forwardRef((r,n)=>{let{children:o,...i}=r;if(ih.isValidElement(o)){let a=Ysi(o),s=Zsi(i,o.props);return o.type!==ih.Fragment&&(s.ref=n?Uce(n,a):a),ih.cloneElement(o,s)}return ih.Children.count(o)>1?ih.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Gsi=Symbol("radix.slottable");function Xsi(t){return ih.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Gsi}function Zsi(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Ysi(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 _Jr=$(wt(),1),Qsi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pZ=Qsi.reduce((t,e)=>{let r=m$e(`Primitive.${e}`),n=yJr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,_Jr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function vJr(t,e){t&&bJr.flushSync(()=>t.dispatchEvent(e))}var eg=$(K(),1);var $Rs=!!(typeof window<"u"&&window.document&&window.document.createElement);function m3(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var SJr=$(K(),1);function wJr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Hgt(...t){return e=>{let r=!1,n=t.map(o=>{let i=wJr(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():wJr(t[o],null)}}}}function CJr(...t){return SJr.useCallback(Hgt(...t),t)}var z$=$(K(),1),xJr=$(wt(),1);function TJr(t,e=[]){let r=[];function n(i,a){let s=z$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=z$.useMemo(()=>m,Object.values(m));return(0,xJr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=z$.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=>z$.createContext(a));return function(s){let u=s?.[t]||i;return z$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,eui(o,...e)]}function eui(...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 z$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Wgt=$(K(),1);var OJr=$(K(),1),h$e=globalThis?.document?OJr.useLayoutEffect:()=>{};var tui=Wgt[" useId ".trim().toString()]||(()=>{}),rui=0;function EJr(t){let[e,r]=Wgt.useState(tui());return h$e(()=>{t||r(n=>n??String(rui++))},[t]),t||(e?`radix-${e}`:"")}var MJr=$(K(),1),uui=$(yu(),1);var ah=$(K(),1);var g$e=$(wt(),1);function PJr(t){let e=nui(t),r=ah.forwardRef((n,o)=>{let{children:i,...a}=n,s=ah.Children.toArray(i),u=s.find(iui);if(u){let l=u.props.children,c=s.map(d=>d===u?ah.Children.count(l)>1?ah.Children.only(null):ah.isValidElement(l)?l.props.children:null:d);return(0,g$e.jsx)(e,{...a,ref:o,children:ah.isValidElement(l)?ah.cloneElement(l,void 0,c):null})}return(0,g$e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function nui(t){let e=ah.forwardRef((r,n)=>{let{children:o,...i}=r;if(ah.isValidElement(o)){let a=sui(o),s=aui(i,o.props);return o.type!==ah.Fragment&&(s.ref=n?Hgt(n,a):a),ah.cloneElement(o,s)}return ah.Children.count(o)>1?ah.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var oui=Symbol("radix.slottable");function iui(t){return ah.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===oui}function aui(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function sui(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 RJr=$(wt(),1),lui=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Jgt=lui.reduce((t,e)=>{let r=PJr(`Primitive.${e}`),n=MJr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,RJr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var mZ=$(K(),1);function IJr(t){let e=mZ.useRef(t);return mZ.useEffect(()=>{e.current=t}),mZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var rC=$(K(),1);var y$e=$(K(),1);var cui=rC[" useInsertionEffect ".trim().toString()]||h$e;function AJr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=dui({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=rC.useRef(t!==void 0);rC.useEffect(()=>{let d=c.current;d!==s&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}let l=rC.useCallback(c=>{if(s){let d=fui(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function dui({defaultProp:t,onChange:e}){let[r,n]=rC.useState(t),o=rC.useRef(r),i=rC.useRef(e);return cui(()=>{i.current=e},[e]),rC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function fui(t){return typeof t=="function"}var GRs=Symbol("RADIX:SYNC_STATE");var b$e=$(K(),1),pui=$(wt(),1),mui=b$e.createContext(void 0);function NJr(t){let e=b$e.useContext(mui);return t||e||"ltr"}var dU=$(wt(),1),Kgt="rovingFocusGroup.onEntryFocus",hui={bubbles:!1,cancelable:!0},Xce="RovingFocusGroup",[Ggt,DJr,gui]=oU(Xce),[yui,Xgt]=TJr(Xce,[gui]),[bui,_ui]=yui(Xce),jJr=eg.forwardRef((t,e)=>(0,dU.jsx)(Ggt.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,dU.jsx)(Ggt.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,dU.jsx)(vui,{...t,ref:e})})}));jJr.displayName=Xce;var vui=eg.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=eg.useRef(null),p=CJr(e,f),m=NJr(i),[h,y]=AJr({prop:a,defaultProp:s??null,onChange:u,caller:Xce}),[g,b]=eg.useState(!1),_=IJr(l),w=DJr(r),T=eg.useRef(!1),[O,E]=eg.useState(0);return eg.useEffect(()=>{let P=f.current;if(P)return P.addEventListener(Kgt,_),()=>P.removeEventListener(Kgt,_)},[_]),(0,dU.jsx)(bui,{scope:r,orientation:n,dir:m,loop:o,currentTabStopId:h,onItemFocus:eg.useCallback(P=>y(P),[y]),onItemShiftTab:eg.useCallback(()=>b(!0),[]),onFocusableItemAdd:eg.useCallback(()=>E(P=>P+1),[]),onFocusableItemRemove:eg.useCallback(()=>E(P=>P-1),[]),children:(0,dU.jsx)(Jgt.div,{tabIndex:g||O===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:m3(t.onMouseDown,()=>{T.current=!0}),onFocus:m3(t.onFocus,P=>{let R=!T.current;if(P.target===P.currentTarget&&R&&!g){let I=new CustomEvent(Kgt,hui);if(P.currentTarget.dispatchEvent(I),!I.defaultPrevented){let A=w().filter(V=>V.focusable),B=A.find(V=>V.active),k=A.find(V=>V.id===h),Z=[B,k,...A].filter(Boolean).map(V=>V.ref.current);FJr(Z,c)}}T.current=!1}),onBlur:m3(t.onBlur,()=>b(!1))})})}),$Jr="RovingFocusGroupItem",LJr=eg.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,children:a,...s}=t,u=EJr(),l=i||u,c=_ui($Jr,r),d=c.currentTabStopId===l,f=DJr(r),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=c;return eg.useEffect(()=>{if(n)return p(),()=>m()},[n,p,m]),(0,dU.jsx)(Ggt.ItemSlot,{scope:r,id:l,focusable:n,active:o,children:(0,dU.jsx)(Jgt.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...s,ref:e,onMouseDown:m3(t.onMouseDown,y=>{n?c.onItemFocus(l):y.preventDefault()}),onFocus:m3(t.onFocus,()=>c.onItemFocus(l)),onKeyDown:m3(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){c.onItemShiftTab();return}if(y.target!==y.currentTarget)return;let g=Cui(y,c.orientation,c.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let _=f().filter(w=>w.focusable).map(w=>w.ref.current);if(g==="last")_.reverse();else if(g==="prev"||g==="next"){g==="prev"&&_.reverse();let w=_.indexOf(y.currentTarget);_=c.loop?xui(_,w+1):_.slice(w+1)}setTimeout(()=>FJr(_))}}),children:typeof a=="function"?a({isCurrentTabStop:d,hasTabStop:h!=null}):a})})});LJr.displayName=$Jr;var wui={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Sui(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Cui(t,e,r){let n=Sui(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return wui[n]}function FJr(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function xui(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var kJr=jJr,qJr=LJr;var hZ=$(K(),1);function _$e(t){let e=hZ.useRef(t);return hZ.useEffect(()=>{e.current=t}),hZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var Oui=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},gZ=new WeakMap,v$e=new WeakMap,w$e={},Zgt=0,BJr=function(t){return t&&(t.host||BJr(t.parentNode))},Eui=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=BJr(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})},Pui=function(t,e,r,n){var o=Eui(e,Array.isArray(t)?t:[t]);w$e[r]||(w$e[r]=new WeakMap);var i=w$e[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=(gZ.get(f)||0)+1,y=(i.get(f)||0)+1;gZ.set(f,h),i.set(f,y),a.push(f),h===1&&m&&v$e.set(f,!0),y===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(),Zgt++,function(){a.forEach(function(d){var f=gZ.get(d)-1,p=i.get(d)-1;gZ.set(d,f),i.set(d,p),f||(v$e.has(d)||d.removeAttribute(n),v$e.delete(d)),p||d.removeAttribute(r)}),Zgt--,Zgt||(gZ=new WeakMap,gZ=new WeakMap,v$e=new WeakMap,w$e={})}},fU=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||Oui(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),Pui(n,o,r,"aria-hidden")):function(){return null}};var Ov=function(){return Ov=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},Ov.apply(this,arguments)};function S$e(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 UJr(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 E$e=$(K());var ib=$(K());var h3="right-scroll-bar-position",g3="width-before-scroll-bar",Ygt="with-scroll-bars-hidden",Qgt="--removed-body-scroll-bar-size";function C$e(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var zJr=$(K());function VJr(t,e){var r=(0,zJr.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 x$e=$(K());var Mui=typeof window<"u"?x$e.useLayoutEffect:x$e.useEffect,HJr=new WeakMap;function eyt(t,e){var r=VJr(e||null,function(n){return t.forEach(function(o){return C$e(o,n)})});return Mui(function(){var n=HJr.get(r);if(n){var o=new Set(n),i=new Set(t),a=r.current;o.forEach(function(s){i.has(s)||C$e(s,null)}),i.forEach(function(s){o.has(s)||C$e(s,a)})}HJr.set(r,t)},[t]),r}function Rui(t){return t}function Iui(t,e){e===void 0&&(e=Rui);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 tyt(t){t===void 0&&(t={});var e=Iui(null);return e.options=Ov({async:!0,ssr:!1},t),e}var WJr=$(K()),JJr=function(t){var e=t.sideCar,r=S$e(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 WJr.createElement(n,Ov({},r))};JJr.isSideCarExport=!0;function ryt(t,e){return t.useMedium(e),JJr}var T$e=tyt();var nyt=function(){},Zce=ib.forwardRef(function(t,e){var r=ib.useRef(null),n=ib.useState({onScrollCapture:nyt,onWheelCapture:nyt,onTouchMoveCapture:nyt}),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.noRelative,m=t.noIsolation,h=t.inert,y=t.allowPinchZoom,g=t.as,b=g===void 0?"div":g,_=t.gapMode,w=S$e(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=f,O=eyt([r,e]),E=Ov(Ov({},w),o);return ib.createElement(ib.Fragment,null,c&&ib.createElement(T,{sideCar:T$e,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:i,allowPinchZoom:!!y,lockRef:r,gapMode:_}),a?ib.cloneElement(ib.Children.only(s),Ov(Ov({},E),{ref:O})):ib.createElement(b,Ov({},E,{className:u,ref:O}),s))});Zce.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Zce.classNames={fullWidth:g3,zeroRight:h3};var Rl=$(K());var bZ=$(K());var XJr=$(K());var KJr;var GJr=function(){if(KJr)return KJr;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Aui(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=GJr();return e&&t.setAttribute("nonce",e),t}function Nui(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Dui(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var oyt=function(){var t=0,e=null;return{add:function(r){t==0&&(e=Aui())&&(Nui(e,r),Dui(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};var iyt=function(){var t=oyt();return function(e,r){XJr.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}};var Yce=function(){var t=iyt(),e=function(r){var n=r.styles,o=r.dynamic;return t(n,o),null};return e};var jui={left:0,top:0,right:0,gap:0},ayt=function(t){return parseInt(t||"",10)||0},$ui=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[ayt(r),ayt(n),ayt(o)]},syt=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return jui;var e=$ui(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 Lui=Yce(),yZ="data-scroll-locked",Fui=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(Ygt,` {
   overflow: hidden `).concat(n,`;
   padding-right: `).concat(s,"px ").concat(n,`;
  }
  body[`).concat(yZ,`] {
    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(h3,` {
    right: `).concat(s,"px ").concat(n,`;
  }
  
  .`).concat(g3,` {
    margin-right: `).concat(s,"px ").concat(n,`;
  }
  
  .`).concat(h3," .").concat(h3,` {
    right: 0 `).concat(n,`;
  }
  
  .`).concat(g3," .").concat(g3,` {
    margin-right: 0 `).concat(n,`;
  }
  
  body[`).concat(yZ,`] {
    `).concat(Qgt,": ").concat(s,`px;
  }
`)},ZJr=function(){var t=parseInt(document.body.getAttribute(yZ)||"0",10);return isFinite(t)?t:0},kui=function(){bZ.useEffect(function(){return document.body.setAttribute(yZ,(ZJr()+1).toString()),function(){var t=ZJr()-1;t<=0?document.body.removeAttribute(yZ):document.body.setAttribute(yZ,t.toString())}},[])},uyt=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;kui();var i=bZ.useMemo(function(){return syt(o)},[o]);return bZ.createElement(Lui,{styles:Fui(i,!e,o,r?"":"!important")})};var lyt=!1;if(typeof window<"u")try{Qce=Object.defineProperty({},"passive",{get:function(){return lyt=!0,!0}}),window.addEventListener("test",Qce,Qce),window.removeEventListener("test",Qce,Qce)}catch{lyt=!1}var Qce,y3=lyt?{passive:!1}:!1;var qui=function(t){return t.tagName==="TEXTAREA"},YJr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!qui(t)&&r[e]==="visible")},Bui=function(t){return YJr(t,"overflowY")},Uui=function(t){return YJr(t,"overflowX")},cyt=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=QJr(t,n);if(o){var i=e5r(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},zui=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},Vui=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},QJr=function(t,e){return t==="v"?Bui(e):Uui(e)},e5r=function(t,e){return t==="v"?zui(e):Vui(e)},Hui=function(t,e){return t==="h"&&e==="rtl"?-1:1},t5r=function(t,e,r,n,o){var i=Hui(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{if(!s)break;var p=e5r(t,s),m=p[0],h=p[1],y=p[2],g=h-y-i*m;(m||g)&&QJr(t,s)&&(d+=g,f+=m);var b=s.parentNode;s=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}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 O$e=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},r5r=function(t){return[t.deltaX,t.deltaY]},n5r=function(t){return t&&"current"in t?t.current:t},Wui=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Jui=function(t){return`
  .block-interactivity-`.concat(t,` {pointer-events: none;}
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},Kui=0,_Z=[];function o5r(t){var e=Rl.useRef([]),r=Rl.useRef([0,0]),n=Rl.useRef(),o=Rl.useState(Kui++)[0],i=Rl.useState(Yce)[0],a=Rl.useRef(t);Rl.useEffect(function(){a.current=t},[t]),Rl.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=UJr([t.lockRef.current],(t.shards||[]).map(n5r),!0).filter(Boolean);return h.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Rl.useCallback(function(h,y){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=O$e(h),b=r.current,_="deltaX"in h?h.deltaX:b[0]-g[0],w="deltaY"in h?h.deltaY:b[1]-g[1],T,O=h.target,E=Math.abs(_)>Math.abs(w)?"h":"v";if("touches"in h&&E==="h"&&O.type==="range")return!1;var P=cyt(E,O);if(!P)return!0;if(P?T=E:(T=E==="v"?"h":"v",P=cyt(E,O)),!P)return!1;if(!n.current&&"changedTouches"in h&&(_||w)&&(n.current=T),!T)return!0;var R=n.current||T;return t5r(R,y,h,R==="h"?_:w,!0)},[]),u=Rl.useCallback(function(h){var y=h;if(!(!_Z.length||_Z[_Z.length-1]!==i)){var g="deltaY"in y?r5r(y):O$e(y),b=e.current.filter(function(T){return T.name===y.type&&(T.target===y.target||y.target===T.shadowParent)&&Wui(T.delta,g)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var _=(a.current.shards||[]).map(n5r).filter(Boolean).filter(function(T){return T.contains(y.target)}),w=_.length>0?s(y,_[0]):!a.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),l=Rl.useCallback(function(h,y,g,b){var _={name:h,delta:y,target:g,should:b,shadowParent:Gui(g)};e.current.push(_),setTimeout(function(){e.current=e.current.filter(function(w){return w!==_})},1)},[]),c=Rl.useCallback(function(h){r.current=O$e(h),n.current=void 0},[]),d=Rl.useCallback(function(h){l(h.type,r5r(h),h.target,s(h,t.lockRef.current))},[]),f=Rl.useCallback(function(h){l(h.type,O$e(h),h.target,s(h,t.lockRef.current))},[]);Rl.useEffect(function(){return _Z.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,y3),document.addEventListener("touchmove",u,y3),document.addEventListener("touchstart",c,y3),function(){_Z=_Z.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,y3),document.removeEventListener("touchmove",u,y3),document.removeEventListener("touchstart",c,y3)}},[]);var p=t.removeScrollBar,m=t.inert;return Rl.createElement(Rl.Fragment,null,m?Rl.createElement(i,{styles:Jui(o)}):null,p?Rl.createElement(uyt,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Gui(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var i5r=ryt(T$e,o5r);var a5r=E$e.forwardRef(function(t,e){return E$e.createElement(Zce,Ov({},t,{ref:e,sideCar:i5r}))});a5r.classNames=Zce.classNames;var V$=a5r;var Ro=$(wt(),1),dyt=["Enter"," "],Xui=["ArrowDown","PageUp","Home"],u5r=["ArrowUp","PageDown","End"],Zui=[...Xui,...u5r],Yui={ltr:[...dyt,"ArrowRight"],rtl:[...dyt,"ArrowLeft"]},Qui={ltr:["ArrowLeft"],rtl:["ArrowRight"]},nde="Menu",[tde,eli,tli]=oU(nde),[b3,fyt]=r3r(nde,[tli,tC,Xgt]),ode=tC(),l5r=Xgt(),[c5r,pU]=b3(nde),[rli,ide]=b3(nde),d5r=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=ode(e),[u,l]=Gr.useState(null),c=Gr.useRef(!1),d=_$e(i),f=n3r(o);return Gr.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,Ro.jsx)(B$,{...s,children:(0,Ro.jsx)(c5r,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,Ro.jsx)(rli,{scope:e,onClose:Gr.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};d5r.displayName=nde;var nli="MenuAnchor",pyt=Gr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=ode(r);return(0,Ro.jsx)(U$,{...o,...n,ref:e})});pyt.displayName=nli;var myt="MenuPortal",[oli,f5r]=b3(myt,{forceMount:void 0}),p5r=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=pU(myt,e);return(0,Ro.jsx)(oli,{scope:e,forceMount:r,children:(0,Ro.jsx)(fZ,{present:r||i.open,children:(0,Ro.jsx)(mT,{asChild:!0,container:o,children:n})})})};p5r.displayName=myt;var nC="MenuContent",[ili,hyt]=b3(nC),m5r=Gr.forwardRef((t,e)=>{let r=f5r(nC,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=pU(nC,t.__scopeMenu),a=ide(nC,t.__scopeMenu);return(0,Ro.jsx)(tde.Provider,{scope:t.__scopeMenu,children:(0,Ro.jsx)(fZ,{present:n||i.open,children:(0,Ro.jsx)(tde.Slot,{scope:t.__scopeMenu,children:a.modal?(0,Ro.jsx)(ali,{...o,ref:e}):(0,Ro.jsx)(sli,{...o,ref:e})})})})}),ali=Gr.forwardRef((t,e)=>{let r=pU(nC,t.__scopeMenu),n=Gr.useRef(null),o=iU(e,n);return Gr.useEffect(()=>{let i=n.current;if(i)return fU(i)},[]),(0,Ro.jsx)(gyt,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Gc(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),sli=Gr.forwardRef((t,e)=>{let r=pU(nC,t.__scopeMenu);return(0,Ro.jsx)(gyt,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),uli=m$e("MenuContent.ScrollLock"),gyt=Gr.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,y=pU(nC,r),g=ide(nC,r),b=ode(r),_=l5r(r),w=eli(r),[T,O]=Gr.useState(null),E=Gr.useRef(null),P=iU(e,E,y.onContentChange),R=Gr.useRef(0),I=Gr.useRef(""),A=Gr.useRef(0),B=Gr.useRef(null),k=Gr.useRef("right"),q=Gr.useRef(0),Z=m?V$:Gr.Fragment,V=m?{as:uli,allowPinchZoom:!0}:void 0,Y=W=>{let re=I.current+W,ue=w().filter(N=>!N.disabled),le=document.activeElement,L=ue.find(N=>N.ref.current===le)?.textValue,J=ue.map(N=>N.textValue),ne=wli(J,re,L),D=ue.find(N=>N.textValue===ne)?.ref.current;(function N(z){I.current=z,window.clearTimeout(R.current),z!==""&&(R.current=window.setTimeout(()=>N(""),1e3))})(re),D&&setTimeout(()=>D.focus())};Gr.useEffect(()=>()=>window.clearTimeout(R.current),[]),aU();let X=Gr.useCallback(W=>k.current===B.current?.side&&Cli(W,B.current?.area),[]);return(0,Ro.jsx)(ili,{scope:r,searchRef:I,onItemEnter:Gr.useCallback(W=>{X(W)&&W.preventDefault()},[X]),onItemLeave:Gr.useCallback(W=>{X(W)||(E.current?.focus(),O(null))},[X]),onTriggerLeave:Gr.useCallback(W=>{X(W)&&W.preventDefault()},[X]),pointerGraceTimerRef:A,onPointerGraceIntentChange:Gr.useCallback(W=>{B.current=W},[]),children:(0,Ro.jsx)(Z,{...V,children:(0,Ro.jsx)(F$,{asChild:!0,trapped:o,onMountAutoFocus:Gc(i,W=>{W.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,Ro.jsx)(lT,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Ro.jsx)(kJr,{asChild:!0,..._,dir:g.dir,orientation:"vertical",loop:n,currentTabStopId:T,onCurrentTabStopIdChange:O,onEntryFocus:Gc(u,W=>{g.isUsingKeyboardRef.current||W.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Ro.jsx)(lU,{role:"menu","aria-orientation":"vertical","data-state":R5r(y.open),"data-radix-menu-content":"",dir:g.dir,...b,...h,ref:P,style:{outline:"none",...h.style},onKeyDown:Gc(h.onKeyDown,W=>{let ue=W.target.closest("[data-radix-menu-content]")===W.currentTarget,le=W.ctrlKey||W.altKey||W.metaKey,L=W.key.length===1;ue&&(W.key==="Tab"&&W.preventDefault(),!le&&L&&Y(W.key));let J=E.current;if(W.target!==J||!Zui.includes(W.key))return;W.preventDefault();let D=w().filter(N=>!N.disabled).map(N=>N.ref.current);u5r.includes(W.key)&&D.reverse(),_li(D)}),onBlur:Gc(t.onBlur,W=>{W.currentTarget.contains(W.target)||(window.clearTimeout(R.current),I.current="")}),onPointerMove:Gc(t.onPointerMove,rde(W=>{let re=W.target,ue=q.current!==W.clientX;if(W.currentTarget.contains(re)&&ue){let le=W.clientX>q.current?"right":"left";k.current=le,q.current=W.clientX}}))})})})})})})});m5r.displayName=nC;var lli="MenuGroup",yyt=Gr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Ro.jsx)(pZ.div,{role:"group",...n,ref:e})});yyt.displayName=lli;var cli="MenuLabel",h5r=Gr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Ro.jsx)(pZ.div,{...n,ref:e})});h5r.displayName=cli;var P$e="MenuItem",s5r="menu.itemSelect",R$e=Gr.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=Gr.useRef(null),a=ide(P$e,t.__scopeMenu),s=hyt(P$e,t.__scopeMenu),u=iU(e,i),l=Gr.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(s5r,{bubbles:!0,cancelable:!0});d.addEventListener(s5r,p=>n?.(p),{once:!0}),vJr(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,Ro.jsx)(g5r,{...o,ref:u,disabled:r,onClick:Gc(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:Gc(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:Gc(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||dyt.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});R$e.displayName=P$e;var g5r=Gr.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=hyt(P$e,r),s=l5r(r),u=Gr.useRef(null),l=iU(e,u),[c,d]=Gr.useState(!1),[f,p]=Gr.useState("");return Gr.useEffect(()=>{let m=u.current;m&&p((m.textContent??"").trim())},[i.children]),(0,Ro.jsx)(tde.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,Ro.jsx)(qJr,{asChild:!0,...s,focusable:!n,children:(0,Ro.jsx)(pZ.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:Gc(t.onPointerMove,rde(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Gc(t.onPointerLeave,rde(m=>a.onItemLeave(m))),onFocus:Gc(t.onFocus,()=>d(!0)),onBlur:Gc(t.onBlur,()=>d(!1))})})})}),dli="MenuCheckboxItem",y5r=Gr.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,Ro.jsx)(S5r,{scope:t.__scopeMenu,checked:r,children:(0,Ro.jsx)(R$e,{role:"menuitemcheckbox","aria-checked":M$e(r)?"mixed":r,...o,ref:e,"data-state":vyt(r),onSelect:Gc(o.onSelect,()=>n?.(M$e(r)?!0:!r),{checkForDefaultPrevented:!1})})})});y5r.displayName=dli;var b5r="MenuRadioGroup",[fli,pli]=b3(b5r,{value:void 0,onValueChange:()=>{}}),_5r=Gr.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=_$e(n);return(0,Ro.jsx)(fli,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,Ro.jsx)(yyt,{...o,ref:e})})});_5r.displayName=b5r;var v5r="MenuRadioItem",w5r=Gr.forwardRef((t,e)=>{let{value:r,...n}=t,o=pli(v5r,t.__scopeMenu),i=r===o.value;return(0,Ro.jsx)(S5r,{scope:t.__scopeMenu,checked:i,children:(0,Ro.jsx)(R$e,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":vyt(i),onSelect:Gc(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});w5r.displayName=v5r;var byt="MenuItemIndicator",[S5r,mli]=b3(byt,{checked:!1}),C5r=Gr.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=mli(byt,r);return(0,Ro.jsx)(fZ,{present:n||M$e(i.checked)||i.checked===!0,children:(0,Ro.jsx)(pZ.span,{...o,ref:e,"data-state":vyt(i.checked)})})});C5r.displayName=byt;var hli="MenuSeparator",x5r=Gr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Ro.jsx)(pZ.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});x5r.displayName=hli;var gli="MenuArrow",T5r=Gr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=ode(r);return(0,Ro.jsx)(cU,{...o,...n,ref:e})});T5r.displayName=gli;var _yt="MenuSub",[yli,O5r]=b3(_yt),bli=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=pU(_yt,e),a=ode(e),[s,u]=Gr.useState(null),[l,c]=Gr.useState(null),d=_$e(o);return Gr.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,Ro.jsx)(B$,{...a,children:(0,Ro.jsx)(c5r,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,Ro.jsx)(yli,{scope:e,contentId:Igt(),triggerId:Igt(),trigger:s,onTriggerChange:u,children:r})})})};bli.displayName=_yt;var ede="MenuSubTrigger",E5r=Gr.forwardRef((t,e)=>{let r=pU(ede,t.__scopeMenu),n=ide(ede,t.__scopeMenu),o=O5r(ede,t.__scopeMenu),i=hyt(ede,t.__scopeMenu),a=Gr.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:t.__scopeMenu},c=Gr.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return Gr.useEffect(()=>c,[c]),Gr.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,Ro.jsx)(pyt,{asChild:!0,...l,children:(0,Ro.jsx)(g5r,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":R5r(r.open),...t,ref:Uce(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Gc(t.onPointerMove,rde(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:Gc(t.onPointerLeave,rde(d=>{c();let f=r.content?.getBoundingClientRect();if(f){let p=r.content?.dataset.side,m=p==="right",h=m?-5:5,y=f[m?"left":"right"],g=f[m?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+h,y:d.clientY},{x:y,y:f.top},{x:g,y:f.top},{x:g,y:f.bottom},{x:y,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:Gc(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||Yui[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});E5r.displayName=ede;var P5r="MenuSubContent",M5r=Gr.forwardRef((t,e)=>{let r=f5r(nC,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=pU(nC,t.__scopeMenu),a=ide(nC,t.__scopeMenu),s=O5r(P5r,t.__scopeMenu),u=Gr.useRef(null),l=iU(e,u);return(0,Ro.jsx)(tde.Provider,{scope:t.__scopeMenu,children:(0,Ro.jsx)(fZ,{present:n||i.open,children:(0,Ro.jsx)(tde.Slot,{scope:t.__scopeMenu,children:(0,Ro.jsx)(gyt,{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:Gc(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Gc(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:Gc(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=Qui[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});M5r.displayName=P5r;function R5r(t){return t?"open":"closed"}function M$e(t){return t==="indeterminate"}function vyt(t){return M$e(t)?"indeterminate":t?"checked":"unchecked"}function _li(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function vli(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function wli(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=vli(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 Sli(t,e){let{x:r,y:n}=t,o=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let s=e[i],u=e[a],l=s.x,c=s.y,d=u.x,f=u.y;c>n!=f>n&&r<(d-l)*(n-c)/(f-c)+l&&(o=!o)}return o}function Cli(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return Sli(r,e)}function rde(t){return e=>e.pointerType==="mouse"?t(e):void 0}var I5r=d5r,A5r=pyt,N5r=p5r,D5r=m5r,j5r=yyt,$5r=h5r,L5r=R$e,F5r=y5r,k5r=_5r,q5r=w5r,B5r=C5r,U5r=x5r,z5r=T5r;var V5r=E5r,H5r=M5r;var wyt=$(K(),1);var Tli=wyt[" useId ".trim().toString()]||(()=>{}),Oli=0;function Syt(t){let[e,r]=wyt.useState(Tli());return qje(()=>{t||r(n=>n??String(Oli++))},[t]),t||(e?`radix-${e}`:"")}var tg=$(wt(),1),I$e="DropdownMenu",[Eli,HAs]=UWr(I$e,[fyt]),i_=fyt(),[Pli,W5r]=Eli(I$e),ade=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=i_(e),l=sh.useRef(null),[c,d]=VWr({prop:o,defaultProp:i??!1,onChange:a,caller:I$e});return(0,tg.jsx)(Pli,{scope:e,triggerId:Syt(),triggerRef:l,contentId:Syt(),open:c,onOpenChange:d,onOpenToggle:sh.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,tg.jsx)(I5r,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};ade.displayName=I$e;var J5r="DropdownMenuTrigger",sde=sh.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=W5r(J5r,r),a=i_(r);return(0,tg.jsx)(A5r,{asChild:!0,...a,children:(0,tg.jsx)(KWr.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:kje(e,i.triggerRef),onPointerDown:Bce(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:Bce(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});sde.displayName=J5r;var Mli="DropdownMenuPortal",K5r=t=>{let{__scopeDropdownMenu:e,...r}=t,n=i_(e);return(0,tg.jsx)(N5r,{...n,...r})};K5r.displayName=Mli;var G5r="DropdownMenuContent",X5r=sh.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=W5r(G5r,r),i=i_(r),a=sh.useRef(!1);return(0,tg.jsx)(D5r,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:Bce(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:Bce(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)"}})});X5r.displayName=G5r;var Rli="DropdownMenuGroup",Ili=sh.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=i_(r);return(0,tg.jsx)(j5r,{...o,...n,ref:e})});Ili.displayName=Rli;var Ali="DropdownMenuLabel",Z5r=sh.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=i_(r);return(0,tg.jsx)($5r,{...o,...n,ref:e})});Z5r.displayName=Ali;var Nli="DropdownMenuItem",Y5r=sh.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=i_(r);return(0,tg.jsx)(L5r,{...o,...n,ref:e})});Y5r.displayName=Nli;var Dli="DropdownMenuCheckboxItem",Q5r=sh.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=i_(r);return(0,tg.jsx)(F5r,{...o,...n,ref:e})});Q5r.displayName=Dli;var jli="DropdownMenuRadioGroup",$li=sh.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=i_(r);return(0,tg.jsx)(k5r,{...o,...n,ref:e})});$li.displayName=jli;var Lli="DropdownMenuRadioItem",eKr=sh.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=i_(r);return(0,tg.jsx)(q5r,{...o,...n,ref:e})});eKr.displayName=Lli;var Fli="DropdownMenuItemIndicator",tKr=sh.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=i_(r);return(0,tg.jsx)(B5r,{...o,...n,ref:e})});tKr.displayName=Fli;var kli="DropdownMenuSeparator",rKr=sh.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=i_(r);return(0,tg.jsx)(U5r,{...o,...n,ref:e})});rKr.displayName=kli;var qli="DropdownMenuArrow",Bli=sh.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=i_(r);return(0,tg.jsx)(z5r,{...o,...n,ref:e})});Bli.displayName=qli;var Uli="DropdownMenuSubTrigger",nKr=sh.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=i_(r);return(0,tg.jsx)(V5r,{...o,...n,ref:e})});nKr.displayName=Uli;var zli="DropdownMenuSubContent",oKr=sh.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=i_(r);return(0,tg.jsx)(H5r,{...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)"}})});oKr.displayName=zli;var iKr=ade,aKr=sde,sKr=K5r,Cyt=X5r;var xyt=Z5r,Tyt=Y5r,Oyt=Q5r;var Eyt=eKr,Pyt=tKr,Myt=rKr;var Ryt=nKr,Iyt=oKr;Mr();var uKr=require("obsidian");zr();var sN=iKr,uN=aKr;var Hli=zu.forwardRef(({className:t,inset:e,children:r,...n},o)=>zu.createElement(Ryt,{ref:o,className:Se("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-modifier-hover data-[state=open]:tw-bg-modifier-hover [&_svg]:tw-pointer-events-none [&_svg]:tw-size-4 [&_svg]:tw-shrink-0",e&&"tw-pl-8",t),...n},r,zu.createElement(od,{className:"tw-ml-auto"})));Hli.displayName=Ryt.displayName;var Wli=zu.forwardRef(({className:t,...e},r)=>zu.createElement(Iyt,{ref:r,className:Se("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}));Wli.displayName=Iyt.displayName;var Ev=zu.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>zu.createElement(sKr,{container:r??activeDocument.body},zu.createElement(Cyt,{ref:o,sideOffset:e,hideWhenDetached:uKr.Platform.isMobile,className:Se("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})));Ev.displayName=Cyt.displayName;var Ai=zu.forwardRef(({className:t,inset:e,...r},n)=>zu.createElement(Tyt,{ref:n,className:Se("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-modifier-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}));Ai.displayName=Tyt.displayName;var Jli=zu.forwardRef(({className:t,children:e,checked:r,...n},o)=>zu.createElement(Oyt,{ref:o,className:Se("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-modifier-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t),checked:r,...n},zu.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},zu.createElement(Pyt,null,zu.createElement(Yu,{className:"tw-size-4"}))),e));Jli.displayName=Oyt.displayName;var Kli=zu.forwardRef(({className:t,children:e,...r},n)=>zu.createElement(Eyt,{ref:n,className:Se("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-modifier-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t),...r},zu.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},zu.createElement(Pyt,null,zu.createElement(_re,{className:"tw-size-2 tw-fill-current"}))),e));Kli.displayName=Eyt.displayName;var Gli=zu.forwardRef(({className:t,inset:e,...r},n)=>zu.createElement(xyt,{ref:n,className:Se("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",e&&"tw-pl-8",t),...r}));Gli.displayName=xyt.displayName;var Xli=zu.forwardRef(({className:t,...e},r)=>zu.createElement(Myt,{ref:r,className:Se("-tw-mx-1 tw-my-1 tw-h-px",t),...e}));Xli.displayName=Myt.displayName;var Zli=({className:t,...e})=>zu.createElement("span",{className:Se("tw-ml-auto tw-text-xs tw-tracking-widest tw-opacity-60",t),...e});Zli.displayName="DropdownMenuShortcut";Qe();Dt();Mr();zr();function vZ({disabled:t=!1,size:e="fit",variant:r="ghost2",className:n,value:o,onChange:i}){let[a,s]=(0,a_.useState)(null),u=kr(),l=u.activeModels.find(d=>d.enabled&&no(d)===o),c=u.activeModels;return a_.default.createElement(sN,null,a_.default.createElement(uN,{asChild:!0},a_.default.createElement(me,{variant:r,size:e,disabled:t,className:Se("tw-min-w-0 tw-justify-start tw-text-muted",n)},a_.default.createElement("div",{className:"tw-min-w-0 tw-flex-1 tw-truncate"},a?a_.default.createElement("span",{className:"tw-truncate tw-text-error"},"Model Load Failed"):l?a_.default.createElement(rgt,{model:l,iconSize:8}):a_.default.createElement("span",{className:"tw-truncate"},"Select Model")),!t&&a_.default.createElement(Ji,{className:"tw-mt-0.5 tw-size-5 tw-shrink-0"}))),a_.default.createElement(Ev,{align:"start",className:"tw-max-h-64 tw-overflow-y-auto"},c.filter(d=>d.enabled).map(d=>{let{hasApiKey:f}=qJ(d,u);return a_.default.createElement(Ai,{key:no(d),disabled:!f,onSelect:async p=>{if(!f){p.preventDefault();return}try{s(null),i(no(d))}catch(m){let h="Model switch failed: "+Wr(m);s(h);let y=c.find(g=>g.enabled&&no(g)===o);y&&i(no(y))}},className:f?"":"tw-cursor-not-allowed tw-opacity-50"},a_.default.createElement(rgt,{model:d,iconSize:12}),!f&&a_.default.createElement("span",{className:"tw-ml-auto tw-text-smallest tw-text-faint"},"Needs API key"))})))}xn();var dde=$(K());var oi=$(K(),1);var aNs=!!(typeof window<"u"&&window.document&&window.document.createElement);function _3(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var cKr=$(K(),1);function lKr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ayt(...t){return e=>{let r=!1,n=t.map(o=>{let i=lKr(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():lKr(t[o],null)}}}}function ude(...t){return cKr.useCallback(Ayt(...t),t)}var H$=$(K(),1),dKr=$(wt(),1);function fKr(t,e=[]){let r=[];function n(i,a){let s=H$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=H$.useMemo(()=>m,Object.values(m));return(0,dKr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=H$.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=>H$.createContext(a));return function(s){let u=s?.[t]||i;return H$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Yli(o,...e)]}function Yli(...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 H$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Nyt=$(K(),1);var pKr=$(K(),1),v3=globalThis?.document?pKr.useLayoutEffect:()=>{};var Qli=Nyt[" useId ".trim().toString()]||(()=>{}),eci=0;function mKr(t){let[e,r]=Nyt.useState(Qli());return v3(()=>{t||r(n=>n??String(eci++))},[t]),t||(e?`radix-${e}`:"")}var Pv=$(K(),1);var hKr=$(K(),1);function tci(t,e){return hKr.useReducer((r,n)=>e[r][n]??r,t)}var N$e=t=>{let{present:e,children:r}=t,n=rci(e),o=typeof r=="function"?r({present:n.isPresent}):Pv.Children.only(r),i=ude(n.ref,nci(o));return typeof r=="function"||n.isPresent?Pv.cloneElement(o,{ref:i}):null};N$e.displayName="Presence";function rci(t){let[e,r]=Pv.useState(),n=Pv.useRef(null),o=Pv.useRef(t),i=Pv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=tci(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Pv.useEffect(()=>{let l=A$e(n.current);i.current=s==="mounted"?l:"none"},[s]),v3(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=A$e(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),v3(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=A$e(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=A$e(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{c.clearTimeout(l),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:Pv.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function A$e(t){return t?.animationName||"none"}function nci(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 _Kr=$(K(),1),uci=$(yu(),1);var uh=$(K(),1);var wZ=$(wt(),1);function gKr(t){let e=oci(t),r=uh.forwardRef((n,o)=>{let{children:i,...a}=n,s=uh.Children.toArray(i),u=s.find(ici);if(u){let l=u.props.children,c=s.map(d=>d===u?uh.Children.count(l)>1?uh.Children.only(null):uh.isValidElement(l)?l.props.children:null:d);return(0,wZ.jsx)(e,{...a,ref:o,children:uh.isValidElement(l)?uh.cloneElement(l,void 0,c):null})}return(0,wZ.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function oci(t){let e=uh.forwardRef((r,n)=>{let{children:o,...i}=r;if(uh.isValidElement(o)){let a=sci(o),s=aci(i,o.props);return o.type!==uh.Fragment&&(s.ref=n?Ayt(n,a):a),uh.cloneElement(o,s)}return uh.Children.count(o)>1?uh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var yKr=Symbol("radix.slottable");function bKr(t){let e=({children:r})=>(0,wZ.jsx)(wZ.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=yKr,e}function ici(t){return uh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===yKr}function aci(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function sci(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 vKr=$(wt(),1),lci=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wKr=lci.reduce((t,e)=>{let r=gKr(`Primitive.${e}`),n=_Kr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,vKr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var oC=$(K(),1);var D$e=$(K(),1);var cci=oC[" useInsertionEffect ".trim().toString()]||v3;function SKr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=dci({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=oC.useRef(t!==void 0);oC.useEffect(()=>{let d=c.current;d!==s&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}let l=oC.useCallback(c=>{if(s){let d=fci(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function dci({defaultProp:t,onChange:e}){let[r,n]=oC.useState(t),o=oC.useRef(r),i=oC.useRef(e);return cci(()=>{i.current=e},[e]),oC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function fci(t){return typeof t=="function"}var wNs=Symbol("RADIX:SYNC_STATE");var MKr=$(K(),1);var OKr=$(K(),1),_ci=$(yu(),1);var lh=$(K(),1);var pci=$(K(),1);function CKr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function xKr(...t){return e=>{let r=!1,n=t.map(o=>{let i=CKr(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():CKr(t[o],null)}}}}var j$e=$(wt(),1);function TKr(t){let e=mci(t),r=lh.forwardRef((n,o)=>{let{children:i,...a}=n,s=lh.Children.toArray(i),u=s.find(gci);if(u){let l=u.props.children,c=s.map(d=>d===u?lh.Children.count(l)>1?lh.Children.only(null):lh.isValidElement(l)?l.props.children:null:d);return(0,j$e.jsx)(e,{...a,ref:o,children:lh.isValidElement(l)?lh.cloneElement(l,void 0,c):null})}return(0,j$e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function mci(t){let e=lh.forwardRef((r,n)=>{let{children:o,...i}=r;if(lh.isValidElement(o)){let a=bci(o),s=yci(i,o.props);return o.type!==lh.Fragment&&(s.ref=n?xKr(n,a):a),lh.cloneElement(o,s)}return lh.Children.count(o)>1?lh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var hci=Symbol("radix.slottable");function gci(t){return lh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===hci}function yci(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function bci(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 EKr=$(wt(),1),vci=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],PKr=vci.reduce((t,e)=>{let r=TKr(`Primitive.${e}`),n=OKr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,EKr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var RKr=$(wt(),1),Dyt=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),wci="VisuallyHidden",IKr=MKr.forwardRef((t,e)=>(0,RKr.jsx)(PKr.span,{...t,ref:e,style:{...Dyt,...t.style}}));IKr.displayName=wci;var AKr=IKr;var ym=$(wt(),1),[$$e,qNs]=fKr("Tooltip",[tC]),L$e=tC(),NKr="TooltipProvider",Cci=700,jyt="tooltip.open",[xci,Lyt]=$$e(NKr),DKr=t=>{let{__scopeTooltip:e,delayDuration:r=Cci,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,a=oi.useRef(!0),s=oi.useRef(!1),u=oi.useRef(0);return oi.useEffect(()=>{let l=u.current;return()=>window.clearTimeout(l)},[]),(0,ym.jsx)(xci,{scope:e,isOpenDelayedRef:a,delayDuration:r,onOpen:oi.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:oi.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:oi.useCallback(l=>{s.current=l},[]),disableHoverableContent:o,children:i})};DKr.displayName=NKr;var lde="Tooltip",[Tci,cde]=$$e(lde),jKr=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=Lyt(lde,t.__scopeTooltip),l=L$e(e),[c,d]=oi.useState(null),f=mKr(),p=oi.useRef(0),m=a??u.disableHoverableContent,h=s??u.delayDuration,y=oi.useRef(!1),[g,b]=SKr({prop:n,defaultProp:o??!1,onChange:E=>{E?(u.onOpen(),document.dispatchEvent(new CustomEvent(jyt))):u.onClose(),i?.(E)},caller:lde}),_=oi.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),w=oi.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,b(!0)},[b]),T=oi.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b(!1)},[b]),O=oi.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,b(!0),p.current=0},h)},[h,b]);return oi.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,ym.jsx)(B$,{...l,children:(0,ym.jsx)(Tci,{scope:e,contentId:f,open:g,stateAttribute:_,trigger:c,onTriggerChange:d,onTriggerEnter:oi.useCallback(()=>{u.isOpenDelayedRef.current?O():w()},[u.isOpenDelayedRef,O,w]),onTriggerLeave:oi.useCallback(()=>{m?T():(window.clearTimeout(p.current),p.current=0)},[T,m]),onOpen:w,onClose:T,disableHoverableContent:m,children:r})})};jKr.displayName=lde;var $yt="TooltipTrigger",$Kr=oi.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=cde($yt,r),i=Lyt($yt,r),a=L$e(r),s=oi.useRef(null),u=ude(e,s,o.onTriggerChange),l=oi.useRef(!1),c=oi.useRef(!1),d=oi.useCallback(()=>l.current=!1,[]);return oi.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,ym.jsx)(U$,{asChild:!0,...a,children:(0,ym.jsx)(wKr.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:_3(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:_3(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:_3(t.onPointerDown,()=>{o.open&&o.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:_3(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:_3(t.onBlur,o.onClose),onClick:_3(t.onClick,o.onClose)})})});$Kr.displayName=$yt;var Fyt="TooltipPortal",[Oci,Eci]=$$e(Fyt,{forceMount:void 0}),LKr=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=cde(Fyt,e);return(0,ym.jsx)(Oci,{scope:e,forceMount:r,children:(0,ym.jsx)(N$e,{present:r||i.open,children:(0,ym.jsx)(mT,{asChild:!0,container:o,children:n})})})};LKr.displayName=Fyt;var SZ="TooltipContent",FKr=oi.forwardRef((t,e)=>{let r=Eci(SZ,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=cde(SZ,t.__scopeTooltip);return(0,ym.jsx)(N$e,{present:n||a.open,children:a.disableHoverableContent?(0,ym.jsx)(kKr,{side:o,...i,ref:e}):(0,ym.jsx)(Pci,{side:o,...i,ref:e})})}),Pci=oi.forwardRef((t,e)=>{let r=cde(SZ,t.__scopeTooltip),n=Lyt(SZ,t.__scopeTooltip),o=oi.useRef(null),i=ude(e,o),[a,s]=oi.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=oi.useCallback(()=>{s(null),d(!1)},[d]),p=oi.useCallback((m,h)=>{let y=m.currentTarget,g={x:m.clientX,y:m.clientY},b=Nci(g,y.getBoundingClientRect()),_=Dci(g,b),w=jci(h.getBoundingClientRect()),T=Lci([..._,...w]);s(T),d(!0)},[d]);return oi.useEffect(()=>()=>f(),[f]),oi.useEffect(()=>{if(u&&c){let m=y=>p(y,c),h=y=>p(y,u);return u.addEventListener("pointerleave",m),c.addEventListener("pointerleave",h),()=>{u.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",h)}}},[u,c,p,f]),oi.useEffect(()=>{if(a){let m=h=>{let y=h.target,g={x:h.clientX,y:h.clientY},b=u?.contains(y)||c?.contains(y),_=!$ci(g,a);b?f():_&&(f(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[u,c,a,l,f]),(0,ym.jsx)(kKr,{...t,ref:i})}),[Mci,Rci]=$$e(lde,{isInside:!1}),Ici=bKr("TooltipContent"),kKr=oi.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=cde(SZ,r),l=L$e(r),{onClose:c}=u;return oi.useEffect(()=>(document.addEventListener(jyt,c),()=>document.removeEventListener(jyt,c)),[c]),oi.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,ym.jsx)(lT,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,ym.jsxs)(lU,{"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,ym.jsx)(Ici,{children:n}),(0,ym.jsx)(Mci,{scope:r,isInside:!0,children:(0,ym.jsx)(AKr,{id:u.contentId,role:"tooltip",children:o||n})})]})})});FKr.displayName=SZ;var qKr="TooltipArrow",Aci=oi.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=L$e(r);return Rci(qKr,r).isInside?null:(0,ym.jsx)(cU,{...o,...n,ref:e})});Aci.displayName=qKr;function Nci(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 Dci(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 jci(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 $ci(t,e){let{x:r,y:n}=t,o=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let s=e[i],u=e[a],l=s.x,c=s.y,d=u.x,f=u.y;c>n!=f>n&&r<(d-l)*(n-c)/(f-c)+l&&(o=!o)}return o}function Lci(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),Fci(e)}function Fci(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 F$e=DKr,BKr=jKr,UKr=$Kr,zKr=LKr,kyt=FKr;zr();var s_=F$e,vn=BKr,wn=UKr,pn=dde.forwardRef(({className:t,sideOffset:e=4,...r},n)=>dde.createElement(zKr,{container:activeDocument.body},dde.createElement(kyt,{ref:n,sideOffset:e,className:Se("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})));pn.displayName=kyt.displayName;Mr();var hT=$(K()),HKr=require("obsidian"),to=({content:t,children:e,side:r="bottom",delayDuration:n=0,contentClassName:o,buttonClassName:i})=>{let a=HKr.Platform.isMobile,[s,u]=(0,hT.useState)(!1),l=hT.default.useRef(!1),c=()=>{a&&(l.current=!0)},d=()=>{a&&(u(!s),setTimeout(()=>{l.current=!1},100))};return hT.default.createElement(s_,{delayDuration:n},hT.default.createElement(vn,{open:s,onOpenChange:f=>{a&&l.current||u(f)}},hT.default.createElement(wn,{asChild:!0},e?hT.default.createElement("div",{onClick:d,onTouchStart:c,className:"tw-cursor-pointer"},e):hT.default.createElement(me,{variant:"ghost",size:"sm",onClick:d,onTouchStart:c,className:`tw-inline-flex tw-size-6 tw-items-center tw-justify-center tw-p-0 hover:tw-bg-transparent hover:tw-text-normal ${i||""}`},hT.default.createElement(MF,{className:"tw-size-4"}))),hT.default.createElement(pn,{side:r,className:o},t)))};xn();function Uyt({open:t,onClose:e,commandIcon:r,commandLabel:n,contentState:o,editableContent:i,onEditableContentChange:a,followUpValue:s,onFollowUpChange:u,onFollowUpSubmit:l,selectedModel:c,onSelectModel:d,onStop:f,onCopy:p,onInsert:m,onReplace:h,initialPosition:y,anchorBottom:g,resizable:b=!1,hideContentAreaOnIdle:_=!1,includeNoteContext:w,onIncludeNoteContextChange:T,renderMarkdown:O}){let E=o.type==="loading"||o.type==="result"&&o.isStreaming?"loading":o.type==="result"?"result":"idle",P=o.type==="loading"||o.type==="result"&&!!o.isStreaming,R=o.type==="result"&&!o.isStreaming&&!!a,I=(0,k$e.useRef)(null);(0,k$e.useEffect)(()=>{if(!t)return;let k=I.current?.closest('[data-copilot-draggable-modal="true"]'),q=k?.ownerDocument??document,Z=V=>{if(E!=="result")return;let Y=WKr.Platform.isMacOS?V.metaKey:V.ctrlKey;if(V.key!=="Enter"||!Y)return;let X=q.activeElement;k&&(!X||!k.contains(X))||(V.shiftKey?(V.preventDefault(),V.stopPropagation(),m?.()):(V.preventDefault(),V.stopPropagation(),h?.()))};return q.addEventListener("keydown",Z),()=>q.removeEventListener("keydown",Z)},[t,E,m,h]);let A=_?o.type!=="idle":!0;return ab.createElement(hgt,{open:t,onClose:e,initialPosition:y,anchorBottom:g,resizable:b,minHeight:b?A?400:180:void 0,closeOnEscapeFromOutside:!0},ab.createElement(cgt,{icon:r,label:n,className:"tw-border-b tw-border-border"}),A&&ab.createElement(dgt,{state:o,editable:R,value:i,onChange:a,disableAutoGrow:b,minHeight:b?"0px":void 0,renderMarkdown:O}),ab.createElement(fgt,{value:s,onChange:u,onSubmit:()=>{P||l()},onClear:()=>u(""),placeholder:"Enter follow-up instructions...",className:A?void 0:"tw-mt-auto",hint:P?"Generating...":void 0,autoFocus:!0}),ab.createElement("div",{ref:I,className:"tw-flex tw-flex-none tw-items-center tw-justify-between tw-border-t tw-border-border tw-px-4 tw-py-3"},ab.createElement("div",{className:"tw-flex tw-items-center tw-gap-3"},ab.createElement(vZ,{size:"sm",variant:"ghost",value:c,onChange:d,disabled:P}),T&&ab.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ab.createElement(Uu,{id:"menuCommandIncludeContext",checked:w,onCheckedChange:k=>T(!!k),className:"tw-size-3.5",disabled:P}),ab.createElement("label",{htmlFor:"menuCommandIncludeContext",className:"tw-cursor-pointer tw-text-xs tw-text-muted"},"Note"),ab.createElement(to,{content:"Include the active note's content as context",side:"top"}))),ab.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},_&&E==="idle"&&ab.createElement(me,{variant:"default",size:"sm",onClick:l,disabled:!s.trim()||P,title:"Send message"},ab.createElement(U4,{className:"tw-mr-1 tw-size-4"}),"Send"),ab.createElement(mgt,{state:E,onStop:f,onCopy:p,onInsert:m,onReplace:h}))))}Xe();var fde=require("@codemirror/state"),w3=require("@codemirror/view");function pde(t){let e=fde.StateEffect.define(),r=w3.Decoration.mark({class:t});function n(f,p,m){let h=Math.max(0,Math.min(p,f)),y=Math.max(0,Math.min(m,f));return h===y?null:{from:Math.min(h,y),to:Math.max(h,y)}}let o=fde.StateField.define({create:()=>null,update(f,p){let m=f;if(m&&!p.changes.empty){let h=p.changes.mapPos(m.from,1),y=p.changes.mapPos(m.to,-1);m=n(p.state.doc.length,h,y)}for(let h of p.effects)h.is(e)&&(m=h.value?n(p.state.doc.length,h.value.from,h.value.to):null);return m},provide:f=>w3.EditorView.decorations.from(f,p=>p?w3.Decoration.set([r.range(p.from,p.to)]):w3.Decoration.none)}),i=w3.EditorView.baseTheme({[`.${t}`]:{backgroundColor:"var(--text-selection)",borderRadius:"2px"}}),a=[o,i];function s(f){return f.state.field(o,!1)!==void 0}function u(f,p){let m=[];if(!p)return s(f)&&m.push(e.of(null)),m;let h=n(f.state.doc.length,p.from,p.to);return h?(s(f)||m.push(fde.StateEffect.appendConfig.of(a)),m.push(e.of(h)),m):(s(f)&&m.push(e.of(null)),m)}function l(f,p,m){let h=u(f,{from:p,to:m});h.length>0&&f.dispatch({effects:h})}function c(f){let p=u(f,null);p.length>0&&f.dispatch({effects:p})}function d(f){return f.state.field(o,!1)??null}return{field:o,effect:e,extension:a,show:l,hide:c,buildEffects:u,getRange:d}}var mde=pde("copilot-selection-highlight"),kci=mde.extension;function JKr(t,e){try{t.dispatch(e)}catch(r){ie("SelectionHighlight dispatch failed:",r)}}function qci(t,e){return mde.buildEffects(t,e)}function zyt(t,e,r){let n=mde.buildEffects(t,{from:e,to:r});n.length>0&&JKr(t,{effects:n})}function KKr(t,e,r){zyt(t,e,r)}function GKr(t){let e=mde.buildEffects(t,null);e.length>0&&JKr(t,{effects:e})}function Bci(t){return mde.getRange(t)}var Mv={show:zyt,update:KKr,hide:GKr,getRange:Bci,buildEffects:qci};Xe();function CZ(t){switch(t){case"no_range":return"No selection range available.";case"range_out_of_bounds":return"Selection range is out of bounds.";case"content_changed":return"Selection content has changed. Please reselect and try again.";case"file_changed":return"File has changed. Please reselect in the original file.";case"editor_changed":return"Editor has changed. Please reselect and try again.";case"leaf_changed":return"Editor pane has changed. Please reselect and try again.";case"target_unavailable":return"Editor is no longer available.";default:return"Cannot replace. Please reselect and try again."}}function XKr(t,e,r){let n=t.state.toText(r);t.dispatch({changes:{from:e.from,to:e.to,insert:n},selection:{anchor:e.from,head:e.from+n.length}}),t.focus()}function ZKr(t){let{editorView:e,leafSnapshot:r,filePathSnapshot:n,selectedTextSnapshot:o,initialRange:i,getLeafState:a}=t,s={...i},u=!0,l=null,c=null,d=h=>{let y=h.mapPos(s.from,1),g=h.mapPos(s.to,-1);s={from:Math.min(y,g),to:Math.max(y,g)},u=!0},f=()=>({...s}),p=()=>{let h=a(),y=!l||h.leaf!==l.leaf||h.editorView!==l.editorView||h.filePath!==l.filePath||!e.dom.isConnected;if(!u&&!y&&c)return c;u=!1,l=h;let g=(w,T)=>({ok:!1,reason:w,range:T,message:CZ(w)});if(!h.leaf||h.leaf!==r)return c=g("leaf_changed",null),c;if(!h.editorView||h.editorView!==e)return c=g("editor_changed",null),c;if(h.filePath!==n)return c=g("file_changed",null),c;if(!e.dom.isConnected)return c=g("target_unavailable",null),c;let b=e.state.doc;return s.from<0||s.to>b.length||s.from>=s.to?(c=g("range_out_of_bounds",null),c):b.sliceString(s.from,s.to)!==o?(c=g("content_changed",{...s}),c):(c={ok:!0,reason:null,range:{...s}},c)};return{getRange:f,validate:p,onDocChanged:d,replace:h=>{let y=p();if(!y.ok||!y.range)return y;try{return XKr(e,y.range,h),{ok:!0,reason:null,range:y.range}}catch(g){return ie("MapPosReplaceGuard replace failed:",g),{ok:!1,reason:"target_unavailable",range:null,message:CZ("target_unavailable")}}}}}function YKr(t){let{editorView:e,filePathSnapshot:r,selectedTextSnapshot:n,getCurrentContext:o}=t,i=()=>{let u=Mv.getRange(e);return u?{from:u.from,to:u.to}:null},a=()=>{let u=o(),l=(p,m)=>({ok:!1,reason:p,range:m,message:CZ(p)});if(!u.editorView)return l("target_unavailable",null);if(u.editorView!==e)return l("editor_changed",null);if(u.filePath!==r)return l("file_changed",null);let c=i();if(!c)return l("no_range",null);let d=e.state.doc;return c.from<0||c.to>d.length||c.from>=c.to?l("range_out_of_bounds",null):d.sliceString(c.from,c.to)!==n?l("content_changed",c):{ok:!0,reason:null,range:c}};return{getRange:i,validate:a,replace:u=>{let l=a();if(!l.ok||!l.range)return l;try{return XKr(e,l.range,u),{ok:!0,reason:null,range:l.range}}catch(c){return ie("HighlightReplaceGuard replace failed:",c),{ok:!1,reason:"target_unavailable",range:null,message:CZ("target_unavailable")}}}}}Xe();Dt();function QKr(t){let{scrollRect:e,visibleBottom:r,visibleTop:n,panelHeight:o,margin:i,gap:a,viewportHeight:s}=t,u=(e.top+e.bottom)/2-o/2,l=o+i,c,d;if(r&&n){let f=e.bottom-r.bottom-a,p=n.top-e.top-a;f>=l?c=r.bottom+a:p>=l?(d=n.top-a,c=d-o):c=u}else r?e.bottom-r.bottom-a>=l?c=r.bottom+a:c=u:n&&n.top-e.top-a>=l?(d=n.top-a,c=d-o):c=u;return c=Math.max(i,Math.min(c,s-i-o)),d!==void 0?{top:c,anchorBottomY:d}:{top:c}}function q$e(t,e){let r=t.from,n=t.to,o=t.head;return!t.empty&&n>0&&e.lineAt(n).from===n&&(n=n-1),!t.empty&&o>0&&o===t.to&&e.lineAt(o).from===o&&(o=o-1),{bottomPos:n,topPos:r,focusPos:o}}Mr();var ry=require("obsidian"),Ni=$(K());function Uci(t){return t.split(/(```[\s\S]*?```|`[^`]*`)/g).map((r,n)=>n%2===1?r:r.replace(/\\\[\s*/g,"$$").replace(/\s*\\\]/g,"$$").replace(/\\\(\s*/g,"$").replace(/\s*\\\)/g,"$")).join("")}function zci(t){return t=t.replace(/```dataview(\s*(?:\n|$))/g,"```text$1"),t=t.replace(/```dataviewjs(\s*(?:\n|$))/g,"```javascript$1"),t}function Vci(t){return t.replace(/```tasks(\s*(?:\n|$))/g,"```text$1")}function xZ(t){let e=zci(t),r=Vci(e);return Uci(r)}var r8r=$(Im());Qe();var Js=$(K());Qv();TS();LW();function Vyt(){return new hje({returnMessages:!0,memoryKey:"history"})}async function e8r(t,e,r){let n=await U0.getInstance().createModelInstance(t),i=Eb.fromMessages([$C.fromTemplate(e||"You are a helpful assistant. You'll help the user with their content editing needs."),new QN("history"),rw.fromTemplate("{input}")]);return gc.from([{input:a=>a.input,memory:()=>r.loadMemoryVariables({})},{input:a=>a.input,history:a=>a.memory.history},i,n])}gr();Xe();var W$=$(K());function t8r(t){let e=(0,W$.useRef)(t),r=(0,W$.useRef)(null),n=(0,W$.useRef)(null);return(0,W$.useEffect)(()=>{e.current=t},[t]),(0,W$.useEffect)(()=>()=>{r.current!==null&&(cancelAnimationFrame(r.current),r.current=null)},[]),(0,W$.useCallback)((...o)=>{n.current=o,r.current===null&&(r.current=requestAnimationFrame(()=>{r.current=null;let i=n.current;i&&e.current(...i)}))},[])}function Hci(t){return`${t.name}|${t.provider}`}function Wci(t){if(!t.aborted)return!1;let e=t.reason;return typeof e!="string"?!0:e==="new-chat"||e==="component-unmount"}function B$e(t){let{model:e,systemPrompt:r,excludeThinking:n=!0,onNoModel:o,onNonAbortError:i}=t,[a,s]=(0,Js.useState)(!1),[u,l]=(0,Js.useState)(""),c=(0,Js.useRef)(!0),d=(0,Js.useRef)(!1),f=(0,Js.useRef)(null),p=(0,Js.useRef)(""),m=(0,Js.useRef)(!1),h=(0,Js.useRef)(0),y=(0,Js.useRef)(o),g=(0,Js.useRef)(i);(0,Js.useEffect)(()=>{y.current=o,g.current=i},[o,i]);let b=(0,Js.useRef)(null),_=(0,Js.useRef)(null),w=(0,Js.useRef)(null),T=(0,Js.useRef)(null),O=(0,Js.useMemo)(()=>e?Hci(e):null,[e]),E=t8r(V=>{c.current&&l(V)}),P=(0,Js.useCallback)(V=>{c.current&&(p.current=V,E(V))},[E]),R=(0,Js.useCallback)(async V=>{if(!e||!O)return y.current?.(),null;if(!_.current||w.current!==O||T.current!==r){b.current||(b.current=Vyt());let X=await e8r(e,r,b.current);if(V.aborted)return null;_.current=X,w.current=O,T.current=r}return!_.current||!b.current?null:{chain:_.current,memory:b.current}},[e,O,r]);(0,Js.useEffect)(()=>(c.current=!0,()=>{c.current=!1,f.current?.abort("component-unmount"),f.current=null}),[]),(0,Js.useEffect)(()=>{d.current&&f.current?.abort("new-chat"),_.current=null,w.current=null,T.current=null},[O,r]);let I=(0,Js.useCallback)(()=>!m.current,[]),A=(0,Js.useCallback)(()=>b.current,[]),B=(0,Js.useCallback)(()=>p.current,[]),k=(0,Js.useCallback)((V="user-stopped")=>{f.current?.abort(V)},[]),q=(0,Js.useCallback)(()=>{f.current?.abort("new-chat"),f.current=null,_.current=null,w.current=null,T.current=null,b.current=Vyt(),m.current=!1,h.current+=1,p.current="",d.current=!1,c.current&&(l(""),E(""),s(!1))},[E]),Z=(0,Js.useCallback)(async V=>{if(d.current)return null;d.current=!0,c.current&&s(!0);let Y=++h.current,X=new AbortController;f.current=X,p.current="",c.current&&(l(""),E(""));let W=ne=>{h.current===Y&&P(ne)},re=new iv(W,n),ue=!1,le=null,L="",J=null;try{let ne=!m.current;if(!e)return y.current?.(),null;if(L=await V({signal:X.signal,isFirstTurn:ne}),X.signal.aborted||!L.trim())return null;let D=await R(X.signal);if(!D)return null;le=D.memory;let z=await D.chain.withConfig({signal:X.signal}).stream({input:L});for await(let H of z)if(re.processChunk(H),X.signal.aborted)break}catch(ne){ne instanceof Error&&ne.name==="AbortError"||X.signal.aborted||(ue=!0,g.current?.(ne))}finally{let ne=re.close().content.trim(),D=Wci(X.signal),N=h.current!==Y;if(!ue&&ne&&!D&&!N&&(J=ne,le))try{let z=YW(ne);await le.saveContext({input:L},{output:typeof z=="string"?z:ne}),m.current=!0}catch(z){ie("Error saving chat context:",z)}N||(p.current="",d.current=!1),f.current===X&&(f.current=null),c.current&&!N&&(l(""),E(""),s(!1))}return J},[n,R,P,e,E]);return{isStreaming:a,streamingText:u,getIsFirstTurn:I,runTurn:Z,stop:k,reset:q,getMemory:A,getLatestStreamingText:B}}gr();function Jci(t,e){return{...{autoExecuteOnOpen:!0,hideContentAreaOnIdle:!1,commandLabel:t.title,commandIcon:Ni.default.createElement(qS,{className:"tw-size-4 tw-text-muted"})},...e}}function Kci({originalText:t,command:e,onInsert:r,onReplace:n,onClose:o,systemPrompt:i,initialPosition:a,anchorBottom:s,behaviorConfig:u}){let l=(0,Ni.useMemo)(()=>Jci(e,u),[e,u]),c=(0,Ni.useRef)(!1),d=(0,Ni.useRef)(!0);(0,Ni.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let f=(0,Ni.useRef)(null);if(!f.current){let fe=new ry.Component;fe.load(),f.current=fe}(0,Ni.useEffect)(()=>()=>{f.current?.unload(),f.current=null},[]);let p=(0,Ni.useRef)(app.workspace.getActiveFile()?.path??""),m=(0,Ni.useCallback)(async(fe,De)=>{let st=f.current;if(!st)return;let Le=xZ(fe);await ry.MarkdownRenderer.renderMarkdown(Le,De,p.current,st)},[]),[h,y]=(0,Ni.useState)(""),[g,b]=(0,Ni.useState)(""),[_,w]=(0,Ni.useState)(l.autoExecuteOnOpen),[T,O]=(0,Ni.useState)(""),[E]=oF(),P=kr(),R=l.modelSelectionScope??"custom-command",I=(0,Ni.useMemo)(()=>R==="quick-command"?P.quickCommandModelKey??E:e.modelKey||E,[R,P.quickCommandModelKey,e.modelKey,E]),[A,B]=(0,Ni.useState)(I),k=(0,Ni.useCallback)(fe=>{B(fe),R==="quick-command"&&Re("quickCommandModelKey",fe)},[R]),[q,Z]=(0,Ni.useState)(()=>P.quickCommandIncludeNoteContext),V=(0,Ni.useCallback)(fe=>{Z(fe),Re("quickCommandIncludeNoteContext",fe)},[]),Y=(0,Ni.useRef)(!1),X=(0,Ni.useMemo)(()=>{try{let fe=PS(A,P.activeModels);if(!fe.enabled)throw new Error(`Selected model is disabled: ${A}`);return fe}catch{return P.activeModels.find(fe=>fe.enabled)??null}},[A,P.activeModels]),W=(0,Ni.useMemo)(()=>X?`${X.name}|${X.provider}`:null,[X]);(0,Ni.useEffect)(()=>{W&&W!==A&&(B(W),!Y.current&&(Y.current=!0,Ce("Selected model is no longer available. Falling back to a default model.",{selectedModelKey:A,resolvedModelKey:W}),new ry.Notice("Selected model is no longer available. Falling back to a default model.")))},[W,A]);let{isStreaming:re,streamingText:ue,runTurn:le,stop:L,getLatestStreamingText:J}=B$e({model:X,systemPrompt:i||"",excludeThinking:!0,onNoModel:()=>{new ry.Notice("No active model is configured. Please configure a model in Copilot settings."),w(!1)},onNonAbortError:fe=>{ie("Error generating response:",fe),new ry.Notice("Error generating response. Please try again."),w(!1)}}),ne=(0,Ni.useRef)("");(0,Ni.useEffect)(()=>{h&&b(h)},[h]);let D=(0,Ni.useMemo)(()=>_&&!re&&!ue&&!h?{type:"loading"}:re||ue?{type:"result",text:ue||h,isStreaming:re}:h?{type:"result",text:h,isStreaming:!1}:{type:"idle"},[_,re,ue,h]),N=(0,Ni.useRef)(!1);(0,Ni.useEffect)(()=>{if(!l.autoExecuteOnOpen||N.current)return;N.current=!0;let fe=!1;async function De(){try{let st=await le(async Le=>{if(Le.signal.aborted)return"";let Bt=await Fce(e.content,t);return ne.current=Bt,Bt});!fe&&st&&(y(st),ne.current="")}catch(st){ie("Error in initial response:",st)}finally{fe||w(!1)}}return De(),()=>{fe=!0,L("component-unmount")}},[l.autoExecuteOnOpen,e.content,t,le,L]);let z=async()=>{if(!T.trim()||c.current||_||re)return;c.current=!0;let fe=T;O(""),y(""),b("");try{w(!0);let De=await le(async st=>{if(st.signal.aborted)return"";let Le=st.isFirstTurn,Bt=fe;Le&&l.firstSubmitTransform&&(Bt=l.firstSubmitTransform(Bt,q));let Pt=await Fce(Bt,t,!Le);return ne.current=Pt,Pt});if(!d.current)return;De&&(y(De),ne.current="")}catch(De){De instanceof Error&&De.name==="AbortError"||(ie("Error in follow-up submit:",De),d.current&&new ry.Notice("Failed to send message. Please try again."))}finally{d.current&&w(!1),c.current=!1}},H=(0,Ni.useCallback)(()=>{let fe=J().trim();L("user-stopped"),fe&&y(fe),ne.current=""},[L,J]),oe=(0,Ni.useCallback)(async()=>{let fe=g||h||ue;if(!fe)return;let De=lO(fe);try{await navigator.clipboard.writeText(De),new ry.Notice("Copied to clipboard")}catch{new ry.Notice("Failed to copy to clipboard")}},[g,h,ue]),Q=()=>{let fe=g||h||ue;fe&&r(fe)},de=()=>{let fe=g||h||ue;fe&&n(fe)};return Ni.default.createElement(Uyt,{open:!0,onClose:o,commandIcon:l.commandIcon,commandLabel:l.commandLabel,contentState:D,editableContent:g,onEditableContentChange:b,followUpValue:T,onFollowUpChange:O,onFollowUpSubmit:z,selectedModel:A,onSelectModel:k,onStop:H,onCopy:oe,onInsert:Q,onReplace:de,initialPosition:a,anchorBottom:s,resizable:!0,hideContentAreaOnIdle:l.hideContentAreaOnIdle,includeNoteContext:l.showIncludeNoteContext?q:void 0,onIncludeNoteContextChange:l.showIncludeNoteContext?V:void 0,renderMarkdown:m})}var mU=class{constructor(e,r){this.app=e;this.configs=r;this.root=null;this.container=null;this.highlightView=null;this.replaceGuard=null}resolveWindow(e){return e?.containerEl?.ownerDocument?.defaultView??window}resolveDocument(e){return e?.containerEl?.ownerDocument??document}getInitialPosition(e){let r=this.resolveWindow(e),n=Math.min(500,r.innerWidth*.9),i=this.configs.behaviorConfig?.hideContentAreaOnIdle??!1?180:400,a=12,s=6,u={x:Math.max(a,(r.innerWidth-n)/2),y:Math.max(a,(r.innerHeight-i)/2)};if(!e?.editor?.cm)return u;let l=e.editor.cm,c=l.state.selection.main,d=c.empty,f=q$e(c,l.state.doc),p=l.coordsAtPos(f.focusPos),m=l.coordsAtPos(f.bottomPos),h=l.coordsAtPos(f.topPos);if(!p&&!m&&!h)return u;let y=l.scrollDOM.getBoundingClientRect(),g=A=>A.bottom>=y.top&&A.top<=y.bottom&&A.right>=y.left&&A.left<=y.right,b=p&&g(p)?p:null,_=m&&g(m)?m:null,w=h&&g(h)?h:null;if(!b&&!_&&!w)return u;let T=Math.min((h?.bottom??0)-(h?.top??0),(m?.bottom??0)-(m?.top??0)),O=!d&&h&&m&&Math.abs(h.top-m.top)>Math.max(T/2,2),{top:E,anchorBottomY:P}=QKr({scrollRect:y,visibleBottom:_,visibleTop:w,panelHeight:i,margin:a,gap:s,viewportHeight:r.innerHeight}),R=E,I;if(d)I=(b??_??w).left;else if(O)I=(y.left+y.right)/2-n/2;else{let A=l.coordsAtPos(f.topPos),B=l.coordsAtPos(f.bottomPos);A&&B?I=(A.left+B.right)/2-n/2:I=(y.left+y.right)/2-n/2}return I=Math.max(y.left,Math.min(I,y.right-n)),I=Math.max(a,Math.min(I,r.innerWidth-a-n)),{x:I,y:R,anchorBottom:P}}open(){let e=this.app.workspace.getActiveViewOfType(ry.MarkdownView),r=this.resolveDocument(e);this.container=r.createElement("div"),this.container.className="copilot-menu-command-modal-container",r.body.appendChild(this.container),this.root=(0,r8r.createRoot)(this.container);let{selectedText:n,command:o,systemPrompt:i,behaviorConfig:a}=this.configs,s=n;if(e?.editor?.cm){let p=e.editor.cm,m=p.state.selection.main,h=e.file?.path??null;s=p.state.doc.sliceString(m.from,m.to),Mv.show(p,m.from,m.to),this.highlightView=p,this.replaceGuard=YKr({editorView:p,filePathSnapshot:h,selectedTextSnapshot:s,getCurrentContext:()=>{let y=this.app.workspace.getActiveViewOfType(ry.MarkdownView);return{editorView:y?.editor?.cm??null,filePath:y?.file?.path??null}}})}let{anchorBottom:u,...l}=this.getInitialPosition(e),c=p=>{FJ(p),this.close()},d=p=>{if(!this.replaceGuard){new ry.Notice("No selection to replace.");return}let m=lO(p),h=this.replaceGuard.replace(m);if(!h.ok){new ry.Notice(h.message??"Cannot replace.");return}new ry.Notice("Message replaced in the active note."),this.close()},f=()=>{this.close()};this.root.render(Ni.default.createElement(Kci,{originalText:s,command:o,onInsert:c,onReplace:d,onClose:f,systemPrompt:i,initialPosition:l,anchorBottom:u,behaviorConfig:a}))}close(){this.highlightView&&(Mv.hide(this.highlightView),this.highlightView=null),this.replaceGuard=null,this.root?.unmount(),this.root=null,this.container?.remove(),this.container=null}};xn();var n8r=require("obsidian"),S3=$(K()),o8r=$(Im());function Gci({content:t,onConfirm:e,onCancel:r,confirmButtonText:n,cancelButtonText:o}){return S3.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-5"},S3.default.createElement("div",{className:"tw-whitespace-pre-wrap"},t),S3.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},o&&S3.default.createElement(me,{variant:"secondary",onClick:r},o),n&&S3.default.createElement(me,{variant:"default",onClick:e},n)))}var nu=class extends n8r.Modal{constructor(r,n,o,i,a="Continue",s="Cancel",u){super(r);this.onConfirm=n;this.content=o;this.confirmButtonText=a;this.cancelButtonText=s;this.onCancel=u;this.confirmed=!1;this.setTitle(i)}onOpen(){let{contentEl:r}=this;this.root=(0,o8r.createRoot)(r);let n=()=>{this.confirmed=!0,this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(S3.default.createElement(Gci,{content:this.content,onConfirm:n,onCancel:o,confirmButtonText:this.confirmButtonText,cancelButtonText:this.cancelButtonText}))}onClose(){this.confirmed||this.onCancel?.(),this.root.unmount()}};var z$e=require("obsidian");var U$e=class extends z$e.FuzzySuggestModal{constructor(e){super(e),this.setPlaceholder("Select a custom command to apply...");let r=Sv();this.commands=Aje(r)}onOpen(){super.onOpen(),this.commands.length===0&&this.setInstructions([{command:"",purpose:"No custom commands found. Create some custom commands first in the settings."}])}getItems(){return this.commands}getItemText(e){return e.title}onChooseItem(e,r){let n=this.app.workspace.getActiveViewOfType(z$e.MarkdownView);if(!n||!n.editor){this.openCommandModal(e,"");return}let o=n.editor.getSelection();this.openCommandModal(e,o)}openCommandModal(e,r){Zm.getInstance().recordUsage(e),new mU(this.app,{selectedText:r,command:e}).open()}};aA();xn();Xe();Dt();var TZ=require("obsidian"),Vu=$(K()),i8r=$(Im());function Xci({onClose:t}){let[e,r]=Vu.useState("input"),[n,o]=Vu.useState(""),[i,a]=Vu.useState(!1),[s,u]=Vu.useState(""),[l,c]=Vu.useState(!1),[d,f]=Vu.useState(null),p=(w,T=!0)=>{if(!w.trim())return T&&(u(""),c(!1)),{isValid:!1};let O=HWe(w);return O.isValid?(T&&(u(""),c(!0)),{isValid:!0,videoId:O.videoId}):(T&&(u(O.error||"Invalid URL"),c(!1)),{isValid:!1})},m=w=>{o(w),p(w,!0)},h=async()=>{if(i)return;let w=p(n);if(w.isValid){a(!0),u("");try{let T=await Xl.getInstance().youtube4llm(n);if(!T.response.transcript)throw new Error("Transcript not available. Only English videos with auto transcript enabled are supported.");let O={videoId:w.videoId,transcript:T.response.transcript,url:vNt(w.videoId)};f(O),r("display")}catch(T){ie("Error downloading YouTube transcript:",T);let O=T instanceof Error?T.message:"An error occurred while downloading the transcript";u(O)}finally{a(!1)}}},y=async()=>{if(d)try{let w=`# YouTube Video Transcript

Source: ${d.url}

${d.transcript}`;await navigator.clipboard.writeText(w),new TZ.Notice("Transcript copied to clipboard!")}catch(w){ie("Failed to copy to clipboard:",w),new TZ.Notice("Failed to copy to clipboard")}},g=async()=>{if(d)try{let w=`# YouTube Video Transcript

Source: ${d.url}

${d.transcript}`;await FJ(w,!1),t()}catch(w){ie("Failed to insert to note:",w),new TZ.Notice("Failed to insert to note")}},b=()=>{r("input"),o(""),u(""),f(null)},_=w=>{w.key==="Enter"&&!i&&l&&h()};return e==="display"&&d?Vu.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Vu.createElement("div",{className:"tw-rounded tw-bg-secondary tw-p-3"},Vu.createElement("a",{href:d.url,className:"tw-text-sm tw-text-muted hover:tw-text-normal",target:"_blank",rel:"noopener noreferrer"},d.url)),Vu.createElement("div",{className:"tw-max-h-96 tw-overflow-y-auto tw-rounded tw-border tw-border-border tw-bg-primary tw-p-4"},Vu.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-sm tw-leading-relaxed"},d.transcript)),Vu.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Vu.createElement(me,{variant:"ghost",onClick:b},"Download Another"),Vu.createElement(me,{variant:"default",onClick:y},"Copy to Clipboard"),Vu.createElement(me,{variant:"default",onClick:g},"Insert at Cursor"),Vu.createElement(me,{variant:"secondary",onClick:t},"Close"))):Vu.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Vu.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Vu.createElement("div",{className:"tw-text-sm tw-text-muted"},"Enter a valid YouTube video URL"),Vu.createElement(ni,{placeholder:"https://www.youtube.com/watch?v=...",value:n,onChange:w=>m(w.target.value),onKeyDown:_,disabled:i}),s&&Vu.createElement("div",{className:"tw-text-sm tw-text-error"},s)),Vu.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Vu.createElement(me,{variant:"secondary",onClick:t,disabled:i},"Cancel"),Vu.createElement(me,{variant:"default",onClick:h,disabled:i||!l},i?"Downloading...":"Download Transcript")))}var V$e=class extends TZ.Modal{constructor(e){super(e),this.setTitle("Download YouTube Script (plus)")}onOpen(){let{contentEl:e}=this;this.root=(0,i8r.createRoot)(e);let r=()=>{this.close()};this.root.render(Vu.createElement(Xci,{onClose:r}))}onClose(){this.root.unmount()}};id();u0();Wb();Dt();var Io=require("obsidian");y_();gr();na();function rg(t,e,r){t.addCommand({id:e,name:Fge[e],icon:kge[e],callback:r})}function U8r(t,e,r){t.addCommand({id:e,name:Fge[e],icon:kge[e],editorCallback:r})}function z8r(t,e,r){t.addCommand({id:e,name:Fge[e],icon:kge[e],checkCallback:r})}function obt(t,e,r){U8r(t,ur.COUNT_WORD_AND_TOKENS_SELECTION,async n=>{let o=await n.getSelection(),i=o.split(" ").length,a=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(o);new Io.Notice(`Selected text contains ${i} words and ${a} tokens.`)}),rg(t,ur.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let n=await cat(t.app),o=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(n);new Io.Notice(`Total tokens in your vault: ${o}`)}catch(n){ie("Error counting tokens: ",n),new Io.Notice("An error occurred while counting tokens.")}}),rg(t,ur.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),rg(t,ur.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),rg(t,ur.NEW_CHAT,()=>{r9(),t.newChat()}),z8r(t,ur.TRIGGER_QUICK_COMMAND,n=>{let o=t.app.workspace.getActiveViewOfType(Io.MarkdownView);if(n)return!!(!cte()&&o&&o.editor);if(cte())return new Io.Notice("Quick command is not available in source mode."),!1;if(!o||!o.editor)return new Io.Notice("No active editor found."),!1;let a=o.editor.getSelection();if(!a.trim())return new Io.Notice("Please select some text first. Selected text is required for quick commands."),!1;let s={title:"Quick Command",content:"",showInContextMenu:!1,showInSlashMenu:!1,order:0,modelKey:"",lastUsedMs:Date.now()};return new mU(t.app,{selectedText:a,command:s,systemPrompt:Dje,behaviorConfig:{autoExecuteOnOpen:!1,hideContentAreaOnIdle:!0,commandLabel:"Quick Command",commandIcon:null,showIncludeNoteContext:!0,modelSelectionScope:"quick-command",firstSubmitTransform:(l,c)=>jje(l,c)}}).open(),!0}),rg(t,ur.CLEAR_LOCAL_COPILOT_INDEX,async()=>{let{getSettings:n}=await Promise.resolve().then(()=>(Qe(),r1)),o=n();if(kh(o)){new Io.Notice("Miyo folders are managed in Miyo. Remove the folder there if you want to clear it.");return}let a=`This will permanently delete all document indexes in Copilot. This action cannot be undone.

Are you sure you want to proceed?`;if(await new Promise(u=>{new nu(t.app,()=>u(!0),a,"Clear Semantic Index","Clear Index","Cancel",()=>u(!1)).open()}))try{await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().clearIndex(),new Io.Notice("Cleared local Copilot semantic index.")}catch(u){ie("Error clearing semantic index:",u),new Io.Notice("Failed to clear semantic index.")}}),rg(t,ur.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(Qe(),r1));if(kh(n())){new Io.Notice("Miyo manages file cleanup automatically. Run Index (refresh) vault to trigger a scan if needed.");return}let i=await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().garbageCollectVectorStore();new Io.Notice(`Garbage collection completed. Removed ${i} stale documents.`)}catch(n){ie("Error during garbage collection:",n),new Io.Notice("Failed to garbage collect semantic index.")}}),rg(t,ur.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(Qe(),r1)),o=n();if(o.enableSemanticSearchV3){let a=await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0});kh(o)?new Io.Notice("Miyo folder index refresh started. Open the Miyo app to check details."):new Io.Notice(`Semantic search index refreshed with ${a} documents.`)}else new Io.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(n){ie("Error building index:",n),new Io.Notice("An error occurred while building the index.")}}),rg(t,ur.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{if(await new Promise(o=>{new nu(t.app,()=>o(!0),"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","Continue","Cancel",()=>o(!1)).open()}))try{let{getSettings:o}=await Promise.resolve().then(()=>(Qe(),r1)),i=o();if(i.enableSemanticSearchV3){let s=await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().indexVaultToVectorStore(!0,{userInitiated:!0});kh(i)?new Io.Notice("Miyo folder index refresh started. Open the Miyo app to check details."):new Io.Notice(`Semantic search index rebuilt with ${s} documents.`)}else new Io.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(o){ie("Error rebuilding index:",o),new Io.Notice("An error occurred while rebuilding the index.")}}),rg(t,ur.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),rg(t,ur.LIST_INDEXED_FILES,async()=>{try{let o=await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().getIndexedFiles(),{getMatchingPatterns:i,shouldIndexFile:a}=await Promise.resolve().then(()=>(Wb(),wbr)),{inclusions:s,exclusions:u}=i(),l=t.app.vault.getMarkdownFiles(),c=new Set,d=new Set,f=new Set,p=new Set(o);for(let w of l){if(!a(w,s,u)){f.add(w.path);continue}let T=await t.app.vault.cachedRead(w);!T||T.trim().length===0?c.add(w.path):p.has(w.path)||d.add(w.path)}let m=["# Copilot Files Status",`- Indexed files: ${p.size}`,`- Unindexed files: ${d.size}`,`- Empty files: ${c.size}`,`- Excluded files: ${f.size}`,"","## Indexed Files",...p.size>0?Array.from(p).sort().map(w=>`- [[${w}]]`):["No indexed files found."],"","## Unindexed Files",...d.size>0?Array.from(d).sort().map(w=>`- [[${w}]]`):["No unindexed files found."],"","## Empty Files",...c.size>0?Array.from(c).sort().map(w=>`- [[${w}]]`):["No empty files found."],"","## Excluded Files (based on settings)",...f.size>0?Array.from(f).sort().map(w=>`- [[${w}]]`):["No excluded files."]].join(`
`),h=`Copilot-Indexed-Files-${new Date().toLocaleDateString().replace(/\//g,"-")}.md`,y="copilot",g=`${y}/${h}`;await ql(y);let b=t.app.vault.getAbstractFileByPath(g);b?await t.app.vault.modify(b,m):await t.app.vault.create(g,m);let _=t.app.vault.getAbstractFileByPath(g);_&&(await t.app.workspace.getLeaf().openFile(_),new Io.Notice(`Listed ${p.size} indexed files`))}catch(n){ie("Error listing indexed files:",n),new Io.Notice("Failed to list indexed files.")}}),rg(t,ur.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS,async()=>{try{let n=t.app.workspace.getActiveFile();if(!n){new Io.Notice("No active file. Please open a note first.");return}let o=(await Promise.resolve().then(()=>(El(),Bc))).default,{DBOperations:i}=await Promise.resolve().then(()=>(KOe(),xbr)),a=await o.getInstance().getDb(),s=await i.getDocsByPath(a,n.path);if(!s||s.length===0){new Io.Notice(`No embedding data found for: ${n.path}`);return}let u=s.map(h=>h.document),l=[`# Embedding Debug: ${n.basename}`,"",`**Path:** ${n.path}`,`**Chunks:** ${u.length}`,`**Embedding Model:** ${u[0]?.embeddingModel||"unknown"}`,"",...u.flatMap((h,y)=>{let g=h.embedding||[],b=g.slice(0,10).map(_=>_.toFixed(6)).join(", ");return[`## Chunk ${y+1}`,`- **ID:** ${h.id}`,`- **Content Preview:** "${(h.content||"").substring(0,200)}..."`,`- **Vector Length:** ${g.length}`,`- **Vector Preview:** [${b}${g.length>10?", ...":""}]`,`- **Tags:** ${(h.tags||[]).join(", ")||"none"}`,`- **Characters:** ${h.nchars||0}`,""]})].join(`
`),c=`Copilot-Embedding-Debug-${n.basename.replace(/[\\/:*?"<>|]/g,"_")}.md`,d="copilot",f=`${d}/${c}`;await ql(d);let p=t.app.vault.getAbstractFileByPath(f);p?await t.app.vault.modify(p,l):await t.app.vault.create(f,l);let m=t.app.vault.getAbstractFileByPath(f);m&&(await t.app.workspace.getLeaf().openFile(m),new Io.Notice(`Embedding debug info for ${u.length} chunk(s)`))}catch(n){ie("Error inspecting embeddings:",n),new Io.Notice("Failed to inspect embeddings. Is the index loaded?")}}),rg(t,ur.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),await Iw.getInstance().clearAllCache(),await ZG.getInstance().clear(),new Io.Notice("All Copilot caches cleared successfully")}catch(n){ie("Error clearing Copilot caches:",n),new Io.Notice("Failed to clear Copilot caches")}}),rg(t,ur.OPEN_LOG_FILE,async()=>{try{await uEe(),await Em.openLogFile()}catch(n){ie("Error creating Copilot log file:",n),new Io.Notice("Failed to create Copilot log file.")}}),rg(t,ur.CLEAR_LOG_FILE,async()=>{try{await Em.clear(),new Io.Notice("Copilot log cleared.")}catch(n){ie("Error clearing Copilot log file:",n),new Io.Notice("Failed to clear Copilot log file.")}}),U8r(t,ur.ADD_SELECTION_TO_CHAT_CONTEXT,async n=>{let o=n.getSelection();if(!o){new Io.Notice("No text selected");return}let i=t.app.workspace.getActiveFile();if(!i){new Io.Notice("No active file");return}let a=n.listSelections()[0];if(!a){new Io.Notice("Could not determine selection range");return}let s=a.anchor.line+1,u=a.head.line+1,l={id:gu(),content:o,sourceType:"note",noteTitle:i.basename,notePath:i.path,startLine:Math.min(s,u),endLine:Math.max(s,u)};pO([l]),t.activateView()}),rg(t,ur.ADD_WEB_SELECTION_TO_CHAT_CONTEXT,async()=>{let{Platform:n}=await import("obsidian");if(!n.isDesktopApp){new Io.Notice("Web selection is only available on desktop");return}let{getWebViewerService:o}=await Promise.resolve().then(()=>(T3(),B8r));try{let i=o(t.app),a=i.getActiveLeaf()??i.getLastActiveLeaf();if(!a){new Io.Notice("No active Web Tab found");return}let s=await i.getSelectedMarkdown(a);if(!s.trim()){new Io.Notice("No text selected in Web Tab");return}let u=i.getPageInfo(a),l={id:gu(),content:s,sourceType:"web",title:u.title||"Untitled",url:u.url,faviconUrl:u.faviconUrl||void 0};pO([l]),t.activateView()}catch(i){ie("Error adding web selection to context:",i),new Io.Notice("Failed to get web selection")}}),rg(t,ur.ADD_CUSTOM_COMMAND,async()=>{let n=Sv(),o={...rN};new rU(t.app,n,o,async a=>{await Zm.getInstance().createCommand(a)}).open()}),rg(t,ur.APPLY_CUSTOM_COMMAND,()=>{new U$e(t.app).open()}),rg(t,ur.DOWNLOAD_YOUTUBE_SCRIPT,async()=>{if(!await m0()){new Io.Notice("Download YouTube Script (plus) is a Copilot Plus feature");return}new V$e(t.app).open()}),z8r(t,ur.TRIGGER_QUICK_ASK,n=>{let o=t.app.workspace.getActiveViewOfType(Io.MarkdownView);if(n)return!!(!cte()&&o&&o.editor);if(cte())return new Io.Notice("Quick Ask is not available in source mode."),!1;if(!o||!o.editor)return new Io.Notice("No active editor found."),!1;let i=o.editor.cm;return i?(t.quickAskController.show(o,i),!0):(new Io.Notice("Could not access CodeMirror editor."),!1)})}na();var DZ={title:"",content:"",createdMs:0,modifiedMs:0,lastUsedMs:0},jZ="copilot-system-prompt-created",$Z="copilot-system-prompt-modified",LZ="copilot-system-prompt-last-used",ibt="copilot-system-prompt-default";var gU=require("obsidian");Qe();Dt();Xe();function gde(t,e,r){let n=t.trim();return n?t!==n?"Prompt name cannot have leading or trailing spaces":r&&t===r?null:/[#<>:"/\\|?*[\]^\x00-\x1F]/g.test(n)?'Prompt name contains invalid characters. Avoid using: < > : " / \\ | ? * [ ] ^':e.some(i=>i.title.toLowerCase()===n.toLowerCase())?"A prompt with this name already exists":null:"Prompt name cannot be empty"}function iC(){return(0,gU.normalizePath)(ee().userSystemPromptsFolder)}function aC(t){return(0,gU.normalizePath)(`${iC()}/${t}.md`)}function Mdi(t,e){let r=e?(0,gU.normalizePath)(e):iC();return(0,gU.normalizePath)(`${r}/${t}.md`)}function FZ(t){if(!(t instanceof gU.TFile)||t.extension!=="md")return!1;let e=iC();if(!t.path.startsWith(e+"/"))return!1;let r=t.path.slice(e.length+1);return!(r.startsWith("unsupported/")||r.includes("/"))}function abt(t,e){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){let r=Number(t);if(Number.isFinite(r))return r}return e}async function O3(t){let e=await app.vault.read(t),r=jJ(e),o=app.metadataCache.getFileCache(t)?.frontmatter,i=abt(o?.[jZ],DZ.createdMs),a=abt(o?.[$Z],DZ.modifiedMs),s=abt(o?.[LZ],DZ.lastUsedMs);return{title:t.basename,content:r,createdMs:i,modifiedMs:a,lastUsedMs:s}}async function sbt(){let t=app.vault.getFiles().filter(e=>FZ(e));return await Promise.all(t.map(O3))}async function kZ(){let t=await sbt();return dDe(t),t}async function E3(t,e){let r=y$(t.path),n=Date.now(),o=Number.isFinite(e.createdMs)&&e.createdMs>0?e.createdMs:n,i=Number.isFinite(e.modifiedMs)&&e.modifiedMs>0?e.modifiedMs:n,a=Number.isFinite(e.lastUsedMs)&&e.lastUsedMs>0?e.lastUsedMs:0;try{r||DB(t.path),await app.fileManager.processFrontMatter(t,s=>{s[jZ]==null&&(s[jZ]=o),s[$Z]==null&&(s[$Z]=i),s[LZ]==null&&(s[LZ]=a)})}finally{r||jB(t.path)}}function V8r(t,e){let n=`${t} (copy)`,o=1;for(;e.some(i=>i.title.toLowerCase()===n.toLowerCase());)o++,n=`${t} (copy ${o})`;return n}async function ubt(t,e,r){let n=Mdi(t,r),o=app.vault.getAbstractFileByPath(n);if(!(o instanceof gU.TFile)){Ce(`System prompt file not found for default flag update: ${n}`);return}let i=y$(o.path);try{i||DB(o.path),await app.fileManager.processFrontMatter(o,a=>{e?a[ibt]=!0:delete a[ibt]})}finally{i||jB(o.path)}}var yde=require("obsidian");Xe();Dt();Qe();var P3=class t{constructor(e){this.vault=e}static getInstance(e){if(!t.instance){if(!e)throw new Error("Vault is required for first initialization");t.instance=new t(e)}return t.instance}async initialize(){F("Initializing SystemPromptManager"),await kZ()}async createPrompt(e,r=!1){let n=yX(),o=gde(e.title,n);if(o)throw new Error(o);let i=aC(e.title),a=iC();try{DB(i),await ql(a),await this.vault.create(i,e.content);let s=this.vault.getAbstractFileByPath(i);s instanceof yde.TFile&&await E3(s,e),r||qW(e),F(`Created system prompt: ${e.title}`)}finally{jB(i)}}async updatePrompt(e,r,n=!1){let o=aC(e),i=aC(r.title),a=e!==r.title;if(a){let s=yX(),u=gde(r.title,s,e);if(u)throw new Error(u)}try{if(DB(i),a&&DB(o),a){let u=this.vault.getAbstractFileByPath(o);u instanceof yde.TFile&&await app.fileManager.renameFile(u,i)}let s=this.vault.getAbstractFileByPath(i);s instanceof yde.TFile&&(await this.vault.modify(s,r.content),await app.fileManager.processFrontMatter(s,u=>{u[jZ]=r.createdMs,u[$Z]=r.modifiedMs,u[LZ]=r.lastUsedMs})),n||(a&&(bX(e),ee().defaultSystemPromptTitle===e&&(Re("defaultSystemPromptTitle",r.title),F(`Updated defaultSystemPromptTitle: ${e} -> ${r.title}`))),qW(r)),F(`Updated system prompt: ${e} -> ${r.title}`)}finally{jB(i),a&&jB(o)}}async deletePrompt(e){let r=aC(e);try{DB(r);let n=this.vault.getAbstractFileByPath(r);n instanceof yde.TFile&&await this.vault.delete(n),ee().defaultSystemPromptTitle===e&&(Re("defaultSystemPromptTitle",""),F(`Cleared defaultSystemPromptTitle (deleted: ${e})`)),kW()===e&&(NB(""),F(`Cleared session selectedPromptTitle (deleted: ${e})`)),bX(e),F(`Deleted system prompt: ${e}`)}finally{jB(r)}}async duplicatePrompt(e){let r=yX(),n=V8r(e.title,r),o=Date.now(),i={title:n,content:e.content,createdMs:o,modifiedMs:o,lastUsedMs:0};return await this.createPrompt(i),F(`Duplicated system prompt: ${e.title} -> ${n}`),i}getPrompts(){return yX()}async reloadPrompts(){return await kZ()}async fetchPrompts(){return await sbt()}};var qZ=require("obsidian");Qe();var lbt=$(YG());Xe();var bde=class{constructor(e,r){this.folderChangeRequestId=0;this.handleSettingsChange=(e,r)=>{let n=e.userSystemPromptsFolder!==r.userSystemPromptsFolder;if(e.defaultSystemPromptTitle!==r.defaultSystemPromptTitle){let i=n?e.userSystemPromptsFolder:void 0;this.handleDefaultPromptChange(e.defaultSystemPromptTitle,r.defaultSystemPromptTitle,i)}n&&this.debouncedFolderChange(r.userSystemPromptsFolder)};this.debouncedFolderChange=(0,lbt.default)(e=>{this.handleSystemPromptsFolderChange(e)},300,{leading:!1,trailing:!0});this.handleFileModify=(0,lbt.default)(async e=>{if(!(!FZ(e)||y$(e.path)))try{let r=await O3(e);qW(r)}catch(r){ie(`Error processing system prompt modification: ${e.path}`,r)}},1e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(!(!FZ(e)||y$(e.path)))try{let r=await O3(e);await E3(e,r);let n=await O3(e);qW(n)}catch(r){ie(`Error processing system prompt creation: ${e.path}`,r)}};this.handleFileDeletion=async e=>{if(!(!FZ(e)||y$(e.path)))try{bX(e.basename),ee().defaultSystemPromptTitle===e.basename&&Re("defaultSystemPromptTitle",""),kW()===e.basename&&(NB(""),new qZ.Notice(`System prompt "${e.basename}" was deleted. Cleared current chat selection.`))}catch(r){ie(`Error processing system prompt deletion: ${e.path}`,r)}};this.handleFileRename=async(e,r)=>{if(y$(e.path)||y$(r))return;let n=iC(),o=r.startsWith(n+"/")?r.slice(n.length+1):"",i=o!==""&&!o.includes("/")&&r.endsWith(".md"),a=FZ(e)?e:null;if(!(!i&&!a))try{if(i){let s=r.split("/").pop()?.replace(/\.md$/i,"");if(s&&(bX(s),ee().defaultSystemPromptTitle===s&&(a?Re("defaultSystemPromptTitle",a.basename):Re("defaultSystemPromptTitle","")),kW()===s)){let l=a?a.basename:"";NB(l),a?new qZ.Notice(`System prompt "${s}" was renamed to "${a.basename}". Updated current chat selection.`):new qZ.Notice(`System prompt "${s}" was moved out of the prompts folder. Cleared current chat selection.`)}}if(a){let s=await O3(a);await E3(a,s);let u=await O3(a);qW(u)}}catch(s){ie(`Error processing system prompt rename: ${e.path}`,s)}};this.plugin=e,this.vault=r,this.manager=P3.getInstance(r),this.initializeEventListeners()}async initialize(){await this.manager.initialize(),zzr()}cleanup(){this.handleFileModify.cancel(),this.debouncedFolderChange.cancel(),this.settingsUnsubscriber?.(),this.vault.off("create",this.handleFileCreation),this.vault.off("delete",this.handleFileDeletion),this.vault.off("rename",this.handleFileRename),this.vault.off("modify",this.handleFileModify)}initializeEventListeners(){this.vault.on("create",this.handleFileCreation),this.vault.on("delete",this.handleFileDeletion),this.vault.on("rename",this.handleFileRename),this.vault.on("modify",this.handleFileModify),this.settingsUnsubscriber=ml(this.handleSettingsChange)}async handleDefaultPromptChange(e,r,n){try{e&&await ubt(e,!1,n),r&&await ubt(r,!0),F(`Default system prompt changed: "${e}" -> "${r}"`)}catch(o){ie("Error updating default system prompt frontmatter",o)}}async handleSystemPromptsFolderChange(e){let r=++this.folderChangeRequestId;try{F(`System prompts folder changed to: ${e}`);let n=await this.manager.fetchPrompts();if(r!==this.folderChangeRequestId){F(`Folder change request ${r} superseded by ${this.folderChangeRequestId}, discarding results`);return}dDe(n);let o=new Set(n.map(i=>i.title));this.validatePromptReferences(o)}catch(n){r===this.folderChangeRequestId&&ie(`Error reloading system prompts after folder change to: ${e}`,n)}}validatePromptReferences(e){let r=ee(),n=kW();r.defaultSystemPromptTitle&&!e.has(r.defaultSystemPromptTitle)&&(Re("defaultSystemPromptTitle",""),F(`Cleared defaultSystemPromptTitle (not found in new folder): ${r.defaultSystemPromptTitle}`),new qZ.Notice(`Default system prompt "${r.defaultSystemPromptTitle}" not found in new folder. Cleared default selection.`)),n&&!e.has(n)&&(NB(""),F(`Cleared selectedPromptTitle (not found in new folder): ${n}`),new qZ.Notice(`Current system prompt "${n}" not found in new folder. Cleared chat selection.`))}};var Ic=$(K());xn();Mr();var BZ=require("obsidian"),H8r=$(Im());Qe();var gT=$(K());function rLe(){return gT.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},gT.default.createElement("li",null,gT.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," includes a note's content. Note: bare ",gT.default.createElement("span",{className:"tw-font-medium"},"[[Note Title]]")," ","without curly braces will NOT include the note content."),gT.default.createElement("li",null,gT.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),gT.default.createElement("li",null,gT.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)."),gT.default.createElement("li",null,gT.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{folder/path}")," represents notes from a specific folder path."))}Xe();function Rdi({prompts:t,onConfirm:e,onCancel:r,contentEl:n}){let o=kr(),[i,a]=(0,Ic.useState)({...DZ}),[s,u]=(0,Ic.useState)({}),l=(d,f)=>{a(p=>({...p,[d]:f})),u(p=>({...p,[d]:void 0}))},c=()=>{let d={},f=gde(i.title,t,"");if(f&&(d.title=f),i.content.trim()||(d.content="Content is required"),Object.keys(d).length>0){u(d);return}e(i)};return Ic.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},Ic.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"},Ic.default.createElement(ex,{className:"tw-size-5 tw-shrink-0"}),Ic.default.createElement("div",{className:"tw-flex-1"},"System prompts are automatically loaded from .md files in your system prompts folder"," ",Ic.default.createElement("strong",null,o.userSystemPromptsFolder),". Modifying the files will also update the system prompt settings.")),Ic.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ic.default.createElement(uc,{htmlFor:"title"},"Name"),Ic.default.createElement(ni,{id:"title",placeholder:"Enter prompt name",value:i.title,onChange:d=>l("title",d.target.value)}),s.title&&Ic.default.createElement("div",{className:"tw-text-sm tw-text-error"},s.title)),Ic.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ic.default.createElement(uc,{htmlFor:"content"},"Content"),Ic.default.createElement(rLe,null),Ic.default.createElement("div",{className:"tw-relative"},Ic.default.createElement(n_,{id:"content",placeholder:"Enter your system prompt here... Use {[[Note Name]]} to include note contents.",value:i.content,onChange:d=>l("content",d.target.value),rows:10,className:"tw-min-h-[180px] tw-w-full tw-pr-8"})),s.content&&Ic.default.createElement("div",{className:"tw-text-sm tw-text-error"},s.content)),Ic.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Ic.default.createElement(me,{variant:"secondary",onClick:r},"Cancel"),Ic.default.createElement(me,{variant:"default",onClick:c},"Save")))}var _de=class extends BZ.Modal{constructor(r,n){super(r);this.prompts=n;this.setTitle("Add System Prompt")}onOpen(){let{contentEl:r,modalEl:n}=this;BZ.Platform.isMobile&&(n.style.height="80%"),this.root=(0,H8r.createRoot)(r);let o=async i=>{let a=Date.now(),s={...i,createdMs:a,modifiedMs:a,lastUsedMs:0};try{await P3.getInstance().createPrompt(s),this.close()}catch(u){let l=u instanceof Error?u.message:String(u);ie("Failed to create system prompt:",u),new BZ.Notice(`Failed to create prompt: ${l}`)}};this.root.render(Ic.default.createElement(Rdi,{prompts:this.prompts,onConfirm:o,onCancel:()=>this.close(),contentEl:r}))}onClose(){this.root.unmount()}};var K8r=require("obsidian");Xe();Qe();Dt();var W8r="Migrated Custom System Prompt";function Idi(t,e){let r=t,n=1;for(;e.getAbstractFileByPath(aC(r));)n++,r=`${t} ${n}`;return r}function cbt(t){return t.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}async function J8r(t,e,r){let n=iC(),o=`${n}/unsupported`;await ql(o);let i="Migrated System Prompt (Failed Verification)",a=i,s=1;for(;t.getAbstractFileByPath(`${o}/${a}.md`);)s++,a=`${i} ${s}`;let u=`${o}/${a}.md`,l=`> Migration failed: ${r}
>
> To fix: Review the content below, then move this file to ${n}

${e}`;return await t.create(u,l),u}async function Adi(t,e,r){try{let n=await t.read(e),o=jJ(n,{trimStart:!1}),i=cbt(o).replace(/^\n+/,""),a=cbt(r).replace(/^\n+/,"");return i!==a?(Ce(`Migration verification failed: content mismatch. Expected ${a.length} chars, got ${i.length} chars`),!1):!0}catch(n){return ie("Migration verification failed: unable to read back file",n),!1}}async function dbt(t){let r=ee().userSystemPrompt;if(!r||r.trim().length===0){F("No legacy userSystemPrompt to migrate");return}try{F("Migrating legacy userSystemPrompt from settings to file system");let n=iC();await ql(n);let o=Idi(W8r,t),i=aC(o);o!==W8r&&F(`Default name already exists, using unique name: "${o}"`);let a=Date.now(),s=cbt(r),u={title:o,content:s,createdMs:a,modifiedMs:a,lastUsedMs:0};await t.create(i,s);let l=t.getAbstractFileByPath(i);if(!(l instanceof K8r.TFile))throw new Error("File not found after creation");if(await E3(l,u),await Adi(t,l,r)){Re("defaultSystemPromptTitle",o);try{await kZ()}catch(d){Ce("Failed to reload prompts after migration:",d)}Re("userSystemPrompt",""),F("Cleared legacy userSystemPrompt field"),new nu(app,()=>{},`We have upgraded your system prompt to the new file-based format. It is now stored as "${o}" in ${n}.

You can now:
\u2022 Edit your system prompt directly in the file
\u2022 Create multiple system prompts
\u2022 Manage prompts through the settings UI

Your migrated prompt has been set as the default system prompt.`,"\u{1F680} System Prompt Upgraded","OK","").open()}else{let d=await J8r(t,r,"content verification mismatch");try{await kZ()}catch(f){Ce("Failed to reload prompts after failed migration:",f)}Re("userSystemPrompt",""),F("Cleared legacy userSystemPrompt field (saved to unsupported)"),new nu(app,()=>{},`\u26A0\uFE0F System Prompt Migration Issue

Your system prompt was migrated but verification failed. Your data has been saved to:

${d}

To recover:
1. Open the file and review the content
2. Move it to ${n}
3. The prompt will be available immediately`,"Migration Verification Failed","OK","").open()}}catch(n){ie("Failed to migrate legacy userSystemPrompt:",n);try{let o=await J8r(t,r,n.message||String(n));Re("userSystemPrompt",""),F("Cleared legacy userSystemPrompt field (saved to unsupported after error)"),new nu(app,()=>{},`\u26A0\uFE0F System Prompt Migration Failed

An error occurred during migration. Your data has been saved to:

${o}

To recover:
1. Open the file and review the content
2. Move it to ${iC()}
3. The prompt will be available immediately`,"Migration Failed","OK","").open()}catch(o){ie("Failed to save to unsupported folder:",o),Ce("Preserving userSystemPrompt in settings for manual recovery"),new nu(app,()=>{},`Failed to migrate system prompt: ${n.message}

Unable to save to file system. Your system prompt is still in settings and will continue to work.

Please check:
- Folder permissions for ${iC()}
- Available disk space
- Vault is accessible

You can retry by reloading the plugin.`,"Migration Failed - Data Preserved","OK","").open()}}}rd();rd();na();function nLe(){let[t]=aw(),[e]=Gge(),[r]=YJ();return(()=>{if(t!=="project")return"initial";let{total:o,success:i,failed:a,processingFiles:s}=r;return e||s.length>0?"loading":a.length>0?"error":o.length>0&&i.length===o.length?"success":"initial"})()}Xe();na();rd();xn();gr();Xe();u0();id();Qe();Mr();var ny=require("obsidian"),hr=$(K());var Or=$(K());Mr();xn();var UZ=$(K());xn();Mr();var zZ=({value:t,onChange:e,placeholder:r="Search..."})=>UZ.default.createElement("div",{className:"tw-relative"},UZ.default.createElement(ni,{type:"text",placeholder:r,value:t,onChange:n=>e(n.target.value),className:"tw-pr-10"}),t&&UZ.default.createElement(me,{variant:"secondary",onClick:()=>e(""),className:"tw-absolute tw-right-8 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-rounded-full tw-p-0 tw-transition-colors","aria-label":"Clear search"},UZ.default.createElement(wO,{className:"tw-size-4 tw-text-muted/60 hover:tw-text-accent-hover"})),UZ.default.createElement(B4,{className:"tw-absolute tw-right-3 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-text-muted"}));var Sde=$(K());var lc=$(K(),1);var O$s=!!(typeof window<"u"&&window.document&&window.document.createElement);function VZ(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var X8r=$(K(),1);function G8r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function fbt(...t){return e=>{let r=!1,n=t.map(o=>{let i=G8r(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():G8r(t[o],null)}}}}function vde(...t){return X8r.useCallback(fbt(...t),t)}var J$=$(K(),1),Z8r=$(wt(),1);function Y8r(t,e=[]){let r=[];function n(i,a){let s=J$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=J$.useMemo(()=>m,Object.values(m));return(0,Z8r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=J$.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=>J$.createContext(a));return function(s){let u=s?.[t]||i;return J$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Ndi(o,...e)]}function Ndi(...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 J$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var pbt=$(K(),1);var Q8r=$(K(),1),M3=globalThis?.document?Q8r.useLayoutEffect:()=>{};var Ddi=pbt[" useId ".trim().toString()]||(()=>{}),jdi=0;function eGr(t){let[e,r]=pbt.useState(Ddi());return M3(()=>{t||r(n=>n??String(jdi++))},[t]),t||(e?`radix-${e}`:"")}var Rv=$(K(),1);var tGr=$(K(),1);function $di(t,e){return tGr.useReducer((r,n)=>e[r][n]??r,t)}var iLe=t=>{let{present:e,children:r}=t,n=Ldi(e),o=typeof r=="function"?r({present:n.isPresent}):Rv.Children.only(r),i=vde(n.ref,Fdi(o));return typeof r=="function"||n.isPresent?Rv.cloneElement(o,{ref:i}):null};iLe.displayName="Presence";function Ldi(t){let[e,r]=Rv.useState(),n=Rv.useRef(null),o=Rv.useRef(t),i=Rv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=$di(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Rv.useEffect(()=>{let l=oLe(n.current);i.current=s==="mounted"?l:"none"},[s]),M3(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=oLe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),M3(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=oLe(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=oLe(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:Rv.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function oLe(t){return t?.animationName||"none"}function Fdi(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 rGr=$(K(),1),Vdi=$(yu(),1);var ch=$(K(),1);var aLe=$(wt(),1);function sLe(t){let e=kdi(t),r=ch.forwardRef((n,o)=>{let{children:i,...a}=n,s=ch.Children.toArray(i),u=s.find(Bdi);if(u){let l=u.props.children,c=s.map(d=>d===u?ch.Children.count(l)>1?ch.Children.only(null):ch.isValidElement(l)?l.props.children:null:d);return(0,aLe.jsx)(e,{...a,ref:o,children:ch.isValidElement(l)?ch.cloneElement(l,void 0,c):null})}return(0,aLe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function kdi(t){let e=ch.forwardRef((r,n)=>{let{children:o,...i}=r;if(ch.isValidElement(o)){let a=zdi(o),s=Udi(i,o.props);return o.type!==ch.Fragment&&(s.ref=n?fbt(n,a):a),ch.cloneElement(o,s)}return ch.Children.count(o)>1?ch.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var qdi=Symbol("radix.slottable");function Bdi(t){return ch.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===qdi}function Udi(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function zdi(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 nGr=$(wt(),1),Hdi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],mbt=Hdi.reduce((t,e)=>{let r=sLe(`Primitive.${e}`),n=rGr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,nGr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var sC=$(K(),1);var uLe=$(K(),1);var Wdi=sC[" useInsertionEffect ".trim().toString()]||M3;function oGr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=Jdi({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=sC.useRef(t!==void 0);sC.useEffect(()=>{let d=c.current;d!==s&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}let l=sC.useCallback(c=>{if(s){let d=Kdi(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function Jdi({defaultProp:t,onChange:e}){let[r,n]=sC.useState(t),o=sC.useRef(r),i=sC.useRef(e);return Wdi(()=>{i.current=e},[e]),sC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function Kdi(t){return typeof t=="function"}var B$s=Symbol("RADIX:SYNC_STATE");var bm=$(wt(),1),lLe="Popover",[iGr,oLs]=Y8r(lLe,[tC]),wde=tC(),[Gdi,yU]=iGr(lLe),aGr=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=wde(e),u=lc.useRef(null),[l,c]=lc.useState(!1),[d,f]=oGr({prop:n,defaultProp:o??!1,onChange:i,caller:lLe});return(0,bm.jsx)(B$,{...s,children:(0,bm.jsx)(Gdi,{scope:e,contentId:eGr(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:lc.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:lc.useCallback(()=>c(!0),[]),onCustomAnchorRemove:lc.useCallback(()=>c(!1),[]),modal:a,children:r})})};aGr.displayName=lLe;var sGr="PopoverAnchor",Xdi=lc.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=yU(sGr,r),i=wde(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return lc.useEffect(()=>(a(),()=>s()),[a,s]),(0,bm.jsx)(U$,{...i,...n,ref:e})});Xdi.displayName=sGr;var uGr="PopoverTrigger",lGr=lc.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=yU(uGr,r),i=wde(r),a=vde(e,o.triggerRef),s=(0,bm.jsx)(mbt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":mGr(o.open),...n,ref:a,onClick:VZ(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,bm.jsx)(U$,{asChild:!0,...i,children:s})});lGr.displayName=uGr;var hbt="PopoverPortal",[Zdi,Ydi]=iGr(hbt,{forceMount:void 0}),cGr=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=yU(hbt,e);return(0,bm.jsx)(Zdi,{scope:e,forceMount:r,children:(0,bm.jsx)(iLe,{present:r||i.open,children:(0,bm.jsx)(mT,{asChild:!0,container:o,children:n})})})};cGr.displayName=hbt;var HZ="PopoverContent",dGr=lc.forwardRef((t,e)=>{let r=Ydi(HZ,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=yU(HZ,t.__scopePopover);return(0,bm.jsx)(iLe,{present:n||i.open,children:i.modal?(0,bm.jsx)(efi,{...o,ref:e}):(0,bm.jsx)(tfi,{...o,ref:e})})});dGr.displayName=HZ;var Qdi=sLe("PopoverContent.RemoveScroll"),efi=lc.forwardRef((t,e)=>{let r=yU(HZ,t.__scopePopover),n=lc.useRef(null),o=vde(e,n),i=lc.useRef(!1);return lc.useEffect(()=>{let a=n.current;if(a)return fU(a)},[]),(0,bm.jsx)(V$,{as:Qdi,allowPinchZoom:!0,children:(0,bm.jsx)(fGr,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:VZ(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:VZ(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:VZ(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),tfi=lc.forwardRef((t,e)=>{let r=yU(HZ,t.__scopePopover),n=lc.useRef(!1),o=lc.useRef(!1);return(0,bm.jsx)(fGr,{...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()}})}),fGr=lc.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=yU(HZ,r),p=wde(r);return aU(),(0,bm.jsx)(F$,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,bm.jsx)(lT,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,bm.jsx)(lU,{"data-state":mGr(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)"}})})})}),pGr="PopoverClose",rfi=lc.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=yU(pGr,r);return(0,bm.jsx)(mbt.button,{type:"button",...n,ref:e,onClick:VZ(t.onClick,()=>o.onOpenChange(!1))})});rfi.displayName=pGr;var nfi="PopoverArrow",ofi=lc.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=wde(r);return(0,bm.jsx)(cU,{...o,...n,ref:e})});ofi.displayName=nfi;function mGr(t){return t?"open":"closed"}var hGr=aGr;var gGr=lGr,yGr=cGr,gbt=dGr;var bGr=require("obsidian");zr();var bU=hGr,_U=gGr;var K$=Sde.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>Sde.createElement(yGr,{container:n??activeDocument.body},Sde.createElement(gbt,{ref:i,align:e,sideOffset:r,hideWhenDetached:bGr.Platform.isMobile,className:Se("tw-z-popover tw-w-72 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-4 tw-text-normal tw-shadow-md tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",t),...o})));K$.displayName=gbt.displayName;var cN=$(K());var an=$(K(),1);var SGr=$(K(),1),dfi=$(yu(),1);var dh=$(K(),1);var vGr=$(K(),1);function _Gr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function ybt(...t){return e=>{let r=!1,n=t.map(o=>{let i=_Gr(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():_Gr(t[o],null)}}}}function G$(...t){return vGr.useCallback(ybt(...t),t)}var cLe=$(wt(),1);function wGr(t){let e=afi(t),r=dh.forwardRef((n,o)=>{let{children:i,...a}=n,s=dh.Children.toArray(i),u=s.find(ufi);if(u){let l=u.props.children,c=s.map(d=>d===u?dh.Children.count(l)>1?dh.Children.only(null):dh.isValidElement(l)?l.props.children:null:d);return(0,cLe.jsx)(e,{...a,ref:o,children:dh.isValidElement(l)?dh.cloneElement(l,void 0,c):null})}return(0,cLe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function afi(t){let e=dh.forwardRef((r,n)=>{let{children:o,...i}=r;if(dh.isValidElement(o)){let a=cfi(o),s=lfi(i,o.props);return o.type!==dh.Fragment&&(s.ref=n?ybt(n,a):a),dh.cloneElement(o,s)}return dh.Children.count(o)>1?dh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var sfi=Symbol("radix.slottable");function ufi(t){return dh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===sfi}function lfi(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function cfi(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 CGr=$(wt(),1),ffi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],WZ=ffi.reduce((t,e)=>{let r=wGr(`Primitive.${e}`),n=SGr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,CGr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Iv=$(K(),1);var xGr=$(K(),1),Cde=globalThis?.document?xGr.useLayoutEffect:()=>{};var TGr=$(K(),1);function pfi(t,e){return TGr.useReducer((r,n)=>e[r][n]??r,t)}var JZ=t=>{let{present:e,children:r}=t,n=mfi(e),o=typeof r=="function"?r({present:n.isPresent}):Iv.Children.only(r),i=G$(n.ref,hfi(o));return typeof r=="function"||n.isPresent?Iv.cloneElement(o,{ref:i}):null};JZ.displayName="Presence";function mfi(t){let[e,r]=Iv.useState(),n=Iv.useRef(null),o=Iv.useRef(t),i=Iv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=pfi(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Iv.useEffect(()=>{let l=dLe(n.current);i.current=s==="mounted"?l:"none"},[s]),Cde(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=dLe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),Cde(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=dLe(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=dLe(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:Iv.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function dLe(t){return t?.animationName||"none"}function hfi(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 X$=$(K(),1),OGr=$(wt(),1);function EGr(t,e=[]){let r=[];function n(i,a){let s=X$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=X$.useMemo(()=>m,Object.values(m));return(0,OGr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=X$.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=>X$.createContext(a));return function(s){let u=s?.[t]||i;return X$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,gfi(o,...e)]}function gfi(...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 X$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var KZ=$(K(),1);function vU(t){let e=KZ.useRef(t);return KZ.useEffect(()=>{e.current=t}),KZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var fLe=$(K(),1),yfi=$(wt(),1),bfi=fLe.createContext(void 0);function PGr(t){let e=fLe.useContext(bfi);return t||e||"ltr"}function wU(t,[e,r]){return Math.min(r,Math.max(e,t))}var SLs=!!(typeof window<"u"&&window.document&&window.document.createElement);function SU(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var RGr=$(K(),1),Ks=$(wt(),1);function _fi(t,e){return RGr.useReducer((r,n)=>e[r][n]??r,t)}var bbt="ScrollArea",[IGr,NLs]=EGr(bbt),[vfi,uC]=IGr(bbt),AGr=an.forwardRef((t,e)=>{let{__scopeScrollArea:r,type:n="hover",dir:o,scrollHideDelay:i=600,...a}=t,[s,u]=an.useState(null),[l,c]=an.useState(null),[d,f]=an.useState(null),[p,m]=an.useState(null),[h,y]=an.useState(null),[g,b]=an.useState(0),[_,w]=an.useState(0),[T,O]=an.useState(!1),[E,P]=an.useState(!1),R=G$(e,A=>u(A)),I=PGr(o);return(0,Ks.jsx)(vfi,{scope:r,type:n,dir:I,scrollHideDelay:i,scrollArea:s,viewport:l,onViewportChange:c,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:T,onScrollbarXEnabledChange:O,scrollbarY:h,onScrollbarYChange:y,scrollbarYEnabled:E,onScrollbarYEnabledChange:P,onCornerWidthChange:b,onCornerHeightChange:w,children:(0,Ks.jsx)(WZ.div,{dir:I,...a,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":_+"px",...t.style}})})});AGr.displayName=bbt;var NGr="ScrollAreaViewport",DGr=an.forwardRef((t,e)=>{let{__scopeScrollArea:r,children:n,nonce:o,...i}=t,a=uC(NGr,r),s=an.useRef(null),u=G$(e,s,a.onViewportChange);return(0,Ks.jsxs)(Ks.Fragment,{children:[(0,Ks.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),(0,Ks.jsx)(WZ.div,{"data-radix-scroll-area-viewport":"",...i,ref:u,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:(0,Ks.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});DGr.displayName=NGr;var lN="ScrollAreaScrollbar",hLe=an.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=uC(lN,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,s=t.orientation==="horizontal";return an.useEffect(()=>(s?i(!0):a(!0),()=>{s?i(!1):a(!1)}),[s,i,a]),o.type==="hover"?(0,Ks.jsx)(wfi,{...n,ref:e,forceMount:r}):o.type==="scroll"?(0,Ks.jsx)(Sfi,{...n,ref:e,forceMount:r}):o.type==="auto"?(0,Ks.jsx)(jGr,{...n,ref:e,forceMount:r}):o.type==="always"?(0,Ks.jsx)(_bt,{...n,ref:e}):null});hLe.displayName=lN;var wfi=an.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=uC(lN,t.__scopeScrollArea),[i,a]=an.useState(!1);return an.useEffect(()=>{let s=o.scrollArea,u=0;if(s){let l=()=>{window.clearTimeout(u),a(!0)},c=()=>{u=window.setTimeout(()=>a(!1),o.scrollHideDelay)};return s.addEventListener("pointerenter",l),s.addEventListener("pointerleave",c),()=>{window.clearTimeout(u),s.removeEventListener("pointerenter",l),s.removeEventListener("pointerleave",c)}}},[o.scrollArea,o.scrollHideDelay]),(0,Ks.jsx)(JZ,{present:r||i,children:(0,Ks.jsx)(jGr,{"data-state":i?"visible":"hidden",...n,ref:e})})}),Sfi=an.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=uC(lN,t.__scopeScrollArea),i=t.orientation==="horizontal",a=yLe(()=>u("SCROLL_END"),100),[s,u]=_fi("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return an.useEffect(()=>{if(s==="idle"){let l=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(l)}},[s,o.scrollHideDelay,u]),an.useEffect(()=>{let l=o.viewport,c=i?"scrollLeft":"scrollTop";if(l){let d=l[c],f=()=>{let p=l[c];d!==p&&(u("SCROLL"),a()),d=p};return l.addEventListener("scroll",f),()=>l.removeEventListener("scroll",f)}},[o.viewport,i,u,a]),(0,Ks.jsx)(JZ,{present:r||s!=="hidden",children:(0,Ks.jsx)(_bt,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:SU(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:SU(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),jGr=an.forwardRef((t,e)=>{let r=uC(lN,t.__scopeScrollArea),{forceMount:n,...o}=t,[i,a]=an.useState(!1),s=t.orientation==="horizontal",u=yLe(()=>{if(r.viewport){let l=r.viewport.offsetWidth<r.viewport.scrollWidth,c=r.viewport.offsetHeight<r.viewport.scrollHeight;a(s?l:c)}},10);return GZ(r.viewport,u),GZ(r.content,u),(0,Ks.jsx)(JZ,{present:n||i,children:(0,Ks.jsx)(_bt,{"data-state":i?"visible":"hidden",...o,ref:e})})}),_bt=an.forwardRef((t,e)=>{let{orientation:r="vertical",...n}=t,o=uC(lN,t.__scopeScrollArea),i=an.useRef(null),a=an.useRef(0),[s,u]=an.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=kGr(s.viewport,s.content),c={...n,sizes:s,onSizesChange:u,hasThumb:l>0&&l<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:f=>a.current=f};function d(f,p){return Pfi(f,a.current,s,p)}return r==="horizontal"?(0,Ks.jsx)(Cfi,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollLeft,p=MGr(f,s,o.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:f=>{o.viewport&&(o.viewport.scrollLeft=f)},onDragScroll:f=>{o.viewport&&(o.viewport.scrollLeft=d(f,o.dir))}}):r==="vertical"?(0,Ks.jsx)(xfi,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollTop,p=MGr(f,s);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:f=>{o.viewport&&(o.viewport.scrollTop=f)},onDragScroll:f=>{o.viewport&&(o.viewport.scrollTop=d(f))}}):null}),Cfi=an.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=uC(lN,t.__scopeScrollArea),[a,s]=an.useState(),u=an.useRef(null),l=G$(e,u,i.onScrollbarXChange);return an.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Ks.jsx)(LGr,{"data-orientation":"horizontal",...o,ref:l,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":gLe(r)+"px",...t.style},onThumbPointerDown:c=>t.onThumbPointerDown(c.x),onDragScroll:c=>t.onDragScroll(c.x),onWheelScroll:(c,d)=>{if(i.viewport){let f=i.viewport.scrollLeft+c.deltaX;t.onWheelScroll(f),BGr(f,d)&&c.preventDefault()}},onResize:()=>{u.current&&i.viewport&&a&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:mLe(a.paddingLeft),paddingEnd:mLe(a.paddingRight)}})}})}),xfi=an.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=uC(lN,t.__scopeScrollArea),[a,s]=an.useState(),u=an.useRef(null),l=G$(e,u,i.onScrollbarYChange);return an.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Ks.jsx)(LGr,{"data-orientation":"vertical",...o,ref:l,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":gLe(r)+"px",...t.style},onThumbPointerDown:c=>t.onThumbPointerDown(c.y),onDragScroll:c=>t.onDragScroll(c.y),onWheelScroll:(c,d)=>{if(i.viewport){let f=i.viewport.scrollTop+c.deltaY;t.onWheelScroll(f),BGr(f,d)&&c.preventDefault()}},onResize:()=>{u.current&&i.viewport&&a&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:mLe(a.paddingTop),paddingEnd:mLe(a.paddingBottom)}})}})}),[Tfi,$Gr]=IGr(lN),LGr=an.forwardRef((t,e)=>{let{__scopeScrollArea:r,sizes:n,hasThumb:o,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:s,onThumbPositionChange:u,onDragScroll:l,onWheelScroll:c,onResize:d,...f}=t,p=uC(lN,r),[m,h]=an.useState(null),y=G$(e,R=>h(R)),g=an.useRef(null),b=an.useRef(""),_=p.viewport,w=n.content-n.viewport,T=vU(c),O=vU(u),E=yLe(d,10);function P(R){if(g.current){let I=R.clientX-g.current.left,A=R.clientY-g.current.top;l({x:I,y:A})}}return an.useEffect(()=>{let R=I=>{let A=I.target;m?.contains(A)&&T(I,w)};return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[_,m,w,T]),an.useEffect(O,[n,O]),GZ(m,E),GZ(p.content,E),(0,Ks.jsx)(Tfi,{scope:r,scrollbar:m,hasThumb:o,onThumbChange:vU(i),onThumbPointerUp:vU(a),onThumbPositionChange:O,onThumbPointerDown:vU(s),children:(0,Ks.jsx)(WZ.div,{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:SU(t.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),g.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),P(R))}),onPointerMove:SU(t.onPointerMove,P),onPointerUp:SU(t.onPointerUp,R=>{let I=R.target;I.hasPointerCapture(R.pointerId)&&I.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),g.current=null})})})}),pLe="ScrollAreaThumb",vbt=an.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=$Gr(pLe,t.__scopeScrollArea);return(0,Ks.jsx)(JZ,{present:r||o.hasThumb,children:(0,Ks.jsx)(Ofi,{ref:e,...n})})}),Ofi=an.forwardRef((t,e)=>{let{__scopeScrollArea:r,style:n,...o}=t,i=uC(pLe,r),a=$Gr(pLe,r),{onThumbPositionChange:s}=a,u=G$(e,d=>a.onThumbChange(d)),l=an.useRef(void 0),c=yLe(()=>{l.current&&(l.current(),l.current=void 0)},100);return an.useEffect(()=>{let d=i.viewport;if(d){let f=()=>{if(c(),!l.current){let p=Mfi(d,s);l.current=p,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,c,s]),(0,Ks.jsx)(WZ.div,{"data-state":a.hasThumb?"visible":"hidden",...o,ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:SU(t.onPointerDownCapture,d=>{let p=d.target.getBoundingClientRect(),m=d.clientX-p.left,h=d.clientY-p.top;a.onThumbPointerDown({x:m,y:h})}),onPointerUp:SU(t.onPointerUp,a.onThumbPointerUp)})});vbt.displayName=pLe;var wbt="ScrollAreaCorner",FGr=an.forwardRef((t,e)=>{let r=uC(wbt,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?(0,Ks.jsx)(Efi,{...t,ref:e}):null});FGr.displayName=wbt;var Efi=an.forwardRef((t,e)=>{let{__scopeScrollArea:r,...n}=t,o=uC(wbt,r),[i,a]=an.useState(0),[s,u]=an.useState(0),l=!!(i&&s);return GZ(o.scrollbarX,()=>{let c=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(c),u(c)}),GZ(o.scrollbarY,()=>{let c=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(c),a(c)}),l?(0,Ks.jsx)(WZ.div,{...n,ref:e,style:{width:i,height:s,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function mLe(t){return t?parseInt(t,10):0}function kGr(t,e){let r=t/e;return isNaN(r)?0:r}function gLe(t){let e=kGr(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function Pfi(t,e,r,n="ltr"){let o=gLe(r),i=o/2,a=e||i,s=o-a,u=r.scrollbar.paddingStart+a,l=r.scrollbar.size-r.scrollbar.paddingEnd-s,c=r.content-r.viewport,d=n==="ltr"?[0,c]:[c*-1,0];return qGr([u,l],d)(t)}function MGr(t,e,r="ltr"){let n=gLe(e),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-o,a=e.content-e.viewport,s=i-n,u=r==="ltr"?[0,a]:[a*-1,0],l=wU(t,u);return qGr([0,a],[0,s])(l)}function qGr(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 BGr(t,e){return t>0&&t<e}var Mfi=(t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return function o(){let i={left:t.scrollLeft,top:t.scrollTop},a=r.left!==i.left,s=r.top!==i.top;(a||s)&&e(),r=i,n=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(n)};function yLe(t,e){let r=vU(t),n=an.useRef(0);return an.useEffect(()=>()=>window.clearTimeout(n.current),[]),an.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function GZ(t,e){let r=vU(e);Cde(()=>{let n=0;if(t){let o=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return o.observe(t),()=>{window.cancelAnimationFrame(n),o.unobserve(t)}}},[t,r])}var Sbt=AGr,UGr=DGr;var zGr=FGr;zr();var CU=cN.forwardRef(({className:t,children:e,...r},n)=>cN.createElement(Sbt,{ref:n,className:Se("tw-relative tw-overflow-hidden",t),...r},cN.createElement(UGr,{className:"tw-size-full tw-rounded-[inherit] [&>div:first-child]:!tw-block"},e),cN.createElement(VGr,null),cN.createElement(zGr,null)));CU.displayName=Sbt.displayName;var VGr=cN.forwardRef(({className:t,orientation:e="vertical",...r},n)=>cN.createElement(hLe,{ref:n,orientation:e,className:Se("tw-flex tw-touch-none tw-select-none tw-transition-colors",e==="vertical"&&"tw-h-full tw-w-2.5 tw-border-l tw-border-l-transparent tw-p-px",e==="horizontal"&&"tw-h-2.5 tw-flex-col tw-border-t tw-border-t-transparent tw-p-px",t),...r},cN.createElement(vbt,{className:"tw-relative tw-flex-1 tw-rounded-full tw-bg-[var(--background-modifier-border)]"})));VGr.displayName=hLe.displayName;zr();Xe();Qe();t1();var HGr=require("obsidian"),bLe=50;function WGr({children:t,chatHistory:e,onUpdateTitle:r,onDeleteChat:n,onLoadChat:o,onOpenSourceFile:i}){let[a,s]=(0,Or.useState)(""),[u,l]=(0,Or.useState)(null),[c,d]=(0,Or.useState)(""),[f,p]=(0,Or.useState)(!1),[m,h]=(0,Or.useState)(null),[y,g]=(0,Or.useState)(bLe),b=(0,Or.useRef)(null),_=(0,Or.useRef)(null),w=HGr.Platform.isMobile,T=kr(),O=(0,Or.useMemo)(()=>a.trim()?e.filter(X=>X.title.toLowerCase().includes(a.toLowerCase())):e,[e,a]),E=(0,Or.useMemo)(()=>iO(O,T.chatHistorySortStrategy,{getName:X=>X.title,getCreatedAtMs:X=>X.createdAt.getTime(),getLastUsedAtMs:X=>X.lastAccessedAt.getTime()}),[O,T.chatHistorySortStrategy]);(0,Or.useLayoutEffect)(()=>{f&&g(bLe)},[f,a]);let P=(0,Or.useMemo)(()=>E.slice(0,y),[E,y]),R=(0,Or.useRef)({displayCount:bLe,totalCount:0});(0,Or.useEffect)(()=>{R.current={displayCount:y,totalCount:E.length}},[y,E.length]);let I=(0,Or.useCallback)(X=>{if(b.current&&(b.current.disconnect(),b.current=null),!X)return;let W=new IntersectionObserver(re=>{if(re[0].isIntersecting){let{displayCount:ue,totalCount:le}=R.current;ue<le&&g(L=>Math.min(L+bLe,le))}},{threshold:.1});W.observe(X),b.current=W},[]),A=(0,Or.useMemo)(()=>{let X=T.chatHistorySortStrategy;if(X==="name")return[{key:"All",label:"All",chats:P,priority:0}];let W=[],re=new Map,ue=new Date;return P.forEach(le=>{let L=X==="recent"?le.lastAccessedAt:le.createdAt,J=ue.getTime()-L.getTime(),ne=Math.floor(J/(1e3*60*60*24)),D,N;if(ne===0)D="Today",N=0;else if(ne===1)D="Yesterday",N=1;else if(ne<7)D=`${ne}d ago`,N=2+ne;else if(ne<30){let z=Math.floor(ne/7);D=z===1?"1w ago":`${z}w ago`,N=10+z}else{let z=Math.floor(ne/30);D=z===1?"1m ago":`${z}m ago`,N=50+z}re.has(D)||(re.set(D,[]),W.push({key:D,label:D,chats:re.get(D),priority:N})),re.get(D).push(le)}),W.sort((le,L)=>le.priority-L.priority)},[T.chatHistorySortStrategy,P]),B=(X,W)=>{l(X),d(W)},k=async()=>{if(u&&c.trim())try{await r(u,c.trim()),l(null),d("")}catch(X){ie("Error updating title:",X);return}else l(null),d("")},q=()=>{l(null),d("")};(0,Or.useEffect)(()=>()=>{_.current&&clearTimeout(_.current)},[]);let Z=async X=>{if(m===X)try{await n(X),h(null)}catch(W){ie("Error deleting chat:",W),h(null)}else _.current&&clearTimeout(_.current),h(X),_.current=setTimeout(()=>{h(null),_.current=null},3e3)},V=()=>{h(null)},Y=async X=>{o&&await o(X),p(!1)};return Or.default.createElement(bU,{open:f,onOpenChange:p},Or.default.createElement(_U,{asChild:!0},t),Or.default.createElement(K$,{className:"tw-w-80 tw-p-0",align:"end",side:"top"},Or.default.createElement("div",{className:"tw-flex tw-max-h-[400px] tw-flex-col"},Or.default.createElement("div",{className:"tw-shrink-0 tw-border-b tw-p-1"},Or.default.createElement(zZ,{value:a,onChange:s})),Or.default.createElement(CU,{className:"tw-min-h-[150px] tw-flex-1 tw-overflow-y-auto"},Or.default.createElement("div",{className:"tw-p-2"},A.length===0?Or.default.createElement("div",{className:"tw-py-8 tw-text-center tw-text-muted"},a?"No matching chat history found.":"No chat history"):Or.default.createElement(Or.default.Fragment,null,A.map(X=>Or.default.createElement("div",{key:X.key,className:"tw-mb-3 tw-border-x-[0px] tw-border-b tw-border-t-[0px] tw-border-border tw-pb-2",style:{borderBottomStyle:"solid"}},Or.default.createElement("div",{className:"tw-mb-2 tw-px-2 tw-text-xs tw-font-medium tw-tracking-wider tw-text-muted"},X.label),Or.default.createElement("div",{className:"tw-space-y-1"},X.chats.map(W=>Or.default.createElement(Ifi,{key:W.id,chat:W,isEditing:u===W.id,editingTitle:c,onEditingTitleChange:d,onStartEdit:B,onSaveEdit:k,onCancelEdit:q,onDelete:Z,onCancelDelete:V,onLoadChat:Y,onOpenSourceFile:i,isMobile:w,confirmDeleteId:m}))))),Or.default.createElement("div",{ref:I,className:"tw-h-1"}),y<E.length?Or.default.createElement("div",{className:"tw-py-2 tw-text-center tw-text-xs tw-text-muted"},"Showing ",y," of ",E.length," \u2014 scroll for more"):null))))))}function Ifi({chat:t,isEditing:e,editingTitle:r,onEditingTitleChange:n,onStartEdit:o,onSaveEdit:i,onCancelEdit:a,onDelete:s,onCancelDelete:u,onLoadChat:l,onOpenSourceFile:c,isMobile:d,confirmDeleteId:f}){return e?Or.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2"},Or.default.createElement(j5,{className:"tw-size-3 tw-shrink-0 tw-text-muted"}),Or.default.createElement(ni,{value:r,onChange:p=>n(p.target.value),className:"!tw-h-6 tw-flex-1",autoFocus:!0,onKeyDown:p=>{p.key==="Enter"?i():p.key==="Escape"&&a()}}),Or.default.createElement(me,{size:"sm",variant:"ghost",onClick:i,className:"tw-size-5 tw-p-0"},Or.default.createElement(Yu,{className:"tw-size-3"})),Or.default.createElement(me,{size:"sm",variant:"ghost",onClick:a,className:"tw-size-5 tw-p-0"},Or.default.createElement(Ho,{className:"tw-size-3"}))):Or.default.createElement("div",{className:Se("tw-group tw-flex tw-cursor-pointer tw-items-center tw-gap-2 tw-rounded-md tw-p-1 tw-transition-colors hover:tw-bg-modifier-hover"),onClick:()=>l(t.id)},Or.default.createElement(j5,{className:"tw-size-3 tw-shrink-0 tw-text-muted"}),Or.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},Or.default.createElement("span",{className:"tw-block tw-truncate tw-text-sm tw-font-medium tw-text-normal"},t.title)),Or.default.createElement("div",{className:Se("tw-flex tw-shrink-0 tw-items-center tw-gap-1.5 tw-transition-opacity",d?"tw-flex":"tw-hidden group-hover:tw-flex")},f===t.id?Or.default.createElement(Or.default.Fragment,null,Or.default.createElement(me,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),s(t.id)},className:"tw-size-5 tw-p-0 tw-text-error hover:tw-text-error",title:"Confirm Delete"},Or.default.createElement(Yu,{className:"tw-size-3"})),Or.default.createElement(me,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),u()},className:"tw-size-5 tw-p-0",title:"Cancel deletion"},Or.default.createElement(Ho,{className:"tw-size-3"}))):Or.default.createElement(Or.default.Fragment,null,Or.default.createElement(me,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),c&&c(t.id)},className:"tw-size-5 tw-p-0",title:"Open the source file"},Or.default.createElement(_1,{className:"tw-size-4"})),Or.default.createElement(me,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),o(t.id,t.title)},className:"tw-size-5 tw-p-0"},Or.default.createElement(Lb,{className:"tw-size-3"})),Or.default.createElement(me,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),s(t.id)},className:"tw-size-5 tw-p-0 tw-text-error hover:tw-text-error",title:"delete file"},Or.default.createElement(Iy,{className:"tw-size-3"})))))}Mr();var R3=$(K()),JGr=({tokenCount:t})=>t==null?null:R3.default.createElement(vn,null,R3.default.createElement(wn,{asChild:!0},R3.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-faint"},R3.default.createElement(Sre,{className:"tw-size-3"}),R3.default.createElement("span",null,(r=>r<1e3?"<1k":`${Math.floor(r/1e3)}k`)(t)))),R3.default.createElement(pn,null,"Context used: ",t.toLocaleString()));var fr=$(K());xn();var I3=$(K());zr();Mr();function dN({options:t,placeholder:e,containerClassName:r,className:n,...o}){return I3.default.createElement("div",{className:Se("tw-group tw-relative tw-w-full",r)},I3.default.createElement("select",{className:Se("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&&I3.default.createElement("option",{value:"",disabled:!0},e),t.map(i=>I3.default.createElement("option",{key:i.value,value:i.value},i.label))),I3.default.createElement("div",{className:Se("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")},I3.default.createElement(Ji,{className:"tw-size-4"})))}var vLe=$(K());var t9r=$(K(),1);var ZGr=$(K(),1),Ffi=$(yu(),1);var fh=$(K(),1);var Afi=$(K(),1);function KGr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function GGr(...t){return e=>{let r=!1,n=t.map(o=>{let i=KGr(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():KGr(t[o],null)}}}}var _Le=$(wt(),1);function XGr(t){let e=Nfi(t),r=fh.forwardRef((n,o)=>{let{children:i,...a}=n,s=fh.Children.toArray(i),u=s.find(jfi);if(u){let l=u.props.children,c=s.map(d=>d===u?fh.Children.count(l)>1?fh.Children.only(null):fh.isValidElement(l)?l.props.children:null:d);return(0,_Le.jsx)(e,{...a,ref:o,children:fh.isValidElement(l)?fh.cloneElement(l,void 0,c):null})}return(0,_Le.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Nfi(t){let e=fh.forwardRef((r,n)=>{let{children:o,...i}=r;if(fh.isValidElement(o)){let a=Lfi(o),s=$fi(i,o.props);return o.type!==fh.Fragment&&(s.ref=n?GGr(n,a):a),fh.cloneElement(o,s)}return fh.Children.count(o)>1?fh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Dfi=Symbol("radix.slottable");function jfi(t){return fh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Dfi}function $fi(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Lfi(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var YGr=$(wt(),1),kfi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],QGr=kfi.reduce((t,e)=>{let r=XGr(`Primitive.${e}`),n=ZGr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,YGr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var r9r=$(wt(),1),qfi="Separator",e9r="horizontal",Bfi=["horizontal","vertical"],n9r=t9r.forwardRef((t,e)=>{let{decorative:r,orientation:n=e9r,...o}=t,i=Ufi(n)?n:e9r,s=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return(0,r9r.jsx)(QGr.div,{"data-orientation":i,...s,...o,ref:e})});n9r.displayName=qfi;function Ufi(t){return Bfi.includes(t)}var Cbt=n9r;zr();var lC=vLe.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},o)=>vLe.createElement(Cbt,{ref:o,decorative:r,orientation:e,className:Se("tw-shrink-0 tw-bg-[var(--background-modifier-border)]",e==="horizontal"?"tw-h-px tw-w-full":"tw-h-full tw-w-px",t),...n}));lC.displayName=Cbt.displayName;Mr();var io=$(K());var XZ=$(K());var ko=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>XZ.default.createElement("div",{className:"tw-space-y-2"},t&&XZ.default.createElement(uc,{className:r?"tw-text-error":""},t," ",e&&XZ.default.createElement("span",{className:"tw-text-error"},"*")),n&&XZ.default.createElement("p",{className:"tw-text-sm tw-text-muted"},n),i,r&&XZ.default.createElement("p",{className:"tw-text-xs tw-text-error"},o));var mu=$(K());var D3=$(K());var Eu=$(K(),1);function A3(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var i9r=$(K(),1);function o9r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function xbt(...t){return e=>{let r=!1,n=t.map(o=>{let i=o9r(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():o9r(t[o],null)}}}}function N3(...t){return i9r.useCallback(xbt(...t),t)}var Z$=$(K(),1),a9r=$(wt(),1);function s9r(t,e=[]){let r=[];function n(i,a){let s=Z$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=Z$.useMemo(()=>m,Object.values(m));return(0,a9r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=Z$.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=>Z$.createContext(a));return function(s){let u=s?.[t]||i;return Z$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Vfi(o,...e)]}function Vfi(...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 Z$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var cC=$(K(),1);var u9r=$(K(),1),wLe=globalThis?.document?u9r.useLayoutEffect:()=>{};var SLe=$(K(),1);var Hfi=cC[" useInsertionEffect ".trim().toString()]||wLe;function l9r({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=Wfi({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=cC.useRef(t!==void 0);cC.useEffect(()=>{let d=c.current;d!==s&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}let l=cC.useCallback(c=>{if(s){let d=Jfi(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function Wfi({defaultProp:t,onChange:e}){let[r,n]=cC.useState(t),o=cC.useRef(r),i=cC.useRef(e);return Hfi(()=>{i.current=e},[e]),cC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function Jfi(t){return typeof t=="function"}var mFs=Symbol("RADIX:SYNC_STATE");var CLe=$(K(),1),Kfi=$(wt(),1),Gfi=CLe.createContext(void 0);function c9r(t){let e=CLe.useContext(Gfi);return t||e||"ltr"}var xLe=$(K(),1);function d9r(t){let e=xLe.useRef({value:t,previous:t});return xLe.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var f9r=$(K(),1);function p9r(t){let[e,r]=f9r.useState(void 0);return wLe(()=>{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 h9r=$(K(),1),tpi=$(yu(),1);var ph=$(K(),1);var TLe=$(wt(),1);function m9r(t){let e=Xfi(t),r=ph.forwardRef((n,o)=>{let{children:i,...a}=n,s=ph.Children.toArray(i),u=s.find(Yfi);if(u){let l=u.props.children,c=s.map(d=>d===u?ph.Children.count(l)>1?ph.Children.only(null):ph.isValidElement(l)?l.props.children:null:d);return(0,TLe.jsx)(e,{...a,ref:o,children:ph.isValidElement(l)?ph.cloneElement(l,void 0,c):null})}return(0,TLe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Xfi(t){let e=ph.forwardRef((r,n)=>{let{children:o,...i}=r;if(ph.isValidElement(o)){let a=epi(o),s=Qfi(i,o.props);return o.type!==ph.Fragment&&(s.ref=n?xbt(n,a):a),ph.cloneElement(o,s)}return ph.Children.count(o)>1?ph.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Zfi=Symbol("radix.slottable");function Yfi(t){return ph.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Zfi}function Qfi(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function epi(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 g9r=$(wt(),1),rpi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ZZ=rpi.reduce((t,e)=>{let r=m9r(`Primitive.${e}`),n=h9r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,g9r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var mh=$(wt(),1),y9r=["PageUp","PageDown"],b9r=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],_9r={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},YZ="Slider",[Tbt,npi,opi]=oU(YZ),[v9r,DFs]=s9r(YZ,[opi]),[ipi,OLe]=v9r(YZ),w9r=Eu.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,y=Eu.useRef(new Set),g=Eu.useRef(0),_=a==="horizontal"?api:spi,[w=[],T]=l9r({prop:c,defaultProp:l,onChange:A=>{[...y.current][g.current]?.focus(),d(A)}}),O=Eu.useRef(w);function E(A){let B=fpi(w,A);I(A,B)}function P(A){I(A,g.current)}function R(){let A=O.current[g.current];w[g.current]!==A&&f(w)}function I(A,B,{commit:k}={commit:!1}){let q=gpi(i),Z=ypi(Math.round((A-n)/i)*i+n,q),V=wU(Z,[n,o]);T((Y=[])=>{let X=cpi(Y,V,B);if(hpi(X,u*i)){g.current=X.indexOf(V);let W=String(X)!==String(Y);return W&&k&&f(X),W?X:Y}else return Y})}return(0,mh.jsx)(ipi,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:y.current,values:w,orientation:a,form:m,children:(0,mh.jsx)(Tbt.Provider,{scope:t.__scopeSlider,children:(0,mh.jsx)(Tbt.Slot,{scope:t.__scopeSlider,children:(0,mh.jsx)(_,{"aria-disabled":s,"data-disabled":s?"":void 0,...h,ref:e,onPointerDown:A3(h.onPointerDown,()=>{s||(O.current=w)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:E,onSlideMove:s?void 0:P,onSlideEnd:s?void 0:R,onHomeKeyDown:()=>!s&&I(n,0,{commit:!0}),onEndKeyDown:()=>!s&&I(o,w.length-1,{commit:!0}),onStepKeyDown:({event:A,direction:B})=>{if(!s){let Z=y9r.includes(A.key)||A.shiftKey&&b9r.includes(A.key)?10:1,V=g.current,Y=w[V],X=i*Z*B;I(Y+X,V,{commit:!0})}}})})})})});w9r.displayName=YZ;var[S9r,C9r]=v9r(YZ,{startEdge:"left",endEdge:"right",size:"width",direction:1}),api=Eu.forwardRef((t,e)=>{let{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:u,onStepKeyDown:l,...c}=t,[d,f]=Eu.useState(null),p=N3(e,_=>f(_)),m=Eu.useRef(void 0),h=c9r(o),y=h==="ltr",g=y&&!i||!y&&i;function b(_){let w=m.current||d.getBoundingClientRect(),T=[0,w.width],E=Pbt(T,g?[r,n]:[n,r]);return m.current=w,E(_-w.left)}return(0,mh.jsx)(S9r,{scope:t.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:(0,mh.jsx)(x9r,{dir:h,"data-orientation":"horizontal",...c,ref:p,style:{...c.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:_=>{let w=b(_.clientX);a?.(w)},onSlideMove:_=>{let w=b(_.clientX);s?.(w)},onSlideEnd:()=>{m.current=void 0,u?.()},onStepKeyDown:_=>{let T=_9r[g?"from-left":"from-right"].includes(_.key);l?.({event:_,direction:T?-1:1})}})})}),spi=Eu.forwardRef((t,e)=>{let{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:u,...l}=t,c=Eu.useRef(null),d=N3(e,c),f=Eu.useRef(void 0),p=!o;function m(h){let y=f.current||c.current.getBoundingClientRect(),g=[0,y.height],_=Pbt(g,p?[n,r]:[r,n]);return f.current=y,_(h-y.top)}return(0,mh.jsx)(S9r,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,mh.jsx)(x9r,{"data-orientation":"vertical",...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{let y=m(h.clientY);i?.(y)},onSlideMove:h=>{let y=m(h.clientY);a?.(y)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:h=>{let g=_9r[p?"from-bottom":"from-top"].includes(h.key);u?.({event:h,direction:g?-1:1})}})})}),x9r=Eu.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=OLe(YZ,r);return(0,mh.jsx)(ZZ.span,{...l,ref:e,onKeyDown:A3(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):y9r.concat(b9r).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:A3(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:A3(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:A3(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),T9r="SliderTrack",O9r=Eu.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=OLe(T9r,r);return(0,mh.jsx)(ZZ.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});O9r.displayName=T9r;var Obt="SliderRange",E9r=Eu.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=OLe(Obt,r),i=C9r(Obt,r),a=Eu.useRef(null),s=N3(e,a),u=o.values.length,l=o.values.map(f=>R9r(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,mh.jsx)(ZZ.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});E9r.displayName=Obt;var Ebt="SliderThumb",P9r=Eu.forwardRef((t,e)=>{let r=npi(t.__scopeSlider),[n,o]=Eu.useState(null),i=N3(e,s=>o(s)),a=Eu.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,mh.jsx)(upi,{...t,ref:i,index:a})}),upi=Eu.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=OLe(Ebt,r),s=C9r(Ebt,r),[u,l]=Eu.useState(null),c=N3(e,b=>l(b)),d=u?a.form||!!u.closest("form"):!0,f=p9r(u),p=a.values[n],m=p===void 0?0:R9r(p,a.min,a.max),h=dpi(n,a.values.length),y=f?.[s.size],g=y?ppi(y,m,s.direction):0;return Eu.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,mh.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${m}% + ${g}px)`},children:[(0,mh.jsx)(Tbt.ItemSlot,{scope:t.__scopeSlider,children:(0,mh.jsx)(ZZ.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:A3(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,mh.jsx)(M9r,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});P9r.displayName=Ebt;var lpi="RadioBubbleInput",M9r=Eu.forwardRef(({__scopeSlider:t,value:e,...r},n)=>{let o=Eu.useRef(null),i=N3(o,n),a=d9r(e);return Eu.useEffect(()=>{let s=o.current;if(!s)return;let u=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==e&&c){let d=new Event("input",{bubbles:!0});c.call(s,e),s.dispatchEvent(d)}},[a,e]),(0,mh.jsx)(ZZ.input,{style:{display:"none"},...r,ref:i,defaultValue:e})});M9r.displayName=lpi;function cpi(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function R9r(t,e,r){let i=100/(r-e)*(t-e);return wU(i,[0,100])}function dpi(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function fpi(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 ppi(t,e,r){let n=t/2,i=Pbt([0,50],[0,n]);return(n-i(e)*r)*r}function mpi(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function hpi(t,e){if(e>0){let r=mpi(t);return Math.min(...r)>=e}return!0}function Pbt(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 gpi(t){return(String(t).split(".")[1]||"").length}function ypi(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var Mbt=w9r,I9r=O9r,A9r=E9r,N9r=P9r;zr();var xde=D3.forwardRef(({className:t,...e},r)=>D3.createElement(Mbt,{ref:r,className:Se("tw-relative tw-flex tw-w-full tw-touch-none tw-select-none tw-items-center",t),...e},D3.createElement(I9r,{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"},D3.createElement(A9r,{className:"tw-absolute tw-h-full tw-bg-interactive-accent"})),D3.createElement(N9r,{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"})));xde.displayName=Mbt.displayName;xn();var Pu=$(K());var er=$(K(),1),Fbt=$(yu(),1);var LFs=!!(typeof window<"u"&&window.document&&window.document.createElement);function ng(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var j9r=$(K(),1);function D9r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Rbt(...t){return e=>{let r=!1,n=t.map(o=>{let i=D9r(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():D9r(t[o],null)}}}}function yT(...t){return j9r.useCallback(Rbt(...t),t)}var Y$=$(K(),1),$9r=$(wt(),1);function L9r(t,e=[]){let r=[];function n(i,a){let s=Y$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=Y$.useMemo(()=>m,Object.values(m));return(0,$9r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=Y$.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=>Y$.createContext(a));return function(s){let u=s?.[t]||i;return Y$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,_pi(o,...e)]}function _pi(...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 Y$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var ELe=$(K(),1),vpi=$(wt(),1),wpi=ELe.createContext(void 0);function F9r(t){let e=ELe.useContext(wpi);return t||e||"ltr"}var Ibt=$(K(),1);var k9r=$(K(),1),eS=globalThis?.document?k9r.useLayoutEffect:()=>{};var Spi=Ibt[" useId ".trim().toString()]||(()=>{}),Cpi=0;function PLe(t){let[e,r]=Ibt.useState(Spi());return eS(()=>{t||r(n=>n??String(Cpi++))},[t]),t||(e?`radix-${e}`:"")}var q9r=$(K(),1),Mpi=$(yu(),1);var hh=$(K(),1);var MLe=$(wt(),1);function RLe(t){let e=xpi(t),r=hh.forwardRef((n,o)=>{let{children:i,...a}=n,s=hh.Children.toArray(i),u=s.find(Opi);if(u){let l=u.props.children,c=s.map(d=>d===u?hh.Children.count(l)>1?hh.Children.only(null):hh.isValidElement(l)?l.props.children:null:d);return(0,MLe.jsx)(e,{...a,ref:o,children:hh.isValidElement(l)?hh.cloneElement(l,void 0,c):null})}return(0,MLe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function xpi(t){let e=hh.forwardRef((r,n)=>{let{children:o,...i}=r;if(hh.isValidElement(o)){let a=Ppi(o),s=Epi(i,o.props);return o.type!==hh.Fragment&&(s.ref=n?Rbt(n,a):a),hh.cloneElement(o,s)}return hh.Children.count(o)>1?hh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Tpi=Symbol("radix.slottable");function Opi(t){return hh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Tpi}function Epi(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Ppi(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 B9r=$(wt(),1),Rpi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Av=Rpi.reduce((t,e)=>{let r=RLe(`Primitive.${e}`),n=q9r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,B9r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var QZ=$(K(),1);function U9r(t){let e=QZ.useRef(t);return QZ.useEffect(()=>{e.current=t}),QZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var dC=$(K(),1);var ILe=$(K(),1);var Ipi=dC[" useInsertionEffect ".trim().toString()]||eS;function Abt({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=Api({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=dC.useRef(t!==void 0);dC.useEffect(()=>{let d=c.current;d!==s&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}let l=dC.useCallback(c=>{if(s){let d=Npi(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function Api({defaultProp:t,onChange:e}){let[r,n]=dC.useState(t),o=dC.useRef(r),i=dC.useRef(e);return Ipi(()=>{i.current=e},[e]),dC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function Npi(t){return typeof t=="function"}var ZFs=Symbol("RADIX:SYNC_STATE");var ALe=$(K(),1);function z9r(t){let e=ALe.useRef({value:t,previous:t});return ALe.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Mn=$(wt(),1),Dpi=[" ","Enter","ArrowUp","ArrowDown"],jpi=[" ","Enter"],j3="Select",[DLe,jLe,$pi]=oU(j3),[eY,wks]=L9r(j3,[$pi,tC]),$Le=tC(),[Lpi,xU]=eY(j3),[Fpi,kpi]=eY(j3),V9r=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=$Le(e),[y,g]=er.useState(null),[b,_]=er.useState(null),[w,T]=er.useState(!1),O=F9r(l),[E,P]=Abt({prop:n,defaultProp:o??!1,onChange:i,caller:j3}),[R,I]=Abt({prop:a,defaultProp:s,onChange:u,caller:j3}),A=er.useRef(null),B=y?m||!!y.closest("form"):!0,[k,q]=er.useState(new Set),Z=Array.from(k).map(V=>V.props.value).join(";");return(0,Mn.jsx)(B$,{...h,children:(0,Mn.jsxs)(Lpi,{required:p,scope:e,trigger:y,onTriggerChange:g,valueNode:b,onValueNodeChange:_,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:PLe(),value:R,onValueChange:I,open:E,onOpenChange:P,dir:O,triggerPointerDownPosRef:A,disabled:f,children:[(0,Mn.jsx)(DLe.Provider,{scope:e,children:(0,Mn.jsx)(Fpi,{scope:t.__scopeSelect,onNativeOptionAdd:er.useCallback(V=>{q(Y=>new Set(Y).add(V))},[]),onNativeOptionRemove:er.useCallback(V=>{q(Y=>{let X=new Set(Y);return X.delete(V),X})},[]),children:r})}),B?(0,Mn.jsxs)(m7r,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:R,onChange:V=>I(V.target.value),disabled:f,form:m,children:[R===void 0?(0,Mn.jsx)("option",{value:""}):null,Array.from(k)]},Z):null]})})};V9r.displayName=j3;var H9r="SelectTrigger",W9r=er.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=$Le(r),a=xU(H9r,r),s=a.disabled||n,u=yT(e,a.onTriggerChange),l=jLe(r),c=er.useRef("touch"),[d,f,p]=g7r(h=>{let y=l().filter(_=>!_.disabled),g=y.find(_=>_.value===a.value),b=y7r(y,h,g);b!==void 0&&a.onValueChange(b.value)}),m=h=>{s||(a.onOpenChange(!0),p()),h&&(a.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return(0,Mn.jsx)(U$,{asChild:!0,...i,children:(0,Mn.jsx)(Av.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":h7r(a.value)?"":void 0,...o,ref:u,onClick:ng(o.onClick,h=>{h.currentTarget.focus(),c.current!=="mouse"&&m(h)}),onPointerDown:ng(o.onPointerDown,h=>{c.current=h.pointerType;let y=h.target;y.hasPointerCapture(h.pointerId)&&y.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(m(h),h.preventDefault())}),onKeyDown:ng(o.onKeyDown,h=>{let y=d.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(y&&h.key===" ")&&Dpi.includes(h.key)&&(m(),h.preventDefault())})})})});W9r.displayName=H9r;var J9r="SelectValue",K9r=er.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=xU(J9r,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=yT(e,u.onValueNodeChange);return eS(()=>{l(c)},[l,c]),(0,Mn.jsx)(Av.span,{...s,ref:d,style:{pointerEvents:"none"},children:h7r(u.value)?(0,Mn.jsx)(Mn.Fragment,{children:a}):i})});K9r.displayName=J9r;var qpi="SelectIcon",G9r=er.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,Mn.jsx)(Av.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});G9r.displayName=qpi;var Bpi="SelectPortal",X9r=t=>(0,Mn.jsx)(mT,{asChild:!0,...t});X9r.displayName=Bpi;var $3="SelectContent",Z9r=er.forwardRef((t,e)=>{let r=xU($3,t.__scopeSelect),[n,o]=er.useState();if(eS(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?Fbt.createPortal((0,Mn.jsx)(Y9r,{scope:t.__scopeSelect,children:(0,Mn.jsx)(DLe.Slot,{scope:t.__scopeSelect,children:(0,Mn.jsx)("div",{children:t.children})})}),i):null}return(0,Mn.jsx)(Q9r,{...t,ref:e})});Z9r.displayName=$3;var bT=10,[Y9r,TU]=eY($3),Upi="SelectContentImpl",zpi=RLe("SelectContent.RemoveScroll"),Q9r=er.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:y,...g}=t,b=xU($3,r),[_,w]=er.useState(null),[T,O]=er.useState(null),E=yT(e,N=>w(N)),[P,R]=er.useState(null),[I,A]=er.useState(null),B=jLe(r),[k,q]=er.useState(!1),Z=er.useRef(!1);er.useEffect(()=>{if(_)return fU(_)},[_]),aU();let V=er.useCallback(N=>{let[z,...H]=B().map(de=>de.ref.current),[oe]=H.slice(-1),Q=document.activeElement;for(let de of N)if(de===Q||(de?.scrollIntoView({block:"nearest"}),de===z&&T&&(T.scrollTop=0),de===oe&&T&&(T.scrollTop=T.scrollHeight),de?.focus(),document.activeElement!==Q))return},[B,T]),Y=er.useCallback(()=>V([P,_]),[V,P,_]);er.useEffect(()=>{k&&Y()},[k,Y]);let{onOpenChange:X,triggerPointerDownPosRef:W}=b;er.useEffect(()=>{if(_){let N={x:0,y:0},z=oe=>{N={x:Math.abs(Math.round(oe.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(oe.pageY)-(W.current?.y??0))}},H=oe=>{N.x<=10&&N.y<=10?oe.preventDefault():_.contains(oe.target)||X(!1),document.removeEventListener("pointermove",z),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",z),document.addEventListener("pointerup",H,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",z),document.removeEventListener("pointerup",H,{capture:!0})}}},[_,X,W]),er.useEffect(()=>{let N=()=>X(!1);return window.addEventListener("blur",N),window.addEventListener("resize",N),()=>{window.removeEventListener("blur",N),window.removeEventListener("resize",N)}},[X]);let[re,ue]=g7r(N=>{let z=B().filter(Q=>!Q.disabled),H=z.find(Q=>Q.ref.current===document.activeElement),oe=y7r(z,N,H);oe&&setTimeout(()=>oe.ref.current.focus())}),le=er.useCallback((N,z,H)=>{let oe=!Z.current&&!H;(b.value!==void 0&&b.value===z||oe)&&(R(N),oe&&(Z.current=!0))},[b.value]),L=er.useCallback(()=>_?.focus(),[_]),J=er.useCallback((N,z,H)=>{let oe=!Z.current&&!H;(b.value!==void 0&&b.value===z||oe)&&A(N)},[b.value]),ne=n==="popper"?Nbt:e7r,D=ne===Nbt?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:y}:{};return(0,Mn.jsx)(Y9r,{scope:r,content:_,viewport:T,onViewportChange:O,itemRefCallback:le,selectedItem:P,onItemLeave:L,itemTextRefCallback:J,focusSelectedItem:Y,selectedItemText:I,position:n,isPositioned:k,searchRef:re,children:(0,Mn.jsx)(V$,{as:zpi,allowPinchZoom:!0,children:(0,Mn.jsx)(F$,{asChild:!0,trapped:b.open,onMountAutoFocus:N=>{N.preventDefault()},onUnmountAutoFocus:ng(o,N=>{b.trigger?.focus({preventScroll:!0}),N.preventDefault()}),children:(0,Mn.jsx)(lT,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:N=>N.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:(0,Mn.jsx)(ne,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:N=>N.preventDefault(),...g,...D,onPlaced:()=>q(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:ng(g.onKeyDown,N=>{let z=N.ctrlKey||N.altKey||N.metaKey;if(N.key==="Tab"&&N.preventDefault(),!z&&N.key.length===1&&ue(N.key),["ArrowUp","ArrowDown","Home","End"].includes(N.key)){let oe=B().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);if(["ArrowUp","End"].includes(N.key)&&(oe=oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(N.key)){let Q=N.target,de=oe.indexOf(Q);oe=oe.slice(de+1)}setTimeout(()=>V(oe)),N.preventDefault()}})})})})})})});Q9r.displayName=Upi;var Vpi="SelectItemAlignedPosition",e7r=er.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=xU($3,r),a=TU($3,r),[s,u]=er.useState(null),[l,c]=er.useState(null),d=yT(e,E=>c(E)),f=jLe(r),p=er.useRef(!1),m=er.useRef(!0),{viewport:h,selectedItem:y,selectedItemText:g,focusSelectedItem:b}=a,_=er.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&h&&y&&g){let E=i.trigger.getBoundingClientRect(),P=l.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),I=g.getBoundingClientRect();if(i.dir!=="rtl"){let Q=I.left-P.left,de=R.left-Q,fe=E.left-de,De=E.width+fe,st=Math.max(De,P.width),Le=window.innerWidth-bT,Bt=wU(de,[bT,Math.max(bT,Le-st)]);s.style.minWidth=De+"px",s.style.left=Bt+"px"}else{let Q=P.right-I.right,de=window.innerWidth-R.right-Q,fe=window.innerWidth-E.right-de,De=E.width+fe,st=Math.max(De,P.width),Le=window.innerWidth-bT,Bt=wU(de,[bT,Math.max(bT,Le-st)]);s.style.minWidth=De+"px",s.style.right=Bt+"px"}let A=f(),B=window.innerHeight-bT*2,k=h.scrollHeight,q=window.getComputedStyle(l),Z=parseInt(q.borderTopWidth,10),V=parseInt(q.paddingTop,10),Y=parseInt(q.borderBottomWidth,10),X=parseInt(q.paddingBottom,10),W=Z+V+k+X+Y,re=Math.min(y.offsetHeight*5,W),ue=window.getComputedStyle(h),le=parseInt(ue.paddingTop,10),L=parseInt(ue.paddingBottom,10),J=E.top+E.height/2-bT,ne=B-J,D=y.offsetHeight/2,N=y.offsetTop+D,z=Z+V+N,H=W-z;if(z<=J){let Q=A.length>0&&y===A[A.length-1].ref.current;s.style.bottom="0px";let de=l.clientHeight-h.offsetTop-h.offsetHeight,fe=Math.max(ne,D+(Q?L:0)+de+Y),De=z+fe;s.style.height=De+"px"}else{let Q=A.length>0&&y===A[0].ref.current;s.style.top="0px";let fe=Math.max(J,Z+h.offsetTop+(Q?le:0)+D)+H;s.style.height=fe+"px",h.scrollTop=z-J+h.offsetTop}s.style.margin=`${bT}px 0`,s.style.minHeight=re+"px",s.style.maxHeight=B+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,h,y,g,i.dir,n]);eS(()=>_(),[_]);let[w,T]=er.useState();eS(()=>{l&&T(window.getComputedStyle(l).zIndex)},[l]);let O=er.useCallback(E=>{E&&m.current===!0&&(_(),b?.(),m.current=!1)},[_,b]);return(0,Mn.jsx)(Wpi,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:O,children:(0,Mn.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:(0,Mn.jsx)(Av.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});e7r.displayName=Vpi;var Hpi="SelectPopperPosition",Nbt=er.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=bT,...i}=t,a=$Le(r);return(0,Mn.jsx)(lU,{...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)"}})});Nbt.displayName=Hpi;var[Wpi,kbt]=eY($3,{}),Dbt="SelectViewport",t7r=er.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=TU(Dbt,r),a=kbt(Dbt,r),s=yT(e,i.onViewportChange),u=er.useRef(0);return(0,Mn.jsxs)(Mn.Fragment,{children:[(0,Mn.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,Mn.jsx)(DLe.Slot,{scope:r,children:(0,Mn.jsx)(Av.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ng(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-bT*2,h=parseFloat(d.style.minHeight),y=parseFloat(d.style.height),g=Math.max(h,y);if(g<m){let b=g+p,_=Math.min(m,b),w=b-_;d.style.height=_+"px",d.style.bottom==="0px"&&(c.scrollTop=w>0?w:0,d.style.justifyContent="flex-end")}}}u.current=c.scrollTop})})})]})});t7r.displayName=Dbt;var r7r="SelectGroup",[Jpi,Kpi]=eY(r7r),Gpi=er.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=PLe();return(0,Mn.jsx)(Jpi,{scope:r,id:o,children:(0,Mn.jsx)(Av.div,{role:"group","aria-labelledby":o,...n,ref:e})})});Gpi.displayName=r7r;var n7r="SelectLabel",o7r=er.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=Kpi(n7r,r);return(0,Mn.jsx)(Av.div,{id:o.id,...n,ref:e})});o7r.displayName=n7r;var NLe="SelectItem",[Xpi,i7r]=eY(NLe),a7r=er.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=xU(NLe,r),u=TU(NLe,r),l=s.value===n,[c,d]=er.useState(i??""),[f,p]=er.useState(!1),m=yT(e,b=>u.itemRefCallback?.(b,n,o)),h=PLe(),y=er.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,Mn.jsx)(Xpi,{scope:r,value:n,disabled:o,textId:h,isSelected:l,onItemTextChange:er.useCallback(b=>{d(_=>_||(b?.textContent??"").trim())},[]),children:(0,Mn.jsx)(DLe.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,Mn.jsx)(Av.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:ng(a.onFocus,()=>p(!0)),onBlur:ng(a.onBlur,()=>p(!1)),onClick:ng(a.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:ng(a.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:ng(a.onPointerDown,b=>{y.current=b.pointerType}),onPointerMove:ng(a.onPointerMove,b=>{y.current=b.pointerType,o?u.onItemLeave?.():y.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ng(a.onPointerLeave,b=>{b.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:ng(a.onKeyDown,b=>{u.searchRef?.current!==""&&b.key===" "||(jpi.includes(b.key)&&g(),b.key===" "&&b.preventDefault())})})})})});a7r.displayName=NLe;var Tde="SelectItemText",s7r=er.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=xU(Tde,r),s=TU(Tde,r),u=i7r(Tde,r),l=kpi(Tde,r),[c,d]=er.useState(null),f=yT(e,g=>d(g),u.onItemTextChange,g=>s.itemTextRefCallback?.(g,u.value,u.disabled)),p=c?.textContent,m=er.useMemo(()=>(0,Mn.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:y}=l;return eS(()=>(h(m),()=>y(m)),[h,y,m]),(0,Mn.jsxs)(Mn.Fragment,{children:[(0,Mn.jsx)(Av.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Fbt.createPortal(i.children,a.valueNode):null]})});s7r.displayName=Tde;var u7r="SelectItemIndicator",l7r=er.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return i7r(u7r,r).isSelected?(0,Mn.jsx)(Av.span,{"aria-hidden":!0,...n,ref:e}):null});l7r.displayName=u7r;var jbt="SelectScrollUpButton",c7r=er.forwardRef((t,e)=>{let r=TU(jbt,t.__scopeSelect),n=kbt(jbt,t.__scopeSelect),[o,i]=er.useState(!1),a=yT(e,n.onScrollButtonChange);return eS(()=>{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,Mn.jsx)(f7r,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});c7r.displayName=jbt;var $bt="SelectScrollDownButton",d7r=er.forwardRef((t,e)=>{let r=TU($bt,t.__scopeSelect),n=kbt($bt,t.__scopeSelect),[o,i]=er.useState(!1),a=yT(e,n.onScrollButtonChange);return eS(()=>{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,Mn.jsx)(f7r,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});d7r.displayName=$bt;var f7r=er.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=TU("SelectScrollButton",r),a=er.useRef(null),s=jLe(r),u=er.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return er.useEffect(()=>()=>u(),[u]),eS(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,Mn.jsx)(Av.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:ng(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:ng(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:ng(o.onPointerLeave,()=>{u()})})}),Zpi="SelectSeparator",p7r=er.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,Mn.jsx)(Av.div,{"aria-hidden":!0,...n,ref:e})});p7r.displayName=Zpi;var Lbt="SelectArrow",Ypi=er.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=$Le(r),i=xU(Lbt,r),a=TU(Lbt,r);return i.open&&a.position==="popper"?(0,Mn.jsx)(cU,{...o,...n,ref:e}):null});Ypi.displayName=Lbt;var Qpi="SelectBubbleInput",m7r=er.forwardRef(({__scopeSelect:t,value:e,...r},n)=>{let o=er.useRef(null),i=yT(n,o),a=z9r(e);return er.useEffect(()=>{let s=o.current;if(!s)return;let u=window.HTMLSelectElement.prototype,c=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==e&&c){let d=new Event("change",{bubbles:!0});c.call(s,e),s.dispatchEvent(d)}},[a,e]),(0,Mn.jsx)(Av.select,{...r,style:{...Dyt,...r.style},ref:i,defaultValue:e})});m7r.displayName=Qpi;function h7r(t){return t===""||t===void 0}function g7r(t){let e=U9r(t),r=er.useRef(""),n=er.useRef(0),o=er.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=er.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return er.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function y7r(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=emi(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 emi(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var b7r=V9r,qbt=W9r,_7r=K9r,v7r=G9r,w7r=X9r,Bbt=Z9r,S7r=t7r;var Ubt=o7r,zbt=a7r,C7r=s7r,x7r=l7r,Vbt=c7r,Hbt=d7r,Wbt=p7r;Mr();zr();var L3=b7r;var F3=_7r,OU=Pu.forwardRef(({className:t,children:e,...r},n)=>Pu.createElement(qbt,{ref:n,className:Se("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,Pu.createElement(v7r,{asChild:!0},Pu.createElement(Ji,{className:"tw-size-4"}))));OU.displayName=qbt.displayName;var T7r=Pu.forwardRef(({className:t,...e},r)=>Pu.createElement(Vbt,{ref:r,className:Se("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},Pu.createElement(Og,{className:"tw-size-4"})));T7r.displayName=Vbt.displayName;var O7r=Pu.forwardRef(({className:t,...e},r)=>Pu.createElement(Hbt,{ref:r,className:Se("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},Pu.createElement(Ji,{className:"tw-size-4"})));O7r.displayName=Hbt.displayName;var EU=Pu.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>Pu.createElement(w7r,{container:n},Pu.createElement(Bbt,{ref:i,className:Se("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},Pu.createElement(T7r,null),Pu.createElement(S7r,{className:Se("tw-p-1",r==="popper"&&"tw-h-[var(--radix-select-trigger-height)] tw-w-full tw-min-w-[var(--radix-select-trigger-width)]")},e),Pu.createElement(O7r,null))));EU.displayName=Bbt.displayName;var rmi=Pu.forwardRef(({className:t,...e},r)=>Pu.createElement(Ubt,{ref:r,className:Se("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",t),...e}));rmi.displayName=Ubt.displayName;var PU=Pu.forwardRef(({className:t,children:e,...r},n)=>Pu.createElement(zbt,{ref:n,className:Se("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},Pu.createElement("span",{className:"tw-absolute tw-right-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},Pu.createElement(x7r,null,Pu.createElement(Yu,{className:"tw-size-4"}))),Pu.createElement(C7r,null,e)));PU.displayName=zbt.displayName;var nmi=Pu.forwardRef(({className:t,...e},r)=>Pu.createElement(Wbt,{ref:r,className:Se("-tw-mx-1 tw-my-1 tw-h-px tw-bg-primary-alt",t),...e}));nmi.displayName=Wbt.displayName;Mr();function MU(t){let{label:e,helpText:r,disableFn:n,optional:o=!0}=t,i=t.type,a=o?t.value!==void 0:!0,[s,u]=(0,mu.useState)(a),l=()=>{o&&(u(!s),s?n?.():i==="slider"?t.onChange(t.value??t.defaultValue??0):t.onChange(t.value??t.defaultValue??t.options[0]?.value??""))},c=f=>{s&&i==="slider"&&t.onChange(f[0])},d=f=>{s&&i==="select"&&t.onChange(f)};return mu.default.createElement("div",{className:"tw-space-y-3"},mu.default.createElement(s_,{delayDuration:0},mu.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},mu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},mu.default.createElement("span",{className:`tw-font-medium ${s?"tw-text-normal":"tw-text-muted"}`},e),r&&mu.default.createElement(to,{buttonClassName:"tw-size-4 tw-text-muted",content:mu.default.createElement("div",{className:"tw-max-w-[300px]"},r)})),mu.default.createElement("div",{className:`tw-flex tw-items-center ${o?"tw-gap-3":"tw-gap-0"}`},mu.default.createElement("span",{className:`tw-min-w-8 tw-text-right tw-font-mono tw-text-sm ${s?"tw-text-normal":"tw-text-muted"}`},s?t.value??t.defaultValue:"\u2014"),o&&mu.default.createElement(vn,null,mu.default.createElement(wn,{asChild:!0},mu.default.createElement(me,{variant:"ghost2",size:"sm",onClick:l,className:`tw-size-8 tw-p-0 ${s?"tw-text-accent/80 hover:tw-text-accent":"tw-text-muted hover:tw-text-normal"}`},s?mu.default.createElement(Wre,{className:"tw-size-4"}):mu.default.createElement(Hre,{className:"tw-size-4"}))),mu.default.createElement(pn,{side:"bottom"},mu.default.createElement("span",null,s?"Disable parameters":"Enable parameters")))))),mu.default.createElement("div",{className:"tw-relative"},i==="slider"?mu.default.createElement(mu.default.Fragment,null,mu.default.createElement(xde,{value:[s?t.value??t.defaultValue??0:t.min??0],onValueChange:c,min:t.min??0,max:t.max??1,step:t.step,disabled:!s,className:`tw-w-full ${s?"":"tw-opacity-40"}`}),!s&&o&&mu.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-cursor-not-allowed tw-rounded"})):mu.default.createElement(L3,{value:s?t.value??t.defaultValue??t.options[0]?.value:void 0,onValueChange:d,disabled:!s},mu.default.createElement(OU,{className:`tw-w-full ${s?"":"tw-opacity-40"}`},mu.default.createElement(F3,{placeholder:"Select an option"})),mu.default.createElement(EU,null,t.options.map(f=>mu.default.createElement(PU,{key:f.value,value:f.value},f.label))))))}gr();gr();var E7r=[{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra High"}],P7r=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function M7r(){return Ab.REASONING_EFFORT}function R7r(){return Ab.VERBOSITY}var cc={temperature:{min:0,max:2,step:.01,default:Ab.TEMPERATURE},topP:{min:0,max:1,step:.05,default:.9},frequencyPenalty:{min:0,max:2,step:.05,default:0},maxTokens:{min:100,max:128e3,step:100,default:Ab.MAX_TOKENS},numCtx:{min:0,max:UJ,step:1024,default:UJ}};function LLe({model:t,settings:e,onChange:r,onReset:n,showTokenLimit:o=!0}){let i=t.provider==="ollama",a=t.temperature??e.temperature,s=t.maxTokens??e.maxTokens,u=t.topP,l=t.frequencyPenalty,c=i?t.numCtx??cc.numCtx.default:t.numCtx,d=t.reasoningEffort,f=t.verbosity,p=(t.name.startsWith("o1")||t.name.startsWith("o3")||t.name.startsWith("o4")||t.name.startsWith("gpt-5"))&&t.provider==="openai",m=t.capabilities?.includes("reasoning")??!1,h=p||t.provider==="openrouterai"||t.provider==="lm_studio"||t.provider==="lm-studio"||m,y=t.name.startsWith("gpt-5")&&t.provider==="openai";return io.default.createElement("div",{className:"tw-space-y-4"},o&&io.default.createElement(ko,null,io.default.createElement(MU,{type:"slider",optional:!1,label:"Token limit",value:s,onChange:g=>r("maxTokens",g),max:cc.maxTokens.max,min:cc.maxTokens.min,step:cc.maxTokens.step,defaultValue:cc.maxTokens.default,helpText:io.default.createElement(io.default.Fragment,null,io.default.createElement("p",null,"The maximum number of ",io.default.createElement("em",null,"output tokens")," to generate. Default is"," ",cc.maxTokens.default,"."),io.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model."))})),i&&io.default.createElement(ko,null,io.default.createElement(MU,{type:"slider",optional:!1,label:"num_ctx",value:c,onChange:g=>r("numCtx",g),min:cc.numCtx.min,max:cc.numCtx.max,step:cc.numCtx.step,defaultValue:cc.numCtx.default,helpText:io.default.createElement(io.default.Fragment,null,io.default.createElement("p",null,"The ",io.default.createElement("code",null,"num_ctx")," parameter sent to Ollama. Controls how many tokens the model can use as context. Default is ",UJ,"."),io.default.createElement("em",null,"Lower this value to reduce VRAM usage on GPUs with limited memory. Ollama will cap this at the model's actual maximum."))})),io.default.createElement(ko,null,io.default.createElement(MU,{type:"slider",optional:!1,label:"Temperature",value:a,onChange:g=>r("temperature",g),min:cc.temperature.min,max:cc.temperature.max,step:cc.temperature.step,defaultValue:cc.temperature.default,helpText:`Default is ${cc.temperature.default}. Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.`})),io.default.createElement(ko,null,io.default.createElement(MU,{type:"slider",optional:!0,label:"Top-P",value:u,onChange:g=>r("topP",g),disableFn:n?()=>n("topP"):void 0,min:cc.topP.min,max:cc.topP.max,step:cc.topP.step,defaultValue:cc.topP.default,helpText:`Default value is ${cc.topP.default}, the smaller the value, the less variety in the answers, the easier to understand, the larger the value, the larger the range of the AI's vocabulary, the more diverse`})),io.default.createElement(ko,null,io.default.createElement(MU,{type:"slider",optional:!0,label:"Frequency Penalty",value:l,onChange:g=>r("frequencyPenalty",g),disableFn:n?()=>n("frequencyPenalty"):void 0,min:cc.frequencyPenalty.min,max:cc.frequencyPenalty.max,step:cc.frequencyPenalty.step,defaultValue:cc.frequencyPenalty.default,helpText:io.default.createElement(io.default.Fragment,null,io.default.createElement("p",null,"The frequency penalty parameter tells the model not to repeat a word that has already been used multiple times in the conversation."),io.default.createElement("em",null,"The higher the value, the more the model is penalized for repeating words."))})),h&&io.default.createElement(ko,null,io.default.createElement(MU,{type:"select",optional:!0,label:"Reasoning Effort",value:d,onChange:g=>r("reasoningEffort",g),disableFn:n?()=>n("reasoningEffort"):void 0,defaultValue:e.reasoningEffort??M7r(),options:[...t.name.startsWith("gpt-5")&&t.provider==="openai"?[{value:"minimal",label:"Minimal"}]:[],...E7r.filter(g=>g.value!=="minimal"&&g.value!=="xhigh"),...t.name.startsWith("gpt-5.4")&&t.provider==="openai"?[{value:"xhigh",label:"Extra High"}]:[]],helpText:io.default.createElement(io.default.Fragment,null,io.default.createElement("p",null,"Controls the amount of reasoning effort the model uses. Higher effort provides more thorough reasoning but takes longer."),io.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},t.name.startsWith("gpt-5")&&t.provider==="openai"&&io.default.createElement("li",null,"Minimal: Fastest responses, minimal reasoning (GPT-5 only)"),io.default.createElement("li",null,"Low: Faster responses, basic reasoning (default)"),io.default.createElement("li",null,"Medium: Balanced performance"),io.default.createElement("li",null,"High: Thorough reasoning, slower responses"),t.name.startsWith("gpt-5.4")&&t.provider==="openai"&&io.default.createElement("li",null,"Extra High: Maximum reasoning depth (GPT-5.4 only)")),!m&&!p&&io.default.createElement("p",{className:"tw-mt-2 tw-text-warning"},'Enable the "Reasoning" capability above to use this feature.'))})),y&&io.default.createElement(ko,null,io.default.createElement(MU,{type:"select",optional:!0,label:"Verbosity",value:f,onChange:g=>r("verbosity",g),disableFn:n?()=>n("verbosity"):void 0,defaultValue:e.verbosity??R7r(),options:P7r,helpText:io.default.createElement(io.default.Fragment,null,io.default.createElement("p",null,"Controls the length and detail of the model responses."),io.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},io.default.createElement("li",null,"Low: Concise, brief responses"),io.default.createElement("li",null,"Medium: Balanced detail"),io.default.createElement("li",null,"High: Detailed, comprehensive responses")))})))}na();Qe();var I7r=$(YG());var imi=["topP","frequencyPenalty","reasoningEffort","verbosity"];function A7r(){let t=ee(),e=j_(),r=t.activeModels.find(R=>`${R.name}|${R.provider}`===e),[n,o]=(0,fr.useState)(r),i=cDe(),[a,s]=Bzr(),u=fDe(),l=R=>R?i.some(I=>I.title===R):!1,c=l(a)?a:l(u)?u:"",[d,f]=(0,fr.useState)(ile()),[p,m]=(0,fr.useState)(!1),h=(0,fr.useRef)(null);(0,fr.useEffect)(()=>{o(r)},[r]),(0,fr.useEffect)(()=>{p&&h.current&&h.current.scrollIntoView({behavior:"smooth",block:"end"})},[p]);let y=(0,fr.useMemo)(()=>(0,I7r.default)(R=>{let I=t.activeModels.map(A=>`${A.name}|${A.provider}`===e?R:A);Re("activeModels",I)},500),[t.activeModels,e]);(0,fr.useEffect)(()=>()=>{y.flush(),y.cancel()},[y]);let g=(0,fr.useCallback)(R=>{if(R||y.flush(),R){let I=ile();f(I),I||m(!1)}},[y]),b=(0,fr.useCallback)((R,I)=>{if(!n)return;let A={...n,[R]:I};o(A),y(A)},[n,y]),_=(0,fr.useCallback)(R=>{if(!n)return;let I={...n};delete I[R],o(I),y(I)},[n,y]),w=(0,fr.useCallback)(()=>{if(n){let R={...n};imi.forEach(I=>delete R[I]),o(R),y(R)}s(""),f(!1),m(!1),ole(!1)},[n,y,s]),T=R=>{R?m(!0):(f(!1),m(!1),ole(!1))},O=()=>{f(!0),m(!1),ole(!0)},E=()=>{m(!1)},P=()=>{if(!c)return;let R=aC(c);app.workspace.openLinkText(R,"",!0)};return n?fr.default.createElement(bU,{onOpenChange:g},fr.default.createElement(vn,null,fr.default.createElement(wn,{asChild:!0},fr.default.createElement(_U,{asChild:!0},fr.default.createElement(me,{variant:"ghost2",size:"icon"},fr.default.createElement(zre,{className:"tw-size-4"})))),fr.default.createElement(pn,null,"Chat Settings")),fr.default.createElement(K$,{className:"tw-w-80 tw-rounded-md tw-p-0",align:"end"},fr.default.createElement("div",{className:"tw-flex tw-max-h-[500px] tw-flex-col"},fr.default.createElement("div",{className:"tw-shrink-0 tw-border-b tw-px-4"},fr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},fr.default.createElement("h3",{className:"tw-font-semibold"},"Chat Settings"),fr.default.createElement(me,{variant:"ghost",size:"sm",onClick:w,className:"tw-h-8 tw-text-xs"},fr.default.createElement(q4,{className:"tw-mr-1 tw-size-3"}),"Reset"))),fr.default.createElement(lC,null),fr.default.createElement(CU,{className:"tw-flex-1 tw-overflow-y-auto"},fr.default.createElement("div",{className:"tw-space-y-4 tw-p-4"},fr.default.createElement("div",{className:"tw-space-y-2"},fr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},fr.default.createElement(uc,{htmlFor:"system-prompt",className:"tw-text-sm sm:tw-min-w-fit"},"System Prompt"),fr.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2 sm:tw-flex-1"},fr.default.createElement(dN,{value:c,onChange:R=>{let I=R.target.value;I===""?s(""):l(I)&&s(I)},options:[{label:"None (use built-in prompt)",value:""},...i.map(R=>({label:R.title===u?`${R.title} (Default)`:R.title,value:R.title}))],placeholder:"Select system prompt",containerClassName:"tw-flex-1"}),fr.default.createElement(me,{variant:"ghost",size:"icon",onClick:P,className:"tw-size-5 tw-shrink-0 tw-p-0",title:"Open the source file",disabled:!c},fr.default.createElement(_1,{className:"tw-size-5"}))))),fr.default.createElement(LLe,{model:n,settings:t,onChange:b,onReset:_,showTokenLimit:!0}),fr.default.createElement(lC,null),fr.default.createElement("div",{className:"tw-space-y-3"},fr.default.createElement("div",{className:"tw-space-y-1.5"},fr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},fr.default.createElement(uc,{htmlFor:"disable-builtin",className:"tw-text-sm tw-font-medium"},"Disable Builtin System Prompt"),fr.default.createElement(tT,{checked:d,onCheckedChange:T,disabled:p})),fr.default.createElement("div",{className:"tw-pr-12 tw-text-xs tw-leading-relaxed tw-text-muted"},"Disables the builtin system prompt and only uses your custom system prompt."," ",fr.default.createElement("span",{className:"tw-text-xs tw-text-error"},"WARNING: This may break expected functionality."))),(d||p)&&fr.default.createElement("div",{ref:h,className:"tw-rounded-md tw-border tw-bg-error/10 tw-p-3 tw-border-error/50"},fr.default.createElement("div",{className:"tw-flex tw-gap-2"},fr.default.createElement(Eg,{className:"tw-mt-0.5 tw-size-4 tw-shrink-0 tw-text-error"}),fr.default.createElement("div",{className:"tw-flex-1 tw-space-y-2"},fr.default.createElement("div",{className:"tw-space-y-1"},fr.default.createElement("div",{className:"tw-text-xs tw-font-semibold tw-text-error"},"Copilot Plus Features Will Become Unavailable"),fr.default.createElement("div",{className:"tw-flex tw-flex-col  tw-items-center tw-gap-2 tw-text-xs tw-leading-relaxed tw-text-muted"},fr.default.createElement("div",null,"When enabled, advanced features such as vault search, web search, and agent mode will become unavailable."," "),fr.default.createElement("div",{className:"tw-italic"},"Only your custom system prompt (configured in Settings) will be used."))),p&&fr.default.createElement("div",{className:"tw-flex tw-gap-2 tw-pt-1"},fr.default.createElement(me,{size:"sm",variant:"destructive",onClick:O,className:"tw-h-7 tw-text-xs"},"Disable Builtin"),fr.default.createElement(me,{size:"sm",variant:"ghost",onClick:E,className:"tw-h-7 tw-bg-transparent tw-text-xs"},"Cancel")))))))),fr.default.createElement(lC,null),fr.default.createElement("div",{className:"tw-shrink-0 tw-rounded-md tw-bg-primary tw-px-4 tw-py-1"},fr.default.createElement("div",{className:"tw-flex tw-flex-row tw-flex-wrap"},fr.default.createElement("span",{className:"tw-text-xs tw-text-normal"},fr.default.createElement("span",{className:" tw-italic"},"System Prompt and Disable Builtin System Prompt")," ",fr.default.createElement("strong",null,"apply to this chat session only"),";",fr.default.createElement("br",null),"other settings are ",fr.default.createElement("strong",null,"bound to the current model"),".")))))):null}async function ami(){try{let{getSettings:t}=await Promise.resolve().then(()=>(Qe(),r1)),e=t();if(e.enableSemanticSearchV3){let n=await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0});kh(e)?new ny.Notice("Miyo folder index refresh started. Open the Miyo app to check details."):new ny.Notice(`Semantic search index refreshed with ${n} documents.`)}else new ny.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error refreshing vault index:",t),new ny.Notice("Failed to refresh vault index. Check console for details.")}}async function smi(){try{let{getSettings:t}=await Promise.resolve().then(()=>(Qe(),r1)),e=t();if(e.enableSemanticSearchV3){let n=await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().indexVaultToVectorStore(!0,{userInitiated:!0});kh(e)?new ny.Notice("Miyo folder index refresh started. Open the Miyo app to check details."):new ny.Notice(`Semantic search index rebuilt with ${n} documents.`)}else new ny.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error force reindexing vault:",t),new ny.Notice("Failed to force reindex vault. Check console for details.")}}async function FLe(){let t=Gu();if(!t){new ny.Notice("No project is currently selected to reload.");return}try{fO(!0),await Iw.getInstance().invalidateMarkdownContext(t,!0);let e=app.plugins.getPlugin("copilot");if(e&&e.projectManager)await e.projectManager.getProjectContext(t.id),new ny.Notice(`Project context for "${t.name}" reloaded successfully.`);else throw new Error("Copilot plugin or ProjectManager not available.")}catch(e){ie("Error reloading project context:",e),ED(e)||new ny.Notice("Failed to reload project context. Check console for details.")}finally{fO(!1)}}async function umi(){let t=Gu();if(!t){new ny.Notice("No project is currently selected to rebuild.");return}new nu(app,async()=>{try{fO(!0),new ny.Notice(`Force rebuilding context for project: ${t.name}... This will take some time and re-fetch all data.`,1e4),lae.resetRateLimitNoticeTimer(),await Iw.getInstance().clearForProject(t),new ny.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 ny.Notice(`Project context for "${t.name}" rebuilt successfully from scratch.`);else throw new Error("Copilot plugin or ProjectManager not available for rebuild.")}catch(r){ie("Error force rebuilding project context:",r),ED(r)||new ny.Notice("Failed to force rebuild project context. Check console for details.")}finally{fO(!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 N7r({onNewChat:t,onSaveAsNote:e,onLoadHistory:r,onModeChange:n,onCloseProject:o,chatHistory:i,onUpdateChatTitle:a,onDeleteChat:s,onLoadChat:u,onOpenSourceFile:l,latestTokenCount:c}){let d=kr(),[f,p]=aw(),m=XG(),h=async y=>{f==="project"&&y!=="project"&&d.autosaveChat&&await e(),p(y),n(y),y!=="project"&&(C4(null),o?.())};return hr.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-p-1"},hr.default.createElement("div",{className:"tw-flex-1"},hr.default.createElement(ade,null,hr.default.createElement(sde,{asChild:!0},hr.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-ml-1 tw-text-sm tw-text-muted"},f==="llm_chain"&&"chat (free)",f==="vault_qa"&&"vault QA (free)",f==="copilot_plus"&&hr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},hr.default.createElement(Ry,{className:"tw-size-4"}),"copilot plus"),f==="project"&&"projects (alpha)",hr.default.createElement(Ji,{className:"tw-mt-0.5 tw-size-5"}))),hr.default.createElement(Ev,{align:"start"},hr.default.createElement(Ai,{onSelect:()=>{h("llm_chain")}},"chat (free)"),hr.default.createElement(Ai,{onSelect:()=>{h("vault_qa")}},"vault QA (free)"),m?hr.default.createElement(Ai,{onSelect:()=>{h("copilot_plus")}},hr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},hr.default.createElement(Ry,{className:"tw-size-4"}),"copilot plus")):hr.default.createElement(Ai,{onSelect:()=>{V4(a1.CHAT_MODE_SELECT),o?.()}},"copilot plus",hr.default.createElement(x1,{className:"tw-size-3"})),m?hr.default.createElement(Ai,{className:"tw-flex tw-items-center tw-gap-1",onSelect:()=>{h("project")}},hr.default.createElement(k4,{className:"tw-size-4"}),"projects (alpha)"):hr.default.createElement(Ai,{onSelect:()=>{V4(a1.CHAT_MODE_SELECT),o?.()}},"copilot plus",hr.default.createElement(x1,{className:"tw-size-3"}))))),hr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},hr.default.createElement("div",{className:"tw-mr-2"},hr.default.createElement(JGr,{tokenCount:c??null})),hr.default.createElement(vn,null,hr.default.createElement(wn,{asChild:!0},hr.default.createElement(me,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},hr.default.createElement(Lre,{className:"tw-size-4"}))),hr.default.createElement(pn,null,"New Chat")),f!=="project"&&hr.default.createElement(A7r,null),!d.autosaveChat&&hr.default.createElement(vn,null,hr.default.createElement(wn,{asChild:!0},hr.default.createElement(me,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},hr.default.createElement(Ore,{className:"tw-size-4"}))),hr.default.createElement(pn,null,"Save Chat as Note")),hr.default.createElement(vn,null,hr.default.createElement(WGr,{chatHistory:i,onUpdateTitle:a,onDeleteChat:s,onLoadChat:u,onOpenSourceFile:l},hr.default.createElement(wn,{asChild:!0},hr.default.createElement(me,{variant:"ghost2",size:"icon",title:"Chat History",onClick:r},hr.default.createElement(Nre,{className:"tw-size-4"})))),hr.default.createElement(pn,null,"Chat History")),hr.default.createElement(ade,null,hr.default.createElement(sde,{asChild:!0},hr.default.createElement(me,{variant:"ghost2",size:"icon",title:"Advanced Settings"},hr.default.createElement(IF,{className:"tw-size-4"}))),hr.default.createElement(Ev,{align:"end",className:"tw-w-64"},hr.default.createElement(Ai,{className:"tw-flex tw-justify-between",onSelect:y=>{y.preventDefault(),Re("showSuggestedPrompts",!d.showSuggestedPrompts)}},hr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},hr.default.createElement(Ry,{className:"tw-size-4"}),"Suggested Prompt"),hr.default.createElement(tT,{checked:d.showSuggestedPrompts})),hr.default.createElement(Ai,{className:"tw-flex tw-justify-between",onSelect:y=>{y.preventDefault(),Re("showRelevantNotes",!d.showRelevantNotes)}},hr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},hr.default.createElement(ju,{className:"tw-size-4"}),"Relevant Note"),hr.default.createElement(tT,{checked:d.showRelevantNotes})),hr.default.createElement(Ai,{className:"tw-flex tw-justify-between",onSelect:y=>{y.preventDefault(),Re("autoAcceptEdits",!d.autoAcceptEdits)}},hr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},hr.default.createElement(B_,{className:"tw-size-4"}),"Auto-accept Edits"),hr.default.createElement(tT,{checked:d.autoAcceptEdits})),f==="project"?hr.default.createElement(hr.default.Fragment,null,hr.default.createElement(Ai,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>FLe()},hr.default.createElement(jF,{className:"tw-size-4"}),"Reload Current Project"),hr.default.createElement(Ai,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>umi()},hr.default.createElement(Eg,{className:"tw-size-4"}),"Force Rebuild Context")):hr.default.createElement(hr.default.Fragment,null,hr.default.createElement(Ai,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>ami()},hr.default.createElement(jF,{className:"tw-size-4"}),"Refresh Vault Index"),hr.default.createElement(Ai,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>{new nu(app,()=>smi(),"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()}},hr.default.createElement(Eg,{className:"tw-size-4"}),"Force Reindex Vault"))))))}na();rd();var kLe=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()}};xn();var ar=$(K());Mr();xn();rd();zr();Qe();Dt();var D7r=({vaultToggle:t,setVaultToggle:e,webToggle:r,setWebToggle:n,composerToggle:o,setComposerToggle:i,autonomousAgentToggle:a,setAutonomousAgentToggle:s,onVaultToggleOff:u,onWebToggleOff:l,onComposerToggleOff:c,currentChain:d})=>{let f=Rb(d),p=f&&d!=="project",m=()=>{let b=!a;s(b),Re("enableAutonomousAgent",b)},h=()=>{let b=!t;e(b),!b&&u&&u()},y=()=>{let b=!r;n(b),!b&&l&&l()},g=()=>{let b=!o;i(b),!b&&c&&c()};return f?ar.default.createElement(s_,{delayDuration:0},ar.default.createElement("div",{className:"tw-hidden tw-items-center tw-gap-1.5 @[420px]/chat-input:tw-flex"},p&&ar.default.createElement(vn,null,ar.default.createElement(wn,{asChild:!0},ar.default.createElement(me,{variant:"ghost2",size:"fit",onClick:m,className:Se("tw-text-muted hover:tw-text-accent",a&&"tw-text-accent tw-bg-accent/10")},ar.default.createElement(N5,{className:"tw-size-4"}))),ar.default.createElement(pn,{className:"tw-px-1 tw-py-0.5"},"Toggle autonomous agent mode")),!a&&ar.default.createElement(ar.default.Fragment,null,ar.default.createElement(vn,null,ar.default.createElement(wn,{asChild:!0},ar.default.createElement(me,{variant:"ghost2",size:"fit",onClick:h,className:Se("tw-text-muted hover:tw-text-accent",t&&"tw-text-accent tw-bg-accent/10")},ar.default.createElement(YC,{className:"tw-size-4"}))),ar.default.createElement(pn,{className:"tw-px-1 tw-py-0.5"},"Toggle vault search")),ar.default.createElement(vn,null,ar.default.createElement(wn,{asChild:!0},ar.default.createElement(me,{variant:"ghost2",size:"fit",onClick:y,className:Se("tw-text-muted hover:tw-text-accent",r&&"tw-text-accent tw-bg-accent/10")},ar.default.createElement(_l,{className:"tw-size-4"}))),ar.default.createElement(pn,{className:"tw-px-1 tw-py-0.5"},"Toggle web search")),ar.default.createElement(vn,null,ar.default.createElement(wn,{asChild:!0},ar.default.createElement(me,{variant:"ghost2",size:"fit",onClick:g,className:Se("tw-text-muted hover:tw-text-accent",o&&"tw-text-accent tw-bg-accent/10")},ar.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},ar.default.createElement(Ry,{className:"tw-size-2"}),ar.default.createElement(Lb,{className:"tw-size-3"})))),ar.default.createElement(pn,{className:"tw-px-1 tw-py-0.5"},"Toggle composer (note editing)")))),ar.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-0.5 @[420px]/chat-input:tw-hidden"},ar.default.createElement(sN,null,ar.default.createElement(uN,{asChild:!0},ar.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted hover:tw-text-accent"},ar.default.createElement(mw,{className:"tw-size-4"}))),ar.default.createElement(Ev,{align:"end",className:"tw-w-56"},p&&ar.default.createElement(Ai,{onClick:m,className:"tw-flex tw-items-center tw-justify-between"},ar.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ar.default.createElement(N5,{className:"tw-size-4"}),ar.default.createElement("span",null,"Autonomous Agent")),a&&ar.default.createElement(Yu,{className:"tw-size-4"})),!a&&ar.default.createElement(ar.default.Fragment,null,ar.default.createElement(Ai,{onClick:h,className:"tw-flex tw-items-center tw-justify-between"},ar.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ar.default.createElement(YC,{className:"tw-size-4"}),ar.default.createElement("span",null,"Vault Search")),t&&ar.default.createElement(Yu,{className:"tw-size-4"})),ar.default.createElement(Ai,{onClick:y,className:"tw-flex tw-items-center tw-justify-between"},ar.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ar.default.createElement(_l,{className:"tw-size-4"}),ar.default.createElement("span",null,"Web Search")),r&&ar.default.createElement(Yu,{className:"tw-size-4"})),ar.default.createElement(Ai,{onClick:g,className:"tw-flex tw-items-center tw-justify-between"},ar.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ar.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},ar.default.createElement(Ry,{className:"tw-size-2"}),ar.default.createElement(Lb,{className:"tw-size-3"})),ar.default.createElement("span",null,"Composer")),o&&ar.default.createElement(Yu,{className:"tw-size-4"}))),a&&ar.default.createElement(ar.default.Fragment,null,ar.default.createElement(Ai,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},ar.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ar.default.createElement(YC,{className:"tw-size-4"}),ar.default.createElement("span",null,"Vault Search"))),ar.default.createElement(Ai,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},ar.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ar.default.createElement(_l,{className:"tw-size-4"}),ar.default.createElement("span",null,"Web Search"))),ar.default.createElement(Ai,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},ar.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ar.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},ar.default.createElement(Ry,{className:"tw-size-2"}),ar.default.createElement(Lb,{className:"tw-size-3"})),ar.default.createElement("span",null,"Composer")))))))):null};Dt();AZ();Qe();Dt();Mr();var gfe=require("obsidian"),Wt=$(K());var bvt={};En(bvt,{$addUpdateTag:()=>HZr,$applyNodeReplacement:()=>Gde,$caretFromPoint:()=>kU,$caretRangeFromSelection:()=>A_t,$cloneWithProperties:()=>YZr,$comparePointCaretNext:()=>hvt,$copyNode:()=>lvt,$create:()=>khi,$createLineBreakNode:()=>lY,$createNodeSelection:()=>G_t,$createParagraphNode:()=>aL,$createPoint:()=>CT,$createRangeSelection:()=>SZr,$createRangeSelectionFromDom:()=>lhi,$createTabNode:()=>yFe,$createTextNode:()=>og,$extendCaretToRange:()=>pvt,$getAdjacentChildCaret:()=>bY,$getAdjacentNode:()=>zZr,$getAdjacentSiblingOrParentSiblingCaret:()=>Jhi,$getCaretInDirection:()=>qU,$getCaretRange:()=>FU,$getCaretRangeInDirection:()=>yvt,$getCharacterOffsets:()=>x_t,$getChildCaret:()=>lL,$getChildCaretAtIndex:()=>aYr,$getChildCaretOrSelf:()=>tYr,$getCollapsedCaretRange:()=>rYr,$getCommonAncestor:()=>Nde,$getCommonAncestorResultBranchOrder:()=>gvt,$getEditor:()=>cvt,$getNearestNodeFromDOMNode:()=>CFe,$getNearestRootOrShadowRoot:()=>JZr,$getNodeByKey:()=>yh,$getNodeByKeyOrThrow:()=>KZr,$getPreviousSelection:()=>G3,$getRoot:()=>jv,$getSelection:()=>qs,$getSiblingCaret:()=>lg,$getState:()=>YLe,$getStateChange:()=>Lmi,$getTextContent:()=>fhi,$getTextNodeOffset:()=>ST,$getTextPointCaret:()=>LU,$getTextPointCaretSlice:()=>R_t,$getWritableNodeState:()=>q_t,$hasAncestor:()=>fFe,$hasUpdateTag:()=>Nhi,$insertNodes:()=>dhi,$isBlockElementNode:()=>uhi,$isChildCaret:()=>wT,$isDecoratorNode:()=>Hu,$isElementNode:()=>tt,$isExtendableTextPointCaret:()=>iYr,$isInlineElementOrDecoratorNode:()=>Dhi,$isLeafNode:()=>Rhi,$isLineBreakNode:()=>B3,$isNodeCaret:()=>Uhi,$isNodeSelection:()=>bFe,$isParagraphNode:()=>whi,$isRangeSelection:()=>mn,$isRootNode:()=>Nv,$isRootOrShadowRoot:()=>xT,$isSiblingCaret:()=>K3,$isTabNode:()=>K_t,$isTextNode:()=>Ar,$isTextPointCaret:()=>sL,$isTextPointCaretSlice:()=>Whi,$isTokenOrSegmented:()=>rL,$isTokenOrTab:()=>AU,$nodesOfType:()=>Ahi,$normalizeCaret:()=>_T,$normalizeSelection__EXPERIMENTAL:()=>QLe,$onUpdate:()=>WZr,$parseSerializedNode:()=>hhi,$removeTextFromCaretRange:()=>oYr,$rewindSiblingCaret:()=>SY,$selectAll:()=>Ihi,$setCompositionKey:()=>ag,$setPointFromCaret:()=>_Y,$setSelection:()=>$v,$setSelectionFromCaretRange:()=>nYr,$setState:()=>Fmi,$splitAtPointCaretNext:()=>Xhi,$splitNode:()=>jhi,$updateRangeSelectionFromCaretRange:()=>Dde,ArtificialNode__DO_NOT_USE:()=>lFe,BLUR_COMMAND:()=>sZr,CAN_REDO_COMMAND:()=>Xmi,CAN_UNDO_COMMAND:()=>Zmi,CLEAR_EDITOR_COMMAND:()=>Kmi,CLEAR_HISTORY_COMMAND:()=>Gmi,CLICK_COMMAND:()=>zXr,COLLABORATION_TAG:()=>MZr,COMMAND_PRIORITY_CRITICAL:()=>Ohi,COMMAND_PRIORITY_EDITOR:()=>Shi,COMMAND_PRIORITY_HIGH:()=>Thi,COMMAND_PRIORITY_LOW:()=>Chi,COMMAND_PRIORITY_NORMAL:()=>xhi,CONTROLLED_TEXT_INSERTION_COMMAND:()=>nY,COPY_COMMAND:()=>H_t,CUT_COMMAND:()=>W_t,DELETE_CHARACTER_COMMAND:()=>Bde,DELETE_LINE_COMMAND:()=>zde,DELETE_WORD_COMMAND:()=>Ude,DRAGEND_COMMAND:()=>iZr,DRAGOVER_COMMAND:()=>oZr,DRAGSTART_COMMAND:()=>nZr,DROP_COMMAND:()=>rZr,DecoratorNode:()=>Vde,ElementNode:()=>$U,FOCUS_COMMAND:()=>aZr,FORMAT_ELEMENT_COMMAND:()=>Jmi,FORMAT_TEXT_COMMAND:()=>RU,HISTORIC_TAG:()=>ghi,HISTORY_MERGE_TAG:()=>KLe,HISTORY_PUSH_TAG:()=>yhi,INDENT_CONTENT_COMMAND:()=>Hmi,INSERT_LINE_BREAK_COMMAND:()=>Mde,INSERT_PARAGRAPH_COMMAND:()=>h_t,INSERT_TAB_COMMAND:()=>Vmi,INTERNAL_$isBlock:()=>iL,IS_ALL_FORMATTING:()=>PXr,IS_BOLD:()=>bmi,IS_CODE:()=>vmi,IS_HIGHLIGHT:()=>mFe,IS_ITALIC:()=>_mi,IS_STRIKETHROUGH:()=>$de,IS_SUBSCRIPT:()=>wmi,IS_SUPERSCRIPT:()=>Smi,IS_UNDERLINE:()=>Lde,KEY_ARROW_DOWN_COMMAND:()=>XXr,KEY_ARROW_LEFT_COMMAND:()=>JXr,KEY_ARROW_RIGHT_COMMAND:()=>HXr,KEY_ARROW_UP_COMMAND:()=>GXr,KEY_BACKSPACE_COMMAND:()=>YXr,KEY_DELETE_COMMAND:()=>eZr,KEY_DOWN_COMMAND:()=>VXr,KEY_ENTER_COMMAND:()=>nFe,KEY_ESCAPE_COMMAND:()=>QXr,KEY_MODIFIER_COMMAND:()=>uZr,KEY_SPACE_COMMAND:()=>ZXr,KEY_TAB_COMMAND:()=>tZr,LineBreakNode:()=>uY,MOVE_TO_END:()=>WXr,MOVE_TO_START:()=>KXr,NODE_STATE_KEY:()=>Rmi,OUTDENT_CONTENT_COMMAND:()=>Wmi,PASTE_COMMAND:()=>U_t,PASTE_TAG:()=>bhi,ParagraphNode:()=>fY,REDO_COMMAND:()=>V_t,REMOVE_TEXT_COMMAND:()=>g_t,RootNode:()=>dY,SELECTION_CHANGE_COMMAND:()=>B_t,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>zmi,SELECT_ALL_COMMAND:()=>y_t,SKIP_COLLAB_TAG:()=>_hi,SKIP_DOM_SELECTION_TAG:()=>IZr,SKIP_SCROLL_INTO_VIEW_TAG:()=>RZr,TEXT_TYPE_TO_FORMAT:()=>lb,TabNode:()=>cY,TextNode:()=>H3,UNDO_COMMAND:()=>z_t,buildImportMap:()=>ehi,createCommand:()=>Ao,createEditor:()=>Ehi,createSharedNodeState:()=>jXr,createState:()=>$mi,flipDirection:()=>BU,getDOMOwnerDocument:()=>svt,getDOMSelection:()=>hN,getDOMSelectionFromTarget:()=>GZr,getDOMTextNode:()=>J3,getEditorPropertyFromDOMNode:()=>Jde,getNearestEditorFromDOMNode:()=>rvt,getRegisteredNode:()=>evt,getRegisteredNodeOrThrow:()=>Q_t,isBlockDomNode:()=>P_t,isCurrentlyReadOnlyMode:()=>vY,isDOMDocumentNode:()=>DZr,isDOMNode:()=>wY,isDOMTextNode:()=>gN,isDOMUnmanaged:()=>eYr,isDocumentFragment:()=>XZr,isExactShortcutMatch:()=>ou,isHTMLAnchorElement:()=>$hi,isHTMLElement:()=>c_,isInlineDomNode:()=>ZZr,isLexicalEditor:()=>wFe,isModifierMatch:()=>UZr,isSelectionCapturedInDecoratorInput:()=>tvt,isSelectionWithinEditor:()=>Wde,makeStepwiseIterator:()=>mvt,removeFromParent:()=>NU,resetRandomKey:()=>Phi,setDOMUnmanaged:()=>Fhi,setNodeIndentFromDOM:()=>QZr});function it(t,...e){let r=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(let o of e)n.append("v",o);throw r.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var TT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,lmi=TT&&"documentMode"in document?document.documentMode:null,mN=TT&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),U3=TT&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),GLe=!(!TT||!("InputEvent"in window)||lmi)&&"getTargetRanges"in new window.InputEvent("input"),jde=TT&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),aY=TT&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,cmi=TT&&/Android/.test(navigator.userAgent),OXr=TT&&/^(?=.*Chrome).*/i.test(navigator.userAgent),j7r=TT&&cmi&&OXr,XLe=TT&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!OXr;function ZLe(...t){let e=[];for(let r of t)if(r&&typeof r=="string")for(let[n]of r.matchAll(/\S+/g))e.push(n);return e}var dmi=1,fmi=3,pmi=9,mmi=11,z3=0,EXr=1,sY=2,hmi=0,gmi=1,ymi=2,bmi=1,_mi=2,$de=4,Lde=8,vmi=16,wmi=32,Smi=64,mFe=128,PXr=1792|(112|(3|$de|Lde)|mFe),N_t=1,D_t=2,j_t=3,$_t=4,L_t=5,F_t=6,hFe=jde||aY||XLe?"\xA0":"\u200B",uL=`

`,Cmi=U3?"\xA0":hFe,MXr="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",RXr="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",xmi=new RegExp("^[^"+RXr+"]*["+MXr+"]"),Tmi=new RegExp("^[^"+MXr+"]*["+RXr+"]"),lb={bold:1,capitalize:1024,code:16,highlight:mFe,italic:2,lowercase:256,strikethrough:$de,subscript:32,superscript:64,underline:Lde,uppercase:512},Omi={directionless:1,unmergeable:2},$7r={center:D_t,end:F_t,justify:$_t,left:N_t,right:j_t,start:L_t},Emi={[D_t]:"center",[F_t]:"end",[$_t]:"justify",[N_t]:"left",[j_t]:"right",[L_t]:"start"},Pmi={normal:0,segmented:2,token:1},Mmi={[hmi]:"normal",[ymi]:"segmented",[gmi]:"token"},Rmi="$",L7r="$config";function IXr(t,e,r,n,o,i){let a=t.getFirstChild();for(;a!==null;){let s=a.__key;a.__parent===e&&(tt(a)&&IXr(a,s,r,n,o,i),r.has(s)||i.delete(s),o.push(s)),a=a.getNextSibling()}}var Imi=100,a_t=!1,k_t=0;function Ami(t){k_t=t.timeStamp}function Jbt(t,e,r){let n=t.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(t===o||n&&t.previousSibling===o)||n&&SFe(t,r)!==void 0}function Nmi(t,e,r){let n=hN(fC(r)),o=null,i=null;n!==null&&n.anchorNode===t&&(o=n.anchorOffset,i=n.focusOffset);let a=t.nodeValue;a!==null&&ivt(e,a,o,i,!1)}function Dmi(t,e,r){if(mn(t)){let n=t.anchor.getNode();if(n.is(r)&&t.format!==n.getFormat())return!1}return gN(e)&&r.isAttached()}function jmi(t,e,r,n){for(let o=t;o&&!eYr(o);o=Kde(o)){let i=SFe(o,e);if(i!==void 0){let a=yh(i,r);if(a)return Hu(a)||!c_(o)?void 0:[o,a]}else if(o===n)return[n,FZr(r)]}}function AXr(t,e,r){a_t=!0;let n=performance.now()-k_t>Imi;try{tS(t,()=>{let o=qs()||function(f){return f.getEditorState().read(()=>{let p=qs();return p!==null?p.clone():null})}(t),i=new Map,a=t.getRootElement(),s=t._editorState,u=t._blockCursorElement,l=!1,c="";for(let f=0;f<e.length;f++){let p=e[f],m=p.type,h=p.target,y=jmi(h,t,s,a);if(!y)continue;let[g,b]=y;if(m==="characterData")n&&Ar(b)&&gN(h)&&Dmi(o,h,b)&&Nmi(h,b,t);else if(m==="childList"){l=!0;let _=p.addedNodes;for(let O=0;O<_.length;O++){let E=_[O],P=$Zr(E),R=E.parentNode;if(R!=null&&E!==u&&P===null&&!Jbt(E,R,t)){if(U3){let I=(c_(E)?E.innerText:null)||E.nodeValue;I&&(c+=I)}R.removeChild(E)}}let w=p.removedNodes,T=w.length;if(T>0){let O=0;for(let E=0;E<T;E++){let P=w[E];(Jbt(P,h,t)||u===P)&&(h.appendChild(P),O++)}T!==O&&i.set(g,b)}}}if(i.size>0)for(let[f,p]of i)p.reconcileObservedMutation(f,t);let d=r.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){let p=d[f],m=p.addedNodes,h=p.target;for(let y=0;y<m.length;y++){let g=m[y],b=g.parentNode;b==null||g.nodeName!=="BR"||Jbt(g,h,t)||b.removeChild(g)}}r.takeRecords()}o!==null&&(l&&$v(o),U3&&VZr(t)&&o.insertRawText(c))})}finally{a_t=!1}}function NXr(t){let e=t._observer;e!==null&&AXr(t,e.takeRecords(),e)}function DXr(t){(function(e){k_t===0&&fC(e).addEventListener("textInput",Ami,!0)})(t),t._observer=new MutationObserver((e,r)=>{AXr(t,e,r)})}var s_t=class{constructor(e,r){this.key=e,this.parse=r.parse.bind(r),this.unparse=(r.unparse||kmi).bind(r),this.isEqual=(r.isEqual||Object.is).bind(r),this.defaultValue=this.parse(void 0)}};function $mi(t,e){return new s_t(t,e)}function YLe(t,e,r="latest"){let n=(r==="latest"?t.getLatest():t).__state;return n?n.getValue(e):e.defaultValue}function Lmi(t,e,r){let n=YLe(t,r,"direct"),o=YLe(e,r,"direct");return r.isEqual(n,o)?null:[n,o]}function Fmi(t,e,r){let n;if(ig(),typeof r=="function"){let i=t.getLatest(),a=YLe(i,e);if(n=r(a),e.isEqual(a,n))return i}else n=r;let o=t.getWritable();return q_t(o).updateFromKnown(e,n),o}function jXr(t){let e=new Map,r=new Set;for(let n=typeof t=="function"?t:t.replace;n.prototype&&n.prototype.getType!==void 0;n=Object.getPrototypeOf(n)){let{ownNodeConfig:o}=dvt(n);if(o&&o.stateConfigs)for(let i of o.stateConfigs){let a;"stateConfig"in i?(a=i.stateConfig,i.flat&&r.add(a.key)):a=i,e.set(a.key,a)}}return{flatKeys:r,sharedConfigMap:e}}var u_t=class t{constructor(e,r,n=void 0,o=new Map,i=void 0){this.node=e,this.sharedNodeState=r,this.unknownState=n,this.knownState=o;let{sharedConfigMap:a}=this.sharedNodeState,s=i!==void 0?i:function(u,l,c){let d=c.size;if(l)for(let f in l){let p=u.get(f);p&&c.has(p)||d++}return d}(a,n,o);this.size=s}getValue(e){let r=this.knownState.get(e);if(r!==void 0)return r;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let o=this.unknownState[e.key];o!==void 0&&(n=e.parse(o)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},r={};for(let[n,o]of this.knownState)n.isEqual(o,n.defaultValue)?delete e[n.key]:e[n.key]=n.unparse(o);for(let n of this.sharedNodeState.flatKeys)n in e&&(r[n]=e[n],delete e[n]);return F7r(e)&&(r.$=e),r}getWritable(e){if(this.node===e)return this;let{sharedNodeState:r,unknownState:n}=this,o=new Map(this.knownState);return new t(e,r,function(i,a,s){let u;if(s)for(let[l,c]of Object.entries(s)){let d=i.get(l);d?a.has(d)||a.set(d,d.parse(c)):(u=u||{},u[l]=c)}return u}(r.sharedConfigMap,o,n),o,this.size)}updateFromKnown(e,r){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:o,unknownState:i}=this;o.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=F7r(i)),this.size++),o.set(e,r)}updateFromUnknown(e,r){let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(r)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=r)}updateFromJSON(e){let{knownState:r}=this;for(let n of r.keys())r.set(n,n.defaultValue);if(this.size=r.size,this.unknownState=void 0,e)for(let[n,o]of Object.entries(e))this.updateFromUnknown(n,o)}};function q_t(t){let e=t.getWritable(),r=e.__state?e.__state.getWritable(e):new u_t(e,$Xr(e));return e.__state=r,r}function $Xr(t){return t.__state?t.__state.sharedNodeState:Q_t(cvt(),t.getType()).sharedNodeState}function F7r(t){if(t)for(let e in t)return t}function kmi(t){return t}function k7r(t,e,r){for(let[n,o]of e.knownState){if(t.has(n.key))continue;t.add(n.key);let i=r?r.getValue(n):n.defaultValue;if(i!==o&&!n.isEqual(i,o))return!0}return!1}function q7r(t,e,r){let{unknownState:n}=e,o=r?r.unknownState:void 0;if(n){for(let[i,a]of Object.entries(n))if(!t.has(i)&&(t.add(i),a!==(o?o[i]:void 0)))return!0}return!1}function B7r(t,e){let r=t.__state;return r&&r.node===t?r.getWritable(e):r}function U7r(t,e){let r=t.__mode,n=t.__format,o=t.__style,i=e.__mode,a=e.__format,s=e.__style,u=t.__state,l=e.__state;return(r===null||r===i)&&(n===null||n===a)&&(o===null||o===s)&&(t.__state===null||u===l||function(c,d){if(c===d)return!0;if(c&&d&&c.size!==d.size)return!1;let f=new Set;return!(c&&k7r(f,c,d)||d&&k7r(f,d,c)||c&&q7r(f,c,d)||d&&q7r(f,d,c))}(u,l))}function z7r(t,e){let r=t.mergeWithSibling(e),n=dc()._normalizedNodes;return n.add(t.__key),n.add(e.__key),r}function V7r(t){let e,r,n=t;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&Ar(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(U7r(e,n)){n=z7r(e,n);break}break}e.remove()}for(;(r=n.getNextSibling())!==null&&Ar(r)&&r.isSimpleText()&&!r.isUnmergeable();){if(r.__text!==""){if(U7r(n,r)){n=z7r(n,r);break}break}r.remove()}}else n.remove()}function QLe(t){return H7r(t.anchor),H7r(t.focus),t}function H7r(t){for(;t.type==="element";){let e=t.getNode(),r=t.offset,n,o;if(r===e.getChildrenSize()?(n=e.getChildAtIndex(r-1),o=!0):(n=e.getChildAtIndex(r),o=!1),Ar(n)){t.set(n.__key,o?n.getTextContentSize():0,"text",!0);break}if(!tt(n))break;t.set(n.__key,o?n.getChildrenSize():0,"element",!0)}}var DU,l_,Fde,gFe,l_t,c_t,V3,vT,d_t,kde,gh="",u_="",fN=null,pN="",nL="",LXr=!1,qde=!1,HLe=null;function eFe(t,e){let r=V3.get(t);if(e!==null){let n=m_t(t);n.parentNode===e&&e.removeChild(n)}if(vT.has(t)||l_._keyToDOMMap.delete(t),tt(r)){let n=rFe(r,V3);f_t(n,0,n.length-1,null)}r!==void 0&&avt(kde,Fde,gFe,r,"destroyed")}function f_t(t,e,r,n){let o=e;for(;o<=r;++o){let i=t[o];i!==void 0&&eFe(i,n)}}function k3(t,e){t.setProperty("text-align",e)}var qmi="40px";function FXr(t,e){let r=DU.theme.indent;if(typeof r=="string"){let o=t.classList.contains(r);e>0&&!o?t.classList.add(r):e<1&&o&&t.classList.remove(r)}let n=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||qmi;t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function kXr(t,e){let r=t.style;e===0?k3(r,""):e===N_t?k3(r,"left"):e===D_t?k3(r,"center"):e===j_t?k3(r,"right"):e===$_t?k3(r,"justify"):e===L_t?k3(r,"start"):e===F_t&&k3(r,"end")}function tFe(t,e){let r=vT.get(t);r===void 0&&it(60);let n=r.createDOM(DU,l_);if(function(o,i,a){let s=a._keyToDOMMap;(function(u,l,c){let d=`__lexicalKey_${l._key}`;u[d]=c})(i,a,o),s.set(o,i)}(t,n,l_),Ar(r)?n.setAttribute("data-lexical-text","true"):Hu(r)&&n.setAttribute("data-lexical-decorator","true"),tt(r)){let o=r.__indent,i=r.__size;if(o!==0&&FXr(n,o),i!==0){let s=i-1;(function(u,l,c,d){let f=u_;u_="",p_t(u,c,0,l,c.getDOMSlot(d)),BXr(c,d),u_=f})(rFe(r,vT),s,r,n)}let a=r.__format;a!==0&&kXr(n,a),r.isInline()||qXr(null,r,n),xFe(r)&&(gh+=uL,nL+=uL)}else{let o=r.getTextContent();if(Hu(r)){let i=r.decorate(l_,DU);i!==null&&UXr(t,i),n.contentEditable="false"}else Ar(r)&&(r.isDirectionless()||(u_+=o));gh+=o,nL+=o}return e!==null&&e.insertChild(n),avt(kde,Fde,gFe,r,"created"),n}function p_t(t,e,r,n,o){let i=gh;gh="";let a=r;for(;a<=n;++a){tFe(t[a],o);let s=vT.get(t[a]);s!==null&&Ar(s)&&(fN===null&&(fN=s.getFormat()),pN===""&&(pN=s.getStyle()))}xFe(e)&&(gh+=uL),o.element.__lexicalTextContent=gh,gh=i+gh}function W7r(t,e){if(t){let r=t.__last;if(r){let n=e.get(r);if(n)return B3(n)?"line-break":Hu(n)&&n.isInline()?"decorator":null}return"empty"}return null}function qXr(t,e,r){let n=W7r(t,V3),o=W7r(e,vT);n!==o&&e.getDOMSlot(r).setManagedLineBreak(o)}function BXr(t,e){let r=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(r!==u_||n!==HLe){let o=u_==="",i=o?HLe:function(a){return xmi.test(a)?"rtl":Tmi.test(a)?"ltr":null}(u_);if(i!==n){let a=e.classList,s=DU.theme,u=n!==null?s[n]:void 0,l=i!==null?s[i]:void 0;if(u!==void 0){if(typeof u=="string"){let c=ZLe(u);u=s[n]=c}a.remove(...u)}if(i===null||o&&i==="ltr")e.removeAttribute("dir");else{if(l!==void 0){if(typeof l=="string"){let c=ZLe(l);l=s[i]=c}l!==void 0&&a.add(...l)}e.dir=i}qde||(t.getWritable().__dir=i)}HLe=i,e.__lexicalDirTextContent=u_,e.__lexicalDir=i}}function Bmi(t,e,r){let n=u_;var o;u_="",fN=null,pN="",function(i,a,s){let u=gh,l=i.__size,c=a.__size;gh="";let d=s.element;if(l===1&&c===1){let f=i.__first,p=a.__first;if(f===p)Pde(f,d);else{let h=m_t(f),y=tFe(p,null);try{d.replaceChild(y,h)}catch(g){if(typeof g=="object"&&g!=null){let b=`${g.toString()} Parent: ${d.tagName}, new child: {tag: ${y.tagName} key: ${p}}, old child: {tag: ${h.tagName}, key: ${f}}.`;throw new Error(b)}throw g}eFe(f,null)}let m=vT.get(p);Ar(m)&&(fN===null&&(fN=m.getFormat()),pN===""&&(pN=m.getStyle()))}else{let f=rFe(i,V3),p=rFe(a,vT);if(f.length!==l&&it(227),p.length!==c&&it(228),l===0)c!==0&&p_t(p,a,0,c-1,s);else if(c===0){if(l!==0){let m=s.after==null&&s.before==null&&s.element.__lexicalLineBreak==null;f_t(f,0,l-1,m?null:d),m&&(d.textContent="")}}else(function(m,h,y,g,b,_){let w=g-1,T=b-1,O,E,P=_.getFirstChild(),R=0,I=0;for(;R<=w&&I<=T;){let k=h[R],q=y[I];if(k===q)P=Kbt(Pde(q,_.element)),R++,I++;else{O===void 0&&(O=new Set(h)),E===void 0&&(E=new Set(y));let V=E.has(k),Y=O.has(q);if(V)if(Y){let X=mY(l_,q);X===P?P=Kbt(Pde(q,_.element)):(_.withBefore(P).insertChild(X),Pde(q,_.element)),R++,I++}else tFe(q,_.withBefore(P)),I++;else P=Kbt(m_t(k)),eFe(k,_.element),R++}let Z=vT.get(q);Z!==null&&Ar(Z)&&(fN===null&&(fN=Z.getFormat()),pN===""&&(pN=Z.getStyle()))}let A=R>w,B=I>T;if(A&&!B){let k=y[T+1],q=k===void 0?null:l_.getElementByKey(k);p_t(y,m,I,T,_.withBefore(q))}else B&&!A&&f_t(h,R,w,_.element)})(a,f,p,l,c,s)}xFe(a)&&(gh+=uL),d.__lexicalTextContent=gh,gh=u+gh}(t,e,e.getDOMSlot(r)),BXr(e,r),o=e,fN==null||fN===o.__textFormat||qde||o.setTextFormat(fN),function(i){pN===""||pN===i.__textStyle||qde||i.setTextStyle(pN)}(e),u_=n}function rFe(t,e){let r=[],n=t.__first;for(;n!==null;){let o=e.get(n);o===void 0&&it(101),r.push(n),n=o.__next}return r}function Pde(t,e){let r=V3.get(t),n=vT.get(t);r!==void 0&&n!==void 0||it(61);let o=LXr||c_t.has(t)||l_t.has(t),i=mY(l_,t);if(r===n&&!o){if(tt(r)){let a=i.__lexicalTextContent;a!==void 0&&(gh+=a,nL+=a);let s=i.__lexicalDirTextContent;s!==void 0&&(u_+=s)}else{let a=r.getTextContent();Ar(r)&&!r.isDirectionless()&&(u_+=a),nL+=a,gh+=a}return i}if(r!==n&&o&&avt(kde,Fde,gFe,n,"updated"),n.updateDOM(r,i,DU)){let a=tFe(t,null);return e===null&&it(62),e.replaceChild(a,i),eFe(t,null),a}if(tt(r)&&tt(n)){let a=n.__indent;a!==r.__indent&&FXr(i,a);let s=n.__format;s!==r.__format&&kXr(i,s),o&&(Bmi(r,n,i),Nv(n)||n.isInline()||qXr(r,n,i)),xFe(n)&&(gh+=uL,nL+=uL)}else{let a=n.getTextContent();if(Hu(n)){let s=n.decorate(l_,DU);s!==null&&UXr(t,s)}else Ar(n)&&!n.isDirectionless()&&(u_+=a);gh+=a,nL+=a}if(!qde&&Nv(n)&&n.__cachedText!==nL){let a=n.getWritable();a.__cachedText=nL,n=a}return i}function UXr(t,e){let r=l_._pendingDecorators,n=l_._decorators;if(r===null){if(n[t]===e)return;r=LZr(l_)}r[t]=e}function Kbt(t){let e=t.nextSibling;return e!==null&&e===l_._blockCursorElement&&(e=e.nextSibling),e}function Umi(t,e,r,n,o,i){gh="",nL="",u_="",LXr=n===sY,HLe=null,l_=r,DU=r._config,Fde=r._nodes,gFe=l_._listeners.mutation,l_t=o,c_t=i,V3=t._nodeMap,vT=e._nodeMap,qde=e._readOnly,d_t=new Map(r._keyToDOMMap);let a=new Map;return kde=a,Pde("root",null),l_=void 0,Fde=void 0,l_t=void 0,c_t=void 0,V3=void 0,vT=void 0,DU=void 0,d_t=void 0,kde=void 0,a}function m_t(t){let e=d_t.get(t);return e===void 0&&it(75,t),e}function Ao(t){return{type:t}}var B_t=Ao("SELECTION_CHANGE_COMMAND"),zmi=Ao("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),zXr=Ao("CLICK_COMMAND"),Bde=Ao("DELETE_CHARACTER_COMMAND"),Mde=Ao("INSERT_LINE_BREAK_COMMAND"),h_t=Ao("INSERT_PARAGRAPH_COMMAND"),nY=Ao("CONTROLLED_TEXT_INSERTION_COMMAND"),U_t=Ao("PASTE_COMMAND"),g_t=Ao("REMOVE_TEXT_COMMAND"),Ude=Ao("DELETE_WORD_COMMAND"),zde=Ao("DELETE_LINE_COMMAND"),RU=Ao("FORMAT_TEXT_COMMAND"),z_t=Ao("UNDO_COMMAND"),V_t=Ao("REDO_COMMAND"),VXr=Ao("KEYDOWN_COMMAND"),HXr=Ao("KEY_ARROW_RIGHT_COMMAND"),WXr=Ao("MOVE_TO_END"),JXr=Ao("KEY_ARROW_LEFT_COMMAND"),KXr=Ao("MOVE_TO_START"),GXr=Ao("KEY_ARROW_UP_COMMAND"),XXr=Ao("KEY_ARROW_DOWN_COMMAND"),nFe=Ao("KEY_ENTER_COMMAND"),ZXr=Ao("KEY_SPACE_COMMAND"),YXr=Ao("KEY_BACKSPACE_COMMAND"),QXr=Ao("KEY_ESCAPE_COMMAND"),eZr=Ao("KEY_DELETE_COMMAND"),tZr=Ao("KEY_TAB_COMMAND"),Vmi=Ao("INSERT_TAB_COMMAND"),Hmi=Ao("INDENT_CONTENT_COMMAND"),Wmi=Ao("OUTDENT_CONTENT_COMMAND"),rZr=Ao("DROP_COMMAND"),Jmi=Ao("FORMAT_ELEMENT_COMMAND"),nZr=Ao("DRAGSTART_COMMAND"),oZr=Ao("DRAGOVER_COMMAND"),iZr=Ao("DRAGEND_COMMAND"),H_t=Ao("COPY_COMMAND"),W_t=Ao("CUT_COMMAND"),y_t=Ao("SELECT_ALL_COMMAND"),Kmi=Ao("CLEAR_EDITOR_COMMAND"),Gmi=Ao("CLEAR_HISTORY_COMMAND"),Xmi=Ao("CAN_REDO_COMMAND"),Zmi=Ao("CAN_UNDO_COMMAND"),aZr=Ao("FOCUS_COMMAND"),sZr=Ao("BLUR_COMMAND"),uZr=Ao("KEY_MODIFIER_COMMAND"),Q$=Object.freeze({}),b_t=30,__t=[["keydown",function(t,e){if(Rde=t.timeStamp,lZr=t.key,!e.isComposing()&&!wr(e,VXr,t)&&t.key!=null){if(Gbt&&vXr(t))return tS(e,()=>{qLe(e,Xbt)}),Gbt=!1,void(Xbt="");if(function(r){return ou(r,"ArrowRight",{shiftKey:"any"})}(t))wr(e,HXr,t);else if(function(r){return ou(r,"ArrowRight",tL)}(t))wr(e,WXr,t);else if(function(r){return ou(r,"ArrowLeft",{shiftKey:"any"})}(t))wr(e,JXr,t);else if(function(r){return ou(r,"ArrowLeft",tL)}(t))wr(e,KXr,t);else if(function(r){return ou(r,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))wr(e,GXr,t);else if(function(r){return ou(r,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))wr(e,XXr,t);else if(function(r){return ou(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))Ide=!0,wr(e,nFe,t);else if(function(r){return r.key===" "}(t))wr(e,ZXr,t);else if(function(r){return mN&&ou(r,"o",{ctrlKey:!0})}(t))t.preventDefault(),Ide=!0,wr(e,Mde,!0);else if(function(r){return ou(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))Ide=!1,wr(e,nFe,t);else if(function(r){return ou(r,"Backspace",{shiftKey:"any"})||mN&&ou(r,"h",{ctrlKey:!0})}(t))vXr(t)?wr(e,YXr,t):(t.preventDefault(),wr(e,Bde,!0));else if(function(r){return r.key==="Escape"}(t))wr(e,QXr,t);else if(function(r){return ou(r,"Delete",{})||mN&&ou(r,"d",{ctrlKey:!0})}(t))(function(r){return r.key==="Delete"})(t)?wr(e,eZr,t):(t.preventDefault(),wr(e,Bde,!1));else if(function(r){return ou(r,"Backspace",_Xr)}(t))t.preventDefault(),wr(e,Ude,!0);else if(function(r){return ou(r,"Delete",_Xr)}(t))t.preventDefault(),wr(e,Ude,!1);else if(function(r){return mN&&ou(r,"Backspace",{metaKey:!0})}(t))t.preventDefault(),wr(e,zde,!0);else if(function(r){return mN&&(ou(r,"Delete",{metaKey:!0})||ou(r,"k",{ctrlKey:!0}))}(t))t.preventDefault(),wr(e,zde,!1);else if(function(r){return ou(r,"b",tL)}(t))t.preventDefault(),wr(e,RU,"bold");else if(function(r){return ou(r,"u",tL)}(t))t.preventDefault(),wr(e,RU,"underline");else if(function(r){return ou(r,"i",tL)}(t))t.preventDefault(),wr(e,RU,"italic");else if(function(r){return ou(r,"Tab",{shiftKey:"any"})}(t))wr(e,tZr,t);else if(function(r){return ou(r,"z",tL)}(t))t.preventDefault(),wr(e,z_t,void 0);else if(function(r){return mN?ou(r,"z",{metaKey:!0,shiftKey:!0}):ou(r,"y",{ctrlKey:!0})||ou(r,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),wr(e,V_t,void 0);else{let r=e._editorState._selection;r===null||mn(r)?wXr(t)&&(t.preventDefault(),wr(e,y_t,t)):function(n){return ou(n,"c",tL)}(t)?(t.preventDefault(),wr(e,H_t,t)):function(n){return ou(n,"x",tL)}(t)?(t.preventDefault(),wr(e,W_t,t)):wXr(t)&&(t.preventDefault(),wr(e,y_t,t))}(function(r){return r.ctrlKey||r.shiftKey||r.altKey||r.metaKey})(t)&&wr(e,uZr,t)}}],["pointerdown",function(t,e){let r=t.target,n=t.pointerType;wY(r)&&n!=="touch"&&n!=="pen"&&t.button===0&&tS(e,()=>{gXr(r)||(w_t=!0)})}],["compositionstart",function(t,e){tS(e,()=>{let r=qs();if(mn(r)&&!e.isComposing()){let n=r.anchor,o=r.anchor.getNode();ag(n.key),(t.timeStamp<Rde+b_t||n.type==="element"||!r.isCollapsed()||o.getFormat()!==r.format||Ar(o)&&o.getStyle()!==r.style)&&wr(e,nY,Cmi)}})}],["compositionend",function(t,e){U3?Ode=!0:aY||!jde&&!XLe?tS(e,()=>{qLe(e,t.data)}):(Gbt=!0,Xbt=t.data)}],["input",function(t,e){t.stopPropagation(),tS(e,()=>{if(c_(t.target)&&gXr(t.target))return;let r=qs(),n=t.data,o=mZr(t);if(n!=null&&mn(r)&&fZr(r,o,n,t.timeStamp,!1)){Ode&&(qLe(e,n),Ode=!1);let i=r.anchor.getNode(),a=hN(fC(e));if(a===null)return;let s=r.isBackward(),u=s?r.anchor.offset:r.focus.offset,l=s?r.focus.offset:r.anchor.offset;GLe&&!r.isCollapsed()&&Ar(i)&&a.anchorNode!==null&&i.getTextContent().slice(0,u)+n+i.getTextContent().slice(u+l)===BZr(a.anchorNode)||wr(e,nY,n);let c=n.length;U3&&c>1&&t.inputType==="insertCompositionText"&&!e.isComposing()&&(r.anchor.offset-=c),jde||aY||XLe||!e.isComposing()||(Rde=0,ag(null))}else ovt(!1,e,n!==null?n:void 0),Ode&&(qLe(e,n||void 0),Ode=!1);(function(){ig();let i=dc();NXr(i)})()},{event:t}),tY=null}],["click",function(t,e){tS(e,()=>{let r=qs(),n=hN(fC(e)),o=G3();if(n){if(mn(r)){let i=r.anchor,a=i.getNode();if(i.type==="element"&&i.offset===0&&r.isCollapsed()&&!Nv(a)&&jv().getChildrenSize()===1&&a.getTopLevelElementOrThrow().isEmpty()&&o!==null&&r.is(o))n.removeAllRanges(),r.dirty=!0;else if(t.detail===3&&!r.isCollapsed()&&a!==r.focus.getNode()){let s=function(u,l){let c=u;for(;c!==jv()&&c!=null;){if(l(c))return c;c=c.getParent()}return null}(a,u=>tt(u)&&!u.isInline());tt(s)&&s.select(0)}}else if(t.pointerType==="touch"||t.pointerType==="pen"){let i=n.anchorNode;(c_(i)||gN(i))&&$v(_Fe(o,n,e,t))}}wr(e,zXr,t)})}],["cut",Q$],["copy",Q$],["dragstart",Q$],["dragover",Q$],["dragend",Q$],["paste",Q$],["focus",Q$],["blur",Q$],["drop",Q$]];GLe&&__t.push(["beforeinput",(t,e)=>function(r,n){let o=r.inputType,i=mZr(r);o==="deleteCompositionText"||U3&&VZr(n)||o!=="insertCompositionText"&&tS(n,()=>{let a=qs();if(o==="deleteContentBackward"){if(a===null){let p=G3();if(!mn(p))return;$v(p.clone())}if(mn(a)){let p=a.anchor.key===a.focus.key;if(s=r.timeStamp,lZr==="MediaLast"&&s<Rde+b_t&&n.isComposing()&&p){if(ag(null),Rde=0,setTimeout(()=>{tS(n,()=>{ag(null)})},b_t),mn(a)){let m=a.anchor.getNode();m.markDirty(),Ar(m)||it(142),pZr(a,m)}}else{ag(null),r.preventDefault();let m=a.anchor.getNode(),h=m.getTextContent(),y=m.canInsertTextAfter(),g=a.anchor.offset===0&&a.focus.offset===h.length,b=j7r&&p&&!g&&y;if(b&&a.isCollapsed()&&(b=!Hu(zZr(a.anchor,!0))),!b){wr(n,Bde,!0);let _=qs();j7r&&mn(_)&&_.isCollapsed()&&(q3=_,setTimeout(()=>q3=null))}}return}}var s;if(!mn(a))return;let u=r.data;tY!==null&&ovt(!1,n,tY),a.dirty&&tY===null||!a.isCollapsed()||Nv(a.anchor.getNode())||i===null||a.applyDOMRange(i),tY=null;let l=a.anchor,c=a.focus,d=l.getNode(),f=c.getNode();if(o!=="insertText"&&o!=="insertTranspose")switch(r.preventDefault(),o){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":wr(n,nY,r);break;case"insertFromComposition":ag(null),wr(n,nY,r);break;case"insertLineBreak":ag(null),wr(n,Mde,!1);break;case"insertParagraph":ag(null),Ide&&!aY?(Ide=!1,wr(n,Mde,!1)):wr(n,h_t,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":wr(n,U_t,r);break;case"deleteByComposition":(function(p,m){return p!==m||tt(p)||tt(m)||!AU(p)||!AU(m)})(d,f)&&wr(n,g_t,r);break;case"deleteByDrag":case"deleteByCut":wr(n,g_t,r);break;case"deleteContent":wr(n,Bde,!1);break;case"deleteWordBackward":wr(n,Ude,!0);break;case"deleteWordForward":wr(n,Ude,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":wr(n,zde,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":wr(n,zde,!1);break;case"formatStrikeThrough":wr(n,RU,"strikethrough");break;case"formatBold":wr(n,RU,"bold");break;case"formatItalic":wr(n,RU,"italic");break;case"formatUnderline":wr(n,RU,"underline");break;case"historyUndo":wr(n,z_t,void 0);break;case"historyRedo":wr(n,V_t,void 0)}else{if(u===`
`)r.preventDefault(),wr(n,Mde,!1);else if(u===uL)r.preventDefault(),wr(n,h_t,void 0);else if(u==null&&r.dataTransfer){let p=r.dataTransfer.getData("text/plain");r.preventDefault(),a.insertRawText(p)}else u!=null&&fZr(a,i,u,r.timeStamp,!0)?(r.preventDefault(),wr(n,nY,u)):tY=u;cZr=r.timeStamp}})}(t,e)]);var Rde=0,lZr=null,cZr=0,tY=null,oFe=new WeakMap,v_t=!1,w_t=!1,Ide=!1,Ode=!1,Gbt=!1,Xbt="",q3=null,dZr=[0,"",0,"root",0];function fZr(t,e,r,n,o){let i=t.anchor,a=t.focus,s=i.getNode(),u=dc(),l=hN(fC(u)),c=l!==null?l.anchorNode:null,d=i.key,f=u.getElementByKey(d),p=r.length;return d!==a.key||!Ar(s)||(!o&&(!GLe||cZr<n+50)||s.isDirty()&&p<2||kZr(r))&&i.offset!==a.offset&&!s.isComposing()||rL(s)||s.isDirty()&&p>1||(o||!GLe)&&f!==null&&!s.isComposing()&&c!==J3(f)||l!==null&&e!==null&&(!e.collapsed||e.startContainer!==l.anchorNode||e.startOffset!==l.anchorOffset)||s.getFormat()!==t.format||s.getStyle()!==t.style||function(m,h){if(h.isSegmented())return!0;if(!m.isCollapsed())return!1;let y=m.anchor.offset,g=h.getParentOrThrow(),b=AU(h);return y===0?!h.canInsertTextBefore()||!g.canInsertTextBefore()&&!h.isComposing()||b||function(_){let w=_.getPreviousSibling();return(Ar(w)||tt(w)&&w.isInline())&&!w.canInsertTextAfter()}(h):y===h.getTextContentSize()&&(!h.canInsertTextAfter()||!g.canInsertTextAfter()&&!h.isComposing()||b)}(t,s)}function J7r(t,e){return gN(t)&&t.nodeValue!==null&&e!==0&&e!==t.nodeValue.length}function K7r(t,e,r){let{anchorNode:n,anchorOffset:o,focusNode:i,focusOffset:a}=t;v_t&&(v_t=!1,J7r(n,o)&&J7r(i,a)&&!q3)||tS(e,()=>{if(!r)return void $v(null);if(!Wde(e,n,i))return;let s=qs();if(q3&&mn(s)&&s.isCollapsed()){let u=s.anchor,l=q3.anchor;(u.key===l.key&&u.offset===l.offset+1||u.offset===1&&l.getNode().is(u.getNode().getPreviousSibling()))&&(s=q3.clone(),$v(s))}if(q3=null,mn(s)){let u=s.anchor,l=u.getNode();if(s.isCollapsed()){t.type==="Range"&&t.anchorNode===t.focusNode&&(s.dirty=!0);let c=fC(e).event,d=c?c.timeStamp:performance.now(),[f,p,m,h,y]=dZr,g=jv(),b=e.isComposing()===!1&&g.getTextContent()==="";if(d<y+200&&u.offset===m&&u.key===h)WLe(s,f,p);else if(u.type==="text")Ar(l)||it(141),pZr(s,l);else if(u.type==="element"&&!b){tt(l)||it(259);let _=u.getNode();_.isEmpty()?function(w,T){let O=T.getTextFormat(),E=T.getTextStyle();WLe(w,O,E)}(s,_):WLe(s,0,"")}}else{let c=u.key,d=s.focus.key,f=s.getNodes(),p=f.length,m=s.isBackward(),h=m?a:o,y=m?o:a,g=m?d:c,b=m?c:d,_=PXr,w=!1;for(let T=0;T<p;T++){let O=f[T],E=O.getTextContentSize();if(Ar(O)&&E!==0&&!(T===0&&O.__key===g&&h===E||T===p-1&&O.__key===b&&y===0)&&(w=!0,_&=O.getFormat(),_===0))break}s.format=w?_:0}}wr(e,B_t,void 0)})}function WLe(t,e,r){t.format===e&&t.style===r||(t.format=e,t.style=r,t.dirty=!0)}function pZr(t,e){WLe(t,e.getFormat(),e.getStyle())}function mZr(t){if(!t.getTargetRanges)return null;let e=t.getTargetRanges();return e.length===0?null:e[0]}function qLe(t,e){let r=t._compositionKey;if(ag(null),r!==null&&e!=null){if(e===""){let n=yh(r),o=J3(t.getElementByKey(r));return void(o!==null&&o.nodeValue!==null&&Ar(n)&&ivt(n,o.nodeValue,null,null,!0))}if(e[e.length-1]===`
`){let n=qs();if(mn(n)){let o=n.focus;return n.anchor.set(o.key,o.offset,o.type),void wr(t,nFe,null)}}}ovt(!0,t,e)}function hZr(t){let e=t.__lexicalEventHandles;return e===void 0&&(e=[],t.__lexicalEventHandles=e),e}var oY=new Map;function gZr(t){let e=GZr(t.target);if(e===null)return;let r=rvt(e.anchorNode);if(r===null)return;w_t&&(w_t=!1,tS(r,()=>{let u=G3(),l=e.anchorNode;(c_(l)||gN(l))&&$v(_Fe(u,e,r,t))}));let n=nvt(r),o=n[n.length-1],i=o._key,a=oY.get(i),s=a||o;s!==r&&K7r(e,s,!1),K7r(e,r,!0),r!==o?oY.set(i,r):a&&oY.delete(i)}function G7r(t){t._lexicalHandled=!0}function X7r(t){return t._lexicalHandled===!0}var Ymi=()=>{};function Qmi(t){let e=t.ownerDocument,r=oFe.get(e);if(r===void 0)return void Ymi();let n=r-1;n>=0||it(164),oFe.set(e,n),n===0&&e.removeEventListener("selectionchange",gZr);let o=Jde(t);wFe(o)?(function(a){if(a._parentEditor!==null){let s=nvt(a),u=s[s.length-1]._key;oY.get(u)===a&&oY.delete(u)}else oY.delete(a._key)}(o),t.__lexicalEditor=null):o&&it(198);let i=hZr(t);for(let a=0;a<i.length;a++)i[a]();t.__lexicalEventHandles=[]}function S_t(t,e,r){ig();let n=t.__key,o=t.getParent();if(o===null)return;let i=function(s){let u=qs();if(!mn(u)||!tt(s))return u;let{anchor:l,focus:c}=u,d=l.getNode(),f=c.getNode();return fFe(d,s)&&l.set(s.__key,0,"element"),fFe(f,s)&&c.set(s.__key,0,"element"),u}(t),a=!1;if(mn(i)&&e){let s=i.anchor,u=i.focus;s.key===n&&(sFe(s,t,o,t.getPreviousSibling(),t.getNextSibling()),a=!0),u.key===n&&(sFe(u,t,o,t.getPreviousSibling(),t.getNextSibling()),a=!0)}else bFe(i)&&e&&t.isSelected()&&t.selectPrevious();if(mn(i)&&e&&!a){let s=t.getIndexWithinParent();NU(t),aFe(i,o,s,-1)}else NU(t);r||xT(o)||o.canBeEmpty()||!o.isEmpty()||S_t(o,e),e&&i&&Nv(o)&&o.isEmpty()&&o.selectEnd()}function ehi(t){return t}var jU=class{static getType(){let{ownNodeType:e}=dvt(this);return e===void 0&&it(64,this.name),e}static clone(e){it(65,this.name)}$config(){return{}}config(e,r){let n=r.extends||Object.getPrototypeOf(this.constructor);return Object.assign(r,{extends:n,type:e}),{[e]:r}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),jZr(this,e)}getType(){return this.__type}isInline(){it(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;let r=yh(e);if(r===null)break;e=r.__parent}return!1}isSelected(e){let r=e||qs();if(r==null)return!1;let n=r.getNodes().some(o=>o.__key===this.__key);if(Ar(this))return n;if(mn(r)&&r.anchor.type==="element"&&r.focus.type==="element"){if(r.isCollapsed())return!1;let o=this.getParent();if(Hu(this)&&this.isInline()&&o){let i=r.isBackward()?r.focus:r.anchor;if(o.is(i.getNode())&&i.offset===o.getChildrenSize()&&this.is(o.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let r=e.getFirstChild(),n=0;for(;r!==null;){if(this.is(r))return n;n++,r=r.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:yh(e)}getParentOrThrow(){let e=this.getParent();return e===null&&it(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let r=e.getParent();if(xT(r))return tt(e)||e===this&&Hu(e)||it(194),e;e=r}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&it(67,this.__key),e}getParents(){let e=[],r=this.getParent();for(;r!==null;)e.push(r),r=r.getParent();return e}getParentKeys(){let e=[],r=this.getParent();for(;r!==null;)e.push(r.__key),r=r.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:yh(e)}getPreviousSiblings(){let e=[],r=this.getParent();if(r===null)return e;let n=r.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:yh(e)}getNextSiblings(){let e=[],r=this.getNextSibling();for(;r!==null;)e.push(r),r=r.getNextSibling();return e}getCommonAncestor(e){let r=tt(this)?this:this.getParent(),n=tt(e)?e:e.getParent(),o=r&&n?Nde(r,n):null;return o?o.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let r=Nde(this,e);return r!==null&&(r.type==="descendant"||(r.type==="branch"?gvt(r)===-1:(r.type!=="same"&&r.type!=="ancestor"&&it(279),!1)))}isParentOf(e){let r=Nde(this,e);return r!==null&&r.type==="ancestor"}getNodesBetween(e){let r=this.isBefore(e),n=[],o=new Set,i=this;for(;i!==null;){let a=i.__key;if(o.has(a)||(o.add(a),n.push(i)),i===e)break;let s=tt(i)?r?i.getFirstChild():i.getLastChild():null;if(s!==null){i=s;continue}let u=r?i.getNextSibling():i.getPreviousSibling();if(u!==null){i=u;continue}let l=i.getParentOrThrow();if(o.has(l.__key)||n.push(l),l===e)break;let c=null,d=l;do{if(d===null&&it(68),c=r?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;c!==null||o.has(d.__key)||n.push(d)}while(c===null);i=c}return r||n.reverse(),n}isDirty(){let e=dc()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){let e=yh(this.__key);return e===null&&it(113),e}getWritable(){ig();let e=cL(),r=dc(),n=e._nodeMap,o=this.__key,i=this.getLatest(),a=r._cloneNotNeeded,s=qs();if(s!==null&&s.setCachedNodes(null),a.has(o))return dFe(i),i;let u=YZr(i);return a.add(o),dFe(u),n.set(o,u),u}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,r){it(70)}updateDOM(e,r,n){it(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){it(18,this.name)}updateFromJSON(e){return function(r,n){let o=r.getWritable(),i=n.$,a=i;for(let s of $Xr(o).flatKeys)s in n&&(a!==void 0&&a!==i||(a={...i}),a[s]=n[s]);return(o.__state||a)&&q_t(r).updateFromJSON(a),o}(this,e)}static transform(){return null}remove(e){S_t(this,!0,e)}replace(e,r){ig();let n=qs();n!==null&&(n=n.clone()),r_t(this,e);let o=this.getLatest(),i=this.__key,a=e.__key,s=e.getWritable(),u=this.getParentOrThrow().getWritable(),l=u.__size;NU(s);let c=o.getPreviousSibling(),d=o.getNextSibling(),f=o.__prev,p=o.__next,m=o.__parent;if(S_t(o,!1,!0),c===null?u.__first=a:c.getWritable().__next=a,s.__prev=f,d===null?u.__last=a:d.getWritable().__prev=a,s.__next=p,s.__parent=m,u.__size=l,r&&(tt(this)&&tt(s)||it(139),this.getChildren().forEach(h=>{s.append(h)})),mn(n)){$v(n);let h=n.anchor,y=n.focus;h.key===i&&eXr(h,s),y.key===i&&eXr(y,s)}return IU()===i&&ag(a),s}insertAfter(e,r=!0){ig(),r_t(this,e);let n=this.getWritable(),o=e.getWritable(),i=o.getParent(),a=qs(),s=!1,u=!1;if(i!==null){let p=e.getIndexWithinParent();if(NU(o),mn(a)){let m=i.__key,h=a.anchor,y=a.focus;s=h.type==="element"&&h.key===m&&h.offset===p+1,u=y.type==="element"&&y.key===m&&y.offset===p+1}}let l=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),d=o.__key,f=n.__next;if(l===null?c.__last=d:l.getWritable().__prev=d,c.__size++,n.__next=d,o.__next=f,o.__prev=n.__key,o.__parent=n.__parent,r&&mn(a)){let p=this.getIndexWithinParent();aFe(a,c,p+1);let m=c.__key;s&&a.anchor.set(m,p+2,"element"),u&&a.focus.set(m,p+2,"element")}return e}insertBefore(e,r=!0){ig(),r_t(this,e);let n=this.getWritable(),o=e.getWritable(),i=o.__key;NU(o);let a=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),u=n.__prev,l=this.getIndexWithinParent();a===null?s.__first=i:a.getWritable().__next=i,s.__size++,n.__prev=i,o.__prev=u,o.__next=n.__key,o.__parent=n.__parent;let c=qs();return r&&mn(c)&&aFe(c,this.getParentOrThrow(),l),e}isParentRequired(){return!1}createParentElementNode(){return aL()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,r){ig();let n=this.getPreviousSibling(),o=this.getParentOrThrow();if(n===null)return o.select(0,0);if(tt(n))return n.select();if(!Ar(n)){let i=n.getIndexWithinParent()+1;return o.select(i,i)}return n.select(e,r)}selectNext(e,r){ig();let n=this.getNextSibling(),o=this.getParentOrThrow();if(n===null)return o.select();if(tt(n))return n.select(0,0);if(!Ar(n)){let i=n.getIndexWithinParent();return o.select(i,i)}return n.select(e,r)}markDirty(){this.getWritable()}reconcileObservedMutation(e,r){this.markDirty()}},uY=class t extends jU{static getType(){return"linebreak"}static clone(e){return new t(e.__key)}constructor(e){super(e)}getTextContent(){return`
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(r){let n=r.parentElement;if(n!==null&&P_t(n)){let o=n.firstChild;if(o===r||o.nextSibling===r&&BLe(o)){let i=n.lastChild;if(i===r||i.previousSibling===r&&BLe(i))return!0}}return!1}(e)||function(r){let n=r.parentElement;if(n!==null&&P_t(n)){let o=n.firstChild;if(o===r||o.nextSibling===r&&BLe(o))return!1;let i=n.lastChild;if(i===r||i.previousSibling===r&&BLe(i))return!0}return!1}(e)?null:{conversion:thi,priority:0}}}static importJSON(e){return lY().updateFromJSON(e)}};function thi(t){return{node:lY()}}function lY(){return Gde(new uY)}function B3(t){return t instanceof uY}function BLe(t){return gN(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function Zbt(t,e){return 16&e?"code":e&mFe?"mark":32&e?"sub":64&e?"sup":null}function Ybt(t,e){return 1&e?"strong":2&e?"em":"span"}function yZr(t,e,r,n,o){let i=n.classList,a=iY(o,"base");a!==void 0&&i.add(...a),a=iY(o,"underlineStrikethrough");let s=!1,u=e&Lde&&e&$de;a!==void 0&&(r&Lde&&r&$de?(s=!0,u||i.add(...a)):u&&i.remove(...a));for(let l in lb){let c=lb[l];if(a=iY(o,l),a!==void 0)if(r&c){if(s&&(l==="underline"||l==="strikethrough")){e&c&&i.remove(...a);continue}e&c&&(!u||l!=="underline")&&l!=="strikethrough"||i.add(...a)}else e&c&&i.remove(...a)}}function bZr(t,e,r){let n=e.firstChild,o=r.isComposing(),i=t+(o?hFe:"");if(n==null)e.textContent=i;else{let a=n.nodeValue;if(a!==i)if(o||U3){let[s,u,l]=function(c,d){let f=c.length,p=d.length,m=0,h=0;for(;m<f&&m<p&&c[m]===d[m];)m++;for(;h+m<f&&h+m<p&&c[f-h-1]===d[p-h-1];)h++;return[m,f-m-h,d.slice(m,p-h)]}(a,i);u!==0&&n.deleteData(s,u),n.insertData(s,l)}else n.nodeValue=i}}function Z7r(t,e,r,n,o,i){bZr(o,t,e);let a=i.theme.text;a!==void 0&&yZr(0,0,n,t,a)}function ULe(t,e){let r=document.createElement(e);return r.appendChild(t),r}var H3=class t extends jU{static getType(){return"text"}static clone(e){return new t(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e="",r){super(r),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return Mmi[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===IU()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let r=lb[e];return!!(this.getFormat()&r)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,r){return cFe(this.getLatest().__format,e,r)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,r){let n=this.__format,o=Zbt(0,n),i=Ybt(0,n),a=o===null?i:o,s=document.createElement(a),u=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),o!==null&&(u=document.createElement(i),s.appendChild(u)),Z7r(u,this,0,n,this.__text,e);let l=this.__style;return l!==""&&(s.style.cssText=l),s}updateDOM(e,r,n){let o=this.__text,i=e.__format,a=this.__format,s=Zbt(0,i),u=Zbt(0,a),l=Ybt(0,i),c=Ybt(0,a);if((s===null?l:s)!==(u===null?c:u))return!0;if(s===u&&l!==c){let h=r.firstChild;h==null&&it(48);let y=document.createElement(c);return Z7r(y,this,0,a,o,n),r.replaceChild(y,h),!1}let d=r;u!==null&&s!==null&&(d=r.firstChild,d==null&&it(49)),bZr(o,d,this);let f=n.theme.text;f!==void 0&&i!==a&&yZr(0,i,a,d,f);let p=e.__style,m=this.__style;return p!==m&&(r.style.cssText=m),!1}static importDOM(){return{"#text":()=>({conversion:ihi,priority:0}),b:()=>({conversion:nhi,priority:0}),code:()=>({conversion:eL,priority:0}),em:()=>({conversion:eL,priority:0}),i:()=>({conversion:eL,priority:0}),mark:()=>({conversion:eL,priority:0}),s:()=>({conversion:eL,priority:0}),span:()=>({conversion:rhi,priority:0}),strong:()=>({conversion:eL,priority:0}),sub:()=>({conversion:eL,priority:0}),sup:()=>({conversion:eL,priority:0}),u:()=>({conversion:eL,priority:0})}}static importJSON(e){return og().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:r}=super.exportDOM(e);return c_(r)||it(132),r.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?r.style.textTransform="lowercase":this.hasFormat("uppercase")?r.style.textTransform="uppercase":this.hasFormat("capitalize")&&(r.style.textTransform="capitalize"),this.hasFormat("bold")&&(r=ULe(r,"b")),this.hasFormat("italic")&&(r=ULe(r,"i")),this.hasFormat("strikethrough")&&(r=ULe(r,"s")),this.hasFormat("underline")&&(r=ULe(r,"u")),{element:r}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,r){}setFormat(e){let r=this.getWritable();return r.__format=typeof e=="string"?lb[e]:e,r}setDetail(e){let r=this.getWritable();return r.__detail=typeof e=="string"?Omi[e]:e,r}setStyle(e){let r=this.getWritable();return r.__style=e,r}toggleFormat(e){let r=cFe(this.getFormat(),e,null);return this.setFormat(r)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let r=Pmi[e];if(this.__mode===r)return this;let n=this.getWritable();return n.__mode=r,n}setTextContent(e){if(this.__text===e)return this;let r=this.getWritable();return r.__text=e,r}select(e,r){ig();let n=e,o=r,i=qs(),a=this.getTextContent(),s=this.__key;if(typeof a=="string"){let u=a.length;n===void 0&&(n=u),o===void 0&&(o=u)}else n=0,o=0;if(!mn(i))return wZr(s,n,s,o,"text","text");{let u=IU();u!==i.anchor.key&&u!==i.focus.key||ag(s),i.setTextNodeRange(this,n,this,o)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,r,n,o){let i=this.getWritable(),a=i.__text,s=n.length,u=e;u<0&&(u=s+u,u<0&&(u=0));let l=qs();if(o&&mn(l)){let d=e+s;l.setTextNodeRange(i,d,i,d)}let c=a.slice(0,u)+n+a.slice(u+r);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){ig();let r=this.getLatest(),n=r.getTextContent();if(n==="")return[];let o=r.__key,i=IU(),a=n.length;e.sort((P,R)=>P-R),e.push(a);let s=[],u=e.length;for(let P=0,R=0;P<a&&R<=u;R++){let I=e[R];I>P&&(s.push(n.slice(P,I)),P=I)}let l=s.length;if(l===1)return[r];let c=s[0],d=r.getParent(),f,p=r.getFormat(),m=r.getStyle(),h=r.__detail,y=!1,g=null,b=null,_=qs();if(mn(_)){let[P,R]=_.isBackward()?[_.focus,_.anchor]:[_.anchor,_.focus];P.type==="text"&&P.key===o&&(g=P),R.type==="text"&&R.key===o&&(b=R)}r.isSegmented()?(f=og(c),f.__format=p,f.__style=m,f.__detail=h,f.__state=B7r(r,f),y=!0):f=r.setTextContent(c);let w=[f];for(let P=1;P<l;P++){let R=og(s[P]);R.__format=p,R.__style=m,R.__detail=h,R.__state=B7r(r,R);let I=R.__key;i===o&&ag(I),w.push(R)}let T=g?g.offset:null,O=b?b.offset:null,E=0;for(let P of w){if(!g&&!b)break;let R=E+P.getTextContentSize();if(g!==null&&T!==null&&T<=R&&T>=E&&(g.set(P.getKey(),T-E,"text"),T<R&&(g=null)),b!==null&&O!==null&&O<=R&&O>=E){b.set(P.getKey(),O-E,"text");break}E=R}if(d!==null){(function(I){let A=I.getPreviousSibling(),B=I.getNextSibling();A!==null&&dFe(A),B!==null&&dFe(B)})(this);let P=d.getWritable(),R=this.getIndexWithinParent();y?(P.splice(R,0,w),this.remove()):P.splice(R,1,w),mn(_)&&aFe(_,d,R,l-1)}return w}mergeWithSibling(e){let r=e===this.getPreviousSibling();r||e===this.getNextSibling()||it(50);let n=this.__key,o=e.__key,i=this.__text,a=i.length;IU()===o&&ag(n);let s=qs();if(mn(s)){let d=s.anchor,f=s.focus;d!==null&&d.key===o&&sXr(d,r,n,e,a),f!==null&&f.key===o&&sXr(f,r,n,e,a)}let u=e.__text,l=r?u+i:i+u;this.setTextContent(l);let c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}};function rhi(t){return{forChild:J_t(t.style),node:null}}function nhi(t){let e=t,r=e.style.fontWeight==="normal";return{forChild:J_t(e.style,r?void 0:"bold"),node:null}}var Y7r=new WeakMap;function ohi(t){if(!c_(t))return!1;if(t.nodeName==="PRE")return!0;let e=t.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function ihi(t){let e=t;t.parentElement===null&&it(129);let r=e.textContent||"";if(function(n){let o,i=n.parentNode,a=[n];for(;i!==null&&(o=Y7r.get(i))===void 0&&!ohi(i);)a.push(i),i=i.parentNode;let s=o===void 0?i:o;for(let u=0;u<a.length;u++)Y7r.set(a[u],s);return s}(e)!==null){let n=r.split(/(\r?\n|\t)/),o=[],i=n.length;for(let a=0;a<i;a++){let s=n[a];s===`
`||s===`\r
`?o.push(lY()):s==="	"?o.push(yFe()):s!==""&&o.push(og(s))}return{node:o}}if(r=r.replace(/\r/g,"").replace(/[ \t\n]+/g," "),r==="")return{node:null};if(r[0]===" "){let n=e,o=!0;for(;n!==null&&(n=Q7r(n,!1))!==null;){let i=n.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(r=r.slice(1)),o=!1;break}}o&&(r=r.slice(1))}if(r[r.length-1]===" "){let n=e,o=!0;for(;n!==null&&(n=Q7r(n,!0))!==null;)if((n.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){o=!1;break}o&&(r=r.slice(0,r.length-1))}return r===""?{node:null}:{node:og(r)}}function Q7r(t,e){let r=t;for(;;){let n;for(;(n=e?r.nextSibling:r.previousSibling)===null;){let i=r.parentElement;if(i===null)return null;r=i}if(r=n,c_(r)){let i=r.style.display;if(i===""&&!ZZr(r)||i!==""&&!i.startsWith("inline"))return null}let o=r;for(;(o=e?r.firstChild:r.lastChild)!==null;)r=o;if(gN(r))return r;if(r.nodeName==="BR")return null}}var ahi={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function eL(t){let e=ahi[t.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:J_t(t.style,e),node:null}}function og(t=""){return Gde(new H3(t))}function Ar(t){return t instanceof H3}function J_t(t,e){let r=t.fontWeight,n=t.textDecoration.split(" "),o=r==="700"||r==="bold",i=n.includes("line-through"),a=t.fontStyle==="italic",s=n.includes("underline"),u=t.verticalAlign;return l=>(Ar(l)&&(o&&!l.hasFormat("bold")&&l.toggleFormat("bold"),i&&!l.hasFormat("strikethrough")&&l.toggleFormat("strikethrough"),a&&!l.hasFormat("italic")&&l.toggleFormat("italic"),s&&!l.hasFormat("underline")&&l.toggleFormat("underline"),u!=="sub"||l.hasFormat("subscript")||l.toggleFormat("subscript"),u!=="super"||l.hasFormat("superscript")||l.toggleFormat("superscript"),e&&!l.hasFormat(e)&&l.toggleFormat(e)),l)}var cY=class t extends H3{static getType(){return"tab"}static clone(e){return new t(e.__key)}constructor(e){super("	",e),this.__detail=2}static importDOM(){return null}createDOM(e){let r=super.createDOM(e),n=iY(e.theme,"tab");return n!==void 0&&r.classList.add(...n),r}static importJSON(e){return yFe().updateFromJSON(e)}setTextContent(e){return e!=="	"&&e!==""&&it(126),super.setTextContent("	")}spliceText(e,r,n,o){return n===""&&r===0||n==="	"&&r===1||it(286),this}setDetail(e){return e!==2&&it(127),this}setMode(e){return e!=="normal"&&it(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function yFe(){return Gde(new cY)}function K_t(t){return t instanceof cY}var C_t=class{constructor(e,r,n){this._selection=null,this.key=e,this.offset=r,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:hvt(_T(kU(this,"next")),_T(kU(e,"next")))<0}getNode(){let e=yh(this.key);return e===null&&it(20),e}set(e,r,n,o){let i=this._selection,a=this.key;o&&this.key===e&&this.offset===r&&this.type===n||(this.key=e,this.offset=r,this.type=n,vY()||(IU()===a&&ag(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0)))}};function CT(t,e,r){return new C_t(t,e,r)}function Qbt(t,e){let r=e.__key,n=t.offset,o="element";if(Ar(e)){o="text";let i=e.getTextContentSize();n>i&&(n=i)}else if(!tt(e)){let i=e.getNextSibling();if(Ar(i))r=i.__key,n=0,o="text";else{let a=e.getParent();a&&(r=a.__key,n=e.getIndexWithinParent()+1)}}t.set(r,n,o)}function eXr(t,e){if(tt(e)){let r=e.getLastDescendant();tt(r)||Ar(r)?Qbt(t,r):Qbt(t,e)}else Qbt(t,e)}var iFe=class t{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!bFe(e))return!1;let r=this._nodes,n=e._nodes;return r.size===n.size&&Array.from(r).every(o=>n.has(o))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new t(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let r=this.getNodes(),n=r.length,o=r[n-1],i;if(Ar(o))i=o.select();else{let a=o.getIndexWithinParent()+1;i=o.getParentOrThrow().select(a,a)}i.insertNodes(e);for(let a=0;a<n;a++)r[a].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let r=this._nodes,n=[];for(let o of r){let i=yh(o);i!==null&&n.push(i)}return vY()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),r="";for(let n=0;n<e.length;n++)r+=e[n].getTextContent();return r}deleteNodes(){let e=this.getNodes();if((qs()||G3())===this&&e[0]){let r=lg(e[0],"next");nYr(FU(r,r))}for(let r of e)r.remove()}};function mn(t){return t instanceof W3}var W3=class t{constructor(e,r,n,o){this.anchor=e,this.focus=r,e._selection=this,r._selection=this,this._cachedNodes=null,this.format=n,this.style=o,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!mn(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let r=function(n){let o=[],[i,a]=n.getTextSlices();i&&o.push(i.caret.origin);let s=new Set,u=new Set;for(let l of n)if(wT(l)){let{origin:c}=l;o.length===0?s.add(c):(u.add(c),o.push(c))}else{let{origin:c}=l;tt(c)&&u.has(c)||o.push(c)}if(a&&o.push(a.caret.origin),K3(n.focus)&&tt(n.focus.origin)&&n.focus.getNodeAtCaret()===null)for(let l=lL(n.focus.origin,"previous");wT(l)&&s.has(l.origin)&&!l.origin.isEmpty()&&l.origin.is(o[o.length-1]);l=bY(l))s.delete(l.origin),o.pop();for(;o.length>1;){let l=o[o.length-1];if(!tt(l)||u.has(l)||l.isEmpty()||s.has(l))break;o.pop()}if(o.length===0&&n.isCollapsed()){let l=_T(n.anchor),c=_T(n.anchor.getFlipped()),d=p=>sL(p)?p.origin:p.getNodeAtCaret(),f=d(l)||d(c)||(n.anchor.getNodeAtCaret()?l.origin:c.origin);o.push(f)}return o}(yvt(A_t(this),"next"));return vY()||(this._cachedNodes=r),r}setTextNodeRange(e,r,n,o){this.anchor.set(e.__key,r,"text"),this.focus.set(n.__key,o,"text")}getTextContent(){let e=this.getNodes();if(e.length===0)return"";let r=e[0],n=e[e.length-1],o=this.anchor,i=this.focus,a=o.isBefore(i),[s,u]=x_t(this),l="",c=!0;for(let d=0;d<e.length;d++){let f=e[d];if(tt(f)&&!f.isInline())c||(l+=`
`),c=!f.isEmpty();else if(c=!1,Ar(f)){let p=f.getTextContent();f===r?f===n?o.type==="element"&&i.type==="element"&&i.offset!==o.offset||(p=s<u?p.slice(s,u):p.slice(u,s)):p=a?p.slice(s):p.slice(u):f===n&&(p=a?p.slice(0,u):p.slice(0,s)),l+=p}else!Hu(f)&&!B3(f)||f===n&&this.isCollapsed()||(l+=f.getTextContent())}return l}applyDOMRange(e){let r=dc(),n=r.getEditorState()._selection,o=vZr(e.startContainer,e.startOffset,e.endContainer,e.endOffset,r,n);if(o===null)return;let[i,a]=o;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(a.key,a.offset,a.type,!0),QLe(this)}clone(){let e=this.anchor,r=this.focus;return new t(CT(e.key,e.offset,e.type),CT(r.key,r.offset,r.type),this.format,this.style)}toggleFormat(e){this.format=cFe(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let r=lb[e];return!!(this.format&r)}insertRawText(e){let r=e.split(/(\r?\n|\t)/),n=[],o=r.length;for(let i=0;i<o;i++){let a=r[i];a===`
`||a===`\r
`?n.push(lY()):a==="	"?n.push(yFe()):n.push(og(a))}this.insertNodes(n)}insertText(e){let r=this.anchor,n=this.focus,o=this.format,i=this.style,a=r,s=n;!this.isCollapsed()&&n.isBefore(r)&&(a=n,s=r),a.type==="element"&&function(y,g,b,_){let w=y.getNode(),T=w.getChildAtIndex(y.offset),O=og(),E=Nv(w)?aL().append(O):O;O.setFormat(b),O.setStyle(_),T===null?w.append(E):T.insertBefore(E),y.is(g)&&g.set(O.__key,0,"text"),y.set(O.__key,0,"text")}(a,s,o,i),s.type==="element"&&_Y(s,_T(kU(s,"next")));let u=a.offset,l=s.offset,c=this.getNodes(),d=c.length,f=c[0];Ar(f)||it(26);let p=f.getTextContent().length,m=f.getParentOrThrow(),h=c[d-1];if(d===1&&s.type==="element"&&(l=p,s.set(a.key,l,"text")),this.isCollapsed()&&u===p&&(rL(f)||!f.canInsertTextAfter()||!m.canInsertTextAfter()&&f.getNextSibling()===null)){let y=f.getNextSibling();if(Ar(y)&&y.canInsertTextBefore()&&!rL(y)||(y=og(),y.setFormat(o),y.setStyle(i),m.canInsertTextAfter()?f.insertAfter(y):m.insertAfter(y)),y.select(0,0),f=y,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&u===0&&(rL(f)||!f.canInsertTextBefore()||!m.canInsertTextBefore()&&f.getPreviousSibling()===null)){let y=f.getPreviousSibling();if(Ar(y)&&!rL(y)||(y=og(),y.setFormat(o),m.canInsertTextBefore()?f.insertBefore(y):m.insertBefore(y)),y.select(),f=y,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&u!==p){let y=og(f.getTextContent());y.setFormat(o),f.replace(y),f=y}else if(!this.isCollapsed()&&e!==""){let y=h.getParent();if(!m.canInsertTextBefore()||!m.canInsertTextAfter()||tt(y)&&(!y.canInsertTextBefore()||!y.canInsertTextAfter()))return this.insertText(""),_Zr(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(AU(f)){let _=og(e);return _.select(),void f.replace(_)}let y=f.getFormat(),g=f.getStyle();if(u!==l||y===o&&g===i){if(K_t(f)){let _=og(e);return _.setFormat(o),_.setStyle(i),_.select(),void f.replace(_)}}else{if(f.getTextContent()!==""){let _=og(e);if(_.setFormat(o),_.setStyle(i),_.select(),u===0)f.insertBefore(_,!1);else{let[w]=f.splitText(u);w.insertAfter(_,!1)}return void(_.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(o),f.setStyle(i)}let b=l-u;f=f.spliceText(u,b,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=y,this.style=g))}else{let y=new Set([...f.getParentKeys(),...h.getParentKeys()]),g=tt(f)?f:f.getParentOrThrow(),b=tt(h)?h:h.getParentOrThrow(),_=h;if(!g.is(b)&&b.isInline())do _=b,b=b.getParentOrThrow();while(b.isInline());if(s.type==="text"&&(l!==0||h.getTextContent()==="")||s.type==="element"&&h.getIndexWithinParent()<l)if(Ar(h)&&!AU(h)&&l!==h.getTextContentSize()){if(h.isSegmented()){let P=og(h.getTextContent());h.replace(P),h=P}Nv(s.getNode())||s.type!=="text"||(h=h.spliceText(0,l,"")),y.add(h.__key)}else{let P=h.getParentOrThrow();P.canBeEmpty()||P.getChildrenSize()!==1?h.remove():P.remove()}else y.add(h.__key);let w=b.getChildren(),T=new Set(c),O=g.is(b),E=g.isInline()&&f.getNextSibling()===null?g:f;for(let P=w.length-1;P>=0;P--){let R=w[P];if(R.is(f)||tt(R)&&R.isParentOf(f))break;R.isAttached()&&(!T.has(R)||R.is(_)?O||E.insertAfter(R,!1):R.remove())}if(!O){let P=b,R=null;for(;P!==null;){let I=P.getChildren(),A=I.length;(A===0||I[A-1].is(R))&&(y.delete(P.__key),R=P),P=P.getParent()}}if(AU(f))if(u===p)f.select();else{let P=og(e);P.select(),f.replace(P)}else f=f.spliceText(u,p-u,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let P=1;P<d;P++){let R=c[P],I=R.__key;y.has(I)||R.remove()}}}removeText(){let e=qs()===this;Dde(this,oYr(A_t(this))),e&&qs()!==this&&$v(this)}formatText(e,r=null){if(this.isCollapsed())return this.toggleFormat(e),void ag(null);let n=this.getNodes(),o=[];for(let w of n)Ar(w)&&o.push(w);let i=w=>{n.forEach(T=>{if(tt(T)){let O=T.getFormatFlags(e,w);T.setTextFormat(O)}})},a=o.length;if(a===0)return this.toggleFormat(e),ag(null),void i(r);let s=this.anchor,u=this.focus,l=this.isBackward(),c=l?u:s,d=l?s:u,f=0,p=o[0],m=c.type==="element"?0:c.offset;if(c.type==="text"&&m===p.getTextContentSize()&&(f=1,p=o[1],m=0),p==null)return;let h=p.getFormatFlags(e,r);i(h);let y=a-1,g=o[y],b=d.type==="text"?d.offset:g.getTextContentSize();if(p.is(g)){if(m===b)return;if(rL(p)||m===0&&b===p.getTextContentSize())p.setFormat(h);else{let w=p.splitText(m,b),T=m===0?w[0]:w[1];T.setFormat(h),c.type==="text"&&c.set(T.__key,0,"text"),d.type==="text"&&d.set(T.__key,b-m,"text")}return void(this.format=h)}m===0||rL(p)||([,p]=p.splitText(m),m=0),p.setFormat(h);let _=g.getFormatFlags(e,h);b>0&&(b===g.getTextContentSize()||rL(g)||([g]=g.splitText(b)),g.setFormat(_));for(let w=f+1;w<y;w++){let T=o[w],O=T.getFormatFlags(e,_);T.setFormat(O)}c.type==="text"&&c.set(p.__key,m,"text"),d.type==="text"&&d.set(g.__key,b,"text"),this.format=h|_}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let m=qs();return mn(m)||it(134),m.insertNodes(e)}let r=(this.isBackward()?this.focus:this.anchor).getNode(),n=o_t(r,iL),o=e[e.length-1];if(tt(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{let m=e_t(this);n.splice(m,0,e),o.selectEnd()}return}if(!e.some(m=>(tt(m)||Hu(m))&&!m.isInline())){tt(n)||it(211,r.constructor.name,r.getType());let m=e_t(this);return n.splice(m,0,e),void o.selectEnd()}let i=function(m){let h=aL(),y=null;for(let g=0;g<m.length;g++){let b=m[g],_=B3(b);if(_||Hu(b)&&b.isInline()||tt(b)&&b.isInline()||Ar(b)||b.isParentRequired()){if(y===null&&(y=b.createParentElementNode(),h.append(y),_))continue;y!==null&&y.append(b)}else h.append(b),y=null}return h}(e),a=i.getLastDescendant(),s=i.getChildren(),u=!tt(n)||!n.isEmpty()?this.insertParagraph():null,l=s[s.length-1],c=s[0];var d;tt(d=c)&&iL(d)&&!d.isEmpty()&&tt(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(tt(n)||it(211,r.constructor.name,r.getType()),n.append(...c.getChildren()),c=s[1]),c&&(n===null&&it(212,r.constructor.name,r.getType()),function(m,h,y){let g=h.getParentOrThrow().getLastChild(),b=h,_=[h];for(;b!==g;)b.getNextSibling()||it(140),b=b.getNextSibling(),_.push(b);let w=m;for(let T of _)w=w.insertAfter(T)}(n,c));let f=o_t(a,iL);u&&tt(f)&&(u.canMergeWhenEmpty()||iL(l))&&(f.append(...u.getChildren()),u.remove()),tt(n)&&n.isEmpty()&&n.remove(),a.selectEnd();let p=tt(n)?n.getLastChild():null;B3(p)&&f!==n&&p.remove()}insertParagraph(){if(this.anchor.key==="root"){let a=aL();return jv().splice(this.anchor.offset,0,[a]),a.select(),a}let e=e_t(this),r=o_t(this.anchor.getNode(),iL);tt(r)||it(213);let n=r.getChildAtIndex(e),o=n?[n,...n.getNextSiblings()]:[],i=r.insertNewAfter(this,!1);return i?(i.append(...o),i.selectStart(),i):null}insertLineBreak(e){let r=lY();if(this.insertNodes([r]),e){let n=r.getParentOrThrow(),o=r.getIndexWithinParent();n.select(o,o)}}extract(){let e=this.getNodes(),r=e.length,n=r-1,o=this.anchor,i=this.focus,a=e[0],s=e[n],[u,l]=x_t(this);if(r===0)return[];if(r===1){if(Ar(a)&&!this.isCollapsed()){let d=u>l?l:u,f=u>l?u:l,p=a.splitText(d,f),m=d===0?p[0]:p[1];return m!=null?[m]:[]}return[a]}let c=o.isBefore(i);if(Ar(a)){let d=c?u:l;d===a.getTextContentSize()?e.shift():d!==0&&([,a]=a.splitText(d),e[0]=a)}if(Ar(s)){let d=s.getTextContent().length,f=c?l:u;f===0?e.pop():f!==d&&([s]=s.splitText(f),e[n]=s)}return e}modify(e,r,n){if(uXr(this,e,r,n))return;let o=e==="move",i=dc(),a=hN(fC(i));if(!a)return;let s=i._blockCursorElement,u=i._rootElement,l=this.focus.getNode();if(u===null||s===null||!tt(l)||l.isInline()||l.canBeEmpty()||E_t(s,i,u),this.dirty){let c=mY(i,this.anchor.key),d=mY(i,this.focus.key);this.anchor.type==="text"&&(c=J3(c)),this.focus.type==="text"&&(d=J3(d)),c&&d&&CZr(a,c,this.anchor.offset,d,this.focus.offset)}if(function(c,d,f,p){c.modify(d,f,p)}(a,e,r?"backward":"forward",n),a.rangeCount>0){let c=a.getRangeAt(0),d=this.anchor.getNode(),f=Nv(d)?d:JZr(d);if(this.applyDOMRange(c),this.dirty=!0,!o){let p=this.getNodes(),m=[],h=!1;for(let y=0;y<p.length;y++){let g=p[y];fFe(g,f)?m.push(g):h=!0}if(h&&m.length>0)if(r){let y=m[0];tt(y)?y.selectStart():y.getParentOrThrow().selectStart()}else{let y=m[m.length-1];tt(y)?y.selectEnd():y.getParentOrThrow().selectEnd()}a.anchorNode===c.startContainer&&a.anchorOffset===c.startOffset||function(y){let g=y.focus,b=y.anchor,_=b.key,w=b.offset,T=b.type;b.set(g.key,g.offset,g.type,!0),g.set(_,w,T,!0)}(this)}}n==="lineboundary"&&uXr(this,e,r,n,"decorators")}forwardDeletion(e,r,n){if(!n&&(e.type==="element"&&tt(r)&&e.offset===r.getChildrenSize()||e.type==="text"&&e.offset===r.getTextContentSize())){let o=r.getParent(),i=r.getNextSibling()||(o===null?null:o.getNextSibling());if(tt(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){let r=this.isCollapsed();if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,e))return;let i=pvt(kU(n,e?"previous":"next"));if(i.getTextSlices().every(s=>s===null||s.distance===0)){let s={type:"initial"};for(let u of i.iterNodeCarets("shadowRoot"))if(wT(u)){if(!u.origin.isInline()){if(u.origin.isShadowRoot()){if(s.type==="merge-block")break;if(tt(i.anchor.origin)&&i.anchor.origin.isEmpty()){let l=_T(u);Dde(this,FU(l,l)),i.anchor.origin.remove()}return}s.type!=="merge-next-block"&&s.type!=="merge-block"||(s={block:s.block,caret:u,type:"merge-block"})}}else{if(s.type==="merge-block")break;if(K3(u)){if(tt(u.origin)){if(u.origin.isInline()){if(!u.origin.isParentOf(i.anchor.origin))break}else s={block:u.origin,type:"merge-next-block"};continue}if(Hu(u.origin)){if(!u.origin.isIsolated())if(s.type==="merge-next-block"&&(u.origin.isKeyboardSelectable()||!u.origin.isInline())&&tt(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();let l=G_t();l.add(u.origin.getKey()),$v(l)}else u.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:u,block:l}=s;return Dde(this,FU(!u.origin.isEmpty()&&l.isEmpty()?SY(lg(l,u.direction)):i.anchor,u)),this.removeText()}}let a=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&n.offset===0&&rXr(this,n.getNode()))return}else{let s=a.type==="text"?a.getNode():null;if(o=n.type==="text"?n.getNode():null,s!==null&&s.isSegmented()){let u=a.offset,l=s.getTextContentSize();if(s.is(o)||e&&u!==l||!e&&u!==0)return void nXr(s,e,u)}else if(o!==null&&o.isSegmented()){let u=n.offset,l=o.getTextContentSize();if(o.is(s)||e&&u!==0||!e&&u!==l)return void nXr(o,e,u)}(function(u,l){let c=u.anchor,d=u.focus,f=c.getNode(),p=d.getNode();if(f===p&&c.type==="text"&&d.type==="text"){let m=c.offset,h=d.offset,y=m<h,g=y?m:h,b=y?h:m,_=b-1;g!==_&&function(w){return!(kZr(w)||shi(w))}(f.getTextContent().slice(g,b))&&(l?d.set(d.key,_,d.type):c.set(c.key,_,c.type))}})(this,e)}}if(this.removeText(),e&&!r&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let n=this.anchor.getNode();n.isEmpty()&&Nv(n.getParent())&&n.getPreviousSibling()===null&&rXr(this,n)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){let r=this.anchor,n=r.getNode();if(this.forwardDeletion(r,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function bFe(t){return t instanceof iFe}function tXr(t){let e=t.offset;if(t.type==="text")return e;let r=t.getNode();return e===r.getChildrenSize()?r.getTextContent().length:0}function x_t(t){let e=t.getStartEndPoints();if(e===null)return[0,0];let[r,n]=e;return r.type==="element"&&n.type==="element"&&r.key===n.key&&r.offset===n.offset?[0,0]:[tXr(r),tXr(n)]}function rXr(t,e){for(let r=e;r;r=r.getParent()){if(tt(r)){if(r.collapseAtStart(t))return!0;if(xT(r))break}if(r.getPreviousSibling())break}return!1}var shi=(()=>{try{let t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("\u2764\uFE0F")&&e("#\uFE0F\u20E3")&&e("\u{1F44D}"))return e}catch{}return()=>!1})();function nXr(t,e,r){let n=t,o=n.getTextContent().split(/(?=\s)/g),i=o.length,a=0,s=0;for(let l=0;l<i;l++){let c=l===i-1;if(s=a,a+=o[l].length,e&&a===r||a>r||c){o.splice(l,1),c&&(s=void 0);break}}let u=o.join("").trim();u===""?n.remove():(n.setTextContent(u),n.select(s,s))}function oXr(t,e,r,n){let o,i=e;if(c_(t)){let a=!1,s=t.childNodes,u=s.length,l=n._blockCursorElement;i===u&&(a=!0,i=u-1);let c=s[i],d=!1;if(c===l)c=s[i+1],d=!0;else if(l!==null){let f=l.parentNode;t===f&&e>Array.prototype.indexOf.call(f.children,l)&&i--}if(o=rY(c),Ar(o))i=ST(o,a?"next":"previous");else{let f=rY(t);if(f===null)return null;if(tt(f)){let p=n.getElementByKey(f.getKey());p===null&&it(214),[f,i]=f.getDOMSlot(p).resolveChildIndex(f,p,t,e),tt(f)||it(215),a&&i>=f.getChildrenSize()&&(i=Math.max(0,f.getChildrenSize()-1));let h=f.getChildAtIndex(i);if(tt(h)&&function(y,g,b){let _=y.getParent();return b===null||_===null||!_.canBeEmpty()||_!==b.getNode()}(h,0,r)){let y=a?h.getLastDescendant():h.getFirstDescendant();y===null?f=h:(h=y,f=tt(h)?h:h.getParentOrThrow()),i=0}Ar(h)?(o=h,f=null,i=ST(h,a?"next":"previous")):h!==f&&a&&!d&&(tt(f)||it(216),i=Math.min(f.getChildrenSize(),i+1))}else{let p=f.getIndexWithinParent();i=e===0&&Hu(f)&&rY(t)===f?p:p+1,f=f.getParentOrThrow()}if(tt(f))return CT(f.__key,i,"element")}}else o=rY(t);return Ar(o)?CT(o.__key,ST(o,i,"clamp"),"text"):null}function iXr(t,e,r){let n=t.offset,o=t.getNode();if(n===0){let i=o.getPreviousSibling(),a=o.getParent();if(e){if((r||!e)&&i===null&&tt(a)&&a.isInline()){let s=a.getPreviousSibling();Ar(s)&&t.set(s.__key,s.getTextContent().length,"text")}}else tt(i)&&!r&&i.isInline()?t.set(i.__key,i.getChildrenSize(),"element"):Ar(i)&&t.set(i.__key,i.getTextContent().length,"text")}else if(n===o.getTextContent().length){let i=o.getNextSibling(),a=o.getParent();if(e&&tt(i)&&i.isInline())t.set(i.__key,0,"element");else if((r||e)&&i===null&&tt(a)&&a.isInline()&&!a.canInsertTextAfter()){let s=a.getNextSibling();Ar(s)&&t.set(s.__key,0,"text")}}}function _Zr(t,e,r){if(t.type==="text"&&e.type==="text"){let n=t.isBefore(e),o=t.is(e);iXr(t,n,o),iXr(e,!n,o),o&&e.set(t.key,t.offset,t.type);let i=dc();if(i.isComposing()&&i._compositionKey!==t.key&&mn(r)){let a=r.anchor,s=r.focus;t.set(a.key,a.offset,a.type,!0),e.set(s.key,s.offset,s.type,!0)}}}function vZr(t,e,r,n,o,i){if(t===null||r===null||!Wde(o,t,r))return null;let a=oXr(t,e,mn(i)?i.anchor:null,o);if(a===null)return null;let s=oXr(r,n,mn(i)?i.focus:null,o);if(s===null)return null;if(a.type==="element"&&s.type==="element"){let u=rY(t),l=rY(r);if(Hu(u)&&Hu(l))return null}return _Zr(a,s,i),[a,s]}function uhi(t){return tt(t)&&!t.isInline()}function wZr(t,e,r,n,o,i){let a=cL(),s=new W3(CT(t,e,o),CT(r,n,i),0,"");return s.dirty=!0,a._selection=s,s}function SZr(){let t=CT("root",0,"element"),e=CT("root",0,"element");return new W3(t,e,0,"")}function G_t(){return new iFe(new Set)}function lhi(t,e){return _Fe(null,t,e,null)}function _Fe(t,e,r,n){let o=r._window;if(o===null)return null;let i=n||o.event,a=i?i.type:void 0,s=a==="selectionchange",u=!a_t&&(s||a==="beforeinput"||a==="compositionstart"||a==="compositionend"||a==="click"&&i&&i.detail===3||a==="drop"||a===void 0),l,c,d,f;if(mn(t)&&!u)return t.clone();if(e===null)return null;if(l=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,s&&mn(t)&&!Wde(r,l,c))return t.clone();let p=vZr(l,d,c,f,r,t);if(p===null)return null;let[m,h]=p;return new W3(m,h,mn(t)?t.format:0,mn(t)?t.style:"")}function qs(){return cL()._selection}function G3(){return dc()._editorState._selection}function aFe(t,e,r,n=1){let o=t.anchor,i=t.focus,a=o.getNode(),s=i.getNode();if(!e.is(a)&&!e.is(s))return;let u=e.__key;if(t.isCollapsed()){let l=o.offset;if(r<=l&&n>0||r<l&&n<0){let c=Math.max(0,l+n);o.set(u,c,"element"),i.set(u,c,"element"),aXr(t)}}else{let l=t.isBackward(),c=l?i:o,d=c.getNode(),f=l?o:i,p=f.getNode();if(e.is(d)){let m=c.offset;(r<=m&&n>0||r<m&&n<0)&&c.set(u,Math.max(0,m+n),"element")}if(e.is(p)){let m=f.offset;(r<=m&&n>0||r<m&&n<0)&&f.set(u,Math.max(0,m+n),"element")}}aXr(t)}function aXr(t){let e=t.anchor,r=e.offset,n=t.focus,o=n.offset,i=e.getNode(),a=n.getNode();if(t.isCollapsed()){if(!tt(i))return;let s=i.getChildrenSize(),u=r>=s,l=u?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Ar(l)){let c=0;u&&(c=l.getTextContentSize()),e.set(l.__key,c,"text"),n.set(l.__key,c,"text")}}else{if(tt(i)){let s=i.getChildrenSize(),u=r>=s,l=u?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Ar(l)){let c=0;u&&(c=l.getTextContentSize()),e.set(l.__key,c,"text")}}if(tt(a)){let s=a.getChildrenSize(),u=o>=s,l=u?a.getChildAtIndex(s-1):a.getChildAtIndex(o);if(Ar(l)){let c=0;u&&(c=l.getTextContentSize()),n.set(l.__key,c,"text")}}}}function sFe(t,e,r,n,o){let i=null,a=0,s=null;n!==null?(i=n.__key,Ar(n)?(a=n.getTextContentSize(),s="text"):tt(n)&&(a=n.getChildrenSize(),s="element")):o!==null&&(i=o.__key,Ar(o)?s="text":tt(o)&&(s="element")),i!==null&&s!==null?t.set(i,a,s):(a=e.getIndexWithinParent(),a===-1&&(a=r.getChildrenSize()),t.set(r.__key,a,"element"))}function sXr(t,e,r,n,o){t.type==="text"?t.set(r,t.offset+(e?0:o),"text"):t.offset>n.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element")}function CZr(t,e,r,n,o){try{t.setBaseAndExtent(e,r,n,o)}catch{}}function chi(t,e,r,n,o,i,a){let s=n.anchorNode,u=n.focusNode,l=n.anchorOffset,c=n.focusOffset,d=document.activeElement;if(o.has(MZr)&&d!==i||d!==null&&tvt(d))return;if(!mn(e))return void(t!==null&&Wde(r,s,u)&&n.removeAllRanges());let f=e.anchor,p=e.focus,m=f.key,h=p.key,y=mY(r,m),g=mY(r,h),b=f.offset,_=p.offset,w=e.format,T=e.style,O=e.isCollapsed(),E=y,P=g,R=!1;if(f.type==="text"){E=J3(y);let Z=f.getNode();R=Z.getFormat()!==w||Z.getStyle()!==T}else mn(t)&&t.anchor.type==="text"&&(R=!0);var I,A,B,k,q;if(p.type==="text"&&(P=J3(g)),E!==null&&P!==null&&(O&&(t===null||R||mn(t)&&(t.format!==w||t.style!==T))&&(I=w,A=T,B=b,k=m,q=performance.now(),dZr=[I,A,B,k,q]),l!==b||c!==_||s!==E||u!==P||n.type==="Range"&&O||(d!==null&&i.contains(d)||i.focus({preventScroll:!0}),f.type==="element"))){if(CZr(n,E,b,P,_),!o.has(RZr)&&e.isCollapsed()&&i!==null&&i===document.activeElement){let Z=mn(e)&&e.anchor.type==="element"?E.childNodes[b]||null:n.rangeCount>0?n.getRangeAt(0):null;if(Z!==null){let V;if(Z instanceof Text){let Y=document.createRange();Y.selectNode(Z),V=Y.getBoundingClientRect()}else V=Z.getBoundingClientRect();(function(Y,X,W){let re=svt(W),ue=uvt(re);if(re===null||ue===null)return;let{top:le,bottom:L}=X,J=0,ne=0,D=W;for(;D!==null;){let N=D===re.body;if(N)J=0,ne=fC(Y).innerHeight;else{let H=D.getBoundingClientRect();J=H.top,ne=H.bottom}let z=0;if(le<J?z=-(J-le):L>ne&&(z=L-ne),z!==0)if(N)ue.scrollBy(0,z);else{let H=D.scrollTop;D.scrollTop+=z;let oe=D.scrollTop-H;le-=oe,L-=oe}if(N)break;D=Kde(D)}})(r,V,i)}}v_t=!0}}function dhi(t){let e=qs()||G3();e===null&&(e=jv().selectEnd()),e.insertNodes(t)}function fhi(){let t=qs();return t===null?"":t.getTextContent()}function e_t(t){let e=t;t.isCollapsed()||e.removeText();let r=qs();mn(r)&&(e=r),mn(e)||it(161);let n=e.anchor,o=n.getNode(),i=n.offset;for(;!iL(o);){let a=o;if([o,i]=phi(o,i),a.is(o))break}return i}function phi(t,e){let r=t.getParent();if(!r){let o=aL();return jv().append(o),o.select(),[jv(),0]}if(Ar(t)){let o=t.splitText(e);if(o.length===0)return[r,t.getIndexWithinParent()];let i=e===0?0:1;return[r,o[0].getIndexWithinParent()+i]}if(!tt(t)||e===0)return[r,t.getIndexWithinParent()];let n=t.getChildAtIndex(e);if(n){let o=new W3(CT(t.__key,e,"element"),CT(t.__key,e,"element"),0,""),i=t.insertNewAfter(o);i&&i.append(n,...n.getNextSiblings())}return[r,t.getIndexWithinParent()+1]}function uXr(t,e,r,n,o="decorators-and-blocks"){if(e==="move"&&n==="character"&&!t.isCollapsed()){let[c,d]=r===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return d.set(c.key,c.offset,c.type),!0}let i=kU(t.focus,r?"previous":"next"),a=n==="lineboundary",s=e==="move",u=i,l=o==="decorators-and-blocks";if(!iYr(u)){for(let c of u){l=!1;let{origin:d}=c;if(!Hu(d)||d.isIsolated()||(u=c,!a||!d.isInline()))break}if(l)for(let c of pvt(i).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if(wT(c))c.origin.isInline()||(u=c);else{if(tt(c.origin))continue;Hu(c.origin)&&!c.origin.isInline()&&(u=c)}break}}if(u===i)return!1;if(s&&!a&&Hu(u.origin)&&u.origin.isKeyboardSelectable()){let c=G_t();return c.add(u.origin.getKey()),$v(c),!0}return u=_T(u),s&&_Y(t.anchor,u),_Y(t.focus,u),l||!a}var sg=null,ug=null,Dv=!1,t_t=!1,JLe=0,lXr={characterData:!0,childList:!0,subtree:!0};function vY(){return Dv||sg!==null&&sg._readOnly}function ig(){Dv&&it(13)}function xZr(){JLe>99&&it(14)}function cL(){return sg===null&&it(195,TZr()),sg}function dc(){return ug===null&&it(196,TZr()),ug}function TZr(){let t=0,e=new Set,r=pY.version;if(typeof window<"u")for(let o of document.querySelectorAll("[contenteditable]")){let i=Jde(o);if(wFe(i))t++;else if(i){let a=String(i.constructor.version||"<0.17.1");a===r&&(a+=" (separately built, likely a bundler configuration issue)"),e.add(a)}}let n=` Detected on the page: ${t} compatible editor(s) with version ${r}`;return e.size&&(n+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),n}function mhi(){return ug}function cXr(t,e,r){let n=e.__type,o=Q_t(t,n),i=r.get(n);i===void 0&&(i=Array.from(o.transforms),r.set(n,i));let a=i.length;for(let s=0;s<a&&(i[s](e),e.isAttached());s++);}function dXr(t,e){return t!==void 0&&t.__key!==e&&t.isAttached()}function OZr(t,e){if(!e)return;let r=t._updateTags,n=e;Array.isArray(e)||(n=[e]);for(let o of n)r.add(o)}function hhi(t){return X_t(t,dc()._nodes)}function X_t(t,e){let r=t.type,n=e.get(r);n===void 0&&it(17,r);let o=n.klass;t.type!==o.getType()&&it(18,o.name);let i=o.importJSON(t),a=t.children;if(tt(i)&&Array.isArray(a))for(let s=0;s<a.length;s++){let u=X_t(a[s],e);i.append(u)}return i}function fXr(t,e,r){let n=sg,o=Dv,i=ug;sg=e,Dv=!0,ug=t;try{return r()}finally{sg=n,Dv=o,ug=i}}function oL(t,e){let r=t._pendingEditorState,n=t._rootElement,o=t._headless||n===null;if(r===null)return;let i=t._editorState,a=i._selection,s=r._selection,u=t._dirtyType!==z3,l=sg,c=Dv,d=ug,f=t._updating,p=t._observer,m=null;if(t._pendingEditorState=null,t._editorState=r,!o&&u&&p!==null){ug=t,sg=r,Dv=!1,t._updating=!0;try{let O=t._dirtyType,E=t._dirtyElements,P=t._dirtyLeaves;p.disconnect(),m=Umi(i,r,t,O,E,P)}catch(O){if(O instanceof Error&&t._onError(O),t_t)throw O;return AZr(t,null,n,r),DXr(t),t._dirtyType=sY,t_t=!0,oL(t,i),void(t_t=!1)}finally{p.observe(n,lXr),t._updating=f,sg=l,Dv=c,ug=d}}r._readOnly||(r._readOnly=!0);let h=t._dirtyLeaves,y=t._dirtyElements,g=t._normalizedNodes,b=t._updateTags,_=t._deferred;u&&(t._dirtyType=z3,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),function(O,E){let P=O._decorators,R=O._pendingDecorators||P,I=E._nodeMap,A;for(A in R)I.has(A)||(R===P&&(R=LZr(O)),delete R[A])}(t,r);let w=o?null:hN(fC(t));if(t._editable&&w!==null&&(u||s===null||s.dirty)&&n!==null&&!b.has(IZr)){ug=t,sg=r;try{if(p!==null&&p.disconnect(),u||s===null||s.dirty){let O=t._blockCursorElement;O!==null&&E_t(O,t,n),chi(a,s,t,w,b,n)}(function(O,E,P){let R=O._blockCursorElement;if(mn(P)&&P.isCollapsed()&&P.anchor.type==="element"&&E.contains(document.activeElement)){let I=P.anchor,A=I.getNode(),B=I.offset,k=!1,q=null;if(B===A.getChildrenSize())n_t(A.getChildAtIndex(B-1))&&(k=!0);else{let Z=A.getChildAtIndex(B);if(Z!==null&&n_t(Z)){let V=Z.getPreviousSibling();(V===null||n_t(V))&&(k=!0,q=O.getElementByKey(Z.__key))}}if(k){let Z=O.getElementByKey(A.__key);return R===null&&(O._blockCursorElement=R=function(V){let Y=V.theme,X=document.createElement("div");X.contentEditable="false",X.setAttribute("data-lexical-cursor","true");let W=Y.blockCursor;if(W!==void 0){if(typeof W=="string"){let re=ZLe(W);W=Y.blockCursor=re}W!==void 0&&X.classList.add(...W)}return X}(O._config)),E.style.caretColor="transparent",void(q===null?Z.appendChild(R):Z.insertBefore(R,q))}}R!==null&&E_t(R,O,E)})(t,n,s)}finally{p!==null&&p.observe(n,lXr),ug=d,sg=l}}m!==null&&function(O,E,P,R,I){let A=Array.from(O._listeners.mutation),B=A.length;for(let k=0;k<B;k++){let[q,Z]=A[k];for(let V of Z){let Y=E.get(V);Y!==void 0&&q(Y,{dirtyLeaves:R,prevEditorState:I,updateTags:P})}}}(t,m,b,h,i),mn(s)||s===null||a!==null&&a.is(s)||t.dispatchCommand(B_t,void 0);let T=t._pendingDecorators;T!==null&&(t._decorators=T,t._pendingDecorators=null,Ade("decorator",t,!0,T)),function(O,E,P){let R=yXr(E),I=yXr(P);R!==I&&Ade("textcontent",O,!0,I)}(t,e||i,r),Ade("update",t,!0,{dirtyElements:y,dirtyLeaves:h,editorState:r,mutatedNodes:m,normalizedNodes:g,prevEditorState:e||i,tags:b}),function(O,E){if(O._deferred=[],E.length!==0){let P=O._updating;O._updating=!0;try{for(let R=0;R<E.length;R++)E[R]()}finally{O._updating=P}}}(t,_),function(O){let E=O._updates;if(E.length!==0){let P=E.shift();if(P){let[R,I]=P;vFe(O,R,I)}}}(t)}function Ade(t,e,r,...n){let o=e._updating;e._updating=r;try{let i=Array.from(e._listeners[t]);for(let a=0;a<i.length;a++)i[a].apply(null,n)}finally{e._updating=o}}function pXr(t,e){let r=t._updates,n=e||!1;for(;r.length!==0;){let o=r.shift();if(o){let[i,a]=o,s=t._pendingEditorState,u;a!==void 0&&(u=a.onUpdate,a.skipTransforms&&(n=!0),a.discrete&&(s===null&&it(191),s._flushSync=!0),u&&t._deferred.push(u),OZr(t,a.tag)),s==null?vFe(t,i,a):i()}}return n}function vFe(t,e,r){let n=t._updateTags,o,i=!1,a=!1;r!==void 0&&(o=r.onUpdate,OZr(t,r.tag),i=r.skipTransforms||!1,a=r.discrete||!1),o&&t._deferred.push(o);let s=t._editorState,u=t._pendingEditorState,l=!1;(u===null||u._readOnly)&&(u=t._pendingEditorState=EZr(u||s),l=!0),u._flushSync=a;let c=sg,d=Dv,f=ug,p=t._updating;sg=u,Dv=!1,t._updating=!0,ug=t;let m=t._headless||t.getRootElement()===null;Y_t(null);try{l&&(m?s._selection!==null&&(u._selection=s._selection.clone()):u._selection=function(b,_){let w=b.getEditorState()._selection,T=hN(fC(b));return mn(w)||w==null?_Fe(w,T,b,_):w.clone()}(t,r&&r.event||null));let y=t._compositionKey;e(),i=pXr(t,i),function(b,_){let w=_.getEditorState()._selection,T=b._selection;if(mn(T)){let O=T.anchor,E=T.focus,P;if(O.type==="text"&&(P=O.getNode(),P.selectionTransform(w,T)),E.type==="text"){let R=E.getNode();P!==R&&R.selectionTransform(w,T)}}}(u,t),t._dirtyType!==z3&&(i?function(b,_){let w=_._dirtyLeaves,T=b._nodeMap;for(let O of w){let E=T.get(O);Ar(E)&&E.isAttached()&&E.isSimpleText()&&!E.isUnmergeable()&&V7r(E)}}(u,t):function(b,_){let w=_._dirtyLeaves,T=_._dirtyElements,O=b._nodeMap,E=IU(),P=new Map,R=w,I=R.size,A=T,B=A.size;for(;I>0||B>0;){if(I>0){_._dirtyLeaves=new Set;for(let k of R){let q=O.get(k);Ar(q)&&q.isAttached()&&q.isSimpleText()&&!q.isUnmergeable()&&V7r(q),q!==void 0&&dXr(q,E)&&cXr(_,q,P),w.add(k)}if(R=_._dirtyLeaves,I=R.size,I>0){JLe++;continue}}_._dirtyLeaves=new Set,_._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(let k of A){let q=k[0],Z=k[1];if(T.set(q,Z),!Z)continue;let V=O.get(q);V!==void 0&&dXr(V,E)&&cXr(_,V,P)}R=_._dirtyLeaves,I=R.size,A=_._dirtyElements,B=A.size,JLe++}_._dirtyLeaves=w,_._dirtyElements=T}(u,t),pXr(t),function(b,_,w,T){let O=b._nodeMap,E=_._nodeMap,P=[];for(let[R]of T){let I=E.get(R);I!==void 0&&(I.isAttached()||(tt(I)&&IXr(I,R,O,E,P,T),O.has(R)||T.delete(R),P.push(R)))}for(let R of P)E.delete(R);for(let R of w){let I=E.get(R);I===void 0||I.isAttached()||(O.has(R)||w.delete(R),E.delete(R))}}(s,u,t._dirtyLeaves,t._dirtyElements)),y!==t._compositionKey&&(u._flushSync=!0);let g=u._selection;if(mn(g)){let b=u._nodeMap,_=g.anchor.key,w=g.focus.key;b.get(_)!==void 0&&b.get(w)!==void 0||it(19)}else bFe(g)&&g._nodes.size===0&&(u._selection=null)}catch(y){return y instanceof Error&&t._onError(y),t._pendingEditorState=s,t._dirtyType=sY,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),void oL(t)}finally{sg=c,Dv=d,ug=f,t._updating=p,JLe=0}t._dirtyType!==z3||t._deferred.length>0||function(y,g){let b=g.getEditorState()._selection,_=y._selection;if(_!==null){if(_.dirty||!_.is(b))return!0}else if(b!==null)return!0;return!1}(u,t)?u._flushSync?(u._flushSync=!1,oL(t)):l&&Mhi(()=>{oL(t)}):(u._flushSync=!1,l&&(n.clear(),t._deferred=[],t._pendingEditorState=null))}function tS(t,e,r){ug===t&&r===void 0?e():vFe(t,e,r)}var T_t=class t{constructor(e,r,n){this.element=e,this.before=r||null,this.after=n||null}withBefore(e){return new t(this.element,e,this.after)}withAfter(e){return new t(this.element,this.before,e)}withElement(e){return this.element===e?this:new t(e,this.before,this.after)}insertChild(e){let r=this.before||this.getManagedLineBreak();return r!==null&&r.parentElement!==this.element&&it(222),this.element.insertBefore(e,r),this}removeChild(e){return e.parentElement!==this.element&&it(223),this.element.removeChild(e),this}replaceChild(e,r){return r.parentElement!==this.element&&it(224),this.element.replaceChild(e,r),this}getFirstChild(){let e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{let r=e==="decorator"&&(aY||jde);this.insertManagedLineBreak(r)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let r=this.element,n=e.nodeName==="IMG"?e.nextSibling:null;n&&r.removeChild(n),r.removeChild(e),r.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let r=this.getManagedLineBreak();if(r){if(e===(r.nodeName==="IMG"))return;this.removeManagedLineBreak()}let n=this.element,o=this.before,i=document.createElement("br");if(n.insertBefore(i,o),e){let a=document.createElement("img");a.setAttribute("data-lexical-linebreak","true"),a.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",a.alt="",n.insertBefore(a,i),n.__lexicalLineBreak=a}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let r=this.after;r!==null;r=r.previousSibling)e++;return e}resolveChildIndex(e,r,n,o){if(n===this.element){let u=this.getFirstChildOffset();return[e,Math.min(u+e.getChildrenSize(),Math.max(u,o))]}let i=mXr(r,n);i.push(o);let a=mXr(r,this.element),s=e.getIndexWithinParent();for(let u=0;u<a.length;u++){let l=i[u],c=a[u];if(l===void 0||l<c)break;if(l>c){s+=1;break}}return[e.getParentOrThrow(),s]}};function mXr(t,e){let r=[],n=e;for(;n!==t&&n!==null;n=n.parentNode){let o=0;for(let i=n.previousSibling;i!==null;i=i.previousSibling)o++;r.push(o)}return n!==t&&it(225),r.reverse()}var $U=class extends jU{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let e=this.getFormat();return Emi[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],r=this.getFirstChild();for(;r!==null;)e.push(r),r=r.getNextSibling();return e}getChildrenKeys(){let e=[],r=this.getFirstChild();for(;r!==null;)e.push(r.__key),r=r.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let e=dc()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),r=this.getParentOrThrow().getLastChild();return r!==null&&r.is(e)}getAllTextNodes(){let e=[],r=this.getFirstChild();for(;r!==null;){if(Ar(r)&&e.push(r),tt(r)){let n=r.getAllTextNodes();e.push(...n)}r=r.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;tt(e);){let r=e.getFirstChild();if(r===null)break;e=r}return e}getLastDescendant(){let e=this.getLastChild();for(;tt(e);){let r=e.getLastChild();if(r===null)break;e=r}return e}getDescendantByIndex(e){let r=this.getChildren(),n=r.length;if(e>=n){let i=r[n-1];return tt(i)&&i.getLastDescendant()||i||null}let o=r[e];return tt(o)&&o.getFirstDescendant()||o||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:yh(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&it(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:yh(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&it(96,this.__key),e}getChildAtIndex(e){let r=this.getChildrenSize(),n,o;if(e<r/2){for(n=this.getFirstChild(),o=0;n!==null&&o<=e;){if(o===e)return n;n=n.getNextSibling(),o++}return null}for(n=this.getLastChild(),o=r-1;n!==null&&o>=e;){if(o===e)return n;n=n.getPreviousSibling(),o--}return null}getTextContent(){let e="",r=this.getChildren(),n=r.length;for(let o=0;o<n;o++){let i=r[o];e+=i.getTextContent(),tt(i)&&o!==n-1&&!i.isInline()&&(e+=uL)}return e}getTextContentSize(){let e=0,r=this.getChildren(),n=r.length;for(let o=0;o<n;o++){let i=r[o];e+=i.getTextContentSize(),tt(i)&&o!==n-1&&!i.isInline()&&(e+=uL.length)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){let r=$7r[e];return!!(this.getFormat()&r)}return!1}hasTextFormat(e){let r=lb[e];return!!(this.getTextFormat()&r)}getFormatFlags(e,r){return cFe(this.getLatest().__textFormat,e,r)}getTextStyle(){return this.getLatest().__textStyle}select(e,r){ig();let n=qs(),o=e,i=r,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&r===0){let u=this.getFirstChild();if(Ar(u)||tt(u))return u.select(0,0)}else if(!(e!==void 0&&e!==a||r!==void 0&&r!==a)){let u=this.getLastChild();if(Ar(u)||tt(u))return u.select()}}o===void 0&&(o=a),i===void 0&&(i=a);let s=this.__key;return mn(n)?(n.anchor.set(s,o,"element"),n.focus.set(s,i,"element"),n.dirty=!0,n):wZr(s,o,s,i,"element","element")}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(r=>r.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let r=this.getWritable();return r.__dir=e,r}setFormat(e){return this.getWritable().__format=e!==""?$7r[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){let r=this.getWritable();return r.__textFormat=e,r}setTextStyle(e){let r=this.getWritable();return r.__textStyle=e,r}setIndent(e){return this.getWritable().__indent=e,this}splice(e,r,n){let o=n.length,i=this.getChildrenSize(),a=this.getWritable();e+r<=i||it(226,String(e),String(r),String(i));let s=a.__key,u=[],l=[],c=this.getChildAtIndex(e+r),d=null,f=i-r+o;if(e!==0)if(e===i)d=this.getLastChild();else{let m=this.getChildAtIndex(e);m!==null&&(d=m.getPreviousSibling())}if(r>0){let m=d===null?this.getFirstChild():d.getNextSibling();for(let h=0;h<r;h++){m===null&&it(100);let y=m.getNextSibling(),g=m.__key;NU(m.getWritable()),l.push(g),m=y}}let p=d;for(let m=0;m<o;m++){let h=n[m];p!==null&&h.is(p)&&(d=p=p.getPreviousSibling());let y=h.getWritable();y.__parent===s&&f--,NU(y);let g=h.__key;if(p===null)a.__first=g,y.__prev=null;else{let b=p.getWritable();b.__next=g,y.__prev=b.__key}h.__key===s&&it(76),y.__parent=s,u.push(g),p=h}if(e+r===i)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(c!==null){let m=c.getWritable();if(p!==null){let h=p.getWritable();m.__prev=p.__key,h.__next=c.__key}else m.__prev=null}if(a.__size=f,l.length){let m=qs();if(mn(m)){let h=new Set(l),y=new Set(u),{anchor:g,focus:b}=m;hXr(g,h,y)&&sFe(g,g.getNode(),this,d,c),hXr(b,h,y)&&sFe(b,b.getNode(),this,d,c),f!==0||this.canBeEmpty()||xT(this)||this.remove()}}return a}getDOMSlot(e){return new T_t(e)}exportDOM(e){let{element:r}=super.exportDOM(e);if(c_(r)){let n=this.getIndent();n>0&&(r.style.paddingInlineStart=40*n+"px");let o=this.getDirection();o&&(r.dir=o)}return{element:r}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},r=this.getTextFormat(),n=this.getTextStyle();return r!==0&&(e.textFormat=r),n!==""&&(e.textStyle=n),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,r){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,r,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,r){let n=this.getDOMSlot(e),o=n.getFirstChild();for(let i=this.getFirstChild();i;i=i.getNextSibling()){let a=r.getElementByKey(i.getKey());a!==null&&(o==null?(n.insertChild(a),o=a):o!==a&&n.replaceChild(a,o),o=o.nextSibling)}}};function tt(t){return t instanceof $U}function hXr(t,e,r){let n=t.getNode();for(;n;){let o=n.__key;if(e.has(o)&&!r.has(o))return!0;n=n.getParent()}return!1}var Vde=class extends jU{decorate(e,r){it(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Hu(t){return t instanceof Vde}var dY=class t extends $U{static getType(){return"root"}static clone(){return new t}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){it(51)}getTextContent(){let e=this.__cachedText;return!vY()&&dc()._dirtyType!==z3||e===null?super.getTextContent():e}remove(){it(52)}replace(e){it(53)}insertBefore(e){it(54)}insertAfter(e){it(55)}updateDOM(e,r){return!1}splice(e,r,n){for(let o of n)tt(o)||Hu(o)||it(282);return super.splice(e,r,n)}static importJSON(e){return jv().updateFromJSON(e)}collapseAtStart(){return!0}};function Nv(t){return t instanceof dY}function EZr(t){return new uFe(new Map(t._nodeMap))}function Z_t(){return new uFe(new Map([["root",new dY]]))}function PZr(t){let e=t.exportJSON(),r=t.constructor;if(e.type!==r.getType()&&it(130,r.name),tt(t)){let n=e.children;Array.isArray(n)||it(59,r.name);let o=t.getChildren();for(let i=0;i<o.length;i++){let a=PZr(o[i]);n.push(a)}}return e}var uFe=class t{constructor(e,r){this._nodeMap=e,this._selection=r||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,r){return fXr(r&&r.editor||null,this,e)}clone(e){let r=new t(this._nodeMap,e===void 0?this._selection:e);return r._readOnly=!0,r}toJSON(){return fXr(null,this,()=>({root:PZr(jv())}))}},ghi="historic",yhi="history-push",KLe="history-merge",bhi="paste",MZr="collaboration",_hi="skip-collab",RZr="skip-scroll-into-view",IZr="skip-dom-selection",lFe=class extends $U{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}},fY=class t extends $U{static getType(){return"paragraph"}static clone(e){return new t(e.__key)}createDOM(e){let r=document.createElement("p"),n=iY(e.theme,"paragraph");return n!==void 0&&r.classList.add(...n),r}updateDOM(e,r,n){return!1}static importDOM(){return{p:e=>({conversion:vhi,priority:0})}}exportDOM(e){let{element:r}=super.exportDOM(e);if(c_(r)){this.isEmpty()&&r.append(document.createElement("br"));let n=this.getFormatType();n&&(r.style.textAlign=n)}return{element:r}}static importJSON(e){return aL().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,r){let n=aL();n.setTextFormat(e.format),n.setTextStyle(e.style);let o=this.getDirection();return n.setDirection(o),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,r),n}collapseAtStart(){let e=this.getChildren();if(e.length===0||Ar(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function vhi(t){let e=aL();return t.style&&(e.setFormat(t.style.textAlign),QZr(t,e)),{node:e}}function aL(){return Gde(new fY)}function whi(t){return t instanceof fY}var Shi=0,Chi=1,xhi=2,Thi=3,Ohi=4;function AZr(t,e,r,n){let o=t._keyToDOMMap;o.clear(),t._editorState=Z_t(),t._pendingEditorState=n,t._compositionKey=null,t._dirtyType=z3,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;let i=t._observer;i!==null&&(i.disconnect(),t._observer=null),e!==null&&(e.textContent=""),r!==null&&(r.textContent="",o.set("root",r))}function Ehi(t){let e=t||{},r=mhi(),n=e.theme||{},o=t===void 0?r:e.parentEditor||null,i=e.disableEvents||!1,a=Z_t(),s=e.namespace||(o!==null?o._config.namespace:qZr()),u=e.editorState,l=[dY,H3,uY,cY,fY,lFe,...e.nodes||[]],{onError:c,html:d}=e,f=e.editable===void 0||e.editable,p;if(t===void 0&&r!==null)p=r._nodes;else{p=new Map;for(let h=0;h<l.length;h++){let y=l[h],g=null,b=null;if(typeof y!="function"){let E=y;y=E.replace,g=E.with,b=E.withKlass||null}let{ownNodeConfig:_}=dvt(y),w=y.getType(),T=y.transform(),O=new Set;_&&_.$transform&&O.add(_.$transform),T!==null&&O.add(T),p.set(w,{exportDOM:d&&d.export?d.export.get(y):void 0,klass:y,replace:g,replaceWithKlass:b,sharedNodeState:jXr(l[h]),transforms:O})}}let m=new pY(a,o,p,{disableEvents:i,namespace:s,theme:n},c||console.error,function(h,y){let g=new Map,b=new Set,_=w=>{Object.keys(w).forEach(T=>{let O=g.get(T);O===void 0&&(O=[],g.set(T,O)),O.push(w[T])})};return h.forEach(w=>{let T=w.klass.importDOM;if(T==null||b.has(T))return;b.add(T);let O=T.call(w.klass);O!==null&&_(O)}),y&&_(y),g}(p,d?d.import:void 0),f,t);return u!==void 0&&(m._pendingEditorState=u,m._dirtyType=sY),m}var pY=class{constructor(e,r,n,o,i,a,s,u){this._createEditorArgs=u,this._parentEditor=r,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=o,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=z3,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=qZr(),this._onError=i,this._htmlConversions=a,this._editable=s,this._headless=r!==null&&r._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){let r=this._listeners.update;return r.add(e),()=>{r.delete(e)}}registerEditableListener(e){let r=this._listeners.editable;return r.add(e),()=>{r.delete(e)}}registerDecoratorListener(e){let r=this._listeners.decorator;return r.add(e),()=>{r.delete(e)}}registerTextContentListener(e){let r=this._listeners.textcontent;return r.add(e),()=>{r.delete(e)}}registerRootListener(e){let r=this._listeners.root;return e(this._rootElement,null),r.add(e),()=>{e(null,this._rootElement),r.delete(e)}}registerCommand(e,r,n){n===void 0&&it(35);let o=this._commands;o.has(e)||o.set(e,[new Set,new Set,new Set,new Set,new Set]);let i=o.get(e);i===void 0&&it(36,String(e));let a=i[n];return a.add(r),()=>{a.delete(r),i.every(s=>s.size===0)&&o.delete(e)}}registerMutationListener(e,r,n){let o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,a=i.get(r);a===void 0&&(a=new Set,i.set(r,a)),a.add(o);let s=n&&n.skipInitialization;return s!==void 0&&s||this.initializeMutationListener(r,o),()=>{a.delete(o),a.size===0&&i.delete(r)}}getRegisteredNode(e){let r=this._nodes.get(e.getType());return r===void 0&&it(37,e.name),r}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,r){let n=this._editorState,o=M_t(n).get(r.getType());if(!o)return;let i=new Map;for(let a of o.keys())i.set(a,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,r){let n=this.getRegisteredNode(e);return n.transforms.add(r),n}registerNodeTransform(e,r){let n=this.registerNodeTransformToKlass(e,r),o=[n],i=n.replaceWithKlass;if(i!=null){let a=this.registerNodeTransformToKlass(i,r);o.push(a)}return function(a,s){let u=M_t(a.getEditorState()),l=[];for(let c of s){let d=u.get(c);d&&l.push(d)}l.length!==0&&a.update(()=>{for(let c of l)for(let d of c.keys()){let f=yh(d);f&&f.markDirty()}},a._pendingEditorState===null?{tag:KLe}:void 0)}(this,o.map(a=>a.klass.getType())),()=>{o.forEach(a=>a.transforms.delete(r))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,r){return wr(this,e,r)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let r=this._rootElement;if(e!==r){let n=iY(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,AZr(this,r,e,o),r!==null&&(this._config.disableEvents||Qmi(r),n!=null&&r.classList.remove(...n)),e!==null){let i=uvt(e),a=e.style;a.userSelect="text",a.whiteSpace="pre-wrap",a.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=sY,DXr(this),this._updateTags.add(KLe),oL(this),this._config.disableEvents||function(s,u){let l=s.ownerDocument,c=oFe.get(l);(c===void 0||c<1)&&l.addEventListener("selectionchange",gZr),oFe.set(l,(c||0)+1),s.__lexicalEditor=u;let d=hZr(s);for(let f=0;f<__t.length;f++){let[p,m]=__t[f],h=typeof m=="function"?y=>{X7r(y)||(G7r(y),(u.isEditable()||p==="click")&&m(y,u))}:y=>{if(X7r(y))return;G7r(y);let g=u.isEditable();switch(p){case"cut":return g&&wr(u,W_t,y);case"copy":return wr(u,H_t,y);case"paste":return g&&wr(u,U_t,y);case"dragstart":return g&&wr(u,nZr,y);case"dragover":return g&&wr(u,oZr,y);case"dragend":return g&&wr(u,iZr,y);case"focus":return g&&wr(u,aZr,y);case"blur":return g&&wr(u,sZr,y);case"drop":return g&&wr(u,rZr,y)}};s.addEventListener(p,h),d.push(()=>{s.removeEventListener(p,h)})}}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(KLe),oL(this);Ade("root",this,!1,e,r)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,r){e.isEmpty()&&it(38);let n=e;n._readOnly&&(n=EZr(e),n._selection=e._selection?e._selection.clone():null),NXr(this);let o=this._pendingEditorState,i=this._updateTags,a=r!==void 0?r.tag:null;o===null||o.isEmpty()||(a!=null&&i.add(a),oL(this)),this._pendingEditorState=n,this._dirtyType=sY,this._dirtyElements.set("root",!1),this._compositionKey=null,a!=null&&i.add(a),this._updating||oL(this)}parseEditorState(e,r){return function(n,o,i){let a=Z_t(),s=sg,u=Dv,l=ug,c=o._dirtyElements,d=o._dirtyLeaves,f=o._cloneNotNeeded,p=o._dirtyType;o._dirtyElements=new Map,o._dirtyLeaves=new Set,o._cloneNotNeeded=new Set,o._dirtyType=0,sg=a,Dv=!1,ug=o,Y_t(null);try{let m=o._nodes;X_t(n.root,m),i&&i(),a._readOnly=!0}catch(m){m instanceof Error&&o._onError(m)}finally{o._dirtyElements=c,o._dirtyLeaves=d,o._cloneNotNeeded=f,o._dirtyType=p,sg=s,Dv=u,ug=l}return a}(typeof e=="string"?JSON.parse(e):e,this,r)}read(e){return oL(this),this.getEditorState().read(e,{editor:this})}update(e,r){(function(n,o,i){n._updating?n._updates.push([o,i]):vFe(n,o,i)})(this,e,r)}focus(e,r={}){let n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),tS(this,()=>{let o=qs(),i=jv();o!==null?o.dirty||$v(o.clone()):i.getChildrenSize()!==0&&(r.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),HZr("focus"),WZr(()=>{n.removeAttribute("autocapitalize"),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){let e=this._rootElement;e!==null&&e.blur();let r=hN(this._window);r!==null&&r.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Ade("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};pY.version="0.34.0+prod.esm";var O_t=null;function Y_t(t){O_t=t}var NZr=1;function Phi(){NZr=1}function Q_t(t,e){let r=evt(t,e);return r===void 0&&it(30,e),r}function evt(t,e){return t._nodes.get(e)}var Mhi=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function gXr(t){return Hu(CFe(t))}function tvt(t){let e=document.activeElement;if(!c_(e))return!1;let r=e.nodeName;return Hu(CFe(t))&&(r==="INPUT"||r==="TEXTAREA"||e.contentEditable==="true"&&Jde(e)==null)}function Wde(t,e,r){let n=t.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(r)&&e!==null&&!tvt(e)&&rvt(e)===t}catch{return!1}}function wFe(t){return t instanceof pY}function rvt(t){let e=t;for(;e!=null;){let r=Jde(e);if(wFe(r))return r;e=Kde(e)}return null}function Jde(t){return t?t.__lexicalEditor:null}function AU(t){return K_t(t)||t.isToken()}function rL(t){return AU(t)||t.isSegmented()}function gN(t){return wY(t)&&t.nodeType===fmi}function DZr(t){return wY(t)&&t.nodeType===pmi}function J3(t){let e=t;for(;e!=null;){if(gN(e))return e;e=e.firstChild}return null}function cFe(t,e,r){let n=lb[e];if(r!==null&&(t&n)==(r&n))return t;let o=t^n;return e==="subscript"?o&=~lb.superscript:e==="superscript"?o&=~lb.subscript:e==="lowercase"?(o&=~lb.uppercase,o&=~lb.capitalize):e==="uppercase"?(o&=~lb.lowercase,o&=~lb.capitalize):e==="capitalize"&&(o&=~lb.lowercase,o&=~lb.uppercase),o}function Rhi(t){return Ar(t)||B3(t)||Hu(t)}function jZr(t,e){let r=function(){let a=O_t;return O_t=null,a}();if((e=e||r&&r.__key)!=null)return void(t.__key=e);ig(),xZr();let n=dc(),o=cL(),i=""+NZr++;o._nodeMap.set(i,t),tt(t)?n._dirtyElements.set(i,!0):n._dirtyLeaves.add(i),n._cloneNotNeeded.add(i),n._dirtyType=EXr,t.__key=i}function NU(t){let e=t.getParent();if(e!==null){let r=t.getWritable(),n=e.getWritable(),o=t.getPreviousSibling(),i=t.getNextSibling(),a=i!==null?i.__key:null,s=o!==null?o.__key:null,u=o!==null?o.getWritable():null,l=i!==null?i.getWritable():null;o===null&&(n.__first=a),i===null&&(n.__last=s),u!==null&&(u.__next=a),l!==null&&(l.__prev=s),r.__prev=null,r.__next=null,r.__parent=null,n.__size--}}function dFe(t){xZr();let e=t.getLatest(),r=e.__parent,n=cL(),o=dc(),i=n._nodeMap,a=o._dirtyElements;r!==null&&function(u,l,c){let d=u;for(;d!==null;){if(c.has(d))return;let f=l.get(d);if(f===void 0)break;c.set(d,!1),d=f.__parent}}(r,i,a);let s=e.__key;o._dirtyType=EXr,tt(t)?a.set(s,!0):o._dirtyLeaves.add(s)}function ag(t){ig();let e=dc(),r=e._compositionKey;if(t!==r){if(e._compositionKey=t,r!==null){let n=yh(r);n!==null&&n.getWritable()}if(t!==null){let n=yh(t);n!==null&&n.getWritable()}}}function IU(){return vY()?null:dc()._compositionKey}function yh(t,e){let r=(e||cL())._nodeMap.get(t);return r===void 0?null:r}function $Zr(t,e){let r=SFe(t,dc());return r!==void 0?yh(r,e):null}function SFe(t,e){return t[`__lexicalKey_${e._key}`]}function CFe(t,e){let r=t;for(;r!=null;){let n=$Zr(r,e);if(n!==null)return n;r=Kde(r)}return null}function LZr(t){let e=t._decorators,r=Object.assign({},e);return t._pendingDecorators=r,r}function yXr(t){return t.read(()=>jv().getTextContent())}function jv(){return FZr(cL())}function FZr(t){return t._nodeMap.get("root")}function $v(t){ig();let e=cL();t!==null&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function rY(t){let e=dc(),r=function(n,o){let i=n;for(;i!=null;){let a=SFe(i,o);if(a!==void 0)return a;i=Kde(i)}return null}(t,e);return r===null?t===e.getRootElement()?yh("root"):null:yh(r)}function kZr(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function nvt(t){let e=[],r=t;for(;r!==null;)e.push(r),r=r._parentEditor;return e}function qZr(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function BZr(t){return gN(t)?t.nodeValue:null}function ovt(t,e,r){let n=hN(fC(e));if(n===null)return;let o=n.anchorNode,{anchorOffset:i,focusOffset:a}=n;if(o!==null){let s=BZr(o),u=CFe(o);if(s!==null&&Ar(u)){if(s===hFe&&r){let l=r.length;s=r,i=l,a=l}s!==null&&ivt(u,s,i,a,t)}}}function ivt(t,e,r,n,o){let i=t;if(i.isAttached()&&(o||!i.isDirty())){let a=i.isComposing(),s=e;(a||o)&&e[e.length-1]===hFe&&(s=e.slice(0,-1));let u=i.getTextContent();if(o||s!==u){if(s===""){if(ag(null),jde||aY||XLe)i.remove();else{let h=dc();setTimeout(()=>{h.update(()=>{i.isAttached()&&i.remove()})},20)}return}let l=i.getParent(),c=G3(),d=i.getTextContentSize(),f=IU(),p=i.getKey();if(i.isToken()||f!==null&&p===f&&!a||mn(c)&&(l!==null&&!l.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===t.__key&&c.anchor.offset===0&&!i.canInsertTextBefore()&&!a||c.focus.key===t.__key&&c.focus.offset===d&&!i.canInsertTextAfter()&&!a))return void i.markDirty();let m=qs();if(!mn(m)||r===null||n===null)return void bXr(i,s,m);if(m.setTextNodeRange(i,r,i,n),i.isSegmented()){let h=og(i.getTextContent());i.replace(h),i=h}bXr(i,s,m)}}}function bXr(t,e,r){if(t.setTextContent(e),mn(r)){let n=t.getKey();for(let o of["anchor","focus"]){let i=r[o];i.type==="text"&&i.key===n&&(i.offset=ST(t,i.offset,"clamp"))}}}function zLe(t,e,r){let n=e[r]||!1;return n==="any"||n===t[r]}function UZr(t,e){return zLe(t,e,"altKey")&&zLe(t,e,"ctrlKey")&&zLe(t,e,"shiftKey")&&zLe(t,e,"metaKey")}function ou(t,e,r){return UZr(t,r)&&t.key.toLowerCase()===e.toLowerCase()}var tL={ctrlKey:!mN,metaKey:mN},_Xr={altKey:mN,ctrlKey:!mN};function vXr(t){return t.key==="Backspace"}function wXr(t){return ou(t,"a",tL)}function Ihi(t){let e=jv();if(mn(t)){let r=t.anchor,n=t.focus,o=r.getNode().getTopLevelElementOrThrow().getParentOrThrow();return r.set(o.getKey(),0,"element"),n.set(o.getKey(),o.getChildrenSize(),"element"),QLe(t),t}{let r=e.select(0,e.getChildrenSize());return $v(QLe(r)),r}}function iY(t,e){t.__lexicalClassNameCache===void 0&&(t.__lexicalClassNameCache={});let r=t.__lexicalClassNameCache,n=r[e];if(n!==void 0)return n;let o=t[e];if(typeof o=="string"){let i=ZLe(o);return r[e]=i,i}return o}function avt(t,e,r,n,o){if(r.size===0)return;let i=n.__type,a=n.__key,s=e.get(i);s===void 0&&it(33,i);let u=s.klass,l=t.get(u);l===void 0&&(l=new Map,t.set(u,l));let c=l.get(a),d=c==="destroyed"&&o==="created";(c===void 0||d)&&l.set(a,d?"updated":o)}function Ahi(t){let e=t.getType(),r=cL();if(r._readOnly){let i=M_t(r).get(e);return i?Array.from(i.values()):[]}let n=r._nodeMap,o=[];for(let[,i]of n)i instanceof t&&i.__type===e&&i.isAttached()&&o.push(i);return o}function SXr(t,e,r){let n=t.getParent(),o=r,i=t;return n!==null&&(e&&r===0?(o=i.getIndexWithinParent(),i=n):e||r!==i.getChildrenSize()||(o=i.getIndexWithinParent()+1,i=n)),i.getChildAtIndex(e?o-1:o)}function zZr(t,e){let r=t.offset;if(t.type==="element")return SXr(t.getNode(),e,r);{let n=t.getNode();if(e&&r===0||!e&&r===n.getTextContentSize()){let o=e?n.getPreviousSibling():n.getNextSibling();return o===null?SXr(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):o}}return null}function VZr(t){let e=fC(t).event,r=e&&e.inputType;return r==="insertFromPaste"||r==="insertFromPasteAsQuotation"}function wr(t,e,r){return function(n,o,i){let a=nvt(n);for(let s=4;s>=0;s--)for(let u=0;u<a.length;u++){let l=a[u],c=l._commands.get(o);if(c!==void 0){let d=c[s];if(d!==void 0){let f=Array.from(d),p=f.length,m=!1;if(tS(l,()=>{for(let h=0;h<p;h++)if(f[h](i,n))return void(m=!0)}),m)return m}}}return!1}(t,e,r)}function xFe(t){return!Nv(t)&&!t.isLastChild()&&!t.isInline()}function mY(t,e){let r=t._keyToDOMMap.get(e);return r===void 0&&it(75,e),r}function Kde(t){let e=t.assignedSlot||t.parentElement;return XZr(e)?e.host:e}function svt(t){return DZr(t)?t:c_(t)?t.ownerDocument:null}function Nhi(t){return dc()._updateTags.has(t)}function HZr(t){ig(),dc()._updateTags.add(t)}function WZr(t){ig(),dc()._deferred.push(t)}function fFe(t,e){let r=t.getParent();for(;r!==null;){if(r.is(e))return!0;r=r.getParent()}return!1}function uvt(t){let e=svt(t);return e?e.defaultView:null}function fC(t){let e=t._window;return e===null&&it(78),e}function Dhi(t){return tt(t)&&t.isInline()||Hu(t)&&t.isInline()}function JZr(t){let e=t.getParentOrThrow();for(;e!==null;){if(xT(e))return e;e=e.getParentOrThrow()}return e}function xT(t){return Nv(t)||tt(t)&&t.isShadowRoot()}function lvt(t){let e=t.constructor.clone(t);return jZr(e,null),e.afterCloneFrom(t),e}function Gde(t){let e=dc(),r=t.getType(),n=evt(e,r);n===void 0&&it(200,t.constructor.name,r);let{replace:o,replaceWithKlass:i}=n;if(o!==null){let a=o(t),s=a.constructor;return i!==null?a instanceof i||it(201,i.name,i.getType(),s.name,s.getType(),t.constructor.name,r):a instanceof t.constructor&&s!==t.constructor||it(202,s.name,s.getType(),t.constructor.name,r),a.__key===t.__key&&it(203,t.constructor.name,r,s.name,s.getType()),a}return t}function r_t(t,e){!Nv(t.getParent())||tt(e)||Hu(e)||it(99)}function KZr(t){let e=yh(t);return e===null&&it(63,t),e}function n_t(t){return(Hu(t)||tt(t)&&!t.canBeEmpty())&&!t.isInline()}function E_t(t,e,r){r.style.removeProperty("caret-color"),e._blockCursorElement=null;let n=t.parentElement;n!==null&&n.removeChild(t)}function hN(t){return TT?(t||window).getSelection():null}function GZr(t){let e=uvt(t);return e?e.getSelection():null}function jhi(t,e){let r=t.getChildAtIndex(e);r==null&&(r=t),xT(t)&&it(102);let n=a=>{let s=a.getParentOrThrow(),u=xT(s),l=a!==r||u?lvt(a):a;if(u)return tt(a)&&tt(l)||it(133),a.insertAfter(l),[a,l,l];{let[c,d,f]=n(s),p=a.getNextSiblings();return f.append(l,...p),[c,d,l]}},[o,i]=n(r);return[o,i]}function $hi(t){return c_(t)&&t.tagName==="A"}function c_(t){return wY(t)&&t.nodeType===dmi}function wY(t){return typeof t=="object"&&t!==null&&"nodeType"in t&&typeof t.nodeType=="number"}function XZr(t){return wY(t)&&t.nodeType===mmi}function ZZr(t){let e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return t.nodeName.match(e)!==null}function P_t(t){let e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return t.nodeName.match(e)!==null}function iL(t){if(Hu(t)&&!t.isInline())return!0;if(!tt(t)||xT(t))return!1;let e=t.getFirstChild(),r=e===null||B3(e)||Ar(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&r}function o_t(t,e){let r=t;for(;r!==null&&r.getParent()!==null&&!e(r);)r=r.getParentOrThrow();return e(r)?r:null}function cvt(){return dc()}var CXr=new WeakMap,Lhi=new Map;function M_t(t){if(!t._readOnly&&t.isEmpty())return Lhi;t._readOnly||it(192);let e=CXr.get(t);return e||(e=function(r){let n=new Map;for(let[o,i]of r._nodeMap){let a=i.__type,s=n.get(a);s||(s=new Map,n.set(a,s)),s.set(o,i)}return n}(t),CXr.set(t,e)),e}function YZr(t){let e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function QZr(t,e){let r=parseInt(t.style.paddingInlineStart,10)||0,n=Math.round(r/40);e.setIndent(n)}function Fhi(t){t.__lexicalUnmanaged=!0}function eYr(t){return t.__lexicalUnmanaged===!0}function Ede(t,e){return function(r,n){return Object.prototype.hasOwnProperty.call(r,n)}(t,e)&&t[e]!==jU[e]}function dvt(t){let e=L7r in t.prototype?t.prototype[L7r]():void 0,r=function(a){return a===Vde||a===$U||a===jU}(t),n=!r&&Ede(t,"getType")?t.getType():void 0,o,i=n;if(e)if(n)o=e[n];else for(let[a,s]of Object.entries(e))i=a,o=s;if(!r&&i&&(Ede(t,"getType")||(t.getType=()=>i),Ede(t,"clone")||(t.clone=a=>(Y_t(a),new t)),Ede(t,"importJSON")||(t.importJSON=o&&o.$importJSON||(a=>new t().updateFromJSON(a))),!Ede(t,"importDOM")&&o)){let{importDOM:a}=o;a&&(t.importDOM=()=>a)}return{ownNodeConfig:o,ownNodeType:i}}function khi(t){let e=cvt();return ig(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t))).klass}var qhi={next:"previous",previous:"next"},hY=class{constructor(e){this.origin=e}[Symbol.iterator](){return mvt({hasNext:K3,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return lg(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return lg(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,r){let n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(n===null?this.insert(e):n.replace(e,r)),this}splice(e,r,n="next"){let o=n===this.direction?r:Array.from(r).reverse(),i=this,a=this.getParentAtCaret(),s=new Map;for(let u=i.getAdjacentCaret();u!==null&&s.size<e;u=u.getAdjacentCaret()){let l=u.origin.getWritable();s.set(l.getKey(),l)}for(let u of o){if(s.size>0){let l=i.getNodeAtCaret();if(l){if(s.delete(l.getKey()),s.delete(u.getKey()),!(l.is(u)||i.origin.is(u))){let c=u.getParent();c&&c.is(a)&&u.remove(),l.replace(u)}}else l===null&&it(263,Array.from(s).join(" "))}else i.insert(u);i=lg(u,this.direction)}for(let u of s.values())u.remove();return this}},Hde=class t extends hY{constructor(){super(...arguments);x(this,"type","child")}getLatest(){let r=this.origin.getLatest();return r===this.origin?this:lL(r,this.direction)}getParentCaret(r="root"){return lg(fvt(this.getParentAtCaret(),r),this.direction)}getFlipped(){let r=BU(this.direction);return lg(this.getNodeAtCaret(),r)||lL(this.origin,r)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(r){return r instanceof t&&this.direction===r.direction&&this.origin.is(r.origin)}isSamePointCaret(r){return this.isSameNodeCaret(r)}},Bhi={root:Nv,shadowRoot:xT};function BU(t){return qhi[t]}function fvt(t,e="root"){return Bhi[e](t)?null:t}var gY=class t extends hY{constructor(){super(...arguments);x(this,"type","sibling")}getLatest(){let r=this.origin.getLatest();return r===this.origin?this:lg(r,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return tt(this.origin)?lL(this.origin,this.direction):null}getParentCaret(r="root"){return lg(fvt(this.getParentAtCaret(),r),this.direction)}getFlipped(){let r=BU(this.direction);return lg(this.getNodeAtCaret(),r)||lL(this.origin.getParentOrThrow(),r)}isSamePointCaret(r){return r instanceof t&&this.direction===r.direction&&this.origin.is(r.origin)}isSameNodeCaret(r){return(r instanceof t||r instanceof yY)&&this.direction===r.direction&&this.origin.is(r.origin)}},yY=class t extends hY{constructor(r,n){super(r);x(this,"type","text");this.offset=n}getLatest(){let r=this.origin.getLatest();return r===this.origin?this:LU(r,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(r="root"){return lg(fvt(this.getParentAtCaret(),r),this.direction)}getFlipped(){return LU(this.origin,BU(this.direction),this.offset)}isSamePointCaret(r){return r instanceof t&&this.direction===r.direction&&this.origin.is(r.origin)&&this.offset===r.offset}isSameNodeCaret(r){return(r instanceof gY||r instanceof t)&&this.direction===r.direction&&this.origin.is(r.origin)}getSiblingCaret(){return lg(this.origin,this.direction)}};function sL(t){return t instanceof yY}function Uhi(t){return t instanceof hY}function K3(t){return t instanceof gY}function wT(t){return t instanceof Hde}var zhi={next:class extends yY{constructor(){super(...arguments);x(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends yY{constructor(){super(...arguments);x(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Vhi={next:class extends gY{constructor(){super(...arguments);x(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends gY{constructor(){super(...arguments);x(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Hhi={next:class extends Hde{constructor(){super(...arguments);x(this,"direction","next")}getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Hde{constructor(){super(...arguments);x(this,"direction","previous")}getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function lg(t,e){return t?new Vhi[e](t):null}function LU(t,e,r){return t?new zhi[e](t,ST(t,r)):null}function ST(t,e,r="error"){let n=t.getTextContentSize(),o=e==="next"?n:e==="previous"?0:e;return(o<0||o>n)&&(r!=="clamp"&&function(i,...a){let s=new URL("https://lexical.dev/docs/error"),u=new URLSearchParams;u.append("code",i);for(let l of a)u.append("v",l);s.search=u.toString(),console.warn(`Minified Lexical warning #${i}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(284,String(e),String(n),t.getKey()),o=o<0?0:n),o}function R_t(t,e){return new pFe(t,e)}function lL(t,e){return tt(t)?new Hhi[e](t):null}function tYr(t){return t&&t.getChildCaret()||t}function bY(t){return t&&tYr(t.getAdjacentCaret())}var I_t=class t{constructor(e,r,n){x(this,"type","node-caret-range");this.anchor=e,this.focus=r,this.direction=n}getLatest(){let e=this.anchor.getLatest(),r=this.focus.getLatest();return e===this.anchor&&r===this.focus?this:new t(e,r,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=o=>{let i=this[o].getLatest();return sL(i)?function(a,s){let{direction:u,origin:l}=a,c=ST(l,s==="focus"?BU(u):u);return R_t(a,c-a.offset)}(i,o):null},r=e("anchor"),n=e("focus");if(r&&n){let{caret:o}=r,{caret:i}=n;if(o.isSameNodeCaret(i))return[R_t(o,i.offset-o.offset),null]}return[r,n]}iterNodeCarets(e="root"){let r=sL(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),o=sL(n),i=a=>a.isSameNodeCaret(n)?null:bY(a)||a.getParentCaret(e);return mvt({hasNext:a=>a!==null&&!(o&&n.isSameNodeCaret(a)),initial:r.isSameNodeCaret(n)?null:i(r),map:a=>a,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}},pFe=class{constructor(e,r){x(this,"type","slice");this.caret=e,this.distance=r}getSliceIndices(){let{distance:e,caret:{offset:r}}=this,n=r+e;return n<r?[n,r]:[r,n]}getTextContent(){let[e,r]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,r)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:r}}=this,[n,o]=this.getSliceIndices(),i=e.getTextContent();return LU(e.setTextContent(i.slice(0,n)+i.slice(o)),r,n)}};function Whi(t){return t instanceof pFe}function pvt(t){return FU(t,lg(jv(),t.direction))}function rYr(t){return FU(t,t)}function FU(t,e){return t.direction!==e.direction&&it(265),new I_t(t,e,t.direction)}function mvt(t){let{initial:e,hasNext:r,step:n,map:o}=t,i=e;return{[Symbol.iterator](){return this},next(){if(!r(i))return{done:!0,value:void 0};let a={done:!1,value:o(i)};return i=n(i),a}}}function hvt(t,e){let r=Nde(t.origin,e.origin);switch(r===null&&it(275,t.origin.getKey(),e.origin.getKey()),r.type){case"same":{let n=t.type==="text",o=e.type==="text";return n&&o?function(i,a){return Math.sign(i-a)}(t.offset,e.offset):t.type===e.type?0:n?-1:o?1:t.type==="child"?-1:1}case"ancestor":return t.type==="child"?-1:1;case"descendant":return e.type==="child"?1:-1;case"branch":return gvt(r)}}function gvt(t){let{a:e,b:r}=t,n=e.__key,o=r.__key,i=e,a=r;for(;i&&a;i=i.getNextSibling(),a=a.getNextSibling()){if(i.__key===o)return-1;if(a.__key===n)return 1}return i===null?1:-1}function VLe(t,e){return e.is(t)}function xXr(t){return tt(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function Nde(t,e){if(t.is(e))return{commonAncestor:t,type:"same"};let r=new Map;for(let[n,o]=xXr(t);n;o=n,n=n.getParent())r.set(n,o);for(let[n,o]=xXr(e);n;o=n,n=n.getParent()){let i=r.get(n);if(i!==void 0)return i===null?(VLe(t,n)||it(276),{commonAncestor:n,type:"ancestor"}):o===null?(VLe(e,n)||it(277),{commonAncestor:n,type:"descendant"}):((tt(i)||VLe(t,i))&&(tt(o)||VLe(e,o))&&n.is(i.getParent())&&n.is(o.getParent())||it(278),{a:i,b:o,commonAncestor:n,type:"branch"})}return null}function kU(t,e){let{type:r,key:n,offset:o}=t,i=KZr(t.key);return r==="text"?(Ar(i)||it(266,i.getType(),n),LU(i,e,o)):(tt(i)||it(267,i.getType(),n),aYr(i,t.offset,e))}function _Y(t,e){let{origin:r,direction:n}=e,o=n==="next";sL(e)?t.set(r.getKey(),e.offset,"text"):K3(e)?Ar(r)?t.set(r.getKey(),ST(r,n),"text"):t.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(o?1:0),"element"):(wT(e)&&tt(r)||it(268),t.set(r.getKey(),o?0:r.getChildrenSize(),"element"))}function nYr(t){let e=qs(),r=mn(e)?e:SZr();return Dde(r,t),$v(r),r}function Dde(t,e){_Y(t.anchor,e.anchor),_Y(t.focus,e.focus)}function A_t(t){let{anchor:e,focus:r}=t,n=kU(e,"next"),o=kU(r,"next"),i=hvt(n,o)<=0?"next":"previous";return FU(qU(n,i),qU(o,i))}function SY(t){let{direction:e,origin:r}=t,n=lg(r,BU(e)).getNodeAtCaret();return n?lg(n,e):lL(r.getParentOrThrow(),e)}function TXr(t,e="root"){let r=[t];for(let n=wT(t)?t.getParentCaret(e):t.getSiblingCaret();n!==null;n=n.getParentCaret(e))r.push(SY(n));return r}function i_t(t){return!!t&&t.origin.isAttached()}function oYr(t,e="removeEmptySlices"){if(t.isCollapsed())return t;let r="root",n="next",o=e,i=yvt(t,n),a=TXr(i.anchor,r),s=TXr(i.focus.getFlipped(),r),u=new Set,l=[];for(let m of i.iterNodeCarets(r))if(wT(m))u.add(m.origin.getKey());else if(K3(m)){let{origin:h}=m;tt(h)&&!u.has(h.getKey())||l.push(h)}for(let m of l)m.remove();for(let m of i.getTextSlices()){if(!m)continue;let{origin:h}=m.caret,y=h.getTextContentSize(),g=SY(lg(h,n)),b=h.getMode();if(Math.abs(m.distance)===y&&o==="removeEmptySlices"||b==="token"&&m.distance!==0)g.remove();else if(m.distance!==0){o="removeEmptySlices";let _=m.removeTextSlice(),w=m.caret.origin;if(b==="segmented"){let T=_.origin,O=og(T.getTextContent()).setStyle(T.getStyle()).setFormat(T.getFormat());g.replaceOrInsert(O),_=LU(O,n,_.offset)}w.is(a[0].origin)&&(a[0]=_),w.is(s[0].origin)&&(s[0]=_.getFlipped())}}let c,d;for(let m of a)if(i_t(m)){c=_T(m);break}for(let m of s)if(i_t(m)){d=_T(m);break}let f=function(m,h,y){if(!m||!h)return null;let g=m.getParentAtCaret(),b=h.getParentAtCaret();if(!g||!b)return null;let _=g.getParents().reverse();_.push(g);let w=b.getParents().reverse();w.push(b);let T=Math.min(_.length,w.length),O;for(O=0;O<T&&_[O]===w[O];O++);let E=(I,A)=>{let B;for(let k=O;k<I.length;k++){let q=I[k];if(xT(q))return;!B&&A(q)&&(B=q)}return B},P=E(_,iL),R=P&&E(w,I=>y.has(I.getKey())&&iL(I));return P&&R?[P,R]:null}(c,d,u);if(f){let[m,h]=f;lL(m,"previous").splice(0,h.getChildren()),h.remove()}let p=[c,d,...a,...s].find(i_t);if(p)return rYr(qU(_T(p),t.direction));it(269,JSON.stringify(a.map(m=>m.origin.__key)))}function _T(t){let e=function(o){let i=o;for(;wT(i);){let a=bY(i);if(!wT(a))break;i=a}return i}(t.getLatest()),{direction:r}=e;if(Ar(e.origin))return sL(e)?e:LU(e.origin,r,r);let n=e.getAdjacentCaret();return K3(n)&&Ar(n.origin)?LU(n.origin,r,BU(r)):e}function iYr(t){return sL(t)&&t.offset!==ST(t.origin,t.direction)}function qU(t,e){return t.direction===e?t:t.getFlipped()}function yvt(t,e){return t.direction===e?t:FU(qU(t.focus,e),qU(t.anchor,e))}function aYr(t,e,r){let n=lL(t,"next");for(let o=0;o<e;o++){let i=n.getAdjacentCaret();if(i===null)break;n=i}return qU(n,r)}function Jhi(t,e="root"){let r=0,n=t,o=bY(n);for(;o===null;){if(r--,o=n.getParentCaret(e),!o)return null;n=o,o=bY(n)}return o&&[o,r]}function Khi(t){let{origin:e,offset:r,direction:n}=t;if(r===ST(e,n))return t.getSiblingCaret();if(r===ST(e,BU(n)))return SY(t.getSiblingCaret());let[o]=e.splitText(r);return Ar(o)||it(281),qU(lg(o,"next"),n)}function Ghi(t,e){return!0}function Xhi(t,{$copyElementNode:e=lvt,$splitTextPointCaretNext:r=Khi,rootMode:n="shadowRoot",$shouldSplit:o=Ghi}={}){if(sL(t))return r(t);let i=t.getParentCaret(n);if(i){let{origin:a}=i;if(wT(t)&&(!a.canBeEmpty()||!o(a,"first")))return SY(i);let s=function(u){let l=[];for(let c=u.getAdjacentCaret();c;c=c.getAdjacentCaret())l.push(c.origin);return l}(t);(s.length>0||a.canBeEmpty()&&o(a,"last"))&&i.insert(e(a).splice(0,0,s))}return i}var be=bvt,Bqs=be.$addUpdateTag,Uqs=be.$applyNodeReplacement,CY=be.$caretFromPoint,sYr=be.$caretRangeFromSelection,UU=be.$cloneWithProperties,zqs=be.$comparePointCaretNext,Vqs=be.$copyNode,Hqs=be.$create,_vt=be.$createLineBreakNode,Wqs=be.$createNodeSelection,dL=be.$createParagraphNode,Jqs=be.$createPoint,TFe=be.$createRangeSelection,Kqs=be.$createRangeSelectionFromDom,uYr=be.$createTabNode,rS=be.$createTextNode,lYr=be.$extendCaretToRange,Xde=be.$getAdjacentChildCaret,Gqs=be.$getAdjacentNode,Xqs=be.$getAdjacentSiblingOrParentSiblingCaret,vvt=be.$getCaretInDirection,cYr=be.$getCaretRange,Zqs=be.$getCaretRangeInDirection,dYr=be.$getCharacterOffsets,zU=be.$getChildCaret,Yqs=be.$getChildCaretAtIndex,wvt=be.$getChildCaretOrSelf,fYr=be.$getCollapsedCaretRange,Qqs=be.$getCommonAncestor,eBs=be.$getCommonAncestorResultBranchOrder,OFe=be.$getEditor,tBs=be.$getNearestNodeFromDOMNode,rBs=be.$getNearestRootOrShadowRoot,pYr=be.$getNodeByKey,nBs=be.$getNodeByKeyOrThrow,Zde=be.$getPreviousSelection,Ci=be.$getRoot,Sn=be.$getSelection,fL=be.$getSiblingCaret,mYr=be.$getState,oBs=be.$getStateChange,iBs=be.$getTextContent,aBs=be.$getTextNodeOffset,sBs=be.$getTextPointCaret,uBs=be.$getTextPointCaretSlice,lBs=be.$getWritableNodeState,hYr=be.$hasAncestor,cBs=be.$hasUpdateTag,dBs=be.$insertNodes,EFe=be.$isBlockElementNode,Yde=be.$isChildCaret,PFe=be.$isDecoratorNode,gi=be.$isElementNode,gYr=be.$isExtendableTextPointCaret,fBs=be.$isInlineElementOrDecoratorNode,yYr=be.$isLeafNode,pBs=be.$isLineBreakNode,mBs=be.$isNodeCaret,hBs=be.$isNodeSelection,bYr=be.$isParagraphNode,jr=be.$isRangeSelection,xY=be.$isRootNode,X3=be.$isRootOrShadowRoot,_Yr=be.$isSiblingCaret,gBs=be.$isTabNode,Yi=be.$isTextNode,MFe=be.$isTextPointCaret,yBs=be.$isTextPointCaretSlice,Svt=be.$isTokenOrSegmented,bBs=be.$isTokenOrTab,_Bs=be.$nodesOfType,vYr=be.$normalizeCaret,vBs=be.$normalizeSelection__EXPERIMENTAL,wBs=be.$onUpdate,wYr=be.$parseSerializedNode,SBs=be.$removeTextFromCaretRange,SYr=be.$rewindSiblingCaret,RFe=be.$selectAll,CBs=be.$setCompositionKey,xBs=be.$setPointFromCaret,Z3=be.$setSelection,CYr=be.$setSelectionFromCaretRange,xYr=be.$setState,TYr=be.$splitAtPointCaretNext,OYr=be.$splitNode,TBs=be.$updateRangeSelectionFromCaretRange,Cvt=be.ArtificialNode__DO_NOT_USE,EYr=be.BLUR_COMMAND,Qde=be.CAN_REDO_COMMAND,efe=be.CAN_UNDO_COMMAND,PYr=be.CLEAR_EDITOR_COMMAND,MYr=be.CLEAR_HISTORY_COMMAND,OBs=be.CLICK_COMMAND,EBs=be.COLLABORATION_TAG,IFe=be.COMMAND_PRIORITY_CRITICAL,nl=be.COMMAND_PRIORITY_EDITOR,pL=be.COMMAND_PRIORITY_HIGH,RYr=be.COMMAND_PRIORITY_LOW,PBs=be.COMMAND_PRIORITY_NORMAL,IYr=be.CONTROLLED_TEXT_INSERTION_COMMAND,AFe=be.COPY_COMMAND,AYr=be.CUT_COMMAND,TY=be.DELETE_CHARACTER_COMMAND,NYr=be.DELETE_LINE_COMMAND,DYr=be.DELETE_WORD_COMMAND,MBs=be.DRAGEND_COMMAND,RBs=be.DRAGOVER_COMMAND,jYr=be.DRAGSTART_COMMAND,$Yr=be.DROP_COMMAND,NFe=be.DecoratorNode,IBs=be.ElementNode,ABs=be.FOCUS_COMMAND,NBs=be.FORMAT_ELEMENT_COMMAND,DBs=be.FORMAT_TEXT_COMMAND,DFe=be.HISTORIC_TAG,OY=be.HISTORY_MERGE_TAG,LYr=be.HISTORY_PUSH_TAG,jBs=be.INDENT_CONTENT_COMMAND,xvt=be.INSERT_LINE_BREAK_COMMAND,FYr=be.INSERT_PARAGRAPH_COMMAND,$Bs=be.INSERT_TAB_COMMAND,tfe=be.INTERNAL_$isBlock,LBs=be.IS_ALL_FORMATTING,FBs=be.IS_BOLD,kBs=be.IS_CODE,qBs=be.IS_HIGHLIGHT,BBs=be.IS_ITALIC,UBs=be.IS_STRIKETHROUGH,zBs=be.IS_SUBSCRIPT,VBs=be.IS_SUPERSCRIPT,HBs=be.IS_UNDERLINE,kYr=be.KEY_ARROW_DOWN_COMMAND,qYr=be.KEY_ARROW_LEFT_COMMAND,BYr=be.KEY_ARROW_RIGHT_COMMAND,UYr=be.KEY_ARROW_UP_COMMAND,zYr=be.KEY_BACKSPACE_COMMAND,VYr=be.KEY_DELETE_COMMAND,WBs=be.KEY_DOWN_COMMAND,EY=be.KEY_ENTER_COMMAND,HYr=be.KEY_ESCAPE_COMMAND,JBs=be.KEY_MODIFIER_COMMAND,KBs=be.KEY_SPACE_COMMAND,WYr=be.KEY_TAB_COMMAND,GBs=be.LineBreakNode,XBs=be.MOVE_TO_END,ZBs=be.MOVE_TO_START,YBs=be.NODE_STATE_KEY,QBs=be.OUTDENT_CONTENT_COMMAND,jFe=be.PASTE_COMMAND,JYr=be.PASTE_TAG,eUs=be.ParagraphNode,KYr=be.REDO_COMMAND,GYr=be.REMOVE_TEXT_COMMAND,tUs=be.RootNode,rUs=be.SELECTION_CHANGE_COMMAND,XYr=be.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,ZYr=be.SELECT_ALL_COMMAND,nUs=be.SKIP_COLLAB_TAG,oUs=be.SKIP_DOM_SELECTION_TAG,iUs=be.SKIP_SCROLL_INTO_VIEW_TAG,aUs=be.TEXT_TYPE_TO_FORMAT,sUs=be.TabNode,yN=be.TextNode,YYr=be.UNDO_COMMAND,uUs=be.buildImportMap,QYr=be.createCommand,eQr=be.createEditor,lUs=be.createSharedNodeState,cUs=be.createState,dUs=be.flipDirection,fUs=be.getDOMOwnerDocument,Tvt=be.getDOMSelection,pUs=be.getDOMSelectionFromTarget,tQr=be.getDOMTextNode,mUs=be.getEditorPropertyFromDOMNode,hUs=be.getNearestEditorFromDOMNode,rQr=be.getRegisteredNode,gUs=be.getRegisteredNodeOrThrow,nQr=be.isBlockDomNode,yUs=be.isCurrentlyReadOnlyMode,bUs=be.isDOMDocumentNode,_Us=be.isDOMNode,vUs=be.isDOMTextNode,wUs=be.isDOMUnmanaged,Ovt=be.isDocumentFragment,SUs=be.isExactShortcutMatch,oQr=be.isHTMLAnchorElement,$Fe=be.isHTMLElement,rfe=be.isInlineDomNode,CUs=be.isLexicalEditor,xUs=be.isModifierMatch,TUs=be.isSelectionCapturedInDecoratorInput,iQr=be.isSelectionWithinEditor,Evt=be.makeStepwiseIterator,OUs=be.removeFromParent,EUs=be.resetRandomKey,PUs=be.setDOMUnmanaged,MUs=be.setNodeIndentFromDOM;var wQr=$(K());Mr();var _Qr=require("obsidian"),hn=$(K());xn();var LFe=$(K());_be();zr();var Zhi=R5("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"}}),Xc=LFe.forwardRef(({className:t,variant:e,...r},n)=>LFe.createElement("div",{ref:n,className:Se(Zhi({variant:e}),t),...r}));Xc.displayName="Badge";var ao=$(K());Mr();var PY=$(K());zr();var FFe=$(K()),Yhi=2;function Qhi(t,e){return e&&e>1?t.current?t.current.offsetHeight<t.current.scrollHeight:!1:(t.current&&t.current?.offsetWidth+Yhi<t.current?.scrollWidth)??!1}function egi(t){switch(t){case 2:return"tw-line-clamp-2";case 3:return"tw-line-clamp-3";default:return""}}var fc=({children:t,className:e,lineClamp:r,tooltipContent:n,alwaysShowTooltip:o=!1,...i})=>{let a=(0,FFe.useRef)(null),[s,u]=(0,FFe.useState)(!1);return PY.default.createElement(s_,{delayDuration:0},PY.default.createElement(vn,{open:s,onOpenChange:c=>{u(c&&(o||Qhi(a,r)))}},PY.default.createElement(wn,{asChild:!0},PY.default.createElement("div",{...i,ref:a,className:Se("tw-max-w-full tw-text-normal",(!r||r<=1)&&"tw-truncate",r&&egi(r),e),"data-testid":"truncatedText"},t)),PY.default.createElement(pn,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},n??t)))};Dt();zr();var MY=$(K());Mr();zr();function bN({children:t,icon:e,onRemove:r,className:n,isClickable:o=!1,...i}){return MY.default.createElement(Xc,{variant:"default",tabIndex:r?0:void 0,className:Se("tw-group/badge tw-items-center tw-gap-1 tw-border tw-border-solid tw-border-border tw-py-1 tw-pl-1.5 tw-pr-2 tw-text-xs",o&&"tw-cursor-pointer hover:tw-bg-interactive-hover",n),onKeyDown:r?a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),a.stopPropagation(),r())}:void 0,...i},MY.default.createElement("span",{className:"tw-relative tw-size-4 tw-shrink-0"},MY.default.createElement("span",{className:Se("tw-flex tw-size-full tw-items-center tw-justify-center",r&&"context-badge-icon-removable group-focus-within/badge:tw-invisible group-hover/badge:tw-invisible")},e),r&&MY.default.createElement("div",{"aria-hidden":"true",className:"context-badge-close tw-invisible tw-absolute tw-inset-0 tw-flex tw-items-center tw-justify-center tw-text-muted group-focus-within/badge:tw-visible group-hover/badge:tw-visible",onClick:a=>{a.stopPropagation(),r()}},MY.default.createElement(Ho,{className:"tw-size-3"}))),t)}function kFe(t){return t.sourceType==="web"}function nfe({faviconUrl:t,isLoaded:e=!0,className:r="tw-size-3"}){let[n,o]=ao.default.useState(!!t);return ao.default.useEffect(()=>{o(!!t)},[t]),e?n&&t?ao.default.createElement("img",{src:t,alt:"",referrerPolicy:"no-referrer",loading:"lazy",decoding:"async",className:Se(r,"tw-rounded-sm"),onError:()=>o(!1)}):ao.default.createElement(_l,{className:r}):ao.default.createElement(v1,{className:Se(r,"tw-text-muted")})}function aQr({currentActiveFile:t,onRemove:e,onClick:r}){if(!t)return null;let n=ao.default.createElement("div",{className:"tw-text-left"},t.path),o=t.extension==="pdf",i=t.extension==="canvas";return ao.default.createElement(bN,{icon:ao.default.createElement(ju,{className:"tw-size-3"}),onRemove:e,isClickable:!!r,onClick:r},ao.default.createElement(fc,{className:"tw-max-w-40",tooltipContent:n,alwaysShowTooltip:!0},t.basename),ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),o&&ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf"),i&&ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"canvas"))}function sQr({activeWebTab:t,onRemove:e,onClick:r}){if(!t)return null;let n=n1(t.url),o=t.title||n||t.url||"Untitled",i=ao.default.createElement("div",{className:"tw-text-left"},t.url);return ao.default.createElement(bN,{icon:ao.default.createElement(nfe,{faviconUrl:t.faviconUrl}),onRemove:e,isClickable:!!r,onClick:r},ao.default.createElement(fc,{className:"tw-max-w-40",tooltipContent:i,alwaysShowTooltip:!0},o),ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"))}function qFe({note:t,onRemove:e,onClick:r}){let n=ao.default.createElement("div",{className:"tw-text-left"},t.path),o=t.extension==="pdf",i=t.extension==="canvas";return ao.default.createElement(bN,{icon:ao.default.createElement(ju,{className:"tw-size-3"}),onRemove:e,isClickable:!!r,onClick:r},ao.default.createElement(fc,{className:"tw-max-w-40",tooltipContent:n,alwaysShowTooltip:!0},t.basename),o&&ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf"),i&&ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"canvas"))}function BFe({url:t,onRemove:e}){return ao.default.createElement(bN,{icon:ao.default.createElement(w1,{className:"tw-size-3"}),onRemove:e},ao.default.createElement(fc,{className:"tw-max-w-40",tooltipContent:t},n1(t)))}function UFe({webTab:t,onRemove:e,onClick:r}){let n=t.isLoaded!==!1,o=n1(t.url),i=t.title||o||t.url||"Untitled",a=n?t.url:"Tab not loaded - switch to this tab to load content";return ao.default.createElement(bN,{icon:ao.default.createElement(nfe,{faviconUrl:t.faviconUrl,isLoaded:n}),onRemove:e,isClickable:!!r,onClick:r,className:Se(!n&&"tw-opacity-60")},ao.default.createElement(fc,{className:Se("tw-max-w-40",!n&&"tw-italic"),tooltipContent:a},i),!n&&ao.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"(not loaded)"))}function uQr({tag:t,onRemove:e}){let r=t.startsWith("#")?t.slice(1):t;return ao.default.createElement(bN,{icon:ao.default.createElement(AF,{className:"tw-size-3"}),onRemove:e},ao.default.createElement(fc,{className:"tw-max-w-40",tooltipContent:t},r))}function zFe({folder:t,onRemove:e}){return ao.default.createElement(bN,{icon:ao.default.createElement(Am,{className:"tw-size-3"}),onRemove:e},ao.default.createElement(fc,{className:"tw-max-w-40",tooltipContent:t,alwaysShowTooltip:!0},t))}function lQr({selectedText:t,onRemove:e}){if(kFe(t)){let o=n1(t.url),i=ao.default.createElement("div",{className:"tw-text-left"},t.url);return ao.default.createElement(bN,{icon:ao.default.createElement(nfe,{faviconUrl:t.faviconUrl}),onRemove:e},ao.default.createElement(fc,{className:"tw-max-w-40",tooltipContent:i,alwaysShowTooltip:!0},t.title||o),ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Selection"))}let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`,n=ao.default.createElement("div",{className:"tw-text-left"},t.notePath," (",r,")");return ao.default.createElement(bN,{icon:ao.default.createElement(ju,{className:"tw-size-3"}),onRemove:e},ao.default.createElement(fc,{className:"tw-max-w-40",tooltipContent:n,alwaysShowTooltip:!0},t.noteTitle),ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r))}rd();na();Dt();AZ();var Lv=$(K());var cQr=$(K());var Mu=$(K());Mr();zr();var tgi=120,rgi=240;function VFe({options:t,selectedIndex:e,onSelect:r,onHighlight:n,query:o="",mode:i="search",showPreview:a=!1,searchBarMode:s=!1,searchQuery:u="",onSearchChange:l,onKeyDown:c,className:d,width:f}){let p=(0,Mu.useRef)(null),m=(0,Mu.useRef)(null),[h,y]=Mu.default.useState(null);(0,Mu.useEffect)(()=>{y(null)},[e]),(0,Mu.useEffect)(()=>{p.current&&p.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[e]);let g=w=>{let T=w.target.value;l?.(T)},b=w=>{(w.key==="ArrowDown"||w.key==="ArrowUp"||w.key==="Enter"||w.key==="Tab"||w.key==="Escape")&&(w.preventDefault(),c?.(w))},_=a&&t[e]?.content;return Mu.default.createElement("div",{className:Se("tw-flex tw-flex-col",d)},_&&Mu.default.createElement("div",{className:"tw-mb-2 tw-overflow-hidden tw-rounded-md tw-bg-primary tw-p-3 tw-text-sm tw-shadow-xl",style:{minHeight:tgi,maxHeight:rgi,...f&&{width:f}}},Mu.default.createElement("div",{className:"tw-mb-1 tw-text-xs tw-text-muted"},"Preview"),t[e].subtitle&&Mu.default.createElement("div",{className:"tw-mb-2 tw-text-xs tw-text-muted"},t[e].subtitle),Mu.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-normal"},t[e].content)),Mu.default.createElement("div",{className:"tw-overflow-hidden tw-rounded-lg tw-bg-primary",style:{...f&&{width:f}}},Mu.default.createElement("div",{className:"tw-overflow-y-auto",style:{minHeight:Math.min(t.length*44+16,100),maxHeight:240}},Mu.default.createElement("div",{className:"tw-p-2 tw-text-normal"},t.map((w,T)=>{let O=T===e,E=T===h,P=w.disabled??!1,R=(O||E)&&!P,I=i==="category"&&!o&&w.icon&&!("data"in w);return Mu.default.createElement("div",{key:w.key,ref:O?p:void 0,className:Se("tw-flex tw-items-center tw-rounded-md tw-px-3 tw-py-2 tw-text-sm",P?"tw-cursor-not-allowed tw-text-muted tw-opacity-50":"tw-cursor-pointer tw-text-normal",R&&"tw-bg-modifier-hover"),title:P?w.disabledReason:void 0,onMouseDown:A=>{A.preventDefault(),!P&&r(w)},onMouseEnter:()=>{P||(y(T),n(T))},onMouseLeave:()=>y(null)},I?Mu.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between"},Mu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},w.icon,Mu.default.createElement("span",{className:"tw-font-medium"},w.title)),Mu.default.createElement(od,{className:"tw-size-4 tw-text-muted"})):Mu.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-items-center tw-gap-2"},w.icon&&Mu.default.createElement("div",{className:"tw-flex tw-h-full tw-shrink-0 tw-items-center"},w.icon),Mu.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col tw-gap-0.5"},Mu.default.createElement("div",{className:"tw-truncate tw-font-medium tw-text-normal"},w.title),w.subtitle&&Mu.default.createElement("div",{className:"tw-truncate tw-text-xs tw-text-muted"},w.subtitle))))}))),s&&Mu.default.createElement("div",{className:"tw-border-t tw-border-solid tw-border-border tw-p-0.5"},Mu.default.createElement("input",{ref:m,type:"text",value:u,onChange:g,onKeyDown:b,placeholder:"Search...",autoFocus:!0,className:"tw-w-full tw-rounded-md !tw-border-none !tw-bg-transparent tw-px-1 tw-py-0 tw-text-sm tw-text-normal placeholder:tw-text-muted focus:!tw-shadow-none"}))))}function dQr({options:t,selectedIndex:e,onSelect:r,onHighlight:n,query:o="",mode:i="search",showPreview:a=!1,searchBarMode:s=!1,searchQuery:u="",onSearchChange:l,onKeyDown:c}){return cQr.default.createElement(VFe,{options:t,selectedIndex:e,onSelect:r,onHighlight:n,query:o,mode:i,showPreview:a,searchBarMode:s,searchQuery:u,onSearchChange:l,onKeyDown:c})}var Y3=$(K()),fQr=require("obsidian");Mr();var ngi=[{key:"notes",title:"Notes",subtitle:"Reference notes in your vault",category:"notes",icon:Y3.default.createElement(ju,{className:"tw-size-4"})},{key:"webTabs",title:"Web Tabs",subtitle:"Reference open browser tabs",category:"webTabs",icon:Y3.default.createElement(_l,{className:"tw-size-4"})},{key:"tools",title:"Tools",subtitle:"AI tools and commands",category:"tools",icon:Y3.default.createElement(mw,{className:"tw-size-4"})},{key:"folders",title:"Folders",subtitle:"Reference vault folders",category:"folders",icon:Y3.default.createElement(Am,{className:"tw-size-4"})}];function HFe(t=!1){return(0,Y3.useMemo)(()=>ngi.filter(e=>e.category==="tools"?t:e.category==="webTabs"?fQr.Platform.isDesktopApp:!0),[t])}var cb=$(K()),Nvt=require("obsidian");Mr();var Dvt=$(ofe());var mQr=$(K());LC();LC();var OT=require("obsidian"),ife=$(YG());Qe();Dt();Xe();var JFe=250,Pvt=yc([]),Mvt=yc([]),Rvt=yc([]),Ivt=yc([]),Q3=class Q3{constructor(){this.initialized=!1;this.handleFileCreate=e=>{e instanceof OT.TFile?uO(e)&&(this.debouncedRefreshNotes(),this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll()):e instanceof OT.TFolder&&this.debouncedRefreshFolders()};this.handleFileDelete=e=>{e instanceof OT.TFile?uO(e)&&(this.debouncedRefreshNotes(),this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll()):e instanceof OT.TFolder&&this.debouncedRefreshFolders()};this.handleFileRename=(e,r)=>{e instanceof OT.TFile?uO(e)&&(this.debouncedRefreshNotes(),this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll()):e instanceof OT.TFolder&&this.debouncedRefreshFolders()};this.handleFileModify=e=>{e instanceof OT.TFile&&e.extension==="md"&&this.debouncedRefreshTagsAll()};this.handleMetadataChange=e=>{e.extension==="md"&&(this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll())};this.debouncedRefreshNotes=(0,ife.default)(()=>this.refreshNotes(),JFe,{leading:!0,trailing:!0});this.debouncedRefreshFolders=(0,ife.default)(()=>this.refreshFolders(),JFe,{leading:!0,trailing:!0});this.debouncedRefreshTagsFrontmatter=(0,ife.default)(()=>this.refreshTagsFrontmatter(),JFe,{leading:!0,trailing:!0});this.debouncedRefreshTagsAll=(0,ife.default)(()=>this.refreshTagsAll(),JFe,{leading:!0,trailing:!0});this.refreshNotes=()=>{if(!app?.vault)return;let r=app.vault.getFiles().filter(n=>n instanceof OT.TFile&&uO(n));jo.set(Pvt,r)};this.refreshFolders=()=>{if(!app?.vault)return;let e=app.vault.getAllLoadedFiles().filter(r=>r instanceof OT.TFolder);jo.set(Mvt,e)};this.refreshTagsFrontmatter=()=>{if(!app?.vault||!app?.metadataCache)return;let e=new Set;app.vault.getMarkdownFiles().forEach(n=>{sO(n,!0).forEach(i=>{let a=i.startsWith("#")?i:`#${i}`;e.add(a)})});let r=Array.from(e).sort();jo.set(Rvt,r)};this.refreshTagsAll=()=>{if(!app?.vault||!app?.metadataCache)return;let e=new Set;app.vault.getMarkdownFiles().forEach(n=>{sO(n,!1).forEach(i=>{let a=i.startsWith("#")?i:`#${i}`;e.add(a)})});let r=Array.from(e).sort();jo.set(Ivt,r)}}static getInstance(){return Q3.instance||(Q3.instance=new Q3),Q3.instance}initialize(){if(this.initialized){F("VaultDataManager: Already initialized, skipping");return}if(!app?.vault){F("VaultDataManager: app.vault not available, deferring initialization");return}F("VaultDataManager: Initializing with vault event listeners"),this.refreshNotes(),this.refreshFolders(),this.refreshTagsFrontmatter(),this.refreshTagsAll(),app.vault.on("create",this.handleFileCreate),app.vault.on("delete",this.handleFileDelete),app.vault.on("rename",this.handleFileRename),app.vault.on("modify",this.handleFileModify),app.metadataCache.on("changed",this.handleMetadataChange),this.initialized=!0}cleanup(){this.initialized&&(F("VaultDataManager: Cleaning up event listeners"),this.debouncedRefreshNotes.cancel(),this.debouncedRefreshFolders.cancel(),this.debouncedRefreshTagsFrontmatter.cancel(),this.debouncedRefreshTagsAll.cancel(),app?.vault&&(app.vault.off("create",this.handleFileCreate),app.vault.off("delete",this.handleFileDelete),app.vault.off("rename",this.handleFileRename),app.vault.off("modify",this.handleFileModify)),app?.metadataCache&&app.metadataCache.off("changed",this.handleMetadataChange),this.initialized=!1)}unload(){this.cleanup()}};Q3.instance=null;var afe=Q3;Qe();function KFe(t=!1){let e=I_(Pvt,{store:jo});return(0,mQr.useMemo)(()=>{let r;return t?r=[...e]:r=e.filter(n=>n.extension==="md"||n.extension==="canvas"),r.sort((n,o)=>o.stat.ctime-n.stat.ctime)},[e,t])}LC();Qe();function hQr(){return I_(Mvt,{store:jo})}var RY=$(K()),gQr=require("obsidian");T3();var ogi=6e3;function igi(){try{let t=md(app),e=t.getLeaves(),r=[];for(let n of e){let o=t.getPageInfo(n),i=n.view,a=!!o.url?.trim(),s=!!o.title?.trim();if(!a&&!s)continue;let u=i.webviewMounted===void 0||i.webviewFirstLoadFinished===void 0?!0:!!(i.webviewMounted&&i.webviewFirstLoadFinished),l=a&&u;r.push({url:o.url||"",title:o.title||void 0,faviconUrl:o.faviconUrl||void 0,isLoaded:l})}return r.sort((n,o)=>{if(n.isLoaded!==o.isLoaded)return n.isLoaded?-1:1;let i=n.url||n.title||"",a=o.url||o.title||"";return i.localeCompare(a)}),r}catch{return[]}}function agi(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r];if(n.url!==o.url||n.title!==o.title||n.faviconUrl!==o.faviconUrl||n.isLoaded!==o.isLoaded)return!1}return!0}function yQr(t={}){let{enabled:e=!0}=t,[r,n]=(0,RY.useState)([]),o=(0,RY.useRef)(null);return(0,RY.useEffect)(()=>{if(!e){n([]);return}if(!gQr.Platform.isDesktopApp){n([]);return}let i=!1,a=()=>{if(i)return;let p=igi();n(m=>agi(m,p)?m:p)},s=()=>{i||o.current===null&&(o.current=window.requestAnimationFrame(()=>{o.current=null,a()}))};a();let l=md(app).subscribeToWebviewLoad(s),c=app.workspace.on("layout-change",s),d=app.workspace.on("active-leaf-change",s),f=window.setInterval(s,ogi);return()=>{i=!0,o.current!==null&&(window.cancelAnimationFrame(o.current),o.current=null),window.clearInterval(f),app.workspace.offref(c),app.workspace.offref(d),l()}},[e]),r}var XFe=$(K()),Avt=require("obsidian");T3();var GFe={activeWebTabForMentions:null,activeOrLastWebTab:null};function VU(){let[t,e]=(0,XFe.useState)(()=>{if(!Avt.Platform.isDesktopApp)return GFe;try{return md(app).getActiveWebTabState()}catch{return GFe}});return(0,XFe.useEffect)(()=>{if(!Avt.Platform.isDesktopApp){e(GFe);return}let r;try{let n=md(app);e(n.getActiveWebTabState()),r=n.subscribeActiveWebTabState(e)}catch{e(GFe)}return()=>{r?.()}},[]),t}Qe();var sfe=30;function ZFe(t,e,r,n,o,i=null){let a=KFe(n),s=hQr(),u=Nvt.Platform.isDesktopApp&&(e==="category"&&t.trim().length>0||e==="search"&&r==="webTabs"),l=yQr({enabled:u}),{activeWebTabForMentions:c}=VU(),d=(0,cb.useMemo)(()=>a.map((h,y)=>({key:`note-${h.basename}-${y}`,title:h.basename,subtitle:h.path,category:"notes",data:h,content:void 0,icon:cb.default.createElement(ju,{className:"tw-size-4"}),searchKeyword:h.path})),[a]),f=(0,cb.useMemo)(()=>n?gX.map(h=>({key:`tool-${h}`,title:h,subtitle:bmt(h),category:"tools",data:h,content:bmt(h),icon:cb.default.createElement(mw,{className:"tw-size-4"})})):[],[n]),p=(0,cb.useMemo)(()=>s.map(h=>({key:`folder-${h.path}`,title:h.name,subtitle:h.path,category:"folders",data:h,content:void 0,icon:cb.default.createElement(Am,{className:"tw-size-4"}),searchKeyword:h.path})),[s]),m=(0,cb.useMemo)(()=>Nvt.Platform.isDesktopApp?l.map((h,y)=>{let g=h.isLoaded!==!1;return{key:`webtab-${h.url||h.title||y}-${y}`,title:h.title||"Untitled",subtitle:g?h.url:"Tab not loaded",category:"webTabs",data:h,content:void 0,disabled:!g,disabledReason:"Switch to this tab to load it first",icon:g?cb.default.createElement(_l,{className:"tw-size-4"}):cb.default.createElement(v1,{className:"tw-size-4 tw-text-muted"}),searchKeyword:`${h.title||""} ${h.url||""}`}}):[],[l]);return(0,cb.useMemo)(()=>{if(e==="category"){if(!t){let I=o.map(B=>({...B,content:void 0})),A=[];return c&&A.push({key:"active-web-tab",title:"Active Web Tab",subtitle:void 0,category:"activeWebTab",data:c,content:void 0,icon:cb.default.createElement(_l,{className:"tw-size-4"})}),i&&A.push({key:`active-note-${i.path}`,title:"Active Note",subtitle:void 0,category:"activeNote",data:i,content:void 0,icon:cb.default.createElement(C1,{className:"tw-size-4"})}),A.length>0?[...A,...I]:I}let h=t.toLowerCase(),y=f.filter(I=>I.title.toLowerCase().includes(h)),_="active note".includes(h)&&i?{key:`active-note-${i.path}`,title:"Active Note",subtitle:void 0,category:"activeNote",data:i,content:void 0,icon:cb.default.createElement(C1,{className:"tw-size-4"})}:null,O="active web tab".includes(h)&&c?{key:"active-web-tab",title:"Active Web Tab",subtitle:void 0,category:"activeWebTab",data:c,content:void 0,icon:cb.default.createElement(_l,{className:"tw-size-4"})}:null,E=[...d,...p,...m],R=Dvt.default.go(t,E,{keys:["searchKeyword"],limit:sfe,threshold:-1e4}).map(I=>I.obj);return[...y,...O?[O]:[],..._?[_]:[],...R].slice(0,sfe)}else{let h=[];switch(r){case"notes":h=d;break;case"tools":h=f;break;case"folders":h=p;break;case"webTabs":h=m;break}if(!t){if(r==="notes"){let g=ee().customPromptsFolder,b=h.filter(w=>!(typeof w.data=="object"&&"path"in w.data&&typeof w.data.path=="string"&&w.data.path.startsWith(g+"/"))),_=h.filter(w=>typeof w.data=="object"&&"path"in w.data&&typeof w.data.path=="string"&&w.data.path.startsWith(g+"/"));return[...b,..._].slice(0,sfe)}return h.slice(0,sfe)}return Dvt.default.go(t,h,{keys:["title","subtitle"],limit:sfe,threshold:-1e4}).map(g=>g.obj)}},[e,t,r,d,f,p,m,o,c,i])}function sgi(t){return"data"in t}function ugi(t){return"icon"in t&&!("data"in t)}function bQr({isOpen:t,onClose:e,onSelect:r,isCopilotPlus:n=!1,currentActiveFile:o=null}){let[i,a]=(0,Lv.useState)(""),[s,u]=(0,Lv.useState)(0),[l,c]=(0,Lv.useState)({mode:"category"}),d=HFe(n),f=ZFe(i,l.mode,l.selectedCategory,n,d,o),p=(0,Lv.useCallback)(g=>{if(!g?.disabled){if(l.mode==="category"&&ugi(g)&&!i){c(b=>({...b,mode:"search",selectedCategory:g.category})),a(""),u(0);return}sgi(g)&&(r(g.category,g.data),e())}},[l.mode,i,r,e]),m=(0,Lv.useCallback)(g=>{u(g)},[]),h=(0,Lv.useCallback)(g=>{a(g),u(0)},[]),y=(0,Lv.useCallback)(g=>{switch(g.key){case"ArrowDown":{g.preventDefault();let b=s+1;for(;b<f.length&&f[b]?.disabled;)b++;b>=f.length&&(b=s),u(b);break}case"ArrowUp":{g.preventDefault();let b=s-1;for(;b>=0&&f[b]?.disabled;)b--;b<0&&(b=s),u(b);break}case"Enter":case"Tab":{g.preventDefault();let b=f[s];if(b?.disabled)break;b&&p(b);break}case"Escape":{g.preventDefault(),e();break}case"Backspace":{l.mode==="search"&&!i&&(g.preventDefault(),c({mode:"category",selectedCategory:void 0}),u(0));break}}},[s,f,p,e,l.mode,i]);return(0,Lv.useEffect)(()=>{t||(a(""),u(0),c({mode:"category",selectedCategory:void 0}))},[t]),(0,Lv.useEffect)(()=>{u(0)},[f.length]),t?Lv.default.createElement(dQr,{options:f,selectedIndex:s,onSelect:p,onHighlight:m,query:i,mode:l.mode,showPreview:!1,searchBarMode:!0,searchQuery:i,onSearchChange:h,onKeyDown:y}):null}function lgi({selectedText:t,onRemoveContext:e}){if(kFe(t)){let n=n1(t.url);return hn.default.createElement(Xc,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},hn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},hn.default.createElement(nfe,{faviconUrl:t.faviconUrl}),hn.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.title||n),hn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Selection")),hn.default.createElement(me,{variant:"ghost2",size:"fit",onClick:()=>e("selectedText",t.id),"aria-label":"Remove from context",className:"tw-text-muted"},hn.default.createElement(Ho,{className:"tw-size-4"})))}let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`;return hn.default.createElement(Xc,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},hn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},hn.default.createElement(ju,{className:"tw-size-3"}),hn.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.noteTitle),hn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r)),hn.default.createElement(me,{variant:"ghost2",size:"fit",onClick:()=>e("selectedText",t.id),"aria-label":"Remove from context",className:"tw-text-muted"},hn.default.createElement(Ho,{className:"tw-size-4"})))}var vQr=({includeActiveNote:t,currentActiveFile:e,includeActiveWebTab:r,activeWebTab:n,contextNotes:o,contextUrls:i,contextFolders:a,contextWebTabs:s,selectedTextContexts:u=[],onRemoveContext:l,showProgressCard:c,showIndexingCard:d,onTypeaheadSelect:f,lexicalEditorRef:p})=>{let[m]=aw(),h=nLe(),[y]=e5(),[g,b]=(0,hn.useState)(!1),_=(0,hn.useRef)(null),w=Rb(m),T=()=>{b(!1)},O=(V,Y)=>{f(V,Y),setTimeout(()=>{p?.current&&p.current.focus()},100)},E=V=>{ENt(V)},P=hn.default.useMemo(()=>{let V=new Map(o.map(Y=>[Y.path,Y]));return Array.from(V.values())},[o]),R=hn.default.useMemo(()=>Array.from(new Set(i)),[i]),I=hn.default.useMemo(()=>x3(s),[s]),A=u.length>0,B=t&&!A&&!!e,k=r&&!A&&!!n&&_Qr.Platform.isDesktopApp,q=P.length>0||R.length>0||u.length>0||a.length>0||I.length>0||B||k,Z=()=>{switch(h){case"success":return hn.default.createElement(B_,{className:"tw-size-4 tw-text-success"});case"loading":return hn.default.createElement(Us,{className:"tw-size-4 tw-animate-spin tw-text-loading"});case"error":return hn.default.createElement($b,{className:"tw-size-4 tw-text-error"});case"initial":return hn.default.createElement(v1,{className:"tw-size-4 tw-text-faint"})}};return hn.default.createElement("div",{className:"tw-flex tw-w-full tw-items-start tw-gap-1"},hn.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},hn.default.createElement(bU,{open:g,onOpenChange:b},hn.default.createElement(_U,{asChild:!0},hn.default.createElement(me,{ref:_,variant:"ghost2",size:"fit",className:"tw-ml-1 tw-rounded-sm tw-border tw-border-solid tw-border-border tw-text-muted"},hn.default.createElement("span",{className:"tw-text-base tw-font-medium tw-leading-none"},"@"),!q&&hn.default.createElement("span",{className:"tw-pr-1 tw-text-sm tw-leading-4"},"Add context"))),hn.default.createElement(K$,{className:"tw-w-[400px] tw-p-0",align:"start",side:"top",sideOffset:4},hn.default.createElement(bQr,{isOpen:g,onClose:T,onSelect:O,isCopilotPlus:w,currentActiveFile:e})))),hn.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-wrap tw-gap-1"},B&&e&&hn.default.createElement(aQr,{currentActiveFile:e,onRemove:()=>l("activeNote",""),onClick:()=>E(e)}),k&&n&&hn.default.createElement(sQr,{activeWebTab:n,onRemove:()=>l("activeWebTab","")}),P.map(V=>hn.default.createElement(qFe,{key:V.path,note:V,onRemove:()=>l("notes",V.path),onClick:()=>E(V)})),R.map(V=>hn.default.createElement(BFe,{key:V,url:V,onRemove:()=>l("urls",V)})),a.map(V=>hn.default.createElement(zFe,{key:V,folder:V,onRemove:()=>l("folders",V)})),I.map(V=>hn.default.createElement(UFe,{key:V.url,webTab:V,onRemove:()=>l("webTabs",V.url)})),u.map(V=>hn.default.createElement(lgi,{key:V.id,selectedText:V,onRemoveContext:l}))),m==="project"&&hn.default.createElement(hn.default.Fragment,null,hn.default.createElement(lC,{orientation:"vertical"}),hn.default.createElement("div",{className:""},hn.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>c()},Z()))),m!=="project"&&y.isActive&&d&&hn.default.createElement(hn.default.Fragment,null,hn.default.createElement(lC,{orientation:"vertical"}),hn.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:d},hn.default.createElement(Us,{className:"tw-size-3 tw-animate-spin"}),hn.default.createElement("span",{className:"tw-text-xs"},"Indexing..."))))};var SQr=({contextNotes:t,includeActiveNote:e,activeNote:r,includeActiveWebTab:n,activeWebTab:o,contextUrls:i,contextFolders:a,contextWebTabs:s,selectedTextContexts:u,showProgressCard:l,showIndexingCard:c,lexicalEditorRef:d,onAddToContext:f,onRemoveFromContext:p})=>wQr.default.createElement(vQr,{includeActiveNote:e,currentActiveFile:r,includeActiveWebTab:n,activeWebTab:o,contextNotes:t,onRemoveContext:(y,g)=>{p(y,g)},contextUrls:i,contextFolders:a,contextWebTabs:s,selectedTextContexts:u,showProgressCard:l,showIndexingCard:c,onTypeaheadSelect:(y,g)=>{f(y,g)},lexicalEditorRef:d});var HU=$(K());var xQr=$(K());var CQr=$(K());zr();function oy({children:t,className:e,...r}){return CQr.default.createElement(Xc,{variant:"secondary",className:Se("tw-mx-0.5 tw-inline-flex tw-items-center tw-gap-1 tw-border tw-border-solid tw-border-border tw-px-2 tw-py-0 tw-align-middle tw-text-xs",e),...r},t)}var db=class extends NFe{constructor(e,r){super(r),this.__value=e}updateDOM(){return!1}isInline(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}canBeEmpty(){return!1}isKeyboardSelectable(){return!0}isIsolated(){return!0}isPill(){return!0}getValue(){return this.__value}setValue(e){let r=this.getWritable();r.__value=e}getTextContent(){return this.__value}createDOM(e){let r=document.createElement("span");return r.className=this.getClassName(),r}exportDOM(){let e=document.createElement("span");return e.setAttribute(this.getDataAttribute(),""),e.setAttribute("data-pill-value",this.__value),e.textContent=this.__value,{element:e}}exportJSON(){return{...super.exportJSON(),value:this.__value,type:this.getType(),version:1}}decorate(){return xQr.default.createElement(oy,null,this.__value)}};var nS=$(K());zr();function _N({content:t,openBracket:e,closeBracket:r,className:n,maxWidth:o="tw-max-w-40",tooltipContent:i}){let a=(0,nS.useRef)(null),[s,u]=(0,nS.useState)(!1);return nS.default.createElement(s_,{delayDuration:300},nS.default.createElement(vn,{open:s,onOpenChange:c=>{let d=a.current?a.current.offsetWidth<a.current.scrollWidth:!1;u(c&&d)}},nS.default.createElement(wn,{asChild:!0},nS.default.createElement("span",{className:Se("tw-inline-flex tw-items-center",o,n)},nS.default.createElement("span",{className:"tw-shrink-0"},e),nS.default.createElement("span",{ref:a,className:"tw-min-w-0 tw-truncate"},t),nS.default.createElement("span",{className:"tw-shrink-0"},r))),nS.default.createElement(pn,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},i||`${e}${t}${r}`)))}var WU=class t extends db{static getType(){return"note-pill"}static clone(e){return new t(e.__noteTitle,e.__notePath,e.__key)}constructor(e,r,n){super(e,n),this.__noteTitle=e,this.__notePath=r}getClassName(){return"note-pill-wrapper"}getDataAttribute(){return"data-lexical-note-pill"}createDOM(e){let r=document.createElement("span");return r.className="note-pill-wrapper",r}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-note-pill")?{conversion:cgi,priority:1}:null}}static importJSON(e){let{noteTitle:r,notePath:n}=e;return ufe(r,n)}exportJSON(){return{...super.exportJSON(),noteTitle:this.__noteTitle,notePath:this.__notePath,type:"note-pill",version:1}}exportDOM(){let e=document.createElement("span");e.setAttribute("data-lexical-note-pill","true"),e.setAttribute("data-note-title",this.__noteTitle),e.setAttribute("data-note-path",this.__notePath);let r=this.__notePath.toLowerCase(),n=r.endsWith(".pdf")?`${this.__noteTitle}.pdf`:r.endsWith(".canvas")?`${this.__noteTitle}.canvas`:this.__noteTitle;return e.textContent=`[[${n}]]`,{element:e}}getTextContent(){let e=this.__notePath.toLowerCase();return`[[${e.endsWith(".pdf")?`${this.__noteTitle}.pdf`:e.endsWith(".canvas")?`${this.__noteTitle}.canvas`:this.__noteTitle}]]`}getNoteTitle(){return this.__noteTitle}getNotePath(){return this.__notePath}decorate(){return HU.default.createElement(dgi,{node:this})}};function cgi(t){let e=t.getAttribute("data-note-title"),r=t.getAttribute("data-note-path");return e&&r?{node:ufe(e,r)}:null}function dgi({node:t}){let e=t.getNoteTitle(),r=t.getNotePath(),n=r.toLowerCase(),o=n.endsWith(".pdf"),i=n.endsWith(".canvas");return HU.default.createElement(oy,null,HU.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},HU.default.createElement(_N,{content:e,openBracket:"[[",closeBracket:"]]",tooltipContent:HU.default.createElement("div",{className:"tw-text-left"},r)}),o&&HU.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf"),i&&HU.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"canvas")))}function ufe(t,e){return new WU(t,e)}function jvt(t){return t instanceof WU}function TQr(t){let e=Ci(),r=0;function n(o){if(jvt(o)&&o.getNotePath()===t)o.remove(),r++;else if(typeof o.getChildren=="function"){let i=o.getChildren();for(let a of i)n(a)}}return n(e),r}var pC=$(K());var IY=$(K()),OQr=(0,IY.createContext)(void 0);function EQr(){let t=(0,IY.useContext)(OQr);return t===void 0?null:t.currentActiveFile}function YFe({currentActiveFile:t,children:e}){return IY.default.createElement(OQr.Provider,{value:{currentActiveFile:t}},e)}var JU=class t extends db{static getType(){return"active-note-pill"}static clone(e){return new t(e.__key)}constructor(e){super("Current Note",e)}getClassName(){return"active-note-pill-wrapper"}getDataAttribute(){return"data-lexical-active-note-pill"}createDOM(e){let r=document.createElement("span");return r.className="active-note-pill-wrapper",r}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-active-note-pill")?{conversion:fgi,priority:2}:null}}static importJSON(e){return lfe()}exportJSON(){return{...super.exportJSON(),type:"active-note-pill",version:1}}exportDOM(){let e=document.createElement("span");return e.setAttribute("data-lexical-active-note-pill","true"),e.textContent="{activeNote}",{element:e}}getTextContent(){return"{activeNote}"}decorate(){return pC.default.createElement(pgi,null)}};function fgi(t){return{node:lfe()}}function pgi(){let t=EQr();if(!t)return pC.default.createElement(oy,null,pC.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},pC.default.createElement(_N,{content:"activeNote",openBracket:"{",closeBracket:"}",tooltipContent:pC.default.createElement("div",{className:"tw-text-left"},"Will use the active note at the time the message is sent")})));let e=t.basename,r=t.path,n=r.toLowerCase().endsWith(".pdf");return pC.default.createElement(oy,null,pC.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},pC.default.createElement(_N,{content:e,openBracket:"[[",closeBracket:"]]",tooltipContent:pC.default.createElement("div",{className:"tw-text-left"},r)}),pC.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),n&&pC.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")))}function lfe(){return new JU}function $vt(t){return t instanceof JU}function PQr(){let t=Ci(),e=0;function r(n){if($vt(n))n.remove(),e++;else if(typeof n.getChildren=="function"){let o=n.getChildren();for(let i of o)r(i)}}return r(t),e}var cfe=$(K());var e6=class t extends db{static getType(){return"url-pill"}static clone(e){return new t(e.__url,e.__title,e.__isActive,e.__key)}constructor(e,r,n=!1,o){super(e,o),this.__url=e,this.__title=r,this.__isActive=n}getClassName(){return"url-pill-wrapper"}getDataAttribute(){return"data-lexical-url-pill"}createDOM(e){let r=document.createElement("span");return r.className="url-pill-wrapper",r}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-url-pill")?{conversion:mgi,priority:1}:null}}static importJSON(e){let{url:r,title:n,isActive:o}=e;return QFe(r,n,o)}exportJSON(){return{...super.exportJSON(),url:this.__url,title:this.__title,isActive:this.__isActive,type:"url-pill",version:1}}exportDOM(){let e=document.createElement("span");return e.setAttribute("data-lexical-url-pill","true"),e.setAttribute("data-url",this.__url),this.__title&&e.setAttribute("data-title",this.__title),e.textContent=this.__url,{element:e}}getTextContent(){return this.__url}getURL(){return this.__url}setURL(e){let r=this.getWritable();r.__url=e}getTitle(){return this.__title}setTitle(e){let r=this.getWritable();r.__title=e}setActive(e){let r=this.getWritable();r.__isActive=e}getActive(){return this.__isActive}decorate(){let e=this.__title||this.__url;return cfe.default.createElement(oy,{className:"tw-whitespace-nowrap"},cfe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},cfe.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e),this.__isActive&&cfe.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Active")))}};function mgi(t){let e=t.getAttribute("data-url"),r=t.getAttribute("data-title");return e!==null?{node:QFe(e,r||void 0)}:null}function QFe(t,e,r=!1){return new e6(t,e,r)}function hgi(){let t=Ci(),e=[];function r(n){if(n instanceof e6&&e.push(n),"getChildren"in n&&typeof n.getChildren=="function"){let o=n.getChildren();for(let i of o)r(i)}}return r(t),e}function MQr(t){let e=hgi();for(let r of e)r.getURL()===t&&r.remove()}function RQr(t){return t instanceof e6}var eke=$(K());var mL=class t extends db{static getType(){return"folder-pill"}static clone(e){return new t(e.__value,e.__key)}constructor(e,r){super(e,r)}getClassName(){return"folder-pill-wrapper"}getDataAttribute(){return"data-lexical-folder-pill"}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-folder-pill")?{conversion:ggi,priority:1}:null}}static importJSON(e){let{value:r}=e;return dfe(r)}exportJSON(){return{...super.exportJSON(),type:"folder-pill"}}decorate(){let e=eke.default.createElement("div",{className:"tw-text-left"},this.getFolderPath());return eke.default.createElement(oy,null,eke.default.createElement(_N,{content:this.getFolderPath(),openBracket:"{",closeBracket:"}",tooltipContent:e}))}getTextContent(){return`{${this.getFolderPath()}}`}exportDOM(){let e=document.createElement("span");return e.setAttribute(this.getDataAttribute(),""),e.setAttribute("data-pill-value",this.__value),e.textContent=`{${this.getFolderPath()}}`,{element:e}}getFolderPath(){return this.getValue()}};function ggi(t){let e=t.getAttribute("data-pill-value");return e!==null?{node:dfe(e)}:null}function dfe(t){return new mL(t)}function IQr(t){return t instanceof mL}function ygi(){let t=Ci(),e=[];function r(n){if(n instanceof mL&&e.push(n),"getChildren"in n&&typeof n.getChildren=="function"){let o=n.getChildren();for(let i of o)r(i)}}return r(t),e}function AQr(t){let e=ygi();for(let r of e)r.getValue()===t&&r.remove()}var t6=class t extends db{static getType(){return"tool-pill"}static clone(e){return new t(e.__value,e.__key)}constructor(e,r){super(e,r)}getClassName(){return"tool-pill-wrapper"}getDataAttribute(){return"data-lexical-tool-pill"}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-tool-pill")?{conversion:bgi,priority:1}:null}}static importJSON(e){let{value:r}=e;return r6(r)}exportJSON(){return{...super.exportJSON(),type:"tool-pill"}}getToolName(){return this.getValue()}};function bgi(t){let e=t.getAttribute("data-pill-value");return e!==null?{node:r6(e)}:null}function r6(t){return new t6(t)}function NQr(t){return t instanceof t6}function _gi(){let t=Ci(),e=[];function r(n){if(n instanceof t6&&e.push(n),"getChildren"in n&&typeof n.getChildren=="function"){let o=n.getChildren();for(let i of o)r(i)}}return r(t),e}function ffe(t){let e=_gi();for(let r of e)r.getValue()===t&&r.remove()}var iy=$(K());Mr();var DQr=require("obsidian");gr();var KU=class t extends db{static getType(){return"active-web-tab-pill"}static clone(e){return new t(e.__key)}constructor(e){super("Current Web Tab",e)}getClassName(){return"active-web-tab-pill-wrapper"}getDataAttribute(){return"data-lexical-active-web-tab-pill"}createDOM(e){let r=document.createElement("span");return r.className="active-web-tab-pill-wrapper",r}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-active-web-tab-pill")?{conversion:vgi,priority:2}:null}}static importJSON(e){return tke()}exportJSON(){return{...super.exportJSON(),type:"active-web-tab-pill",version:1}}exportDOM(){let e=document.createElement("span");return e.setAttribute("data-lexical-active-web-tab-pill","true"),e.textContent=yte,{element:e}}getTextContent(){return yte}decorate(){return iy.default.createElement(wgi,null)}};function vgi(t){return{node:tke()}}function wgi(){let{activeWebTabForMentions:t}=VU();return DQr.Platform.isDesktopApp?t?iy.default.createElement(oy,null,iy.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},iy.default.createElement(_l,{className:"tw-size-3"}),iy.default.createElement("span",{className:"tw-max-w-40 tw-truncate",title:t.url},t.title??"Untitled"),iy.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"))):iy.default.createElement(oy,null,iy.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},iy.default.createElement(_l,{className:"tw-size-3"}),iy.default.createElement(_N,{content:"activeWebTab",openBracket:"{",closeBracket:"}",tooltipContent:iy.default.createElement("div",{className:"tw-text-left"},"Will use the active web tab at the time the message is sent")}))):iy.default.createElement(oy,null,iy.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},iy.default.createElement(_l,{className:"tw-size-3"}),iy.default.createElement(_N,{content:"activeWebTab",openBracket:"{",closeBracket:"}",tooltipContent:iy.default.createElement("div",{className:"tw-text-left"},"Web Viewer not supported on mobile")})))}function tke(){return new KU}function Lvt(t){return t instanceof KU}function jQr(){let t=Ci(),e=0;function r(n){if(Lvt(n))n.remove(),e++;else if("getChildren"in n&&typeof n.getChildren=="function"){let o=n.getChildren();for(let i of o)r(i)}}return r(t),e}var pfe=$(K());Mr();Dt();function $Qr(t,e){return`[\u{1F310}: ${e?.trim()||n1(t)||"Untitled"}]`}var hL=class t extends db{static getType(){return"web-tab-pill"}static clone(e){return new t(e.__url,e.__title,e.__faviconUrl,e.__key)}constructor(e,r,n,o){super(e,o),this.__url=e,this.__title=r,this.__faviconUrl=n}getClassName(){return"web-tab-pill-wrapper"}getDataAttribute(){return"data-lexical-web-tab-pill"}createDOM(e){let r=document.createElement("span");return r.className="web-tab-pill-wrapper",r}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-web-tab-pill")?{conversion:Sgi,priority:1}:null}}static importJSON(e){let{url:r,title:n,faviconUrl:o}=e;return rke(r,n,o)}exportJSON(){return{...super.exportJSON(),url:this.__url,title:this.__title,faviconUrl:this.__faviconUrl,type:"web-tab-pill",version:1}}exportDOM(){let e=document.createElement("span");return e.setAttribute("data-lexical-web-tab-pill","true"),e.setAttribute("data-url",this.__url),this.__title&&e.setAttribute("data-title",this.__title),this.__faviconUrl&&e.setAttribute("data-favicon-url",this.__faviconUrl),e.textContent=$Qr(this.__url,this.__title),{element:e}}getTextContent(){return $Qr(this.__url,this.__title)}getURL(){return this.__url}getTitle(){return this.__title}getFaviconUrl(){return this.__faviconUrl}setTitle(e){let r=this.getWritable();r.__title=e}setFaviconUrl(e){let r=this.getWritable();r.__faviconUrl=e}decorate(){let e=this.__title||this.__url;return pfe.default.createElement(oy,{className:"tw-whitespace-nowrap"},pfe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},pfe.default.createElement(_l,{className:"tw-size-3"}),pfe.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e)))}};function Sgi(t){let e=t.getAttribute("data-url"),r=t.getAttribute("data-title"),n=t.getAttribute("data-favicon-url");return e!==null?{node:rke(e,r||void 0,n||void 0)}:null}function rke(t,e,r){return new hL(t,e,r)}function LQr(t){return t instanceof hL}function Fvt(){let t=Ci(),e=[];function r(n){if(n instanceof hL&&e.push(n),"getChildren"in n&&typeof n.getChildren=="function"){let o=n.getChildren();for(let i of o)r(i)}}return r(t),e}function FQr(t){let e=Fvt();for(let r of e)r.getURL()===t&&r.remove()}var Qi=$(K());var kvt={};En(kvt,{LexicalComposerContext:()=>kQr,createLexicalComposerContext:()=>Cgi,useLexicalComposerContext:()=>xgi});var nke=$(K(),1),kQr=(0,nke.createContext)(null);function Cgi(t,e){let r=null;return t!=null&&(r=t[1]),{getTheme:function(){return e??(r!=null?r.getTheme():null)}}}function xgi(){let t=(0,nke.useContext)(kQr);return t==null&&function(e,...r){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let i of r)o.append("v",i);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),t}var qvt=kvt,qQr=qvt.LexicalComposerContext,BQr=qvt.createLexicalComposerContext,Di=qvt.useLexicalComposerContext;var Bvt={};En(Bvt,{LexicalComposer:()=>Ogi});var AY=$(K(),1),UQr=$(wt(),1),zQr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Tgi=zQr?AY.useLayoutEffect:AY.useEffect,oke={tag:OY};function Ogi({initialConfig:t,children:e}){let r=(0,AY.useMemo)(()=>{let{theme:n,namespace:o,nodes:i,onError:a,editorState:s,html:u}=t,l=BQr(null,n),c=eQr({editable:t.editable,html:u,namespace:o,nodes:i,onError:d=>a(d,c),theme:n});return function(d,f){if(f!==null){if(f===void 0)d.update(()=>{let p=Ci();if(p.isEmpty()){let m=dL();p.append(m);let h=zQr?document.activeElement:null;(Sn()!==null||h!==null&&h===d.getRootElement())&&m.select()}},oke);else if(f!==null)switch(typeof f){case"string":{let p=d.parseEditorState(f);d.setEditorState(p,oke);break}case"object":d.setEditorState(f,oke);break;case"function":d.update(()=>{Ci().isEmpty()&&f(d)},oke)}}}(c,s),[c,l]},[]);return Tgi(()=>{let n=t.editable,[o]=r;o.setEditable(n===void 0||n)},[]),(0,UQr.jsx)(qQr.Provider,{value:r,children:e})}var Egi=Bvt,ike=Egi.LexicalComposer;var Uvt={};En(Uvt,{useLexicalEditable:()=>Rgi});var vN=$(K(),1),Pgi=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?vN.useLayoutEffect:vN.useEffect;function Mgi(t){return{initialValueFn:()=>t.isEditable(),subscribe:e=>t.registerEditableListener(e)}}function Rgi(){return function(t){let[e]=Di(),r=(0,vN.useMemo)(()=>t(e),[e,t]),[n,o]=(0,vN.useState)(()=>r.initialValueFn()),i=(0,vN.useRef)(n);return Pgi(()=>{let{initialValueFn:a,subscribe:s}=r,u=a();return i.current!==u&&(i.current=u,o(u)),s(l=>{i.current=l,o(l)})},[r,t]),n}(Mgi)}var Igi=Uvt,VQr=Igi.useLexicalEditable;var Vvt={};En(Vvt,{$canShowPlaceholder:()=>WQr,$canShowPlaceholderCurry:()=>Ngi,$findTextIntersectionFromCharacters:()=>Dgi,$isRootTextContentEmpty:()=>zvt,$isRootTextContentEmptyCurry:()=>Agi,$rootTextContent:()=>HQr,registerLexicalTextEntity:()=>$gi});function HQr(){return Ci().getTextContent()}function zvt(t,e=!0){if(t)return!1;let r=HQr();return e&&(r=r.trim()),r===""}function Agi(t,e){return()=>zvt(t,e)}function WQr(t){if(!zvt(t,!1))return!1;let e=Ci().getChildren(),r=e.length;if(r>1)return!1;for(let n=0;n<r;n++){let o=e[n];if(PFe(o))return!1;if(gi(o)){if(!bYr(o)||o.__indent!==0)return!1;let i=o.getChildren(),a=i.length;for(let s=0;s<a;s++){let u=i[n];if(!Yi(u))return!1}}}return!0}function Ngi(t){return()=>WQr(t)}function Dgi(t,e){let r=t.getFirstChild(),n=0;e:for(;r!==null;){if(gi(r)){let a=r.getFirstChild();if(a!==null){r=a;continue}}else if(Yi(r)){let a=r.getTextContentSize();if(n+a>e)return{node:r,offset:e-n};n+=a}let o=r.getNextSibling();if(o!==null){r=o;continue}let i=r.getParent();for(;i!==null;){let a=i.getNextSibling();if(a!==null){r=a;continue e}i=i.getParent()}break}return null}function jgi(t,...e){let r=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(let o of e)n.append("v",o);throw r.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function $gi(t,e,r,n){let o=a=>a instanceof r,i=a=>{let s=rS(a.getTextContent());s.setFormat(a.getFormat()),a.replace(s)};return[t.registerNodeTransform(yN,a=>{if(!a.isSimpleText())return;let s,u=a.getPreviousSibling(),l=a.getTextContent(),c=a;if(Yi(u)){let f=u.getTextContent(),p=e(f+l);if(o(u)){if(p===null||(m=>m.getLatest().__mode)(u)!==0)return void i(u);{let m=p.end-f.length;if(m>0){let h=f+l.slice(0,m);if(u.select(),u.setTextContent(h),m===l.length)a.remove();else{let y=l.slice(m);a.setTextContent(y)}return}}}else if(p===null||p.start<f.length)return}let d=0;for(;;){s=e(l);let f,p=s===null?"":l.slice(s.end);if(l=p,p===""){let h=c.getNextSibling();if(Yi(h)){p=c.getTextContent()+h.getTextContent();let y=e(p);if(y===null)return void(o(h)?i(h):h.markDirty());if(y.start!==0)return}}if(s===null)return;if(s.start===0&&Yi(u)&&u.isTextEntity()){d+=s.end;continue}s.start===0?[f,c]=c.splitText(s.end):[,f,c]=c.splitText(s.start+d,s.end+d),f===void 0&&jgi(165,"nodeToReplace");let m=n(f);if(m.setFormat(f.getFormat()),f.replace(m),c==null)return;d=0,u=m}}),t.registerNodeTransform(r,a=>{let s=a.getTextContent(),u=e(s);if(u===null||u.start!==0)return void i(a);if(s.length>u.end)return void a.splitText(u.end);let l=a.getPreviousSibling();Yi(l)&&l.isTextEntity()&&(i(l),i(a));let c=a.getNextSibling();Yi(c)&&c.isTextEntity()&&(i(c),o(a)&&i(a))})]}var n6=Vvt,iVs=n6.$canShowPlaceholder,ake=n6.$canShowPlaceholderCurry,aVs=n6.$findTextIntersectionFromCharacters,sVs=n6.$isRootTextContentEmpty,uVs=n6.$isRootTextContentEmptyCurry,lVs=n6.$rootTextContent,cVs=n6.registerLexicalTextEntity;var Xvt={};En(Xvt,{$addNodeStyle:()=>Bgi,$cloneWithProperties:()=>UU,$copyBlockFormatIndent:()=>ten,$ensureForwardRangeSelection:()=>een,$forEachSelectedTextNode:()=>QQr,$getSelectionStyleValueForProperty:()=>Ggi,$isAtNodeEnd:()=>qgi,$isParentElementRTL:()=>Gvt,$moveCaretSelection:()=>nen,$moveCharacter:()=>Jgi,$patchStyleText:()=>Ugi,$selectAll:()=>RFe,$setBlocksType:()=>zgi,$shouldOverrideDefaultCharacterSelection:()=>Wgi,$sliceSelectedTextNodeContent:()=>kgi,$trimTextContentFromAnchor:()=>YQr,$wrapNodes:()=>Hgi,createDOMRange:()=>Lgi,createRectsFromDOMRange:()=>Fgi,getCSSFromStyleObject:()=>ZQr,getStyleObjectFromCSS:()=>uke,trimTextContentFromAnchor:()=>Xgi});function Kvt(t,...e){let r=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(let o of e)n.append("v",o);throw r.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var ske=new Map;function JQr(t){let e=t;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function KQr(t){let e=t.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(t)]}function Lgi(t,e,r,n,o){let i=e.getKey(),a=n.getKey(),s=document.createRange(),u=t.getElementByKey(i),l=t.getElementByKey(a),c=r,d=o;if(Yi(e)&&(u=JQr(u)),Yi(n)&&(l=JQr(l)),e===void 0||n===void 0||u===null||l===null)return null;u.nodeName==="BR"&&([u,c]=KQr(u)),l.nodeName==="BR"&&([l,d]=KQr(l));let f=u.firstChild;u===l&&f!=null&&f.nodeName==="BR"&&c===0&&d===0&&(d=1);try{s.setStart(u,c),s.setEnd(l,d)}catch{return null}return!s.collapsed||c===d&&i===a||(s.setStart(l,d),s.setEnd(u,c)),s}function Fgi(t,e){let r=t.getRootElement();if(r===null)return[];let n=r.getBoundingClientRect(),o=getComputedStyle(r),i=parseFloat(o.paddingLeft)+parseFloat(o.paddingRight),a=Array.from(e.getClientRects()),s,u=a.length;a.sort((l,c)=>{let d=l.top-c.top;return Math.abs(d)<=3?l.left-c.left:d});for(let l=0;l<u;l++){let c=a[l],d=s&&s.top<=c.top&&s.top+s.height>c.top&&s.left+s.width>c.left,f=c.width+i===n.width;d||f?(a.splice(l--,1),u--):s=c}return a}function XQr(t){let e={};if(!t)return e;let r=t.split(";");for(let n of r)if(n!==""){let[o,i]=n.split(/:([^]+)/);o&&i&&(e[o.trim()]=i.trim())}return e}function uke(t){let e=ske.get(t);return e===void 0&&(e=XQr(t),ske.set(t,e)),e}function ZQr(t){let e="";for(let r in t)r&&(e+=`${r}: ${t[r]};`);return e}function kgi(t,e){let r=t.getStartEndPoints();if(e.isSelected(t)&&!Svt(e)&&r!==null){let[n,o]=r,i=t.isBackward(),a=n.getNode(),s=o.getNode(),u=e.is(a),l=e.is(s);if(u||l){let[c,d]=dYr(t),f=a.is(s),p=e.is(i?s:a),m=e.is(i?a:s),h,y=0;f?(y=c>d?d:c,h=c>d?c:d):p?(y=i?d:c,h=void 0):m&&(y=0,h=i?c:d),e.__text=e.__text.slice(y,h)}}return e}function qgi(t){if(t.type==="text")return t.offset===t.getNode().getTextContentSize();let e=t.getNode();return gi(e)||Kvt(177),t.offset===e.getChildrenSize()}function YQr(t,e,r){let n=e.getNode(),o=r;if(gi(n)){let i=n.getDescendantByIndex(e.offset);i!==null&&(n=i)}for(;o>0&&n!==null;){if(gi(n)){let l=n.getLastDescendant();l!==null&&(n=l)}let i=n.getPreviousSibling(),a=0;if(i===null){let l=n.getParentOrThrow(),c=l.getPreviousSibling();for(;c===null;){if(l=l.getParent(),l===null){i=null;break}c=l.getPreviousSibling()}l!==null&&(a=l.isInline()?0:2,i=c)}let s=n.getTextContent();s===""&&gi(n)&&!n.isInline()&&(s=`

`);let u=s.length;if(!Yi(n)||o>=u){let l=n.getParent();n.remove(),l==null||l.getChildrenSize()!==0||xY(l)||l.remove(),o-=u+a,n=i}else{let l=n.getKey(),c=t.getEditorState().read(()=>{let p=pYr(l);return Yi(p)&&p.isSimpleText()?p.getTextContent():null}),d=u-o,f=s.slice(0,d);if(c!==null&&c!==s){let p=Zde(),m=n;if(n.isSimpleText())n.setTextContent(c);else{let h=rS(c);n.replace(h),m=h}if(jr(p)&&p.isCollapsed()){let h=p.anchor.offset;m.select(h,h)}}else if(n.isSimpleText()){let p=e.key===l,m=e.offset;m<o&&(m=u);let h=p?m-o:0,y=p?m:d;if(p&&h===0){let[g]=n.splitText(h,y);g.remove()}else{let[,g]=n.splitText(h,y);g.remove()}}else{let p=rS(f);n.replace(p)}o=0}}}function Bgi(t){let e=t.getStyle(),r=XQr(e);ske.set(e,r)}function Hvt(t,e){(jr(t)?t.isCollapsed():Yi(t)||gi(t))||Kvt(280);let r=uke(jr(t)?t.style:Yi(t)?t.getStyle():t.getTextStyle()),n=Object.entries(e).reduce((i,[a,s])=>(typeof s=="function"?i[a]=s(r[a],t):s===null?delete i[a]:i[a]=s,i),{...r}),o=ZQr(n);jr(t)||Yi(t)?t.setStyle(o):t.setTextStyle(o),ske.set(o,n)}function Ugi(t,e){if(jr(t)&&t.isCollapsed()){Hvt(t,e);let r=t.anchor.getNode();gi(r)&&r.isEmpty()&&Hvt(r,e)}QQr(r=>{Hvt(r,e)})}function QQr(t){let e=Sn();if(!e)return;let r=new Map;if(jr(e))for(let i of sYr(e).getTextSlices())i&&r.set(i.caret.origin.getKey(),i.getSliceIndices());let n=e.getNodes();for(let i of n){if(!Yi(i)||!i.canHaveFormat())continue;let[a,s]=(o=i,r.get(o.getKey())||[0,o.getTextContentSize()]);s!==a&&(Svt(i)||a===0&&s===i.getTextContentSize()?t(i):t(i.splitText(a,s)[a===0?0:1]))}var o;jr(e)&&e.anchor.type==="text"&&e.focus.type==="text"&&e.anchor.key===e.focus.key&&een(e)}function een(t){if(t.isBackward()){let{anchor:e,focus:r}=t,{key:n,offset:o,type:i}=e;e.set(r.key,r.offset,r.type),r.set(n,o,i)}}function ten(t,e){let r=t.getFormatType(),n=t.getIndent();r!==e.getFormatType()&&e.setFormat(r),n!==e.getIndent()&&e.setIndent(n)}function zgi(t,e,r=ten){if(t===null)return;let n=t.getStartEndPoints(),o=new Map,i=null;if(n){let[a,s]=n;i=TFe(),i.anchor.set(a.key,a.offset,a.type),i.focus.set(s.key,s.offset,s.type);let u=Jvt(a.getNode(),tfe),l=Jvt(s.getNode(),tfe);gi(u)&&o.set(u.getKey(),u),gi(l)&&o.set(l.getKey(),l)}for(let a of t.getNodes())if(gi(a)&&tfe(a))o.set(a.getKey(),a);else if(n===null){let s=Jvt(a,tfe);gi(s)&&o.set(s.getKey(),s)}for(let[a,s]of o){let u=e();r(s,u),s.replace(u,!0),i&&(a===i.anchor.key&&i.anchor.set(u.getKey(),i.anchor.offset,i.anchor.type),a===i.focus.key&&i.focus.set(u.getKey(),i.focus.offset,i.focus.type))}i&&t.is(Sn())&&Z3(i)}function GQr(t){return t.getNode().isAttached()}function Vgi(t){let e=t;for(;e!==null&&!X3(e);){let r=e.getLatest(),n=e.getParent();r.getChildrenSize()===0&&e.remove(!0),e=n}}function Hgi(t,e,r=null){let n=t.getStartEndPoints(),o=n?n[0]:null,i=t.getNodes(),a=i.length;if(o!==null&&(a===0||a===1&&o.type==="element"&&o.getNode().getChildrenSize()===0)){let l=o.type==="text"?o.getNode().getParentOrThrow():o.getNode(),c=l.getChildren(),d=e();return d.setFormat(l.getFormatType()),d.setIndent(l.getIndent()),c.forEach(f=>d.append(f)),r&&(d=r.append(d)),void l.replace(d)}let s=null,u=[];for(let l=0;l<a;l++){let c=i[l];X3(c)?(Wvt(t,u,u.length,e,r),u=[],s=c):s===null||s!==null&&hYr(c,s)?u.push(c):(Wvt(t,u,u.length,e,r),u=[c])}Wvt(t,u,u.length,e,r)}function Wvt(t,e,r,n,o=null){if(e.length===0)return;let i=e[0],a=new Map,s=[],u=gi(i)?i:i.getParentOrThrow();u.isInline()&&(u=u.getParentOrThrow());let l=!1;for(;u!==null;){let m=u.getPreviousSibling();if(m!==null){u=m,l=!0;break}if(u=u.getParentOrThrow(),X3(u))break}let c=new Set;for(let m=0;m<r;m++){let h=e[m];gi(h)&&h.getChildrenSize()===0&&c.add(h.getKey())}let d=new Set;for(let m=0;m<r;m++){let h=e[m],y=h.getParent();if(y!==null&&y.isInline()&&(y=y.getParent()),y!==null&&yYr(h)&&!d.has(h.getKey())){let g=y.getKey();if(a.get(g)===void 0){let b=n();b.setFormat(y.getFormatType()),b.setIndent(y.getIndent()),s.push(b),a.set(g,b),y.getChildren().forEach(_=>{b.append(_),d.add(_.getKey()),gi(_)&&_.getChildrenKeys().forEach(w=>d.add(w))}),Vgi(y)}}else if(c.has(h.getKey())){gi(h)||Kvt(179);let g=n();g.setFormat(h.getFormatType()),g.setIndent(h.getIndent()),s.push(g),h.remove(!0)}}if(o!==null)for(let m=0;m<s.length;m++){let h=s[m];o.append(h)}let f=null;if(X3(u))if(l)if(o!==null)u.insertAfter(o);else for(let m=s.length-1;m>=0;m--){let h=s[m];u.insertAfter(h)}else{let m=u.getFirstChild();if(gi(m)&&(u=m),m===null)if(o)u.append(o);else for(let h=0;h<s.length;h++){let y=s[h];u.append(y),f=y}else if(o!==null)m.insertBefore(o);else for(let h=0;h<s.length;h++){let y=s[h];m.insertBefore(y),f=y}}else if(o)u.insertAfter(o);else for(let m=s.length-1;m>=0;m--){let h=s[m];u.insertAfter(h),f=h}let p=Zde();jr(p)&&GQr(p.anchor)&&GQr(p.focus)?Z3(p.clone()):f!==null?f.selectEnd():t.dirty=!0}function ren(t){let e=t.anchor.getNode(),r=xY(e)?e:e.getParentOrThrow(),n=OFe().getElementByKey(r.getKey());if(n===null)return!1;let o=n.ownerDocument.defaultView;return o===null?!1:o.getComputedStyle(n).writingMode==="vertical-rl"}function Wgi(t,e){let r=ren(t)?!e:e;Gvt(t)&&(r=!r);let n=CY(t.focus,r?"previous":"next");if(gYr(n))return!1;for(let o of lYr(n)){if(Yde(o))return!o.origin.isInline();if(!gi(o.origin)){if(PFe(o.origin))return!0;break}}return!1}function nen(t,e,r,n){t.modify(e?"extend":"move",r,n)}function Gvt(t){let e=t.anchor.getNode();return(xY(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Jgi(t,e,r){let n=Gvt(t),o;o=ren(t)||n?!r:r,nen(t,e,o,"character")}function Kgi(t,e,r){let n=uke(t.getStyle());return n!==null&&n[e]||r}function Ggi(t,e,r=""){let n=null,o=t.getNodes(),i=t.anchor,a=t.focus,s=t.isBackward(),u=s?a.offset:i.offset,l=s?a.getNode():i.getNode();if(jr(t)&&t.isCollapsed()&&t.style!==""){let c=uke(t.style);if(c!==null&&e in c)return c[e]}for(let c=0;c<o.length;c++){let d=o[c];if((c===0||u!==0||!d.is(l))&&Yi(d)){let f=Kgi(d,e,r);if(n===null)n=f;else if(n!==f){n="";break}}}return n===null?r:n}function Jvt(t,e){let r=t;for(;r!==null&&r.getParent()!==null&&!e(r);)r=r.getParentOrThrow();return e(r)?r:null}var Xgi=YQr;var Zc=Xvt,oen=Zc.$addNodeStyle,mVs=Zc.$cloneWithProperties,hVs=Zc.$copyBlockFormatIndent,gVs=Zc.$ensureForwardRangeSelection,yVs=Zc.$forEachSelectedTextNode,bVs=Zc.$getSelectionStyleValueForProperty,_Vs=Zc.$isAtNodeEnd,vVs=Zc.$isParentElementRTL,wVs=Zc.$moveCaretSelection,Zvt=Zc.$moveCharacter,SVs=Zc.$patchStyleText,CVs=Zc.$selectAll,xVs=Zc.$setBlocksType,Yvt=Zc.$shouldOverrideDefaultCharacterSelection,lke=Zc.$sliceSelectedTextNodeContent,TVs=Zc.$trimTextContentFromAnchor,OVs=Zc.$wrapNodes,EVs=Zc.createDOMRange,ien=Zc.createRectsFromDOMRange,PVs=Zc.getCSSFromStyleObject,MVs=Zc.getStyleObjectFromCSS,RVs=Zc.trimTextContentFromAnchor;var rwt={};En(rwt,{$descendantsMatching:()=>jyi,$dfs:()=>byi,$dfsIterator:()=>hen,$filter:()=>Ryi,$findMatchingParent:()=>_en,$firstToLastIterator:()=>$yi,$getAdjacentCaret:()=>_yi,$getAdjacentSiblingOrParentSiblingCaret:()=>mfe,$getDepth:()=>yen,$getNearestBlockElementAncestorOrThrow:()=>xyi,$getNearestNodeOfType:()=>Cyi,$getNextRightPreorderNode:()=>Syi,$getNextSiblingOrParentSibling:()=>wyi,$insertFirst:()=>Iyi,$insertNodeToNearestRoot:()=>Eyi,$insertNodeToNearestRootAtCaret:()=>ven,$isEditorIsNestedEditor:()=>Nyi,$lastToFirstIterator:()=>twt,$restoreEditorState:()=>Oyi,$reverseDfs:()=>vyi,$reverseDfsIterator:()=>ben,$splitNode:()=>OYr,$unwrapAndFilterDescendants:()=>Dyi,$unwrapNode:()=>Lyi,$wrapNodeInElement:()=>Pyi,CAN_USE_BEFORE_INPUT:()=>syi,CAN_USE_DOM:()=>fen,IS_ANDROID:()=>uyi,IS_ANDROID_CHROME:()=>lyi,IS_APPLE:()=>cyi,IS_APPLE_WEBKIT:()=>dyi,IS_CHROME:()=>fyi,IS_FIREFOX:()=>pen,IS_IOS:()=>pyi,IS_SAFARI:()=>myi,addClassNamesToElement:()=>hyi,calculateZoomLevel:()=>Ayi,isBlockDomNode:()=>nQr,isHTMLAnchorElement:()=>oQr,isHTMLElement:()=>$Fe,isInlineDomNode:()=>rfe,isMimeType:()=>men,makeStateWrapper:()=>Fyi,markSelection:()=>den,mediaFileReader:()=>yyi,mergeRegister:()=>len,objectKlassEquals:()=>Myi,positionNodeOnRange:()=>cen,registerNestedElementResolver:()=>Tyi,removeClassNamesFromElement:()=>gyi,selectionAlwaysOnDisplay:()=>ayi});function cke(t,...e){let r=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(let o of e)n.append("v",o);throw r.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var ET=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Zgi=ET&&"documentMode"in document?document.documentMode:null,Ygi=ET&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Qgi=ET&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),eyi=!(!ET||!("InputEvent"in window)||Zgi)&&"getTargetRanges"in new window.InputEvent("input"),tyi=ET&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ryi=ET&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,sen=ET&&/Android/.test(navigator.userAgent),ewt=ET&&/^(?=.*Chrome).*/i.test(navigator.userAgent),nyi=ET&&sen&&ewt,oyi=ET&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ewt;function uen(...t){let e=[];for(let r of t)if(r&&typeof r=="string")for(let[n]of r.matchAll(/\S+/g))e.push(n);return e}function len(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function wN(t){return`${t}px`}var iyi={attributes:!0,characterData:!0,childList:!0,subtree:!0};function cen(t,e,r){let n=null,o=null,i=null,a=[],s=document.createElement("div");function u(){n===null&&cke(182),o===null&&cke(183);let{left:d,top:f}=o.getBoundingClientRect(),p=ien(t,e);var m,h;s.isConnected||(h=s,(m=o).insertBefore(h,m.firstChild));let y=!1;for(let g=0;g<p.length;g++){let b=p[g],_=a[g]||document.createElement("div"),w=_.style;w.position!=="absolute"&&(w.position="absolute",y=!0);let T=wN(b.left-d);w.left!==T&&(w.left=T,y=!0);let O=wN(b.top-f);w.top!==O&&(_.style.top=O,y=!0);let E=wN(b.width);w.width!==E&&(_.style.width=E,y=!0);let P=wN(b.height);w.height!==P&&(_.style.height=P,y=!0),_.parentNode!==s&&(s.append(_),y=!0),a[g]=_}for(;a.length>p.length;)a.pop();y&&r(a)}function l(){o=null,n=null,i!==null&&i.disconnect(),i=null,s.remove();for(let d of a)d.remove();a=[]}s.style.position="relative";let c=t.registerRootListener(function d(){let f=t.getRootElement();if(f===null)return l();let p=f.parentElement;if(!$Fe(p))return l();l(),n=f,o=p,i=new MutationObserver(m=>{let h=t.getRootElement(),y=h&&h.parentElement;if(h!==n||y!==o)return d();for(let g of m)if(!s.contains(g.target))return u()}),i.observe(p,iyi),u()});return()=>{c(),l()}}function aen(t,e,r){if(t.type!=="text"&&gi(e)){let n=e.getDOMSlot(r);return[n.element,n.getFirstChildOffset()+t.offset]}return[tQr(r)||r,t.offset]}function den(t,e){let r=null,n=null,o=null,i=null,a=null,s=null,u=()=>{};function l(c){c.read(()=>{let d=Sn();if(!jr(d))return r=null,o=null,i=null,s=null,u(),void(u=()=>{});let[f,p]=function(P){let R=P.getStartEndPoints();return P.isBackward()?[R[1],R[0]]:R}(d),m=f.getNode(),h=m.getKey(),y=f.offset,g=p.getNode(),b=g.getKey(),_=p.offset,w=t.getElementByKey(h),T=t.getElementByKey(b),O=r===null||w!==n||y!==o||h!==r.getKey(),E=i===null||T!==a||_!==s||b!==i.getKey();if((O||E)&&w!==null&&T!==null){let P=function(R,I,A,B,k,q,Z){let V=(R._window?R._window.document:document).createRange();return V.setStart(...aen(I,A,B)),V.setEnd(...aen(k,q,Z)),V}(t,f,m,w,p,g,T);u(),u=cen(t,P,R=>{if(e===void 0)for(let I of R){let A=I.style;A.background!=="Highlight"&&(A.background="Highlight"),A.color!=="HighlightText"&&(A.color="HighlightText"),A.marginTop!==wN(-1.5)&&(A.marginTop=wN(-1.5)),A.paddingTop!==wN(4)&&(A.paddingTop=wN(4)),A.paddingBottom!==wN(0)&&(A.paddingBottom=wN(0))}else e(R)})}r=m,n=w,o=y,i=g,a=T,s=_})}return l(t.getEditorState()),len(t.registerUpdateListener(({editorState:c})=>l(c)),()=>{u()})}function ayi(t){let e=null,r=()=>{let n=getSelection(),o=n&&n.anchorNode,i=t.getRootElement();o!==null&&i!==null&&i.contains(o)?e!==null&&(e(),e=null):e===null&&(e=den(t))};return document.addEventListener("selectionchange",r),()=>{e!==null&&e(),document.removeEventListener("selectionchange",r)}}var syi=eyi,fen=ET,uyi=sen,lyi=nyi,cyi=Ygi,dyi=oyi,fyi=ewt,pen=Qgi,pyi=ryi,myi=tyi;function hyi(t,...e){let r=uen(...e);r.length>0&&t.classList.add(...r)}function gyi(t,...e){let r=uen(...e);r.length>0&&t.classList.remove(...r)}function men(t,e){for(let r of e)if(t.type.startsWith(r))return!0;return!1}function yyi(t,e){let r=t[Symbol.iterator]();return new Promise((n,o)=>{let i=[],a=()=>{let{done:s,value:u}=r.next();if(s)return n(i);let l=new FileReader;l.addEventListener("error",o),l.addEventListener("load",()=>{let c=l.result;typeof c=="string"&&i.push({file:u,result:c}),a()}),men(u,e)?l.readAsDataURL(u):a()};a()})}function byi(t,e){return Array.from(hen(t,e))}function _yi(t){return t?t.getAdjacentCaret():null}function vyi(t,e){return Array.from(ben(t,e))}function hen(t,e){return gen("next",t,e)}function gen(t,e,r){let n=Ci(),o=e||n,i=gi(o)?zU(o,t):fL(o,t),a=yen(o),s=r?Xde(wvt(fL(r,t))):function(l,c){let d=mfe(fL(l,c));return d&&d[0]}(o,t),u=a;return Evt({hasNext:l=>l!==null,initial:i,map:l=>({depth:u,node:l.origin}),step:l=>{if(l.isSameNodeCaret(s))return null;Yde(l)&&u++;let c=mfe(l);return!c||c[0].isSameNodeCaret(s)?null:(u+=c[1],c[0])}})}function wyi(t){let e=mfe(fL(t,"next"));return e&&[e[0].origin,e[1]]}function yen(t){let e=-1;for(let r=t;r!==null;r=r.getParent())e++;return e}function Syi(t){let e=mfe(wvt(fL(t,"previous")),"root");return e&&e[0].origin}function ben(t,e){return gen("previous",t,e)}function Cyi(t,e){let r=t;for(;r!=null;){if(r instanceof e)return r;r=r.getParent()}return null}function xyi(t){let e=_en(t,r=>gi(r)&&!r.isInline());return gi(e)||cke(4,t.__key),e}var _en=(t,e)=>{let r=t;for(;r!==Ci()&&r!=null;){if(e(r))return r;r=r.getParent()}return null};function Tyi(t,e,r,n){let o=i=>i instanceof e;return t.registerNodeTransform(e,i=>{let a=(s=>{let u=s.getChildren();for(let d=0;d<u.length;d++){let f=u[d];if(o(f))return null}let l=s,c=s;for(;l!==null;)if(c=l,l=l.getParent(),o(l))return{child:c,parent:l};return null})(i);if(a!==null){let{child:s,parent:u}=a;if(s.is(i)){n(u,i);let l=s.getNextSiblings(),c=l.length;if(u.insertAfter(s),c!==0){let d=r(u);s.insertAfter(d);for(let f=0;f<c;f++)d.append(l[f])}u.canBeEmpty()||u.getChildrenSize()!==0||u.remove()}}})}function Oyi(t,e){let r=new Map,n=t._pendingEditorState;for(let[i,a]of e._nodeMap)r.set(i,UU(a));n&&(n._nodeMap=r),t._dirtyType=2;let o=e._selection;Z3(o===null?null:o.clone())}function Eyi(t){let e=Sn()||Zde(),r;if(jr(e))r=CY(e.focus,"next");else{if(e!=null){let a=e.getNodes(),s=a[a.length-1];s&&(r=fL(s,"next"))}r=r||zU(Ci(),"previous").getFlipped().insert(dL())}let n=ven(t,r),o=Xde(n),i=Yde(o)?vYr(o):n;return CYr(fYr(i)),t.getLatest()}function ven(t,e,r){let n=vvt(e,"next");for(let o=n;o;o=TYr(o,r))n=o;return MFe(n)&&cke(283),n.insert(t.isInline()?dL().append(t):t),vvt(fL(t.getLatest(),"next"),e.direction)}function Pyi(t,e){let r=e();return t.replace(r),r.append(t),r}function Myi(t,e){return t!==null&&Object.getPrototypeOf(t).constructor.name===e.name}function Ryi(t,e){let r=[];for(let n=0;n<t.length;n++){let o=e(t[n]);o!==null&&r.push(o)}return r}function Iyi(t,e){zU(t,"next").insert(e)}var Qvt=!(pen||!fen)&&void 0;function Ayi(t){let e=1;if(function(){if(Qvt===void 0){let r=document.createElement("div");r.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(r);let n=r.getBoundingClientRect();r.style.setProperty("zoom","2"),Qvt=r.getBoundingClientRect().width===n.width,document.body.removeChild(r)}return Qvt}())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue("zoom")),t=t.parentElement;return e}function Nyi(t){return t._parentEditor!==null}function Dyi(t,e){return wen(t,e,null)}function wen(t,e,r){let n=!1;for(let o of twt(t))e(o)?r!==null&&r(o):(n=!0,gi(o)&&wen(o,e,r||(i=>o.insertAfter(i))),o.remove());return n}function jyi(t,e){let r=[],n=Array.from(t).reverse();for(let o=n.pop();o!==void 0;o=n.pop())if(e(o))r.push(o);else if(gi(o))for(let i of twt(o))n.push(i);return r}function $yi(t){return Sen(zU(t,"next"))}function twt(t){return Sen(zU(t,"previous"))}function Sen(t){return Evt({hasNext:_Yr,initial:t.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function Lyi(t){SYr(fL(t,"next")).splice(1,t.getChildren())}function mfe(t,e="root"){let r=0,n=t,o=Xde(n);for(;o===null;){if(r--,o=n.getParentCaret(e),!o)return null;n=o,o=Xde(n)}return o&&[o,r]}function Fyi(t){let e=n=>mYr(n,t),r=(n,o)=>xYr(n,t,o);return{$get:e,$set:r,accessors:[e,r],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(n){return r(this,n)},stateConfig:t}}var Rn=rwt,jVs=Rn.$descendantsMatching,$Vs=Rn.$dfs,LVs=Rn.$dfsIterator,FVs=Rn.$filter,kVs=Rn.$findMatchingParent,qVs=Rn.$firstToLastIterator,BVs=Rn.$getAdjacentCaret,UVs=Rn.$getAdjacentSiblingOrParentSiblingCaret,zVs=Rn.$getDepth,VVs=Rn.$getNearestBlockElementAncestorOrThrow,HVs=Rn.$getNearestNodeOfType,WVs=Rn.$getNextRightPreorderNode,JVs=Rn.$getNextSiblingOrParentSibling,KVs=Rn.$insertFirst,GVs=Rn.$insertNodeToNearestRoot,XVs=Rn.$insertNodeToNearestRootAtCaret,ZVs=Rn.$isEditorIsNestedEditor,YVs=Rn.$lastToFirstIterator,QVs=Rn.$restoreEditorState,eHs=Rn.$reverseDfs,tHs=Rn.$reverseDfsIterator,rHs=Rn.$splitNode,nHs=Rn.$unwrapAndFilterDescendants,oHs=Rn.$unwrapNode,iHs=Rn.$wrapNodeInElement,aHs=Rn.CAN_USE_BEFORE_INPUT,sHs=Rn.CAN_USE_DOM,uHs=Rn.IS_ANDROID,lHs=Rn.IS_ANDROID_CHROME,cHs=Rn.IS_APPLE,dHs=Rn.IS_APPLE_WEBKIT,fHs=Rn.IS_CHROME,pHs=Rn.IS_FIREFOX,mHs=Rn.IS_IOS,hHs=Rn.IS_SAFARI,gHs=Rn.addClassNamesToElement,yHs=Rn.calculateZoomLevel,nwt=Rn.isBlockDomNode,bHs=Rn.isHTMLAnchorElement,Cen=Rn.isHTMLElement,_Hs=Rn.isInlineDomNode,vHs=Rn.isMimeType,wHs=Rn.makeStateWrapper,SHs=Rn.markSelection,CHs=Rn.mediaFileReader,gL=Rn.mergeRegister,hfe=Rn.objectKlassEquals,xHs=Rn.positionNodeOnRange,THs=Rn.registerNestedElementResolver,OHs=Rn.removeClassNamesFromElement,EHs=Rn.selectionAlwaysOnDisplay;var owt={};En(owt,{registerDragonSupport:()=>kyi});function kyi(t){let e=window.location.origin,r=n=>{if(n.origin!==e)return;let o=t.getRootElement();if(document.activeElement!==o)return;let i=n.data;if(typeof i=="string"){let a;try{a=JSON.parse(i)}catch{return}if(a&&a.protocol==="nuanria_messaging"&&a.type==="request"){let s=a.payload;if(s&&s.functionId==="makeChanges"){let u=s.args;if(u){let[l,c,d,f,p,m]=u;t.update(()=>{let h=Sn();if(jr(h)){let y=h.anchor,g=y.getNode(),b=0,_=0;if(Yi(g)&&l>=0&&c>=0&&(b=l,_=l+c,h.setTextNodeRange(g,b,g,_)),b===_&&d===""||(h.insertRawText(d),g=y.getNode()),Yi(g)){b=f,_=f+p;let w=g.getTextContentSize();b=b>w?w:b,_=_>w?w:_,h.setTextNodeRange(g,b,g,_)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",r,!0),()=>{window.removeEventListener("message",r,!0)}}var qyi=owt,xen=qyi.registerDragonSupport;var iwt={};En(iwt,{$generateHtmlFromNodes:()=>Uyi,$generateNodesFromDOM:()=>Byi});function Byi(t,e){let r=e.body?e.body.childNodes:[],n=[],o=[];for(let i=0;i<r.length;i++){let a=r[i];if(!Oen.has(a.nodeName)){let s=Een(a,t,o,!1);s!==null&&(n=n.concat(s))}}return function(i){for(let a of i)a.getNextSibling()instanceof Cvt&&a.insertAfter(_vt());for(let a of i){let s=a.getChildren();for(let u of s)a.insertBefore(u);a.remove()}}(o),n}function Uyi(t,e){if(typeof document>"u"||typeof window>"u"&&window.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let r=document.createElement("div"),n=Ci().getChildren();for(let o=0;o<n.length;o++)Ten(t,n[o],r,e);return r.innerHTML}function Ten(t,e,r,n=null){let o=n===null||e.isSelected(n),i=gi(e)&&e.excludeFromCopy("html"),a=e;if(n!==null){let p=UU(e);p=Yi(p)&&n!==null?lke(n,p):p,a=p}let s=gi(a)?a.getChildren():[],u=rQr(t,a.getType()),l;l=u&&u.exportDOM!==void 0?u.exportDOM(t,a):a.exportDOM(t);let{element:c,after:d}=l;if(!c)return!1;let f=document.createDocumentFragment();for(let p=0;p<s.length;p++){let m=s[p],h=Ten(t,m,f,n);!o&&gi(e)&&h&&e.extractWithChild(m,n,"html")&&(o=!0)}if(o&&!i){if((Cen(c)||Ovt(c))&&c.append(f),r.append(c),d){let p=d.call(a,c);p&&(Ovt(c)?c.replaceChildren(p):c.replaceWith(p))}}else r.append(f);return o}var Oen=new Set(["STYLE","SCRIPT"]);function Een(t,e,r,n,o=new Map,i){let a=[];if(Oen.has(t.nodeName))return a;let s=null,u=function(m,h){let{nodeName:y}=m,g=h._htmlConversions.get(y.toLowerCase()),b=null;if(g!==void 0)for(let _ of g){let w=_(m);w!==null&&(b===null||(b.priority||0)<=(w.priority||0))&&(b=w)}return b!==null?b.conversion:null}(t,e),l=u?u(t):null,c=null;if(l!==null){c=l.after;let m=l.node;if(s=Array.isArray(m)?m[m.length-1]:m,s!==null){for(let[,h]of o)if(s=h(s,i),!s)break;s&&a.push(...Array.isArray(m)?m:[s])}l.forChild!=null&&o.set(t.nodeName,l.forChild)}let d=t.childNodes,f=[],p=(s==null||!X3(s))&&(s!=null&&EFe(s)||n);for(let m=0;m<d.length;m++)f.push(...Een(d[m],e,r,p,new Map(o),s));return c!=null&&(f=c(f)),nwt(t)&&(f=zyi(t,f,p?()=>{let m=new Cvt;return r.push(m),m}:dL)),s==null?f.length>0?a=a.concat(f):nwt(t)&&function(m){return m.nextSibling==null||m.previousSibling==null?!1:rfe(m.nextSibling)&&rfe(m.previousSibling)}(t)&&(a=a.concat(_vt())):gi(s)&&s.append(...f),a}function zyi(t,e,r){let n=t.style.textAlign,o=[],i=[];for(let a=0;a<e.length;a++){let s=e[a];if(EFe(s))n&&!s.getFormat()&&s.setFormat(n),o.push(s);else if(i.push(s),a===e.length-1||a<e.length-1&&EFe(e[a+1])){let u=r();u.setFormat(n),u.append(...i),o.push(u),i=[]}}return o}var Pen=iwt,Men=Pen.$generateHtmlFromNodes,Ren=Pen.$generateNodesFromDOM;var swt={};En(swt,{$generateJSONFromSelectedNodes:()=>jen,$generateNodesFromSerializedNodes:()=>$en,$getClipboardDataFromSelection:()=>Len,$getHtmlContent:()=>Aen,$getLexicalContent:()=>Nen,$insertDataTransferForPlainText:()=>Vyi,$insertDataTransferForRichText:()=>Hyi,$insertGeneratedNodes:()=>awt,copyToClipboard:()=>Wyi,setLexicalClipboardDataTransfer:()=>Fen});function dke(t,...e){let r=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(let o of e)n.append("v",o);throw r.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Aen(t,e=Sn()){return e==null&&dke(166),jr(e)&&e.isCollapsed()||e.getNodes().length===0?"":Men(t,e)}function Nen(t,e=Sn()){return e==null&&dke(166),jr(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(jen(t,e))}function Vyi(t,e){let r=t.getData("text/plain")||t.getData("text/uri-list");r!=null&&e.insertRawText(r)}function Hyi(t,e,r){let n=t.getData("application/x-lexical-editor");if(n)try{let s=JSON.parse(n);if(s.namespace===r._config.namespace&&Array.isArray(s.nodes))return awt(r,$en(s.nodes),e)}catch{}let o=t.getData("text/html"),i=t.getData("text/plain");if(o&&i!==o)try{let s=new DOMParser().parseFromString(function(u){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:l=>l}).createHTML(u):u}(o),"text/html");return awt(r,Ren(r,s),e)}catch{}let a=i||t.getData("text/uri-list");if(a!=null)if(jr(e)){let s=a.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let u=0;u<s.length;u++){let l=Sn();if(jr(l)){let c=s[u];c===`
`||c===`\r
`?l.insertParagraph():c==="	"?l.insertNodes([uYr()]):l.insertText(c)}}}else e.insertRawText(a)}function awt(t,e,r){t.dispatchCommand(XYr,{nodes:e,selection:r})||(r.insertNodes(e),function(n){if(jr(n)&&n.isCollapsed()){let o=n.anchor,i=null,a=CY(o,"previous");if(a)if(MFe(a))i=a.origin;else{let s=cYr(a,zU(Ci(),"next").getFlipped());for(let u of s){if(Yi(u.origin)){i=u.origin;break}if(gi(u.origin)&&!u.origin.isInline())break}}if(i&&Yi(i)){let s=i.getFormat(),u=i.getStyle();n.format===s&&n.style===u||(n.format=s,n.style=u,n.dirty=!0)}}}(r))}function Den(t,e,r,n=[]){let o=e===null||r.isSelected(e),i=gi(r)&&r.excludeFromCopy("html"),a=r;if(e!==null){let l=UU(r);l=Yi(l)&&e!==null?lke(e,l):l,a=l}let s=gi(a)?a.getChildren():[],u=function(l){let c=l.exportJSON(),d=l.constructor;if(c.type!==d.getType()&&dke(58,d.name),gi(l)){let f=c.children;Array.isArray(f)||dke(59,d.name)}return c}(a);if(Yi(a)){let l=a.__text;l.length>0?u.text=l:o=!1}for(let l=0;l<s.length;l++){let c=s[l],d=Den(t,e,c,u.children);!o&&gi(r)&&d&&r.extractWithChild(c,e,"clone")&&(o=!0)}if(o&&!i)n.push(u);else if(Array.isArray(u.children))for(let l=0;l<u.children.length;l++){let c=u.children[l];n.push(c)}return o}function jen(t,e){let r=[],n=Ci().getChildren();for(let o=0;o<n.length;o++)Den(t,e,n[o],r);return{namespace:t._config.namespace,nodes:r}}function $en(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r],o=wYr(n);Yi(o)&&oen(o),e.push(o)}return e}var NY=null;async function Wyi(t,e,r){if(NY!==null)return!1;if(e!==null)return new Promise((l,c)=>{t.update(()=>{l(Ien(t,e,r))})});let n=t.getRootElement(),o=t._window||window,i=window.document,a=Tvt(o);if(n===null||a===null)return!1;let s=i.createElement("span");s.style.cssText="position: fixed; top: -1000px;",s.append(i.createTextNode("#")),n.append(s);let u=new Range;return u.setStart(s,0),u.setEnd(s,1),a.removeAllRanges(),a.addRange(u),new Promise((l,c)=>{let d=t.registerCommand(AFe,f=>(hfe(f,ClipboardEvent)&&(d(),NY!==null&&(window.clearTimeout(NY),NY=null),l(Ien(t,f,r))),!0),IFe);NY=window.setTimeout(()=>{d(),NY=null,l(!1)},50),i.execCommand("copy"),s.remove()})}function Ien(t,e,r){if(r===void 0){let o=Tvt(t._window);if(!o)return!1;let i=o.anchorNode,a=o.focusNode;if(i!==null&&a!==null&&!iQr(t,i,a))return!1;let s=Sn();if(s===null)return!1;r=Len(s)}e.preventDefault();let n=e.clipboardData;return n!==null&&(Fen(n,r),!0)}var Jyi=[["text/html",Aen],["application/x-lexical-editor",Nen]];function Len(t=Sn()){let e={"text/plain":t?t.getTextContent():""};if(t){let r=OFe();for(let[n,o]of Jyi){let i=o(r,t);i!==null&&(e[n]=i)}}return e}function Fen(t,e){for(let r in e){let n=e[r];n!==void 0&&t.setData(r,n)}}var SN=swt,kHs=SN.$generateJSONFromSelectedNodes,qHs=SN.$generateNodesFromSerializedNodes,BHs=SN.$getClipboardDataFromSelection,ken=SN.$getHtmlContent,UHs=SN.$getLexicalContent,uwt=SN.$insertDataTransferForPlainText,zHs=SN.$insertDataTransferForRichText,VHs=SN.$insertGeneratedNodes,HHs=SN.copyToClipboard,WHs=SN.setLexicalClipboardDataTransfer;var lwt={};En(lwt,{registerPlainText:()=>Qyi});var DY=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Kyi=DY&&"documentMode"in document?document.documentMode:null,Gyi=!(!DY||!("InputEvent"in window)||Kyi)&&"getTargetRanges"in new window.InputEvent("input"),Xyi=DY&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),qen=DY&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Zyi=DY&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Yyi=DY&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Zyi;function Ben(t,e){e.update(()=>{if(t!==null){let r=hfe(t,KeyboardEvent)?null:t.clipboardData,n=Sn();if(n!==null&&r!=null){t.preventDefault();let o=ken(e);o!==null&&r.setData("text/html",o),r.setData("text/plain",n.getTextContent())}}})}function Qyi(t){return gL(t.registerCommand(TY,e=>{let r=Sn();return!!jr(r)&&(r.deleteCharacter(e),!0)},nl),t.registerCommand(DYr,e=>{let r=Sn();return!!jr(r)&&(r.deleteWord(e),!0)},nl),t.registerCommand(NYr,e=>{let r=Sn();return!!jr(r)&&(r.deleteLine(e),!0)},nl),t.registerCommand(IYr,e=>{let r=Sn();if(!jr(r))return!1;if(typeof e=="string")r.insertText(e);else{let n=e.dataTransfer;if(n!=null)uwt(n,r);else{let o=e.data;o&&r.insertText(o)}}return!0},nl),t.registerCommand(GYr,()=>{let e=Sn();return!!jr(e)&&(e.removeText(),!0)},nl),t.registerCommand(xvt,e=>{let r=Sn();return!!jr(r)&&(r.insertLineBreak(e),!0)},nl),t.registerCommand(FYr,()=>{let e=Sn();return!!jr(e)&&(e.insertLineBreak(),!0)},nl),t.registerCommand(qYr,e=>{let r=Sn();if(!jr(r))return!1;let n=e,o=n.shiftKey;return!!Yvt(r,!0)&&(n.preventDefault(),Zvt(r,o,!0),!0)},nl),t.registerCommand(BYr,e=>{let r=Sn();if(!jr(r))return!1;let n=e,o=n.shiftKey;return!!Yvt(r,!1)&&(n.preventDefault(),Zvt(r,o,!1),!0)},nl),t.registerCommand(zYr,e=>{let r=Sn();return!!jr(r)&&(!qen||navigator.language!=="ko-KR")&&(e.preventDefault(),t.dispatchCommand(TY,!0))},nl),t.registerCommand(VYr,e=>{let r=Sn();return!!jr(r)&&(e.preventDefault(),t.dispatchCommand(TY,!1))},nl),t.registerCommand(EY,e=>{let r=Sn();if(!jr(r))return!1;if(e!==null){if((qen||Xyi||Yyi)&&Gyi)return!1;e.preventDefault()}return t.dispatchCommand(xvt,!1)},nl),t.registerCommand(ZYr,()=>(RFe(),!0),nl),t.registerCommand(AFe,e=>{let r=Sn();return!!jr(r)&&(Ben(e,t),!0)},nl),t.registerCommand(AYr,e=>{let r=Sn();return!!jr(r)&&(function(n,o){Ben(n,o),o.update(()=>{let i=Sn();jr(i)&&i.removeText()})}(e,t),!0)},nl),t.registerCommand(jFe,e=>{let r=Sn();return!!jr(r)&&(function(n,o){n.preventDefault(),o.update(()=>{let i=Sn(),a=hfe(n,ClipboardEvent)?n.clipboardData:null;a!=null&&jr(i)&&uwt(a,i)},{tag:JYr})}(e,t),!0)},nl),t.registerCommand($Yr,e=>{let r=Sn();return!!jr(r)&&(e.preventDefault(),!0)},nl),t.registerCommand(jYr,e=>{let r=Sn();return!!jr(r)&&(e.preventDefault(),!0)},nl))}var ebi=lwt,Uen=ebi.registerPlainText;var dwt={};En(dwt,{PlainTextPlugin:()=>tbi});var mC=$(K(),1),fke=$(yu(),1),GU=$(wt(),1);var cwt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?mC.useLayoutEffect:mC.useEffect;function zen(t){return t.getEditorState().read(ake(t.isComposing()))}function tbi({contentEditable:t,placeholder:e=null,ErrorBoundary:r}){let[n]=Di(),o=function(i,a){let[s,u]=(0,mC.useState)(()=>i.getDecorators());return cwt(()=>i.registerDecoratorListener(l=>{(0,fke.flushSync)(()=>{u(l)})}),[i]),(0,mC.useEffect)(()=>{u(i.getDecorators())},[i]),(0,mC.useMemo)(()=>{let l=[],c=Object.keys(s);for(let d=0;d<c.length;d++){let f=c[d],p=(0,GU.jsx)(a,{onError:h=>i._onError(h),children:(0,GU.jsx)(mC.Suspense,{fallback:null,children:s[f]})}),m=i.getElementByKey(f);m!==null&&l.push((0,fke.createPortal)(p,m,f))}return l},[a,s,i])}(n,r);return function(i){cwt(()=>gL(Uen(i),xen(i)),[i])}(n),(0,GU.jsxs)(GU.Fragment,{children:[t,(0,GU.jsx)(rbi,{content:e}),o]})}function rbi({content:t}){let[e]=Di(),r=function(o){let[i,a]=(0,mC.useState)(()=>zen(o));return cwt(()=>{function s(){let u=zen(o);a(u)}return s(),gL(o.registerUpdateListener(()=>{s()}),o.registerEditableListener(()=>{s()}))},[o]),i}(e),n=VQr();return r?typeof t=="function"?t(n):t:null}var nbi=dwt,pke=nbi.PlainTextPlugin;var fwt={};En(fwt,{ContentEditable:()=>ibi,ContentEditableElement:()=>Wen});var fb=$(K(),1),yL=$(wt(),1);var Hen=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fb.useLayoutEffect:fb.useEffect;function obi({editor:t,ariaActiveDescendant:e,ariaAutoComplete:r,ariaControls:n,ariaDescribedBy:o,ariaErrorMessage:i,ariaExpanded:a,ariaInvalid:s,ariaLabel:u,ariaLabelledBy:l,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:p,className:m,id:h,role:y="textbox",spellCheck:g=!0,style:b,tabIndex:_,"data-testid":w,...T},O){let[E,P]=(0,fb.useState)(t.isEditable()),R=(0,fb.useCallback)(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?t.setRootElement(A):t.setRootElement(null)},[t]),I=(0,fb.useMemo)(()=>function(...A){return B=>{A.forEach(k=>{typeof k=="function"?k(B):k!=null&&(k.current=B)})}}(O,R),[R,O]);return Hen(()=>(P(t.isEditable()),t.registerEditableListener(A=>{P(A)})),[t]),(0,yL.jsx)("div",{"aria-activedescendant":E?e:void 0,"aria-autocomplete":E?r:"none","aria-controls":E?n:void 0,"aria-describedby":o,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":E&&y==="combobox"?!!a:void 0,...s!=null?{"aria-invalid":s}:{},"aria-label":u,"aria-labelledby":l,"aria-multiline":c,"aria-owns":E?d:void 0,"aria-readonly":!E||void 0,"aria-required":f,autoCapitalize:p,className:m,contentEditable:E,"data-testid":w,id:h,ref:I,role:y,spellCheck:g,style:b,tabIndex:_,...T})}var Wen=(0,fb.forwardRef)(obi);function Ven(t){return t.getEditorState().read(ake(t.isComposing()))}var ibi=(0,fb.forwardRef)(abi);function abi(t,e){let{placeholder:r,...n}=t,[o]=Di();return(0,yL.jsxs)(yL.Fragment,{children:[(0,yL.jsx)(Wen,{editor:o,...n,ref:e}),r!=null&&(0,yL.jsx)(sbi,{editor:o,content:r})]})}function sbi({content:t,editor:e}){let r=function(a){let[s,u]=(0,fb.useState)(()=>Ven(a));return Hen(()=>{function l(){let c=Ven(a);u(c)}return l(),gL(a.registerUpdateListener(()=>{l()}),a.registerEditableListener(()=>{l()}))},[a]),s}(e),[n,o]=(0,fb.useState)(e.isEditable());if((0,fb.useLayoutEffect)(()=>(o(e.isEditable()),e.registerEditableListener(a=>{o(a)})),[e]),!r)return null;let i=null;return typeof t=="function"?i=t(n):t!==null&&(i=t),i===null?null:(0,yL.jsx)("div",{"aria-hidden":!0,children:i})}var Jen=fwt,mke=Jen.ContentEditable,lWs=Jen.ContentEditableElement;var hwt={};En(hwt,{createEmptyHistoryState:()=>mbi,registerHistory:()=>pbi});var hke=0,pwt=1,mwt=2,PT=0,ubi=1,Ken=2,lbi=3,cbi=4;function dbi(t,e,r,n,o){if(t===null||r.size===0&&n.size===0&&!o)return PT;let i=e._selection,a=t._selection;if(o)return ubi;if(!(jr(i)&&jr(a)&&a.isCollapsed()&&i.isCollapsed()))return PT;let s=function(g,b,_){let w=g._nodeMap,T=[];for(let O of b){let E=w.get(O);E!==void 0&&T.push(E)}for(let[O,E]of _){if(!E)continue;let P=w.get(O);P===void 0||xY(P)||T.push(P)}return T}(e,r,n);if(s.length===0)return PT;if(s.length>1){let g=e._nodeMap,b=g.get(i.anchor.key),_=g.get(a.anchor.key);return b&&_&&!t._nodeMap.has(b.__key)&&Yi(b)&&b.__text.length===1&&i.anchor.offset===1?Ken:PT}let u=s[0],l=t._nodeMap.get(u.__key);if(!Yi(l)||!Yi(u)||l.__mode!==u.__mode)return PT;let c=l.__text,d=u.__text;if(c===d)return PT;let f=i.anchor,p=a.anchor;if(f.key!==p.key||f.type!=="text")return PT;let m=f.offset,h=p.offset,y=d.length-c.length;return y===1&&h===m-1?Ken:y===-1&&h===m+1?lbi:y===-1&&h===m?cbi:PT}function fbi(t,e){let r=Date.now(),n=PT;return(o,i,a,s,u,l)=>{let c=Date.now();if(l.has(DFe))return n=PT,r=c,mwt;let d=dbi(o,i,s,u,t.isComposing()),f=(()=>{let p=a===null||a.editor===t,m=l.has(LYr);if(!m&&p&&l.has(OY))return hke;if(o===null)return pwt;let h=i._selection;return s.size>0||u.size>0?m===!1&&d!==PT&&d===n&&c<r+e&&p||s.size===1&&function(y,g,b){let _=g._nodeMap.get(y),w=b._nodeMap.get(y),T=g._selection,O=b._selection;return!(jr(T)&&jr(O)&&T.anchor.type==="element"&&T.focus.type==="element"&&O.anchor.type==="text"&&O.focus.type==="text"||!Yi(_)||!Yi(w)||_.__parent!==w.__parent)&&JSON.stringify(g.read(()=>_.exportJSON()))===JSON.stringify(b.read(()=>w.exportJSON()))}(Array.from(s)[0],o,i)?hke:pwt:h!==null?hke:mwt})();return r=c,n=d,f}}function Gen(t){t.undoStack=[],t.redoStack=[],t.current=null}function pbi(t,e,r){let n=fbi(t,r);return gL(t.registerCommand(YYr,()=>(function(i,a){let s=a.redoStack,u=a.undoStack;if(u.length!==0){let l=a.current,c=u.pop();l!==null&&(s.push(l),i.dispatchCommand(Qde,!0)),u.length===0&&i.dispatchCommand(efe,!1),a.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:DFe})}}(t,e),!0),nl),t.registerCommand(KYr,()=>(function(i,a){let s=a.redoStack,u=a.undoStack;if(s.length!==0){let l=a.current;l!==null&&(u.push(l),i.dispatchCommand(efe,!0));let c=s.pop();s.length===0&&i.dispatchCommand(Qde,!1),a.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:DFe})}}(t,e),!0),nl),t.registerCommand(PYr,()=>(Gen(e),!1),nl),t.registerCommand(MYr,()=>(Gen(e),t.dispatchCommand(Qde,!1),t.dispatchCommand(efe,!1),!0),nl),t.registerUpdateListener(({editorState:i,prevEditorState:a,dirtyLeaves:s,dirtyElements:u,tags:l})=>{let c=e.current,d=e.redoStack,f=e.undoStack,p=c===null?null:c.editorState;if(c!==null&&i===p)return;let m=n(a,i,c,s,u,l);if(m===pwt)d.length!==0&&(e.redoStack=[],t.dispatchCommand(Qde,!1)),c!==null&&(f.push({...c}),t.dispatchCommand(efe,!0));else if(m===mwt)return;e.current={editor:t,editorState:i}}))}function mbi(){return{current:null,redoStack:[],undoStack:[]}}var Xen=hwt,gke=Xen.createEmptyHistoryState,Zen=Xen.registerHistory;var gwt={};En(gwt,{HistoryPlugin:()=>hbi,createEmptyHistoryState:()=>gke});var yke=$(K(),1);function hbi({delay:t,externalHistoryState:e}){let[r]=Di();return function(n,o,i=1e3){let a=(0,yke.useMemo)(()=>o||gke(),[o]);(0,yke.useEffect)(()=>Zen(n,a,i),[i,n,a])}(r,e,t),null}var Yen=gwt,bke=Yen.HistoryPlugin,yWs=Yen.createEmptyHistoryState;var ywt={};En(ywt,{OnChangePlugin:()=>ybi});var _ke=$(K(),1),gbi=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?_ke.useLayoutEffect:_ke.useEffect;function ybi({ignoreHistoryMergeTagChange:t=!0,ignoreSelectionChange:e=!1,onChange:r}){let[n]=Di();return gbi(()=>{if(r)return n.registerUpdateListener(({editorState:o,dirtyElements:i,dirtyLeaves:a,prevEditorState:s,tags:u})=>{e&&i.size===0&&a.size===0||t&&u.has(OY)||s.isEmpty()||r(o,n,u)})},[n,t,e,r]),null}var bbi=ywt,vke=bbi.OnChangePlugin;var vwt={};En(vwt,{LexicalErrorBoundary:()=>vbi});var jY=$(K(),1),bwt=$(wt(),1);function _wt(t,e){return _wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},_wt(t,e)}var Qen={error:null},_bi=function(t){var e,r;function n(){for(var i,a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return(i=t.call.apply(t,[this].concat(s))||this).state=Qen,i.resetErrorBoundary=function(){for(var l,c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];i.props.onReset==null||(l=i.props).onReset.apply(l,d),i.reset()},i}r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,_wt(e,r),n.getDerivedStateFromError=function(i){return{error:i}};var o=n.prototype;return o.reset=function(){this.setState(Qen)},o.componentDidCatch=function(i,a){var s,u;(s=(u=this.props).onError)==null||s.call(u,i,a)},o.componentDidUpdate=function(i,a){var s,u,l,c,d=this.state.error,f=this.props.resetKeys;d!==null&&a.error!==null&&((l=i.resetKeys)===void 0&&(l=[]),(c=f)===void 0&&(c=[]),l.length!==c.length||l.some(function(p,m){return!Object.is(p,c[m])}))&&((s=(u=this.props).onResetKeysChange)==null||s.call(u,i.resetKeys,f),this.reset())},o.render=function(){var i=this.state.error,a=this.props,s=a.fallbackRender,u=a.FallbackComponent,l=a.fallback;if(i!==null){var c={error:i,resetErrorBoundary:this.resetErrorBoundary};if(jY.isValidElement(l))return l;if(typeof s=="function")return s(c);if(u)return jY.createElement(u,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(jY.Component);function vbi({children:t,onError:e}){return(0,bwt.jsx)(_bi,{fallback:(0,bwt.jsx)("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:t})}var wbi=vwt,wke=wbi.LexicalErrorBoundary;var RT=$(K());var Swt=$(ofe());var MT=$(K()),ttn=$(yu());function rtn(t,e){let r=e.getSelection();if(r===null||!r.isCollapsed)return null;let n=r.anchorNode,o=t,i=r.anchorOffset;if(n==null||i==null)return null;let a=e.document.createRange();try{a.setStart(n,o),a.setEnd(n,i)}catch{return null}return a}var etn=400,Sbi=.9;function XU({options:t,selectedIndex:e,onSelect:r,onHighlight:n,range:o,query:i,showPreview:a=!1,mode:s="search",onKeyDown:u}){let[l,c]=(0,MT.useState)(null),d=(0,MT.useCallback)(()=>{let m=Math.floor(window.innerWidth*Sbi);if(t.length===0)return Math.min(etn,m);let h=Math.max(...t.map(_=>_.title.length)),y=Math.max(...t.map(_=>_.subtitle?.length||0)),g=Math.max(h*8+32,y*6+32),b=Math.min(Math.max(g,300),etn);return Math.min(b,m)},[t]),f=(0,MT.useCallback)(()=>{if(!o)return;let m=o.getBoundingClientRect(),h=d(),y=m.top-4,g=8,b=window.innerWidth-h-8,_=Math.min(Math.max(m.left,g),b);c({top:y,left:_,width:h})},[o,d]);if((0,MT.useEffect)(()=>{f()},[f]),(0,MT.useEffect)(()=>{let m=()=>f();return window.addEventListener("resize",m),document.addEventListener("scroll",m,{passive:!0}),()=>{window.removeEventListener("resize",m),document.removeEventListener("scroll",m)}},[f]),!l||t.length===0)return null;let p=MT.default.createElement("div",{className:"tw-absolute tw-z-[9999] tw-flex tw-flex-col tw-items-end",style:{bottom:`calc(100vh - ${l.top}px)`,left:l.left,width:l.width}},MT.default.createElement(VFe,{options:t,selectedIndex:e,onSelect:r,onHighlight:n,query:i,mode:s,showPreview:a,onKeyDown:u,className:"tw-shadow-lg",width:l.width}));return(0,ttn.createPortal)(p,document.body)}var CN=require("obsidian");Xe();function Cbi(t){let{type:e,title:r,data:n}=t;switch(e){case"active-note":return lfe();case"notes":if(n instanceof CN.TFile&&r)return ufe(r,n.path);break;case"tools":if(typeof n=="string")return r6(n);break;case"folders":if(n instanceof CN.TFolder)return dfe(n.path);break;case"webTabs":if(n&&typeof n=="object"&&"url"in n){let o=n;return rke(o.url,o.title,o.faviconUrl)}break;case"activeWebTab":return tke()}throw new Error(`Invalid pill data: ${JSON.stringify(t)}`)}function wwt(t,e,r){return{beforeText:t.slice(0,e),afterText:t.slice(r)}}function xbi(t,e,r=!0){if(e.length===1&&e[0].getType()==="text")t.replace(e[0]),r&&ntn(e[0]);else{for(let n=0;n<e.length;n++)n===0?t.replace(e[n]):e[n-1].insertAfter(e[n]);if(r&&e.length>0){let n=e[e.length-1];ntn(n)}}}function Tbi(t,e,r,n,o){let i=o?n?" "+n:" ":n;e?(t.setTextContent(e),t.insertAfter(r),i&&r.insertAfter(rS(i))):(t.replace(r),i&&r.insertAfter(rS(i))),r.selectNext()}function ntn(t){if(t.getType()==="text"){let e=t,r=e.getTextContent().length;e.select(r,r)}else{let e=t.getParent();if(e){let r=TFe(),n=t.getIndexWithinParent();r.anchor.set(e.getKey(),n+1,"element"),r.focus.set(e.getKey(),n+1,"element"),Z3(r)}}}var Ske=QYr("INSERT_TEXT_WITH_PILLS_COMMAND");function Obi(t){try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function Ebi(t){let e=t.startsWith("@")?t:`@${t}`;return gX.includes(e)?e:null}function Pbi(t){if(!app?.vault)return null;try{let e=app.vault.getAllLoadedFiles().filter(n=>n instanceof CN.TFolder);for(let n of e)if(n.name===t)return n;for(let n of e)if(n.path===t)return n;let r=t.toLowerCase();for(let n of e)if(n.name.toLowerCase()===r||n.path.toLowerCase()===r)return n;return null}catch(e){return F("Error resolving folder reference:",e),null}}function Mbi(t){if(!app?.vault||!app?.metadataCache)return null;try{let e=app.metadataCache.getFirstLinkpathDest(t,"");if(e&&e instanceof CN.TFile)return e;if(!t.endsWith(".md")){let i=app.metadataCache.getFirstLinkpathDest(t+".md","");if(i&&i instanceof CN.TFile)return i}if(!t.endsWith(".pdf")){let i=app.metadataCache.getFirstLinkpathDest(t+".pdf","");if(i&&i instanceof CN.TFile)return i}let r=app.vault.getMarkdownFiles();for(let i of r)if(i.basename===t||i.name===t)return i;let o=app.vault.getFiles().filter(i=>i instanceof CN.TFile&&i.extension==="pdf");for(let i of o)if(i.basename===t||i.name===t)return i;return null}catch(e){return F("Error resolving note reference:",e),null}}function Cke(t,e={}){let{includeNotes:r=!0,includeURLs:n=!1,includeTools:o=!1,includeCustomTemplates:i=!1}=e,a=[],s=[],u=[],l=1;if(r&&(s.push("(\\[\\[([^\\]]+)\\]\\])"),u.push({type:"notes",groupCount:2,startIndex:l}),l+=2),n&&(s.push(`(https?:\\/\\/[^\\s"'<>]+)`),u.push({type:"urls",groupCount:1,startIndex:l}),l+=1),o&&(s.push("(@[a-zA-Z][a-zA-Z0-9_]*)"),u.push({type:"tools",groupCount:1,startIndex:l}),l+=1),i&&(s.push("(\\{([^}]+)\\})"),u.push({type:"customTemplates",groupCount:2,startIndex:l}),l+=2),s.length===0)return[{type:"text",content:t}];let c=new RegExp(s.join("|"),"g"),d=0,f;for(;(f=c.exec(t))!==null;){if(f.index>d){let m=t.slice(d,f.index);m&&a.push({type:"text",content:m})}let p=null;for(let m of u)if(f[m.startIndex]){p=m;break}if(!p)a.push({type:"text",content:f[0]});else if(p.type==="notes"){let m=f[p.startIndex+1].trim(),h=Mbi(m);if(h&&h instanceof CN.TFile){let g=app?.workspace.getActiveFile()?.path===h.path;a.push({type:"note-pill",content:h.basename,file:h,isActive:g})}else a.push({type:"text",content:f[0]})}else if(p.type==="urls"){let m=f[p.startIndex].replace(/,+$/,"");Obi(m)?a.push({type:"url-pill",content:m,url:m}):a.push({type:"text",content:f[0]})}else if(p.type==="tools"){let m=f[p.startIndex],h=Ebi(m);h?a.push({type:"tool-pill",content:h,toolName:h}):a.push({type:"text",content:f[0]})}else if(p.type==="customTemplates"){let m=f[p.startIndex+1].trim();if(m==="activeNote")a.push({type:"active-note-pill",content:"activeNote"});else{let h=Pbi(m);h?a.push({type:"folder-pill",content:h.path,folder:h}):a.push({type:"text",content:f[0]})}}d=c.lastIndex}if(d<t.length){let p=t.slice(d);p&&a.push({type:"text",content:p})}return a}function xke(t){let e=[];for(let r of t)r.type==="text"&&r.content?e.push(rS(r.content)):r.type==="active-note-pill"?e.push(lfe()):r.type==="note-pill"&&r.file?e.push(ufe(r.content,r.file.path)):r.type==="url-pill"&&r.url?e.push(QFe(r.url)):r.type==="tool-pill"&&r.toolName?e.push(r6(r.toolName)):r.type==="folder-pill"&&r.folder&&e.push(dfe(r.folder.path));return e}function otn(t,e={}){let{enableURLPills:r=!1,insertAtSelection:n=!0}=e;if(!t)return;let o=Sn();if(!jr(o)){F("No range selection available for text insertion");return}let i=Cke(t,{includeNotes:!0,includeURLs:r}),a=xke(i);a.length>0&&(n||o.removeText(),o.insertNodes(a))}function itn(t,e,r,n={}){let{enableURLPills:o=!1,enableToolPills:i=!1,enableCustomTemplatePills:a=!1}=n,s=Sn();if(!jr(s))return;let l=s.anchor.getNode();if(l.getType()!=="text")return;let c=l,d=c.getTextContent(),f=Cke(r,{includeNotes:!0,includeURLs:o,includeTools:i,includeCustomTemplates:a});if(f.length===1&&f[0].type==="text"){let{beforeText:p,afterText:m}=wwt(d,t,e),h=p+f[0].content+m;c.setTextContent(h);let y=p.length+f[0].content.length;c.select(y,y)}else{let{beforeText:p,afterText:m}=wwt(d,t,e),h=[];p&&h.push(rS(p)),h.push(...xke(f)),m&&h.push(rS(m)),xbi(c,h)}}function $Y(t,e,r=!0){let n=Sn();if(!jr(n))return;let o=n.anchor,i=o.getNode();if(!(i instanceof yN))return;let a=i.getTextContent(),s=o.offset,u=-1;if(t==="[["?u=a.lastIndexOf("[[",s):u=a.lastIndexOf(t,s),u===-1)return;let{beforeText:l,afterText:c}=wwt(a,u,s),d=Cbi(e);Tbi(i,l,d,c,r)}var oS=$(K());function ZU({triggerConfig:t,options:e,onSelect:r,onStateChange:n,onHighlight:o}){let[i]=Di(),[a,s]=(0,oS.useState)({isOpen:!1,query:"",selectedIndex:0,range:null});(0,oS.useEffect)(()=>{n?.(a)},[a,n]);let u=(0,oS.useCallback)(()=>{s({isOpen:!1,query:"",selectedIndex:0,range:null})},[]),l=(0,oS.useCallback)(f=>{s(p=>({...p,selectedIndex:f})),o&&e[f]&&o(f,e[f])},[o,e]),c=(0,oS.useCallback)(f=>{if(!f||!a.isOpen)return!1;switch(f.key){case"ArrowDown":{if(e.length===0)return!1;f.preventDefault();let p=a.selectedIndex+1;for(;p<e.length&&e[p]?.disabled;)p++;return p>=e.length&&(p=a.selectedIndex),l(p),!0}case"ArrowUp":{if(e.length===0)return!1;f.preventDefault();let p=a.selectedIndex-1;for(;p>=0&&e[p]?.disabled;)p--;return p<0&&(p=a.selectedIndex),l(p),!0}case"Enter":case"Tab":return e.length===0?(u(),!1):(e[a.selectedIndex]?.disabled||(f.preventDefault(),e[a.selectedIndex]&&r(e[a.selectedIndex])),!0);case"Escape":return f.preventDefault(),u(),!0;default:return!1}},[a.isOpen,a.selectedIndex,e,r,u,l]);(0,oS.useEffect)(()=>{let f=i.registerCommand(kYr,b=>c(b),pL),p=i.registerCommand(UYr,b=>c(b),pL),m=i.registerCommand(EY,b=>c(b),pL),h=i.registerCommand(WYr,b=>c(b),pL),y=i.registerCommand(HYr,b=>c(b),pL),g=i.registerCommand(EYr,()=>(a.isOpen&&u(),!1),pL);return()=>{f(),p(),m(),h(),y(),g()}},[i,c,a.isOpen,u]);let d=(0,oS.useCallback)((f,p)=>{let{char:m,multiChar:h=!1,allowWhitespace:y=!1}=t;if(h){let g=m.length,b=-1;for(let _=p-1;_>=g-1;_--)if(f.slice(_-g+1,_+1)===m){if(_-g+1===0||/\s/.test(f[_-g])){b=_-g+1;break}}else if(!y&&/\s/.test(f[_]))break;if(b!==-1){let _=f.slice(b+g,p);return _.startsWith(" ")?null:{triggerIndex:b,query:_}}}else{let g=-1;for(let b=p-1;b>=0;b--){let _=f[b];if(_===m){if(b===0||/\s/.test(f[b-1])){g=b;break}}else if(!y&&/\s/.test(_))break}if(g!==-1){let b=f.slice(g+1,p);return b.startsWith(" ")?null:{triggerIndex:g,query:b}}}return null},[t]);return(0,oS.useEffect)(()=>i.registerUpdateListener(({editorState:f})=>{f.read(()=>{let p=Sn();if(!jr(p)||!p.isCollapsed()){a.isOpen&&u();return}let m=p.anchor,h=m.getNode();if(!(h instanceof yN)){a.isOpen&&u();return}let y=h.getTextContent(),g=m.offset,b=d(y,g);if(b){let{triggerIndex:_,query:w}=b,T=i._window??window,O=rtn(_,T);O&&s(E=>({...E,isOpen:!0,query:w,selectedIndex:0,range:O}))}else a.isOpen&&u()})}),[i,a.isOpen,u,d]),(0,oS.useEffect)(()=>{s(f=>({...f,selectedIndex:0}))},[e.length]),(0,oS.useEffect)(()=>{s(f=>f.selectedIndex>=e.length&&e.length>0?{...f,selectedIndex:Math.max(0,e.length-1)}:f)},[e.length]),{state:a,setState:s,closeMenu:u,detectTrigger:d,handleHighlight:l}}function atn(){let[t]=Di(),e=Mje(),[r,n]=(0,RT.useState)(""),o=(0,RT.useMemo)(()=>Aje(e.filter(c=>c.showInSlashMenu)).map((c,d)=>({key:`${c.title}-${d}`,title:c.title,content:c.content,command:c})),[e]),i=(0,RT.useMemo)(()=>{if(!r)return o;let l=r,c=Swt.default.go(l,o,{key:"title",threshold:-1e4});return c.length>0?c.map(f=>f.obj):Swt.default.go(l,o,{key:"content",threshold:-1e4}).map(f=>f.obj)},[o,r]),a=(0,RT.useCallback)(l=>{Zm.getInstance().recordUsage(l.command),t.update(()=>{let c=Sn();if(!jr(c))return;let d=c.anchor,f=d.getNode();if(f instanceof yN){let m=f.getTextContent().lastIndexOf("/",d.offset);if(m!==-1){let h=l.content||l.title;itn(m,d.offset,h,{enableURLPills:!0,enableToolPills:!0,enableCustomTemplatePills:!0})}}})},[t]),{state:s,handleHighlight:u}=ZU({triggerConfig:{char:"/",allowWhitespace:!0},options:i,onSelect:a,onStateChange:l=>{n(l.query)}});return RT.default.createElement(RT.default.Fragment,null,s.isOpen&&RT.default.createElement(XU,{options:i,selectedIndex:s.selectedIndex,onSelect:a,onHighlight:u,range:s.range,query:s.query,showPreview:!0}))}var iS=$(K());var o6=$(K());Mr();var stn=$(ofe());Qe();var Rbi={limit:30,threshold:-1e4};function utn(t,e=!1,r={},n=null){let o=KFe(e),i=(0,o6.useMemo)(()=>o.map((s,u)=>({key:`${s.basename}-${u}`,title:s.basename,subtitle:s.path,content:"",icon:o6.default.createElement(ju,{className:"tw-size-4"}),file:s})),[o]);return(0,o6.useMemo)(()=>{let s={...Rbi,...r},u=ee().customPromptsFolder;if(!t.trim()){let g=i.filter(w=>!w.file.path.startsWith(u+"/")),b=i.filter(w=>w.file.path.startsWith(u+"/"));if(n){let w={key:`active-note-${n.path}`,title:"Active Note",subtitle:n.path,content:"",category:"activeNote",icon:o6.default.createElement(C1,{className:"tw-size-4"}),file:n},T=[...g,...b].slice(0,s.limit-1);return[w,...T]}return[...g,...b].slice(0,s.limit)}let l=t.trim(),c=l.toLowerCase(),p="active note".includes(c)&&n?{key:`active-note-${n.path}`,title:"Active Note",subtitle:n.path,content:"",category:"activeNote",icon:o6.default.createElement(C1,{className:"tw-size-4"}),file:n}:null,m=p?s.limit-1:s.limit,y=stn.default.go(l,i,{keys:["subtitle"],limit:m,threshold:s.threshold}).map(g=>g.obj);return p?[p,...y]:y},[i,t,r,n])}async function Ibi(t,e=500){try{if(t.extension==="pdf"||t.extension==="canvas")return"";let n=(await app.vault.cachedRead(t)).replace(/^---\s*\n[\s\S]*?\n---\s*\n?/,"").trim();return n.length>e?n.slice(0,e)+"...":n}catch(r){return console.warn("Failed to read note content:",r),"Failed to load content"}}var Tke=class{constructor(){this.cache=new Map}async getOrLoadContent(e,r=500){let n=this.cache.get(e.path);if(n!==void 0)return n;let o=await Ibi(e,r);return this.cache.set(e.path,o),o}clear(){this.cache.clear()}remove(e){this.cache.delete(e)}has(e){return this.cache.has(e)}};function ltn({isCopilotPlus:t=!1,currentActiveFile:e=null}){let[r]=Di(),[n,o]=(0,iS.useState)(""),[i]=(0,iS.useState)(()=>new Tke),[a,s]=(0,iS.useState)(new Map),u=(0,iS.useCallback)(async m=>{try{let h=await i.getOrLoadContent(m,500);return s(y=>{let g=new Map(y);return g.set(m.path,h),g}),h}catch{let h="Failed to load content";return s(y=>{let g=new Map(y);return g.set(m.path,h),g}),h}},[i]),c=utn(n,t,{},e).map(m=>({...m,content:a.get(m.file.path)||""})),d=(0,iS.useCallback)(m=>{if(m.category==="activeNote")r.update(()=>{$Y("[[",{type:"active-note"})});else{let h={type:"notes",title:m.title,data:m.file};r.update(()=>{$Y("[[",h)})}},[r]),{state:f,handleHighlight:p}=ZU({triggerConfig:{char:"[[",multiChar:!0,allowWhitespace:!0},options:c,onSelect:d,onStateChange:m=>{o(m.query)},onHighlight:(m,h)=>{h&&!a.has(h.file.path)&&u(h.file)}});return(0,iS.useEffect)(()=>{c.length>0&&!a.has(c[0].file.path)&&u(c[0].file)},[c,a,u]),iS.default.createElement(iS.default.Fragment,null,f.isOpen&&iS.default.createElement(XU,{options:c,selectedIndex:f.selectedIndex,onSelect:d,onHighlight:p,range:f.range,query:f.query,showPreview:!0}))}var YU=$(K());var Oke=$(K()),dtn=$(ofe());LC();Qe();function ctn(t=!1){let e=I_(Rvt,{store:jo}),r=I_(Ivt,{store:jo});return t?e:r}var Abi={limit:10,threshold:-1e4,frontmatterOnly:!1};function ftn(t,e={}){let r=(0,Oke.useMemo)(()=>({...Abi,...e}),[e]),n=ctn(r.frontmatterOnly),o=(0,Oke.useMemo)(()=>n.map((a,s)=>{let u=a.startsWith("#")?a.slice(1):a;return{key:`tag-${u}-${s}`,title:a,subtitle:void 0,content:"",tag:u}}),[n]);return(0,Oke.useMemo)(()=>{if(!t.trim())return o.slice(0,r.limit);let a=t.trim();return dtn.default.go(a,o,{key:"title",limit:r.limit,threshold:r.threshold}).map(u=>u.obj)},[o,t,r])}function ptn({onTagSelected:t}){let[e]=Di(),[r,n]=(0,YU.useState)(""),o=ftn(r,{limit:10}),i=(0,YU.useCallback)(u=>{e.update(()=>{let l=Sn();if(!jr(l))return;let c=l.anchor,d=c.getNode();if(!(d instanceof yN))return;let f=d.getTextContent(),p=c.offset,m=f.lastIndexOf("#",p);if(m===-1)return;let h=f.slice(0,m),y=f.slice(p),g=`#${u.tag} `;d.setTextContent(h+g+y);let b=h.length+g.length;d.select(b,b)}),t?.()},[e,t]),{state:a,handleHighlight:s}=ZU({triggerConfig:{char:"#",multiChar:!1,allowWhitespace:!1},options:o,onSelect:i,onStateChange:u=>{n(u.query)}});return YU.default.createElement(YU.default.Fragment,null,a.isOpen&&YU.default.createElement(XU,{options:o,selectedIndex:a.selectedIndex,onSelect:i,onHighlight:s,range:a.range,query:a.query,showPreview:!1}))}var cg=$(K());var Cwt=require("obsidian");function Eke({isCopilotPlus:t=!1,currentActiveFile:e=null}){let[r]=Di(),[n,o]=(0,cg.useState)({mode:"category"}),[i,a]=(0,cg.useState)(""),s=HFe(t),u=(0,cg.useCallback)(async _=>{try{if(_.extension==="pdf"||_.extension==="canvas"){a("");return}let T=(await app.vault.cachedRead(_)).replace(/^---\s*\n[\s\S]*?\n---\s*\n?/,"").trim(),O=T.length>300?T.slice(0,300)+"...":T;a(O)}catch{a("Failed to load content")}},[]),[l,c]=(0,cg.useState)(""),d=ZFe(l,n.mode,n.selectedCategory,t,s,e),f=(0,cg.useCallback)(_=>"data"in _,[]),p=(0,cg.useCallback)(_=>"icon"in _&&!("data"in _),[]),m=(0,cg.useCallback)(_=>{if(n.mode==="category"&&p(_)&&!l){o(w=>({...w,mode:"search",selectedCategory:_.category}));return}if(f(_))if(_.category==="activeNote")r.update(()=>{$Y("@",{type:"active-note"})});else{let w={type:_.category,title:_.title,data:_.data};r.update(()=>{$Y("@",w)})}},[n.mode,l,p,f,r]),h=(0,cg.useCallback)(_=>{c(_.query),_.isOpen||o({mode:"category",selectedCategory:void 0})},[]),{state:y,handleHighlight:g}=ZU({triggerConfig:{char:"@",allowWhitespace:!0},options:d,onSelect:m,onStateChange:h});(0,cg.useEffect)(()=>{let _=d[y.selectedIndex];_&&f(_)&&_.category==="notes"&&_.data instanceof Cwt.TFile?u(_.data):a("")},[y.selectedIndex,d,f,u]);let b=(0,cg.useMemo)(()=>d.map((_,w)=>w===y.selectedIndex&&f(_)&&_.category==="notes"&&_.data instanceof Cwt.TFile?{..._,content:i}:_),[d,y.selectedIndex,i,f]);return cg.default.createElement(cg.default.Fragment,null,y.isOpen&&cg.default.createElement(XU,{options:b,selectedIndex:y.selectedIndex,onSelect:m,onHighlight:g,range:y.range,query:y.query,showPreview:d[y.selectedIndex]&&f(d[y.selectedIndex])&&d[y.selectedIndex].category==="notes",mode:n.mode}))}var mtn=$(K());function xwt(t){return t instanceof NFe?typeof t.isPill=="function"&&t.isPill()===!0:!1}function Pke(){let[t]=Di();return mtn.default.useEffect(()=>{let e=t.registerCommand(TY,r=>{let n=!1;return t.update(()=>{let o=Sn();if(!jr(o)||!o.isCollapsed()){n=!1;return}let i=o.anchor,a=i.getNode();if(xwt(a)){(r&&i.offset===1||!r&&i.offset===0)&&(a.remove(),n=!0);return}if(gi(a)&&r&&i.offset>0){let u=a.getChildren()[i.offset-1];if(xwt(u)){u.remove(),n=!0;return}}if(r&&i.offset===0){let s=a.getPreviousSibling();if(xwt(s)){s.remove(),n=!0;return}}n=!1}),n},IFe);return()=>{e()}},[t]),null}var LY=$(K());gr();function Mke({onSubmit:t,sendShortcut:e}){let[r]=Di(),n=(0,LY.useRef)(!1),o=(0,LY.useRef)(null);return(0,LY.useEffect)(()=>{let i=null,a=()=>{o.current&&(clearTimeout(o.current),o.current=null),n.current=!0},s=()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{n.current=!1,o.current=null},100)},u=d=>{d.addEventListener("compositionstart",a),d.addEventListener("compositionend",s)},l=d=>{d.removeEventListener("compositionstart",a),d.removeEventListener("compositionend",s)},c=r.registerRootListener((d,f)=>{f&&l(f),d&&u(d),i=d});return()=>{c(),i&&(l(i),i=null),o.current&&(clearTimeout(o.current),o.current=null)}},[r]),(0,LY.useEffect)(()=>r.registerCommand(EY,i=>i?n.current||i.isComposing||i.keyCode===229?(i.preventDefault(),!0):Nbi(i,e)?(i.preventDefault(),t(),!0):!1:!1,RYr),[r,t,e]),null}function Nbi(t,e){switch(e){case"enter":return!t.shiftKey&&!t.metaKey&&!t.ctrlKey&&!t.altKey;case"shift+enter":return t.shiftKey&&!t.metaKey&&!t.ctrlKey&&!t.altKey;default:return!1}}var htn=$(K());function Rke({value:t}){let[e]=Di();return htn.default.useEffect(()=>{e.update(()=>{let r=Ci();if(r.getTextContent()!==t){r.clear();let o=dL();t&&o.append(rS(t)),r.append(o)}})},[e,t]),null}var gtn=$(K());function Ike({onFocus:t,onEditorReady:e}){let[r]=Di();return gtn.default.useEffect(()=>{t(()=>{r.focus()}),e&&e(r)},[r,t,e]),null}var ytn=$(K());var Ake=$(K());function IT({config:t,onChange:e,onRemoved:r}){let[n]=Di(),o=Ake.default.useRef([]),{isPillNode:i,extractData:a,getKey:s=c=>String(c),getChangeKey:u}=t,l=Ake.default.useMemo(()=>u??s,[u,s]);return Ake.default.useEffect(()=>{if(!(!e&&!r))return n.registerUpdateListener(({editorState:c})=>{c.read(()=>{let d=[],f=Ci();function p(R){if(i(R)){let I=a(R);d.push(I)}if(typeof R.getChildren=="function"){let I=R.getChildren();for(let A of I)p(A)}}p(f);let m=new Set,y=d.filter(R=>{let I=s(R);return m.has(I)?!1:(m.add(I),!0)}).sort((R,I)=>s(R).localeCompare(s(I))),g=o.current,b=y.map(s),_=g.map(s),w=y.map(l),T=g.map(l),O=b.length!==_.length||b.some((R,I)=>R!==_[I]),E=w.length!==T.length||w.some((R,I)=>R!==T[I]);if(O||E){if(r){let R=new Set(b),I=g.filter(A=>!R.has(s(A)));I.length>0&&r(I)}o.current=y,e&&e(y)}})})},[n,e,r,i,a,s,l]),null}var Dbi={isPillNode:jvt,extractData:t=>({path:t.getNotePath(),basename:t.getNoteTitle()}),getKey:t=>t.path};function Nke({onNotesChange:t,onNotesRemoved:e}){return ytn.default.createElement(IT,{config:Dbi,onChange:t,onRemoved:e})}var btn=$(K());var jbi={isPillNode:RQr,extractData:t=>t.getURL()};function _tn({onURLsChange:t,onURLsRemoved:e}){return btn.default.createElement(IT,{config:jbi,onChange:t,onRemoved:e})}var vtn=$(K());var $bi={isPillNode:NQr,extractData:t=>t.getToolName()};function wtn({onToolsChange:t,onToolsRemoved:e}){return vtn.default.createElement(IT,{config:$bi,onChange:t,onRemoved:e})}var Stn=$(K());var Lbi={isPillNode:IQr,extractData:t=>t.getFolderPath()};function Dke({onFoldersChange:t,onFoldersRemoved:e}){return Stn.default.createElement(IT,{config:Lbi,onChange:t,onRemoved:e})}var Ctn=$(K());function jke({onActiveNoteAdded:t,onActiveNoteRemoved:e}){let[r]=Di();return(0,Ctn.useEffect)(()=>{let n=!1,o=r.registerUpdateListener(({editorState:i})=>{i.read(()=>{let a=Ci(),s=!1;function u(l){if($vt(l)){s=!0;return}if(typeof l.getChildren=="function"){let c=l.getChildren();for(let d of c){if(s)return;u(d)}}}u(a),s&&!n?(n=!0,t?.()):!s&&n&&(n=!1,e?.())})});return()=>{o()}},[r,t,e]),null}var QU=$(K());var Fbi={isPillNode:LQr,extractData:t=>({url:t.getURL(),title:t.getTitle(),faviconUrl:t.getFaviconUrl()}),getKey:t=>t.url,getChangeKey:t=>[t.url,t.title??"",t.faviconUrl??""].join(`
`)};function xtn({onWebTabsChange:t,onWebTabsRemoved:e,onActiveWebTabAdded:r,onActiveWebTabRemoved:n}){return QU.default.createElement(QU.default.Fragment,null,QU.default.createElement(IT,{config:Fbi,onChange:t,onRemoved:e}),(r||n)&&QU.default.createElement(kbi,{onActiveWebTabAdded:r,onActiveWebTabRemoved:n}))}function kbi({onActiveWebTabAdded:t,onActiveWebTabRemoved:e}){let r={isPillNode:Lvt,extractData:()=>!0,getKey:()=>"active-web-tab"},n=QU.default.useCallback(i=>{i.length>0&&t&&t()},[t]),o=QU.default.useCallback(i=>{i.length>0&&e&&e()},[e]);return QU.default.createElement(IT,{config:r,onChange:n,onRemoved:o})}var Ttn=$(K());function Otn({enableURLPills:t=!1,onImagePaste:e}){let[r]=Di();return Ttn.default.useEffect(()=>r.registerCommand(jFe,n=>{let o=n.clipboardData;if(!o)return!1;if(e){let p=o.items;if(p){let m=Array.from(p).filter(h=>h.type.indexOf("image")!==-1);if(m.length>0)return n.preventDefault(),Promise.all(m.map(h=>h.getAsFile())).then(h=>{let y=h.filter(g=>g!==null);y.length>0&&e(y)}),!0}}let i=o.getData("text/plain"),a=i.includes("[["),s=t&&i.includes("http"),u=i.includes("@"),l=i.includes("#"),c=i.includes("{")&&i.includes("}");if(!i||!a&&!s&&!u&&!l&&!c)return!1;let d=Cke(i,{includeNotes:!0,includeURLs:t,includeTools:!0,includeCustomTemplates:!0});return d.some(p=>p.type==="note-pill"||p.type==="active-note-pill"||t&&p.type==="url-pill"||p.type==="tool-pill"||p.type==="folder-pill")?(n.preventDefault(),r.update(()=>{let p=Sn();if(!jr(p))return;let m=xke(d);m.length>0&&p.insertNodes(m)}),!0):!1},pL),[r,t,e]),null}var Etn=$(K());function Ptn(){let[t]=Di();return Etn.default.useEffect(()=>t.registerCommand(Ske,e=>{let{text:r,options:n={}}=e;return t.update(()=>{otn(r,n)}),!0},nl),[t]),null}var Fv=$(K());var Mtn=(0,Fv.createContext)(void 0);function ez(){let t=(0,Fv.useContext)(Mtn);if(t===void 0)throw new Error("useChatInput must be used within a ChatInputProvider");return t}function Rtn({children:t}){let[e,r]=(0,Fv.useState)(null),[n,o]=(0,Fv.useState)(null),i=(0,Fv.useCallback)(c=>{r(c)},[]),a=(0,Fv.useCallback)(c=>{o(()=>c)},[]),s=(0,Fv.useCallback)((c,d=!1)=>{e&&e.dispatchCommand(Ske,{text:c,options:{enableURLPills:d,insertAtSelection:!0}})},[e]),u=(0,Fv.useCallback)(()=>{n&&n()},[n]),l={insertTextWithPills:s,focusInput:u,registerEditor:i,registerFocusHandler:a};return Fv.default.createElement(Mtn.Provider,{value:l},t)}zr();Xe();rd();Qe();var qbi=({value:t,onChange:e,onSubmit:r,placeholder:n="Type a message...",disabled:o=!1,className:i="",onNotesChange:a,onNotesRemoved:s,onURLsChange:u,onURLsRemoved:l,onToolsChange:c,onToolsRemoved:d,onFoldersChange:f,onFoldersRemoved:p,onActiveNoteAdded:m,onActiveNoteRemoved:h,onWebTabsChange:y,onWebTabsRemoved:g,onActiveWebTabAdded:b,onActiveWebTabRemoved:_,onEditorReady:w,onImagePaste:T,onTagSelected:O,isCopilotPlus:E=!1,currentActiveFile:P=null,currentChain:R})=>{let[I,A]=Qi.default.useState(null),[B,k]=Qi.default.useState(null),q=ez(),Z=kr(),V=Qi.default.useCallback(re=>{A(()=>re)},[]);(0,Qi.useEffect)(()=>{B&&q.registerEditor(B)},[B,q]),(0,Qi.useEffect)(()=>{I&&q.registerFocusHandler(I)},[I,q]);let Y=Qi.default.useMemo(()=>({namespace:"ChatEditor",theme:{root:"tw-outline-none",paragraph:"tw-m-0"},nodes:[WU,JU,t6,mL,hL,KU,...u?[e6]:[]],onError:re=>{ie("Lexical error:",re)},editable:!o}),[u,o]),X=(0,Qi.useCallback)(re=>{re.read(()=>{let le=Ci().getTextContent();e(le)})},[e]),W=(0,Qi.useCallback)(re=>{k(re),w?.(re)},[w]);return Qi.default.createElement(ike,{initialConfig:Y},Qi.default.createElement(YFe,{currentActiveFile:P},Qi.default.createElement("div",{className:Se("tw-relative",i)},Qi.default.createElement(pke,{contentEditable:Qi.default.createElement(mke,{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 tw-outline-none focus-visible:tw-ring-0","aria-label":"Chat input"}),placeholder:Qi.default.createElement("div",{className:"tw-pointer-events-none tw-absolute tw-left-2 tw-top-0 tw-select-none tw-text-sm tw-text-muted/60"},n),ErrorBoundary:wke}),Qi.default.createElement(vke,{onChange:X}),Qi.default.createElement(bke,null),Qi.default.createElement(Mke,{onSubmit:r,sendShortcut:Z.defaultSendShortcut}),Qi.default.createElement(Rke,{value:t}),Qi.default.createElement(Ike,{onFocus:V,onEditorReady:W}),Qi.default.createElement(Nke,{onNotesChange:a,onNotesRemoved:s}),u&&Qi.default.createElement(_tn,{onURLsChange:u,onURLsRemoved:l}),Qi.default.createElement(wtn,{onToolsChange:c,onToolsRemoved:d}),Qi.default.createElement(Dke,{onFoldersChange:f,onFoldersRemoved:p}),Qi.default.createElement(jke,{onActiveNoteAdded:m,onActiveNoteRemoved:h}),Qi.default.createElement(xtn,{onWebTabsChange:y,onWebTabsRemoved:g,onActiveWebTabAdded:b,onActiveWebTabRemoved:_}),Qi.default.createElement(Pke,null),Qi.default.createElement(Otn,{enableURLPills:!!u,onImagePaste:T}),Qi.default.createElement(atn,null),Qi.default.createElement(ltn,{isCopilotPlus:E,currentActiveFile:P}),R&&R!=="llm_chain"&&Qi.default.createElement(ptn,{onTagSelected:O}),Qi.default.createElement(Eke,{isCopilotPlus:E,currentActiveFile:P}),Qi.default.createElement(Ptn,null))))},Itn=qbi;var Atn=({inputMessage:t,setInputMessage:e,handleSendMessage:r,isGenerating:n,onStopGenerating:o,app:i,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,includeActiveWebTab:c,setIncludeActiveWebTab:d,activeWebTab:f,selectedImages:p,onAddImage:m,setSelectedImages:h,disableModelSwitch:y,selectedTextContexts:g,onRemoveSelectedText:b,showProgressCard:_,showIndexingCard:w,editMode:T=!1,onEditSave:O,onEditCancel:E,initialContext:P})=>{let[R,I]=(0,Wt.useState)(P?.urls||[]),[A,B]=(0,Wt.useState)(P?.folders||[]),[k,q]=(0,Wt.useState)([]),Z=(0,Wt.useRef)(null),V=(0,Wt.useRef)(null),[Y,X]=oF(),[W]=aw(),[re]=Gge(),ue=kr(),[le,L]=(0,Wt.useState)(()=>{let Ue=i.workspace.getActiveFile();return uO(Ue)?Ue:null}),[J,ne]=(0,Wt.useState)(null),[D,N]=(0,Wt.useState)([]),[z,H]=(0,Wt.useState)([]),[oe,Q]=(0,Wt.useState)([]),[de,fe]=(0,Wt.useState)([]),[De,st]=(0,Wt.useState)([]),Le=Rb(W),Bt=(0,Wt.useMemo)(()=>x3([...k,...De]),[k,De]),Pt=()=>{let Ue=V.current;return Ue?Ue.read(()=>Fvt().map(Mt=>({url:Mt.getURL(),title:Mt.getTitle(),faviconUrl:Mt.getFaviconUrl()}))):De},[Nt,$e]=(0,Wt.useState)(!1),[Fr,ft]=(0,Wt.useState)(!1),[Ve,Rt]=(0,Wt.useState)(!1),[ze,He]=(0,Wt.useState)(ue.enableAutonomousAgent),[We,Jt]=(0,Wt.useState)(0),so=["Loading the project context...","Processing context files...","If you have many files in context, this can take a while..."];(0,Wt.useEffect)(()=>{W==="project"?He(!1):He(ue.enableAutonomousAgent)},[ue.enableAutonomousAgent,W]),(0,Wt.useEffect)(()=>{if(W==="project"){ne(Gu());let Ue=XJ(Ee=>{ne(Ee)});return()=>{Ue()}}else ne(null)},[W]),(0,Wt.useEffect)(()=>{if(!re)return;let Ue=setInterval(()=>{Jt(Ee=>(Ee+1)%so.length)},3e3);return()=>clearInterval(Ue)},[re,so.length]);let au=()=>J&&W==="project"&&J.projectModelKey?J.projectModelKey:Y,An=()=>{if(T&&O){O(t,{notes:a,urls:R,folders:A});return}let Ue=Pt(),Ee=x3([...k,...Ue]);if(!Le){r({webTabs:Ee});return}let Mt=[];if(!ze){let Yt=t.toLowerCase();Nt&&!Yt.includes("@vault")&&Mt.push("@vault"),Fr&&!Yt.includes("@websearch")&&!Yt.includes("@web")&&Mt.push("@websearch"),Ve&&!Yt.includes("@composer")&&Mt.push("@composer")}r({toolCalls:Mt,contextNotes:a,urls:R,contextFolders:A,webTabs:Ee})},_i=Ue=>{let Ee=new Set(Ue.map(Mt=>Mt.path));s(Mt=>Mt.filter(Yt=>!Ee.has(Yt.path)))},Nl=Ue=>{let Ee=new Set(Ue);I(Mt=>Mt.filter(Yt=>!Ee.has(Yt)))},Vi=Ue=>{!Le||ze||Ue.forEach(Ee=>{switch(Ee){case"@vault":$e(!1);break;case"@websearch":case"@web":ft(!1);break;case"@composer":Rt(!1);break}})};(0,Wt.useEffect)(()=>{if(!Le||ze)return;let Ue=de.includes("@vault"),Ee=de.includes("@websearch")||de.includes("@web"),Mt=de.includes("@composer");$e(Ue),ft(Ee),Rt(Mt)},[de,Le,ze]);let g_=Ue=>{V.current&&V.current.update(()=>{TQr(Ue)}),N(Ee=>Ee.filter(Mt=>Mt.path!==Ue))},mg=Ue=>{V.current&&V.current.update(()=>{MQr(Ue)}),H(Ee=>Ee.filter(Mt=>Mt!==Ue))},cS=Ue=>{V.current&&V.current.update(()=>{AQr(Ue)}),Q(Ee=>Ee.filter(Mt=>Mt!==Ue))},ji=(Ue,Ee)=>{switch(Ue){case"activeNote":l(!0);break;case"notes":if(Ee instanceof gfe.TFile){let Mt=i.workspace.getActiveFile();Mt&&Ee.path===Mt.path?(l(!0),s(Yt=>Yt.filter(Ln=>Ln.path!==Ee.path))):s(Yt=>Yt.find(ul=>ul.path===Ee.path)?Yt:[...Yt,Ee])}break;case"tools":typeof Ee=="string"&&V.current&&V.current.update(()=>{let Mt=Sn();if(jr(Mt)){let Yt=r6(Ee);Mt.insertNodes([Yt])}});break;case"folders":if(Ee&&Ee.path){let Mt=Ee.path;B(Yt=>Yt.find(ul=>ul===Mt)?Yt:[...Yt,Mt])}break;case"webTabs":if(Ee&&typeof Ee.url=="string"){let Mt=rbt(Ee);if(!Mt)break;let Yt=ub(f?.url);if(Yt&&Mt.url===Yt){d(!0),q(Ln=>Ln.filter(ul=>ub(ul.url)!==Yt));break}q(Ln=>x3([...Ln,Mt]))}break;case"activeWebTab":d(!0);{let Mt=ub(f?.url);Mt&&q(Yt=>Yt.filter(Ln=>ub(Ln.url)!==Mt))}break}},LT=(Ue,Ee)=>{switch(Ue){case"activeNote":l(!1),V.current&&V.current.update(()=>{PQr()});break;case"notes":typeof Ee=="string"&&(le?.path===Ee&&u?l(!1):s(Mt=>Mt.filter(Yt=>Yt.path!==Ee)),g_(Ee));break;case"urls":typeof Ee=="string"&&(I(Mt=>Mt.filter(Yt=>Yt!==Ee)),mg(Ee));break;case"folders":typeof Ee=="string"&&(B(Mt=>Mt.filter(Yt=>Yt!==Ee)),cS(Ee));break;case"selectedText":typeof Ee=="string"&&b?.(Ee);break;case"activeWebTab":d(!1),V.current&&V.current.update(()=>{jQr()});break;case"webTabs":if(typeof Ee=="string"){let Mt=ub(Ee);if(!Mt)break;q(Yt=>Yt.filter(Ln=>ub(Ln.url)!==Mt)),st(Yt=>Yt.filter(Ln=>ub(Ln.url)!==Mt)),V.current&&V.current.update(()=>{FQr(Mt)})}break}},SC=Ue=>{let Ee=new Set(Ue);B(Mt=>Mt.filter(Yt=>!Ee.has(Yt)))};(0,Wt.useEffect)(()=>{s(Ue=>{let Ee=new Set(Ue.map(Ln=>Ln.path)),Mt=D.filter(Ln=>!Ee.has(Ln.path)),Yt=[];return Mt.forEach(Ln=>{let ul=i.vault.getAbstractFileByPath(Ln.path);ul instanceof gfe.TFile&&Yt.push(ul)}),[...Ue,...Yt]})},[D,i.vault,s]),(0,Wt.useEffect)(()=>{Rb(W)?I(Ue=>{let Ee=new Set(Ue),Mt=z.filter(Yt=>!Ee.has(Yt));return Mt.length>0?Array.from(new Set([...Ue,...Mt])):Ue}):I([])},[z,W]),(0,Wt.useEffect)(()=>{B(Ue=>{let Ee=new Set(Ue),Mt=oe.filter(Yt=>!Ee.has(Yt));return[...Ue,...Mt]})},[oe]),(0,Wt.useEffect)(()=>{let Ue,Ee=()=>{clearTimeout(Ue),Ue=setTimeout(()=>{let Yt=i.workspace.getActiveFile();L(uO(Yt)?Yt:null)},100)},Mt=i.workspace.on("active-leaf-change",Ee);return()=>{clearTimeout(Ue),i.workspace.offref(Mt)}},[i.workspace]);let dS=(0,Wt.useCallback)(Ue=>{V.current=Ue},[]);(0,Wt.useEffect)(()=>{if(!T||!E)return;let Ue=Ee=>{Ee.key==="Escape"&&(Ee.preventDefault(),E())};return document.addEventListener("keydown",Ue),()=>document.removeEventListener("keydown",Ue)},[T,E]);let Xs=(0,Wt.useCallback)(()=>{V.current&&Le&&V.current.update(()=>{ffe("@vault")})},[Le]),Dl=(0,Wt.useCallback)(()=>{V.current&&Le&&V.current.update(()=>{ffe("@websearch"),ffe("@web")})},[Le]),Iu=(0,Wt.useCallback)(()=>{V.current&&Le&&V.current.update(()=>{ffe("@composer")})},[Le]),wm=(0,Wt.useCallback)(()=>{l(!0)},[l]),_d=(0,Wt.useCallback)(()=>{l(!1)},[l]),sl=(0,Wt.useCallback)(()=>{d(!0)},[d]),nt=(0,Wt.useCallback)(()=>{d(!1)},[d]),Nr=(0,Wt.useCallback)(()=>{Le&&!ze&&!Nt&&($e(!0),new gfe.Notice("Vault search enabled for tag query"))},[Le,ze,Nt]);return Wt.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:Z},!T&&Wt.default.createElement(SQr,{contextNotes:a,includeActiveNote:u,activeNote:le,includeActiveWebTab:c,activeWebTab:f,contextUrls:R,contextFolders:A,contextWebTabs:Bt,selectedTextContexts:g,showProgressCard:_,showIndexingCard:w,lexicalEditorRef:V,onAddToContext:ji,onRemoveFromContext:LT}),p.length>0&&Wt.default.createElement("div",{className:"selected-images"},p.map((Ue,Ee)=>Wt.default.createElement("div",{key:Ee,className:"image-preview-container"},Wt.default.createElement("img",{src:URL.createObjectURL(Ue),alt:Ue.name,className:"selected-image-preview"}),Wt.default.createElement("button",{className:"remove-image-button",onClick:()=>h(Mt=>Mt.filter((Yt,Ln)=>Ln!==Ee)),title:"Remove image"},Wt.default.createElement(Ho,{className:"tw-size-4"}))))),Wt.default.createElement("div",{className:"tw-relative"},re&&Wt.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"},Wt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Wt.default.createElement(Us,{className:"tw-size-4 tw-animate-spin"}),Wt.default.createElement("span",{className:"tw-text-sm"},so[We]))),Wt.default.createElement(Itn,{value:t,onChange:Ue=>e(Ue),onSubmit:An,onNotesChange:N,onNotesRemoved:_i,onActiveNoteAdded:wm,onActiveNoteRemoved:_d,onURLsChange:Le?H:void 0,onURLsRemoved:Le?Nl:void 0,onToolsChange:Le?fe:void 0,onToolsRemoved:Le?Vi:void 0,onFoldersChange:Q,onFoldersRemoved:SC,onWebTabsChange:st,onActiveWebTabAdded:sl,onActiveWebTabRemoved:nt,onEditorReady:dS,onImagePaste:m,onTagSelected:Nr,placeholder:"Your AI assistant for Obsidian \u2022 @ to add context \u2022 / for custom prompts",disabled:re,isCopilotPlus:Le,currentActiveFile:le,currentChain:W})),Wt.default.createElement("div",{className:"tw-flex tw-h-6 tw-justify-between tw-gap-1 tw-px-1"},n?Wt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-px-1 tw-text-sm tw-text-muted"},Wt.default.createElement(Us,{className:"tw-size-3 tw-animate-spin"}),Wt.default.createElement("span",null,"Generating...")):Wt.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},Wt.default.createElement(vZ,{variant:"ghost2",size:"fit",disabled:y,value:au(),onChange:Ue=>{W!=="project"&&X(Ue)},className:"tw-max-w-full tw-truncate"})),Wt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},n?Wt.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>o()},Wt.default.createElement(RF,{className:"tw-size-4"}),"Stop"):Wt.default.createElement(Wt.default.Fragment,null,Wt.default.createElement(D7r,{vaultToggle:Nt,setVaultToggle:$e,webToggle:Fr,setWebToggle:ft,composerToggle:Ve,setComposerToggle:Rt,autonomousAgentToggle:ze,setAutonomousAgentToggle:He,currentChain:W,onVaultToggleOff:Xs,onWebToggleOff:Dl,onComposerToggleOff:Iu}),Wt.default.createElement(s_,{delayDuration:0},Wt.default.createElement(vn,null,Wt.default.createElement(wn,{asChild:!0},Wt.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted hover:tw-text-accent",onClick:()=>{new kLe(i,m).open()}},Wt.default.createElement(Dre,{className:"tw-size-4"}))),Wt.default.createElement(pn,{className:"tw-px-1 tw-py-0.5"},"Add image(s)"))),T&&E&&Wt.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:E},Wt.default.createElement("span",null,"cancel")),Wt.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>An()},Wt.default.createElement(xre,{className:"!tw-size-3"}),Wt.default.createElement("span",null,T?"save":"chat"))))))};Atn.displayName="ChatInput";var $ke=Atn;xn();gr();zr();Mr();var Ntn=require("obsidian"),ro=$(K()),Dtn=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>ro.default.createElement("div",{className:Se("tw-flex tw-gap-1",{"group-hover:opacity-100 opacity-0":!Ntn.Platform.isMobile})},t.sender===Zs?ro.default.createElement(ro.default.Fragment,null,ro.default.createElement(vn,null,ro.default.createElement(wn,{asChild:!0},ro.default.createElement(me,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?ro.default.createElement(Yu,{className:"tw-size-4"}):ro.default.createElement(U_,{className:"tw-size-4"}))),ro.default.createElement(pn,null,"Copy")),ro.default.createElement(vn,null,ro.default.createElement(wn,{asChild:!0},ro.default.createElement(me,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},ro.default.createElement(z_,{className:"tw-size-4"}))),ro.default.createElement(pn,null,"Edit")),ro.default.createElement(vn,null,ro.default.createElement(wn,{asChild:!0},ro.default.createElement(me,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},ro.default.createElement(Iy,{className:"tw-size-4"}))),ro.default.createElement(pn,null,"Delete"))):ro.default.createElement(ro.default.Fragment,null,u&&ro.default.createElement(vn,null,ro.default.createElement(wn,{asChild:!0},ro.default.createElement(me,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},ro.default.createElement(k4,{className:"tw-size-4"}))),ro.default.createElement(pn,null,"Show Sources")),ro.default.createElement(vn,null,ro.default.createElement(wn,{asChild:!0},ro.default.createElement(me,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},ro.default.createElement(Vre,{className:"tw-size-4"}))),ro.default.createElement(pn,null,"Insert / Replace at cursor")),ro.default.createElement(vn,null,ro.default.createElement(wn,{asChild:!0},ro.default.createElement(me,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?ro.default.createElement(Yu,{className:"tw-size-4"}):ro.default.createElement(U_,{className:"tw-size-4"}))),ro.default.createElement(pn,null,"Copy")),ro.default.createElement(vn,null,ro.default.createElement(wn,{asChild:!0},ro.default.createElement(me,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},ro.default.createElement(Ure,{className:"tw-size-4"}))),ro.default.createElement(pn,null,"Regenerate")),ro.default.createElement(vn,null,ro.default.createElement(wn,{asChild:!0},ro.default.createElement(me,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},ro.default.createElement(Iy,{className:"tw-size-4"}))),ro.default.createElement(pn,null,"Delete"))));var Fke=require("obsidian"),Lke=class extends Fke.Modal{constructor(e,r){super(e),this.sources=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Sources"}),this.createSourceList(e,this.sources)}createSourceList(e,r){let n=e.createEl("ul");n.style.listStyleType="none",n.style.padding="0",r.forEach(o=>{let i=n.createEl("li");i.style.marginBottom="1em";let a=i.createDiv();a.style.cursor="pointer";let s=a.createSpan();s.style.marginRight="0.5em",s.style.display="inline-block",s.style.width="1em",s.style.transition="transform 0.2s",s.textContent=o.explanation?"\u25B6":"";let u=o.path&&o.path!==o.title?`${o.title} (${o.path})`:o.title,l=a.createEl("a",{href:`obsidian://open?vault=${encodeURIComponent(this.app.vault.getName())}&file=${encodeURIComponent(o.path||o.title)}`,text:u});l.title=`${u} - drag to insert wikilink`,l.draggable=!0,l.addEventListener("dragstart",d=>{let f=o.path||o.title,p=this.app.vault.getAbstractFileByPath(f);if(p instanceof Fke.TFile){let m=this.app.dragManager;if(!m)return;let h=this.app.metadataCache.fileToLinktext(p,""),y=m.dragLink(d,h);m.onDragStart(d,y)}}),l.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),this.app.workspace.openLinkText(o.path||o.title,"")}),typeof o.score=="number"&&a.appendChild(document.createTextNode(` - Relevance score: ${o.score.toFixed(4)}`));let c=null;o.explanation&&(c=this.addExplanation(i,o.explanation),c.style.display="none",a.addEventListener("click",d=>{if(d.target!==l&&c){let f=c.style.display!=="none";c.style.display=f?"none":"block",s.style.transform=f?"":"rotate(90deg)"}}))})}addExplanation(e,r){let n=e.createDiv({cls:"search-explanation"});n.style.marginTop="0.5em",n.style.marginLeft="2.5em",n.style.fontSize="0.9em",n.style.color="var(--text-muted)",n.style.borderLeft="2px solid var(--background-modifier-border)",n.style.paddingLeft="0.5em";let o=[];if(r.lexicalMatches&&r.lexicalMatches.length>0){let i=new Set(r.lexicalMatches.map(s=>s.field)),a=new Set(r.lexicalMatches.map(s=>s.query));o.push(`Lexical: matched "${Array.from(a).join('", "')}" in ${Array.from(i).join(", ")}`)}if(r.semanticScore!==void 0&&r.semanticScore>0&&o.push(`Semantic: ${(r.semanticScore*100).toFixed(1)}% similarity`),r.folderBoost&&o.push(`Folder boost: ${r.folderBoost.boostFactor.toFixed(2)}x (${r.folderBoost.documentCount} docs in ${r.folderBoost.folder||"root"})`),r.graphConnections){let i=r.graphConnections,a=[];i.backlinks>0&&a.push(`${i.backlinks} backlinks`),i.coCitations>0&&a.push(`${i.coCitations} co-citations`),i.sharedTags>0&&a.push(`${i.sharedTags} shared tags`),a.length>0&&o.push(`Graph connections: ${i.score.toFixed(1)} score (${a.join(", ")})`)}return r.graphBoost&&!r.graphConnections&&o.push(`Graph boost: ${r.graphBoost.boostFactor.toFixed(2)}x (${r.graphBoost.connections} connections)`),r.baseScore!==r.finalScore&&o.push(`Score: ${r.baseScore.toFixed(4)} \u2192 ${r.finalScore.toFixed(4)}`),o.length>0&&o.forEach(i=>{let a=n.createEl("div");a.style.marginBottom="0.25em",a.textContent=`\u2022 ${i}`}),n}onClose(){let{contentEl:e}=this;e.empty()}};var pb=$(K());var jtn=({initialValue:t,initialContext:e,onSave:r,onCancel:n,app:o})=>{let[i,a]=(0,pb.useState)(t),[s,u]=(0,pb.useState)(e?.notes?.map(P=>P)||[]),[l,c]=(0,pb.useState)(!1),[d,f]=(0,pb.useState)(!1),[p,m]=(0,pb.useState)([]),{activeWebTabForMentions:h}=VU(),y=(0,pb.useCallback)((P,R)=>{let I={notes:R.notes,urls:R.urls,tags:R.tags,folders:R.folders,selectedTextContexts:e?.selectedTextContexts||[]};r(P,I)},[r,e?.selectedTextContexts]),g=(0,pb.useCallback)(()=>{n()},[n]),b=(0,pb.useCallback)(()=>{},[]),_=(0,pb.useCallback)(()=>{},[]),w=(0,pb.useCallback)(P=>{m(R=>[...R,...P])},[]),T=(0,pb.useCallback)(P=>{},[]),O=(0,pb.useCallback)(()=>{},[]),E={notes:s,urls:e?.urls||[],tags:e?.tags||[],folders:e?.folders||[]};return pb.default.createElement($ke,{inputMessage:i,setInputMessage:a,handleSendMessage:b,isGenerating:!1,onStopGenerating:_,app:o,contextNotes:s,setContextNotes:u,includeActiveNote:l,setIncludeActiveNote:c,includeActiveWebTab:d,setIncludeActiveWebTab:f,activeWebTab:h,selectedImages:p,onAddImage:w,setSelectedImages:m,disableModelSwitch:!1,selectedTextContexts:e?.selectedTextContexts,onRemoveSelectedText:T,showProgressCard:O,editMode:!0,onEditSave:y,onEditCancel:g,initialContext:E})};na();xn();Qe();xn();var aS=$(K());zr();Mr();BC();Xe();Dt();function xN({value:t,onChange:e,placeholder:r,disabled:n,className:o}){let[i,a]=(0,aS.useState)(!1),s=(0,aS.useRef)(null),u=(0,aS.useRef)(!0);return(0,aS.useEffect)(()=>{(async()=>{if(u.current&&t&&s.current){try{s.current.value=await kn(t)}catch(c){ie("Failed to decrypt value:"+Wr(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),aS.default.createElement("div",{className:Se("tw-relative",o)},aS.default.createElement(ni,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:Se("tw-w-full !tw-pr-7")}),aS.default.createElement("div",{onClick:()=>!n&&a(!i),className:Se("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?aS.default.createElement(Ere,{className:Se("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")}):aS.default.createElement(S1,{className:Se("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")})))}gr();Qe();Dt();g4();var kke=require("obsidian"),pr=$(K()),$tn=$(Im());var Bbi=({model:t,onUpdate:e,isEmbeddingModel:r,onCancel:n})=>{let[o,i]=(0,pr.useState)(t),[a,s]=(0,pr.useState)(t),[u,l]=(0,pr.useState)({}),c=ee(),d=o.provider==="amazon-bedrock";(0,pr.useEffect)(()=>{i(t),s(t),t.provider&&l(o1(t.provider))},[t]);let f=(0,pr.useMemo)(()=>Ige((_,w)=>{e(r,_,w)},500),[r,e]),p=(0,pr.useCallback)((_,w)=>{i(T=>{let O={...T,[_]:w};return f(a,O),O})},[a,f]),m=(0,pr.useCallback)(_=>{i(w=>{let T={...w};return delete T[_],f(a,T),T})},[f,a]);if(!o)return null;let h=()=>{if(!o||!o.provider||o.provider!=="azure-openai")return u.host||"https://api.example.com/v1";let _=o.azureOpenAIApiInstanceName||"[instance]",w=o.isEmbeddingModel?o.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":o.azureOpenAIApiDeploymentName||"[deployment]",T=o.azureOpenAIApiVersion||"[api-version]",O=o.isEmbeddingModel?"embeddings":"chat/completions";return`https://${_}.openai.azure.com/openai/deployments/${w}/${O}?api-version=${T}`},y=Object.entries(rF).map(([_,w])=>({id:_,label:_.charAt(0).toUpperCase()+_.slice(1),description:w})),g=nw(o.provider,o),b=!r&&o.provider!=="copilot-plus-jina";return pr.default.createElement("div",{className:"tw-space-y-3 tw-p-4"},pr.default.createElement("div",{className:"tw-space-y-3"},pr.default.createElement(ko,{label:"Model Name",required:!0},pr.default.createElement(ni,{type:"text",disabled:o.core,value:o.name,onChange:_=>p("name",_.target.value),placeholder:"Enter model name"})),pr.default.createElement(ko,{label:pr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},pr.default.createElement("span",{className:"tw-leading-none"},"Display Name"),pr.default.createElement(to,{content:pr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},pr.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),pr.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),pr.default.createElement("div",{className:"tw-text-[12px]"},"Example:",pr.default.createElement("li",null,"Direct-Paid:Ds-r1"),pr.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),pr.default.createElement("li",null,"Perplexity-Paid:lg"))),contentClassName:"tw-max-w-96"}))},pr.default.createElement(ni,{type:"text",placeholder:"Custom display name (optional)",value:o.displayName||"",onChange:_=>p("displayName",_.target.value)})),pr.default.createElement(ko,{label:"Provider"},pr.default.createElement(ni,{type:"text",value:wg(o.provider),disabled:!0})),pr.default.createElement(ko,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},pr.default.createElement(ni,{type:"text",placeholder:h(),value:o.baseUrl||"",onChange:_=>p("baseUrl",_.target.value)})),d&&pr.default.createElement(ko,{label:"Region (optional)",description:"Defaults to us-east-1 when left blank. With inference profiles (global., us., eu., apac.), region is auto-managed."},pr.default.createElement(ni,{type:"text",placeholder:"Enter AWS region (e.g. us-east-1)",value:o.bedrockRegion||"",onChange:_=>p("bedrockRegion",_.target.value)})),pr.default.createElement(ko,{label:"API Key"},pr.default.createElement(xN,{placeholder:`Enter ${u.label||"Provider"} API Key`,value:g,onChange:_=>p("apiKey",_)}),u.keyManagementURL&&pr.default.createElement("p",{className:"tw-text-xs tw-text-muted"},pr.default.createElement("a",{href:u.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",u.label," API Key"))),o.provider==="openrouterai"&&pr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},pr.default.createElement(Uu,{id:"enable-prompt-caching",checked:o.enablePromptCaching!==!1,onCheckedChange:_=>p("enablePromptCaching",_)}),pr.default.createElement(uc,{htmlFor:"enable-prompt-caching",className:"tw-cursor-pointer tw-text-sm"},"Prompt Caching"),pr.default.createElement(to,{content:pr.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Disable if your OpenRouter endpoint uses Zero Data Retention (ZDR), which does not support prompt caching.")})),b&&pr.default.createElement(pr.default.Fragment,null,pr.default.createElement(ko,{label:pr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},pr.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),pr.default.createElement(to,{content:pr.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality"),contentClassName:"tw-max-w-96"}))},pr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},y.map(({id:_,label:w,description:T})=>pr.default.createElement("div",{key:_,className:"tw-flex tw-items-center tw-gap-2"},pr.default.createElement(Uu,{id:_,checked:o.capabilities?.includes(_),onCheckedChange:O=>{let E=o.capabilities||[],P=O?[...E,_]:E.filter(R=>R!==_);p("capabilities",P)}}),pr.default.createElement(to,{content:T},pr.default.createElement(uc,{htmlFor:_,className:"tw-text-sm"},w)))))),(o.provider==="3rd party (openai-format)"||o.provider==="lm-studio")&&pr.default.createElement(ko,{label:"Stream Options"},pr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},pr.default.createElement(Uu,{id:"stream-usage",checked:o.streamUsage||!1,onCheckedChange:_=>p("streamUsage",_)}),pr.default.createElement(to,{content:pr.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Enable if your provider supports stream_options for token usage tracking. Disable for providers that do not support it (e.g., Databricks, MLFlow).")},pr.default.createElement(uc,{htmlFor:"stream-usage",className:"tw-cursor-pointer tw-text-sm"},"Stream Usage")))),o.provider==="lm-studio"&&pr.default.createElement(ko,{label:"Responses API"},pr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},pr.default.createElement(Uu,{id:"use-responses-api",checked:o.useResponsesApi!==!1,onCheckedChange:_=>p("useResponsesApi",_)}),pr.default.createElement(to,{content:pr.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Use /v1/responses instead of /v1/chat/completions. Patches compatibility issues with LM Studio (text.format, tool definitions). Requires LM Studio 0.3.6+.")},pr.default.createElement(uc,{htmlFor:"use-responses-api",className:"tw-cursor-pointer tw-text-sm"},"Use Responses API (faster inference)")))),pr.default.createElement(LLe,{model:o,settings:c,onChange:p,onReset:m,showTokenLimit:!0}))),pr.default.createElement("div",{className:"tw-mt-6 tw-flex tw-justify-end tw-gap-2 tw-border-t tw-border-border tw-pt-4"},pr.default.createElement(me,{variant:"secondary",onClick:n},"Close")))},FY=class extends kke.Modal{constructor(r,n,o,i){super(r);this.model=n;this.isEmbeddingModel=o;this.onUpdate=i;this.setTitle(`Model Settings - ${this.model.name}`)}onOpen(){let{contentEl:r,modalEl:n}=this;kke.Platform.isMobile&&(n.style.height="80%"),this.root=(0,$tn.createRoot)(r);let o=(a,s,u)=>{this.onUpdate(a,s,u)},i=()=>{this.close()};this.root.render(pr.default.createElement(Bbi,{model:this.model,isEmbeddingModel:this.isEmbeddingModel,onUpdate:o,onCancel:i}))}onClose(){this.root.unmount()}};Mr();var Ltn=require("obsidian"),bL=$(K()),Ftn=({message:t,app:e})=>{let r=()=>{let n=ee(),o=j_(),i=n.activeModels.find(u=>no(u)===o);if(!i){new Ltn.Notice("Could not find the current model settings");return}let a=(u,l,c)=>{let d=n.activeModels.map(f=>f===l?c:f);Re("activeModels",d)};new FY(e,i,!1,a).open()};return bL.default.createElement("div",{className:"tw-mt-3 tw-rounded-md tw-border tw-border-border tw-bg-callout-warning/20 tw-p-4"},bL.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-3"},bL.default.createElement(Eg,{className:"tw-size-5 tw-shrink-0 tw-text-warning"}),bL.default.createElement("div",{className:"tw-flex-1"},bL.default.createElement("div",{className:"tw-mb-2 tw-font-semibold tw-text-warning"},"Response Truncated"),bL.default.createElement("div",{className:"tw-mb-3 tw-text-normal"},"The AI response was cut off because it reached the token limit. You can increase the 'Token Limit' in model settings for longer responses."),t.responseMetadata?.tokenUsage&&bL.default.createElement("div",{className:"tw-mb-3 tw-text-sm tw-text-muted"},"Output tokens used: ",t.responseMetadata.tokenUsage.outputTokens||"N/A"),bL.default.createElement(me,{variant:"secondary",size:"sm",onClick:r,className:"tw-text-warning hover:tw-bg-callout-warning/10"},"Open Model Settings"))))};var $wt=$(K()),Lwt=$(Im());var qke=$(K()),ktn=({errorContent:t})=>qke.default.createElement("div",{className:"tw-my-2 tw-mb-6 tw-max-h-[180px] tw-overflow-y-scroll tw-rounded-xl tw-bg-modifier-error-rgb/5 tw-p-3"},qke.default.createElement("div",{className:"tw-mb-2 tw-text-sm tw-font-semibold tw-text-error"},"\u26A0\uFE0F Error occurred"),qke.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-xs tw-text-error"},t.trim()));var sy=$(K(),1);function qtn(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var _L=$(K(),1),Btn=$(wt(),1);function Utn(t,e=[]){let r=[];function n(i,a){let s=_L.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=_L.useMemo(()=>m,Object.values(m));return(0,Btn.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=_L.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=>_L.createContext(a));return function(s){let u=s?.[t]||i;return _L.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Ubi(o,...e)]}function Ubi(...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 _L.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var tz=$(K(),1);var kY=$(K(),1);function Twt(t){let e=kY.useRef(t);return kY.useEffect(()=>{e.current=t}),kY.useMemo(()=>(...r)=>e.current?.(...r),[])}function ztn({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=zbi({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=Twt(r),u=tz.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 zbi({defaultProp:t,onChange:e}){let r=tz.useState(t),[n]=r,o=tz.useRef(n),i=Twt(e);return tz.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var Vtn=$(K(),1),i6=globalThis?.document?Vtn.useLayoutEffect:()=>{};var Wtn=$(K(),1);function Htn(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Owt(...t){return e=>{let r=!1,n=t.map(o=>{let i=Htn(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():Htn(t[o],null)}}}}function Jtn(...t){return Wtn.useCallback(Owt(...t),t)}var Ktn=$(K(),1),Kbi=$(yu(),1);var ay=$(K(),1);var qY=$(wt(),1),Pwt=ay.forwardRef((t,e)=>{let{children:r,...n}=t,o=ay.Children.toArray(r),i=o.find(Hbi);if(i){let a=i.props.children,s=o.map(u=>u===i?ay.Children.count(a)>1?ay.Children.only(null):ay.isValidElement(a)?a.props.children:null:u);return(0,qY.jsx)(Ewt,{...n,ref:e,children:ay.isValidElement(a)?ay.cloneElement(a,void 0,s):null})}return(0,qY.jsx)(Ewt,{...n,ref:e,children:r})});Pwt.displayName="Slot";var Ewt=ay.forwardRef((t,e)=>{let{children:r,...n}=t;if(ay.isValidElement(r)){let o=Jbi(r);return ay.cloneElement(r,{...Wbi(n,r.props),ref:e?Owt(e,o):o})}return ay.Children.count(r)>1?ay.Children.only(null):null});Ewt.displayName="SlotClone";var Vbi=({children:t})=>(0,qY.jsx)(qY.Fragment,{children:t});function Hbi(t){return ay.isValidElement(t)&&t.type===Vbi}function Wbi(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 Jbi(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 Gtn=$(wt(),1),Gbi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Bke=Gbi.reduce((t,e)=>{let r=Ktn.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Pwt:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Gtn.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var kv=$(K(),1);var Ztn=$(K(),1);function Xtn(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Xbi(...t){return e=>{let r=!1,n=t.map(o=>{let i=Xtn(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():Xtn(t[o],null)}}}}function Ytn(...t){return Ztn.useCallback(Xbi(...t),t)}var Qtn=$(K(),1);function Zbi(t,e){return Qtn.useReducer((r,n)=>e[r][n]??r,t)}var Mwt=t=>{let{present:e,children:r}=t,n=Ybi(e),o=typeof r=="function"?r({present:n.isPresent}):kv.Children.only(r),i=Ytn(n.ref,Qbi(o));return typeof r=="function"||n.isPresent?kv.cloneElement(o,{ref:i}):null};Mwt.displayName="Presence";function Ybi(t){let[e,r]=kv.useState(),n=kv.useRef({}),o=kv.useRef(t),i=kv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=Zbi(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return kv.useEffect(()=>{let l=Uke(n.current);i.current=s==="mounted"?l:"none"},[s]),i6(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Uke(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),i6(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Uke(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=Uke(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:kv.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function Uke(t){return t?.animationName||"none"}function Qbi(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 zke=$(K(),1);var e_i=zke.useId||(()=>{}),t_i=0;function ern(t){let[e,r]=zke.useState(e_i());return i6(()=>{t||r(n=>n??String(t_i++))},[t]),t||(e?`radix-${e}`:"")}var a6=$(wt(),1),Rwt="Collapsible",[r_i,cKs]=Utn(Rwt),[n_i,Iwt]=r_i(Rwt),trn=sy.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=ztn({prop:n,defaultProp:o,onChange:a});return(0,a6.jsx)(n_i,{scope:r,disabled:i,contentId:ern(),open:u,onOpenToggle:sy.useCallback(()=>l(c=>!c),[l]),children:(0,a6.jsx)(Bke.div,{"data-state":jwt(u),"data-disabled":i?"":void 0,...s,ref:e})})});trn.displayName=Rwt;var rrn="CollapsibleTrigger",Awt=sy.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=Iwt(rrn,r);return(0,a6.jsx)(Bke.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":jwt(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:qtn(t.onClick,o.onOpenToggle)})});Awt.displayName=rrn;var Nwt="CollapsibleContent",Dwt=sy.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=Iwt(Nwt,t.__scopeCollapsible);return(0,a6.jsx)(Mwt,{present:r||o.open,children:({present:i})=>(0,a6.jsx)(o_i,{...n,ref:e,present:i})})});Dwt.displayName=Nwt;var o_i=sy.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=Iwt(Nwt,r),[s,u]=sy.useState(n),l=sy.useRef(null),c=Jtn(e,l),d=sy.useRef(0),f=d.current,p=sy.useRef(0),m=p.current,h=a.open||s,y=sy.useRef(h),g=sy.useRef(void 0);return sy.useEffect(()=>{let b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),i6(()=>{let b=l.current;if(b){g.current=g.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";let _=b.getBoundingClientRect();d.current=_.height,p.current=_.width,y.current||(b.style.transitionDuration=g.current.transitionDuration,b.style.animationName=g.current.animationName),u(n)}},[a.open,n]),(0,a6.jsx)(Bke.div,{"data-state":jwt(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 jwt(t){return t?"open":"closed"}var nrn=trn;var uy=nrn,AT=Awt,ly=Dwt;zr();Mr();var ol=$(K()),a_i="shimmer 2s ease-in-out infinite",yfe=5e3,s_i=(t,e)=>{if(!e)return null;if(e.length>yfe)return`Tool '${t}' returned ${e.length.toLocaleString()} characters. The full output is preserved in chat history but omitted here to keep the UI responsive.`;try{let r=S$.format(t,e);return r.length>yfe?r.slice(0,yfe)+`

\u2026 (truncated ${(r.length-yfe).toLocaleString()} characters for display)`:r}catch{return e.length>yfe?`Tool '${t}' returned ${e.length.toLocaleString()} characters. The full output is preserved in chat history but omitted here to keep the UI responsive.`:e}},orn=({toolName:t,displayName:e,emoji:r,isExecuting:n,result:o,confirmationMessage:i,onAccept:a,onReject:s})=>{let[u,l]=(0,ol.useState)(!1),c=(0,ol.useMemo)(()=>s_i(t,o),[t,o]),d=n&&!o,f=!d&&c!==null;return ol.default.createElement(uy,{open:f?u:!1,onOpenChange:l,disabled:!f,"aria-disabled":!f,className:"tw-my-3 tw-w-full sm:tw-max-w-sm"},ol.default.createElement("div",{className:Se("tw-rounded-md tw-border tw-border-border tw-bg-secondary/50",d&&"tw-relative tw-overflow-hidden")},d&&ol.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-z-[1] tw-overflow-hidden"},ol.default.createElement("div",{className:"tw-absolute tw-inset-0 -tw-translate-x-full",style:{background:"linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%)",animation:a_i}})),ol.default.createElement(AT,{className:Se("tw-flex tw-w-full tw-items-center tw-justify-between tw-px-3 tw-py-2.5 tw-text-sm sm:tw-px-4 sm:tw-py-3",f&&"hover:tw-bg-secondary/70",!f&&"tw-cursor-default")},ol.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ol.default.createElement("span",{className:"tw-text-base"},r),ol.default.createElement("span",{className:"tw-font-medium"},t==="readNote"?`${d?"Reading":"Read"} ${e}`:`${d?"Calling":"Called"} ${e}`,d&&t!=="readNote"&&"..."),d&&i&&ol.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"\u2022 ",i,"...")),ol.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},!d&&a&&s&&ol.default.createElement(ol.default.Fragment,null,ol.default.createElement("button",{onClick:p=>{p.stopPropagation(),a()},className:"hover:tw-bg-green-rgb/20 tw-rounded tw-p-1",title:"Accept"},ol.default.createElement(Yu,{className:"tw-size-4 tw-text-success"})),ol.default.createElement("button",{onClick:p=>{p.stopPropagation(),s()},className:"hover:tw-bg-red-rgb/20 tw-rounded tw-p-1",title:"Reject"},ol.default.createElement(Ho,{className:"tw-size-4 tw-text-error"}))),f&&ol.default.createElement(od,{className:Se("tw-size-4 tw-text-muted tw-transition-transform",u&&"tw-rotate-90")}))),ol.default.createElement(ly,null,ol.default.createElement("div",{className:"tw-border-t tw-border-border tw-px-3 tw-py-2.5 sm:tw-px-4 sm:tw-py-3"},ol.default.createElement("div",{className:"tw-text-sm tw-text-muted"},ol.default.createElement("pre",{className:"tw-overflow-x-auto tw-whitespace-pre-wrap tw-font-mono tw-text-xs"},c??"No result available"))))))};Xe();var irn=60*60*1e3,BY=()=>(window.__copilotToolCallRoots||(window.__copilotToolCallRoots=new Map),window.__copilotToolCallRoots),UY=()=>(window.__copilotErrorBlocks||(window.__copilotErrorBlocks=new Map),window.__copilotErrorBlocks),Fwt=(t,e,r)=>{if(e.size>0)return;r.get(t)===e&&r.delete(t)},kwt=(t,e,r,n,o,i)=>{try{n.root.unmount()}catch(a){Ce(`Error unmounting tool call root during ${o}`,r,a)}n.isUnmounting=!1,e.get(r)===n&&e.delete(r),Fwt(t,e,i)},arn=(t,e,r,n,o,i)=>{e.delete(r),n.isUnmounting=!0,setTimeout(()=>{try{n.root.unmount()}catch(a){Ce(`Error unmounting tool call root during ${o}`,r,a)}n.isUnmounting=!1,Fwt(t,e,i)},0)},rz=(t,e,r,n,o,i)=>{n.isUnmounting||(n.isUnmounting=!0,setTimeout(()=>{let a=i.get(t),s=a?.get(r);if(!a||s!==n){n.isUnmounting=!1,Fwt(t,e,i);return}kwt(t,a,r,s,o,i)},0))},srn=(t,e,r,n,o)=>{let i=e.get(r);return i?.isUnmounting&&(kwt(t,e,r,i,`${o} (finalizing stale root)`,BY()),i=void 0),i&&i.container&&i.container!==n&&(arn(t,e,r,i,`${o} (container changed)`,BY()),i=void 0),i||(i={root:(0,Lwt.createRoot)(n),isUnmounting:!1,container:n},e.set(r,i)),i},urn=(t,e,r,n,o)=>{let i=e.get(r);return i?.isUnmounting&&(kwt(t,e,r,i,`${o} (finalizing stale error root)`,UY()),i=void 0),i&&i.container&&i.container!==n&&(arn(t,e,r,i,`${o} (container changed)`,UY()),i=void 0),i||(i={root:(0,Lwt.createRoot)(n),isUnmounting:!1,container:n},e.set(r,i)),i},lrn=(t,e)=>{t.root.render($wt.default.createElement(orn,{toolName:e.toolName,displayName:e.displayName,emoji:e.emoji,isExecuting:e.isExecuting,result:e.result||null,confirmationMessage:e.confirmationMessage}))},crn=(t,e)=>{t.root.render($wt.default.createElement(ktn,{errorContent:e.errorContent}))},drn=(t,e,r,n)=>{let o=e.get(r);o&&rz(t,e,r,o,n,BY())},frn=(t,e,r,n)=>{let o=e.get(r);o&&rz(t,e,r,o,n,UY())},prn=t=>{let e=BY(),r=e.get(t);return r||(r=new Map,e.set(t,r)),r},mrn=t=>{let e=UY(),r=e.get(t);return r||(r=new Map,e.set(t,r)),r},hrn=(t=Date.now())=>{let e=BY();e.forEach((r,n)=>{r.forEach((o,i)=>{if(o.container){if(o.container.isConnected)return;rz(n,r,i,o,"stale cleanup (detached container)",e);return}let a=Number.parseInt(n,10);Number.isNaN(a)||t-a<irn||rz(n,r,i,o,"stale cleanup (legacy record)",e)})})},grn=(t=Date.now())=>{let e=UY();e.forEach((r,n)=>{r.forEach((o,i)=>{if(o.container){if(o.container.isConnected)return;rz(n,r,i,o,"stale error cleanup (detached container)",e);return}let a=Number.parseInt(n,10);Number.isNaN(a)||t-a<irn||rz(n,r,i,o,"stale error cleanup (legacy record)",e)})})},yrn=(t,e,r)=>{let n=BY();e.forEach((o,i)=>{rz(t,e,i,o,r,n)})},brn=(t,e,r)=>{let n=UY();e.forEach((o,i)=>{rz(t,e,i,o,r,n)})};zr();Mr();var dg=$(K()),u_i=t=>{if(t<60)return`${t}s`;let e=Math.floor(t/60),r=t%60;return`${e}m ${r}s`},l_i=()=>{let t=[{row:0,col:0,animIndex:2},{row:0,col:1,animIndex:1},{row:0,col:2,animIndex:0},{row:1,col:1,animIndex:3},{row:2,col:0,animIndex:4},{row:2,col:1,animIndex:5},{row:2,col:2,animIndex:6}],e=2.5,r=3,n=e*3+r*2;return dg.default.createElement("svg",{width:n,height:n,viewBox:`0 0 ${n} ${n}`,className:"copilot-spinner"},t.map((o,i)=>{let a=o.col*(e+r)+e/2,s=o.row*(e+r)+e/2;return dg.default.createElement("circle",{key:i,cx:a,cy:s,r:e/2,className:`copilot-spinner-dot copilot-spinner-dot-${o.animIndex}`})}))},_rn=({status:t,elapsedSeconds:e,steps:r,isStreaming:n})=>{let[o,i]=(0,dg.useState)(t==="reasoning");if((0,dg.useEffect)(()=>{t==="reasoning"?i(!0):(t==="collapsed"||t==="complete")&&i(!1)},[t]),t==="idle")return null;let a=t==="reasoning",s=!a&&r.length>0;return dg.default.createElement(uy,{open:s?o:a,onOpenChange:s?i:void 0,disabled:!s,className:"agent-reasoning-block"},dg.default.createElement(AT,{asChild:!0,disabled:!s},dg.default.createElement("div",{className:Se("agent-reasoning-header",s&&"tw-cursor-pointer",!s&&"tw-cursor-default")},dg.default.createElement("span",{className:"agent-reasoning-icon"},a?dg.default.createElement(l_i,null):dg.default.createElement(od,{className:Se("tw-size-3 tw-text-muted tw-transition-transform",o&&"tw-rotate-90")})),dg.default.createElement("span",{className:"agent-reasoning-title"},a?"Reasoning":"Thought for"),dg.default.createElement("span",{className:"agent-reasoning-timer"},u_i(e)))),dg.default.createElement(ly,null,r.length>0&&dg.default.createElement("ul",{className:"agent-reasoning-steps"},r.map((u,l)=>dg.default.createElement("li",{key:l,className:"agent-reasoning-step"},u)))))};gr();zr();Fat();Dt();var s6=require("obsidian"),sr=$(K());Qe();var Vke="copilot-collapsible",c_i=()=>(window.__copilotCollapsibleStates||(window.__copilotCollapsibleStates=new Map),window.__copilotCollapsibleStates),vrn=t=>{let e=c_i(),r=e.get(t);return r||(r=new Map,e.set(t,r)),r},qwt=(t,e)=>{let r=t.replace(/[^a-zA-Z0-9_-]/g,"_");return`${Vke}-${r}-${e}`},wrn=(t,e,r={})=>{let n=r.overwriteExisting??!0;t.querySelectorAll(`details[id^="${Vke}-"]`).forEach(i=>{let a=i.id;a&&(!n&&e.has(a)||e.set(a,i.open))})},Hke=(t,e)=>{let r=typeof t.composedPath=="function"?t.composedPath():[];for(let i of r)if(i instanceof HTMLElement&&i.tagName==="DETAILS"){let a=i;if(a.id.startsWith(`${Vke}-`)&&e.contains(a))return a}let n=t.target;if(!(n instanceof Element))return null;let o=n.closest(`details[id^="${Vke}-"]`);return o instanceof HTMLElement&&o.tagName==="DETAILS"&&e.contains(o)?o:null},Bwt=(t,e)=>{let r=e.querySelector("summary");if(!r)return!1;let n=t.target;return n instanceof Node?r.contains(n):(typeof t.composedPath=="function"?t.composedPath():[]).includes(r)};var d_i=/^\d+-\d+$/,f_i=t=>{let e=t.querySelector(".footnotes");e?(e.querySelectorAll("hr, hr.footnotes-sep").forEach(r=>r.remove()),e.querySelectorAll("a.footnote-backref, a.footnote-link.footnote-backref").forEach(r=>r.remove())):t.querySelectorAll("a.footnote-backref, a.footnote-link.footnote-backref").forEach(r=>r.remove()),t.querySelectorAll('a.footnote-ref, sup a[href^="#fn"], sup a[href^="#fn-"], a[href^="#fn"], a[href^="#fn-"]').forEach(r=>{let n=r.textContent?.trim()??"";if(!n||!d_i.test(n))return;let[o]=n.split("-");o&&o!==n&&(r.textContent=o)})},bfe=/\[(\d+(?:\s*,\s*\d+)*)\]/g,p_i=t=>{let e=t.querySelectorAll(".copilot-sources__item");if(e.length===0)return;let r=new Map;if(e.forEach(s=>{let u=s.querySelector(".copilot-sources__index"),l=s.querySelector(".copilot-sources__text");if(!u||!l)return;let c=u.textContent?.match(/\[(\d+)\]/);if(!c)return;let d=parseInt(c[1],10),f=l.querySelector("a");f&&r.set(d,f)}),r.size===0)return;let n=t.querySelector(".copilot-sources"),o=[],i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(s){return n?.contains(s)||s.parentElement?.closest("code, pre")?NodeFilter.FILTER_REJECT:(bfe.lastIndex=0,bfe.test(s.textContent||"")?(bfe.lastIndex=0,NodeFilter.FILTER_ACCEPT):NodeFilter.FILTER_REJECT)}}),a;for(;a=i.nextNode();)o.push(a);o.forEach(s=>{let u=s.textContent||"";bfe.lastIndex=0;let l=document.createDocumentFragment(),c=0,d;for(;(d=bfe.exec(u))!==null;){d.index>c&&l.appendChild(document.createTextNode(u.slice(c,d.index)));let p=d[1].split(/\s*,\s*/).map(h=>parseInt(h.trim(),10));if(p.every(h=>r.has(h))){let h=document.createElement("span");h.className="copilot-citation-group",h.appendChild(document.createTextNode("[")),p.forEach((y,g)=>{g>0&&h.appendChild(document.createTextNode(", "));let b=r.get(y),_=document.createElement("a");for(let w of Array.from(b.attributes))_.setAttribute(w.name,w.value);_.className=`copilot-citation-link${b.className?` ${b.className}`:""}`,_.textContent=String(y),_.setAttribute("aria-label",`Source ${y}`),h.appendChild(_)}),h.appendChild(document.createTextNode("]")),l.appendChild(h)}else l.appendChild(document.createTextNode(d[0]));c=d.index+d[0].length}c<u.length&&l.appendChild(document.createTextNode(u.slice(c)));let f=s.parentElement?.classList.contains("copilot-citation-ref")?s.parentElement:s;f.parentNode?.replaceChild(l,f)})};function m_i({context:t}){return!t||!t.notes?.length&&!t.urls?.length&&!t.webTabs?.length&&!t.tags?.length&&!t.folders?.length&&!t.selectedTextContexts?.length?null:sr.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-2"},t.notes.map((e,r)=>sr.default.createElement(vn,{key:`note-${r}-${e.path}`},sr.default.createElement(wn,{asChild:!0},sr.default.createElement("div",null,sr.default.createElement(qFe,{note:e}))),sr.default.createElement(pn,{className:"tw-max-w-sm tw-break-words"},e.path))),t.urls.map((e,r)=>sr.default.createElement(vn,{key:`url-${r}-${e}`},sr.default.createElement(wn,{asChild:!0},sr.default.createElement("div",null,sr.default.createElement(BFe,{url:e}))),sr.default.createElement(pn,{className:"tw-max-w-sm tw-break-words"},e))),t.webTabs?.map((e,r)=>sr.default.createElement(vn,{key:`webTab-${r}-${e.url}`},sr.default.createElement(wn,{asChild:!0},sr.default.createElement("div",null,sr.default.createElement(UFe,{webTab:e}))),sr.default.createElement(pn,{className:"tw-max-w-sm tw-break-words"},e.title?sr.default.createElement("div",{className:"tw-text-left"},sr.default.createElement("div",{className:"tw-font-medium"},e.title),sr.default.createElement("div",null,e.url)):e.url))),t.tags?.map((e,r)=>sr.default.createElement(vn,{key:`tag-${r}-${e}`},sr.default.createElement(wn,{asChild:!0},sr.default.createElement("div",null,sr.default.createElement(uQr,{tag:e}))),sr.default.createElement(pn,{className:"tw-max-w-sm tw-break-words"},e))),t.folders?.map((e,r)=>sr.default.createElement(vn,{key:`folder-${r}-${e}`},sr.default.createElement(wn,{asChild:!0},sr.default.createElement("div",null,sr.default.createElement(zFe,{folder:e}))),sr.default.createElement(pn,{className:"tw-max-w-sm tw-break-words"},e))),t.selectedTextContexts?.map((e,r)=>sr.default.createElement(vn,{key:`selectedText-${r}-${e.id}`},sr.default.createElement(wn,{asChild:!0},sr.default.createElement("div",null,sr.default.createElement(lQr,{selectedText:e}))),sr.default.createElement(pn,{className:"tw-max-w-sm tw-break-words"},e.sourceType==="web"?e.url:e.notePath))))}var h_i=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i})=>{let[a,s]=(0,sr.useState)(!1),[u,l]=(0,sr.useState)(!1),[c,d]=(0,sr.useState)(null),f=(0,sr.useRef)(null),p=(0,sr.useRef)(null),m=(0,sr.useRef)(!1),h=(0,sr.useRef)(t.id||(t.timestamp?.epoch?String(t.timestamp.epoch):`temp-${Date.now()}-${Math.random()}`)),y=(0,sr.useRef)(prn(h.current)),g=(0,sr.useRef)(mrn(h.current)),_=(0,sr.useRef)(vrn(h.current)).current,w=kr(),T=()=>{if(!navigator.clipboard||!navigator.clipboard.writeText)return;let k=lO(t.message);navigator.clipboard.writeText(k).then(()=>{s(!0),setTimeout(()=>{s(!1)},2e3)})},O=(0,sr.useCallback)(k=>{let q=e.workspace.getActiveFile(),Z=q?q.path:"",V=(z,H,oe,Q)=>{let de="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",fe="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",De="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)",st=`<${H}>`,Le=0;if(r&&z.includes(st)){let Pt=new RegExp(`<${H}>([\\s\\S]*?)<\\/${H}>`,"g");z=z.replace(Pt,($e,Fr)=>{let ft=`${H}-${Le}`;Le+=1;let Ve=qwt(h.current,ft),Rt=_.get(Ve)?" open":"";return`<details id="${Ve}"${Rt} style="${de}">
              <summary style="${fe}">${oe}</summary>
              <div class="tw-text-muted" style="${De}">${Fr.trim()}</div>
            </details>

`});let Nt=new RegExp(`<${H}>([\\s\\S]*)$`);return z=z.replace(Nt,($e,Fr)=>`<div style="${de}">
              <div style="${fe}">${Q}</div>
              <div class="tw-text-muted" style="${De}">${Fr.trim()}</div>
            </div>`),z}let Bt=new RegExp(`<${H}>([\\s\\S]*?)<\\/${H}>`,"g");return z.replace(Bt,(Pt,Nt)=>{let $e=`${H}-${Le}`;Le+=1;let Fr=qwt(h.current,$e),ft=_.get(Fr)?" open":"";return`<details id="${Fr}"${ft} style="${de}">
            <summary style="${fe}">${oe}</summary>
            <div class="tw-text-muted" style="${De}">${Nt.trim()}</div>
          </details>

`})},Y=z=>V(z,"think","Thought for a while","Thinking..."),X=z=>{let H=fe=>fe.replace(/<(\/?)writeToFile>/g,"<$1writeFile>"),oe=fe=>{let De=/```(?:xml)?\s*([\s\S]*?<writeFile>[\s\S]*?<\/writeFile>[\s\S]*?)\s*```/g;return fe.replace(De,(st,Le)=>Le.trim())},Q=fe=>{if(!r)return fe;let De=/```xml\s*([\s\S]*?<writeFile>[\s\S]*?)$/g;return fe.replace(De,(st,Le)=>Le.trim())},de=H(z);return de=oe(de),de=Q(de),V(de,"writeFile","Generated new content","Generating changes...")},W=(z,H,oe)=>z.split(/(```[\s\S]*?```|`[^`]*`)/g).map((de,fe)=>fe%2===0?de.replace(H,(De,st)=>{let Le=e.metadataCache.getFirstLinkpathDest(st,Z);return Le?oe(Le):De}):de).join(""),re=xZ(k),ue=W(re,/!\[\[(.*?)]]/g,z=>`![](${e.vault.getResourcePath(z)})`),le=Y(ue),L=X(le),ne=kzr(L,w.enableInlineCitations).replace(/\[\^(\d+)\](?!:)/g,'<span class="copilot-citation-ref">[$1]</span>'),D=W(ne,/(?<!!)\[\[([^\]]+)]]/g,z=>`<a href="obsidian://open?file=${encodeURIComponent(z.path)}">${z.basename}</a>`);return(z=>{if(!r)return z;let H=/!\[([^\]]*)\]\(([^)]+)\)/g;return z.replace(H,(oe,Q,de)=>{let fe=WWe(de);if(!fe)return oe;let De=Q||"YouTube Video",st=`https://i.ytimg.com/vi/${fe}/hqdefault.jpg`;return`[![${De}](${st})](${de})`})})(D)},[e,r,w.enableInlineCitations,_]);(0,sr.useEffect)(()=>{let k=f.current;if(!k||t.sender===Zs||!r)return;let q=Y=>{if(Y instanceof PointerEvent&&(Y.button!==0||!Y.isPrimary))return;let X=Hke(Y,k);if(!X||!Bwt(Y,X))return;let W=!X.open;X.open=W,_.set(X.id,W)},Z=Y=>{let X=Hke(Y,k);!X||!Bwt(Y,X)||Y.preventDefault()},V=Y=>{let X=Hke(Y,k);X&&_.set(X.id,X.open)};return k.addEventListener("pointerdown",q,!0),k.addEventListener("click",Z,!0),k.addEventListener("toggle",V,!0),()=>{k.removeEventListener("pointerdown",q,!0),k.removeEventListener("click",Z,!0),k.removeEventListener("toggle",V,!0)}},[r,t.sender,_]),(0,sr.useEffect)(()=>{if(m.current=!1,f.current&&t.sender!==Zs){p.current||(p.current=new s6.Component,p.current.load()),wrn(f.current,_,{overwriteExisting:!r});let k=t.message,q=wce(k);q?.hasReasoning&&q.status!=="idle"?d({status:q.status,elapsedSeconds:q.elapsedSeconds,steps:q.steps}):d(null);let Z=q?.contentAfter??k,V=O(Z),Y=Lat(V,h.current);if(!m.current){let X=new Set,W=new Set;f.current.querySelectorAll('[id^="tool-call-"]').forEach(D=>{let N=D.id.replace("tool-call-","");X.add(N)}),f.current.querySelectorAll('[id^="error-block-"]').forEach(D=>{let N=D.id.replace("error-block-","");W.add(N)}),f.current.querySelectorAll(".message-segment").forEach(D=>D.remove());let L=0;Y.segments.forEach(D=>{if(D.type==="text"&&D.content.trim()){let N=f.current.children[L],z=document.createElement("div");z.className="message-segment",N?f.current.insertBefore(z,N):f.current.appendChild(z),s6.MarkdownRenderer.renderMarkdown(D.content,z,"",p.current),f_i(z),L++}else if(D.type==="toolCall"&&D.toolCall){let N=D.toolCall.id,z=document.getElementById(`tool-call-${N}`);if(!z){let oe=f.current.children[L],Q=document.createElement("div");Q.className="tool-call-container",Q.id=`tool-call-${N}`,oe?f.current.insertBefore(Q,oe):f.current.appendChild(Q),z=Q}let H=srn(h.current,y.current,N,z,"render refresh");!m.current&&!H.isUnmounting&&lrn(H,D.toolCall),L++}else if(D.type==="error"&&D.error){let N=D.error.id,z=document.getElementById(`error-block-${N}`);if(!z){let oe=f.current.children[L],Q=document.createElement("div");Q.className="error-block-container",Q.id=`error-block-${N}`,oe?f.current.insertBefore(Q,oe):f.current.appendChild(Q),z=Q}let H=urn(h.current,g.current,N,z,"error render");!m.current&&!H.isUnmounting&&crn(H,D.error),L++}});let J=new Set(Y.segments.filter(D=>D.type==="toolCall"&&D.toolCall).map(D=>D.toolCall.id));X.forEach(D=>{if(!J.has(D)){let N=document.getElementById(`tool-call-${D}`);N&&(drn(h.current,y.current,D,"tool call removal"),N.remove())}});let ne=new Set(Y.segments.filter(D=>D.type==="error"&&D.error).map(D=>D.error.id));W.forEach(D=>{if(!ne.has(D)){let N=document.getElementById(`error-block-${D}`);N&&(frn(h.current,g.current,D,"error block removal"),N.remove())}}),f.current&&!r&&p_i(f.current)}}return()=>{m.current=!0}},[t,e,p,r,O,_]),(0,sr.useEffect)(()=>{let k=p,q=h.current,Z=y.current,V=g.current;return(()=>{hrn(),grn()})(),()=>{m.current=!0,setTimeout(()=>{k.current&&(k.current.unload(),k.current=null),q.startsWith("temp-")&&(yrn(q,Z,"component cleanup"),brn(q,V,"component cleanup"))},0)}},[]);let E=()=>{l(!0)},P=()=>{l(!1)},R=k=>{l(!1),o&&o(k)},I=()=>{t.sources&&t.sources.length>0&&new Lke(e,t.sources).open()},A=()=>{let k=e.workspace.getMostRecentLeaf();if((!k||!(k.view instanceof s6.MarkdownView))&&(k=e.workspace.getLeaf(!1),!k||!(k.view instanceof s6.MarkdownView)))return;let Z=k.view.editor.getSelection().length>0;FJ(t.message,Z)},B=()=>t.content?sr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3"},t.content.map((k,q)=>k.type==="text"?sr.default.createElement("div",{key:q},t.sender===Zs?sr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):sr.default.createElement("div",{ref:f,className:t.isErrorMessage?"tw-text-error":""})):k.type==="image_url"?sr.default.createElement("div",{key:q,className:"message-image-content"},sr.default.createElement("img",{src:k.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===Zs?sr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):sr.default.createElement("div",{ref:f,className:t.isErrorMessage?"tw-text-error":""});return u&&t.sender===Zs?sr.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},sr.default.createElement(jtn,{initialValue:t.message,initialContext:t.context,onSave:R,onCancel:P,app:e})):sr.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},sr.default.createElement("div",{className:Se("tw-group tw-mx-2 tw-rounded-md tw-p-2",t.sender===Zs&&"tw-border tw-border-solid tw-border-border"),style:t.sender===Zs?{backgroundColor:"var(--background-modifier-hover)"}:void 0},sr.default.createElement("div",{className:"tw-flex tw-max-w-full tw-flex-col tw-gap-2 tw-overflow-hidden"},!u&&sr.default.createElement(m_i,{context:t.context}),c&&t.sender!==Zs&&sr.default.createElement(_rn,{status:c.status,elapsedSeconds:c.elapsedSeconds,steps:c.steps,isStreaming:r}),sr.default.createElement("div",{className:"message-content"},B()),t.responseMetadata?.wasTruncated&&t.sender!==Zs&&sr.default.createElement(Ftn,{message:t,app:e}),!r&&sr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},sr.default.createElement("div",{className:"tw-text-xs tw-text-faint"},t.timestamp?.display),sr.default.createElement(Dtn,{message:t,onCopy:T,isCopied:a,onInsertIntoEditor:A,onRegenerate:n,onEdit:E,onDelete:i,onShowSources:I,hasSources:!!(t.sources&&t.sources.length>0)})))))},Uwt=h_i;xn();gr();var zwt=$(K()),Wke=zwt.createContext(void 0),zY=zwt.createContext(void 0);var VY=$(K());function Vwt(){let[t,e]=(0,VY.useState)(null),r=(0,VY.useContext)(zY);return(0,VY.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(MS.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(MS.ACTIVE_LEAF_CHANGE,n)}},[r]),t}var Srn=$(K());function Hwt(){return(0,Srn.useCallback)((e,r)=>{let n=app.dragManager;if(!n)return;e.dataTransfer.setData("copilot/internal-drag","true");let o=app.metadataCache.fileToLinktext(r,""),i=n.dragLink(e.nativeEvent,o);n.onDragStart(e.nativeEvent,i)},[])}zr();Xe();var HY=class extends nu{constructor(e,r,n){let o=n?`Semantic search requires building an embedding index for your vault.

Use 'Refresh Vault Index' or 'Force Reindex Vault' commands to build the index after enabling. Pick your embedding model below.`:`Disabling semantic search will fall back to index-free lexical search (less resource-intensive, could be less accurate).

Your existing index will be preserved but not used.`,i=n?"Enable Semantic Search":"Disable Semantic Search",a=n?"Enable":"Disable";super(e,r,o,i,a,"Cancel")}};u0();Xe();DG();u0();fte();var Crn=require("obsidian");function xrn(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 Trn(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 Crn.TFile&&(r.push(i),r.length>=e))break}return r}KOe();El();Qe();var Wwt=require("obsidian"),Kke=20,Orn=.7,Jke=.3;function g_i(){return kh(ee())}function y_i(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}function Prn(t){if(t.size<=Kke)return t;let e=Array.from(t.entries()).sort((r,n)=>n[1]-r[1]).slice(0,Kke);return new Map(e)}function b_i(t){return Array.isArray(t.embedding)&&t.embedding.length>0}function __i(t){return t.some(e=>e.content.trim().length>0)}async function v_i({db:t,filePath:e,currentNoteEmbeddings:r}){let n=r.map(s=>uq.getDocsByEmbedding(t,s,{limit:Kke,similarity:0})),i=(await Promise.all(n)).flat(),a=y_i(i,e);return Prn(a)}async function Ern(t){try{let e=ee(),r=new l0,n=await r.resolveBaseUrl(Mx(e)),o=tq(app),i=await r.searchRelated(n,UTe(app,t),{folderName:o,limit:Kke}),a=new Map,s=i.results||[];for(let u of s){let l=NG(app,u.path);if(l===t||typeof u.score!="number"||Number.isNaN(u.score))continue;let c=a.get(l);(c===void 0||u.score>c)&&a.set(l,u.score)}return ee().debug&&F(`RelevantNotes(Miyo): received ${s.length} chunks, collected ${a.size} note scores`),Prn(a)}catch(e){return Ce("RelevantNotes(Miyo): failed to compute similarity scores",e),new Map}}async function w_i(t){if(g_i())return Ern(t);let e=await p0.getInstance().getDocumentsByPath(t);if(e.length===0)return new Map;let r=e.filter(n=>b_i(n)).map(n=>n.embedding);if(r.length>0)try{let n=await p0.getInstance().getDb();return v_i({db:n,filePath:t,currentNoteEmbeddings:r})}catch(n){return Ce("RelevantNotes(Orama): failed to compute similarity scores",n),new Map}return __i(e)?Ern(t):new Map}function S_i(t){let e=new Map,n=xrn(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=Trn(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 C_i(t,e){let r=new Map,n=Orn+Jke;for(let[o,i]of t)r.set(o,i*Orn/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=Jke:(i.links||i.backlinks)&&(a=Jke*.8),r.set(o,(r.get(o)??0)+a)}return r}async function Mrn({filePath:t}){let e=app.vault.getAbstractFileByPath(t);if(!(e instanceof Wwt.TFile))return[];let r=await w_i(t),n=S_i(e),o=C_i(r,n);return Array.from(o.entries()).sort((a,s)=>{let u=a[0],l=s[0],c=Gke(r.get(u)??0),d=Gke(r.get(l)??0);return c!==d?d-c:s[1]-a[1]}).map(([a,s])=>{let u=app.vault.getAbstractFileByPath(a);return!(u instanceof Wwt.TFile)||u.extension!=="md"?null:{document:{path:a,title:u.basename},metadata:{score:s,similarityScore:r.get(a),hasOutgoingLinks:n.get(a)?.links??!1,hasBacklinks:n.get(a)?.backlinks??!1}}}).filter(a=>a!==null)}function Gke(t){return t>.7?3:t>.55?2:1}hat();Mr();var u6=require("obsidian"),It=$(K());function x_i(t){let[e,r]=(0,It.useState)([]),[n,o]=(0,It.useState)(0),i=Vwt();return(0,It.useEffect)(()=>mat(()=>o(a=>a+1)),[]),(0,It.useEffect)(()=>{async function a(){if(i?.path)try{let s=await Mrn({filePath:i.path});r(s)}catch(s){Ce("Failed to fetch relevant notes",s),r([])}}a()},[i?.path,t,n]),e}function T_i(t,e){let[r,n]=(0,It.useState)(!0),[o,i]=(0,It.useState)(0);return(0,It.useEffect)(()=>mat(()=>i(a=>a+1)),[]),(0,It.useEffect)(()=>{if(!t)return;async function a(){try{let s=(await Promise.resolve().then(()=>(El(),Bc))).default,{getSettings:u}=await Promise.resolve().then(()=>(Qe(),r1)),l=u();if(kh(l)){let f=await s.getInstance().isIndexEmpty();n(!f);return}let d=await s.getInstance().hasIndex(t);n(d)}catch{n(!1)}}a()},[t,e,o]),r}function O_i({score:t}){let e=Gke(t),r="\u{1F534}";return e===2&&(r="\u{1F7E0}"),e===3&&(r="\u{1F7E2}"),It.default.createElement("span",{className:"tw-text-sm"},r)}function E_i({note:t,onAddToChat:e,onNavigateToNote:r}){let[n,o]=(0,It.useState)(!1),[i,a]=(0,It.useState)(null),s=Hwt(),u=(0,It.useCallback)(async()=>{if(i)return;let l=app.vault.getAbstractFileByPath(t.document.path);if(l instanceof u6.TFile){let c=await app.vault.cachedRead(l),d=c;if(c.startsWith("---")){let f=c.indexOf("---",3);f!==-1&&(d=c.slice(f+3).trim())}a(d.slice(0,1e3)+(d.length>1e3?"...":""))}},[i,t.document.path]);return(0,It.useEffect)(()=>{n&&u()},[n,u]),It.default.createElement(uy,{open:n,onOpenChange:o,className:"tw-rounded-md tw-border tw-border-solid tw-border-border"},It.default.createElement("div",{className:Se("tw-flex tw-items-center tw-justify-between tw-gap-2 tw-p-2")},It.default.createElement(me,{variant:"ghost2",size:"icon",className:"tw-shrink-0",asChild:!0},It.default.createElement(AT,null,It.default.createElement(od,{className:Se("tw-size-4 tw-transition-transform tw-duration-200",{"rotate-90":n})}))),It.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-2"},It.default.createElement(O_i,{score:t.metadata.similarityScore??0})),It.default.createElement("div",{className:"tw-flex-1 tw-overflow-hidden"},It.default.createElement("a",{draggable:!0,onDragStart:l=>{let c=app.vault.getAbstractFileByPath(t.document.path);c instanceof u6.TFile&&s(l,c)},onClick:l=>{l.preventDefault();let c=l.metaKey||l.ctrlKey;r(c)},onAuxClick:l=>{l.button===1&&(l.preventDefault(),r(!0))},className:"tw-block tw-w-full tw-truncate tw-text-sm tw-font-bold tw-text-normal",title:`${t.document.title} - drag to insert wikilink`},t.document.title)),It.default.createElement(vn,null,It.default.createElement(wn,{asChild:!0},It.default.createElement(me,{variant:"ghost2",size:"icon",onClick:e,className:"tw-shrink-0"},It.default.createElement(pw,{className:"tw-size-4"}))),It.default.createElement(pn,null,"Add to Chat"))),It.default.createElement(ly,null,It.default.createElement("div",{className:"tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2"},It.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&&It.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)),It.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&&It.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},It.default.createElement("span",null,"Similarity: ",(t.metadata.similarityScore*100).toFixed(1),"%")),t.metadata.hasOutgoingLinks&&It.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},It.default.createElement(Ire,{className:"tw-size-4"}),It.default.createElement("span",null,"Outgoing links")),t.metadata.hasBacklinks&&It.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},It.default.createElement(Rre,{className:"tw-size-4"}),It.default.createElement("span",null,"Backlinks")))))}function P_i({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return It.default.createElement(bU,{key:t.document.path},It.default.createElement(_U,{asChild:!0},n),It.default.createElement(K$,{className:"tw-flex tw-w-fit tw-min-w-72 tw-max-w-96 tw-flex-col tw-gap-2 tw-overflow-hidden"},It.default.createElement("span",{className:"tw-text-sm tw-text-normal"},t.document.title),It.default.createElement("span",{className:"tw-text-xs tw-text-muted"},t.document.path),It.default.createElement("div",{className:"tw-flex tw-gap-2"},It.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 ",It.default.createElement(pw,{className:"tw-size-4"})),It.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 ",It.default.createElement(yre,{className:"tw-size-4"})))))}var Xke=(0,It.memo)(({className:t,defaultOpen:e=!1})=>{let[r,n]=(0,It.useState)(0),[o,i]=(0,It.useState)(e),a=x_i(r),s=Vwt(),u=ez(),l=T_i(s?.path??"",r),c=Hwt(),d=(h,y=!1)=>{let g=app.vault.getAbstractFileByPath(h);g instanceof u6.TFile&&app.workspace.getLeaf(y).openFile(g)},f=h=>{u.insertTextWithPills(`[[${h}]]`,!0)},p=async()=>{s&&(await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().reindexFile(s),new u6.Notice(`Refreshed index for ${s.basename}`),n(r+1))},m=async()=>{let{getSettings:h,updateSetting:y}=await Promise.resolve().then(()=>(Qe(),r1));h().enableSemanticSearchV3?(await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0}),n(r+1)):new HY(app,async()=>{y("enableSemanticSearchV3",!0),await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0}),n(r+1)},!0).open()};return It.default.createElement("div",{className:Se("tw-w-full tw-border tw-border-solid tw-border-transparent tw-border-b-border tw-pb-2",t)},It.default.createElement(uy,{open:o,onOpenChange:i},It.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-pb-2 tw-pl-1"},It.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},It.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Relevant Notes"),It.default.createElement(to,{content:"Relevance is a combination of semantic similarity and links. Requires semantic search setting on.",contentClassName:"tw-w-64",buttonClassName:"tw-size-4 tw-text-muted"})),It.default.createElement("div",{className:"tw-flex tw-items-center"},l?It.default.createElement(vn,null,It.default.createElement(wn,{asChild:!0},It.default.createElement(me,{variant:"ghost2",size:"icon",onClick:p},It.default.createElement(qre,{className:"tw-size-4"}))),It.default.createElement(pn,{side:"bottom"},"Reindex Current Note")):It.default.createElement(me,{variant:"secondary",size:"sm",onClick:m},"Build Index"),a.length>0&&It.default.createElement(AT,{asChild:!0},It.default.createElement(me,{variant:"ghost2",size:"icon"},o?It.default.createElement(Og,{className:"tw-size-5"}):It.default.createElement(Ji,{className:"tw-size-5"}))))),a.length===0&&l&&It.default.createElement("div",{className:"tw-flex tw-max-h-12 tw-flex-wrap tw-items-center tw-gap-x-2 tw-gap-y-1 tw-overflow-y-hidden tw-px-1"},It.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"No relevant notes found")),!o&&a.length>0&&It.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"},a.map(h=>It.default.createElement(P_i,{key:h.document.path,note:h,onAddToChat:()=>f(h.document.title),onNavigateToNote:y=>d(h.document.path,y)},It.default.createElement(Xc,{variant:"outline",key:h.document.path,draggable:!0,onDragStart:y=>{let g=app.vault.getAbstractFileByPath(h.document.path);g instanceof u6.TFile&&c(y,g)},className:"tw-max-w-40 tw-text-xs tw-text-muted hover:tw-cursor-pointer hover:tw-bg-interactive-hover",title:`${h.document.title} - drag to insert wikilink`},It.default.createElement("span",{className:"tw-truncate"},h.document.title))))),It.default.createElement(ly,null,It.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"},a.map(h=>It.default.createElement(E_i,{note:h,key:h.document.path,onAddToChat:()=>f(h.document.title),onNavigateToNote:y=>d(h.document.path,y)}))))))});Xke.displayName="RelevantNotes";na();rd();xn();var qv=$(K());zr();var vL=qv.forwardRef(({className:t,...e},r)=>qv.createElement("div",{ref:r,className:Se("tw-rounded-xl tw-border tw-border-border tw-bg-primary tw-text-normal tw-shadow",t),...e}));vL.displayName="Card";var wL=qv.forwardRef(({className:t,...e},r)=>qv.createElement("div",{ref:r,className:Se("tw-flex tw-flex-col tw-space-y-1.5 tw-p-6",t),...e}));wL.displayName="CardHeader";var l6=qv.forwardRef(({className:t,...e},r)=>qv.createElement("div",{ref:r,className:Se("tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));l6.displayName="CardTitle";var M_i=qv.forwardRef(({className:t,...e},r)=>qv.createElement("div",{ref:r,className:Se("tw-text-sm tw-text-muted",t),...e}));M_i.displayName="CardDescription";var SL=qv.forwardRef(({className:t,...e},r)=>qv.createElement("div",{ref:r,className:Se("tw-p-6 tw-pt-0",t),...e}));SL.displayName="CardContent";var R_i=qv.forwardRef(({className:t,...e},r)=>qv.createElement("div",{ref:r,className:Se("tw-flex tw-items-center tw-p-6 tw-pt-0",t),...e}));R_i.displayName="CardFooter";gr();Qe();Mr();var il=$(K());var Jwt={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","Summarize <youtube_video_url>","@websearch what are most recent updates in the AI industry","What are the key insights from this paper <arxiv_url>","What new methods are proposed in this paper [[<note_with_embedded_pdf>]]"]}},Rrn={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"],project:["copilotPlus","copilotPlus","copilotPlus"]};function I_i(t="llm_chain"){let e=Rrn[t]||Rrn.llm_chain,r={};return e.map(n=>(r[n]||(r[n]=[...Jwt[n].prompts].sort(()=>Math.random()-.5)),{title:Jwt[n].title,text:r[n].pop()||Jwt[n].prompts[0]}))}var Irn=({onClick:t})=>{let[e]=aw(),r=(0,il.useMemo)(()=>I_i(e),[e]),o=kr().indexVaultToVectorStore;return il.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},il.default.createElement(vL,{className:"tw-w-full tw-bg-transparent"},il.default.createElement(wL,{className:"tw-px-2"},il.default.createElement(l6,null,"Suggested Prompts")),il.default.createElement(SL,{className:"tw-p-2 tw-pt-0"},il.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},r.map((i,a)=>il.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"},il.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},il.default.createElement("div",{className:"tw-text-muted"},i.title),il.default.createElement("div",null,i.text)),il.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},il.default.createElement(vn,null,il.default.createElement(wn,{asChild:!0},il.default.createElement(me,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>t(i.text)},il.default.createElement(pw,{className:"tw-size-4"}))),il.default.createElement(pn,null,"Add to Chat")))))))),e==="vault_qa"&&il.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"&&il.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},il.default.createElement("div",null,il.default.createElement(Eg,{className:"tw-size-4"})," Your auto-index strategy is set to"," ",il.default.createElement("b",null,"NEVER"),". Before proceeding, click the"," ",il.default.createElement("span",{className:"tw-text-accent"},"Refresh Index")," button below or run the"," ",il.default.createElement("span",{className:"tw-text-accent"},"Copilot command: Index (refresh) vault for QA")," ","to update the index.")))};gr();gr();var d_=$(K()),Arn=({chatHistory:t})=>{let[e,r]=(0,d_.useState)(0),n=(0,d_.useRef)(null),o=(0,d_.useRef)(null),i=(0,d_.useCallback)((l,c)=>`message-${l.id||l.timestamp?.epoch||c}`,[]),a=(0,d_.useCallback)(()=>{if(!n.current)return 0;let l=n.current,c=l.clientHeight,d=t.map((m,h)=>({msg:m,idx:h})).filter(({msg:m})=>m.isVisible&&m.sender===Zs).pop()?.idx,f=0;if(d!==void 0){let m=i(t[d],d),h=l.querySelector(`[data-message-key="${m}"]`);if(h)f=h.getBoundingClientRect().height;else{let y=t[d].message.length,g=Math.ceil(y/80);f=Math.max(60,g*24)}}return Math.max(100,c-f)},[t,i]),s=(0,d_.useCallback)(l=>{if(l!==n.current&&(o.current&&(o.current.disconnect(),o.current=null),n.current=l,l)){let c=a();r(c);let d=new ResizeObserver(()=>{if(n.current){let f=a();r(f)}});d.observe(l),o.current=d}},[a]);(0,d_.useEffect)(()=>{if(n.current&&t.length>0){let l=a();r(l)}},[t,a]),(0,d_.useEffect)(()=>()=>{o.current&&o.current.disconnect()},[]);let u=(0,d_.useCallback)((l="smooth")=>{n.current&&n.current.scrollTo({top:n.current.scrollHeight,behavior:l})},[]);return(0,d_.useEffect)(()=>{u("instant")},[u]),(0,d_.useEffect)(()=>{if(t.length>0){let l=t[t.length-1];l&&l.sender===Zs&&u()}},[t.length,t,u]),{containerMinHeight:e,scrollContainerCallbackRef:s,getMessageKey:i}};Qe();var cy=$(K()),Nrn=(0,cy.memo)(({chatHistory:t,currentAiMessage:e,streamingMessageId:r,loading:n,loadingMessage:o,app:i,onRegenerate:a,onEdit:s,onDelete:u,onReplaceChat:l,showHelperComponents:c=!0})=>{let[d,f]=(0,cy.useState)(""),p=kr(),{containerMinHeight:m,scrollContainerCallbackRef:h,getMessageKey:y}=Arn({chatHistory:t});if((0,cy.useEffect)(()=>{let b;return n?b=setInterval(()=>{f(_=>_.length<6?_+".":"")},200):f(""),()=>clearInterval(b)},[n]),!t.filter(b=>b.isVisible).length&&!e)return cy.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-gap-2 tw-overflow-y-auto"},c&&p.showRelevantNotes&&cy.default.createElement(Xke,{defaultOpen:!0,key:"relevant-notes-before-chat"}),c&&p.showSuggestedPrompts&&cy.default.createElement(Irn,{onClick:l}));let g=()=>o?`${o} ${d}`:d;return cy.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-1 tw-flex-col tw-overflow-hidden"},c&&p.showRelevantNotes&&cy.default.createElement(Xke,{className:"tw-mb-4",defaultOpen:!1,key:"relevant-notes-in-chat"}),cy.default.createElement("div",{ref:h,"data-testid":"chat-messages",className:"tw-relative tw-flex tw-w-full tw-flex-1 tw-select-text tw-flex-col tw-items-start tw-justify-start tw-overflow-y-auto tw-scroll-smooth tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)]"},t.map((b,_)=>{let w=t.filter(E=>E.isVisible),O=_===w.length-1&&b.sender!==Zs;return b.isVisible&&cy.default.createElement("div",{key:y(b,_),"data-message-key":y(b,_),className:"tw-w-full",style:{minHeight:O?`${m}px`:"auto"}},cy.default.createElement(Uwt,{message:b,app:i,isStreaming:!1,onRegenerate:()=>a(_),onEdit:E=>s(_,E),onDelete:()=>u(_)}))}),(e||n)&&cy.default.createElement("div",{className:"tw-w-full",style:{minHeight:`${m}px`}},cy.default.createElement(Uwt,{key:r??"ai_message_streaming",message:{id:r??void 0,sender:"AI",message:e||g(),isVisible:!0,timestamp:null},app:i,isStreaming:!0,onDelete:()=>{}}))))});Nrn.displayName="ChatMessages";var Drn=Nrn;xn();Dt();var Zke=$(K());function Yke(t){let[e,r]=(0,Zke.useState)(null);(0,Zke.useEffect)(()=>{(async()=>{let i=await xNt();i.version&&r(i.version)})()},[]);let n=e!==null&&Age(e,t);return{latestVersion:e,hasUpdate:n}}zr();Qe();Dt();Mr();var hC=$(K());function jrn({currentVersion:t}){let{latestVersion:e,hasUpdate:r}=Yke(t),n=kr().lastDismissedVersion,[o,i]=(0,hC.useState)(!0),a=r&&e&&Age(e,t)&&n!==e,s=()=>{e&&(i(!1),setTimeout(()=>{Re("lastDismissedVersion",e)},300))};return a?hC.default.createElement("div",{className:Se("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")},hC.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"},hC.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},hC.default.createElement("span",{className:"tw-font-medium"},"Update available:"),hC.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"tw-text-normal"},"v",e)),hC.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},hC.default.createElement(me,{size:"fit",variant:"ghost2",className:"tw-text-accent hover:tw-text-accent-hover",onClick:()=>{window.open("obsidian://show-plugin?id=copilot","_blank"),s()}},"Update"),hC.default.createElement(me,{variant:"ghost2",size:"icon",onClick:s},hC.default.createElement(Ho,{className:"tw-size-4"}))))):null}na();na();na();var $rn=require("obsidian");Wb();var WY=class extends $rn.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=dat(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 Kwt=require("obsidian");var Qke=require("obsidian");Dt();rd();var JY=class extends Qke.FuzzySuggestModal{constructor(e,r="copilot_plus"){super(e),this.activeNote=e.workspace.getActiveFile(),this.chainType=r}getOrderedNotes(e=[]){let r=this.app.workspace.getLastOpenFiles().map(a=>this.app.vault.getAbstractFileByPath(a)).filter(a=>a instanceof Qke.TFile&&LJ(a,this.chainType)&&!e.includes(a.path)&&a.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(a=>LJ(a,this.chainType)).filter(a=>!r.some(s=>s.path===a.path)&&!e.includes(a.path)&&a.path!==this.activeNote?.path);return[...this.activeNote&&LJ(this.activeNote,this.chainType)?[this.activeNote]:[],...r,...o]}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n==="pdf"?o+=" (PDF)":n==="canvas"&&(o+=" (Canvas)"),o}};var _fe=class extends JY{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 Kwt.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 Kwt.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}};Dt();var Lrn=require("obsidian"),KY=class extends Lrn.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)sO(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};xn();var xfe=$(K());Mr();var Wrn=$(K(),1),Er=$(K(),1),oqe=(0,Er.createContext)(null);oqe.displayName="PanelGroupContext";var Yc={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},tSt=10,d6=Er.useLayoutEffect,Frn=Wrn.useId,A_i=typeof Frn=="function"?Frn:()=>null,N_i=0;function rSt(t=null){let e=A_i(),r=(0,Er.useRef)(t||e||null);return r.current===null&&(r.current=""+N_i++),t??r.current}function Jrn({children:t,className:e="",collapsedSize:r,collapsible:n,defaultSize:o,forwardedRef:i,id:a,maxSize:s,minSize:u,onCollapse:l,onExpand:c,onResize:d,order:f,style:p,tagName:m="div",...h}){let y=(0,Er.useContext)(oqe);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:g,expandPanel:b,getPanelSize:_,getPanelStyle:w,groupId:T,isPanelCollapsed:O,reevaluatePanelConstraints:E,registerPanel:P,resizePanel:R,unregisterPanel:I}=y,A=rSt(a),B=(0,Er.useRef)({callbacks:{onCollapse:l,onExpand:c,onResize:d},constraints:{collapsedSize:r,collapsible:n,defaultSize:o,maxSize:s,minSize:u},id:A,idIsFromProps:a!==void 0,order:f});(0,Er.useRef)({didLogMissingDefaultSizeWarning:!1}),d6(()=>{let{callbacks:q,constraints:Z}=B.current,V={...Z};B.current.id=A,B.current.idIsFromProps=a!==void 0,B.current.order=f,q.onCollapse=l,q.onExpand=c,q.onResize=d,Z.collapsedSize=r,Z.collapsible=n,Z.defaultSize=o,Z.maxSize=s,Z.minSize=u,(V.collapsedSize!==Z.collapsedSize||V.collapsible!==Z.collapsible||V.maxSize!==Z.maxSize||V.minSize!==Z.minSize)&&E(B.current,V)}),d6(()=>{let q=B.current;return P(q),()=>{I(q)}},[f,A,P,I]),(0,Er.useImperativeHandle)(i,()=>({collapse:()=>{g(B.current)},expand:q=>{b(B.current,q)},getId(){return A},getSize(){return _(B.current)},isCollapsed(){return O(B.current)},isExpanded(){return!O(B.current)},resize:q=>{R(B.current,q)}}),[g,b,_,O,A,R]);let k=w(B.current,o);return(0,Er.createElement)(m,{...h,children:t,className:e,id:A,style:{...k,...p},[Yc.groupId]:T,[Yc.panel]:"",[Yc.panelCollapsible]:n||void 0,[Yc.panelId]:A,[Yc.panelSize]:parseFloat(""+k.flexGrow).toFixed(1)})}var nSt=(0,Er.forwardRef)((t,e)=>(0,Er.createElement)(Jrn,{...t,forwardedRef:e}));Jrn.displayName="Panel";nSt.displayName="forwardRef(Panel)";var D_i;function j_i(){return D_i}var eSt=null,$_i=!0,tqe=-1,CL=null;function L_i(t,e){if(e){let r=(e&Yrn)!==0,n=(e&Qrn)!==0,o=(e&enn)!==0,i=(e&tnn)!==0;if(r)return o?"se-resize":i?"ne-resize":"e-resize";if(n)return o?"sw-resize":i?"nw-resize":"w-resize";if(o)return"s-resize";if(i)return"n-resize"}switch(t){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function F_i(){CL!==null&&(document.head.removeChild(CL),eSt=null,CL=null,tqe=-1)}function Gwt(t,e){var r,n;if(!$_i)return;let o=L_i(t,e);if(eSt!==o){if(eSt=o,CL===null){CL=document.createElement("style");let a=j_i();a&&CL.setAttribute("nonce",a),document.head.appendChild(CL)}if(tqe>=0){var i;(i=CL.sheet)===null||i===void 0||i.removeRule(tqe)}tqe=(r=(n=CL.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${o} !important;}`))!==null&&r!==void 0?r:-1}}function Krn(t){return t.type==="keydown"}function Grn(t){return t.type.startsWith("pointer")}function Xrn(t){return t.type.startsWith("mouse")}function iqe(t){if(Grn(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(Xrn(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function k_i(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function q_i(t,e,r){return r?t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y:t.x<=e.x+e.width&&t.x+t.width>=e.x&&t.y<=e.y+e.height&&t.y+t.height>=e.y}function B_i(t,e){if(t===e)throw new Error("Cannot compare node with itself");let r={a:Brn(t),b:Brn(e)},n;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),n=t;yi(n,"Stacking order can only be calculated for elements with a common ancestor");let o={a:qrn(krn(r.a)),b:qrn(krn(r.b))};if(o.a===o.b){let i=n.childNodes,a={a:r.a.at(-1),b:r.b.at(-1)},s=i.length;for(;s--;){let u=i[s];if(u===a.a)return 1;if(u===a.b)return-1}}return Math.sign(o.a-o.b)}var U_i=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function z_i(t){var e;let r=getComputedStyle((e=Zrn(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function V_i(t){let e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||z_i(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||U_i.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function krn(t){let e=t.length;for(;e--;){let r=t[e];if(yi(r,"Missing node"),V_i(r))return r}return null}function qrn(t){return t&&Number(getComputedStyle(t).zIndex)||0}function Brn(t){let e=[];for(;t;)e.push(t),t=Zrn(t);return e}function Zrn(t){let{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}var Yrn=1,Qrn=2,enn=4,tnn=8,H_i=k_i()==="coarse",NT=[],YY=!1,nz=new Map,aqe=new Map,Sfe=new Set;function W_i(t,e,r,n,o){var i;let{ownerDocument:a}=e,s={direction:r,element:e,hitAreaMargins:n,setResizeHandlerState:o},u=(i=nz.get(a))!==null&&i!==void 0?i:0;return nz.set(a,u+1),Sfe.add(s),rqe(),function(){var c;aqe.delete(t),Sfe.delete(s);let d=(c=nz.get(a))!==null&&c!==void 0?c:1;if(nz.set(a,d-1),rqe(),d===1&&nz.delete(a),NT.includes(s)){let f=NT.indexOf(s);f>=0&&NT.splice(f,1),iSt(),o("up",!0,null)}}}function J_i(t){let{target:e}=t,{x:r,y:n}=iqe(t);YY=!0,oSt({target:e,x:r,y:n}),rqe(),NT.length>0&&(nqe("down",t),t.preventDefault(),rnn(e)||t.stopImmediatePropagation())}function Xwt(t){let{x:e,y:r}=iqe(t);if(YY&&t.buttons===0&&(YY=!1,nqe("up",t)),!YY){let{target:n}=t;oSt({target:n,x:e,y:r})}nqe("move",t),iSt(),NT.length>0&&t.preventDefault()}function Zwt(t){let{target:e}=t,{x:r,y:n}=iqe(t);aqe.clear(),YY=!1,NT.length>0&&(t.preventDefault(),rnn(e)||t.stopImmediatePropagation()),nqe("up",t),oSt({target:e,x:r,y:n}),iSt(),rqe()}function rnn(t){let e=t;for(;e;){if(e.hasAttribute(Yc.resizeHandle))return!0;e=e.parentElement}return!1}function oSt({target:t,x:e,y:r}){NT.splice(0);let n=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(n=t),Sfe.forEach(o=>{let{element:i,hitAreaMargins:a}=o,s=i.getBoundingClientRect(),{bottom:u,left:l,right:c,top:d}=s,f=H_i?a.coarse:a.fine;if(e>=l-f&&e<=c+f&&r>=d-f&&r<=u+f){if(n!==null&&document.contains(n)&&i!==n&&!i.contains(n)&&!n.contains(i)&&B_i(n,i)>0){let m=n,h=!1;for(;m&&!m.contains(i);){if(q_i(m.getBoundingClientRect(),s,!0)){h=!0;break}m=m.parentElement}if(h)return}NT.push(o)}})}function Ywt(t,e){aqe.set(t,e)}function iSt(){let t=!1,e=!1;NT.forEach(n=>{let{direction:o}=n;o==="horizontal"?t=!0:e=!0});let r=0;aqe.forEach(n=>{r|=n}),t&&e?Gwt("intersection",r):t?Gwt("horizontal",r):e?Gwt("vertical",r):F_i()}var Qwt=new AbortController;function rqe(){Qwt.abort(),Qwt=new AbortController;let t={capture:!0,signal:Qwt.signal};Sfe.size&&(YY?(NT.length>0&&nz.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("contextmenu",Zwt,t),n.addEventListener("pointerleave",Xwt,t),n.addEventListener("pointermove",Xwt,t))}),nz.forEach((e,r)=>{let{body:n}=r;n.addEventListener("pointerup",Zwt,t),n.addEventListener("pointercancel",Zwt,t)})):nz.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("pointerdown",J_i,t),n.addEventListener("pointermove",Xwt,t))}))}function nqe(t,e){Sfe.forEach(r=>{let{setResizeHandlerState:n}=r,o=NT.includes(r);n(t,o,e)})}function K_i(){let[t,e]=(0,Er.useState)(0);return(0,Er.useCallback)(()=>e(r=>r+1),[])}function yi(t,e){if(!t)throw console.error(e),Error(e)}function f6(t,e,r=tSt){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function xL(t,e,r=tSt){return f6(t,e,r)===0}function sS(t,e,r){return f6(t,e,r)===0}function G_i(t,e,r){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++){let o=t[n],i=e[n];if(!sS(o,i,r))return!1}return!0}function ZY({panelConstraints:t,panelIndex:e,size:r}){let n=t[e];yi(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=n;if(f6(r,s)<0)if(i){let u=(o+s)/2;f6(r,u)<0?r=o:r=s}else r=s;return r=Math.min(a,r),r=parseFloat(r.toFixed(tSt)),r}function vfe({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:n,prevLayout:o,trigger:i}){if(sS(t,0))return e;let a=[...e],[s,u]=n;yi(s!=null,"Invalid first pivot index"),yi(u!=null,"Invalid second pivot index");let l=0;if(i==="keyboard"){{let d=t<0?u:s,f=r[d];yi(f,`Panel constraints not found for index ${d}`);let{collapsedSize:p=0,collapsible:m,minSize:h=0}=f;if(m){let y=e[d];if(yi(y!=null,`Previous layout not found for panel index ${d}`),sS(y,p)){let g=h-y;f6(g,Math.abs(t))>0&&(t=t<0?0-g:g)}}}{let d=t<0?s:u,f=r[d];yi(f,`No panel constraints found for index ${d}`);let{collapsedSize:p=0,collapsible:m,minSize:h=0}=f;if(m){let y=e[d];if(yi(y!=null,`Previous layout not found for panel index ${d}`),sS(y,h)){let g=y-p;f6(g,Math.abs(t))>0&&(t=t<0?0-g:g)}}}}{let d=t<0?1:-1,f=t<0?u:s,p=0;for(;;){let h=e[f];yi(h!=null,`Previous layout not found for panel index ${f}`);let g=ZY({panelConstraints:r,panelIndex:f,size:100})-h;if(p+=g,f+=d,f<0||f>=r.length)break}let m=Math.min(Math.abs(t),Math.abs(p));t=t<0?0-m:m}{let f=t<0?s:u;for(;f>=0&&f<r.length;){let p=Math.abs(t)-Math.abs(l),m=e[f];yi(m!=null,`Previous layout not found for panel index ${f}`);let h=m-p,y=ZY({panelConstraints:r,panelIndex:f,size:h});if(!sS(m,y)&&(l+=m-y,a[f]=y,l.toPrecision(3).localeCompare(Math.abs(t).toPrecision(3),void 0,{numeric:!0})>=0))break;t<0?f--:f++}}if(G_i(o,a))return o;{let d=t<0?u:s,f=e[d];yi(f!=null,`Previous layout not found for panel index ${d}`);let p=f+l,m=ZY({panelConstraints:r,panelIndex:d,size:p});if(a[d]=m,!sS(m,p)){let h=p-m,g=t<0?u:s;for(;g>=0&&g<r.length;){let b=a[g];yi(b!=null,`Previous layout not found for panel index ${g}`);let _=b+h,w=ZY({panelConstraints:r,panelIndex:g,size:_});if(sS(b,w)||(h-=w-b,a[g]=w),sS(h,0))break;t>0?g--:g++}}}let c=a.reduce((d,f)=>f+d,0);return sS(c,100)?a:o}function X_i({layout:t,panelsArray:e,pivotIndices:r}){let n=0,o=100,i=0,a=0,s=r[0];yi(s!=null,"No pivot index found"),e.forEach((d,f)=>{let{constraints:p}=d,{maxSize:m=100,minSize:h=0}=p;f===s?(n=h,o=m):(i+=h,a+=m)});let u=Math.min(o,100-i),l=Math.max(n,100-a),c=t[s];return{valueMax:u,valueMin:l,valueNow:c}}function Cfe(t,e=document){return Array.from(e.querySelectorAll(`[${Yc.resizeHandleId}][data-panel-group-id="${t}"]`))}function nnn(t,e,r=document){let o=Cfe(t,r).findIndex(i=>i.getAttribute(Yc.resizeHandleId)===e);return o??null}function onn(t,e,r){let n=nnn(t,e,r);return n!=null?[n,n+1]:[-1,-1]}function Z_i(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function inn(t,e=document){if(Z_i(e)&&e.dataset.panelGroupId==t)return e;let r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function sqe(t,e=document){let r=e.querySelector(`[${Yc.resizeHandleId}="${t}"]`);return r||null}function Y_i(t,e,r,n=document){var o,i,a,s;let u=sqe(e,n),l=Cfe(t,n),c=u?l.indexOf(u):-1,d=(o=(i=r[c])===null||i===void 0?void 0:i.id)!==null&&o!==void 0?o:null,f=(a=(s=r[c+1])===null||s===void 0?void 0:s.id)!==null&&a!==void 0?a:null;return[d,f]}function Q_i({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:n,panelDataArray:o,panelGroupElement:i,setLayout:a}){(0,Er.useRef)({didWarnAboutMissingResizeHandle:!1}),d6(()=>{if(!i)return;let s=Cfe(r,i);for(let u=0;u<o.length-1;u++){let{valueMax:l,valueMin:c,valueNow:d}=X_i({layout:n,panelsArray:o,pivotIndices:[u,u+1]}),f=s[u];if(f!=null){let p=o[u];yi(p,`No panel data found for index "${u}"`),f.setAttribute("aria-controls",p.id),f.setAttribute("aria-valuemax",""+Math.round(l)),f.setAttribute("aria-valuemin",""+Math.round(c)),f.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{s.forEach((u,l)=>{u.removeAttribute("aria-controls"),u.removeAttribute("aria-valuemax"),u.removeAttribute("aria-valuemin"),u.removeAttribute("aria-valuenow")})}},[r,n,o,i]),(0,Er.useEffect)(()=>{if(!i)return;let s=e.current;yi(s,"Eager values not found");let{panelDataArray:u}=s,l=inn(r,i);yi(l!=null,`No group found for id "${r}"`);let c=Cfe(r,i);yi(c,`No resize handles found for group id "${r}"`);let d=c.map(f=>{let p=f.getAttribute(Yc.resizeHandleId);yi(p,"Resize handle element has no handle id attribute");let[m,h]=Y_i(r,p,u,i);if(m==null||h==null)return()=>{};let y=g=>{if(!g.defaultPrevented)switch(g.key){case"Enter":{g.preventDefault();let b=u.findIndex(_=>_.id===m);if(b>=0){let _=u[b];yi(_,`No panel data found for index ${b}`);let w=n[b],{collapsedSize:T=0,collapsible:O,minSize:E=0}=_.constraints;if(w!=null&&O){let P=vfe({delta:sS(w,T)?E-T:T-w,initialLayout:n,panelConstraints:u.map(R=>R.constraints),pivotIndices:onn(r,p,i),prevLayout:n,trigger:"keyboard"});n!==P&&a(P)}}break}}};return f.addEventListener("keydown",y),()=>{f.removeEventListener("keydown",y)}});return()=>{d.forEach(f=>f())}},[i,t,e,r,n,o,a])}function Urn(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function ann(t,e){let r=t==="horizontal",{x:n,y:o}=iqe(e);return r?n:o}function evi(t,e,r,n,o){let i=r==="horizontal",a=sqe(e,o);yi(a,`No resize handle element found for id "${e}"`);let s=a.getAttribute(Yc.groupId);yi(s,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=n,l=ann(r,t),c=inn(s,o);yi(c,`No group element found for id "${s}"`);let d=c.getBoundingClientRect(),f=i?d.width:d.height;return(l-u)/f*100}function tvi(t,e,r,n,o,i){if(Krn(t)){let a=r==="horizontal",s=0;t.shiftKey?s=100:o!=null?s=o:s=10;let u=0;switch(t.key){case"ArrowDown":u=a?0:s;break;case"ArrowLeft":u=a?-s:0;break;case"ArrowRight":u=a?s:0;break;case"ArrowUp":u=a?0:-s;break;case"End":u=100;break;case"Home":u=-100;break}return u}else return n==null?0:evi(t,e,r,n,i)}function rvi({panelDataArray:t}){let e=Array(t.length),r=t.map(i=>i.constraints),n=0,o=100;for(let i=0;i<t.length;i++){let a=r[i];yi(a,`Panel constraints not found for index ${i}`);let{defaultSize:s}=a;s!=null&&(n++,e[i]=s,o-=s)}for(let i=0;i<t.length;i++){let a=r[i];yi(a,`Panel constraints not found for index ${i}`);let{defaultSize:s}=a;if(s!=null)continue;let u=t.length-n,l=o/u;n++,e[i]=l,o-=l}return e}function GY(t,e,r){e.forEach((n,o)=>{let i=t[o];yi(i,`Panel data not found for index ${o}`);let{callbacks:a,constraints:s,id:u}=i,{collapsedSize:l=0,collapsible:c}=s,d=r[u];if(d==null||n!==d){r[u]=n;let{onCollapse:f,onExpand:p,onResize:m}=a;m&&m(n,d),c&&(f||p)&&(p&&(d==null||xL(d,l))&&!xL(n,l)&&p(),f&&(d==null||!xL(d,l))&&xL(n,l)&&f())}})}function eqe(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!=e[r])return!1;return!0}function nvi({defaultSize:t,dragState:e,layout:r,panelData:n,panelIndex:o,precision:i=3}){let a=r[o],s;return a==null?s=t!=null?t.toPrecision(i):"1":n.length===1?s="1":s=a.toPrecision(i),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function ovi(t,e=10){let r=null;return(...o)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...o)},e)}}function zrn(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,r)=>{localStorage.setItem(e,r)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function snn(t){return`react-resizable-panels:${t}`}function unn(t){return t.map(e=>{let{constraints:r,id:n,idIsFromProps:o,order:i}=e;return o?n:i?`${i}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((e,r)=>e.localeCompare(r)).join(",")}function lnn(t,e){try{let r=snn(t),n=e.getItem(r);if(n){let o=JSON.parse(n);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function ivi(t,e,r){var n,o;let i=(n=lnn(t,r))!==null&&n!==void 0?n:{},a=unn(e);return(o=i[a])!==null&&o!==void 0?o:null}function avi(t,e,r,n,o){var i;let a=snn(t),s=unn(e),u=(i=lnn(t,o))!==null&&i!==void 0?i:{};u[s]={expandToSizes:Object.fromEntries(r.entries()),layout:n};try{o.setItem(a,JSON.stringify(u))}catch(l){console.error(l)}}function Vrn({layout:t,panelConstraints:e}){let r=[...t],n=r.reduce((i,a)=>i+a,0);if(r.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${r.map(i=>`${i}%`).join(", ")}`);if(!sS(n,100)&&r.length>0)for(let i=0;i<e.length;i++){let a=r[i];yi(a!=null,`No layout data found for index ${i}`);let s=100/n*a;r[i]=s}let o=0;for(let i=0;i<e.length;i++){let a=r[i];yi(a!=null,`No layout data found for index ${i}`);let s=ZY({panelConstraints:e,panelIndex:i,size:a});a!=s&&(o+=a-s,r[i]=s)}if(!sS(o,0))for(let i=0;i<e.length;i++){let a=r[i];yi(a!=null,`No layout data found for index ${i}`);let s=a+o,u=ZY({panelConstraints:e,panelIndex:i,size:s});if(a!==u&&(o-=u-a,r[i]=u,sS(o,0)))break}return r}var svi=100,wfe={getItem:t=>(zrn(wfe),wfe.getItem(t)),setItem:(t,e)=>{zrn(wfe),wfe.setItem(t,e)}},Hrn={};function cnn({autoSaveId:t=null,children:e,className:r="",direction:n,forwardedRef:o,id:i=null,onLayout:a=null,keyboardResizeBy:s=null,storage:u=wfe,style:l,tagName:c="div",...d}){let f=rSt(i),p=(0,Er.useRef)(null),[m,h]=(0,Er.useState)(null),[y,g]=(0,Er.useState)([]),b=K_i(),_=(0,Er.useRef)({}),w=(0,Er.useRef)(new Map),T=(0,Er.useRef)(0),O=(0,Er.useRef)({autoSaveId:t,direction:n,dragState:m,id:f,keyboardResizeBy:s,onLayout:a,storage:u}),E=(0,Er.useRef)({layout:y,panelDataArray:[],panelDataArrayChanged:!1});(0,Er.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,Er.useImperativeHandle)(o,()=>({getId:()=>O.current.id,getLayout:()=>{let{layout:L}=E.current;return L},setLayout:L=>{let{onLayout:J}=O.current,{layout:ne,panelDataArray:D}=E.current,N=Vrn({layout:L,panelConstraints:D.map(z=>z.constraints)});Urn(ne,N)||(g(N),E.current.layout=N,J&&J(N),GY(D,N,_.current))}}),[]),d6(()=>{O.current.autoSaveId=t,O.current.direction=n,O.current.dragState=m,O.current.id=f,O.current.onLayout=a,O.current.storage=u}),Q_i({committedValuesRef:O,eagerValuesRef:E,groupId:f,layout:y,panelDataArray:E.current.panelDataArray,setLayout:g,panelGroupElement:p.current}),(0,Er.useEffect)(()=>{let{panelDataArray:L}=E.current;if(t){if(y.length===0||y.length!==L.length)return;let J=Hrn[t];J==null&&(J=ovi(avi,svi),Hrn[t]=J);let ne=[...L],D=new Map(w.current);J(t,ne,D,y,u)}},[t,y,u]),(0,Er.useEffect)(()=>{});let P=(0,Er.useCallback)(L=>{let{onLayout:J}=O.current,{layout:ne,panelDataArray:D}=E.current;if(L.constraints.collapsible){let N=D.map(Q=>Q.constraints),{collapsedSize:z=0,panelSize:H,pivotIndices:oe}=c6(D,L,ne);if(yi(H!=null,`Panel size not found for panel "${L.id}"`),!xL(H,z)){w.current.set(L.id,H);let de=XY(D,L)===D.length-1?H-z:z-H,fe=vfe({delta:de,initialLayout:ne,panelConstraints:N,pivotIndices:oe,prevLayout:ne,trigger:"imperative-api"});eqe(ne,fe)||(g(fe),E.current.layout=fe,J&&J(fe),GY(D,fe,_.current))}}},[]),R=(0,Er.useCallback)((L,J)=>{let{onLayout:ne}=O.current,{layout:D,panelDataArray:N}=E.current;if(L.constraints.collapsible){let z=N.map(De=>De.constraints),{collapsedSize:H=0,panelSize:oe=0,minSize:Q=0,pivotIndices:de}=c6(N,L,D),fe=J??Q;if(xL(oe,H)){let De=w.current.get(L.id),st=De!=null&&De>=fe?De:fe,Bt=XY(N,L)===N.length-1?oe-st:st-oe,Pt=vfe({delta:Bt,initialLayout:D,panelConstraints:z,pivotIndices:de,prevLayout:D,trigger:"imperative-api"});eqe(D,Pt)||(g(Pt),E.current.layout=Pt,ne&&ne(Pt),GY(N,Pt,_.current))}}},[]),I=(0,Er.useCallback)(L=>{let{layout:J,panelDataArray:ne}=E.current,{panelSize:D}=c6(ne,L,J);return yi(D!=null,`Panel size not found for panel "${L.id}"`),D},[]),A=(0,Er.useCallback)((L,J)=>{let{panelDataArray:ne}=E.current,D=XY(ne,L);return nvi({defaultSize:J,dragState:m,layout:y,panelData:ne,panelIndex:D})},[m,y]),B=(0,Er.useCallback)(L=>{let{layout:J,panelDataArray:ne}=E.current,{collapsedSize:D=0,collapsible:N,panelSize:z}=c6(ne,L,J);return yi(z!=null,`Panel size not found for panel "${L.id}"`),N===!0&&xL(z,D)},[]),k=(0,Er.useCallback)(L=>{let{layout:J,panelDataArray:ne}=E.current,{collapsedSize:D=0,collapsible:N,panelSize:z}=c6(ne,L,J);return yi(z!=null,`Panel size not found for panel "${L.id}"`),!N||f6(z,D)>0},[]),q=(0,Er.useCallback)(L=>{let{panelDataArray:J}=E.current;J.push(L),J.sort((ne,D)=>{let N=ne.order,z=D.order;return N==null&&z==null?0:N==null?-1:z==null?1:N-z}),E.current.panelDataArrayChanged=!0,b()},[b]);d6(()=>{if(E.current.panelDataArrayChanged){E.current.panelDataArrayChanged=!1;let{autoSaveId:L,onLayout:J,storage:ne}=O.current,{layout:D,panelDataArray:N}=E.current,z=null;if(L){let oe=ivi(L,N,ne);oe&&(w.current=new Map(Object.entries(oe.expandToSizes)),z=oe.layout)}z==null&&(z=rvi({panelDataArray:N}));let H=Vrn({layout:z,panelConstraints:N.map(oe=>oe.constraints)});Urn(D,H)||(g(H),E.current.layout=H,J&&J(H),GY(N,H,_.current))}}),d6(()=>{let L=E.current;return()=>{L.layout=[]}},[]);let Z=(0,Er.useCallback)(L=>{let J=!1,ne=p.current;return ne&&window.getComputedStyle(ne,null).getPropertyValue("direction")==="rtl"&&(J=!0),function(N){N.preventDefault();let z=p.current;if(!z)return()=>null;let{direction:H,dragState:oe,id:Q,keyboardResizeBy:de,onLayout:fe}=O.current,{layout:De,panelDataArray:st}=E.current,{initialLayout:Le}=oe??{},Bt=onn(Q,L,z),Pt=tvi(N,L,H,oe,de,z),Nt=H==="horizontal";Nt&&J&&(Pt=-Pt);let $e=st.map(Ve=>Ve.constraints),Fr=vfe({delta:Pt,initialLayout:Le??De,panelConstraints:$e,pivotIndices:Bt,prevLayout:De,trigger:Krn(N)?"keyboard":"mouse-or-touch"}),ft=!eqe(De,Fr);(Grn(N)||Xrn(N))&&T.current!=Pt&&(T.current=Pt,!ft&&Pt!==0?Nt?Ywt(L,Pt<0?Yrn:Qrn):Ywt(L,Pt<0?enn:tnn):Ywt(L,0)),ft&&(g(Fr),E.current.layout=Fr,fe&&fe(Fr),GY(st,Fr,_.current))}},[]),V=(0,Er.useCallback)((L,J)=>{let{onLayout:ne}=O.current,{layout:D,panelDataArray:N}=E.current,z=N.map(De=>De.constraints),{panelSize:H,pivotIndices:oe}=c6(N,L,D);yi(H!=null,`Panel size not found for panel "${L.id}"`);let de=XY(N,L)===N.length-1?H-J:J-H,fe=vfe({delta:de,initialLayout:D,panelConstraints:z,pivotIndices:oe,prevLayout:D,trigger:"imperative-api"});eqe(D,fe)||(g(fe),E.current.layout=fe,ne&&ne(fe),GY(N,fe,_.current))},[]),Y=(0,Er.useCallback)((L,J)=>{let{layout:ne,panelDataArray:D}=E.current,{collapsedSize:N=0,collapsible:z}=J,{collapsedSize:H=0,collapsible:oe,maxSize:Q=100,minSize:de=0}=L.constraints,{panelSize:fe}=c6(D,L,ne);fe!=null&&(z&&oe&&xL(fe,N)?xL(N,H)||V(L,H):fe<de?V(L,de):fe>Q&&V(L,Q))},[V]),X=(0,Er.useCallback)((L,J)=>{let{direction:ne}=O.current,{layout:D}=E.current;if(!p.current)return;let N=sqe(L,p.current);yi(N,`Drag handle element not found for id "${L}"`);let z=ann(ne,J);h({dragHandleId:L,dragHandleRect:N.getBoundingClientRect(),initialCursorPosition:z,initialLayout:D})},[]),W=(0,Er.useCallback)(()=>{h(null)},[]),re=(0,Er.useCallback)(L=>{let{panelDataArray:J}=E.current,ne=XY(J,L);ne>=0&&(J.splice(ne,1),delete _.current[L.id],E.current.panelDataArrayChanged=!0,b())},[b]),ue=(0,Er.useMemo)(()=>({collapsePanel:P,direction:n,dragState:m,expandPanel:R,getPanelSize:I,getPanelStyle:A,groupId:f,isPanelCollapsed:B,isPanelExpanded:k,reevaluatePanelConstraints:Y,registerPanel:q,registerResizeHandle:Z,resizePanel:V,startDragging:X,stopDragging:W,unregisterPanel:re,panelGroupElement:p.current}),[P,m,n,R,I,A,f,B,k,Y,q,Z,V,X,W,re]),le={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return(0,Er.createElement)(oqe.Provider,{value:ue},(0,Er.createElement)(c,{...d,children:e,className:r,id:i,ref:p,style:{...le,...l},[Yc.group]:"",[Yc.groupDirection]:n,[Yc.groupId]:f}))}var aSt=(0,Er.forwardRef)((t,e)=>(0,Er.createElement)(cnn,{...t,forwardedRef:e}));cnn.displayName="PanelGroup";aSt.displayName="forwardRef(PanelGroup)";function XY(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function c6(t,e,r){let n=XY(t,e),i=n===t.length-1?[n-1,n]:[n,n+1],a=r[n];return{...e.constraints,panelSize:a,pivotIndices:i}}function uvi({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:n}){(0,Er.useEffect)(()=>{if(t||r==null||n==null)return;let o=sqe(e,n);if(o==null)return;let i=a=>{if(!a.defaultPrevented)switch(a.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{a.preventDefault(),r(a);break}case"F6":{a.preventDefault();let s=o.getAttribute(Yc.groupId);yi(s,`No group element found for id "${s}"`);let u=Cfe(s,n),l=nnn(s,e,n);yi(l!==null,`No resize element found for id "${e}"`);let c=a.shiftKey?l>0?l-1:u.length-1:l+1<u.length?l+1:0;u[c].focus();break}}};return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}},[n,t,e,r])}function sSt({children:t=null,className:e="",disabled:r=!1,hitAreaMargins:n,id:o,onBlur:i,onClick:a,onDragging:s,onFocus:u,onPointerDown:l,onPointerUp:c,style:d={},tabIndex:f=0,tagName:p="div",...m}){var h,y;let g=(0,Er.useRef)(null),b=(0,Er.useRef)({onClick:a,onDragging:s,onPointerDown:l,onPointerUp:c});(0,Er.useEffect)(()=>{b.current.onClick=a,b.current.onDragging=s,b.current.onPointerDown=l,b.current.onPointerUp=c});let _=(0,Er.useContext)(oqe);if(_===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:w,groupId:T,registerResizeHandle:O,startDragging:E,stopDragging:P,panelGroupElement:R}=_,I=rSt(o),[A,B]=(0,Er.useState)("inactive"),[k,q]=(0,Er.useState)(!1),[Z,V]=(0,Er.useState)(null),Y=(0,Er.useRef)({state:A});d6(()=>{Y.current.state=A}),(0,Er.useEffect)(()=>{if(r)V(null);else{let ue=O(I);V(()=>ue)}},[r,I,O]);let X=(h=n?.coarse)!==null&&h!==void 0?h:15,W=(y=n?.fine)!==null&&y!==void 0?y:5;return(0,Er.useEffect)(()=>{if(r||Z==null)return;let ue=g.current;yi(ue,"Element ref not attached");let le=!1;return W_i(I,ue,w,{coarse:X,fine:W},(J,ne,D)=>{if(!ne){B("inactive");return}switch(J){case"down":{B("drag"),le=!1,yi(D,'Expected event to be defined for "down" action'),E(I,D);let{onDragging:N,onPointerDown:z}=b.current;N?.(!0),z?.();break}case"move":{let{state:N}=Y.current;le=!0,N!=="drag"&&B("hover"),yi(D,'Expected event to be defined for "move" action'),Z(D);break}case"up":{B("hover"),P();let{onClick:N,onDragging:z,onPointerUp:H}=b.current;z?.(!1),H?.(),le||N?.();break}}})},[X,w,r,W,O,I,Z,E,P]),uvi({disabled:r,handleId:I,resizeHandler:Z,panelGroupElement:R}),(0,Er.createElement)(p,{...m,children:t,className:e,id:o,onBlur:()=>{q(!1),i?.()},onFocus:()=>{q(!0),u?.()},ref:g,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...d},tabIndex:f,[Yc.groupDirection]:w,[Yc.groupId]:T,[Yc.resizeHandle]:"",[Yc.resizeHandleActive]:A==="drag"?"pointer":k?"keyboard":void 0,[Yc.resizeHandleEnabled]:!r,[Yc.resizeHandleId]:I,[Yc.resizeHandleState]:A})}sSt.displayName="PanelResizeHandle";zr();var dnn=({className:t,...e})=>xfe.createElement(aSt,{className:Se("tw-flex tw-size-full data-[panel-group-direction=vertical]:tw-flex-col",t),...e}),uSt=nSt,fnn=({withHandle:t,className:e,...r})=>xfe.createElement(sSt,{className:Se("tw-relative tw-flex tw-w-px tw-items-center tw-justify-center tw-bg-[var(--background-modifier-border)] after:tw-absolute after:tw-inset-y-0 after:tw-left-1/2 after:tw-w-1 after:tw--translate-x-1/2 focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring focus-visible:tw-ring-offset-1 data-[panel-group-direction=vertical]:tw-h-px data-[panel-group-direction=vertical]:tw-w-full data-[panel-group-direction=vertical]:after:tw-left-0 data-[panel-group-direction=vertical]:after:tw-h-1 data-[panel-group-direction=vertical]:after:tw-w-full data-[panel-group-direction=vertical]:after:tw--translate-y-1/2 data-[panel-group-direction=vertical]:after:tw-translate-x-0 [&[data-panel-group-direction=vertical]>div]:tw-rotate-90",e),...r},t&&xfe.createElement("div",{className:"tw-z-sidedock tw-flex tw-h-4 tw-w-3 tw-items-center tw-justify-center tw-rounded-sm tw-border tw-border-solid tw-border-border"},xfe.createElement(QC,{className:"tw-size-2.5"})));zr();Wb();Dt();Mr();var eQ=require("obsidian"),Ge=$(K()),gnn=$(Im());function cvi({extension:t,size:e="tw-size-4"}){let r=t.toLowerCase().replace("*.","");return["jpg","jpeg","png","gif","svg"].includes(r)?Ge.default.createElement(Mre,{className:`tw-text-context-manager-blue ${e}`}):["mp3","wav","ogg"].includes(r)?Ge.default.createElement(Pre,{className:`tw-text-context-manager-purple ${e}`}):["mp4","mov","avi"].includes(r)?Ge.default.createElement(Are,{className:`tw-text-context-manager-orange ${e}`}):["md","txt","mdx","markdown"].includes(r)?Ge.default.createElement(ju,{className:`${e}`}):Ge.default.createElement(ju,{className:`tw-text-faint ${e}`})}var lSt=({IconComponent:t,title:e,iconColorClassName:r,onAddClick:n,tooltip:o})=>Ge.default.createElement("div",{className:"tw-mb-3 tw-flex tw-items-center tw-justify-between"},Ge.default.createElement("div",{className:"tw-flex tw-items-center"},Ge.default.createElement(t,{className:`tw-mr-2 tw-size-4 ${r}`}),Ge.default.createElement("h3",{className:`tw-text-sm tw-font-semibold ${r}`},e),o&&Ge.default.createElement(to,{buttonClassName:"tw-ml-2 tw-size-4 tw-text-muted",content:Ge.default.createElement("div",{className:"tw-max-w-80"},o)})),Ge.default.createElement(me,{variant:"ghost",size:"fit",className:"tw-text-muted hover:tw-bg-secondary",title:`Add new ${e.toLowerCase()}`,onClick:n},Ge.default.createElement(pw,{className:`tw-size-4 ${r}`}))),pnn=({title:t,IconComponent:e,iconColorClassName:r,items:n,activeItem:o,activeSection:i,sectionType:a,renderIcon:s,onItemClick:u,onAddClick:l,onDeleteItem:c,tooltip:d})=>Ge.default.createElement("div",null,Ge.default.createElement(lSt,{IconComponent:e,title:t,iconColorClassName:r,onAddClick:l,tooltip:d}),Ge.default.createElement("div",{className:"tw-space-y-1"},n.map(f=>Ge.default.createElement("div",{key:f.id,className:Se("tw-group tw-flex tw-cursor-pointer tw-items-center tw-justify-between tw-rounded-md tw-p-2 hover:tw-bg-secondary/50",i===a&&o===f.id&&"tw-bg-secondary tw-text-normal"),onClick:()=>u(f.id,f.name)},Ge.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-items-center"},s?s(f):Ge.default.createElement(e,{className:`tw-mr-2 tw-size-4 ${r}`}),Ge.default.createElement(fc,{className:"tw-flex-1 tw-text-sm"},f.name)),Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ge.default.createElement("span",{className:"tw-text-xs tw-text-muted group-hover:tw-hidden"},f.count||0),Ge.default.createElement(Ho,{className:"tw-hidden tw-size-4 tw-shrink-0 tw-text-muted hover:tw-text-warning group-hover:tw-block group-hover:tw-flex-none",onClick:p=>c(p,f)}))))));function dvi(t,e){if(e.isCurrentProject){if(e.processingFiles.has(t))return{status:"processing"};let r=e.failedByPath.get(t);return r?{status:"failed",failedItem:r}:e.success.has(t)?{status:"success"}:{status:"notStarted"}}return e.cachedFiles.has(t)?{status:"success"}:{status:"notStarted"}}var mnn={success:"Processed",failed:"Failed",processing:"Processing",notStarted:"Not started"};function fvi({item:t,viewMode:e,loadStatus:r,onDelete:n}){let o=t.id.split(".").pop()||"",i=t.isIgnored?Fb:Ho;return Ge.default.createElement("div",{className:"tw-group tw-flex tw-cursor-pointer tw-items-center tw-rounded-lg tw-border tw-border-solid tw-border-border tw-p-2 tw-transition-shadow hover:tw-shadow-md"},Ge.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},Ge.default.createElement(cvi,{extension:o,size:"tw-size-8"})),Ge.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},Ge.default.createElement(fc,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.isIgnored&&Ge.default.createElement("span",{className:"tw-text-sm tw-text-error"}," (Ignored files)"),t.name),t.id&&Ge.default.createElement(fc,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.id)),Ge.default.createElement("div",{className:"tw-ml-auto tw-flex tw-min-w-[24px] tw-items-center tw-justify-end tw-gap-2"},r&&Ge.default.createElement(Xc,{variant:"outline",className:Se("tw-flex tw-items-center tw-gap-1 tw-whitespace-nowrap",r.status==="success"&&"tw-text-success",r.status==="failed"&&"tw-text-error",r.status==="processing"&&"tw-text-accent",r.status==="notStarted"&&"tw-text-muted"),title:r.status==="failed"&&r.failedItem?.error?`Failed: ${r.failedItem.error}`:mnn[r.status]},r.status==="processing"?Ge.default.createElement(Us,{className:"tw-size-3 tw-animate-spin"}):r.status==="success"?Ge.default.createElement(B_,{className:"tw-size-3"}):r.status==="failed"?Ge.default.createElement($b,{className:"tw-size-3"}):Ge.default.createElement("div",{className:"tw-size-2 tw-rounded-full tw-border tw-border-solid tw-border-border"}),Ge.default.createElement("span",{className:"tw-hidden md:tw-inline"},mnn[r.status])),Ge.default.createElement(i,{className:"tw-hidden tw-size-4 tw-shrink-0 tw-text-muted hover:tw-text-warning group-hover:tw-block group-hover:tw-flex-none",onClick:a=>n(a,t)})))}function pvi({item:t,onClick:e}){let r,n;switch(t.type){case"tag":r=T1,n="tw-text-context-manager-orange";break;case"folder":r=Am,n="tw-text-context-manager-yellow";break;case"files":r=ju,n="tw-text-context-manager-blue";break;case"ignoreFiles":r=Ho,n="tw-text-context-manager-red";break}return Ge.default.createElement("div",{className:"tw-group tw-flex tw-cursor-pointer tw-items-center tw-rounded-lg tw-border tw-border-solid tw-border-border tw-p-2 tw-transition-shadow hover:tw-shadow-md",onClick:()=>e(t)},Ge.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},Ge.default.createElement(r,{className:`tw-size-6 ${n}`})),Ge.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},Ge.default.createElement(fc,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.type==="tag"&&Ge.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),t.name),Ge.default.createElement(fc,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.count," ",t.count===1?"item":"items")))}function hnn(t){return"type"in t}function mvi({initialProject:t,onSave:e,onCancel:r,app:n}){let o=eQ.Platform.isMobile,[i]=YJ(),[a,s]=(0,Ge.useState)(null);(0,Ge.useEffect)(()=>{let z=!0;return(async()=>{let oe=await Iw.getInstance().get(t);z&&s(oe)})(),()=>{z=!1}},[t]);let u=(0,Ge.useMemo)(()=>Gu()?.id===t.id,[t.id]),l=(0,Ge.useMemo)(()=>a?.fileContexts?new Set(Object.entries(a.fileContexts).filter(([,z])=>z?.cacheKey).map(([z])=>z)):new Set,[a]),c=(0,Ge.useMemo)(()=>({success:new Set(i.success),failedByPath:new Map(i.failed.map(z=>[z.path,z])),processingFiles:new Set(i.processingFiles),total:new Set(i.total),cachedFiles:l,isCurrentProject:u}),[i.success,i.failed,i.processingFiles,i.total,l,u]),{inclusions:d,exclusions:f}=(0,Ge.useMemo)(()=>Zl({inclusions:t?.contextSource.inclusions,exclusions:t?.contextSource.exclusions,isProject:!0}),[t.contextSource]),p=(0,Ge.useMemo)(()=>n.vault.getFiles(),[n.vault]),m=(0,Ge.useCallback)((z,H,oe)=>{let Q=z.filter(Bt=>fu(Bt,H,oe,!0)),de=(Bt,Pt,Nt,$e)=>{Pt&&Pt.forEach(Fr=>{let ft={[Nt]:[Fr]};fu(Bt,ft,null,!0)&&!$e[Fr].some(Ve=>Ve.id===Bt.path)&&$e[Fr].push({id:Bt.path,name:Bt.basename})})},fe={},De={},st={},Le=[];return(H?.tagPatterns??[]).forEach(Bt=>{fe[Bt]=[]}),(H?.folderPatterns??[]).forEach(Bt=>{De[Bt]=[]}),(H?.extensionPatterns??[]).forEach(Bt=>{st[Bt]=[]}),Q.forEach(Bt=>{de(Bt,H?.tagPatterns,"tagPatterns",fe),de(Bt,H?.folderPatterns,"folderPatterns",De),de(Bt,H?.extensionPatterns,"extensionPatterns",st),H?.notePatterns&&fu(Bt,{notePatterns:H.notePatterns},null,!0)&&!Le.some(Pt=>Pt.id===Bt.path)&&Le.push({id:Bt.path,name:Bt.basename})}),{tags:fe,folders:De,extensions:st,notes:Le}},[]),[h,y]=(0,Ge.useState)(()=>m(p,d,f)),[g,b]=(0,Ge.useState)(()=>{let z=p.filter(H=>f&&fu(H,f,null,!0));return{files:new Set(z)}}),_=(0,Ge.useRef)(h),w=(0,Ge.useRef)(g),[T,O]=(0,Ge.useState)(""),[E,P]=(0,Ge.useState)(null),[R,I]=(0,Ge.useState)(null),A=(0,Ge.useCallback)((z,H)=>{let oe=Object.keys(z.tags),Q=Object.keys(z.folders),de=Object.keys(z.extensions),fe=z.notes.map(De=>{let st=H.find(Le=>Le.path===De.id);if(st)return WG(st)}).filter(Boolean);return sq({tagPatterns:oe,folderPatterns:Q,extensionPatterns:de,notePatterns:fe})},[]),B=(0,Ge.useCallback)(z=>{let H=new Array(...z.files).map(oe=>WG(oe));return sq({notePatterns:H})||""},[]);(0,Ge.useEffect)(()=>{_.current=h,w.current=g},[h,g]);let k=(0,Ge.useMemo)(()=>{let z=[],H=(Q,de)=>{de.forEach(fe=>{Q.some(De=>De.id===fe.id)||Q.push({id:fe.id,name:fe.name})})};return[h.tags,h.folders,h.extensions,{notes:h.notes}].forEach(Q=>{Object.values(Q).forEach(de=>{H(z,de)})}),z},[h]),q=(0,Ge.useCallback)(z=>{let H=[],oe=[],Q=[];return z.split(",").map(fe=>fe.trim()).filter(fe=>fe).forEach(fe=>{fe.startsWith("#")?H.push(fe.substring(1)):fe.startsWith(".")||fe.startsWith("*.")?Q.push(fe.replace("*","")):oe.push(fe)}),{tags:H,titles:oe,extensions:Q}},[]),Z=(0,Ge.useCallback)(z=>[...z].sort((H,oe)=>H.name.toLowerCase().localeCompare(oe.name.toLowerCase())),[]),V=(0,Ge.useMemo)(()=>{if(T){let z=q(T);return k.filter(H=>{let oe=p.find(Le=>Le.path===H.id);if(!oe)return!1;let Q=oe.extension==="md",de=z.tags.length>0&&Q&&z.tags.some(Le=>sO(oe).some(Pt=>(Pt.startsWith("#")?Pt.substring(1):Pt).toLowerCase().includes(Le.toLowerCase()))),fe=z.titles.length>0&&z.titles.some(Le=>oe.basename.toLowerCase().includes(Le.toLowerCase())),De=z.extensions.length>0&&z.extensions.some(Le=>`.${oe.extension}`.toLowerCase()===Le.toLowerCase());return z.tags.length>0||z.titles.length>0||z.extensions.length>0?de||fe||De:!1}).map(H=>({id:H.id,name:H.name}))}if(E==="tags"&&R){let z=h.tags[R];return z||[]}if(E==="folders"&&R){let z=h.folders[R];return z||[]}if(E==="files")return h.notes;if(E==="extensions"&&R){let z=h.extensions[R];return z||[]}if(E==="ignoreFiles")return Array.from(g.files).map(z=>({id:z.path,name:z.basename}));if(!E){let z=Z(Object.entries(h.tags).map(([de,fe])=>({id:`tag:${de}`,name:de.slice(1),type:"tag",originalId:de,count:fe.length}))),H=Z(Object.entries(h.folders).map(([de,fe])=>({id:`folder:${de}`,name:de,type:"folder",originalId:de,count:fe.length}))),oe=h.notes.length>0?[{id:"files:all",name:"Files",type:"files",count:h.notes.length}]:[],Q=g.files.size>0?[{id:"ignoreFiles:all",name:"Ignore Files",type:"ignoreFiles",count:g.files.size}]:[];return[...z,...H,...oe,...Q]}return[]},[T,E,R,q,k,p,h.tags,h.folders,h.notes,h.extensions,g.files,Z]),Y=(0,Ge.useCallback)((z,H)=>Object.entries(z).sort(([oe],[Q])=>oe.localeCompare(Q)).map(([oe,Q])=>({id:oe,name:H?H(oe):oe,count:Q.length})),[]),X=(0,Ge.useCallback)((z,H,oe)=>{let Q=De=>p.filter(st=>fu(st,De,null,!0)).map(st=>({id:st.path,name:st.basename})),de=[...w.current.files],fe=Q(oe).map(De=>({...De,isIgnored:de.some(st=>st.path===De.id)}));y(De=>({...De,[z]:{...De[z],[H]:fe}}))},[p]),W=(0,Ge.useCallback)((z,H)=>{let oe={tags:{...z.tags},folders:{...z.folders},extensions:{...z.extensions},notes:[...z.notes]},Q=de=>{Object.keys(de).forEach(fe=>{de[fe]=de[fe].filter(De=>De.id!==H)})};return Q(oe.tags),Q(oe.folders),Q(oe.extensions),oe.notes=oe.notes.filter(de=>de.id!==H),oe},[]),re=(0,Ge.useCallback)((z,H=null,oe=!0)=>{P(z),I(H),oe&&O("")},[]),ue=(0,Ge.useMemo)(()=>{let z=H=>(oe,Q)=>{oe.stopPropagation(),y(de=>{let fe={...de[H]};return delete fe[Q.id],{...de,[H]:fe}})};return{delete:{tag:z("tags"),folder:z("folders"),extension:z("extensions")},add:{tag:()=>{new KY(n,H=>{let oe=eae(H);X("tags",oe,{tagPatterns:[oe]})}).open()},folder:()=>{new WY(n,H=>{X("folders",H,{folderPatterns:[H]})}).open()},file:()=>{new _fe({app:n,onFileSelect:H=>{h.notes.find(Q=>Q.id===H.path)||(b(Q=>{let de=new Set(Q.files);return de.delete(H),{...Q,files:de}}),y(Q=>({...Q,notes:[...Q.notes,{id:H.path,name:H.basename}]})))},excludeFilePaths:[],titleOnly:!1}).open()},extension:()=>{new eQ.Notice("Adding extension is temporarily not supported.")},ignoreFile:()=>{new _fe({app:n,onFileSelect:H=>{g.files.has(H)||(b(Q=>{let de=new Set(Q.files);return de.add(H),{...Q,files:de}}),y(Q=>W(Q,H.path)))},excludeFilePaths:[],titleOnly:!1}).open()}},click:{tag:H=>{re("tags",H)},folder:H=>{re("folders",H)},extension:H=>{re("extensions",H)},files:()=>{re("files")},ignoreFiles:()=>{re("ignoreFiles")}}}},[n,h.notes,g.files,X,W,re]),le=(0,Ge.useCallback)(z=>{z.type==="tag"&&z.originalId?ue.click.tag(z.originalId):z.type==="folder"&&z.originalId?ue.click.folder(z.originalId):z.type==="files"?ue.click.files():z.type==="ignoreFiles"&&ue.click.ignoreFiles()},[ue]),L=()=>T?`Search Results for: "${T}"`:E==="tags"&&R?`Tag: ${R}`:E==="folders"&&R?`Folder: ${R}`:E==="files"?"Files":E==="extensions"&&R?`Extension: ${R}`:E==="ignoreFiles"?"Ignore Files":"All Categories",J=(z,H)=>{z.stopPropagation();let oe=p.find(Q=>Q.path===H.id);oe&&(b(Q=>{let de=new Set(Q.files);return de.add(oe),{...Q,files:de}}),y(Q=>W(Q,H.id)))},ne=(0,Ge.useCallback)(()=>{let z=A(_.current,p),H=B(w.current),{inclusions:oe,exclusions:Q}=Zl({inclusions:z,exclusions:H,isProject:!0}),de=m(p,oe,Q);y(de)},[p,B,A,m]),D=(z,H)=>{z.stopPropagation();let oe=p.find(Q=>Q.path===H.id);oe&&(b(Q=>{let de=new Set(Q.files);return de.delete(oe),{...Q,files:de}}),ne())},N=()=>{let z=A(h,p),H=B(g);e({...t,contextSource:{...t.contextSource,inclusions:z,exclusions:H}})};return Ge.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ge.default.createElement(dnn,{direction:"horizontal",className:"tw-flex-1"},Ge.default.createElement(uSt,{defaultSize:o?35:30,minSize:20,maxSize:40},Ge.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ge.default.createElement("div",{className:"tw-border-b tw-p-4"},Ge.default.createElement("h2",{className:"tw-text-lg tw-font-semibold"},"File Context")),Ge.default.createElement(CU,{className:"tw-max-h-[500px] tw-flex-1"},Ge.default.createElement("div",{className:"tw-space-y-6 tw-p-4"},Ge.default.createElement(pnn,{title:"Tags",IconComponent:T1,iconColorClassName:"tw-text-context-manager-orange",items:Y(h.tags,z=>z.slice(1)),activeItem:R,activeSection:E,sectionType:"tags",renderIcon:z=>Ge.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),onItemClick:ue.click.tag,onAddClick:ue.add.tag,onDeleteItem:(z,H)=>ue.delete.tag(z,H),tooltip:"must be in note property"}),Ge.default.createElement(lC,null),Ge.default.createElement(pnn,{title:"Folders",IconComponent:Am,iconColorClassName:"tw-text-context-manager-yellow",items:Y(h.folders),activeItem:R,activeSection:E,sectionType:"folders",onItemClick:ue.click.folder,onAddClick:ue.add.folder,onDeleteItem:(z,H)=>ue.delete.folder(z,H)}),Ge.default.createElement(lC,null),Ge.default.createElement("div",null,Ge.default.createElement(lSt,{IconComponent:ju,title:"Files",iconColorClassName:"tw-text-context-manager-blue",onAddClick:ue.add.file}),Ge.default.createElement("div",{className:Se("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",E==="files"&&"tw-bg-secondary tw-text-normal"),onClick:ue.click.files},"Files (",h.notes.length,")")),Ge.default.createElement(lC,null),Ge.default.createElement("div",null,Ge.default.createElement(lSt,{IconComponent:Ho,title:"Ignore Files",iconColorClassName:"tw-text-context-manager-red",onAddClick:ue.add.ignoreFile}),Ge.default.createElement("div",{className:Se("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",E==="ignoreFiles"&&"tw-bg-secondary tw-text-normal"),onClick:ue.click.ignoreFiles},"Files (",g.files.size,")")))))),Ge.default.createElement(fnn,{withHandle:!0}),Ge.default.createElement(uSt,{defaultSize:o?65:70},Ge.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ge.default.createElement("div",{className:"tw-border-b tw-p-4"},Ge.default.createElement(zZ,{placeholder:"Custom search: title, #tag1, .jpg",value:T,onChange:z=>{O(z),z&&re("search",null,!1)}})),Ge.default.createElement("div",{className:"tw-p-4"},Ge.default.createElement("h3",{className:"tw-text-lg tw-font-medium tw-text-muted"},L())),Ge.default.createElement(CU,{className:"tw-max-h-[400px] tw-flex-1 tw-p-4 tw-pt-0"},V.length===0?Ge.default.createElement("div",{className:"tw-mt-10 tw-text-center tw-text-muted"},E?"No items found.":"No categories found. Add tags, folders, or files using the sidebar."):Ge.default.createElement("div",{className:"tw-space-y-2",style:{display:"block"}},E||T?Z(V).map(z=>hnn(z)?null:Ge.default.createElement(fvi,{key:z.id,item:z,viewMode:"list",loadStatus:E==="ignoreFiles"||z.isIgnored?void 0:dvi(z.id,c),onDelete:E==="ignoreFiles"||z.isIgnored?D:J})).filter(Boolean):V.map(z=>hnn(z)?Ge.default.createElement(pvi,{key:z.id,item:z,onClick:le}):null).filter(Boolean)))))),Ge.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2 tw-border-t tw-p-1"},Ge.default.createElement(me,{variant:"ghost",onClick:r},"Cancel"),Ge.default.createElement(me,{onClick:N},"Save")))}var QY=class extends eQ.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r,modalEl:n}=this;this.root=(0,gnn.createRoot)(r),n.style.minWidth="50vw";let o=a=>{this.onSave(a),this.close()},i=()=>{this.close()};this.root.render(Ge.default.createElement(mvi,{initialProject:this.initialProject,onSave:o,onCancel:i,app:this.app}))}onClose(){this.root&&this.root.unmount()}};xn();var oz=$(K());zr();function Tfe({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a,suffix:s}){let[u,l]=(0,oz.useState)(t);return(0,oz.useEffect)(()=>{l(t)},[t]),oz.default.createElement("div",{className:Se("tw-flex tw-items-center tw-gap-4",a)},oz.default.createElement(xde,{value:[u],onValueChange:([c])=>l(c),onValueCommit:([c])=>e?.(c),min:r,max:n,step:o,disabled:i,className:"tw-flex-1"}),oz.default.createElement("div",{className:"tw-min-w-[60px] tw-text-right tw-text-sm tw-tabular-nums"},u>=1e3?`${u%1e3===0?u/1e3:(u/1e3).toFixed(1)}k`:u,s))}gr();Wb();Qe();Dt();var Ofe=require("obsidian"),gn=$(K()),ynn=$(Im());function hvi({initialProject:t,onSave:e,onCancel:r}){let n=kr(),[o,i]=(0,gn.useState)(!1),[a,s]=(0,gn.useState)({name:!1,systemPrompt:!1,projectModelKey:!1,inclusions:!1}),[u,l]=(0,gn.useState)(t||{id:TNt(),name:"",description:"",systemPrompt:"",projectModelKey:"",modelConfigs:{temperature:Ab.TEMPERATURE,maxTokens:Ab.MAX_TOKENS},contextSource:{inclusions:"",exclusions:"",webUrls:"",youtubeUrls:""},created:Date.now(),UsageTimestamps:Date.now()}),c=uA(u.contextSource.inclusions||u.contextSource.exclusions||"nothing").reverse().join(","),d=h=>{let y=h;if(t?.id){let b=Gu();b?.id===h.id&&(y=b)}new QY(app,async b=>{l(b)},y).open()},f=()=>u.name&&u.projectModelKey,p=(h,y)=>{l(g=>{if(typeof y=="string"&&h==="projectModelKey"&&(y=y.trim()),Array.isArray(y)&&y.every(b=>typeof b=="string")&&(y=y.map(b=>b.trim()).filter(Boolean)),h.includes(".")){let[b,_]=h.split("."),T=g[b];if(typeof T=="object"&&T!==null)return{...g,[b]:{...T,[_]:y}}}return{...g,[h]:y}})},m=async()=>{u.name&&(u.name=u.name.trim());let y=["name","projectModelKey"].filter(g=>!u[g]);if(y.length>0){s(g=>({...g,...Object.fromEntries(y.map(b=>[b,!0]))})),new Ofe.Notice("Please fill in all required fields");return}try{i(!0),await e(u)}catch(g){new Ofe.Notice(Wr(g)),s(b=>({...b,name:!0}))}finally{i(!1)}};return gn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-p-4"},gn.default.createElement("div",{className:"tw-mb-2 tw-text-xl tw-font-bold tw-text-normal"},t?"Edit Project":"New Project"),gn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},gn.default.createElement(ko,{label:"Project Name",required:!0,error:a.name&&!u.name,errorMessage:"Project name is required"},gn.default.createElement(ni,{type:"text",value:u.name,onChange:h=>p("name",h.target.value),onBlur:()=>s(h=>({...h,name:!0})),className:"tw-w-full"})),gn.default.createElement(ko,{label:"Description",description:"Briefly describe the purpose and goals of the project"},gn.default.createElement(ni,{type:"text",value:u.description,onChange:h=>p("description",h.target.value),className:"tw-w-full"})),gn.default.createElement(ko,{label:"Project System Prompt",description:"Custom instructions for how the AI should behave in this project context"},gn.default.createElement(rLe,null),gn.default.createElement(n_,{value:u.systemPrompt,onChange:h=>p("systemPrompt",h.target.value),onBlur:()=>s(h=>({...h,systemPrompt:!0})),placeholder:"Enter your project system prompt here... Use {[[Note Name]]} to include note contents.",className:"tw-min-h-32"})),gn.default.createElement(ko,{label:"Default Model",required:!0,error:a.projectModelKey&&!u.projectModelKey,errorMessage:"Default model is required"},gn.default.createElement(dN,{value:u.projectModelKey,onChange:h=>{let y=h.target.value,g=n.activeModels.find(w=>w.enabled&&no(w)===y);if(!g)return;let{hasApiKey:b,errorNotice:_}=qJ(g,n);p("projectModelKey",y)},onBlur:()=>s(h=>({...h,projectModelKey:!0})),placeholder:"Select a model",options:n.activeModels.filter(h=>h.enabled&&h.projectEnabled).map(h=>({label:QX(h),value:no(h)}))})),gn.default.createElement("div",{className:"tw-space-y-4"},gn.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Model Configuration"),gn.default.createElement("div",{className:"tw-grid tw-grid-cols-1 tw-gap-4"},gn.default.createElement(ko,{label:"Temperature"},gn.default.createElement(Tfe,{value:u.modelConfigs?.temperature??Ab.TEMPERATURE,onChange:h=>p("modelConfigs.temperature",h),min:0,max:2,step:.01,className:"tw-w-full"})),gn.default.createElement(ko,{label:"Token Limit"},gn.default.createElement(Tfe,{value:u.modelConfigs?.maxTokens??Ab.MAX_TOKENS,onChange:h=>p("modelConfigs.maxTokens",h),min:1,max:65e3,step:1,className:"tw-w-full"})))),gn.default.createElement("div",{className:"tw-space-y-4"},gn.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Context Sources"),gn.default.createElement(ko,{label:gn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},gn.default.createElement("span",null,"File Context"),gn.default.createElement(to,{buttonClassName:"tw-size-4 tw-text-muted",content:gn.default.createElement("div",{className:"tw-max-w-80"},gn.default.createElement("strong",null,"Supported File Types:"),gn.default.createElement("br",null),gn.default.createElement("strong",null,"\u2022 Documents:")," pdf, doc, docx, ppt, pptx, epub, txt, rtf and many more",gn.default.createElement("br",null),gn.default.createElement("strong",null,"\u2022 Images:")," jpg, png, svg, gif, bmp, webp, tiff",gn.default.createElement("br",null),gn.default.createElement("strong",null,"\u2022 Spreadsheets:")," xlsx, xls, csv, numbers",gn.default.createElement("br",null),gn.default.createElement("br",null),"Non-markdown files are converted to markdown in the background.",gn.default.createElement("br",null),gn.default.createElement("strong",null,"Rate limit:")," 50 files or 100MB per 3 hours, whichever is reached first.")})),description:"Define patterns to include specific files, folders or tags (specified in the note property) in the project context."},gn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},gn.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-row"},gn.default.createElement(fc,{className:"tw-max-w-[100px] tw-text-sm tw-text-accent"},c)),gn.default.createElement(me,{variant:"secondary",onClick:()=>{d(u)}},"Manage Context"))),gn.default.createElement(ko,{label:"Web URLs"},gn.default.createElement(n_,{value:u.contextSource?.webUrls,onChange:h=>{let g=h.target.value.split(`
`).map(b=>{if(!b.trim())return b;try{return new URL(b.trim()),b}catch{return b}});p("contextSource.webUrls",g.join(`
`))},placeholder:"Enter web URLs, one per line",className:"tw-min-h-20 tw-w-full"})),gn.default.createElement(ko,{label:"YouTube URLs"},gn.default.createElement(n_,{value:u.contextSource?.youtubeUrls,onChange:h=>{let g=h.target.value.split(`
`).map(b=>{if(!b.trim())return b;try{let _=new URL(b.trim());return _.hostname.includes("youtube.com")||_.hostname.includes("youtu.be"),b}catch{return b}});p("contextSource.youtubeUrls",g.join(`
`))},placeholder:"Enter YouTube URLs, one per line",className:"tw-min-h-20 tw-w-full"})))),gn.default.createElement("div",{className:"tw-mt-4 tw-flex tw-items-center tw-justify-end tw-gap-2"},gn.default.createElement(me,{variant:"ghost",onClick:r,disabled:o},"Cancel"),gn.default.createElement(me,{onClick:m,disabled:o||!f()},o?"Saving...":"Save")))}var Efe=class extends Ofe.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r}=this;this.root=(0,ynn.createRoot)(r);let n=async i=>{await this.onSave(i),this.close()},o=()=>{this.close()};this.root.render(gn.default.createElement(hvi,{initialProject:this.initialProject,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};xn();zr();Xe();Qe();t1();Mr();var _nn=require("obsidian"),at=$(K());function gvi(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 bnn(t,e,r={}){return!t||t.length===0?[]:e.trim()?t.filter(n=>gvi(n,e,r)):t}function yvi(t){let[e,r]=(0,at.useState)(()=>t?.getRevision()??0);return(0,at.useEffect)(()=>{if(!t){r(0);return}return r(t.getRevision()),t.subscribe(()=>{r(t.getRevision())})},[t]),e}function bvi({project:t,loadContext:e,onEdit:r,onDelete:n}){return at.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)},at.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2 tw-overflow-hidden"},at.default.createElement("div",{className:"tw-text-accent"},at.default.createElement(Am,{className:"tw-size-4"})),at.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-col tw-gap-1.5 tw-overflow-hidden"},at.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[13px] tw-font-medium tw-text-normal"},t.name),t.description&&at.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[12px] tw-text-muted/80"},t.description))),at.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-1 tw-opacity-100 tw-transition-opacity tw-duration-200"},at.default.createElement(vn,null,at.default.createElement(wn,{asChild:!0},at.default.createElement(me,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),r(t)}},at.default.createElement(Lb,{className:"tw-size-4"}))),at.default.createElement(pn,{side:"bottom"},"Edit Project")),at.default.createElement(vn,null,at.default.createElement(wn,{asChild:!0},at.default.createElement(me,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),e(t)}},at.default.createElement($5,{className:"tw-size-4"}))),at.default.createElement(pn,{side:"bottom"},"Start Chat")),at.default.createElement(vn,null,at.default.createElement(wn,{asChild:!0},at.default.createElement(me,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),new nu(app,()=>n(t),`Are you sure you want to delete project "${t.name}"?`,"Delete Project").open()}},at.default.createElement(Iy,{className:"tw-size-4"}))),at.default.createElement(pn,{side:"bottom"},"Delete Project"))))}var cSt=(0,at.memo)(({className:t,projects:e,defaultOpen:r=!1,app:n,plugin:o,onProjectAdded:i,onEditProject:a,hasMessages:s=!1,showChatUI:u,onClose:l,onProjectClose:c})=>{let[d,f]=(0,at.useState)(r),[p,m]=(0,at.useState)(!1),[h,y]=(0,at.useState)(null),[g,b]=(0,at.useState)(""),_=ez(),w=kr(),T=o?.projectManager?.getProjectUsageTimestampsManager?.(),O=yvi(T);(0,at.useEffect)(()=>{s&&f(!1)},[s]);let E=(0,at.useMemo)(()=>iO(e,w.projectListSortStrategy,{getName:q=>q.name,getCreatedAtMs:q=>q.created,getLastUsedAtMs:q=>T?T.getEffectiveLastUsedAt(q.id,q.UsageTimestamps):q.UsageTimestamps}),[e,w.projectListSortStrategy,T,O]),P=(0,at.useMemo)(()=>bnn(E,g),[E,g]),R=()=>{new Efe(n,async Z=>{i(Z)}).open()},I=q=>{new Efe(n,async V=>{a(q,V),h&&h.name===q.name&&y(V)},q).open()},A=q=>{let V=(e||[]).filter(Y=>Y.name!==q.name);h?.name===q.name&&B(!1),Re("projectList",V),new _nn.Notice(`Project "${q.name}" deleted successfully`)},B=(q,Z)=>{if(q){if(!Z){ie("Must be exist one project.");return}y(Z),m(!0),f(!1)}else{y(null),m(!1),f(!0),u(!1),C4(null);return}},k=q=>{y(q),m(!0),f(!1),u(!0),C4(q),setTimeout(()=>{_.focusInput()},0)};return at.default.createElement("div",{className:Se("tw-flex tw-flex-col",t)},at.default.createElement("div",{className:"tw-overflow-y-auto"},at.default.createElement("div",{className:"tw-flex tw-flex-col"},p&&h?at.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-2 tw-py-3"},at.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},at.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),at.default.createElement(L3,{value:h.name,onValueChange:q=>{let Z=E.find(V=>V.name===q);Z&&k(Z)}},at.default.createElement(OU,{className:"tw-truncate"},at.default.createElement(F3,null,at.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},at.default.createElement(Am,{className:"tw-size-4 tw-shrink-0 tw-text-accent/70"}),at.default.createElement("span",{className:"tw-flex-1 tw-truncate"},h.name)))),at.default.createElement(EU,{className:"tw-truncate"},E.map(q=>at.default.createElement(PU,{key:q.name,value:q.name,className:"tw-flex tw-items-center tw-gap-2"},at.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},at.default.createElement(Am,{className:"tw-size-4 tw-shrink-0"}),at.default.createElement("span",{className:"tw-truncate"},q.name))))))),at.default.createElement("div",{className:"tw-ml-1 tw-flex tw-items-center tw-gap-2"},at.default.createElement(me,{variant:"secondary",onClick:()=>I(h),className:"hover:tw-text-on-accent hover:tw-bg-accent/50"},at.default.createElement(Lb,{className:"tw-mr-1 tw-size-4"}),"Edit"),at.default.createElement(vn,null,at.default.createElement(wn,{asChild:!0},at.default.createElement(me,{variant:"ghost2",size:"icon",onClick:()=>{B(!1),c()},"aria-label":"Close Current Project"},at.default.createElement(Ho,{className:"tw-size-4"}))),at.default.createElement(pn,{side:"bottom"},"Close Current Project")))):at.default.createElement(uy,{open:d,onOpenChange:f,className:"tw-transition-all tw-duration-200 tw-ease-in-out"},at.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-4 tw-py-3"},at.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},at.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),at.default.createElement(to,{content:"Manage your projects with different contexts and configurations.",contentClassName:"tw-w-64",buttonClassName:"tw-size-4 tw-text-muted"})),at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},at.default.createElement(me,{className:"tw-px-2",variant:"secondary",onClick:R},"Create",at.default.createElement(Fb,{className:"tw-size-3"})),e.length>0&&at.default.createElement(AT,{asChild:!0},at.default.createElement(me,{variant:"ghost2",size:"icon"},d?at.default.createElement(Og,{className:"tw-size-5"}):at.default.createElement(Ji,{className:"tw-size-5"}))),at.default.createElement(vn,null,at.default.createElement(wn,{asChild:!0},at.default.createElement(me,{variant:"ghost2",size:"icon",onClick:()=>l(),"aria-label":"close project mode"},at.default.createElement(Ho,{className:"tw-size-4"}))),at.default.createElement(pn,{side:"bottom"},"Close Project Mode")))),e.length===0&&at.default.createElement("div",{className:"tw-px-4 tw-py-2 tw-text-xs tw-text-muted tw-bg-secondary/30"},"No projects available"),at.default.createElement(ly,{className:"tw-transition-all tw-duration-200 tw-ease-in-out"},at.default.createElement("div",{className:"tw-relative tw-bg-secondary/30"},e.length>0&&at.default.createElement("div",{className:"tw-px-4 tw-pb-2 tw-pt-3"},at.default.createElement(zZ,{value:g,onChange:b,placeholder:"Search projects..."})),at.default.createElement("div",{className:"tw-max-h-[calc(3*5.7rem)] tw-overflow-y-auto tw-px-4 tw-pb-6 tw-pt-3"},at.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"},P.map(q=>at.default.createElement(bvi,{key:q.name,project:q,loadContext:k,onEdit:I,onDelete:A}))),g.trim()&&P.length===0&&at.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-py-8 tw-text-muted"},at.default.createElement(B4,{className:"tw-mb-3 tw-size-12 tw-text-muted/50"}),at.default.createElement("p",{className:"tw-text-base tw-font-medium"},"No matching projects found"),at.default.createElement("p",{className:"tw-mt-1 tw-text-sm"},"Try searching with different keywords"))),e.length>0&&at.default.createElement("div",{className:"tw-pointer-events-none tw-absolute tw-inset-x-0 tw-bottom-0 tw-h-8 tw-bg-[linear-gradient(to_top,var(--background-primary)_0%,var(--background-primary)_30%,transparent_100%)]"}))))),!p&&at.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"},at.default.createElement("div",{className:"tw-max-w-[600px] tw-space-y-4"},at.default.createElement("p",{className:"tw-text-center tw-text-base"},"Create your project-based AI assistants with custom instructions, context, and model configurations."),at.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 tw-text-sm"},at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},at.default.createElement($5,{className:"tw-size-4"}),at.default.createElement("span",null,"Click a project card to start chatting")))))))});cSt.displayName="ProjectList";var ea=$(K()),dqe=$(K());var Pfe=$(K());var fSt=$(K(),1);var TL=$(K(),1),vnn=$(wt(),1);function wnn(t,e=[]){let r=[];function n(i,a){let s=TL.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=TL.useMemo(()=>m,Object.values(m));return(0,vnn.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=TL.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=>TL.createContext(a));return function(s){let u=s?.[t]||i;return TL.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,_vi(o,...e)]}function _vi(...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 TL.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Tnn=$(K(),1),Ovi=$(yu(),1);var bh=$(K(),1);var vvi=$(K(),1);function Snn(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Cnn(...t){return e=>{let r=!1,n=t.map(o=>{let i=Snn(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():Snn(t[o],null)}}}}var uqe=$(wt(),1);function xnn(t){let e=wvi(t),r=bh.forwardRef((n,o)=>{let{children:i,...a}=n,s=bh.Children.toArray(i),u=s.find(Cvi);if(u){let l=u.props.children,c=s.map(d=>d===u?bh.Children.count(l)>1?bh.Children.only(null):bh.isValidElement(l)?l.props.children:null:d);return(0,uqe.jsx)(e,{...a,ref:o,children:bh.isValidElement(l)?bh.cloneElement(l,void 0,c):null})}return(0,uqe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function wvi(t){let e=bh.forwardRef((r,n)=>{let{children:o,...i}=r;if(bh.isValidElement(o)){let a=Tvi(o),s=xvi(i,o.props);return o.type!==bh.Fragment&&(s.ref=n?Cnn(n,a):a),bh.cloneElement(o,s)}return bh.Children.count(o)>1?bh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Svi=Symbol("radix.slottable");function Cvi(t){return bh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Svi}function xvi(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Tvi(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 Onn=$(wt(),1),Evi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dSt=Evi.reduce((t,e)=>{let r=xnn(`Primitive.${e}`),n=Tnn.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Onn.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var lqe=$(wt(),1),pSt="Progress",mSt=100,[Pvi,z9s]=wnn(pSt),[Mvi,Rvi]=Pvi(pSt),Mnn=fSt.forwardRef((t,e)=>{let{__scopeProgress:r,value:n=null,max:o,getValueLabel:i=Ivi,...a}=t;(o||o===0)&&!Enn(o)&&console.error(Avi(`${o}`,"Progress"));let s=Enn(o)?o:mSt;n!==null&&!Pnn(n,s)&&console.error(Nvi(`${n}`,"Progress"));let u=Pnn(n,s)?n:null,l=cqe(u)?i(u,s):void 0;return(0,lqe.jsx)(Mvi,{scope:r,value:u,max:s,children:(0,lqe.jsx)(dSt.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":cqe(u)?u:void 0,"aria-valuetext":l,role:"progressbar","data-state":Ann(u,s),"data-value":u??void 0,"data-max":s,...a,ref:e})})});Mnn.displayName=pSt;var Rnn="ProgressIndicator",Inn=fSt.forwardRef((t,e)=>{let{__scopeProgress:r,...n}=t,o=Rvi(Rnn,r);return(0,lqe.jsx)(dSt.div,{"data-state":Ann(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...n,ref:e})});Inn.displayName=Rnn;function Ivi(t,e){return`${Math.round(t/e*100)}%`}function Ann(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function cqe(t){return typeof t=="number"}function Enn(t){return cqe(t)&&!isNaN(t)&&t>0}function Pnn(t,e){return cqe(t)&&!isNaN(t)&&t<=e&&t>=0}function Avi(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${mSt}\`.`}function Nvi(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
  - a positive number
  - less than the value passed to \`max\` (or ${mSt} if no \`max\` prop is set)
  - \`null\` or \`undefined\` if the progress is indeterminate.

Defaulting to \`null\`.`}var hSt=Mnn,Nnn=Inn;zr();var Mfe=Pfe.forwardRef(({className:t,value:e,...r},n)=>Pfe.createElement(hSt,{ref:n,className:Se("tw-relative tw-h-2 tw-w-full tw-overflow-hidden tw-rounded-full tw-bg-interactive-accent/20 tw-border-interactive-accent/30",t),...r},Pfe.createElement(Nnn,{className:"tw-size-full tw-flex-1 tw-bg-interactive-accent tw-transition-all",style:{transform:`translateX(-${100-Math.min(Math.max(e||0,0),100)}%)`}})));Mfe.displayName=hSt.displayName;xn();Mr();na();function gSt({onClose:t,onPause:e,onResume:r,onStop:n}){let[o]=e5(),i=(0,dqe.useRef)(null),{isActive:a,isPaused:s,indexedCount:u,totalFiles:l,errors:c,completionStatus:d}=o,f=l>0?Math.round(u/l*100):0;(0,dqe.useEffect)(()=>(i.current&&(clearTimeout(i.current),i.current=null),!a&&d!=="none"&&!(d==="error"&&l===0)&&(i.current=setTimeout(()=>{t()},3e3)),()=>{i.current&&(clearTimeout(i.current),i.current=null)}),[a,d,l,t]);let p=()=>d==="success"?l===0?"Index Up to Date":"Indexing Complete":d==="cancelled"?"Indexing Cancelled":d==="error"?l===0?"Indexing Failed":"Indexing Complete (with errors)":s?"Indexing Paused":"Indexing Vault";return ea.createElement(vL,{className:"tw-w-full tw-border tw-border-solid tw-border-border tw-bg-transparent tw-shadow-none"},ea.createElement(wL,null,ea.createElement(l6,{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},ea.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},!a&&d!=="none"?d==="error"?ea.createElement($b,{className:"tw-size-4 tw-text-error"}):d==="success"?ea.createElement(B_,{className:"tw-size-4 tw-text-success"}):ea.createElement(YC,{className:"tw-size-4"}):s?ea.createElement(L5,{className:"tw-size-4 tw-text-warning"}):ea.createElement(Us,{className:"tw-size-4 tw-animate-spin tw-text-accent"}),ea.createElement("span",{className:"tw-text-sm"},p())),ea.createElement(me,{size:"sm",variant:"ghost2",className:"tw-size-6 tw-p-0 tw-text-muted",title:"Close",onClick:t},ea.createElement(Ho,{className:"tw-size-4"})))),ea.createElement(SL,{className:"tw-space-y-3"},l>0&&ea.createElement("div",{className:"tw-space-y-2"},ea.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-text-sm"},ea.createElement("span",{className:"tw-text-muted"},u,"/",l," files"),ea.createElement("span",{className:"tw-font-medium"},f,"%")),ea.createElement(Mfe,{value:f,className:"tw-h-2"})),c.length>0&&ea.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},ea.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ea.createElement($b,{className:"tw-size-3 tw-text-error"}),ea.createElement(Xc,{variant:"destructive",className:"tw-text-xs"},c.length," ",c.length===1?"error":"errors")),l===0&&c[0]&&ea.createElement("span",{className:"tw-text-xs tw-text-error"},c[0])),a&&ea.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ea.createElement(me,{size:"sm",variant:"ghost",className:"tw-h-6 tw-px-2 tw-text-xs",onClick:s?r:e},s?ea.createElement(ea.Fragment,null,ea.createElement(kre,{className:"tw-mr-1 tw-size-3"}),"Resume"):ea.createElement(ea.Fragment,null,ea.createElement(L5,{className:"tw-mr-1 tw-size-3"}),"Pause")),ea.createElement(me,{size:"sm",variant:"ghost",className:"tw-h-6 tw-px-2 tw-text-xs",onClick:n},ea.createElement(z4,{className:"tw-mr-1 tw-size-3"}),"Stop"))))}var On=$(K()),ySt=$(K());Mr();na();xn();Xe();function bSt({plugin:t,setHiddenCard:e,onEditContext:r}){let[n]=YJ(),o=n.total,i=n.success,a=n.failed,s=n.processingFiles,[u,l]=(0,ySt.useState)(!1),[c,d]=(0,ySt.useState)(!1),f=i.length+a.length,p=o.length>0?Math.round(f/o.length*100):0,m=y=>y.path,h=async y=>{if(!t?.projectManager){ie("ProjectManager not available");return}try{await t.projectManager.retryFailedItem(y)}catch(g){ie(`Error retrying failed item: ${g}`)}};return On.createElement(vL,{className:"tw-w-full tw-border tw-border-solid tw-border-border tw-bg-transparent tw-shadow-none"},On.createElement(wL,null,On.createElement(l6,{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},On.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},On.createElement(ju,{className:"tw-size-5"}),"Context Loading",On.createElement(me,{size:"sm",variant:"ghost2",className:"tw-size-6 tw-p-0 tw-text-muted",title:"Edit Context",onClick:()=>r?.()},On.createElement(od,{className:"tw-size-4"}),On.createElement("span",{className:"tw-sr-only"},"Edit Context"))),On.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-rounded tw-p-1"},On.createElement(me,{size:"sm",variant:"ghost2",className:"tw-size-6 tw-p-0 tw-text-muted",title:"Close Progress Bar",onClick:()=>e(!0)},On.createElement(Ho,{className:"tw-size-4"}))))),On.createElement(SL,{className:"tw-space-y-6"},On.createElement("div",{className:"tw-space-y-2"},On.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-text-sm"},On.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},On.createElement("span",{className:"tw-text-muted"},"Total progress"),On.createElement("span",{className:"tw-text-xs tw-text-muted"},"(Success:"," ",On.createElement("span",{className:"tw-font-medium tw-text-success"},i.length),", Failed: ",On.createElement("span",{className:"tw-font-medium tw-text-error"},a.length),")")),On.createElement("span",{className:"tw-font-medium"},f,"/",o.length," (",p,"%)")),On.createElement(Mfe,{value:p,className:"tw-h-2"})),s.length>0&&On.createElement("div",{className:"tw-space-y-3"},On.createElement("div",{className:"tw--m-1 tw-flex tw-cursor-pointer tw-items-center tw-gap-2 tw-rounded-md tw-p-1 tw-transition-colors hover:tw-bg-muted/10",onClick:()=>l(!u)},On.createElement(Us,{className:"tw-size-4 tw-animate-spin tw-text-accent"}),On.createElement("span",{className:"tw-text-sm tw-font-medium"},"Processing"),u?On.createElement(Ji,{className:"tw-ml-auto tw-size-4"}):On.createElement(od,{className:"tw-ml-auto tw-size-4"})),u&&On.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},s.map((y,g)=>On.createElement("div",{key:g,className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2 tw-text-sm tw-bg-faint/10"},On.createElement("div",{className:"tw-size-2 tw-animate-pulse tw-rounded-full tw-bg-interactive-accent"}),On.createElement(fc,{className:"tw-flex-1",title:y},y))))),a.length>0&&On.createElement("div",{className:"tw-space-y-3"},On.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},On.createElement("div",{className:"-tw-m-1 tw-flex tw-flex-1 tw-cursor-pointer tw-items-center tw-gap-2 tw-rounded-md tw-p-1 tw-transition-colors hover:tw-bg-muted/10",onClick:()=>d(!c)},On.createElement($b,{className:"tw-size-4 tw-text-error"}),On.createElement("span",{className:"tw-text-sm tw-font-medium"},"Failed"),On.createElement(Xc,{variant:"destructive",className:"tw-text-xs"},a.length," files"),c?On.createElement(Ji,{className:"tw-ml-auto tw-size-4"}):On.createElement(od,{className:"tw-ml-auto tw-size-4"}))),c&&On.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},a.map((y,g)=>On.createElement("div",{key:g,className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2 tw-text-sm tw-bg-faint/10"},On.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col tw-gap-1"},On.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},On.createElement("div",{className:"tw-size-2 tw-rounded-full tw-bg-error/80"}),On.createElement(fc,{className:"tw-flex-1 tw-font-bold",title:y.path},m(y))),On.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},On.createElement("div",{className:"tw-size-2 tw-rounded-full"}),y.error&&On.createElement(fc,{className:"tw-flex-1 tw-text-xs tw-text-error/80",title:y.error},On.createElement("span",{className:"tw-text-sm tw-text-error"},"Loading Error: "),y.error))),On.createElement(me,{size:"sm",variant:"ghost",className:"tw-size-5 tw-p-0",title:`Retry ${y.type} item`,onClick:async b=>{b.stopPropagation(),await h(y)}},On.createElement(q4,{className:"tw-size-3"}))))))))}gr();var mb=$(K());function Dnn(t){let[e,r]=(0,mb.useState)([]);(0,mb.useEffect)(()=>(r([...t.getMessages()]),t.subscribe(()=>{r([...t.getMessages()])})),[t]);let n=(0,mb.useCallback)(async(m,h,y,g=!1,b=!1)=>await t.sendMessage(m,h,y,g,b),[t]),o=(0,mb.useCallback)(async(m,h,y,g=!1)=>await t.editMessage(m,h,y,g),[t]),i=(0,mb.useCallback)(async(m,h,y)=>await t.regenerateMessage(m,h,y),[t]),a=(0,mb.useCallback)(async m=>await t.deleteMessage(m),[t]),s=(0,mb.useCallback)(()=>{t.clearMessages()},[t]),u=(0,mb.useCallback)(async m=>{await t.truncateAfterMessageId(m)},[t]),l=(0,mb.useCallback)(m=>{t.addMessage(m)},[t]),c=(0,mb.useCallback)(m=>{t.loadMessages(m)},[t]),d=(0,mb.useCallback)(m=>t.getMessage(m),[t]),f=(0,mb.useCallback)(()=>t.getLLMMessages(),[t]),p=(0,mb.useCallback)(()=>t.getDebugInfo(),[t]);return{messages:e,sendMessage:n,editMessage:o,regenerateMessage:i,deleteMessage:a,addMessage:l,clearMessages:s,truncateAfterMessageId:u,loadMessages:c,getMessage:d,getLLMMessages:f,getDebugInfo:p}}Dt();var p6=require("obsidian"),fqe=$(K());function jvi(t,e){let r=e.match(/obsidian:\/\/open\?vault=.*?&file=(.*)$/);if(!r)return null;let n=decodeURIComponent(r[1]),o=t.vault.getAbstractFileByPath(n);return o instanceof p6.TFile||(o=t.vault.getAbstractFileByPath(n+".md"),o instanceof p6.TFile)?o:null}function $vi(t,e){let r=e.split(`
`).filter(o=>o.trim()),n=[];for(let o of r){let i=jvi(t,o.trim());i&&n.push(i)}return n}function jnn(t){let{app:e,contextNotes:r,setContextNotes:n,selectedImages:o,onAddImage:i,containerRef:a}=t,[s,u]=(0,fqe.useState)(!1);return(0,fqe.useEffect)(()=>{let l=a.current;if(!l)return;let c=p=>{if(p.preventDefault(),p.dataTransfer){if(p.dataTransfer.dropEffect="copy",p.dataTransfer.types.includes("copilot/internal-drag"))return;let m=Array.from(p.dataTransfer.items).some(y=>y.kind==="string"),h=Array.from(p.dataTransfer.items).some(y=>y.kind==="file");(m||h)&&u(!0)}},d=p=>{let m=l.getBoundingClientRect(),h=p.clientX,y=p.clientY;(h<m.left||h>=m.right||y<m.top||y>=m.bottom)&&u(!1)},f=async p=>{if(!p.dataTransfer)return;p.preventDefault(),u(!1);let m=p.dataTransfer.items,h=[],y=[];for(let g=0;g<m.length;g++){let b=m[g];b.kind==="string"?h.push(b):b.kind==="file"&&y.push(b)}if(h.length>0){p.stopPropagation();let g=h.map(w=>new Promise(T=>{w.getAsString(O=>T(O))})),b=await Promise.all(g),_=new Map;for(let w of b){let T=$vi(e,w);for(let O of T)_.set(O.path,O)}for(let w of _.values())if(["png","gif","jpeg","jpg","webp"].includes(w.extension)){if(o.some(I=>I.name===w.name)){new p6.Notice("This image is already in the context");continue}let E=await e.vault.readBinary(w),P=new Blob([E]),R=new File([P],w.name,{type:`image/${w.extension}`});i([R])}else if(uO(w)){if(r.some(E=>E.path===w.path)){new p6.Notice("This note is already in the context");continue}n(E=>[...E,w])}else new p6.Notice(`Unsupported file type: ${w.extension}. Supported types: md, pdf, canvas, and images.`)}else if(y.length>0){let g=[];for(let b of y){let _=b.getAsFile();_&&_.type.startsWith("image/")&&g.push(_)}g.length>0&&i(g)}};return l.addEventListener("dragover",c),l.addEventListener("dragleave",d),l.addEventListener("drop",f),()=>{l.removeEventListener("dragover",c),l.removeEventListener("dragleave",d),l.removeEventListener("drop",f)}},[e,r,o,i,n,a]),{isDragActive:s}}gr();Dt();Xe();y_();var _St=async(t,e,r,n,o,i={})=>{let a=new AbortController;o(a);try{await e.runChain(t,a,n,r,i)}catch(s){ie("Model request failed:",s);let u=lEe("Model request failed: "+Wr(s));r({id:gu(),sender:ow,isErrorMessage:!0,message:u,isVisible:!0,timestamp:vg(new Date)})}};h4();id();Qe();Dt();eEe();var Il=require("obsidian");var qt=$(K());y_();var Lvi=({chainManager:t,onSaveChat:e,updateUserMessageHistory:r,fileParserManager:n,plugin:o,chatUIState:i,chatInput:a})=>{let s=kr(),u=(0,qt.useContext)(zY),{messages:l,addMessage:c}=Dnn(i),[d]=oF(),[f]=aw(),[p,m]=(0,qt.useState)(""),[h,y]=(0,qt.useState)(""),[g,b]=(0,qt.useState)(null),_=(0,qt.useRef)(null),w=(0,qt.useRef)(null),T=(0,qt.useCallback)(nt=>{let Nr=w.current,Ee=Nr&&nt.sender===ow&&!nt.isErrorMessage&&!nt.id?{...nt,id:Nr}:nt;c(Ee),Ee.sender===ow&&Ee.responseMetadata?.tokenUsage?.totalTokens&&b(Ee.responseMetadata.tokenUsage.totalTokens)},[c]),O=(0,qt.useCallback)(nt=>{_.current=nt},[]),[E,P]=(0,qt.useState)(!1),[R,I]=(0,qt.useState)(iw.DEFAULT),[A,B]=(0,qt.useState)([]),[k,q]=(0,qt.useState)(!1),[Z,V]=(0,qt.useState)(!1),[Y,X]=(0,qt.useState)([]),[W,re]=(0,qt.useState)(!1),[ue,le]=(0,qt.useState)([]),[L,J]=(0,qt.useState)(null),[ne,D]=(0,qt.useState)(null),[N]=e5(),z=(0,qt.useRef)(!1),H=(0,qt.useRef)(null),oe=(0,qt.useCallback)(()=>{o.chatSelectionHighlightController.persistFromPointerDown()},[o]),Q=(0,qt.useMemo)(()=>({setCurrentAiMessage:nt=>z.current&&m(nt),setLoadingMessage:nt=>z.current&&I(nt),setLoading:nt=>z.current&&P(nt)}),[]),[de]=d1t(),fe=de.length>0,De=k&&!fe,st=Z&&!fe,{activeWebTabForMentions:Le}=VU(),Bt=nLe(),Pt=()=>He!=="project"?!1:L!==null?L:Bt==="loading"||Bt==="error";(0,qt.useEffect)(()=>{J(null)},[Bt]);let Nt=()=>He==="project"||ne===!1?!1:N.isActive||N.completionStatus!=="none";(0,qt.useEffect)(()=>{(N.isActive||N.completionStatus!=="none")&&D(null)},[N.isActive,N.completionStatus]);let $e=(0,qt.useCallback)(()=>{D(!1),N.isActive||Sg({completionStatus:"none"})},[N.isActive]),Fr=(0,qt.useCallback)(async()=>{(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().pauseIndexing()},[]),ft=(0,qt.useCallback)(async()=>{(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().resumeIndexing()},[]),Ve=(0,qt.useCallback)(async()=>{await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().cancelIndexing()},[]);(0,qt.useEffect)(()=>{l.length===0&&b(null)},[l]);let[Rt,ze]=(0,qt.useState)(null),[He,We]=aw(),Jt=XG(),so=(0,qt.useContext)(Wke),au=o.app||so,{isDragActive:An}=jnn({app:au,contextNotes:A,setContextNotes:B,selectedImages:Y,onAddImage:nt=>X(Nr=>[...Nr,...nt]),containerRef:H}),_i=async({toolCalls:nt,urls:Nr,contextNotes:Ue,contextTags:Ee,contextFolders:Mt,webTabs:Yt}={})=>{if(!h&&Y.length===0)return;Nr&&Nr.length>0&&!Rb(f)&&new Il.Notice(zJ.URL_PROCESSING_RESTRICTED);try{let ul=[];h&&ul.push({type:"text",text:h});for(let jl of Y){let gb=await jl.arrayBuffer(),Hv=cq(gb);ul.push({type:"image_url",image_url:{url:`data:${jl.type};base64,${Hv}`}})}let zv=[...Ue||[],...A].filter((jl,gb,Hv)=>Hv.findIndex(TN=>TN.path===jl.path)===gb),PL=h.trim();nt&&(PL+=" "+nt.join(`
`));let Sh={notes:zv,urls:Rb(f)?Nr||[]:[],tags:Ee||[],folders:Mt||[],selectedTextContexts:de,webTabs:Yt||[]};y(""),X([]),w.current=`msg-${gu()}`,Q.setLoading(!0),Q.setLoadingMessage(iw.DEFAULT);let CC=await i.sendMessage(PL,Sh,f,De,st,ul.length>0?ul:void 0,Q.setLoadingMessage);h&&r(h),s.autosaveChat&&Nl();let Vv=i.getLLMMessage(CC);Vv&&await _St(Vv,t,T,Q.setCurrentAiMessage,O,{debug:s.debug,updateLoadingMessage:Q.setLoadingMessage}),s.autosaveChat&&Nl()}catch(ul){ie("Error sending message:",ul),new Il.Notice("Failed to send message. Please try again.")}finally{Q.setLoading(!1),Q.setLoadingMessage(iw.DEFAULT),w.current=null}},Nl=(0,qt.useCallback)(async()=>{if(!au){ie("App instance is not available.");return}try{await i.saveChat(d)}catch(nt){ie("Error saving chat as note:",Wr(nt)),new Il.Notice("Failed to save chat as note. Check console for details.")}},[au,i,d]),Vi=(0,qt.useCallback)(nt=>{_.current&&(F(`stopping generation..., reason: ${nt}`),_.current.abort(nt),Q.setLoading(!1),Q.setLoadingMessage(iw.DEFAULT))},[Q]);(0,qt.useEffect)(()=>(z.current=!0,()=>{z.current=!1,_.current&&_.current.abort("component-unmount")}),[]);let g_=(0,qt.useCallback)(async nt=>{if(nt<=0){new Il.Notice("Cannot regenerate the first message.");return}let Nr=l[nt];if(!Nr){new Il.Notice("Message not found.");return}Q.setCurrentAiMessage(""),w.current=`msg-${gu()}`,Q.setLoading(!0);try{await i.regenerateMessage(Nr.id,Q.setCurrentAiMessage,T)?s.debug&&console.log("Message regenerated successfully"):new Il.Notice("Failed to regenerate message. Please try again."),s.autosaveChat&&Nl()}catch(Ue){ie("Error regenerating message:",Ue),new Il.Notice("Failed to regenerate message. Please try again.")}finally{Q.setLoading(!1),w.current=null}},[l,i,s.debug,s.autosaveChat,Nl,T,Q]),mg=(0,qt.useCallback)(async(nt,Nr)=>{let Ue=l[nt];if(!(!Ue||Ue.message===Nr))try{if(!await i.editMessage(Ue.id,Nr,f,De)){new Il.Notice("Failed to edit message. Please try again.");return}if(Ue.sender===Zs){let Mt=nt<l.length-1;if(await i.truncateAfterMessageId(Ue.id),Mt){w.current=`msg-${gu()}`,Q.setLoading(!0);try{let Yt=i.getLLMMessage(Ue.id);Yt&&await _St(Yt,t,T,Q.setCurrentAiMessage,O,{debug:s.debug,updateLoadingMessage:Q.setLoadingMessage})}catch(Yt){ie("Error regenerating AI response:",Yt),new Il.Notice("Failed to regenerate AI response. Please try again.")}finally{Q.setLoading(!1),w.current=null}}}s.autosaveChat&&Nl()}catch(Ee){ie("Error editing message:",Ee),new Il.Notice("Failed to edit message. Please try again.")}},[l,i,f,De,T,t,s.debug,s.autosaveChat,Nl,Q,O]);(0,qt.useEffect)(()=>{e&&e(Nl)},[e,Nl]);let cS=(0,qt.useCallback)(nt=>{let Nr=s.projectList||[];if(Nr.findIndex(Yt=>Yt.name===nt.name)>=0)throw new Error(`Project "${nt.name}" already exists, please use a different name`);let Ee=[...Nr,nt];return Re("projectList",Ee),Gu()?.id===nt.id?FLe().then(()=>{new Il.Notice(`${nt.name} added and context loaded`)}).catch(Yt=>{ie("Error loading project context:",Yt),new Il.Notice(`${nt.name} added but context loading failed`)}):new Il.Notice(`${nt.name} added successfully`),!0},[s.projectList]),ji=(0,qt.useCallback)((nt,Nr)=>{let Ue=s.projectList||[];if(!Ue.find(Ln=>Ln.name===nt.name))throw new Error(`Project "${nt.name}" does not exist`);let Mt=Ue.map(Ln=>Ln.name===nt.name?Nr:Ln);return Re("projectList",Mt),Gu()?.id===nt.id?(C4(Nr),FLe().then(()=>{new Il.Notice(`${nt.name} updated and context reloaded`)}).catch(Ln=>{ie("Error reloading project context:",Ln),new Il.Notice(`${nt.name} updated but context reload failed`)})):new Il.Notice(`${nt.name} updated successfully`),!0},[s.projectList]),LT=(0,qt.useCallback)(nt=>{let Ue=zC().find(Ee=>Ee.id===nt);l1t(nt),Ue?.sourceType==="web"&&o.suppressCurrentWebSelection(Ue.url)},[o]);(0,qt.useEffect)(()=>{o.chatSelectionHighlightController.clearIfNoNoteContexts(de)},[de,o]),(0,qt.useEffect)(()=>{let nt=()=>{a.focusInput()};return u?.addEventListener(MS.CHAT_IS_VISIBLE,nt),()=>{u?.removeEventListener(MS.CHAT_IS_VISIBLE,nt)}},[u,a]);let SC=(0,qt.useCallback)(async nt=>{let Nr=l[nt];if(!Nr){new Il.Notice("Message not found.");return}try{await i.deleteMessage(Nr.id)||new Il.Notice("Failed to delete message. Please try again.")}catch(Ue){ie("Error deleting message:",Ue),new Il.Notice("Failed to delete message. Please try again.")}},[l,i]),dS=(0,qt.useCallback)(async()=>{if(r9(),await Em.clear(),Vi("new-chat"),s.enableRecentConversations)try{let Nr=t.chatModelManager.getChatModel();o.userMemoryManager.addRecentConversation(i.getMessages(),Nr)}catch(Nr){F("Failed to analyze chat messages for memory:",Nr)}s.autosaveChat&&await Nl(),i.clearMessages(),fmt(),Q.setCurrentAiMessage(""),B([]),b(null);let nt=de.find(Nr=>Nr.sourceType==="web")?.url;c1t(),o.chatSelectionHighlightController.clearForNewChat(),o.suppressCurrentWebSelection(nt),He==="project"?(q(!1),V(!1)):(q(s.autoAddActiveContentToContext),V(s.autoAddActiveContentToContext))},[Vi,t.chatModelManager,i,s.autosaveChat,s.enableRecentConversations,s.autoAddActiveContentToContext,He,Nl,Q,o,de]),Xs=(0,qt.useCallback)(async()=>{try{let nt=await o.getChatHistoryItems();le(nt)}catch(nt){ie("Error loading chat history:",nt),new Il.Notice("Failed to load chat history.")}},[o]),Dl=(0,qt.useCallback)(async(nt,Nr)=>{try{await o.updateChatTitle(nt,Nr),await Xs()}catch(Ue){throw ie("Error updating chat title:",Ue),new Il.Notice("Failed to update chat title."),Ue}},[o,Xs]),Iu=(0,qt.useCallback)(async nt=>{try{await o.deleteChatHistory(nt),await Xs()}catch(Nr){throw ie("Error deleting chat:",Nr),new Il.Notice("Failed to delete chat."),Nr}},[o,Xs]),wm=(0,qt.useCallback)(async nt=>{try{await o.loadChatById(nt),fmt()}catch(Nr){ie("Error loading chat:",Nr),new Il.Notice("Failed to load chat.")}},[o]),_d=(0,qt.useCallback)(async nt=>{try{await o.openChatSourceFile(nt)}catch(Nr){ie("Error opening source file:",Nr),new Il.Notice("Failed to open source file.")}},[o]);(0,qt.useEffect)(()=>{let nt=Nr=>{let Ue=Nr.detail?.reason||"new-chat";Vi(Ue)};return u?.addEventListener(MS.ABORT_STREAM,nt),()=>{u?.removeEventListener(MS.ABORT_STREAM,nt)}},[u,Vi]),(0,qt.useEffect)(()=>{s.autoAddActiveContentToContext!==void 0&&(He==="project"?(q(!1),V(!1)):(q(s.autoAddActiveContentToContext),V(s.autoAddActiveContentToContext)))},[s.autoAddActiveContentToContext,He]);let sl=()=>qt.default.createElement(qt.default.Fragment,null,qt.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},qt.default.createElement(jrn,{currentVersion:o.manifest.version}),qt.default.createElement(Drn,{chatHistory:l,currentAiMessage:p,streamingMessageId:w.current,loading:E,loadingMessage:R,app:au,onRegenerate:g_,onEdit:mg,onDelete:SC,onReplaceChat:y,showHelperComponents:He!=="project"}),Pt()?qt.default.createElement("div",{className:"tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-rounded-xl"},qt.default.createElement(bSt,{plugin:o,setHiddenCard:()=>{J(!1)},onEditContext:()=>{let nt=Gu();nt&&new QY(au,Nr=>{ji(nt,Nr)},nt).open()}})):Nt()?qt.default.createElement("div",{className:"tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-rounded-xl"},qt.default.createElement(gSt,{onClose:$e,onPause:Fr,onResume:ft,onStop:Ve})):qt.default.createElement(qt.default.Fragment,null,qt.default.createElement(N7r,{onNewChat:dS,onSaveAsNote:()=>Nl(),onLoadHistory:Xs,onModeChange:nt=>{ze(He),nt==="project"&&re(!1)},chatHistory:ue,onUpdateChatTitle:Dl,onDeleteChat:Iu,onLoadChat:wm,onOpenSourceFile:_d,latestTokenCount:g}),qt.default.createElement($ke,{inputMessage:h,setInputMessage:y,handleSendMessage:_i,isGenerating:E,onStopGenerating:()=>Vi("user-stopped"),app:au,contextNotes:A,setContextNotes:B,includeActiveNote:k,setIncludeActiveNote:q,includeActiveWebTab:Z,setIncludeActiveWebTab:V,activeWebTab:Le,selectedImages:Y,onAddImage:nt=>X(Nr=>[...Nr,...nt]),setSelectedImages:X,disableModelSwitch:He==="project",selectedTextContexts:de,onRemoveSelectedText:LT,showProgressCard:()=>{J(!0)},showIndexingCard:()=>{D(!0)}}))));return qt.default.createElement("div",{ref:H,onPointerDownCapture:oe,className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},qt.default.createElement("div",{className:"tw-h-full"},qt.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},An&&qt.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-rounded-md tw-border tw-border-dashed tw-bg-primary tw-opacity-80"},qt.default.createElement("span",null,"Drop files here...")),He==="project"&&qt.default.createElement("div",{className:`${He==="project"?"tw-z-modal":""}`},qt.default.createElement(cSt,{projects:s.projectList||[],defaultOpen:!0,app:au,plugin:o,hasMessages:!1,onProjectAdded:cS,onEditProject:ji,onClose:()=>{Rt?(We(Rt),ze(null)):We(Jt?"copilot_plus":"llm_chain")},showChatUI:nt=>re(nt),onProjectClose:()=>{J(null)}})),(He!=="project"||He==="project"&&W)&&sl())))},Fvi=t=>qt.default.createElement(Rtn,null,qt.default.createElement(kvi,{...t})),kvi=t=>{let e=ez();return qt.default.createElement(Lvi,{...t,chatInput:e})},$nn=Fvi;var Lnn=require("obsidian"),qvi=600,pqe=class{constructor(e,r){this.containerEl=e;this.workspace=r;this.debounceTimer=null;this.cssChangeRef=null;this.setupStatusBarClearance()}destroy(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.cssChangeRef&&(this.workspace.offref(this.cssChangeRef),this.cssChangeRef=null)}setupStatusBarClearance(){if(Lnn.Platform.isMobile)return;let e=()=>{let r=document.querySelector(".status-bar"),n=this.containerEl.querySelector(".view-content");if(!r||!n)return;n.style.setProperty("--copilot-status-bar-clearance","0px");let o=n.getBoundingClientRect().bottom-r.getBoundingClientRect().top;if(o<=0)return;let i=getComputedStyle(r),a=i.display==="none"||i.visibility==="hidden"||parseFloat(i.opacity)===0;n.style.setProperty("--copilot-status-bar-clearance",`${a?0:Math.ceil(o)}px`)};e(),this.cssChangeRef=this.workspace.on("css-change",()=>{this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(e,qvi)})}};gr();var Ife=require("obsidian"),Rfe=$(K()),Fnn=$(Im()),iz=class extends Ife.ItemView{constructor(r,n){super(r);this.plugin=n;this.root=null;this.handleSaveAsNote=null;this.keyboardObserver=null;this.drawerHideObserver=null;this.layout=null;this.lastDrawerEl=null;this.app=n.app,this.fileParserManager=n.fileParserManager,this.eventTarget=new EventTarget,this.plugin=n}get chainManager(){return this.plugin.projectManager.getCurrentChainManager()}getViewType(){return Du}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){this.root=(0,Fnn.createRoot)(this.containerEl.children[1]);let r=o=>{this.handleSaveAsNote=o},n=o=>{this.plugin.updateUserMessageHistory(o)};this.renderView(r,n),this.layout=new pqe(this.containerEl,this.app.workspace),this.setupMobileKeyboardObserver(),this.setupDrawerHideObserver(),this.registerEvent(this.app.workspace.on("layout-change",()=>{requestAnimationFrame(()=>this.setupDrawerHideObserver())}))}setupMobileKeyboardObserver(){if(!Ife.Platform.isMobile)return;this.keyboardObserver?.disconnect();let r=()=>{let n=this.containerEl.closest(".workspace-drawer");if(this.lastDrawerEl&&this.lastDrawerEl!==n&&this.lastDrawerEl.classList.remove("copilot-keyboard-open"),this.lastDrawerEl=n,!n)return;let o=!!this.containerEl.closest(".workspace-drawer-active-tab-content"),i=parseFloat(document.documentElement.style.getPropertyValue("--keyboard-height")||"0");n.classList.toggle("copilot-keyboard-open",o&&i>0)};this.keyboardObserver=new MutationObserver(r),this.keyboardObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),r()}setupDrawerHideObserver(){if(!Ife.Platform.isMobile)return;this.drawerHideObserver?.disconnect();let r=this.containerEl.closest(".workspace-drawer");if(!r)return;let n=r.classList.contains("is-hidden");this.drawerHideObserver=new MutationObserver(()=>{let o=r.classList.contains("is-hidden");o&&!n&&this.containerEl.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),n=o}),this.drawerHideObserver.observe(r,{attributes:!0,attributeFilter:["class"]})}renderView(r,n){this.root&&this.root.render(Rfe.createElement(Wke.Provider,{value:this.app},Rfe.createElement(zY.Provider,{value:this.eventTarget},Rfe.createElement(F$e,{delayDuration:0},Rfe.createElement($nn,{chainManager:this.chainManager,updateUserMessageHistory:n,fileParserManager:this.fileParserManager,plugin:this.plugin,onSaveChat:r,chatUIState:this.plugin.chatUIState})))))}async saveChat(){this.handleSaveAsNote&&await this.handleSaveAsNote()}updateView(){let r=o=>{this.handleSaveAsNote=o},n=o=>{this.plugin.updateUserMessageHistory(o)};this.renderView(r,n)}async onClose(){this.keyboardObserver?.disconnect(),this.keyboardObserver=null,this.drawerHideObserver?.disconnect(),this.drawerHideObserver=null,this.layout?.destroy(),this.layout=null,this.lastDrawerEl?.classList.remove("copilot-keyboard-open"),this.lastDrawerEl=null,this.root&&(this.root.unmount(),this.root=null)}};Dt();function Afe(t){let e=app.metadataCache.getFileCache(t)?.frontmatter;return e?.topic&&typeof e.topic=="string"&&e.topic.trim()?e.topic.trim():t.basename.replace(/^[a-zA-Z0-9-]+__/,"").replace(/\{\$date\}|\d{8}/g,"").replace(/\{\$time\}|\d{6}/g,"").replace(/[@_]/g," ").replace(/\s+/g," ").trim()}function Nfe(t){let e=app.metadataCache.getFileCache(t)?.frontmatter;return e&&e.epoch?new Date(e.epoch):new Date(t.stat.ctime)}function Dfe(t){let r=app.metadataCache.getFileCache(t)?.frontmatter?.lastAccessedAt;if(typeof r=="number"&&Number.isFinite(r)&&r>0)return r;if(typeof r=="string"){let n=Number(r);if(Number.isFinite(n)&&n>0)return n;let o=Date.parse(r);if(Number.isFinite(o))return o}return null}function knn(t){let e=Afe(t),r=Nfe(t),n=vg(r);return`${e} - ${n.display}`}Qe();t1();var qnn=require("obsidian"),mqe=class extends qnn.FuzzySuggestModal{constructor(r,n,o,i){super(r);this.chatFiles=n;this.chatHistoryLastAccessedAtManager=o;this.onChooseFile=i}getItems(){let r=ee().chatHistorySortStrategy;return iO(this.chatFiles,r,{getName:n=>Afe(n),getCreatedAtMs:n=>Nfe(n).getTime(),getLastUsedAtMs:n=>{let o=Dfe(n);return this.chatHistoryLastAccessedAtManager.getEffectiveLastUsedAt(n.path,o)}})}getItemText(r){return knn(r)}onChooseItem(r,n){this.onChooseFile(r)}};gr();function Bvi(t){return typeof t.commands?.executeCommandById=="function"}function Bnn(t,e){if(!Bvi(e))return;let r=n=>{e.commands.executeCommandById(n)};t.addItem(n=>{n.setTitle("Copilot"),n.setSubmenu();let o=n.submenu;if(!o)return;o.addItem(s=>{s.setTitle("Add selection to chat context").onClick(()=>{r(`copilot:${ur.ADD_SELECTION_TO_CHAT_CONTEXT}`)})}),o.addItem(s=>{s.setTitle("Quick Ask").onClick(()=>{r(`copilot:${ur.TRIGGER_QUICK_ASK}`)})}),o.addItem(s=>{s.setTitle("Trigger quick command").onClick(()=>{r(`copilot:${ur.TRIGGER_QUICK_COMMAND}`)})});let a=Sv().filter(s=>s.showInContextMenu);a.length>0&&o.addSeparator(),Lce(a).forEach(s=>{o.addItem(u=>{u.setTitle(s.title).onClick(()=>{r(`copilot:${tZ(s.title)}`)})})})})}var Unn=$(YG());Xe();var hqe=class{constructor(e,r){this.handleFileModify=(0,Unn.default)(async e=>{if(!nZ(e)||Dce(e.path))return;let r=await $ce(e);this.registerCommand(r),a3(r,r.title)},1e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(!(!nZ(e)||Dce(e.path)))try{let r=await $ce(e);if(!AWr(e)){let n=Nje();r={...r,order:n}}await igt(e,r),a3(r,r.title),this.registerCommand(r)}catch(r){ie(`Error processing custom command creation: ${e.path}`,r)}};this.handleFileDeletion=async e=>{if(!nZ(e)||Dce(e.path))return;let r=tZ(e.basename);this.plugin.removeCommand(r),jce(e.basename)};this.handleFileRename=async(e,r)=>{if(Dce(e.path))return;let n=r.split("/").pop()?.replace(/\.md$/,"");if(n){let o=tZ(n);this.plugin.removeCommand(o),jce(n)}if(nZ(e)){let o=await $ce(e);this.registerCommand(o),a3(o,o.title),await igt(e,o)}};this.plugin=e,this.vault=r,this.initializeEventListeners()}async initialize(){await Ije(),this.registerCommands()}async registerCommands(){Sv().forEach(r=>{this.registerCommand(r)})}cleanup(){this.vault.off("create",this.handleFileCreation),this.vault.off("delete",this.handleFileDeletion),this.vault.off("rename",this.handleFileRename),this.vault.off("modify",this.handleFileModify)}initializeEventListeners(){this.vault.on("create",this.handleFileCreation),this.vault.on("delete",this.handleFileDeletion),this.vault.on("rename",this.handleFileRename),this.vault.on("modify",this.handleFileModify)}registerCommand(e){let r=tZ(e.title);this.plugin.removeCommand(r),this.plugin.addCommand({id:r,name:e.title,editorCallback:n=>{new mU(this.plugin.app,{selectedText:n.getSelection(),command:e}).open(),Zm.getInstance().recordUsage(e)}})}};Qe();Dt();async function Uvi(t){let r=`${tU()}/unsupported`;return await ql(r),Promise.all(t.map(async n=>{let o=`${r}/${n.title}.md`,i=await app.vault.create(o,n.content);await app.fileManager.processFrontMatter(i,a=>{a[I$]=n.showInContextMenu,a[A$]=n.showInSlashMenu,a[nN]=n.order,a[N$]=n.modelKey,a[D$]=0})}))}async function znn(){let t=ee().inlineEditCommands;if(!t||t.length===0)return;let e=[],r=[],n=Sv(),o=t.map((a,s)=>({title:a.name,content:a.prompt,showInContextMenu:a.showInContextMenu,showInSlashMenu:!1,order:s*10,modelKey:a.modelKey??"",lastUsedMs:0}));for(let a of o){let s=Rje(a.title,n);s?r.push({...a,title:encodeURIComponent(a.title),content:`> ${s} 

Original name: ${a.title} 

${a.content}`}):e.push(a)}await Zm.getInstance().updateCommands([...n.map(a=>({...a,showInSlashMenu:!0})),...e]);let i=`We have upgraded your commands to the new format. They are now also stored as notes in ${tU()}.`;r.length>0&&(await Uvi(r),i+=`

We found ${r.length} unsupported commands. They are saved in ${tU()}/unsupported. To fix them, please resolve the errors and move the note file out of the unsupported folder.`),Re("inlineEditCommands",[]),new nu(app,()=>{},i,"\u{1F680} New Copilot Custom Commands","OK","").open()}async function vSt(){let t=Sv(),e=IWr.filter(n=>!t.some(o=>o.title===n.title)),r=[...t,...e];Zm.getInstance().updateCommands(r)}async function Vnn(){if(ee().suggestedDefaultCommands)return;Sv().length===0&&(new nu(app,()=>{vSt()},"Would you like to add Copilot recommended commands in your custom prompts folder? These commands will be available through the right-click context menu and slash commands in chat.","Welcome to Copilot","Confirm","Skip").open(),Re("suggestedDefaultCommands",!0))}gr();Qe();rd();na();Xe();gr();async function Hnn(t,e){await e.clearChatMemory();for(let r=0;r<t.length-1;r++){let n=t[r];if(n.sender===Zs){let o=t[r+1];o?.sender===ow&&await e.saveContext({input:n.message},{output:o.message})}}}na();rd();gr();var Knn=$(oH());Xe();var Wnn=["L1_SYSTEM","L2_PREVIOUS","L3_TURN","L4_STRIP","L5_USER"],Jnn={L1_SYSTEM:"System Instructions",L2_PREVIOUS:"Previous Turn Context",L3_TURN:"Current Turn Context",L4_STRIP:"Conversation Strip",L5_USER:"User Message"};var az=class az{constructor(){}static getInstance(){return az.instance||(az.instance=new az),az.instance}buildEnvelope(e){let r=Wnn.map(s=>this.buildLayer(s,e.layerSegments[s]??[])),n=this.serializeLayers(r),o=this.collectLayerHashes(r),i=this.hash(n),a=typeof e.metadata?.debugLabel=="string"?e.metadata.debugLabel:void 0;return a&&F(`[PromptContextEngine] Built envelope for ${a}`,o),{version:az.ENVELOPE_VERSION,conversationId:e.conversationId,messageId:e.messageId,layers:r,serializedText:n,layerHashes:o,combinedHash:i,debug:{warnings:this.collectWarnings(r)}}}buildLayer(e,r){let n=r.map((i,a)=>({...i,id:i.id||`${e}-segment-${a}`,content:this.normalizeWhitespace(i.content),stable:i.stable??!0})),o=this.normalizeWhitespace(n.map(i=>i.content).filter(Boolean).join(`

`));return{id:e,label:Jnn[e],text:o,segments:n,stable:n.every(i=>i.stable),metadata:n.length===1?n[0].metadata:void 0,hash:this.hash(o)}}serializeLayers(e){return e.map(r=>r.text).filter(r=>r.length>0).join(`

`)}collectLayerHashes(e){return e.reduce((r,n)=>(r[n.id]=n.hash,r),{})}hash(e){return(0,Knn.SHA256)(e||"").toString()}normalizeWhitespace(e){return e.replace(/\s+$/g,"").trim()}collectWarnings(e){let r=[];return e.forEach(n=>{if(!n.text)return;n.text.includes("\0")&&r.push(`Layer ${n.id} contains control characters and was normalized`)}),r}};az.ENVELOPE_VERSION=1;var gqe=az;function zvi(t){let e=/<path>([^<]+)<\/path>/.exec(t);if(e)return e[1];let r=/<url>([^<]+)<\/url>/.exec(t);if(r)return r[1];let n=/<name>([^<]+)<\/name>/.exec(t);return n?n[1]:""}function Vvi(t,e,r,n={}){let o=n.verbatimThreshold??Xw.verbatimThreshold;if(t.length<=o)return t;let i=n.previewCharsPerSection??Xw.previewCharsPerSection,a=n.maxSections??Xw.maxSections,s=ZW(t,i,a);return`<prior_context source="${sje(e)}" type="${r}">
${s}
</prior_context>`}function Gnn(t,e,r={}){if(!aje(e))return t;let n=r.verbatimThreshold??Xw.verbatimThreshold;if(t.length<=n)return t;let o=JX(t,e)||zvi(t),i=Cce(t),a=XW(e);return Vvi(i,o,a,r)}function Xnn(){return`<prior_context_note>
The above prior_context blocks contain previews of content from earlier turns.
To access full content: use [[note title]] for notes, or ask to read a specific URL/video.
</prior_context_note>`}function Znn(t,e){if(!t.trim())return[];let r=[],o=[...WX.map(u=>u.tag),"prior_context"],i=new RegExp(`<(${o.join("|")})(\\s[^>]*)?>[\\s\\S]*?</\\1>`,"g"),a=new Map,s;for(;(s=i.exec(t))!==null;){let u=s[0],l=s[1];if(l==="prior_context"){let d=/source="([^"]+)"/.exec(u)?.[1]??"prior_context";r.push({id:d,content:u,stable:e,metadata:{source:"previous_turns_compacted",notePath:d}})}else{let c=JX(u,l),d;if(c)d=c;else{let p=(a.get(l)||0)+1;a.set(l,p),d=p===1?l:`${l}:${p}`}let f=XW(l)==="note";r.push({id:d,content:u,stable:e,metadata:{source:e?"previous_turns":"current_turn",...f?{notePath:d}:{}}})}}return r}na();gr();Xe();T3();EZ();Dt();AZ();var jfe=require("obsidian");gr();var yqe=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 jfe.TFile)try{let l=await n.parseFile(u,r);e=e.replace(a[0],`

<${hte}>
<name>${s}</name>
<content>
${l}
</content>
</${hte}>

`)}catch(l){ie(`Error processing embedded PDF ${s}:`,l),e=e.replace(a[0],`

<${hte}>
<name>${s}</name>
<error>Could not process PDF</error>
</${hte}>

`)}}return e}async processDataviewBlocks(e,r){let n=app.plugins?.plugins?.dataview;if(!n)return e;let o=n.api;if(!o)return e;let i=/```(dataview|dataviewjs)\s*\n([\s\S]*?)```/g,a=[...e.matchAll(i)];for(let s=a.length-1;s>=0;s--){let u=a[s],l=u[1],c=u[2].trim(),d=u.index,f=d+u[0].length;try{let p=await Promise.race([this.executeDataviewQuery(o,c,l,r),new Promise((h,y)=>setTimeout(()=>y(new Error("Query timeout")),5e3))]),m=`

<${gte}>
<query_type>${l}</query_type>
<original_query>
${c}
</original_query>
<executed_result>
${p}
</executed_result>
</${gte}>

`;e=e.slice(0,d)+m+e.slice(f)}catch(p){ie("Error executing Dataview query:",p);let m=`

<${gte}>
<query_type>${l}</query_type>
<original_query>
${c}
</original_query>
<error>${p instanceof Error?p.message:"Query execution failed"}</error>
</${gte}>

`;e=e.slice(0,d)+m+e.slice(f)}}return e}async executeDataviewQuery(e,r,n,o){if(n==="dataviewjs")return"[DataviewJS execution not yet supported - showing original query]";let i=await e.query(r,o);if(!i.successful)throw new Error(i.error||"Query failed");return this.formatDataviewResult(i.value)}formatDataviewResult(e){return e?e.type==="list"?this.formatDataviewList(e.values):e.type==="table"?this.formatDataviewTable(e.headers,e.values):e.type==="task"?this.formatDataviewTasks(e.values):Array.isArray(e)?e.map(r=>this.formatDataviewValue(r)).join(`
`):String(e):"No results"}formatDataviewList(e){return!e||e.length===0?"No results":e.map(r=>`- ${this.formatDataviewValue(r)}`).join(`
`)}formatDataviewTable(e,r){if(!r||r.length===0)return"No results";let n=`| ${e.join(" | ")} |
`;n+=`| ${e.map(()=>"---").join(" | ")} |
`;for(let o of r)n+=`| ${o.map(i=>this.formatDataviewValue(i)).join(" | ")} |
`;return n}formatDataviewTasks(e){return!e||e.length===0?"No results":e.map(r=>`- ${r.completed?"[x]":"[ ]"} ${this.formatDataviewValue(r.text||r)}`).join(`
`)}formatDataviewValue(e){return e==null?"":e&&typeof e=="object"&&e.path?`[[${e.path}]]`:Array.isArray(e)?e.map(r=>this.formatDataviewValue(r)).join(", "):String(e)}async buildMarkdownContextContent(e,r,n,o){let i=await n.parseFile(e,r);return i=await this.processEmbeddedNotes(i,e,r,n,o),Rb(o)&&(i=await this.processEmbeddedPDFs(i,r,n)),await this.processDataviewBlocks(i,e.path)}async processEmbeddedNotes(e,r,n,o,i){let a=/!\[\[([^\]]+)\]\]/g,s,u=0,l="";for(;(s=a.exec(e))!==null;){l+=e.slice(u,s.index);let c=s[1].trim(),d=await this.buildEmbeddedNoteBlock(c,s[0],r,n,o,i);l+=d,u=s.index+s[0].length}return l+=e.slice(u),l}async buildEmbeddedNoteBlock(e,r,n,o,i,a){let s=this.parseEmbeddedLinkTarget(e);if(!s)return r;let u=s.path===null?n:app.metadataCache.getFirstLinkpathDest(s.path,n.path);if(!(u instanceof jfe.TFile))return this.formatEmbeddedNoteBlock({title:s.path??n.basename,path:s.path??n.path,heading:s.heading,blockId:s.blockId,error:"Embedded note not found"});if(u.extension!=="md")return r;try{let l=await i.parseFile(u,o);if(s.heading||s.blockId){let c=this.extractMarkdownSegment(u,l,s);if(!c.found){let d=s.blockId?`block reference "${s.blockId}"`:`heading "${s.heading??""}"`;throw new Error(`Embedded note ${d} not found in ${u.path}`)}l=c.content}return Rb(a)&&(l=await this.processEmbeddedPDFs(l,o,i)),l=await this.processDataviewBlocks(l,u.path),this.formatEmbeddedNoteBlock({title:u.basename,path:u.path,heading:s.heading,blockId:s.blockId,content:l})}catch(l){Ce("Failed to process embedded note",l);let c=l instanceof Error?l.message:"Could not process embedded note";return this.formatEmbeddedNoteBlock({title:u.basename,path:u.path,heading:s.heading,blockId:s.blockId,error:c})}}parseEmbeddedLinkTarget(e){if(!e)return null;let r=e.indexOf("|"),o=(r>=0?e.slice(0,r):e).trim();if(!o)return{path:null};let i,a,s=o.indexOf("#^");s!==-1&&(i=o.slice(s+2).trim(),o=o.slice(0,s));let u=o.indexOf("#");return u!==-1&&(a=o.slice(u+1).trim(),o=o.slice(0,u)),{path:o.length>0?o:null,heading:a&&a.length>0?a:void 0,blockId:i&&i.length>0?i:void 0}}extractMarkdownSegment(e,r,n){let o=app.metadataCache.getFileCache(e);if(n.blockId){let i=o?.blocks?.[n.blockId],a=i?.position?.start?.offset,s=i?.position?.end?.offset;return a===void 0||s===void 0?{content:"",found:!1}:{content:r.slice(a,s),found:!0}}if(n.heading){let i=o?.headings??[],a=this.normalizeHeadingForMatch(n.heading),s=i.findIndex(d=>this.normalizeHeadingForMatch(d.heading)===a);if(s===-1)return{content:"",found:!1};let u=i[s],l=u.position?.start?.offset??0,c=r.length;for(let d=s+1;d<i.length;d++)if(i[d].level<=u.level){c=i[d].position?.start?.offset??c;break}return{content:r.slice(l,c),found:!0}}return{content:r,found:!0}}normalizeHeadingForMatch(e){return e.trim().toLowerCase().replace(/\s+/g," ")}formatEmbeddedNoteBlock(e){let{title:r,path:n,heading:o,blockId:i,content:a,error:s}=e,u=`

<${QWe}>
<title>${r}</title>
<path>${n}</path>`;return o&&(u+=`
<heading>${o}</heading>`),i&&(u+=`
<block_id>${i}</block_id>`),s?u+=`
<error>${s}</error>`:u+=`
<content>
${a??""}
</content>`,u+=`
</${QWe}>

`,u}async processContextNotes(e,r,n,o,i,a,s){let u="",l=async(d,f=pte)=>{try{if(e.has(d.path)){F(`Skipping note ${d.path} as it was included via custom prompt.`);return}if(!r.supportsExtension(d.extension)){Ce(`Unsupported file type: ${d.extension}`);return}if(!Rb(s)&&!Ege(d)){Ce(`File type ${d.extension} requires Copilot Plus mode for context processing.`),new jfe.Notice(zJ.NON_MARKDOWN_FILES_RESTRICTED);return}let p=d.extension==="md"?await this.buildMarkdownContextContent(d,n,r,s):await r.parseFile(d,n),m=await n.adapter.stat(d.path),h=m?new Date(m.ctime).toISOString():"Unknown",y=m?new Date(m.mtime).toISOString():"Unknown";u+=`

<${f}>
<title>${Mc(d.basename)}</title>
<path>${d.path}</path>
<ctime>${h}</ctime>
<mtime>${y}</mtime>
<content>
${p}
</content>
</${f}>`}catch(p){ie(`Error processing file ${d.path}:`,p),u+=`

<${f}_error>
<title>${Mc(d.basename)}</title>
<path>${d.path}</path>
<error>[Error: Could not process file]</error>
</${f}_error>`}},c=new Set;i&&a&&(await l(a,"active_note"),c.add(a.path));for(let d of o)c.has(d.path)||(await l(d),c.add(d.path));return u}async hasEmbeddedPDFs(e){return/!\[\[(.*?\.pdf)\]\]/g.test(e)}async addNoteToContext(e,r,n,o,i,a){if(n.some(l=>l.path===e.path))return;let s=await r.read(e),u=await this.hasEmbeddedPDFs(s);o&&e.path===o.path&&a(!0),i(l=>[...l,Object.assign(e,{wasAddedViaReference:!0,hasEmbeddedPDFs:u})])}processSelectedTextContexts(){let e=zC();if(!e||e.length===0)return"";let r="";for(let n of e)n.sourceType==="web"?r+=`

<${YWe}>
<title>${Mc(n.title)}</title>
<url>${Mc(n.url)}</url>
<content>
${Mc(n.content)}
</content>
</${YWe}>`:r+=`

<${N_}>
<title>${Mc(n.noteTitle)}</title>
<path>${Mc(n.notePath)}</path>
<start_line>${n.startLine.toString()}</start_line>
<end_line>${n.endLine.toString()}</end_line>
<content>
${n.content}
</content>
</${N_}>`;return r}async processContextWebTabs(e){if(!e||e.length===0)return"";let r=2500,n=8e3,o=15e3,i=2,a=(b,_)=>{let w=[`

<${b}>`,`
<title>${Mc(_.title)}</title>`,`
<url>${Mc(_.url)}</url>`];return _.mode&&w.push(`
<mode>${Mc(_.mode)}</mode>`),_.error?w.push(`
<error>${Mc(_.error)}</error>`):_.content!==void 0&&w.push(`
<content>
${Mc(_.content)}
</content>`),w.push(`
</${b}>`),w.join("")},s=b=>{let _=[`

<${r3e}>`,`
<title>${Mc(b.title)}</title>`,`
<url>${Mc(b.url)}</url>`,`
<video_id>${Mc(b.videoId)}</video_id>`];b.isActive&&_.push(`
<is_active>true</is_active>`),b.channel&&_.push(`
<channel>${Mc(b.channel)}</channel>`),b.uploadDate&&_.push(`
<upload_date>${Mc(b.uploadDate)}</upload_date>`),b.duration&&_.push(`
<duration>${Mc(b.duration)}</duration>`),b.genre&&_.push(`
<genre>${Mc(b.genre)}</genre>`),b.description&&_.push(`
<description>${Mc(b.description)}</description>`),b.error&&_.push(`
<error>${Mc(b.error)}</error>`);let w=b.transcript||"No transcript available for this video";return _.push(`
<content>
${Mc(w)}
</content>`),_.push(`
</${r3e}>`),_.join("")},u=null,l=[],c=new Set,d=new Set,f=md(app),p=b=>{let _=f.getYouTubeVideoId(b);return _?d.has(_)?!0:(d.add(_),!1):c.has(b)?!0:(c.add(b),!1)};for(let b of e){let _=ub(b.url);_&&b.isActive&&!u&&(u={...b,url:_},p(_))}for(let b of e){let _=ub(b.url);!_||p(_)||l.push({...b,url:_})}if(!u&&l.length===0)return"";let m=f.getAvailability();if(!m.supported||!m.available){let b=m.reason??(m.supported?"Web Viewer is not available.":"Web Viewer is not supported on this platform."),_=[];u&&_.push(a(Dge,{title:u.title||"Unknown",url:u.url,error:b}));for(let w of l)_.push(a(t3e,{title:w.title||"Unknown",url:w.url,error:b}));return _.join("")}let h=async(b,_)=>{try{let w=b.url,T=f.getYouTubeVideoId(w);if(T)return await y(b,T,_===Dge);let O=f.findLeafByUrl(w,{title:b.title});if(!O)return a(_,{title:b.title||"Unknown",url:w,error:"Web tab not found or closed"});let E=f.getPageInfo(O),P=O.view;if(!(P.webviewMounted===void 0||P.webviewFirstLoadFinished===void 0?!0:!!(P.webviewMounted&&P.webviewFirstLoadFinished)))try{await f.waitForWebviewReady(O,r),E=f.getPageInfo(O)}catch(B){return Ce(`Web tab content not loaded yet for ${w}:`,B),a(_,{title:E.title||b.title||"Untitled",url:E.url||w,mode:E.mode,error:"Web tab content not loaded yet"})}let I=new AbortController,A=setTimeout(()=>{I.abort()},n);try{let B=await f.getReaderModeMarkdown(O,{signal:I.signal});return E=f.getPageInfo(O),a(_,{title:E.title||b.title||"Untitled",url:E.url||w,mode:E.mode,content:B})}finally{clearTimeout(A)}}catch(w){return ie(`Error processing web tab ${b.url}:`,w),a(_,{title:b.title||"Unknown",url:b.url,error:w instanceof hU?"Web tab content extraction timed out":"Could not process web tab"})}},y=async(b,_,w)=>{try{let T=null,O=b.url;for(let A of f.getLeaves()){let B=f.getPageInfo(A).url;if(f.getYouTubeVideoId(B)===_){T=A,O=B;break}}if(!T)return s({title:b.title||"YouTube Video",url:b.url,videoId:_,isActive:w,error:"Web tab not found or closed"});let E=T.view;if(!(E.webviewMounted===void 0||E.webviewFirstLoadFinished===void 0?!0:!!(E.webviewMounted&&E.webviewFirstLoadFinished)))try{await f.waitForWebviewReady(T,r)}catch(A){return Ce(`YouTube tab content not loaded yet for ${O}:`,A),s({title:b.title||"YouTube Video",url:O,videoId:_,isActive:w,error:"Web tab content not loaded yet"})}let R=await f.getYouTubeTranscript(T,{timeoutMs:o}),I=R.transcript.length>0?R.transcript.map(A=>`${A.timestamp}: ${A.text}`).join(`
`):void 0;return s({title:R.title||b.title||"YouTube Video",url:O,videoId:R.videoId,channel:R.channel,description:R.description,uploadDate:R.uploadDate,duration:R.duration,genre:R.genre,transcript:I,isActive:w})}catch(T){return Ce(`YouTube transcript extraction failed for ${b.url}:`,T),s({title:b.title||"YouTube Video",url:b.url,videoId:_,isActive:w,error:T instanceof Error?T.message:"Failed to extract video info"})}},g=[];if(u){let b=await h(u,Dge);g.push(b)}for(let b=0;b<l.length;b+=i){let _=l.slice(b,b+i),w=await Promise.all(_.map(T=>h(T,t3e)));g.push(...w)}return g.join("")}};Xe();Qe();Dt();var SSt=null;async function Hvi(){return SSt||(SSt=(await Promise.resolve().then(()=>(Qnn(),Ynn))).ContextCompactor),SSt.getInstance()}var bqe=class t{constructor(){this.contextProcessor=yqe.getInstance(),this.mention=QG.getInstance(),this.promptContextEngine=gqe.getInstance()}static getInstance(){return t.instance||(t.instance=new t),t.instance}async processMessageContext(e,r,n,o,i,a,s,u,l=[],c){try{F(`[ContextManager] Processing context for message ${e.id}`);let d=e.originalMessage||e.message,{processedPrompt:f,includedFiles:p}=await kce(d,"",n,a),{l2Context:m,l2Paths:h}=this.buildL2ContextFromPreviousTurns(e.id,s),y=e.context?.urls||[],g=o==="copilot_plus"?await this.mention.processUrlList(y):{urlContext:"",imageUrls:[]},b=new Set([...p.map(J=>J.path),...l.map(J=>J.path),...h]),_=new Set,T=(e.context?.notes||[]).filter(J=>!h.has(J.path));i&&o!=="project"&&a&&!b.has(a.path)&&!T.some(J=>J.path===a.path)&&T.push(a);let O=await this.contextProcessor.processContextNotes(b,r,n,T,i,a,o);T.forEach(J=>{b.add(J.path),_.add(J.path)});let E=e.context?.tags||[],P="",R=[];if(E.length>0){let ne=Oge(n,E).filter(D=>!b.has(D.path));ne.length>0&&(P=await this.contextProcessor.processContextNotes(new Set,r,n,ne,!1,null,o),ne.forEach(D=>{b.add(D.path),_.add(D.path),R.push(D.path)}))}let I=e.context?.folders||[],A="",B=[];if(I.length>0){let ne=I.flatMap(D=>ite(n,D)).filter(D=>!b.has(D.path));ne.length>0&&(A=await this.contextProcessor.processContextNotes(new Set,r,n,ne,!1,null,o),ne.forEach(D=>{b.add(D.path),_.add(D.path),B.push(D.path)}))}let k=this.contextProcessor.processSelectedTextContexts(),q=e.context?.webTabs||[],Z=await this.contextProcessor.processContextWebTabs(q),V=m+O+P+A+g.urlContext+k+Z,Y=f+V,re=(o==="project"?1e6:ee().autoCompactThreshold)*4,ue=!1,le=V;if(Y.length>re){c?.(iw.COMPACTING);let ne=await(await Hvi()).compact(V);ne.wasCompacted&&(le=ne.content,Y=f+le,ue=!0,F(`[ContextManager] Compacted context: ${ne.originalCharCount} -> ${ne.compactedCharCount} chars`)),c?.(iw.DEFAULT)}F(`[ContextManager] Successfully processed context for message ${e.id}`);let L=ue?this.buildCompactedEnvelope({chainType:o,message:e,systemPrompt:u||"",processedUserMessage:f,compactedContext:le,compactedPaths:Array.from(_)}):this.buildPromptContextEnvelope({chainType:o,message:e,systemPrompt:u||"",processedUserMessage:f,l2PreviousContext:m,noteContextAddition:O,tagContextAddition:P,tagNotePaths:R,folderContextAddition:A,folderNotePaths:B,urlContext:g.urlContext,selectedText:k,webTabContext:Z});return{processedContent:Y,contextEnvelope:L}}catch(d){return F(`[ContextManager] Error processing context for message ${e.id}:`,d),{processedContent:e.originalMessage||e.message,contextEnvelope:void 0}}}async reprocessMessageContext(e,r,n,o,i,a,s,u,l=[]){let c=r.getMessage(e);if(!c||c.sender!=="user"||!c.id)return;F(`[ContextManager] Reprocessing context for message ${e}`);let{processedContent:d,contextEnvelope:f}=await this.processMessageContext(c,n,o,i,a,s,r,u,l);r.updateProcessedText(c.id,d,f),F(`[ContextManager] Completed context reprocessing for message ${e}`)}buildL2ContextFromPreviousTurns(e,r){let n=r.getDisplayMessages(),o=n.findIndex(p=>p.id===e);if(o===-1||o===0)return{l2Context:"",l2Paths:new Set};let i=n.slice(0,o).filter(p=>p.sender==="user"),a=new Map,s=[],u=new Set,l=-1;for(let p=i.length-1;p>=0;p--)if(i[p].contextEnvelope?.layers?.find(g=>g.id==="L3_TURN")?.segments?.some(g=>g.metadata?.wasCompacted)){l=p;break}for(let p=0;p<i.length;p++){let h=i[p].contextEnvelope?.layers?.find(y=>y.id==="L3_TURN");if(h){if(p>=l){for(let y of h.segments||[])if(y.content){let g=this.compactSegmentForL2(y.content);if(!g.trim())continue;a.has(y.id)||s.push(y.id),a.set(y.id,g)}}for(let y of h.segments||[]){if(y.metadata?.notePath&&u.add(y.metadata.notePath),y.metadata?.compactedPaths)for(let g of y.metadata.compactedPaths)u.add(g);if(y.metadata?.notePaths)for(let g of y.metadata.notePaths)u.add(g)}}}let c=s.map(p=>a.get(p)).join(`
`);return{l2Context:/<prior_context\s+source=/.test(c)?c+`

`+Xnn():c,l2Paths:u}}buildPromptContextEnvelope(e){let r=e.message.id;if(!r)return;let n={};if(e.systemPrompt&&(n.L1_SYSTEM=[{id:"system",content:e.systemPrompt,stable:!0,metadata:{source:"system_prompt"}}]),e.l2PreviousContext){let i=this.parseContextIntoSegments(e.l2PreviousContext,!0);i.length>0&&(n.L2_PREVIOUS=i)}let o=[];if(e.noteContextAddition){let i=this.parseContextIntoSegments(e.noteContextAddition,!1);o.push(...i)}return this.appendParsedSegments(o,e.tagContextAddition,{source:"tags",notePaths:e.tagNotePaths}),this.appendParsedSegments(o,e.folderContextAddition,{source:"folders",notePaths:e.folderNotePaths}),this.appendParsedSegments(o,e.urlContext),this.appendParsedSegments(o,e.selectedText),this.appendParsedSegments(o,e.webTabContext),o.length>0&&(n.L3_TURN=o),n.L5_USER=[{id:`${r}-user`,content:e.processedUserMessage,stable:!1,metadata:{source:"user_input"}}],this.promptContextEngine.buildEnvelope({conversationId:null,messageId:r,layerSegments:n,metadata:{debugLabel:`message:${r}`,chainType:e.chainType}})}buildCompactedEnvelope(e){let r=e.message.id;if(!r)return;let n={};return e.systemPrompt&&(n.L1_SYSTEM=[{id:"system",content:e.systemPrompt,stable:!0,metadata:{source:"system_prompt"}}]),e.compactedContext.trim()&&(n.L3_TURN=[{id:"compacted_context",content:e.compactedContext,stable:!1,metadata:{source:"compacted",wasCompacted:!0,compactedPaths:e.compactedPaths}}]),n.L5_USER=[{id:`${r}-user`,content:e.processedUserMessage,stable:!1,metadata:{source:"user_input"}}],this.promptContextEngine.buildEnvelope({conversationId:null,messageId:r,layerSegments:n,metadata:{debugLabel:`message:${r}:compacted`,chainType:e.chainType}})}parseContextIntoSegments(e,r){return Znn(e,r)}appendParsedSegments(e,r,n){let o=(r||"").trim();if(!o)return;let i=this.parseContextIntoSegments(o,!1);if(i.length>0)for(let a of i)n&&(a.metadata={...a.metadata,...n}),e.push(a);else e.push({id:`unparsed-${Date.now()}`,content:o,stable:!1,metadata:{source:"unparsed",...n}})}createMessageContext(e,r,n=zC()){return{notes:e,urls:r,selectedTextContexts:n}}async extractContextNotes(e,r,n=[]){return[...await ES(e,r),...n].filter((s,u,l)=>l.findIndex(c=>c.path===s.path)===u)}needsContextReprocessing(e){return e.needsContextReprocessing===!0}getSelectedTextContexts(){return zC()}compactSegmentForL2(e){let r=[...WX.map(i=>i.tag),"prior_context","prior_context_note"].join("|"),n=new RegExp(`<(${r})(\\s[^>]*)?>[\\s\\S]*?</\\1>`,"g");return e.replace(n,(i,a)=>{let s=WX.find(u=>u.tag===a);return s&&!s.recoverable||a==="prior_context_note"?"":a==="prior_context"?i:s?Gnn(i,a):i}).trim()}};Dt();Xe();var tQ=class{constructor(){this.messages=[]}generateId(){return`msg-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}addMessage(e,r,n,o,i){if(typeof e=="object"){let c=e,d=c.id||this.generateId(),f=c.timestamp||vg(new Date),p={id:d,displayText:c.message,processedText:c.originalMessage||c.message,sender:c.sender,timestamp:f,context:c.context,contextEnvelope:c.contextEnvelope,isVisible:c.isVisible!==!1,isErrorMessage:c.isErrorMessage,sources:c.sources,content:c.content,responseMetadata:c.responseMetadata};return this.messages.push(p),F(`[MessageRepository] Added message with ID: ${d}`),d}if(r===void 0||n===void 0)throw new Error("processedText and sender are required when using string-based addMessage");let a=e,s=this.generateId(),u=vg(new Date),l={id:s,displayText:a,processedText:r,sender:n,timestamp:u,context:o,contextEnvelope:void 0,isVisible:!0,isErrorMessage:!1,content:i};return this.messages.push(l),F(`[MessageRepository] Added message with ID: ${s}`),s}editMessage(e,r){let n=this.messages.find(o=>o.id===e);return n?n.displayText===r?(F(`[MessageRepository] No changes needed for message: ${e}`),!0):(n.displayText=r,n.sender==="user"||n.sender==="USER"?F(`[MessageRepository] Edited user message ${e}, needs context reprocessing`):(n.processedText=r,F(`[MessageRepository] Edited AI message ${e}`)),!0):(F(`[MessageRepository] Message not found for edit: ${e}`),!1)}updateProcessedText(e,r,n){let o=this.messages.find(i=>i.id===e);return o?(o.processedText=r,o.contextEnvelope=n,F(`[MessageRepository] Updated processed text for message ${e}`),!0):(F(`[MessageRepository] Message not found for processed text update: ${e}`),!1)}deleteMessage(e){let r=this.messages.findIndex(n=>n.id===e);return r===-1?(F(`[MessageRepository] Message not found for deletion: ${e}`),!1):(this.messages.splice(r,1),F(`[MessageRepository] Deleted message ${e}`),!0)}clear(){this.messages=[],F("[MessageRepository] Cleared all messages")}truncateAfter(e){this.messages=this.messages.slice(0,e+1),F(`[MessageRepository] Truncated messages after index ${e}`)}truncateAfterMessageId(e){let r=this.messages.findIndex(n=>n.id===e);r!==-1&&(this.messages=this.messages.slice(0,r+1),F(`[MessageRepository] Truncated messages after message ${e}`))}getDisplayMessages(){return this.messages.filter(e=>e.isVisible).map(e=>({id:e.id,message:e.displayText,originalMessage:e.displayText,sender:e.sender,timestamp:e.timestamp,isVisible:!0,context:e.context,contextEnvelope:e.contextEnvelope,isErrorMessage:e.isErrorMessage,sources:e.sources,content:e.content,responseMetadata:e.responseMetadata}))}getLLMMessage(e){let r=this.messages.find(n=>n.id===e);if(r)return{id:r.id,message:r.processedText,originalMessage:r.displayText,sender:r.sender,timestamp:r.timestamp,isVisible:!1,context:r.context,contextEnvelope:r.contextEnvelope,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content,responseMetadata:r.responseMetadata}}getLLMMessages(){return this.messages.map(e=>({id:e.id,message:e.displayText,originalMessage:e.displayText,sender:e.sender,timestamp:e.timestamp,isVisible:!1,context:e.context,contextEnvelope:e.contextEnvelope,isErrorMessage:e.isErrorMessage,sources:e.sources,content:e.content}))}getMessage(e){let r=this.messages.find(n=>n.id===e);if(r)return{id:r.id,message:r.displayText,originalMessage:r.displayText,sender:r.sender,timestamp:r.timestamp,isVisible:r.isVisible,context:r.context,contextEnvelope:r.contextEnvelope,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content}}loadMessages(e){this.clear(),e.forEach(r=>{this.messages.push({id:r.id||this.generateId(),displayText:r.message,processedText:r.originalMessage||r.message,sender:r.sender,timestamp:r.timestamp||vg(new Date),context:r.context,contextEnvelope:r.contextEnvelope,isVisible:r.isVisible!==!1,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content})}),F(`[MessageRepository] Loaded ${e.length} messages`)}getDebugInfo(){return{totalMessages:this.messages.length,visibleMessages:this.messages.filter(e=>e.isVisible).length,userMessages:this.messages.filter(e=>e.sender==="user"||e.sender==="USER").length,aiMessages:this.messages.filter(e=>e.sender==="AI"||e.sender==="assistant").length}}};na();gr();Xe();Qe();Dt();var eon=require("obsidian");async function CSt(t,e){let r=t.vault.getAbstractFileByPath(e);return r||(await t.vault.adapter.exists(e)?ton(t,e):null)}function xSt(t,e){return t.vault.getAbstractFileByPath(e)!=null}async function _qe(t,e){let r=t.vault.getAbstractFileByPath(e);if(r instanceof eon.TFolder)return t.vault.getMarkdownFiles().filter(n=>n.path.startsWith(r.path));if(await t.vault.adapter.exists(e)){let o=(await t.vault.adapter.list(e)).files.filter(a=>a.endsWith(".md")),i=[];for(let a of o)i.push(await ton(t,a));return i}return[]}async function $fe(t,e,r){let n=t.vault.getAbstractFileByPath(e);if(n&&t.fileManager?.processFrontMatter){await t.fileManager.processFrontMatter(n,a=>{for(let[s,u]of Object.entries(r))a[s]=u});return}if(!await t.vault.adapter.exists(e))return;let o=await t.vault.adapter.read(e),i=o.replace(/^(---\n[\s\S]*?)(---)/,(a,s,u)=>{let l=s;for(let[c,d]of Object.entries(r)){let f=typeof d=="string"?`"${d.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:String(d),p=new RegExp(`^${c}:\\s*.+`,"m");p.test(l)?l=l.replace(p,`${c}: ${f}`):l+=`${c}: ${f}
`}return l+u});i!==o&&await t.vault.adapter.write(e,i)}async function vqe(t,e){let n=(await t.vault.adapter.read(e)).match(/^---\n([\s\S]*?)\n---/)?.[1];if(!n)return null;let o={};for(let i of n.split(`
`)){let a=i.match(/^(\w+):\s*(.+)/);a&&(o[a[1]]=a[2].trim().replace(/^["']|["']$/g,""))}return o}async function ton(t,e){let r=await t.vault.adapter.stat(e),n=e.split("/").pop()??"";return{path:e,name:n,basename:n.replace(/\.md$/,""),extension:"md",stat:r??{ctime:Date.now(),mtime:Date.now(),size:0},vault:t.vault,parent:null}}var f_=require("obsidian"),TSt=100;function Wvi(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}var Lfe=class{constructor(e,r,n){this.app=e;this.messageRepo=r;this.chainManager=n}async saveChat(e){try{let r=this.messageRepo.getDisplayMessages();if(r.length===0){new f_.Notice("No messages to save.");return}let n=ee(),o=this.formatChatContent(r),i=r[0].timestamp?.epoch||Date.now();await ql(n.defaultSaveFolder);let a=await this.findFileByEpoch(i),s=a?this.app.metadataCache.getFileCache(a)?.frontmatter:void 0,u=s?.topic,l=s?.lastAccessedAt;if(a&&!s)try{let h=await vqe(this.app,a.path);h&&(h.topic&&(u=h.topic),h.lastAccessedAt&&(l=Number(h.lastAccessedAt)))}catch{}let c=Gu(),d=a?a.path:this.generateFileName(c,r,i,u),f=this.generateNoteContent(o,i,e,u,l),p=a,m=a!=null&&xSt(this.app,a.path);if(a&&m)await this.app.vault.modify(a,f),F(`[ChatPersistenceManager] Updated existing chat file: ${a.path}`);else if(!xSt(this.app,d)&&await this.app.vault.adapter.exists(d))await this.app.vault.adapter.write(d,f),new f_.Notice("Existing chat note found - updating it now."),F(`[ChatPersistenceManager] Updated existing chat file via adapter: ${d}`);else try{p=await this.app.vault.create(d,f),new f_.Notice(`Chat saved as note: ${d}`),F(`[ChatPersistenceManager] Created new chat file: ${d}`)}catch(h){if(this.isFileAlreadyExistsError(h)){let y=this.app.vault.getAbstractFileByPath(d);if(y&&y instanceof f_.TFile){let g=this.app.metadataCache.getFileCache(y)?.frontmatter;u=g?.topic??u;let b=g?.lastAccessedAt,_=this.generateNoteContent(o,i,e,u,b);await this.app.vault.modify(y,_),p=y,new f_.Notice("Existing chat note found - updating it now."),F(`[ChatPersistenceManager] Resolved save conflict by updating existing chat file: ${y.path}`)}else await this.app.vault.adapter.write(d,f),new f_.Notice("Existing chat note found - updating it now."),F(`[ChatPersistenceManager] Resolved save conflict via adapter: ${d}`)}else if(this.isNameTooLongError(h)){let y=c?`${c.id}__`:"",g=`${n.defaultSaveFolder}/${y}chat-${i}.md`;try{p=await this.app.vault.create(g,f),new f_.Notice(`Chat saved as note: ${g}`),Ce(`[ChatPersistenceManager] Used minimal filename due to length constraints: ${g}`)}catch(b){if(this.isFileAlreadyExistsError(b)){let _=this.app.vault.getAbstractFileByPath(g);if(_&&_ instanceof f_.TFile){let w=this.app.metadataCache.getFileCache(_)?.frontmatter,T=w?.lastAccessedAt,O=w?.topic,E=this.generateNoteContent(o,i,e,O,T);await this.app.vault.modify(_,E),p=_,new f_.Notice("Existing chat note found - updating it now."),F(`[ChatPersistenceManager] Resolved fallback save conflict by updating existing chat file: ${_.path}`)}else await this.app.vault.adapter.write(g,f),new f_.Notice("Existing chat note found - updating it now."),F(`[ChatPersistenceManager] Resolved fallback save conflict via adapter: ${g}`)}else throw b}}else throw h}this.generateTopicAsyncIfNeeded(c,p,r,u)}catch(r){ie("[ChatPersistenceManager] Error saving chat:",r),new f_.Notice("Failed to save chat as note. Check console for details.")}}async loadChat(e){try{let r;try{r=await this.app.vault.read(e)}catch{r=await this.app.vault.adapter.read(e.path)}let n=this.parseChatContent(r);return F(`[ChatPersistenceManager] Loaded ${n.length} messages from ${e.path}`),n}catch(r){return ie("[ChatPersistenceManager] Error loading chat:",r),new f_.Notice("Failed to load chat history. Check console for details."),[]}}async getChatHistoryFiles(){let e=ee(),r=await _qe(this.app,e.defaultSaveFolder);if(r.length===0)return[];let n=Gu();return r.filter(o=>n?o.basename.startsWith(`${n.id}__`):!o.basename.includes("__")||!o.basename.split("__")[0])}formatChatContent(e){return e.map(r=>{let n=r.timestamp?r.timestamp.display:"Unknown time",o=r.message;if(r.sender===ow){let a=wce(o);a&&(o=a.contentAfter)}let i=`**${r.sender}**: ${o}`;if(r.context){let a=[];r.context.notes?.length&&a.push(`Notes: ${r.context.notes.map(s=>s.path).join(", ")}`),r.context.urls?.length&&a.push(`URLs: ${r.context.urls.join(", ")}`),r.context.webTabs?.length&&a.push(`Web Tabs: ${r.context.webTabs.map(s=>s.url).join(", ")}`),r.context.tags?.length&&a.push(`Tags: ${r.context.tags.join(", ")}`),r.context.folders?.length&&a.push(`Folders: ${r.context.folders.join(", ")}`),a.length>0&&(i+=`
[Context: ${a.join(" | ")}]`)}return i+=`
[Timestamp: ${n}]`,i}).join(`

`)}parseChatContent(e){let r=[],n=e.match(/^---\n([\s\S]*?)\n---/),o=e;n&&(o=e.slice(n[0].length).trim());let i=/\*\*(user|ai)\*\*: ([\s\S]*?)(?=(?:\n\*\*(?:user|ai)\*\*: )|$)/g,a;for(;(a=i.exec(o))!==null;){let s=a[1]==="user"?Zs:ow,u=a[2].trim(),l=u.split(`
`),c=u,d="Unknown time",f,p=l.length;if(l[p-1]?.startsWith("[Timestamp: ")){let h=l[p-1].match(/\[Timestamp: (.*?)\]/);h&&(d=h[1],p--)}if(p>0&&l[p-1]?.startsWith("[Context: ")){let h=l[p-1].match(/\[Context: (.*?)\]/);if(h){let y=h[1];f=this.parseContextString(y),p--}}if(c=l.slice(0,p).join(`
`).trim(),s===ow){c=c.replace(/<!--TOOL_CALL_START:[^:]+:[^:]+:[^:]+:[^:]+:[^:]*:[^:]+-->[\s\S]*?<!--TOOL_CALL_END:[^:]+:[\s\S]*?-->/g,"");let h=wce(c);h&&(c=h.contentAfter),c=c.replace(/\n{3,}/g,`

`).trim()}let m;if(d!=="Unknown time"){let h=new Date(d);isNaN(h.getTime())||(m=h.getTime())}r.push({message:c,sender:s,isVisible:!0,timestamp:m?{epoch:m,display:d,fileName:""}:null,context:f})}return r}parseContextString(e){let r={notes:[],urls:[],tags:[],folders:[],webTabs:[]},n=e.split(" | ");for(let o of n){let i=o.trim();if(i.startsWith("Notes: ")){let a=i.substring(7);a&&(r.notes=a.split(", ").map(s=>{let u=s.trim(),l=this.app.vault.getAbstractFileByPath(u);if(l instanceof f_.TFile)return l;let c=u.includes("/")?u.split("/").pop():u,d=this.app.vault.getMarkdownFiles().filter(f=>f.basename===c);return d.length===1?(F(`[ChatPersistenceManager] Resolved legacy basename "${c}" to ${d[0].path}`),d[0]):(d.length>1?Ce(`[ChatPersistenceManager] Ambiguous basename "${c}", skipping. Matches: ${d.map(f=>f.path).join(", ")}`):Ce(`[ChatPersistenceManager] Note not found: ${u}`),null)}).filter(s=>s!==null))}else if(i.startsWith("URLs: ")){let a=i.substring(6);a&&(r.urls=a.split(", ").map(s=>s.trim()))}else if(i.startsWith("Web Tabs: ")||i.startsWith("WebTabs: ")){let a=i.startsWith("Web Tabs: ")?i.substring(10):i.substring(9);a&&(r.webTabs=a.split(", ").map(s=>s.trim()).filter(s=>s.length>0).map(s=>({url:s})))}else if(i.startsWith("Tags: ")){let a=i.substring(6);a&&(r.tags=a.split(", ").map(s=>s.trim()))}else if(i.startsWith("Folders: ")){let a=i.substring(9);a&&(r.folders=a.split(", ").map(s=>s.trim()))}}if(r.notes.length>0||r.urls.length>0||r.tags.length>0||r.folders.length>0||r.webTabs.length>0)return r}async findFileByEpoch(e){let r=await this.getChatHistoryFiles();for(let n of r){let o=this.app.metadataCache.getFileCache(n)?.frontmatter?.epoch;if(o===void 0)try{let a=await vqe(this.app,n.path);a?.epoch&&(o=Number(a.epoch))}catch{continue}let i=typeof o=="number"?o:typeof o=="string"?Number(o):void 0;if(typeof i=="number"&&!Number.isNaN(i)&&i===e)return n}return null}async generateAITopic(e){if(this.chainManager)try{let r=this.chainManager.chatModelManager.getChatModel();if(!r)return;let n=6,o=200,a=`Generate a concise title (max 5 words) for this conversation based on its content. Return only the title without any explanation or quotes.

Conversation:
${e.reduce((c,d,f)=>f>=n?c:c+(c?`
`:"")+`${d.sender}: ${d.message.slice(0,o)}`,"")}`,s=await r.invoke(a),u=typeof s=="string"?s:s.content??s.text??s;return tF(u).trim().replace(/^["']|["']$/g,"").replace(/[\\/:*?"<>|]/g,"").slice(0,50)||void 0}catch(r){ie("[ChatPersistenceManager] Error generating AI topic:",r);return}}generateFileName(e,r,n,o){let i=ee(),s=vg(new Date(n)).fileName,u;if(o)u=o;else{let T=r.find(O=>O.sender===Zs);u=T&&T.message.replace(/\[\[([^\]]+)\]\]/g,"$1").replace(/[{}[\]]/g,"").split(/\s+/).slice(0,10).join(" ").replace(/[\\/:*?"<>|\x00-\x1F]/g,"").trim()||"Untitled Chat"}let l=i.defaultConversationNoteName||"{$date}_{$time}__{$topic}",c=e===void 0?Gu():e,d=c?`${c.id}__`:"",f=b4(".md"),p=b4(d),m=l.replace("{$topic}","").replace("{$date}",s.split("_")[0]).replace("{$time}",s.split("_")[1]),h=b4(m),y=Math.max(20,TSt-f-p-h),g=u.replace(/\s+/g,"_"),b=ote(g,y);l=l.replace("{$topic}",b).replace("{$date}",s.split("_")[0]).replace("{$time}",s.split("_")[1]);let _=l.replace(/\[\[([^\]]+)\]\]/g,"$1").replace(/[{}[\]]/g,"_").replace(/[\\/:*?"<>|\x00-\x1F]/g,"_"),w=`${d}${_}.md`;if(b4(w)>TSt){let T=TSt-f-p,O=ote(_,T);return`${i.defaultSaveFolder}/${d}${O}.md`}return`${i.defaultSaveFolder}/${w}`}generateNoteContent(e,r,n,o,i){let a=ee(),s=Gu();return`---
epoch: ${r}
modelKey: "${Wvi(n)}"
${o?`topic: "${o}"`:""}
${i?`lastAccessedAt: ${i}`:""}
${s?`projectId: ${s.id}`:""}
${s?`projectName: ${s.name}`:""}
tags:
  - ${a.defaultConversationTag}
---

${e}`}generateTopicAsyncIfNeeded(e,r,n,o){!ee().generateAIChatTitleOnSave||!r||o||(async()=>{try{let a=await this.generateAITopic(n);if(!a)return;await this.applyTopicToFrontmatter(r,a),await this.renameFileToMatchTopic(e,r,a)}catch(a){ie("[ChatPersistenceManager] Error during async topic generation:",a)}})()}async applyTopicToFrontmatter(e,r){try{await $fe(this.app,e.path,{topic:r.trim()}),F(`[ChatPersistenceManager] Applied AI topic to chat file: ${e.path}`)}catch(n){ie("[ChatPersistenceManager] Error applying AI topic to file:",n)}}isNameTooLongError(e){if(!e)return!1;let n=(e instanceof Error?e.message:String(e)).toLowerCase();return n.includes("enametoolong")||n.includes("name too long")}isFileAlreadyExistsError(e){return e?(e instanceof Error?e.message:String(e)).toLowerCase().includes("already exists"):!1}async renameFileToMatchTopic(e,r,n){if(!r||!n)return;let o,i=this.app.metadataCache.getFileCache(r);if(i?.frontmatter?.epoch)o=i.frontmatter.epoch;else try{let u=await vqe(this.app,r.path);u?.epoch&&(o=Number(u.epoch))}catch{}if(!o)return;let a=this.messageRepo.getDisplayMessages(),s=this.generateFileName(e,a,o,n);r.path!==s&&await this.app.fileManager.renameFile(r,s)}};gr();T3();AZ();var wqe=class{constructor(e,r,n,o){this.messageRepo=e;this.chainManager=r;this.fileParserManager=n;this.plugin=o;this.projectMessageRepos=new Map;this.defaultProjectKey="defaultProjectKey";this.lastKnownProjectId=null;this.contextManager=bqe.getInstance(),this.projectMessageRepos.set(this.defaultProjectKey,e),this.persistenceManager=new Lfe(o.app,e,r)}getCurrentMessageRepo(){let e=this.plugin.projectManager.getCurrentProjectId(),r=e??this.defaultProjectKey;if(this.lastKnownProjectId!==e&&(F(`[ChatManager] Project changed from ${this.lastKnownProjectId} to ${e}`),this.lastKnownProjectId=e),!this.projectMessageRepos.has(r)){F(`[ChatManager] Creating new message repository for project: ${r}`);let o=new tQ;this.projectMessageRepos.set(r,o)}let n=this.projectMessageRepos.get(r);return this.persistenceManager=new Lfe(this.plugin.app,n,this.chainManager),n}setOnMessageCreatedCallback(e){this.onMessageCreatedCallback=e}async processSystemPromptTemplates(e,r,n){if(!e.includes("{")||!e.includes("}"))return{processedPrompt:e,includedFiles:[]};if(!ee().enableCustomPromptTemplating)return{processedPrompt:e,includedFiles:[]};try{let i=await kce(e,"",r,n,!0);return{processedPrompt:i.processedPrompt.trimEnd(),includedFiles:i.includedFiles}}catch(i){return Ce("[ChatManager] Error processing system prompt templates:",i),{processedPrompt:e,includedFiles:[]}}}injectProcessedUserCustomPromptIntoSystemPrompt(e){let{systemPromptWithoutMemory:r,userCustomPrompt:n,processedUserCustomPrompt:o}=e,i=/<user_custom_instructions>\n[\s\S]*?\n<\/user_custom_instructions>/;return i.test(r)?r.replace(i,()=>`<user_custom_instructions>
${o}
</user_custom_instructions>`):r===n?o:(F("[ChatManager] Could not locate <user_custom_instructions> block for injection; returning original system prompt."),r)}replaceSystemPromptWithoutMemoryInBasePrompt(e){let{basePromptWithMemory:r,systemPromptWithoutMemory:n,processedSystemPromptWithoutMemory:o}=e;return r.endsWith(n)?`${r.slice(0,r.length-n.length)}${o}`:(F("[ChatManager] basePromptWithMemory does not end with systemPromptWithoutMemory; returning original base prompt."),r)}async getSystemPromptForMessage(e,r,n){let o=pDe(),i=[],a=await _$(this.chainManager.userMemoryManager),s=b$(),u=a;if(o){let l=await this.processSystemPromptTemplates(o,r,n),c=this.injectProcessedUserCustomPromptIntoSystemPrompt({systemPromptWithoutMemory:s,userCustomPrompt:o,processedUserCustomPrompt:l.processedPrompt}),d=this.replaceSystemPromptWithoutMemoryInBasePrompt({basePromptWithMemory:a,systemPromptWithoutMemory:s,processedSystemPromptWithoutMemory:c});d!==a&&i.push(...l.includedFiles),u=d}if(e==="project"){let l=Gu();if(l){let c=await Vg.instance.getProjectContext(l.id),d=await this.processSystemPromptTemplates(l.systemPrompt,r,n);i.push(...d.includedFiles);let f=`${u}

<project_system_prompt>
${d.processedPrompt}
</project_system_prompt>`;if(c){let m=c;c.length>24e5&&(m=c.substring(0,24e5),Ce(`Project context truncated from ${Math.round(c.length/4e3)}k to ${Math.round(24e5/4e3)}k estimated tokens to stay within token budget`)),f+=`

<project_context>
${m}
</project_context>`}return{processedPrompt:f,includedFiles:i}}}return{processedPrompt:u,includedFiles:i}}buildWebTabsWithActiveSnapshot(e,r){let n=$8r(e);if(!r)return n;try{let a=md(this.plugin.app).getActiveWebTabState().activeWebTabForMentions,s=IZ(a?.url);if(!s)return n;let u=n.map(c=>{if(c.isActive){let{isActive:d,...f}=c;return f}return c}),l=u.findIndex(c=>IZ(c.url)===s);if(l>=0){let c=u[l];return u[l]={...c,url:ub(a?.url)??c.url,title:a?.title??c.title,faviconUrl:a?.faviconUrl??c.faviconUrl,isActive:!0},u}return[...u,{url:ub(a?.url)??s,title:a?.title,faviconUrl:a?.faviconUrl,isActive:!0}]}catch(o){return Ce("[ChatManager] Failed to resolve active web tab:",o),n}}async sendMessage(e,r,n,o=!1,i=!1,a,s){try{F(`[ChatManager] Sending message: "${e}"`);let u=this.plugin.app.workspace.getActiveFile(),l={...r};if(o&&u){let _=r.notes||[],w=_.some(T=>T.path===u.path);l.notes=w?_:[..._,u]}let d=!((l.selectedTextContexts||[]).length>0)&&(i||e.includes(yte));l.webTabs=this.buildWebTabsWithActiveSnapshot(l.webTabs||[],d);let f=this.getCurrentMessageRepo(),p=f.addMessage(e,e,Zs,l,a);this.onMessageCreatedCallback&&this.onMessageCreatedCallback(p);let m=f.getMessage(p);if(!m)throw new Error(`Failed to retrieve message ${p}`);let{processedPrompt:h,includedFiles:y}=await this.getSystemPromptForMessage(n,this.plugin.app.vault,u),{processedContent:g,contextEnvelope:b}=await this.contextManager.processMessageContext(m,this.fileParserManager,this.plugin.app.vault,n,o,u,f,h,y,s);return f.updateProcessedText(p,g,b),F(`[ChatManager] Successfully sent message ${p}`),p}catch(u){throw F("[ChatManager] Error sending message:",u),u}}async editMessage(e,r,n,o=!1){try{F(`[ChatManager] Editing message ${e}: "${r}"`);let i=this.getCurrentMessageRepo();if(!i.editMessage(e,r))return!1;let s=this.plugin.app.workspace.getActiveFile(),{processedPrompt:u,includedFiles:l}=await this.getSystemPromptForMessage(n,this.plugin.app.vault,s);return await this.contextManager.reprocessMessageContext(e,i,this.fileParserManager,this.plugin.app.vault,n,o,s,u,l),await this.updateChainMemory(),F(`[ChatManager] Successfully edited message ${e}`),!0}catch(i){return F(`[ChatManager] Error editing message ${e}:`,i),!1}}async regenerateMessage(e,r,n,o){try{F(`[ChatManager] Regenerating message ${e}`);let i=this.getCurrentMessageRepo();if(!i.getMessage(e))return F(`[ChatManager] Message not found: ${e}`),!1;let s=i.getDisplayMessages(),u=s.findIndex(f=>f.id===e);if(u<=0)return F("[ChatManager] Cannot regenerate first message or no user message found"),!1;let l=s[u-1];if(l.sender!==Zs)return F("[ChatManager] Previous message is not from user"),!1;if(i.truncateAfter(u-1),o&&o(),await this.updateChainMemory(),!l.id)return F("[ChatManager] User message has no ID for regeneration"),!1;let c=i.getLLMMessage(l.id);if(!c)return F("[ChatManager] LLM message not found for regeneration"),!1;if(!c.contextEnvelope){F("[ChatManager] Context envelope missing, reprocessing context for regeneration");let f=UC(),p=this.plugin.app.workspace.getActiveFile(),{processedPrompt:m,includedFiles:h}=await this.getSystemPromptForMessage(f,this.plugin.app.vault,p);await this.contextManager.reprocessMessageContext(l.id,i,this.fileParserManager,this.plugin.app.vault,f,!1,p,m,h),c=i.getLLMMessage(l.id)}let d=new AbortController;return await this.chainManager.runChain(c,d,r,n,{debug:ee().debug}),F(`[ChatManager] Successfully regenerated message ${e}`),!0}catch(i){return F(`[ChatManager] Error regenerating message ${e}:`,i),!1}}async deleteMessage(e){try{return F(`[ChatManager] Deleting message ${e}`),this.getCurrentMessageRepo().deleteMessage(e)?(await this.updateChainMemory(),F(`[ChatManager] Successfully deleted message ${e}`),!0):!1}catch(r){return F(`[ChatManager] Error deleting message ${e}:`,r),!1}}addMessage(e){return this.getCurrentMessageRepo().addMessage(e)}clearMessages(){this.getCurrentMessageRepo().clear(),this.chainManager.memoryManager.clearChatMemory(),F("[ChatManager] Cleared all messages")}async truncateAfterMessageId(e){this.getCurrentMessageRepo().truncateAfterMessageId(e),await this.updateChainMemory(),F(`[ChatManager] Truncated messages after ${e}`)}getDisplayMessages(){return this.getCurrentMessageRepo().getDisplayMessages()}getLLMMessages(){return this.getCurrentMessageRepo().getLLMMessages()}getMessage(e){return this.getCurrentMessageRepo().getMessage(e)}getLLMMessage(e){return this.getCurrentMessageRepo().getLLMMessage(e)}async updateChainMemory(){try{let r=this.getCurrentMessageRepo().getLLMMessages();await Hnn(r,this.chainManager.memoryManager),F(`[ChatManager] Updated chain memory with ${r.length} messages`)}catch(e){F("[ChatManager] Error updating chain memory:",e)}}async loadMessages(e){let r=this.getCurrentMessageRepo();r.clear(),e.forEach(n=>{r.addMessage(n)}),await this.updateChainMemory(),F(`[ChatManager] Loaded ${e.length} messages`)}async saveChat(e){await this.persistenceManager.saveChat(e)}getDebugInfo(){return{...this.getCurrentMessageRepo().getDebugInfo(),currentProject:this.plugin.projectManager.getCurrentProjectId(),totalProjects:this.projectMessageRepos.size}}async handleProjectSwitch(){let e=this.plugin.projectManager.getCurrentProjectId();F(`[ChatManager] Handling project switch to: ${e}`),this.lastKnownProjectId=null;let r=this.getCurrentMessageRepo();await this.updateChainMemory(),F(`[ChatManager] Project switch complete. Messages: ${r.getDisplayMessages().length}`)}async loadChatHistory(e){this.clearMessages();let r=await this.persistenceManager.loadChat(e),n=this.getCurrentMessageRepo();for(let o of r)n.addMessage(o);await this.updateChainMemory(),F(`[ChatManager] Loaded ${r.length} messages from chat history`)}};BC();Xe();h4();id();T3();tbt();y_();var Sqe=class{constructor(e){this.timeoutId=null;this.isRunning=!1;this.leafState=new WeakMap;this.suppressedSelectionsByUrl=new Map;this.intervalMs=e.intervalMs??500;let r=e.emptySelectionDebounceCount??2;this.emptySelectionDebounceCount=Number.isFinite(r)&&r>0?Math.floor(r):2,this.isEnabled=e.isEnabled,this.getLeaf=e.getLeaf,this.getActiveLeaf=e.getActiveLeaf,this.onSelectionChange=e.onSelectionChange,this.onSelectionClear=e.onSelectionClear}start(){this.isRunning||(this.isRunning=!0,this.scheduleNext())}stop(){this.isRunning=!1,this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.leafState=new WeakMap,this.suppressedSelectionsByUrl=new Map}scheduleNext(){this.isRunning&&(this.timeoutId=setTimeout(async()=>{await this.checkSelection(),this.scheduleNext()},this.intervalMs))}async checkSelection(){if(this.isEnabled())try{let e=this.getLeaf();if(!e)return;let r=this.getOrCreateLeafState(e),n=RZ(e),o=n.url;if(this.isValidUrl(o))r.consecutiveInvalidUrlChecks=0;else{r.consecutiveEmptyChecks=0,this.maybeClearSelectionForInvalidUrl(e,r);return}let i=await Z$e(e);if(!i.trim()){this.handleEmptySelection(e,r);return}if(r.consecutiveEmptyChecks=0,this.shouldSuppressSelectionForUrl(o,i)||r.lastSelection&&r.lastSelection.url===o&&r.lastSelection.text===i)return;let a=await Y$e(e);if(!a.trim()||this.shouldSuppressSelectionForUrl(o,i))return;r.lastSelection={url:o,text:i};let s={id:gu(),content:a,sourceType:"web",title:n.title||"Untitled",url:o,faviconUrl:n.faviconUrl||void 0};this.onSelectionChange(s)}catch{}}getOrCreateLeafState(e){let r=this.leafState.get(e);if(r)return r;let n={lastSelection:null,consecutiveEmptyChecks:0,consecutiveInvalidUrlChecks:0};return this.leafState.set(e,n),n}isValidUrl(e){let r=e.trim();if(!r)return!1;try{return new URL(r),!0}catch{return!1}}isActiveWebViewerLeaf(e){let r=this.getActiveLeaf();return!!(r&&r===e)}handleEmptySelection(e,r){if(!r.lastSelection||!this.isActiveWebViewerLeaf(e)||(r.consecutiveEmptyChecks+=1,r.consecutiveEmptyChecks<this.emptySelectionDebounceCount))return;let n=r.lastSelection.url;r.lastSelection=null,r.consecutiveEmptyChecks=0,this.clearSuppressionForUrl(n),this.onSelectionClear({url:n,reason:"selection-cleared"})}maybeClearSelectionForInvalidUrl(e,r){if(!r.lastSelection||!this.isActiveWebViewerLeaf(e)||(r.consecutiveInvalidUrlChecks+=1,r.consecutiveInvalidUrlChecks<this.emptySelectionDebounceCount))return;let n=r.lastSelection.url;r.lastSelection=null,r.consecutiveEmptyChecks=0,r.consecutiveInvalidUrlChecks=0,this.clearSuppressionForUrl(n),this.onSelectionClear({url:n,reason:"invalid-url"})}clearSuppressionForUrl(e){this.suppressedSelectionsByUrl.delete(e.trim())}shouldSuppressSelectionForUrl(e,r){let n=e.trim(),o=this.suppressedSelectionsByUrl.get(n);return o===void 0?!1:o===null?(this.suppressedSelectionsByUrl.set(n,r),!0):o===r?!0:(this.suppressedSelectionsByUrl.delete(n),!1)}suppressSelectionForUrl(e){let r=e.trim();this.isValidUrl(r)&&this.suppressedSelectionsByUrl.set(r,null)}suppressCurrentSelection(){let e=this.getLeaf();if(!e)return;let r=RZ(e);this.suppressSelectionForUrl(r.url)}};El();gr();Qe();Xe();var ope=require("obsidian"),QSt=$(K()),ran=$(Im());var Cqe=class extends nu{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")}};xn();var Ffe=$(K());zr();var ron=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>Ffe.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:Se("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-sm","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-max-w-full","tw-transition-all tw-duration-300 tw-ease-in-out","tw-delay-100"],"lg:tw-max-w-32","md:tw-max-w-32")},Ffe.default.createElement("div",{className:Se("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),Ffe.default.createElement("span",{className:Se("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)),non=({id:t,children:e,isSelected:r})=>r?Ffe.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:Se("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 uS=$(K()),oon=(0,uS.createContext)(void 0),ion=({children:t})=>{let[e,r]=(0,uS.useState)("basic"),[n,o]=(0,uS.useState)(null),i=(0,uS.useRef)(!1);return(0,uS.useEffect)(()=>{if(!i.current){let a=document.querySelector(".modal-container");o(a),i.current=!0}},[]),uS.default.createElement(oon.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},sz=()=>{let t=(0,uS.useContext)(oon);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};Qe();var Et=$(K());xn();var iu=$(K());xn();zr();var gd=$(K());var Ze=$(K()),v6=$(yu());var hd=$(K());function son(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,hd.useMemo)(()=>n=>{e.forEach(o=>o(n))},e)}var kfe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function m6(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function xqe(t){return"nodeType"in t}function p_(t){var e,r;return t?m6(t)?t:xqe(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function Tqe(t){let{Document:e}=p_(t);return t instanceof e}function rQ(t){return m6(t)?!1:t instanceof p_(t).HTMLElement}function ESt(t){return t instanceof p_(t).SVGElement}function h6(t){return t?m6(t)?t.document:xqe(t)?Tqe(t)?t:rQ(t)||ESt(t)?t.ownerDocument:document:document:document}var yC=kfe?hd.useLayoutEffect:hd.useEffect;function Oqe(t){let e=(0,hd.useRef)(t);return yC(()=>{e.current=t}),(0,hd.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 uon(){let t=(0,hd.useRef)(null),e=(0,hd.useCallback)((n,o)=>{t.current=setInterval(n,o)},[]),r=(0,hd.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function nQ(t,e){e===void 0&&(e=[t]);let r=(0,hd.useRef)(t);return yC(()=>{r.current!==t&&(r.current=t)},e),r}function oQ(t,e){let r=(0,hd.useRef)();return(0,hd.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function qfe(t){let e=Oqe(t),r=(0,hd.useRef)(null),n=(0,hd.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function Eqe(t){let e=(0,hd.useRef)();return(0,hd.useEffect)(()=>{e.current=t},[t]),e.current}var OSt={};function g6(t,e){return(0,hd.useMemo)(()=>{if(e)return e;let r=OSt[t]==null?0:OSt[t]+1;return OSt[t]=r,t+"-"+r},[t,e])}function lon(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 y6=lon(1),b6=lon(-1);function Jvi(t){return"clientX"in t&&"clientY"in t}function Bfe(t){if(!t)return!1;let{KeyboardEvent:e}=p_(t.target);return e&&t instanceof e}function Kvi(t){if(!t)return!1;let{TouchEvent:e}=p_(t.target);return e&&t instanceof e}function Pqe(t){if(Kvi(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 Jvi(t)?{x:t.clientX,y:t.clientY}:null}var gC=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[gC.Translate.toString(t),gC.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),aon="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function con(t){return t.matches(aon)?t:t.querySelector(aon)}var _6=$(K()),Gvi={display:"none"};function don(t){let{id:e,value:r}=t;return _6.default.createElement("div",{id:e,style:Gvi},r)}function fon(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 _6.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function pon(){let[t,e]=(0,_6.useState)("");return{announce:(0,_6.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var Oon=(0,Ze.createContext)(null);function Xvi(t){let e=(0,Ze.useContext)(Oon);(0,Ze.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Zvi(){let[t]=(0,Ze.useState)(()=>new Set),e=(0,Ze.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,Ze.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 Yvi={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.
  `},Qvi={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 ewi(t){let{announcements:e=Qvi,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=Yvi}=t,{announce:i,announcement:a}=pon(),s=g6("DndLiveRegion"),[u,l]=(0,Ze.useState)(!1);if((0,Ze.useEffect)(()=>{l(!0)},[]),Xvi((0,Ze.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=Ze.default.createElement(Ze.default.Fragment,null,Ze.default.createElement(don,{id:n,value:o.draggable}),Ze.default.createElement(fon,{id:s,announcement:a}));return r?(0,v6.createPortal)(c,r):c}var _h;(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"})(_h||(_h={}));function Rqe(){}function iQ(t,e){return(0,Ze.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function Aqe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,Ze.useMemo)(()=>[...e].filter(n=>n!=null),[...e])}var DT=Object.freeze({x:0,y:0});function Eon(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Pon(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function twi(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function mon(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 $St(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function hon(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 aQ=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=hon(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=Eon(hon(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(Pon)},Mon=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=mon(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=mon(u),c=o.reduce((f,p,m)=>f+Eon(l[m],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(Pon)};function rwi(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 nwi=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=rwi(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(twi)};function owi(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function Ron(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:DT}function iwi(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 awi=iwi(1);function swi(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 uwi(t,e,r){let n=swi(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 lwi={ignoreTransform:!1};function C6(t,e){e===void 0&&(e=lwi);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=p_(t).getComputedStyle(t);l&&(r=uwi(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 gon(t){return C6(t,{ignoreTransform:!0})}function cwi(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function dwi(t,e){return e===void 0&&(e=p_(t).getComputedStyle(t)),e.position==="fixed"}function fwi(t,e){e===void 0&&(e=p_(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 Wfe(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(Tqe(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!rQ(o)||ESt(o)||r.includes(o))return r;let i=p_(t).getComputedStyle(o);return o!==t&&fwi(o,i)&&r.push(o),dwi(o,i)?r:n(o.parentNode)}return t?n(t):r}function Ion(t){let[e]=Wfe(t,1);return e??null}function PSt(t){return!kfe||!t?null:m6(t)?t:xqe(t)?Tqe(t)||t===h6(t).scrollingElement?window:rQ(t)?t:null:null}function Aon(t){return m6(t)?t.scrollX:t.scrollLeft}function Non(t){return m6(t)?t.scrollY:t.scrollTop}function ISt(t){return{x:Aon(t),y:Non(t)}}var fg;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(fg||(fg={}));function Don(t){return!kfe||!t?!1:t===document.scrollingElement}function jon(t){let e={x:0,y:0},r=Don(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 pwi={x:.2,y:.2};function mwi(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=pwi);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=jon(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=fg.Backward,m.y=n*Math.abs((e.top+h.height-i)/h.height)):!c&&u>=e.bottom-h.height&&(p.y=fg.Forward,m.y=n*Math.abs((e.bottom-h.height-u)/h.height)),!f&&s>=e.right-h.width?(p.x=fg.Forward,m.x=n*Math.abs((e.right-h.width-s)/h.width)):!d&&a<=e.left+h.width&&(p.x=fg.Backward,m.x=n*Math.abs((e.left+h.width-a)/h.width)),{direction:p,speed:m}}function hwi(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 $on(t){return t.reduce((e,r)=>y6(e,ISt(r)),DT)}function gwi(t){return t.reduce((e,r)=>e+Aon(r),0)}function ywi(t){return t.reduce((e,r)=>e+Non(r),0)}function bwi(t,e){if(e===void 0&&(e=C6),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);Ion(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var _wi=[["x",["left","right"],gwi],["y",["top","bottom"],ywi]],zfe=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=Wfe(r),o=$on(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of _wi)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})}},w6=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 vwi(t){let{EventTarget:e}=p_(t);return t instanceof e?t:h6(t)}function MSt(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 bC;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(bC||(bC={}));function yon(t){t.preventDefault()}function wwi(t){t.stopPropagation()}var Ui;(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"})(Ui||(Ui={}));var Lon={start:[Ui.Space,Ui.Enter],cancel:[Ui.Esc],end:[Ui.Space,Ui.Enter,Ui.Tab]},Swi=(t,e)=>{let{currentCoordinates:r}=e;switch(t.code){case Ui.Right:return{...r,x:r.x+25};case Ui.Left:return{...r,x:r.x-25};case Ui.Down:return{...r,y:r.y+25};case Ui.Up:return{...r,y:r.y-25}}},lz=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 w6(h6(r)),this.windowListeners=new w6(p_(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(bC.Resize,this.handleCancel),this.windowListeners.add(bC.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(bC.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,n=e.node.current;n&&bwi(n),r(DT)}handleKeyDown(e){if(Bfe(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=Lon,coordinateGetter:a=Swi,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}:DT;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(e,{active:r,context:n.current,currentCoordinates:c});if(d){let f=b6(d,c),p={x:0,y:0},{scrollableAncestors:m}=n.current;for(let h of m){let y=e.code,{isTop:g,isRight:b,isLeft:_,isBottom:w,maxScroll:T,minScroll:O}=jon(h),E=hwi(h),P={x:Math.min(y===Ui.Right?E.right-E.width/2:E.right,Math.max(y===Ui.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(y===Ui.Down?E.bottom-E.height/2:E.bottom,Math.max(y===Ui.Down?E.top:E.top+E.height/2,d.y))},R=y===Ui.Right&&!b||y===Ui.Left&&!_,I=y===Ui.Down&&!w||y===Ui.Up&&!g;if(R&&P.x!==d.x){let A=h.scrollLeft+f.x,B=y===Ui.Right&&A<=T.x||y===Ui.Left&&A>=O.x;if(B&&!f.y){h.scrollTo({left:A,behavior:s});return}B?p.x=h.scrollLeft-A:p.x=y===Ui.Right?h.scrollLeft-T.x:h.scrollLeft-O.x,p.x&&h.scrollBy({left:-p.x,behavior:s});break}else if(I&&P.y!==d.y){let A=h.scrollTop+f.y,B=y===Ui.Down&&A<=T.y||y===Ui.Up&&A>=O.y;if(B&&!f.x){h.scrollTo({top:A,behavior:s});return}B?p.y=h.scrollTop-A:p.y=y===Ui.Down?h.scrollTop-T.y:h.scrollTop-O.y,p.y&&h.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,y6(b6(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()}};lz.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=Lon,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 bon(t){return!!(t&&"distance"in t)}function _on(t){return!!(t&&"delay"in t)}var Vfe=class{constructor(e,r,n){var o;n===void 0&&(n=vwi(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=h6(a),this.documentListeners=new w6(this.document),this.listeners=new w6(n),this.windowListeners=new w6(p_(a)),this.initialCoordinates=(o=Pqe(i))!=null?o:DT,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(bC.Resize,this.handleCancel),this.windowListeners.add(bC.DragStart,yon),this.windowListeners.add(bC.VisibilityChange,this.handleCancel),this.windowListeners.add(bC.ContextMenu,yon),this.documentListeners.add(bC.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(_on(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(bon(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(bC.Click,wwi,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(bC.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=Pqe(e))!=null?r:DT,l=b6(o,u);if(!n&&s){if(bon(s)){if(s.tolerance!=null&&MSt(l,s.tolerance))return this.handleCancel();if(MSt(l,s.distance))return this.handleStart()}if(_on(s)&&MSt(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===Ui.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Cwi={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},cz=class extends Vfe{constructor(e){let{event:r}=e,n=h6(r.target);super(e,Cwi,n)}};cz.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 xwi={move:{name:"mousemove"},end:{name:"mouseup"}},ASt;(function(t){t[t.RightClick=2]="RightClick"})(ASt||(ASt={}));var NSt=class extends Vfe{constructor(e){super(e,xwi,h6(e.event.target))}};NSt.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===ASt.RightClick?!1:(n?.({event:r}),!0)}}];var RSt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},DSt=class extends Vfe{constructor(e){super(e,RSt)}static setup(){return window.addEventListener(RSt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(RSt.move.name,e)};function e(){}}};DSt.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 Ufe;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Ufe||(Ufe={}));var Iqe;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Iqe||(Iqe={}));function Twi(t){let{acceleration:e,activator:r=Ufe.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=Iqe.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=Ewi({delta:d,disabled:!i}),[m,h]=uon(),y=(0,Ze.useRef)({x:0,y:0}),g=(0,Ze.useRef)({x:0,y:0}),b=(0,Ze.useMemo)(()=>{switch(r){case Ufe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Ufe.DraggableRect:return o}},[r,o,u]),_=(0,Ze.useRef)(null),w=(0,Ze.useCallback)(()=>{let O=_.current;if(!O)return;let E=y.current.x*g.current.x,P=y.current.y*g.current.y;O.scrollBy(E,P)},[]),T=(0,Ze.useMemo)(()=>s===Iqe.TreeOrder?[...l].reverse():l,[s,l]);(0,Ze.useEffect)(()=>{if(!i||!l.length||!b){h();return}for(let O of T){if(n?.(O)===!1)continue;let E=l.indexOf(O),P=c[E];if(!P)continue;let{direction:R,speed:I}=mwi(O,P,b,e,f);for(let A of["x","y"])p[A][R[A]]||(I[A]=0,R[A]=0);if(I.x>0||I.y>0){h(),_.current=O,m(w,a),y.current=I,g.current=R;return}}y.current={x:0,y:0},g.current={x:0,y:0},h()},[e,w,n,h,i,a,JSON.stringify(b),JSON.stringify(p),m,l,T,c,JSON.stringify(f)])}var Owi={x:{[fg.Backward]:!1,[fg.Forward]:!1},y:{[fg.Backward]:!1,[fg.Forward]:!1}};function Ewi(t){let{delta:e,disabled:r}=t,n=Eqe(e);return oQ(o=>{if(r||!n||!o)return Owi;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[fg.Backward]:o.x[fg.Backward]||i.x===-1,[fg.Forward]:o.x[fg.Forward]||i.x===1},y:{[fg.Backward]:o.y[fg.Backward]||i.y===-1,[fg.Forward]:o.y[fg.Forward]||i.y===1}}},[r,e,n])}function Pwi(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return oQ(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function Mwi(t,e){return(0,Ze.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 Hfe;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Hfe||(Hfe={}));var jSt;(function(t){t.Optimized="optimized"})(jSt||(jSt={}));var von=new Map;function Rwi(t,e){let{dragging:r,dependencies:n,config:o}=e,[i,a]=(0,Ze.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,Ze.useRef)(t),d=y(),f=nQ(d),p=(0,Ze.useCallback)(function(g){g===void 0&&(g=[]),!f.current&&a(b=>b===null?g:b.concat(g.filter(_=>!b.includes(_))))},[f]),m=(0,Ze.useRef)(null),h=oQ(g=>{if(d&&!r)return von;if(!g||g===von||c.current!==t||i!=null){let b=new Map;for(let _ of t){if(!_)continue;if(i&&i.length>0&&!i.includes(_.id)&&_.rect.current){b.set(_.id,_.rect.current);continue}let w=_.node.current,T=w?new zfe(u(w),w):null;_.rect.current=T,T&&b.set(_.id,T)}return b}return g},[t,i,r,d,u]);return(0,Ze.useEffect)(()=>{c.current=t},[t]),(0,Ze.useEffect)(()=>{d||p()},[r,d]),(0,Ze.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,Ze.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 y(){switch(l){case Hfe.Always:return!1;case Hfe.BeforeDragging:return r;default:return!r}}}function Fon(t,e){return oQ(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function Iwi(t,e){return Fon(t,e)}function Awi(t){let{callback:e,disabled:r}=t,n=Oqe(e),o=(0,Ze.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,Ze.useEffect)(()=>()=>o?.disconnect(),[o]),o}function Nqe(t){let{callback:e,disabled:r}=t,n=Oqe(e),o=(0,Ze.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,Ze.useEffect)(()=>()=>o?.disconnect(),[o]),o}function Nwi(t){return new zfe(C6(t),t)}function won(t,e,r){e===void 0&&(e=Nwi);let[n,o]=(0,Ze.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=Awi({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=Nqe({callback:i});return yC(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function Dwi(t){let e=Fon(t);return Ron(t,e)}var Son=[];function jwi(t){let e=(0,Ze.useRef)(t),r=oQ(n=>t?n&&n!==Son&&t&&e.current&&t.parentNode===e.current.parentNode?n:Wfe(t):Son,[t]);return(0,Ze.useEffect)(()=>{e.current=t},[t]),r}function $wi(t){let[e,r]=(0,Ze.useState)(null),n=(0,Ze.useRef)(t),o=(0,Ze.useCallback)(i=>{let a=PSt(i.target);a&&r(s=>s?(s.set(a,ISt(a)),new Map(s)):null)},[]);return(0,Ze.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(u=>{let l=PSt(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,ISt(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=PSt(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,Ze.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>y6(i,a),DT):$on(t):DT,[t,e])}function Con(t,e){e===void 0&&(e=[]);let r=(0,Ze.useRef)(null);return(0,Ze.useEffect)(()=>{r.current=null},e),(0,Ze.useEffect)(()=>{let n=t!==DT;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?b6(t,r.current):DT}function Lwi(t){(0,Ze.useEffect)(()=>{if(!kfe)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 Fwi(t,e){return(0,Ze.useMemo)(()=>t.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,e)},r},{}),[t,e])}function kon(t){return(0,Ze.useMemo)(()=>t?cwi(t):null,[t])}var xon=[];function kwi(t,e){e===void 0&&(e=C6);let[r]=t,n=kon(r?p_(r):null),[o,i]=(0,Ze.useState)(xon);function a(){i(()=>t.length?t.map(u=>Don(u)?n:new zfe(e(u),u)):xon)}let s=Nqe({callback:a});return yC(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function qwi(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return rQ(e)?e:t}function Bwi(t){let{measure:e}=t,[r,n]=(0,Ze.useState)(null),o=(0,Ze.useCallback)(l=>{for(let{target:c}of l)if(rQ(c)){n(d=>{let f=e(c);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=Nqe({callback:o}),a=(0,Ze.useCallback)(l=>{let c=qwi(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=qfe(a);return(0,Ze.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var Uwi=[{sensor:cz,options:{}},{sensor:lz,options:{}}],zwi={current:{}},Mqe={draggable:{measure:gon},droppable:{measure:gon,strategy:Hfe.WhileDragging,frequency:jSt.Optimized},dragOverlay:{measure:C6}},S6=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}},Vwi={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new S6,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Rqe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Mqe,measureDroppableContainers:Rqe,windowRect:null,measuringScheduled:!1},Hwi={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Rqe,draggableNodes:new Map,over:null,measureDroppableContainers:Rqe},Dqe=(0,Ze.createContext)(Hwi),qon=(0,Ze.createContext)(Vwi);function Wwi(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new S6}}}function Jwi(t,e){switch(e.type){case _h.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case _h.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 _h.DragEnd:case _h.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case _h.RegisterDroppable:{let{element:r}=e,{id:n}=r,o=new S6(t.droppable.containers);return o.set(n,r),{...t,droppable:{...t.droppable,containers:o}}}case _h.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 S6(t.droppable.containers);return a.set(r,{...i,disabled:o}),{...t,droppable:{...t.droppable,containers:a}}}case _h.UnregisterDroppable:{let{id:r,key:n}=e,o=t.droppable.containers.get(r);if(!o||n!==o.key)return t;let i=new S6(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function Kwi(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,Ze.useContext)(Dqe),i=Eqe(n),a=Eqe(r?.id);return(0,Ze.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!Bfe(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=con(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function Gwi(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function Xwi(t){return(0,Ze.useMemo)(()=>({draggable:{...Mqe.draggable,...t?.draggable},droppable:{...Mqe.droppable,...t?.droppable},dragOverlay:{...Mqe.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function Zwi(t){let{activeNode:e,measure:r,initialRect:n,config:o=!0}=t,i=(0,Ze.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;yC(()=>{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=Ron(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=Ion(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var Bon=(0,Ze.createContext)({...DT,scaleX:1,scaleY:1}),uz;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(uz||(uz={}));var sQ=(0,Ze.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=Uwi,collisionDetection:d=nwi,measuring:f,modifiers:p,...m}=e,h=(0,Ze.useReducer)(Jwi,void 0,Wwi),[y,g]=h,[b,_]=Zvi(),[w,T]=(0,Ze.useState)(uz.Uninitialized),O=w===uz.Initialized,{draggable:{active:E,nodes:P,translate:R},droppable:{containers:I}}=y,A=E!=null?P.get(E):null,B=(0,Ze.useRef)({initial:null,translated:null}),k=(0,Ze.useMemo)(()=>{var Xs;return E!=null?{id:E,data:(Xs=A?.data)!=null?Xs:zwi,rect:B}:null},[E,A]),q=(0,Ze.useRef)(null),[Z,V]=(0,Ze.useState)(null),[Y,X]=(0,Ze.useState)(null),W=nQ(m,Object.values(m)),re=g6("DndDescribedBy",a),ue=(0,Ze.useMemo)(()=>I.getEnabled(),[I]),le=Xwi(f),{droppableRects:L,measureDroppableContainers:J,measuringScheduled:ne}=Rwi(ue,{dragging:O,dependencies:[R.x,R.y],config:le.droppable}),D=Pwi(P,E),N=(0,Ze.useMemo)(()=>Y?Pqe(Y):null,[Y]),z=dS(),H=Iwi(D,le.draggable.measure);Zwi({activeNode:E!=null?P.get(E):null,config:z.layoutShiftCompensation,initialRect:H,measure:le.draggable.measure});let oe=won(D,le.draggable.measure,H),Q=won(D?D.parentElement:null),de=(0,Ze.useRef)({activatorEvent:null,active:null,activeNode:D,collisionRect:null,collisions:null,droppableRects:L,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=I.getNodeFor((r=de.current.over)==null?void 0:r.id),De=Bwi({measure:le.dragOverlay.measure}),st=(n=De.nodeRef.current)!=null?n:D,Le=O?(o=De.rect)!=null?o:oe:null,Bt=!!(De.nodeRef.current&&De.rect),Pt=Dwi(Bt?null:oe),Nt=kon(st?p_(st):null),$e=jwi(O?fe??D:null),Fr=kwi($e),ft=Gwi(p,{transform:{x:R.x-Pt.x,y:R.y-Pt.y,scaleX:1,scaleY:1},activatorEvent:Y,active:k,activeNodeRect:oe,containerNodeRect:Q,draggingNodeRect:Le,over:de.current.over,overlayNodeRect:De.rect,scrollableAncestors:$e,scrollableAncestorRects:Fr,windowRect:Nt}),Ve=N?y6(N,R):null,Rt=$wi($e),ze=Con(Rt),He=Con(Rt,[oe]),We=y6(ft,ze),Jt=Le?awi(Le,ft):null,so=k&&Jt?d({active:k,collisionRect:Jt,droppableRects:L,droppableContainers:ue,pointerCoordinates:Ve}):null,au=$St(so,"id"),[An,_i]=(0,Ze.useState)(null),Nl=Bt?ft:y6(ft,He),Vi=owi(Nl,(i=An?.rect)!=null?i:null,oe),g_=(0,Ze.useRef)(null),mg=(0,Ze.useCallback)((Xs,Dl)=>{let{sensor:Iu,options:wm}=Dl;if(q.current==null)return;let _d=P.get(q.current);if(!_d)return;let sl=Xs.nativeEvent,nt=new Iu({active:q.current,activeNode:_d,event:sl,options:wm,context:de,onAbort(Ue){if(!P.get(Ue))return;let{onDragAbort:Mt}=W.current,Yt={id:Ue};Mt?.(Yt),b({type:"onDragAbort",event:Yt})},onPending(Ue,Ee,Mt,Yt){if(!P.get(Ue))return;let{onDragPending:ul}=W.current,xi={id:Ue,constraint:Ee,initialCoordinates:Mt,offset:Yt};ul?.(xi),b({type:"onDragPending",event:xi})},onStart(Ue){let Ee=q.current;if(Ee==null)return;let Mt=P.get(Ee);if(!Mt)return;let{onDragStart:Yt}=W.current,Ln={activatorEvent:sl,active:{id:Ee,data:Mt.data,rect:B}};(0,v6.unstable_batchedUpdates)(()=>{Yt?.(Ln),T(uz.Initializing),g({type:_h.DragStart,initialCoordinates:Ue,active:Ee}),b({type:"onDragStart",event:Ln}),V(g_.current),X(sl)})},onMove(Ue){g({type:_h.DragMove,coordinates:Ue})},onEnd:Nr(_h.DragEnd),onCancel:Nr(_h.DragCancel)});g_.current=nt;function Nr(Ue){return async function(){let{active:Mt,collisions:Yt,over:Ln,scrollAdjustedTranslate:ul}=de.current,xi=null;if(Mt&&ul){let{cancelDrop:zv}=W.current;xi={activatorEvent:sl,active:Mt,collisions:Yt,delta:ul,over:Ln},Ue===_h.DragEnd&&typeof zv=="function"&&await Promise.resolve(zv(xi))&&(Ue=_h.DragCancel)}q.current=null,(0,v6.unstable_batchedUpdates)(()=>{g({type:Ue}),T(uz.Uninitialized),_i(null),V(null),X(null),g_.current=null;let zv=Ue===_h.DragEnd?"onDragEnd":"onDragCancel";if(xi){let PL=W.current[zv];PL?.(xi),b({type:zv,event:xi})}})}}},[P]),cS=(0,Ze.useCallback)((Xs,Dl)=>(Iu,wm)=>{let _d=Iu.nativeEvent,sl=P.get(wm);if(q.current!==null||!sl||_d.dndKit||_d.defaultPrevented)return;let nt={active:sl};Xs(Iu,Dl.options,nt)===!0&&(_d.dndKit={capturedBy:Dl.sensor},q.current=wm,mg(Iu,Dl))},[P,mg]),ji=Mwi(c,cS);Lwi(c),yC(()=>{oe&&w===uz.Initializing&&T(uz.Initialized)},[oe,w]),(0,Ze.useEffect)(()=>{let{onDragMove:Xs}=W.current,{active:Dl,activatorEvent:Iu,collisions:wm,over:_d}=de.current;if(!Dl||!Iu)return;let sl={active:Dl,activatorEvent:Iu,collisions:wm,delta:{x:We.x,y:We.y},over:_d};(0,v6.unstable_batchedUpdates)(()=>{Xs?.(sl),b({type:"onDragMove",event:sl})})},[We.x,We.y]),(0,Ze.useEffect)(()=>{let{active:Xs,activatorEvent:Dl,collisions:Iu,droppableContainers:wm,scrollAdjustedTranslate:_d}=de.current;if(!Xs||q.current==null||!Dl||!_d)return;let{onDragOver:sl}=W.current,nt=wm.get(au),Nr=nt&&nt.rect.current?{id:nt.id,rect:nt.rect.current,data:nt.data,disabled:nt.disabled}:null,Ue={active:Xs,activatorEvent:Dl,collisions:Iu,delta:{x:_d.x,y:_d.y},over:Nr};(0,v6.unstable_batchedUpdates)(()=>{_i(Nr),sl?.(Ue),b({type:"onDragOver",event:Ue})})},[au]),yC(()=>{de.current={activatorEvent:Y,active:k,activeNode:D,collisionRect:Jt,collisions:so,droppableRects:L,draggableNodes:P,draggingNode:st,draggingNodeRect:Le,droppableContainers:I,over:An,scrollableAncestors:$e,scrollAdjustedTranslate:We},B.current={initial:Le,translated:Jt}},[k,D,so,Jt,P,st,Le,L,I,An,$e,We]),Twi({...z,delta:R,draggingRect:Jt,pointerCoordinates:Ve,scrollableAncestors:$e,scrollableAncestorRects:Fr});let LT=(0,Ze.useMemo)(()=>({active:k,activeNode:D,activeNodeRect:oe,activatorEvent:Y,collisions:so,containerNodeRect:Q,dragOverlay:De,draggableNodes:P,droppableContainers:I,droppableRects:L,over:An,measureDroppableContainers:J,scrollableAncestors:$e,scrollableAncestorRects:Fr,measuringConfiguration:le,measuringScheduled:ne,windowRect:Nt}),[k,D,oe,Y,so,Q,De,P,I,L,An,J,$e,Fr,le,ne,Nt]),SC=(0,Ze.useMemo)(()=>({activatorEvent:Y,activators:ji,active:k,activeNodeRect:oe,ariaDescribedById:{draggable:re},dispatch:g,draggableNodes:P,over:An,measureDroppableContainers:J}),[Y,ji,k,oe,g,re,P,An,J]);return Ze.default.createElement(Oon.Provider,{value:_},Ze.default.createElement(Dqe.Provider,{value:SC},Ze.default.createElement(qon.Provider,{value:LT},Ze.default.createElement(Bon.Provider,{value:Vi},l)),Ze.default.createElement(Kwi,{disabled:s?.restoreFocus===!1})),Ze.default.createElement(ewi,{...s,hiddenTextDescribedById:re}));function dS(){let Xs=Z?.autoScrollEnabled===!1,Dl=typeof u=="object"?u.enabled===!1:u===!1,Iu=O&&!Xs&&!Dl;return typeof u=="object"?{...u,enabled:Iu}:{enabled:Iu}}}),Ywi=(0,Ze.createContext)(null),Ton="button",Qwi="Draggable";function Uon(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=g6(Qwi),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,Ze.useContext)(Dqe),{role:p=Ton,roleDescription:m="draggable",tabIndex:h=0}=o??{},y=u?.id===e,g=(0,Ze.useContext)(y?Bon:Ywi),[b,_]=qfe(),[w,T]=qfe(),O=Fwi(a,e),E=nQ(r);yC(()=>(d.set(e,{id:e,key:i,node:b,activatorNode:w,data:E}),()=>{let R=d.get(e);R&&R.key===i&&d.delete(e)}),[d,e]);let P=(0,Ze.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&p===Ton?!0:void 0,"aria-roledescription":m,"aria-describedby":c.draggable}),[n,p,h,y,m,c.draggable]);return{active:u,activatorEvent:s,activeNodeRect:l,attributes:P,isDragging:y,listeners:n?void 0:O,node:b,over:f,setNodeRef:_,setActivatorNodeRef:T,transform:g}}function zon(){return(0,Ze.useContext)(qon)}var eSi="Droppable",tSi={timeout:25};function Von(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=g6(eSi),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,Ze.useContext)(Dqe),c=(0,Ze.useRef)({disabled:r}),d=(0,Ze.useRef)(!1),f=(0,Ze.useRef)(null),p=(0,Ze.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:y}={...tSi,...o},g=nQ(h??n),b=(0,Ze.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},y)},[y]),_=Nqe({callback:b,disabled:m||!a}),w=(0,Ze.useCallback)((P,R)=>{_&&(R&&(_.unobserve(R),d.current=!1),P&&_.observe(P))},[_]),[T,O]=qfe(w),E=nQ(e);return(0,Ze.useEffect)(()=>{!_||!T.current||(_.disconnect(),d.current=!1,_.observe(T.current))},[T,_]),(0,Ze.useEffect)(()=>(s({type:_h.RegisterDroppable,element:{id:n,key:i,disabled:r,node:T,rect:f,data:E}}),()=>s({type:_h.UnregisterDroppable,key:i,id:n})),[n]),(0,Ze.useEffect)(()=>{r!==c.current.disabled&&(s({type:_h.SetDroppableDisabled,id:n,key:i,disabled:r}),c.current.disabled=r)},[n,i,r,s]),{active:a,rect:f,isOver:u?.id===n,node:T,over:u,setNodeRef:O}}function Fqe(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function rSi(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function jqe(t){return t!==null&&t>=0}function nSi(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 oSi(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}var Hon=t=>{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=Fqe(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 $qe={scaleX:1,scaleY:1},uQ=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,...$qe}:null}let u=iSi(i,o,r);return o>r&&o<=a?{x:0,y:-s.height-u,...$qe}:o<r&&o>=a?{x:0,y:s.height+u,...$qe}:{x:0,y:0,...$qe}};function iSi(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 Won="Sortable",Jon=gd.default.createContext({activeIndex:-1,containerId:Won,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Hon,disabled:{draggable:!1,droppable:!1}});function lQ(t){let{children:e,id:r,items:n,strategy:o=Hon,disabled:i=!1}=t,{active:a,dragOverlay:s,droppableRects:u,over:l,measureDroppableContainers:c}=zon(),d=g6(Won,r),f=s.rect!==null,p=(0,gd.useMemo)(()=>n.map(O=>typeof O=="object"&&"id"in O?O.id:O),[n]),m=a!=null,h=a?p.indexOf(a.id):-1,y=l?p.indexOf(l.id):-1,g=(0,gd.useRef)(p),b=!nSi(p,g.current),_=y!==-1&&h===-1||b,w=oSi(i);yC(()=>{b&&m&&c(p)},[b,p,m,c]),(0,gd.useEffect)(()=>{g.current=p},[p]);let T=(0,gd.useMemo)(()=>({activeIndex:h,containerId:d,disabled:w,disableTransforms:_,items:p,overIndex:y,useDragOverlay:f,sortedRects:rSi(p,u),strategy:o}),[h,d,w.draggable,w.droppable,_,p,y,u,f,o]);return gd.default.createElement(Jon.Provider,{value:T},e)}var aSi=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return Fqe(r,n,o).indexOf(e)},sSi=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},uSi={duration:200,easing:"ease"},Kon="transform",lSi=gC.Transition.toString({property:Kon,duration:0,easing:"linear"}),cSi={roleDescription:"sortable"};function dSi(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,gd.useState)(null),s=(0,gd.useRef)(r);return yC(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=C6(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,gd.useEffect)(()=>{i&&a(null)},[i]),i}function cQ(t){let{animateLayoutChanges:e=sSi,attributes:r,disabled:n,data:o,getNewIndex:i=aSi,id:a,strategy:s,resizeObserverConfig:u,transition:l=uSi}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:y,useDragOverlay:g,strategy:b}=(0,gd.useContext)(Jon),_=fSi(n,p),w=c.indexOf(a),T=(0,gd.useMemo)(()=>({sortable:{containerId:d,index:w,items:c},...o}),[d,o,w,c]),O=(0,gd.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:E,node:P,isOver:R,setNodeRef:I}=Von({id:a,data:T,disabled:_.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...u}}),{active:A,activatorEvent:B,activeNodeRect:k,attributes:q,setNodeRef:Z,listeners:V,isDragging:Y,over:X,setActivatorNodeRef:W,transform:re}=Uon({id:a,data:T,attributes:{...cSi,...r},disabled:_.draggable}),ue=son(I,Z),le=!!A,L=le&&!m&&jqe(f)&&jqe(y),J=!g&&Y,ne=J&&L?re:null,N=L?ne??(s??b)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:y,index:w}):null,z=jqe(f)&&jqe(y)?i({id:a,items:c,activeIndex:f,overIndex:y}):w,H=A?.id,oe=(0,gd.useRef)({activeId:H,items:c,newIndex:z,containerId:d}),Q=c!==oe.current.items,de=e({active:A,containerId:d,isDragging:Y,isSorting:le,id:a,index:w,items:c,newIndex:oe.current.newIndex,previousItems:oe.current.items,previousContainerId:oe.current.containerId,transition:l,wasDragging:oe.current.activeId!=null}),fe=dSi({disabled:!de,index:w,node:P,rect:E});return(0,gd.useEffect)(()=>{le&&oe.current.newIndex!==z&&(oe.current.newIndex=z),d!==oe.current.containerId&&(oe.current.containerId=d),c!==oe.current.items&&(oe.current.items=c)},[le,z,d,c]),(0,gd.useEffect)(()=>{if(H===oe.current.activeId)return;if(H!=null&&oe.current.activeId==null){oe.current.activeId=H;return}let st=setTimeout(()=>{oe.current.activeId=H},50);return()=>clearTimeout(st)},[H]),{active:A,activeIndex:f,attributes:q,data:T,rect:E,index:w,newIndex:z,items:c,isOver:R,isSorting:le,isDragging:Y,listeners:V,node:P,overIndex:y,over:X,setNodeRef:ue,setActivatorNodeRef:W,setDroppableNodeRef:I,setDraggableNodeRef:Z,transform:fe??N,transition:De()};function De(){if(fe||Q&&oe.current.newIndex===w)return lSi;if(!(J&&!Bfe(B)||!l)&&(le||de))return gC.Transition.toString({...l,property:Kon})}}function fSi(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 Lqe(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 pSi=[Ui.Down,Ui.Right,Ui.Up,Ui.Left],kqe=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(pSi.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 Ui.Down:n.top<f.top&&u.push(d);break;case Ui.Up:n.top>f.top&&u.push(d);break;case Ui.Left:n.left>f.left&&u.push(d);break;case Ui.Right:n.left<f.left&&u.push(d);break}});let l=Mon({active:r,collisionRect:n,droppableRects:o,droppableContainers:u,pointerCoordinates:null}),c=$St(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 y=Wfe(m).some((O,E)=>s[E]!==O),g=Gon(d,f),b=mSi(d,f),_=y||!g?{x:0,y:0}:{x:b?n.width-p.width:0,y:b?n.height-p.height:0},w={x:p.left,y:p.top};return _.x&&_.y?w:b6(w,_)}}}};function Gon(t,e){return!Lqe(t)||!Lqe(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function mSi(t,e){return!Lqe(t)||!Lqe(e)||!Gon(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}Mr();function qqe({id:t,item:e,title:r,subtitle:n,badge:o,icon:i,isDraggable:a=!1,isExpandable:s=!1,defaultExpanded:u=!1,expandedContent:l,primaryAction:c,dropdownActions:d=[],containerRef:f,className:p,onExpandToggle:m}){let[h,y]=(0,iu.useState)(u),{attributes:g,listeners:b,setNodeRef:_,transform:w,transition:T,isDragging:O}=cQ({id:t,disabled:!a}),E={transform:gC.Transform.toString(w),transition:T},P=()=>{if(s){let I=!h;y(I),m?.(I)}},R=d.length>0;return iu.default.createElement(vL,{ref:_,style:E,className:Se("tw-mb-2",O&&["tw-opacity-90","tw-shadow-lg","tw-border-accent/50","tw-relative","tw-z-[9999]","tw-bg-primary","tw-rounded-lg","tw-transform-gpu"],a&&"tw-touch-manipulation",p)},iu.default.createElement(wL,{className:"tw-p-3"},iu.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},a&&iu.default.createElement("div",{className:"tw-mr-2 tw-cursor-grab tw-touch-none active:tw-cursor-grabbing",...g,...b},iu.default.createElement(QC,{className:"tw-size-4"})),iu.default.createElement("div",{className:"tw-flex-1 tw-touch-auto",onClick:s?P:void 0,style:{cursor:s?"pointer":"default"}},iu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},s&&iu.default.createElement("div",{className:"tw-flex tw-size-3 tw-items-center tw-justify-center"},h?iu.default.createElement(Ji,{className:"tw-size-3 tw-stroke-[7]"}):iu.default.createElement(od,{className:"tw-size-3 tw-stroke-[7]"})),i&&iu.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},i),iu.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},iu.default.createElement("div",{className:"tw-break-words tw-font-medium tw-leading-relaxed"},r,o&&iu.default.createElement("span",{className:"tw-ml-1 tw-inline-flex tw-items-center"},o)),n&&iu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},iu.default.createElement("span",{className:"tw-bg-secondary tw-text-sm tw-text-muted"},n))))),iu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},c&&iu.default.createElement(me,{variant:"ghost",size:"icon",onClick:I=>{I.stopPropagation(),c.onClick(e)},title:c.tooltip},c.icon),R&&iu.default.createElement(sN,null,iu.default.createElement(uN,{asChild:!0},iu.default.createElement(me,{variant:"ghost",size:"icon"},iu.default.createElement(SO,{className:"tw-size-4"}))),iu.default.createElement(Ev,{align:"end",container:f?.current},d.map((I,A)=>iu.default.createElement(Ai,{key:A,onClick:B=>{B.stopPropagation(),I.onClick(e)},className:Se(I.variant==="destructive"&&"tw-text-error")},iu.default.createElement("span",{className:"tw-mr-2 tw-flex tw-size-4 tw-items-center tw-justify-center"},I.icon),I.label))))))),s&&iu.default.createElement("div",{className:Se("tw-transition-all tw-duration-300 tw-ease-in-out",h?"tw-max-h-96 tw-opacity-100":"tw-max-h-0 tw-overflow-hidden tw-opacity-0")},iu.default.createElement(SL,{className:"tw-p-3 tw-pt-0"},l)))}Mr();var vh=$(K());zr();var Jfe=vh.forwardRef(({className:t,...e},r)=>vh.createElement("div",{className:"tw-relative tw-w-full tw-overflow-auto"},vh.createElement("table",{ref:r,className:Se("tw-w-full tw-caption-bottom tw-border-collapse tw-text-sm",t),...e})));Jfe.displayName="Table";var Kfe=vh.forwardRef(({className:t,...e},r)=>vh.createElement("thead",{ref:r,className:Se("[&_tr]:tw-border-b",t),...e}));Kfe.displayName="TableHeader";var Gfe=vh.forwardRef(({className:t,...e},r)=>vh.createElement("tbody",{ref:r,className:t,...e}));Gfe.displayName="TableBody";var hSi=vh.forwardRef(({className:t,...e},r)=>vh.createElement("tfoot",{ref:r,className:Se("tw-border-t tw-font-medium tw-bg-primary-alt/50",t),...e}));hSi.displayName="TableFooter";var dz=vh.forwardRef(({className:t,...e},r)=>vh.createElement("tr",{ref:r,className:Se("tw-border-b tw-transition-colors hover:tw-bg-primary-alt/50 data-[state=selected]:tw-bg-primary-alt",t),...e}));dz.displayName="TableRow";var m_=vh.forwardRef(({className:t,...e},r)=>vh.createElement("th",{ref:r,className:Se("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}));m_.displayName="TableHead";var hb=vh.forwardRef(({className:t,...e},r)=>vh.createElement("td",{ref:r,className:Se("tw-p-2 tw-align-middle [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));hb.displayName="TableCell";var gSi=vh.forwardRef(({className:t,...e},r)=>vh.createElement("caption",{ref:r,className:Se("tw-mt-4 tw-text-sm tw-text-muted",t),...e}));gSi.displayName="TableCaption";zr();Xe();Qe();fte();var Al=$(K());zr();Mr();var dy=$(K());var al=$(K(),1);var RYs=!!(typeof window<"u"&&window.document&&window.document.createElement);function dQ(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Zon=$(K(),1);function Xon(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function LSt(...t){return e=>{let r=!1,n=t.map(o=>{let i=Xon(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():Xon(t[o],null)}}}}function fQ(...t){return Zon.useCallback(LSt(...t),t)}var _C=$(K(),1),FSt=$(wt(),1);function Yon(t,e){let r=_C.createContext(e),n=i=>{let{children:a,...s}=i,u=_C.useMemo(()=>s,Object.values(s));return(0,FSt.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=_C.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 Qon(t,e=[]){let r=[];function n(i,a){let s=_C.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=_C.useMemo(()=>m,Object.values(m));return(0,FSt.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=_C.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=>_C.createContext(a));return function(s){let u=s?.[t]||i;return _C.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,ySi(o,...e)]}function ySi(...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 _C.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var kSt=$(K(),1);var ein=$(K(),1),x6=globalThis?.document?ein.useLayoutEffect:()=>{};var bSi=kSt[" useId ".trim().toString()]||(()=>{}),_Si=0;function Bqe(t){let[e,r]=kSt.useState(bSi());return x6(()=>{t||r(n=>n??String(_Si++))},[t]),t||(e?`radix-${e}`:"")}var vC=$(K(),1);var Uqe=$(K(),1);var vSi=vC[" useInsertionEffect ".trim().toString()]||x6;function tin({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=wSi({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=vC.useRef(t!==void 0);vC.useEffect(()=>{let d=c.current;d!==s&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}let l=vC.useCallback(c=>{if(s){let d=SSi(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function wSi({defaultProp:t,onChange:e}){let[r,n]=vC.useState(t),o=vC.useRef(r),i=vC.useRef(e);return vSi(()=>{i.current=e},[e]),vC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function SSi(t){return typeof t=="function"}var FYs=Symbol("RADIX:SYNC_STATE");var Bv=$(K(),1);var rin=$(K(),1);function CSi(t,e){return rin.useReducer((r,n)=>e[r][n]??r,t)}var Xfe=t=>{let{present:e,children:r}=t,n=xSi(e),o=typeof r=="function"?r({present:n.isPresent}):Bv.Children.only(r),i=fQ(n.ref,TSi(o));return typeof r=="function"||n.isPresent?Bv.cloneElement(o,{ref:i}):null};Xfe.displayName="Presence";function xSi(t){let[e,r]=Bv.useState(),n=Bv.useRef(null),o=Bv.useRef(t),i=Bv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=CSi(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Bv.useEffect(()=>{let l=zqe(n.current);i.current=s==="mounted"?l:"none"},[s]),x6(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=zqe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),x6(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=zqe(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=zqe(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:Bv.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function zqe(t){return t?.animationName||"none"}function TSi(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 nin=$(K(),1),ISi=$(yu(),1);var wh=$(K(),1);var Vqe=$(wt(),1);function Hqe(t){let e=OSi(t),r=wh.forwardRef((n,o)=>{let{children:i,...a}=n,s=wh.Children.toArray(i),u=s.find(PSi);if(u){let l=u.props.children,c=s.map(d=>d===u?wh.Children.count(l)>1?wh.Children.only(null):wh.isValidElement(l)?l.props.children:null:d);return(0,Vqe.jsx)(e,{...a,ref:o,children:wh.isValidElement(l)?wh.cloneElement(l,void 0,c):null})}return(0,Vqe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function OSi(t){let e=wh.forwardRef((r,n)=>{let{children:o,...i}=r;if(wh.isValidElement(o)){let a=RSi(o),s=MSi(i,o.props);return o.type!==wh.Fragment&&(s.ref=n?LSt(n,a):a),wh.cloneElement(o,s)}return wh.Children.count(o)>1?wh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var ESi=Symbol("radix.slottable");function PSi(t){return wh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===ESi}function MSi(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{let u=i(...s);return o(...s),u}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function RSi(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 oin=$(wt(),1),ASi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pQ=ASi.reduce((t,e)=>{let r=Hqe(`Primitive.${e}`),n=nin.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,oin.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Ru=$(wt(),1),Jqe="Dialog",[iin,sQs]=Qon(Jqe),[NSi,jT]=iin(Jqe),ain=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=al.useRef(null),u=al.useRef(null),[l,c]=tin({prop:n,defaultProp:o??!1,onChange:i,caller:Jqe});return(0,Ru.jsx)(NSi,{scope:e,triggerRef:s,contentRef:u,contentId:Bqe(),titleId:Bqe(),descriptionId:Bqe(),open:l,onOpenChange:c,onOpenToggle:al.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};ain.displayName=Jqe;var sin="DialogTrigger",uin=al.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=jT(sin,r),i=fQ(e,o.triggerRef);return(0,Ru.jsx)(pQ.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":USt(o.open),...n,ref:i,onClick:dQ(t.onClick,o.onOpenToggle)})});uin.displayName=sin;var qSt="DialogPortal",[DSi,lin]=iin(qSt,{forceMount:void 0}),cin=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=jT(qSt,e);return(0,Ru.jsx)(DSi,{scope:e,forceMount:r,children:al.Children.map(n,a=>(0,Ru.jsx)(Xfe,{present:r||i.open,children:(0,Ru.jsx)(mT,{asChild:!0,container:o,children:a})}))})};cin.displayName=qSt;var Wqe="DialogOverlay",din=al.forwardRef((t,e)=>{let r=lin(Wqe,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=jT(Wqe,t.__scopeDialog);return i.modal?(0,Ru.jsx)(Xfe,{present:n||i.open,children:(0,Ru.jsx)($Si,{...o,ref:e})}):null});din.displayName=Wqe;var jSi=Hqe("DialogOverlay.RemoveScroll"),$Si=al.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=jT(Wqe,r);return(0,Ru.jsx)(V$,{as:jSi,allowPinchZoom:!0,shards:[o.contentRef],children:(0,Ru.jsx)(pQ.div,{"data-state":USt(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),T6="DialogContent",fin=al.forwardRef((t,e)=>{let r=lin(T6,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=jT(T6,t.__scopeDialog);return(0,Ru.jsx)(Xfe,{present:n||i.open,children:i.modal?(0,Ru.jsx)(LSi,{...o,ref:e}):(0,Ru.jsx)(FSi,{...o,ref:e})})});fin.displayName=T6;var LSi=al.forwardRef((t,e)=>{let r=jT(T6,t.__scopeDialog),n=al.useRef(null),o=fQ(e,r.contentRef,n);return al.useEffect(()=>{let i=n.current;if(i)return fU(i)},[]),(0,Ru.jsx)(pin,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:dQ(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:dQ(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:dQ(t.onFocusOutside,i=>i.preventDefault())})}),FSi=al.forwardRef((t,e)=>{let r=jT(T6,t.__scopeDialog),n=al.useRef(!1),o=al.useRef(!1);return(0,Ru.jsx)(pin,{...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()}})}),pin=al.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=jT(T6,r),u=al.useRef(null),l=fQ(e,u);return aU(),(0,Ru.jsxs)(Ru.Fragment,{children:[(0,Ru.jsx)(F$,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Ru.jsx)(lT,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":USt(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,Ru.jsxs)(Ru.Fragment,{children:[(0,Ru.jsx)(kSi,{titleId:s.titleId}),(0,Ru.jsx)(BSi,{contentRef:u,descriptionId:s.descriptionId})]})]})}),BSt="DialogTitle",min=al.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=jT(BSt,r);return(0,Ru.jsx)(pQ.h2,{id:o.titleId,...n,ref:e})});min.displayName=BSt;var hin="DialogDescription",gin=al.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=jT(hin,r);return(0,Ru.jsx)(pQ.p,{id:o.descriptionId,...n,ref:e})});gin.displayName=hin;var yin="DialogClose",bin=al.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=jT(yin,r);return(0,Ru.jsx)(pQ.button,{type:"button",...n,ref:e,onClick:dQ(t.onClick,()=>o.onOpenChange(!1))})});bin.displayName=yin;function USt(t){return t?"open":"closed"}var _in="DialogTitleWarning",[uQs,vin]=Yon(_in,{contentName:T6,titleName:BSt,docsSlug:"dialog"}),kSi=({titleId:t})=>{let e=vin(_in),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 al.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},qSi="DialogDescriptionWarning",BSi=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${vin(qSi).contentName}}.`;return al.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},win=ain,Sin=uin,Cin=cin,zSt=din,VSt=fin,HSt=min,WSt=gin,xin=bin;Mr();zr();var Kqe=win,Tin=Sin,zSi=Cin;var Oin=dy.forwardRef(({className:t,...e},r)=>dy.createElement(zSt,{ref:r,className:Se("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}));Oin.displayName=zSt.displayName;var Zfe=dy.forwardRef(({className:t,children:e,container:r,...n},o)=>dy.createElement(zSi,{container:r},dy.createElement(Oin,null),dy.createElement(VSt,{ref:o,className:Se("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,dy.createElement(xin,{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"},dy.createElement(Ho,{className:"tw-size-4"}),dy.createElement("span",{className:"tw-sr-only"},"Close")))));Zfe.displayName=VSt.displayName;var Yfe=({className:t,...e})=>dy.createElement("div",{className:Se("tw-flex tw-flex-col tw-space-y-0.5 tw-text-center sm:tw-text-left",t),...e});Yfe.displayName="DialogHeader";var VSi=({className:t,...e})=>dy.createElement("div",{className:Se("tw-flex tw-flex-col-reverse sm:tw-flex-row sm:tw-justify-end sm:tw-space-x-2",t),...e});VSi.displayName="DialogFooter";var Qfe=dy.forwardRef(({className:t,...e},r)=>dy.createElement(HSt,{ref:r,className:Se("tw-mt-0 tw-text-lg tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));Qfe.displayName=HSt.displayName;var epe=dy.forwardRef(({className:t,...e},r)=>dy.createElement(WSt,{ref:r,className:Se("tw-text-sm tw-text-muted",t),...e}));epe.displayName=WSt.displayName;Dt();function Rr(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=sz(),a="onChange"in t?t.onChange:void 0,s=(0,Al.useMemo)(()=>{if(a)return Ige(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return Al.default.createElement(ni,{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 Al.default.createElement(xN,{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 Al.default.createElement(n_,{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 Al.default.createElement(tT,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return Al.default.createElement("div",{className:"tw-group tw-relative tw-w-full sm:tw-w-[200px]"},Al.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:Se("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&&Al.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>Al.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),Al.default.createElement("div",{className:Se("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")},Al.default.createElement(Ji,{className:"tw-size-4"})));case"slider":return Al.default.createElement(Tfe,{value:t.value||0,onChange:t.onChange,min:t.min,max:t.max,step:t.step,suffix:t.suffix,disabled:o,className:"tw-w-full sm:tw-w-[300px]"});case"dialog":return Al.default.createElement(Kqe,null,Al.default.createElement(Tin,{asChild:!0},t.trigger),Al.default.createElement(Zfe,{container:i},(t.dialogTitle||t.dialogDescription)&&Al.default.createElement(Yfe,null,t.dialogTitle&&Al.default.createElement(Qfe,null,t.dialogTitle),t.dialogDescription&&Al.default.createElement(epe,null,t.dialogDescription)),t.children));case"custom":return t.children}};return Al.default.createElement("div",{className:Se("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)},Al.default.createElement("div",{className:"tw-w-full tw-space-y-1.5 sm:tw-w-[300px]"},Al.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-leading-none"},e),r&&Al.default.createElement("div",{className:"tw-text-xs tw-text-muted"},r)),Al.default.createElement("div",{className:"tw-w-full tw-flex-1 sm:tw-flex sm:tw-justify-end"},u()))}var Gqe=require("obsidian"),HSi=({command:t,commands:e,onUpdate:r,onRemove:n,onCopy:o,containerRef:i})=>{let a=l=>{new rU(app,e,l,async d=>{await r(d,l.title)}).open()},s=[{icon:Et.default.createElement(qS,{className:"tw-size-4"}),label:"Edit",onClick:a},{icon:Et.default.createElement(D5,{className:"tw-size-4"}),label:"Duplicate",onClick:o},{icon:Et.default.createElement(Iy,{className:"tw-size-4"}),label:"Delete",onClick:l=>{new nu(app,()=>n(l),`Are you sure you want to delete the command "${l.title}"? This will permanently remove the command file and cannot be undone.`,"Delete Command","Delete","Cancel").open()},variant:"destructive"}],u=Et.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-justify-around"},Et.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},Et.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Et.default.createElement("span",{className:"tw-text-sm tw-font-medium"},"In Menu"),Et.default.createElement(to,{content:Et.default.createElement("div",{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available in the context menu when you right-click in the editor.")})),Et.default.createElement(Uu,{checked:t.showInContextMenu,onCheckedChange:l=>{r({...t,showInContextMenu:l===!0},t.title)}})),Et.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between  tw-gap-2"},Et.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Et.default.createElement("span",{className:"tw-text-sm tw-font-medium"},"In Slash"),Et.default.createElement(to,{content:Et.default.createElement("div",{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available as a slash command in the chat.")})),Et.default.createElement(Uu,{checked:t.showInSlashMenu,onCheckedChange:l=>r({...t,showInSlashMenu:l===!0},t.title)})));return Et.default.createElement(qqe,{id:t.title,item:t,title:t.title,isDraggable:!0,isExpandable:!0,expandedContent:u,primaryAction:{icon:Et.default.createElement(qS,{className:"tw-size-4"}),onClick:a,tooltip:"Edit Command"},dropdownActions:s,containerRef:i})},WSi=({command:t,commands:e,onUpdate:r,onRemove:n,onCopy:o})=>{let{attributes:i,listeners:a,setNodeRef:s,transform:u,transition:l,isDragging:c}=cQ({id:t.title}),d={transform:gC.Transform.toString(u),transition:l},f=()=>{n(t)};return Et.default.createElement(dz,{ref:s,style:d,className:Se("tw-transition-colors",c&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50")},Et.default.createElement(hb,{className:"tw-w-10"},Et.default.createElement("div",{...i,...a,className:"tw-flex tw-cursor-grab tw-items-center tw-justify-center"},Et.default.createElement(QC,{className:"tw-size-4"}))),Et.default.createElement(hb,null,t.title),Et.default.createElement(hb,{className:"tw-text-center"},Et.default.createElement(Uu,{checked:t.showInContextMenu,onCheckedChange:p=>{r({...t,showInContextMenu:p===!0},t.title)},className:"tw-mx-auto"})),Et.default.createElement(hb,{className:"tw-text-center"},Et.default.createElement(Uu,{checked:t.showInSlashMenu,onCheckedChange:p=>r({...t,showInSlashMenu:p===!0},t.title),className:"tw-mx-auto"})),Et.default.createElement(hb,{className:"tw-text-center"},Et.default.createElement("div",{className:"tw-flex tw-justify-center tw-space-x-1"},Et.default.createElement(me,{variant:"ghost",size:"icon",onClick:()=>{new rU(app,e,t,async m=>{await r(m,t.title)}).open()}},Et.default.createElement(qS,{className:"tw-size-4"})),Et.default.createElement(me,{variant:"ghost",size:"icon",onClick:()=>o(t),title:"Duplicate command"},Et.default.createElement(D5,{className:"tw-size-4"})),Et.default.createElement(me,{variant:"ghost",size:"icon",onClick:()=>{new nu(app,f,`Are you sure you want to delete the command "${t.title}"? This will permanently remove the command file and cannot be undone.`,"Delete Command","Delete","Cancel").open()}},Et.default.createElement(Iy,{className:"tw-size-4"})))))},Ein=()=>{let t=Mje(),e=(0,Et.useMemo)(()=>Lce([...t]),[t]),r=kr(),n=(0,Et.useRef)(null),o=Aqe(iQ(cz,{activationConstraint:{distance:8}}),iQ(lz,{coordinateGetter:kqe})),i=async(d,f)=>{await Zm.getInstance().updateCommand(d,f)},a=async d=>{await Zm.getInstance().createCommand(d)},s=async d=>{try{await Zm.getInstance().deleteCommand(d),new Gqe.Notice(`Command "${d.title}" deleted successfully!`)}catch(f){throw ie("Failed to delete command:",f),new Gqe.Notice("Failed to delete command. Please try again."),f}},u=async d=>{try{let f=NWr(d.title,e),p={...d,title:f};await Zm.getInstance().createCommand(p,{autoOrder:!1})}catch(f){ie("Failed to duplicate command:",f),new Gqe.Notice("Failed to duplicate command. Please try again.")}},l=async d=>{let{active:f,over:p}=d;if(!p||f.id===p.id)return;let m=e.findIndex(b=>b.title===f.id),h=e.findIndex(b=>b.title===p.id);if(m===-1||h===-1)return;let y=[...e],[g]=y.splice(m,1);y.splice(h,0,g),await Zm.getInstance().reorderCommands(y)},c=()=>Et.default.createElement("div",{className:"tw-relative md:tw-hidden"},Et.default.createElement(sQ,{sensors:o,collisionDetection:aQ,onDragEnd:l},Et.default.createElement(lQ,{items:e.map(d=>d.title),strategy:uQ},Et.default.createElement("div",{className:"tw-space-y-2"},e.length===0?Et.default.createElement("div",{className:"tw-rounded-lg tw-border tw-border-border tw-bg-primary tw-p-8 tw-text-center tw-text-muted"},"No custom prompt files found."):e.map(d=>Et.default.createElement(HSi,{key:d.title,command:d,commands:e,onUpdate:i,onRemove:s,onCopy:u,containerRef:n}))))));return Et.default.createElement("div",{className:"tw-space-y-4",ref:n},Et.default.createElement("section",null,Et.default.createElement("div",{className:"tw-mb-4 tw-flex tw-flex-col tw-gap-2"},Et.default.createElement("div",{className:"tw-text-xl tw-font-bold"},"Custom Commands"),Et.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Custom commands are preset prompts that you can trigger in the editor by right-clicking and selecting them from the context menu or by using a ",Et.default.createElement("code",null,"/")," command in the chat to load them into your chat input.")),Et.default.createElement(Rr,{type:"text",title:"Custom Prompts Folder Name",description:"Folder where custom prompts are stored",value:r.customPromptsFolder,onChange:d=>{Re("customPromptsFolder",d),Ije()},placeholder:"copilot/copilot-custom-prompts"}),Et.default.createElement(Rr,{type:"switch",title:"Custom Prompt Templating",description:"Process variables like {activenote}, {foldername}, or {#tag} in prompts. Disable for raw prompts.",checked:r.enableCustomPromptTemplating,onCheckedChange:d=>{Re("enableCustomPromptTemplating",d)}}),Et.default.createElement(Rr,{type:"select",title:"Custom Prompts Sort Strategy",description:"Sort order for slash command menu prompts",value:r.promptSortStrategy,onChange:d=>Re("promptSortStrategy",d),options:[{label:"Recency",value:"timestamp"},{label:"Alphabetical",value:"alphabetical"},{label:"Manual",value:"manual"}]}),Et.default.createElement("div",{className:"tw-mb-4 tw-flex tw-items-start tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-4 tw-text-muted"},Et.default.createElement(ex,{className:"tw-size-5"})," ",Et.default.createElement("div",null,"Commands are automatically loaded from .md files in your custom prompts folder"," ",Et.default.createElement("strong",null,r.customPromptsFolder),". Modifying the files will also update the command settings.")),Et.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Et.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-between tw-gap-2 md:tw-justify-end"},Et.default.createElement("div",null,Et.default.createElement(me,{variant:"secondary",onClick:()=>new nu(app,vSt,"This will add default commands to your custom prompts folder. Do you want to continue?","Generate Default Commands").open()},"Generate Default")),Et.default.createElement(me,{variant:"default",className:"tw-gap-2",onClick:()=>{let d={...rN};new rU(app,e,d,async p=>{await a(p)}).open()}},Et.default.createElement(Fb,{className:"tw-size-2 md:tw-size-4"}),"Add Cmd")),Et.default.createElement("div",{className:"tw-hidden md:tw-block"},Et.default.createElement(sQ,{sensors:o,collisionDetection:aQ,onDragEnd:l},Et.default.createElement(Jfe,null,Et.default.createElement(Kfe,null,Et.default.createElement(dz,null,Et.default.createElement(m_,{className:"tw-w-10"}),Et.default.createElement(m_,null,"Name"),Et.default.createElement(m_,{className:"tw-w-24 tw-text-center"},Et.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"In Menu",Et.default.createElement(to,{content:Et.default.createElement("div",{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available in the context menu when you right-click in the editor.")}))),Et.default.createElement(m_,{className:"tw-w-28 tw-text-center"},Et.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"Slash Cmd",Et.default.createElement(to,{content:Et.default.createElement("div",{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available as a slash command in the chat.")}))),Et.default.createElement(m_,{className:"tw-w-32 tw-text-center"},"Actions"))),Et.default.createElement(lQ,{items:e.map(d=>d.title),strategy:uQ},Et.default.createElement(Gfe,null,e.length===0?Et.default.createElement(dz,null,Et.default.createElement(hb,{colSpan:5,className:"tw-py-8 tw-text-center tw-text-muted"},"No custom prompt files found.")):e.map(d=>Et.default.createElement(WSi,{key:d.title,command:d,commands:e,onUpdate:i,onRemove:s,onCopy:u}))))))),c())))};Mr();var zi=$(K());xn();h4();Qe();Mr();var pg=$(K());var Pin=()=>{let t=kr(),e=cDe(),n=e.some(s=>s.title===t.defaultSystemPromptTitle)?t.defaultSystemPromptTitle:"",o=s=>{Re("defaultSystemPromptTitle",s)},i=()=>{if(!n)return;let s=aC(n);app.setting.close(),app.workspace.openLinkText(s,"",!0)},a=()=>{new _de(app,e).open()};return pg.default.createElement("div",{className:"tw-space-y-4"},pg.default.createElement("section",{className:"tw-space-y-4 tw-rounded-lg tw-border tw-p-4"},pg.default.createElement("h3",{className:"tw-text-lg tw-font-semibold"},"User System Prompt"),pg.default.createElement(Rr,{type:"custom",title:"Default System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!"},pg.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},pg.default.createElement(dN,{value:n,onChange:s=>o(s.target.value),options:[{label:"None (use built-in prompt)",value:""},...e.map(s=>({label:s.title===t.defaultSystemPromptTitle?`${s.title} (Default)`:s.title,value:s.title}))],containerClassName:"tw-flex-1"}),pg.default.createElement(me,{variant:"ghost",size:"icon",onClick:i,className:"tw-size-5 tw-shrink-0 tw-p-0",title:"Open the source file",disabled:!n},pg.default.createElement(_1,{className:"tw-size-5"})),pg.default.createElement(me,{variant:"default",size:"icon",onClick:a,title:"Add new prompt"},pg.default.createElement(Fb,{className:"tw-size-4"})))),pg.default.createElement(Rr,{type:"text",title:"System Prompts Folder Name",description:"Folder where system prompts are stored.",value:t.userSystemPromptsFolder,onChange:s=>Re("userSystemPromptsFolder",s),placeholder:"copilot/system-prompts"})),pg.default.createElement("section",{className:"tw-space-y-4 tw-rounded-lg tw-border tw-p-4"},pg.default.createElement("h3",{className:"tw-text-lg tw-font-semibold"},"Others"),pg.default.createElement(Rr,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:s=>{Re("enableEncryption",s)}}),pg.default.createElement(Rr,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:s=>{Re("debug",s)}}),pg.default.createElement(Rr,{type:"custom",title:"Create Log File",description:`Open the Copilot log file (${Em.getLogPath()}) for easy sharing when reporting issues.`},pg.default.createElement(me,{variant:"secondary",size:"sm",onClick:async()=>{await uEe(),await Em.flush(),await Em.openLogFile()}},"Create Log File"))))};rd();xn();gr();zr();id();Qe();var _m=$(K()),Min=require("obsidian"),Rin=$(Im());xn();id();Qe();Mr();function JSi({onConfirm:t,onCancel:e}){let r=ee();return _m.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},_m.default.createElement("div",null,_m.default.createElement("p",null,"Thanks for purchasing ",_m.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!"),_m.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),_m.default.createElement("ul",{className:"tw-pl-4"},_m.default.createElement("li",null,"Default mode: ",_m.default.createElement("b",{className:"tw-text-accent"},"Copilot Plus")),_m.default.createElement("li",null,"Chat model: ",_m.default.createElement("b",{className:"tw-text-accent"},xat)),_m.default.createElement("li",null,_m.default.createElement("div",null,"Embedding model:"," ",_m.default.createElement("b",{className:"tw-text-accent"},Tat)),r.embeddingModelKey!==Oat&&_m.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-warning"},_m.default.createElement(Eg,{className:"tw-size-4"})," It will rebuild your embeddings for the entire vault")))),_m.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},_m.default.createElement(me,{variant:"ghost",onClick:e},"Apply Later"),_m.default.createElement(me,{variant:"default",onClick:t},"Apply Now")))}var Xqe=class extends Min.Modal{constructor(e){super(e),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:e}=this;this.root=(0,Rin.createRoot)(e);let r=()=>{Fbr(),this.close()},n=()=>{this.close()};this.root.render(_m.default.createElement(JSi,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};xn();gr();id();Qe();Mr();var Qc=$(K());function Iin(){let t=kr(),[e,r]=(0,Qc.useState)(null),[n,o]=(0,Qc.useState)(!1),i=XG(),[a,s]=(0,Qc.useState)(t.plusLicenseKey);return(0,Qc.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),Qc.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4 tw-rounded-lg tw-bg-secondary tw-p-4"},Qc.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-text-xl tw-font-bold"},Qc.default.createElement("span",null,"Copilot Plus"),i&&Qc.default.createElement(Xc,{variant:"outline",className:"tw-text-success"},"Active")),Qc.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-text-sm tw-text-muted"},Qc.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:"," ",Qc.default.createElement("strong",null," ","including chat context, PDF and image support, web search integration, exclusive chat and embedding models, and much more.")),Qc.default.createElement("div",null,"Copilot Plus is evolving fast, with new features and improvements rolling out regularly. Join now to secure the lowest price and get early access!")),Qc.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qc.default.createElement(xN,{className:"tw-w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),Qc.default.createElement(me,{disabled:n,onClick:async()=>{Re("plusLicenseKey",a),o(!0);let u=await m0();o(!1),u?(r(null),new Xqe(app).open()):r("Invalid license key")},className:"tw-min-w-10 tw-text-xs md:tw-text-sm"},n?Qc.default.createElement(Us,{className:"tw-size-2 tw-animate-spin md:tw-size-4"}):"Apply"),Qc.default.createElement(me,{className:"tw-text-xs md:tw-text-sm",variant:"secondary",onClick:()=>V4(a1.SETTINGS)},"Join Now ",Qc.default.createElement(w1,{className:"tw-size-2 md:tw-size-4"}))),Qc.default.createElement("div",{className:"tw-text-error"},e))}Dt();t1();Mr();var tpe=require("obsidian"),ht=$(K());xn();gr();Qe();xn();gr();nDe();nmt();Qe();xn();Xe();Qe();gr();BC();nDe();Xe();gr();Xe();var KSi={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"}))||[],"amazon-bedrock":t=>[],openrouterai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"openrouterai"}))||[],siliconflow:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"siliconflow"}))||[],"github-copilot":t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"github-copilot"}))||[]},GSi=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})):[],XSi=t=>KSi[t]||GSi(t),JSt=(t,e)=>{let r=XSi(t);try{return r(e)}catch(n){return ie(`Error parsing ${t} model data:`,n),[]}};Dt();g4();async function Ain(t){try{if(t==="github-copilot"){let l=await g$.getInstance().listModels();return{success:!0,models:JSt(t,l)}}let e=nw(t);if(!e)return{success:!1,models:[],error:"API key not configured"};e=await kn(e);let r=o1(t).listModelURL;if(!r)return{success:!1,models:[],error:"Provider does not support model listing"};let n={Authorization:`Bearer ${e}`};t==="google"?(r+=`?key=${e}`,n={}):t==="anthropic"&&(n={"x-api-key":e,"anthropic-version":"2023-06-01"});let o=async u=>{let l=new AbortController,c=setTimeout(()=>l.abort(),3e3);try{let d=await(u?hl:fetch)(r,{headers:n,signal:l.signal,method:"GET"});if(!d.ok){let f=Wr(await d.json());throw ie(f),new Error(`Failed to fetch models: ${d.statusText} 
 detail: `+f)}return d}finally{clearTimeout(c)}},i;try{i=await o(!1)}catch(u){Ce("First fetch attempt failed, trying with safeFetch...");try{i=await o(!0)}catch(l){let c=`
without CORS Error: `+Wr(u)+`
with CORS Error: `+Wr(l);throw new Error(c)}}let a=await i.json();return{success:!0,models:JSt(t,a)}}catch(e){return ie(`Error fetching models for ${t}:`,e),{success:!1,models:[],error:Wr(e)}}}async function Nin(t,e,r){let n=r?.skipVerification??!1,i=!!e.find(c=>c.name===t.name&&c.provider===t.provider),a=t.provider==="github-copilot"?void 0:nw(t.provider),s={name:t.name,provider:t.provider,apiKey:a,enabled:!0},u=!1,l;if(!n)try{await Vg.instance.getCurrentChainManager().chatModelManager.ping(s)}catch(c){if(u=!0,l=Wr(c),s.provider==="github-copilot"&&l.toLowerCase().includes("not supported")){let d=g$.getInstance().getPolicyTerms(t.id);d&&(l+=`

${d}`)}ie("Model verification failed:",c)}return{success:!0,alreadyExists:i,verificationFailed:u,verificationError:l}}function Din(t){return{name:t.name,provider:t.provider,enabled:!0}}Dt();Mr();var OL=require("obsidian"),Gs=$(K());function ZSi(t){return t.split(/\n\n+/).map((r,n)=>{let i=r.split(/(\[[^\]]+\]\([^)]+\))/g).map((a,s)=>{let u=a.match(/^\[([^\]]+)\]\(([^)]+)\)$/);return u?Gs.default.createElement("a",{key:s,href:u[2],target:"_blank",rel:"noopener noreferrer",className:"tw-underline"},u[1]):a});return Gs.default.createElement("p",{key:n,className:n>0?"tw-mt-1":""},i)})}function Zqe({provider:t,isReady:e,expanded:r=!1,skipVerification:n=!1,credentialVersion:o}){let i=kr(),[a,s]=(0,Gs.useState)(null),[u,l]=(0,Gs.useState)(!1),[c,d]=(0,Gs.useState)(null),[f,p]=(0,Gs.useState)(null),[m,h]=(0,Gs.useState)(!1),[y,g]=(0,Gs.useState)(null),b=(0,Gs.useRef)(!1),_=(0,Gs.useCallback)(async()=>{if(!(b.current||!e)){b.current=!0,l(!0),d(null);try{let O=await Ain(t);O.success?s(O.models):(d(O.error||"Failed to load models"),new OL.Notice(`Failed to load models for ${wg(t)}: ${O.error}`,5e3))}catch(O){let E=Wr(O);d(E),new OL.Notice(`Failed to load models for ${wg(t)}: ${E}`,5e3)}finally{l(!1),b.current=!1}}},[t,e]);(0,Gs.useEffect)(()=>{s(null),p(null),d(null),g(null)},[t,o]),(0,Gs.useEffect)(()=>{r&&e&&a===null&&!u&&!c&&_()},[r,e,a,u,c,_]);let w=async()=>{if(!f){new OL.Notice("Please select a model first");return}h(!0),g(null);try{let O=await Nin({id:f.id,name:f.name,provider:t},i.activeModels,{skipVerification:n});if(O.alreadyExists)O.verificationFailed?(g(O.verificationError??null),new OL.Notice(`Model ${f.name} already exists (verification failed: ${O.verificationError})`,1e4)):new OL.Notice(`Model ${f.name} verified successfully! It already exists in your models list.`);else{let E=Din({id:f.id,name:f.name,provider:t}),P=[...i.activeModels,E];Re("activeModels",P),O.verificationFailed?(g(O.verificationError??null),new OL.Notice(`Model ${f.name} added (verification failed: ${O.verificationError})`,1e4)):new OL.Notice(`Model ${f.name} verified and added to your models list!`)}}catch(O){ie("Error adding model:",O),new OL.Notice(`Failed to add model: ${Wr(O)}`)}finally{h(!1)}},T=a?.filter((O,E,P)=>P.findIndex(R=>R.id===O.id)===E).sort((O,E)=>O.name.localeCompare(E.name));return Gs.default.createElement(ko,{label:"Model",description:"Add the selected model to your models list. After adding, check the Model Tab."},Gs.default.createElement("div",null,Gs.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Gs.default.createElement("div",{className:"tw-flex-1"},Gs.default.createElement(dN,{options:T?.map(O=>({label:O.name,value:O.id}))||[],onChange:O=>{let E=O.target.value,P=a?.find(R=>R.id===E);P&&(p(P),g(null))},onClick:()=>{a===null&&!u&&_()},value:f?.id||"",placeholder:"Select Model",disabled:!e||u})),Gs.default.createElement("div",{className:"tw-w-[72px]"},Gs.default.createElement(me,{onClick:w,disabled:!f||m,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},m?Gs.default.createElement(Us,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Add"))),Gs.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},u&&Gs.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),c&&Gs.default.createElement("div",{className:"tw-p-1 tw-text-error"},"Failed to load models. ",c),a&&a.length===0&&Gs.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"No models available."),a===null&&!u&&!c&&Gs.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Click to load available models."),y&&Gs.default.createElement("div",{className:"tw-mt-2 tw-rounded-md tw-border tw-border-border tw-p-2 tw-text-error tw-bg-modifier-error/10"},ZSi(y)))))}Mr();var O6=require("obsidian"),Sr=$(K());function jin(){let t=kr(),[e]=(0,Sr.useState)(()=>g$.getInstance()),[r,n]=(0,Sr.useState)("idle"),[o,i]=(0,Sr.useState)(null),[a,s]=(0,Sr.useState)(0),[u,l]=(0,Sr.useState)(null),[c,d]=(0,Sr.useState)(!1),f=(0,Sr.useRef)(0),p=(0,Sr.useRef)(!0);(0,Sr.useEffect)(()=>(p.current=!0,()=>{p.current=!1,f.current+=1,e.abortPolling()}),[e]),(0,Sr.useEffect)(()=>{e.getAuthState().status==="authenticated"&&n("done")},[e]),(0,Sr.useEffect)(()=>{e.getAuthState().status==="authenticated"?r!=="pending"&&r!=="polling"&&n("done"):r==="done"&&n("idle")},[t.githubCopilotToken,t.githubCopilotAccessToken,t.githubCopilotTokenExpiresAt,e,r]);let m=async(O,E)=>{await e.pollForAccessToken(O.deviceCode,O.interval,O.expiresIn,P=>{p.current&&E===f.current&&s(P)}),await e.fetchCopilotToken(),!(!p.current||E!==f.current)&&(n("done"),i(null),new O6.Notice("GitHub Copilot connected successfully!"))},h=async()=>{let O=++f.current;n("pending"),l(null),s(0);try{let E=await e.startDeviceCodeFlow();if(!p.current||O!==f.current)return;i(E),n("polling"),d(!0);try{await m(E,O)}catch(P){if(!p.current||O!==f.current||rmt(P))return;throw P}}catch(E){if(!p.current||O!==f.current)return;let P=E instanceof Error?E.message:String(E);l(P),n("error"),new O6.Notice(`Authentication failed: ${P}`)}},y=()=>{let O=r==="pending"||r==="polling"||r==="error"&&o;f.current+=1,e.resetAuth(),n("idle"),i(null),l(null),s(0),d(!1),new O6.Notice(O?"Authentication cancelled":"GitHub Copilot disconnected")},g=async O=>{try{await navigator.clipboard.writeText(O),new O6.Notice("Copied to clipboard!")}catch{new O6.Notice("Failed to copy to clipboard")}},b=r==="done",_=r==="pending"||r==="polling",w=(r==="polling"||r==="error")&&o!==null,T=async()=>{if(!o)return;let O=++f.current;n("polling"),l(null),s(0);try{await m(o,O)}catch(E){if(!p.current||O!==f.current||rmt(E))return;let P=E instanceof Error?E.message:String(E);l(P),n("error"),new O6.Notice(`Authentication failed: ${P}`)}};return Sr.default.createElement(Sr.default.Fragment,null,Sr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-font-medium"},Sr.default.createElement("div",{className:"tw-truncate"},"GitHub Copilot"),Sr.default.createElement(to,{content:Sr.default.createElement("div",{className:"tw-max-w-[250px]"},Sr.default.createElement("div",{className:"tw-font-semibold"},"Unofficial Integration"),Sr.default.createElement("p",{className:"tw-mt-1"},"This uses GitHub Copilot's internal API, which is not officially supported for third-party apps. It may stop working at any time.")),side:"bottom"},Sr.default.createElement("span",{className:"tw-cursor-help tw-text-warning"},"\u26A0\uFE0F"))),Sr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center"},Sr.default.createElement("div",{className:`tw-flex tw-h-9 tw-flex-1 tw-items-center tw-rounded-md tw-border tw-border-border tw-px-3 tw-text-sm ${b?"tw-text-success":_?"tw-text-warning":r==="error"?"tw-text-error":"tw-text-muted"}`},b?"\u2713 Connected":_?"Authenticating...":r==="error"?"Error - Click Setup to retry":"Not connected"),Sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},b&&Sr.default.createElement(me,{onClick:y,variant:"ghost",className:"tw-flex tw-flex-1 tw-items-center tw-justify-center tw-whitespace-nowrap tw-px-4 tw-py-2 tw-text-warning hover:tw-text-warning sm:tw-flex-none"},"Disconnect"),Sr.default.createElement(me,{onClick:()=>{!b&&!_?h():d(!c)},disabled:_,variant:"secondary",className:"tw-flex tw-flex-1 tw-items-center tw-justify-center tw-gap-2 tw-whitespace-nowrap tw-px-4 tw-py-2 sm:tw-flex-none"},_?Sr.default.createElement(Us,{className:"tw-size-4 tw-animate-spin"}):b?Sr.default.createElement(Sr.default.Fragment,null,"Add Model",c?Sr.default.createElement(Og,{className:"tw-ml-1 tw-size-4"}):Sr.default.createElement(Ji,{className:"tw-ml-1 tw-size-4"})):"Setup"))),Sr.default.createElement("div",null,Sr.default.createElement("a",{href:"https://github.com/settings/apps/authorizations",target:"_blank",rel:"noopener noreferrer",className:"tw-text-[10px] tw-text-accent hover:tw-text-accent-hover sm:tw-text-xs"},"Manage GitHub Authorizations"))),Sr.default.createElement(uy,{open:c},Sr.default.createElement(ly,{className:"tw-rounded-md tw-p-3"},Sr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},w&&o&&Sr.default.createElement("div",{className:"tw-space-y-2.5 tw-rounded-lg tw-border tw-border-border tw-p-3.5 tw-bg-muted/10"},Sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs"},Sr.default.createElement("span",{className:"tw-font-semibold"},"1."),Sr.default.createElement("span",{className:"tw-text-muted"},"Go to:"),Sr.default.createElement("a",{href:o.verificationUri,target:"_blank",rel:"noopener noreferrer",className:"tw-break-all tw-text-accent tw-underline hover:tw-text-accent-hover"},o.verificationUri),Sr.default.createElement(me,{variant:"ghost",size:"sm",onClick:()=>g(o.verificationUri),className:"tw-size-5 tw-shrink-0 tw-p-0",title:"Copy URL"},Sr.default.createElement(U_,{className:"tw-size-3.5"}))),Sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs"},Sr.default.createElement("span",{className:"tw-font-semibold"},"2."),Sr.default.createElement("span",{className:"tw-text-muted"},"Enter code:"),Sr.default.createElement("code",{className:"tw-rounded-md tw-border-border tw-px-3 tw-py-1.5 tw-font-mono tw-text-base tw-font-bold tw-tracking-widest tw-bg-accent/10 tw-border-accent/30"},o.userCode),Sr.default.createElement(me,{variant:"ghost",size:"sm",onClick:()=>g(o.userCode),className:"tw-size-5 tw-shrink-0 tw-p-0",title:"Copy code"},Sr.default.createElement(U_,{className:"tw-size-3.5"}))),Sr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-border-t tw-pt-2 tw-border-border/50"},r==="polling"?Sr.default.createElement(Sr.default.Fragment,null,Sr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-2 tw-py-1 tw-text-xs tw-text-muted"},Sr.default.createElement(Us,{className:"tw-size-3.5 tw-animate-spin"}),Sr.default.createElement("span",null,"Waiting for authorization...",a>0&&` (Attempt ${a})`)),Sr.default.createElement(me,{onClick:y,variant:"ghost",size:"sm",className:"tw-w-full"},"Cancel")):Sr.default.createElement(Sr.default.Fragment,null,Sr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-2 tw-py-1 tw-text-xs tw-text-error"},Sr.default.createElement("span",null,"Polling failed - you can retry with the same code")),Sr.default.createElement("div",{className:"tw-flex tw-gap-2"},Sr.default.createElement(me,{onClick:T,variant:"secondary",size:"sm",className:"tw-flex-1"},"Retry"),Sr.default.createElement(me,{onClick:y,variant:"ghost",size:"sm",className:"tw-flex-1"},"Start Over"))))),b&&Sr.default.createElement(Zqe,{provider:"github-copilot",isReady:b,expanded:c,credentialVersion:t.githubCopilotToken}),u&&Sr.default.createElement("div",{className:"tw-rounded-lg tw-border tw-border-border tw-p-3.5 tw-text-xs tw-text-error tw-bg-muted/10"},u)))))}xn();gr();Xe();Qe();Dt();Mr();var EL=require("obsidian"),bi=$(K());function $in(t){return t.trim().replace(/\/+$/,"").replace(/\/v1$/i,"")}async function YSi(t,e){let r=$in(t);return e==="ollama"?((await(0,EL.requestUrl)({url:`${r}/api/tags`,method:"GET"})).json?.models||[]).map(s=>({id:s.name,name:s.name})):((await(0,EL.requestUrl)({url:`${r}/v1/models`,method:"GET"})).json?.data||[]).map(i=>({id:i.id,name:i.id}))}function QSi({service:t,expanded:e,onToggleExpand:r}){let n=kr(),[o,i]=(0,bi.useState)(t.url),[a,s]=(0,bi.useState)(null),[u,l]=(0,bi.useState)(!1),[c,d]=(0,bi.useState)(null),[f,p]=(0,bi.useState)(""),[m,h]=(0,bi.useState)(!1),y=async()=>{l(!0),d(null);try{let _=await YSi(o,t.kind);s(_)}catch(_){ie(`Error fetching models for ${t.name}:`,_),d(Wr(_)),s(null)}finally{l(!1)}},g=()=>{r(),!e&&!a&&!u&&y()},b=async()=>{if(!f||!a)return;let _=a.find(O=>O.id===f);if(!_)return;h(!0);let w=!1,T="";try{let O=t.kind,E=$in(o),P=t.kind==="ollama"?E:`${E}/v1`,R={name:_.name,provider:O,baseUrl:P,enabled:!0};try{await Vg.instance.getCurrentChainManager().chatModelManager.ping(R)}catch(A){w=!0,T=Wr(A),ie("Model verification failed:",A)}n.activeModels.find(A=>A.name===R.name&&A.provider===R.provider)?w?new EL.Notice(`Model ${_.name} already exists (verification failed: ${T})`,5e3):new EL.Notice(`Model ${_.name} already exists.`):(Re("activeModels",[...n.activeModels,R]),w?new EL.Notice(`Model ${_.name} added (verification failed: ${T})`,5e3):new EL.Notice(`Model ${_.name} added!`))}catch(O){new EL.Notice(`Failed to add model: ${Wr(O)}`)}finally{h(!1)}};return bi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},bi.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},bi.default.createElement("div",{className:"tw-truncate"},t.name)),bi.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},bi.default.createElement("div",{className:"tw-flex-1"},bi.default.createElement(ni,{className:"tw-max-w-full",value:o,onChange:_=>{i(_.target.value),s(null),p(""),d(null)}})),bi.default.createElement("div",null,bi.default.createElement(me,{onClick:g,variant:"secondary",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-2 tw-whitespace-nowrap tw-px-4 tw-py-2"},"Add Model",e?bi.default.createElement(Og,{className:"tw-ml-1 tw-size-4"}):bi.default.createElement(Ji,{className:"tw-ml-1 tw-size-4"})))),bi.default.createElement(uy,{open:e,className:"tw-mt-2"},bi.default.createElement(ly,{className:"tw-rounded-md tw-p-3"},bi.default.createElement(ko,{label:"Model",description:"Add the currently selected model to model List."},bi.default.createElement("div",null,bi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},bi.default.createElement("div",{className:"tw-flex-1"},bi.default.createElement(dN,{options:a?[...a].sort((_,w)=>_.name.localeCompare(w.name)).map(_=>({label:_.name,value:_.id})):[],onChange:_=>p(_.target.value),value:f,placeholder:"Select Model",disabled:u||!!c})),bi.default.createElement("div",{className:"tw-w-[72px]"},bi.default.createElement(me,{onClick:b,disabled:!f||m,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},m?bi.default.createElement(Us,{className:"tw-size-4 tw-animate-spin"}):"Add"))),bi.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},u&&bi.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),c&&bi.default.createElement("div",{className:"tw-p-1 tw-text-error"},"Failed: ",c),a&&a.length===0&&bi.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"No models found.")))))))}function Lin(){let[t,e]=(0,bi.useState)(null),r=[{id:"ollama",name:"Ollama",url:"http://localhost:11434",kind:"ollama"},{id:"lm-studio",name:"LM Studio",url:"http://localhost:1234",kind:"lm-studio"}];return bi.default.createElement("div",{className:"tw-mt-6 tw-border-t tw-border-border tw-pt-4"},bi.default.createElement("div",{className:"tw-mb-3"},bi.default.createElement("h3",{className:"tw-m-0 tw-text-base tw-font-bold"},"Local Services"),bi.default.createElement("div",{className:"tw-mt-1 tw-text-xs tw-text-muted"},"Need help?"," ",bi.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/blob/master/local_copilot.md",target:"_blank",rel:"noopener noreferrer",className:"tw-text-accent hover:tw-text-accent-hover"},"Setup guide"))),bi.default.createElement("div",{className:"tw-space-y-4"},r.map(n=>bi.default.createElement(QSi,{key:n.id,service:n,expanded:t===n.id,onToggleExpand:()=>e(o=>o===n.id?null:n.id)}))))}Dt();Mr();g4();var Fin=require("obsidian"),Go=$(K()),kin=$(Im());function e0i({onClose:t,onGoToModelTab:e}){kr();let[r,n]=(0,Go.useState)(null);(0,Go.useEffect)(()=>{n(null)},[]);let o=JWe().map(a=>{let s=a,u=nw(s);return{provider:s,apiKey:u}}),i=(a,s)=>{nw(a)!==s&&Re(Tge[a],s)};return Go.default.createElement("div",{className:"tw-p-4 sm:tw-max-w-[500px]"},Go.default.createElement("div",{className:"tw-mb-4"},Go.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"AI Provider Settings"),Go.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Configure your AI providers by adding their API keys.")),Go.default.createElement("div",{className:"tw-space-y-6 tw-py-4"},Go.default.createElement("div",{className:"tw-space-y-4"},o.map(a=>{let s=o1(a.provider),u=!!s.listModelURL,l=r===a.provider;return Go.default.createElement(Go.default.Fragment,{key:a.provider},Go.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Go.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},Go.default.createElement("div",{className:"tw-truncate"},wg(a.provider))),Go.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},Go.default.createElement("div",{className:"tw-flex-1"},Go.default.createElement(xN,{className:"tw-max-w-full",value:a.apiKey,onChange:c=>i(a.provider,c)})),u&&Go.default.createElement("div",null,Go.default.createElement(me,{onClick:()=>{n(l?null:a.provider)},disabled:!a.apiKey,variant:"secondary",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-2 tw-whitespace-nowrap tw-px-4 tw-py-2"},"Add Model",l?Go.default.createElement(Og,{className:"tw-ml-1 tw-size-4"}):Go.default.createElement(Ji,{className:"tw-ml-1 tw-size-4"})))),Go.default.createElement("div",null,s.keyManagementURL&&Go.default.createElement("a",{href:s.keyManagementURL,target:"_blank",rel:"noopener noreferrer",className:"tw-text-[10px] tw-text-accent hover:tw-text-accent-hover sm:tw-text-xs"},"Get ",wg(a.provider)," Key"))),u&&Go.default.createElement(uy,{open:l,className:"tw-mt-2"},Go.default.createElement(ly,{className:"tw-rounded-md tw-p-3"},Go.default.createElement(Zqe,{provider:a.provider,isReady:!!a.apiKey,expanded:l,credentialVersion:a.apiKey}))))})),Go.default.createElement(jin,null),Go.default.createElement(Lin,null),e&&Go.default.createElement("div",{className:"tw-mt-4 tw-border-t tw-border-border tw-pt-4"},Go.default.createElement("div",{className:"tw-rounded-lg tw-border tw-p-4 tw-bg-secondary/30 tw-border-border/60"},Go.default.createElement("div",{className:"tw-flex tw-gap-3"},Go.default.createElement("div",{className:"tw-mt-0.5 tw-shrink-0"},Go.default.createElement(jre,{className:"tw-size-5 tw-text-accent"})),Go.default.createElement("div",{className:"tw-flex-1"},Go.default.createElement("h4",{className:"tw-mb-1 tw-text-sm tw-font-semibold"},"Looking for Azure OpenAI or Custom Providers?"),Go.default.createElement("p",{className:"tw-mb-3 tw-text-xs tw-leading-relaxed tw-text-muted"},"Providers like Azure OpenAI, OpenAI Format, or Local LLMs require additional configuration (Base URL, Deployment Name, etc.)."),Go.default.createElement("button",{onClick:()=>{e(),t()},className:"tw-group tw-flex tw-items-center tw-gap-1 tw-text-sm tw-font-medium tw-text-accent hover:tw-text-accent-hover"},"Go to Model Settings",Go.default.createElement(od,{className:"tw-size-4 tw-transition-transform group-hover:tw-translate-x-0.5"}))))))),Go.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end"},Go.default.createElement(me,{onClick:t},"Close")))}var Yqe=class extends Fin.Modal{constructor(e,r){super(e),this.onGoToModelTab=r}onOpen(){let{contentEl:e}=this;this.root=(0,kin.createRoot)(e),this.root.render(Go.default.createElement(e0i,{onClose:()=>this.close(),onGoToModelTab:this.onGoToModelTab}))}onClose(){this.root.unmount()}};var r0i={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus",project:"Projects (alpha)"},qin=()=>{let t=kr(),{setSelectedTab:e}=sz(),[r,n]=(0,ht.useState)(!1),[o,i]=(0,ht.useState)(t.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),a=()=>{n(!0);try{let l=o||"{$date}_{$time}__{$topic}",d=["{$date}","{$time}","{$topic}"].filter(g=>!l.includes(g));if(d.length>0){new tpe.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 tpe.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:m}=vg(new Date),y=l.replace("{$topic}","test topic name".slice(0,100).replace(/\s+/g,"_")).replace("{$date}",m.split("_")[0]).replace("{$time}",m.split("_")[1]);Re("defaultConversationNoteName",l),i(l),new tpe.Notice(`Format applied successfully! Example: ${y}`,4e3)}catch(l){new tpe.Notice(`Error applying format: ${l.message}`,4e3)}finally{n(!1)}},s=!!t.activeModels.find(l=>l.enabled&&no(l)===t.defaultModelKey),u=t.activeModels.filter(l=>l.enabled).map(l=>({label:QX(l),value:no(l)}));return ht.default.createElement("div",{className:"tw-space-y-4"},ht.default.createElement(Iin,null),ht.default.createElement("section",null,ht.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"General"),ht.default.createElement("div",{className:"tw-space-y-4"},ht.default.createElement("div",{className:"tw-space-y-4"},ht.default.createElement(Rr,{type:"custom",title:"API Keys",description:ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ht.default.createElement("span",{className:"tw-leading-none"},"Configure API keys for different AI providers"),ht.default.createElement(to,{content:ht.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},ht.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"API key required for chat and QA features"),ht.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."))}))},ht.default.createElement(me,{onClick:()=>{new Yqe(app,()=>e("model")).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",ht.default.createElement($re,{className:"tw-size-4"})))),ht.default.createElement(Rr,{type:"select",title:"Default Chat Model",description:ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ht.default.createElement("span",{className:"tw-leading-none"},"Select the Chat model to use"),ht.default.createElement(to,{content:ht.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},ht.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Default model is OpenRouter Gemini 2.5 Flash"),ht.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"Set your OpenRouter API key in 'API keys' to use this model, or select a different model from another provider."))})),value:s?t.defaultModelKey:"Select Model",onChange:l=>{let c=t.activeModels.find(p=>p.enabled&&no(p)===l);if(!c)return;let{hasApiKey:d,errorNotice:f}=qJ(c,t);Re("defaultModelKey",l)},options:s?u:[{label:"Select Model",value:"Select Model"},...u],placeholder:"Model"}),ht.default.createElement(Rr,{type:"select",title:"Default Mode",description:ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ht.default.createElement("span",{className:"tw-leading-none"},"Select the default chat mode"),ht.default.createElement(to,{content:ht.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},ht.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},ht.default.createElement("li",null,ht.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",ht.default.createElement("i",null,"Free to use with your own API key.")),ht.default.createElement("li",null,ht.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",ht.default.createElement("i",null,"Free to use with your own API key.")),ht.default.createElement("li",null,ht.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"," ",ht.default.createElement("a",{href:Pat(a1.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=>Re("defaultChainType",l),options:Object.entries(r0i).map(([l,c])=>({label:c,value:l}))}),ht.default.createElement(Rr,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:t.defaultOpenArea,onChange:l=>Re("defaultOpenArea",l),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),ht.default.createElement(Rr,{type:"select",title:"Send Shortcut",description:ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ht.default.createElement("span",{className:"tw-leading-none"},"Choose keyboard shortcut to send messages"),ht.default.createElement(to,{content:ht.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},ht.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Shortcut not working?"),ht.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"If your selected shortcut doesn't work, check",ht.default.createElement("strong",null," Obsidian's Settings \u2192 Hotkeys")," to see if another command is using the same key combination. ",ht.default.createElement("br",null),"You may need to remove or change the conflicting hotkey first."))})),value:t.defaultSendShortcut,onChange:l=>Re("defaultSendShortcut",l),options:[{label:"Enter",value:"enter"},{label:"Shift + Enter",value:"shift+enter"}]}),ht.default.createElement(Rr,{type:"switch",title:"Auto-Add Active Content to Context",description:"Automatically add the active note or Web Viewer tab (Desktop only) to chat context when sending messages.",checked:t.autoAddActiveContentToContext,onCheckedChange:l=>{Re("autoAddActiveContentToContext",l)}}),ht.default.createElement(Rr,{type:"switch",title:"Auto-Add Selection to Context",description:"Automatically add selected text from notes or Web Viewer (Desktop only) to chat context. Disable to use manual command instead.",checked:t.autoAddSelectionToContext,onCheckedChange:l=>{Re("autoAddSelectionToContext",l)}}),ht.default.createElement(Rr,{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:l=>{Re("passMarkdownImages",l)}}),ht.default.createElement(Rr,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:t.showSuggestedPrompts,onCheckedChange:l=>Re("showSuggestedPrompts",l)}),ht.default.createElement(Rr,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:t.showRelevantNotes,onCheckedChange:l=>Re("showRelevantNotes",l)}))),ht.default.createElement("section",null,ht.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Saving Conversations"),ht.default.createElement("div",{className:"tw-space-y-4"},ht.default.createElement(Rr,{type:"switch",title:"Autosave Chat",description:"Automatically saves the chat after every user message and AI response.",checked:t.autosaveChat,onCheckedChange:l=>Re("autosaveChat",l)}),ht.default.createElement(Rr,{type:"switch",title:"Generate AI Chat Title on Save",description:"When enabled, uses an AI model to generate a concise title for saved chat notes. When disabled, uses the first 10 words of the first user message.",checked:t.generateAIChatTitleOnSave,onCheckedChange:l=>Re("generateAIChatTitleOnSave",l)}),ht.default.createElement(Rr,{type:"text",title:"Default Conversation Folder Name",description:"The default folder name where chat conversations will be saved. Default is 'copilot/copilot-conversations'",value:t.defaultSaveFolder,onChange:l=>Re("defaultSaveFolder",l),placeholder:"copilot/copilot-conversations"}),ht.default.createElement(Rr,{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=>Re("defaultConversationTag",l),placeholder:"ai-conversations"}),ht.default.createElement(Rr,{type:"custom",title:"Conversation Filename Template",description:ht.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-1.5 "},ht.default.createElement("span",{className:"tw-leading-none"},"Customize the format of saved conversation note names."),ht.default.createElement(to,{content:ht.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},ht.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Note: All the following variables must be included in the template."),ht.default.createElement("div",null,ht.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-muted"},"Available variables:"),ht.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},ht.default.createElement("li",null,ht.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),ht.default.createElement("li",null,ht.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),ht.default.createElement("li",null,ht.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),ht.default.createElement("i",{className:"tw-mt-2 tw-text-sm tw-text-muted"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]")))}))},ht.default.createElement("div",{className:"tw-flex tw-w-[320px] tw-items-center tw-gap-1.5"},ht.default.createElement(ni,{type:"text",className:Se("tw-min-w-[80px] tw-grow tw-transition-all tw-duration-200",r?"tw-w-[80px]":"tw-w-[120px]"),placeholder:"{$date}_{$time}__{$topic}",value:o,onChange:l=>i(l.target.value),disabled:r}),ht.default.createElement(me,{onClick:()=>a(),disabled:r,variant:"secondary"},r?ht.default.createElement(ht.default.Fragment,null,ht.default.createElement(Us,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Apply"):"Apply"))))),ht.default.createElement("section",null,ht.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Sorting"),ht.default.createElement("div",{className:"tw-space-y-4"},ht.default.createElement(Rr,{type:"select",title:"Chat History Sort Strategy",description:"Sort order for the chat history list",value:t.chatHistorySortStrategy,onChange:l=>{RJ(l)&&Re("chatHistorySortStrategy",l)},options:[{label:"Recency",value:"recent"},{label:"Created",value:"created"},{label:"Alphabetical",value:"name"}]}),ht.default.createElement(Rr,{type:"select",title:"Project List Sort Strategy",description:"Sort order for the project list",value:t.projectListSortStrategy,onChange:l=>{RJ(l)&&Re("projectListSortStrategy",l)},options:[{label:"Recency",value:"recent"},{label:"Created",value:"created"},{label:"Alphabetical",value:"name"}]}))))};gr();DG();u0();id();Qe();var Uin=require("obsidian"),In=$(K());var fy=$(K());gr();Qe();var Bin=()=>{let t=kr(),e=Uc.getInstance(),r=new Set(t.autonomousAgentEnabledToolIds||[]),n=e.getToolsByCategory(),o=e.getConfigurableTools(),i=(u,l)=>{let c=new Set(r);l?c.add(u):c.delete(u),Re("autonomousAgentEnabledToolIds",Array.from(c))},a=(u,l)=>{let c=new Set(r);for(let{metadata:d}of l)u?c.add(d.id):c.delete(d.id);Re("autonomousAgentEnabledToolIds",Array.from(c))},s=()=>Array.from(n.entries()).filter(([l,c])=>c.some(d=>o.includes(d))).map(([l,c])=>{let d=c.filter(f=>o.includes(f));if(d.length===0)return null;if(l==="cli"){let f=d.every(({metadata:p})=>r.has(p.id));return fy.default.createElement("div",{key:"cli",className:"tw-flex tw-flex-col tw-gap-2 tw-rounded-md tw-border tw-border-border tw-pb-3"},fy.default.createElement(Rr,{type:"switch",title:"Obsidian CLI (Experimental)",description:"Enable direct vault operations via the Obsidian desktop CLI",checked:f,onCheckedChange:p=>a(p,d)}),fy.default.createElement("div",{className:"tw-ml-4 tw-flex tw-flex-col tw-gap-1 tw-border-l tw-border-border tw-px-3"},d.map(({metadata:p})=>fy.default.createElement("div",{key:p.id,className:"tw-flex tw-flex-col"},fy.default.createElement("span",{className:"tw-text-xs tw-font-medium tw-text-normal"},p.displayName),fy.default.createElement("span",{className:"tw-text-xs tw-text-muted"},p.description)))))}return fy.default.createElement(fy.default.Fragment,{key:l},d.map(({metadata:f})=>fy.default.createElement(Rr,{key:f.id,type:"switch",title:f.displayName,description:f.description,checked:r.has(f.id),onCheckedChange:p=>i(f.id,p)})))});return fy.default.createElement(fy.default.Fragment,null,fy.default.createElement(Rr,{type:"slider",title:"Max Iterations",description:"Maximum number of reasoning iterations the autonomous agent can perform. Higher values allow for more complex reasoning but may take longer.",value:t.autonomousAgentMaxIterations??4,onChange:u=>{Re("autonomousAgentMaxIterations",u)},min:4,max:Cge,step:1}),fy.default.createElement("div",{className:"tw-mt-4 tw-rounded-lg tw-bg-secondary tw-p-4"},fy.default.createElement("div",{className:"tw-mb-2 tw-text-sm tw-font-medium"},"Agent Accessible Tools"),fy.default.createElement("div",{className:"tw-mb-4 tw-text-xs tw-text-muted"},"Toggle which tools the autonomous agent can use"),fy.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},s())))};var zin=()=>{let t=kr(),[e,r]=(0,In.useState)(!1),n=jbr(),o=async a=>{if(a){r(!0);let s=await $br();if(r(!1),!s)return;Re("enableSelfHostMode",!0)}else Re("enableSelfHostMode",!1),Re("enableMiyo",!1)},i=async a=>{if(a===t.enableMiyo)return;if(!a){Re("enableMiyo",!1);return}r(!0);try{if(!await new l0().isBackendAvailable(Mx(t))){new Uin.Notice("Miyo app is not available. Please start the Miyo app and try again.");return}}finally{r(!1)}let s=async()=>{a&&t.embeddingBatchSize!==Do.embeddingBatchSize&&Re("embeddingBatchSize",Do.embeddingBatchSize),Re("enableMiyo",a),a&&!t.enableSemanticSearchV3&&Re("enableSemanticSearchV3",!0),(t.enableSemanticSearchV3||a)&&await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0})};new nu(app,s,`Enabling Miyo Search will use your current vault folder name as the Miyo folder identifier and request a scan from Miyo. Make sure this folder is already registered in Miyo. Embedding Batch Size will be reset to the default (${Do.embeddingBatchSize}) for local stability. Continue?`,"Request Miyo Scan").open()};return In.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},In.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4"},In.default.createElement("div",{className:"tw-flex tw-items-center tw-py-4"},In.default.createElement(Xc,{variant:"secondary",className:"tw-text-accent"},"Plus Required")),In.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},In.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autonomous Agent"),In.default.createElement(Rr,{type:"switch",title:"Enable Autonomous Agent",description:"Enable autonomous agent mode in Plus chat. The AI will reason step-by-step and decide which tools to use automatically, improving response quality for complex queries.",checked:t.enableAutonomousAgent,onCheckedChange:a=>{Re("enableAutonomousAgent",a)}}),t.enableAutonomousAgent&&In.default.createElement(In.default.Fragment,null,In.default.createElement(Bin,null)),In.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Document Processor"),In.default.createElement(Rr,{type:"text",title:"Store converted markdown at",description:"When PDFs and other documents are processed, the converted markdown is saved to this folder. Leave empty to skip saving.",value:t.convertedDocOutputFolder,onChange:a=>{Re("convertedDocOutputFolder",a)},placeholder:"e.g. copilot/converteddocs"}),In.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Memory (experimental)"),In.default.createElement(Rr,{type:"text",title:"Memory Folder Name",description:"Specify the folder where memory data is stored.",value:t.memoryFolderName,onChange:a=>{Re("memoryFolderName",a)},placeholder:"copilot/memory"}),In.default.createElement(Rr,{type:"switch",title:"Reference Recent Conversation",description:"When enabled, Copilot references your recent conversation history to provide more contextually relevant responses. All history data is stored locally in your vault.",checked:t.enableRecentConversations,onCheckedChange:a=>{Re("enableRecentConversations",a)}}),t.enableRecentConversations&&In.default.createElement(Rr,{type:"slider",title:"Max Recent Conversations",description:"Number of recent conversations to remember for context. Higher values provide more context but may slow down responses.",min:10,max:50,step:1,value:t.maxRecentConversations,onChange:a=>Re("maxRecentConversations",a)}),In.default.createElement(Rr,{type:"switch",title:"Reference Saved Memories",description:"When enabled, Copilot can access memories that you explicitly asked it to remember. Use this to store important facts, preferences, or context for future conversations.",checked:t.enableSavedMemory,onCheckedChange:a=>{Re("enableSavedMemory",a)}}),n&&In.default.createElement(In.default.Fragment,null,In.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5 tw-pt-4 tw-text-xl tw-font-semibold"},"Self-Host Mode",In.default.createElement(to,{content:"Lifetime license required"})),In.default.createElement(Rr,{type:"switch",title:"Enable Self-Host Mode",description:In.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},In.default.createElement("span",{className:"tw-leading-none"},"Use your own infrastructure for LLMs, embeddings and local document understanding with our desktop app Miyo."),In.default.createElement(to,{content:In.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},In.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Self-Host Mode (Believer/Supporter only)"),In.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"Connect to your own self-hosted backend (e.g., Miyo) for complete control over your AI infrastructure. This allows offline usage and custom model deployments."),In.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"Requires re-validation every 15 days when online."))})),checked:t.enableSelfHostMode,onCheckedChange:o,disabled:e}),t.enableSelfHostMode&&In.default.createElement(In.default.Fragment,null,In.default.createElement(Rr,{type:"text",title:"Remote Miyo Server URL (Optional)",description:"Leave blank when accessing Miyo locally. Set this only when Miyo is running on a remote machine \u2014 it will override the local service discovery.",value:t.miyoServerUrl||"",onChange:a=>Re("miyoServerUrl",a)}),In.default.createElement(Rr,{type:"switch",title:"Enable Miyo",description:"Use Miyo as your local search, PDF parsing, and context hub. Copilot will send the current vault folder name to Miyo and can request scans, but folder registration is managed in Miyo.",checked:t.enableMiyo,onCheckedChange:i,disabled:e}),t.enableMiyo&&In.default.createElement(In.default.Fragment,null,In.default.createElement(Rr,{type:"switch",title:"Search everything in Miyo",description:"When enabled, Miyo searches all indexed content across all folders. When disabled, searches are limited to the current vault folder only.",checked:t.miyoSearchAll,onCheckedChange:a=>Re("miyoSearchAll",a)}),!t.miyoSearchAll&&In.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"Folder identifier sent to Miyo:"," ",In.default.createElement("span",{className:"tw-font-medium tw-text-normal"},tq(app)))),In.default.createElement(Rr,{type:"select",title:"Web Search Provider",description:"Choose which service to use for self-host web search.",value:t.selfHostSearchProvider,onChange:a=>Re("selfHostSearchProvider",a),options:[{label:"Firecrawl (default)",value:"firecrawl"},{label:"Perplexity Sonar",value:"perplexity"}]}),t.selfHostSearchProvider==="firecrawl"&&In.default.createElement(Rr,{type:"password",title:"Firecrawl API Key",description:In.default.createElement("span",null,"API key for web search via Firecrawl."," ",In.default.createElement("a",{href:"https://firecrawl.link/logan-yang",target:"_blank",rel:"noopener noreferrer",className:"tw-text-accent"},"Sign up \u2192")),value:t.firecrawlApiKey,onChange:a=>Re("firecrawlApiKey",a),placeholder:"fc-..."}),t.selfHostSearchProvider==="perplexity"&&In.default.createElement(Rr,{type:"password",title:"Perplexity API Key",description:In.default.createElement("span",null,"API key for web search via Perplexity Sonar."," ",In.default.createElement("a",{href:"https://docs.perplexity.ai",target:"_blank",rel:"noopener noreferrer",className:"tw-text-accent"},"Get API key \u2192")),value:t.perplexityApiKey,onChange:a=>Re("perplexityApiKey",a),placeholder:"pplx-..."}),In.default.createElement(Rr,{type:"password",title:"Supadata API Key",description:In.default.createElement("span",null,"API key for YouTube transcripts via Supadata."," ",In.default.createElement("a",{href:"https://supadata.ai/?ref=obcopilot",target:"_blank",rel:"noopener noreferrer",className:"tw-text-accent"},"Sign up \u2192")),value:t.supadataApiKey,onChange:a=>Re("supadataApiKey",a),placeholder:"sd-..."}))))))};gr();XV();Xe();Qe();xn();gr();Xe();Qe();Dt();gr();BC();var n0i="2023-06-01",o0i="bedrock-2023-05-31",P6="Hello!",npe="Hello!",KSt=64,i0i=256,a0i=256,s0i=256,u0i=new Set(["openai","openai","openrouterai","groq","xai","siliconflow","siliconflow","3rd party (openai-format)","3rd party (openai-format)","lm-studio","lm-studio","mistralai","deepseek"]);function fz(t){return t.replace(/\/+$/g,"")}function l0i(t){try{return new URL(t)}catch{return null}}function rpe(t){return t.replace(/'/g,`'"'"'`)}function Qqe(t){let e=qC[t];return(e?.curlBaseURL??e?.host??"").trim()}async function mQ(t){let e=[],r=t?.trim()??"";if(!r)return e.push("API key is empty; using placeholder."),{apiKey:"<YOUR_API_KEY>",warnings:e};try{let n=(await kn(r))?.trim();return!n||n==="Copilot failed to decrypt API keys!"?(e.push("API key could not be decrypted; using placeholder."),{apiKey:"<YOUR_API_KEY>",warnings:e}):{apiKey:n,warnings:e}}catch{return e.push("API key could not be decrypted; using placeholder."),{apiKey:"<YOUR_API_KEY>",warnings:e}}}function c0i(t){let e=fz(t),r=["/chat/completions","/embeddings","/responses"];for(let n of r)if(e.endsWith(n))return e.slice(0,-n.length);return e}function d0i(t){let e=fz(t);return e.endsWith("/models")&&(e=e.slice(0,-7)),!e.includes("/v1beta")&&!e.includes("/v1")&&(e=`${e}/v1beta`),e}function f0i(t){let e=fz(t),r=["/api/v1","/v1","/api"];for(let n of r)if(e.endsWith(n))return e.slice(0,-n.length);return e}function E6(t){let e=[],r=rpe(t.url);e.push(`curl --request ${t.method} '${r}'`);for(let a of t.curlArgs??[])e.push(`  ${a}`);let n=["Content-Type","Accept","Authorization","x-goog-api-key","api-key","x-api-key","anthropic-version","OpenAI-Organization"],o=t.headers??{},i=new Set;for(let a of n)o[a]!==void 0&&(i.add(a),e.push(`  --header '${rpe(`${a}: ${o[a]}`)}'`));for(let a of Object.keys(o).sort())i.has(a)||e.push(`  --header '${rpe(`${a}: ${o[a]}`)}'`);if(t.body!==void 0){let a=JSON.stringify(t.body,null,2);e.push(`  --data-raw '${rpe(a)}'`)}return e.join(` \\
`)}async function p0i(t,e){let r=[],n=t.provider?.trim()??"",o=Qqe(n),i=t.baseUrl?.trim()??"",a=fz(i||o||"https://api.example.com/v1"),s=c0i(a),u=t.name?.trim()||"<MODEL_NAME>";t.name?.trim()||r.push("Model name is empty; using placeholder.");let l=await mQ(t.apiKey);r.push(...l.warnings);let c={"Content-Type":"application/json",Accept:"application/json",Authorization:`Bearer ${l.apiKey}`};return t.openAIOrgId?.trim()&&(c["OpenAI-Organization"]=t.openAIOrgId.trim()),n==="openrouterai"&&(c["HTTP-Referer"]="https://obsidiancopilot.com",c["X-Title"]="Obsidian Copilot"),e?{ok:!0,warnings:r,spec:{method:"POST",url:`${s}/embeddings`,headers:c,body:{model:u,input:npe}}}:{ok:!0,warnings:r,spec:{method:"POST",url:`${s}/chat/completions`,headers:c,body:{model:u,messages:[{role:"user",content:P6}],stream:!1,max_tokens:KSt}}}}function m0i(t,e,r,n){let o=[],i=t.azureOpenAIApiInstanceName?.trim()||"[instance]";t.azureOpenAIApiInstanceName?.trim()||o.push("Azure instance name is empty; using placeholder.");let a=t.baseUrl?.trim();if(a){let s=l0i(a);if(s){let u=fz(s.pathname||"");u.includes("/openai/deployments/")&&(u=u.split("/openai/deployments/")[0]);let l=`${s.origin}${u}`;return{warnings:o,url:`${l}/openai/deployments/${encodeURIComponent(e)}/${r}?api-version=${encodeURIComponent(n)}`}}}return{warnings:o,url:`https://${i}.openai.azure.com/openai/deployments/${encodeURIComponent(e)}/${r}?api-version=${encodeURIComponent(n)}`}}async function h0i(t,e){let r=[],n=await mQ(t.apiKey);r.push(...n.warnings);let o=e?"embeddings":"chat/completions";if(t.baseUrl?.trim()){let{normalizeAzureUrl:l}=await Promise.resolve().then(()=>(LW(),imt)),{baseUrl:c,apiVersion:d}=l(t.baseUrl.trim()),f=d||t.azureOpenAIApiVersion?.trim()||"2024-05-01-preview",p=`${c}/${o}?api-version=${encodeURIComponent(f)}`,m=t.name?.trim(),h=e?{input:npe,...m?{model:m}:{}}:{messages:[{role:"user",content:P6}],stream:!1,max_tokens:KSt,...m?{model:m}:{}};return{ok:!0,warnings:r,spec:{method:"POST",url:p,headers:{"Content-Type":"application/json",Accept:"application/json","api-key":n.apiKey},body:h}}}let i=e?t.azureOpenAIApiEmbeddingDeploymentName?.trim()||"[deployment]":t.azureOpenAIApiDeploymentName?.trim()||"[deployment]";(!i||i==="[deployment]")&&r.push("Azure deployment name is empty; using placeholder.");let a=t.azureOpenAIApiVersion?.trim()||"[api-version]";t.azureOpenAIApiVersion?.trim()||r.push("Azure api-version is empty; using placeholder.");let s=m0i(t,i,o,a);r.push(...s.warnings);let u=e?{input:npe}:{messages:[{role:"user",content:P6}],stream:!1,max_tokens:KSt};return{ok:!0,warnings:r,spec:{method:"POST",url:s.url,headers:{"Content-Type":"application/json",Accept:"application/json","api-key":n.apiKey},body:u}}}async function g0i(t){let e=[],r=t.baseUrl?.trim()??"",n=Qqe("anthropic"),o=fz(r||n||"https://api.anthropic.com"),i=["/v1/messages","/v1"];for(let l of i)if(o.endsWith(l)){o=o.slice(0,-l.length);break}let a=`${o}/v1/messages`,s=await mQ(t.apiKey);e.push(...s.warnings);let u=t.name?.trim()||"<MODEL_NAME>";return t.name?.trim()||e.push("Model name is empty; using placeholder."),{ok:!0,warnings:e,spec:{method:"POST",url:a,headers:{"Content-Type":"application/json",Accept:"application/json","x-api-key":s.apiKey,"anthropic-version":n0i},body:{model:u,max_tokens:i0i,messages:[{role:"user",content:P6}]}}}}async function y0i(t,e){let r=[],n=t.baseUrl?.trim()??"",o=Qqe("google"),a=d0i(n||o||"https://generativelanguage.googleapis.com"),s=t.name?.trim()||"<MODEL_NAME>";t.name?.trim()||r.push("Model name is empty; using placeholder.");let u=s.includes("/")?s:`models/${s}`,l=await mQ(t.apiKey);r.push(...l.warnings);let c={"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":l.apiKey};return e?{ok:!0,warnings:r,spec:{method:"POST",url:`${a}/${u}:embedContent`,headers:c,body:{content:{parts:[{text:npe}]}}}}:{ok:!0,warnings:r,spec:{method:"POST",url:`${a}/${u}:generateContent`,headers:c,body:{contents:[{role:"user",parts:[{text:P6}]}],generationConfig:{maxOutputTokens:s0i}}}}}function b0i(t){return/(^|\.)anthropic\./.test(t)}async function _0i(t){let e=[],r=t.name?.trim()||"<MODEL_ID>";t.name?.trim()||e.push("Model name is empty; using placeholder.");let n=t.bedrockRegion?.trim()||"us-east-1";t.bedrockRegion?.trim()||e.push("Bedrock region is empty; defaulting to us-east-1.");let o=t.baseUrl?.trim(),a=`${fz(o||`https://bedrock-runtime.${n}.amazonaws.com`)}/model/${encodeURIComponent(r)}/invoke`,s={messages:[{role:"user",content:[{type:"text",text:P6}]}],max_tokens:a0i};b0i(r)?s.anthropic_version=o0i:e.push("Model ID does not look like Anthropic; request body may need adjustment.");let u=await mQ(t.apiKey);e.push(...u.warnings);let l={method:"POST",url:a,headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Bearer ${u.apiKey}`},body:s},c={method:"POST",url:a,curlArgs:[`--aws-sigv4 'aws:amz:${rpe(n)}:bedrock'`,"--user '<AWS_ACCESS_KEY_ID>:<AWS_SECRET_ACCESS_KEY>'"],headers:{"Content-Type":"application/json",Accept:"application/json"},body:s};return{ok:!0,command:["# Amazon Bedrock InvokeModel","# Option A: Bearer token auth (matches Obsidian Copilot)",E6(l),"","# Option B: IAM auth (AWS SigV4)",E6(c)].join(`
`),warnings:e}}async function v0i(t,e){let r=[],n=t.baseUrl?.trim()??"",o=Qqe("ollama"),i=f0i(fz(n||o||"http://localhost:11434")),a=t.name?.trim()||"<MODEL_NAME>";t.name?.trim()||r.push("Model name is empty; using placeholder.");let s={"Content-Type":"application/json",Accept:"application/json"};if(t.apiKey?.trim()){let l=await mQ(t.apiKey),c=l.warnings.filter(d=>!d.includes("API key is empty"));r.push(...c),s.Authorization=`Bearer ${l.apiKey}`}return e?{ok:!0,warnings:r,spec:{method:"POST",url:`${i}/api/embed`,headers:s,body:{model:a,input:npe,truncate:!0}}}:{ok:!0,warnings:r,spec:{method:"POST",url:`${i}/api/chat`,headers:s,body:{model:a,messages:[{role:"user",content:P6}],stream:!1}}}}async function Vin(t){let e=[],r=t.provider?.trim();if(!r)return{ok:!1,error:"Provider is required to build a curl command.",warnings:e};let n=!!t.isEmbeddingModel;if(r==="azure openai"){let o=await h0i(t,n);return o.ok?{ok:!0,command:E6(o.spec),warnings:o.warnings}:o}if(r==="anthropic"){if(n)return{ok:!1,error:"Anthropic does not support embeddings.",warnings:e};let o=await g0i(t);return o.ok?{ok:!0,command:E6(o.spec),warnings:o.warnings}:o}if(r==="amazon-bedrock")return n?{ok:!1,error:"Bedrock embeddings are not supported by this generator.",warnings:e}:await _0i(t);if(r==="google"||r==="google"){let o=await y0i(t,n);return o.ok?{ok:!0,command:E6(o.spec),warnings:o.warnings}:o}if(r==="ollama"||r==="ollama"){let o=await v0i(t,n);return o.ok?{ok:!0,command:E6(o.spec),warnings:o.warnings}:o}if(u0i.has(r)){let o=await p0i(t,n);return o.ok?{ok:!0,command:E6(o.spec),warnings:o.warnings}:o}return{ok:!1,error:`Provider "${r}" is not supported for curl generation.`,warnings:e}}Mr();g4();var pz=require("obsidian"),Ye=$(K()),GSt=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=sz(),a=ee(),s=o?"openai":"openrouterai",u=L=>L==="azure openai"&&!E.baseUrl,[l,c]=(0,Ye.useState)(null),[d,f]=(0,Ye.useState)(u(s)),[p,m]=(0,Ye.useState)(!1),[h,y]=(0,Ye.useState)("idle"),[g,b]=(0,Ye.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1,bedrockRegion:!1}),_=(L,J)=>{b(ne=>({...ne,[L]:J}))},w=()=>{b({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1,bedrockRegion:!1})},T=()=>{let L=!0,J={...g};return J.name=!E.name,E.name||(L=!1),E.provider==="azure openai"&&(o||!E.baseUrl?.trim())&&(J.instanceName=!E.azureOpenAIApiInstanceName,J.apiVersion=!E.azureOpenAIApiVersion,o?(J.embeddingDeploymentName=!E.azureOpenAIApiEmbeddingDeploymentName,E.azureOpenAIApiEmbeddingDeploymentName||(L=!1)):(J.deploymentName=!E.azureOpenAIApiDeploymentName,E.azureOpenAIApiDeploymentName||(L=!1)),(!E.azureOpenAIApiInstanceName||!E.azureOpenAIApiVersion)&&(L=!1)),E.provider,"amazon-bedrock",J.bedrockRegion=!1,b(J),L},O=(L=s)=>{let J={name:"",provider:L,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:nw(L),isEmbeddingModel:o,capabilities:[]};if(!o){let ne={...J,stream:!0};return L==="amazon-bedrock"?{...ne,bedrockRegion:a.amazonBedrockRegion}:ne}return J},[E,P]=(0,Ye.useState)(O()),R=L=>{P(J=>({...J,...L})),y("idle")},I=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(),bedrockRegion:L.bedrockRegion?.trim()}),[A,B]=(0,Ye.useState)(o1(s)),k=()=>!!(E.name&&E.provider),q=()=>p||!k(),Z=()=>{if(!T()){new pz.Notice("Please fill in all required fields");return}let L=I(E);r(L),e(!1),P(O()),w(),y("idle"),f(!1)},V=L=>{B(o1(L)),y("idle"),P({...E,provider:L,apiKey:nw(L),...L==="openai"?{openAIOrgId:a.openAIOrgId}:{},...L==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{},...L==="amazon-bedrock"?{bedrockRegion:a.amazonBedrockRegion}:{bedrockRegion:void 0}}),f(u(L))},Y=L=>{L||(P(O()),w(),y("idle"),f(!1)),e(L)},X=async()=>{if(!T()){new pz.Notice("Please fill in all required fields");return}m(!0),y("idle");try{let L=I(E);await n(L),y("success"),new pz.Notice("Model verification successful!")}catch(L){ie(L);let J=Wr(L);y("failed"),new pz.Notice("Model verification failed: "+J)}finally{m(!1)}},W=async()=>{try{let L=I(E),J=await Vin(L);if(!J.ok){new pz.Notice(J.error);return}await navigator.clipboard.writeText(J.command);let D=!J.warnings.some(H=>H.includes("placeholder"))?" Warning: contains real API key!":"",N=J.warnings.filter(H=>!H.includes("placeholder")),z=N.length>0?` (${N[0]})`:"";new pz.Notice(`Copied curl command.${D}${z}`)}catch(L){ie(L),new pz.Notice("Failed to copy curl command: "+Wr(L))}},re=()=>{let J=(()=>{switch(E.provider){case"openai":return Ye.default.createElement(ko,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},Ye.default.createElement(ni,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:E.openAIOrgId||"",onChange:ne=>R({openAIOrgId:ne.target.value})}));case"azure openai":return E.baseUrl?.trim()&&!o?null:Ye.default.createElement(Ye.default.Fragment,null,Ye.default.createElement(ko,{label:"Instance Name",required:!0,error:g.instanceName,errorMessage:"Instance name is required"},Ye.default.createElement(ni,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:E.azureOpenAIApiInstanceName||"",onChange:ne=>{R({azureOpenAIApiInstanceName:ne.target.value}),_("instanceName",!1)}})),o?Ye.default.createElement(ko,{label:"Embedding Deployment Name",required:!0,error:g.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},Ye.default.createElement(ni,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:E.azureOpenAIApiEmbeddingDeploymentName||"",onChange:ne=>{R({azureOpenAIApiEmbeddingDeploymentName:ne.target.value}),_("embeddingDeploymentName",!1)}})):Ye.default.createElement(ko,{label:"Deployment Name",required:!0,error:g.deploymentName,errorMessage:"Deployment name is required",description:"This is your actual model, no need to pass a model name separately."},Ye.default.createElement(ni,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:E.azureOpenAIApiDeploymentName||"",onChange:ne=>{R({azureOpenAIApiDeploymentName:ne.target.value}),_("deploymentName",!1)}})),Ye.default.createElement(ko,{label:"API Version",required:!0,error:g.apiVersion,errorMessage:"API version is required"},Ye.default.createElement(ni,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:E.azureOpenAIApiVersion||"",onChange:ne=>{R({azureOpenAIApiVersion:ne.target.value}),_("apiVersion",!1)}})));case"amazon-bedrock":return Ye.default.createElement(ko,{label:"Region (optional)",description:"Defaults to us-east-1 when left blank. With inference profiles (global., us., eu., apac.), region is auto-managed."},Ye.default.createElement("div",{className:"tw-flex tw-gap-2"},Ye.default.createElement(ni,{className:"tw-flex-1",type:"text",placeholder:"Enter AWS region (e.g. us-east-1)",value:E.bedrockRegion||"",onChange:ne=>{R({bedrockRegion:ne.target.value}),_("bedrockRegion",!1)}}),Ye.default.createElement(L3,{onValueChange:ne=>{R({bedrockRegion:ne}),_("bedrockRegion",!1)}},Ye.default.createElement(OU,{className:"tw-w-[140px]"},Ye.default.createElement(F3,{placeholder:"Presets"})),Ye.default.createElement(EU,{container:l},["us-east-1","us-west-2","eu-west-1","ap-northeast-1","ap-southeast-1"].map(ne=>Ye.default.createElement(PU,{key:ne,value:ne},ne))))));default:return null}})();return J?Ye.default.createElement(uy,{open:d,onOpenChange:f,className:"tw-rounded-lg tw-border tw-bg-secondary/30 tw-border-border/60"},Ye.default.createElement(AT,{asChild:!0},Ye.default.createElement("button",{type:"button",className:"tw-flex tw-w-full tw-cursor-pointer tw-items-center tw-justify-between tw-rounded-lg tw-p-3 tw-text-left hover:tw-bg-modifier-hover"},Ye.default.createElement("span",{className:"tw-text-sm tw-font-medium"},"Additional ",wg(E.provider)," Settings"),Ye.default.createElement(Ji,{className:`tw-size-4 tw-text-muted tw-transition-transform tw-duration-200 ${d?"tw-rotate-180":""}`}))),Ye.default.createElement(ly,{className:"tw-space-y-4 tw-px-3 tw-pb-3"},J)):null},ue=()=>{if(E.provider!=="azure openai")return A.host;let L=E.azureOpenAIApiInstanceName||"[instance]",J=o?E.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":E.azureOpenAIApiDeploymentName||"[deployment]",ne=E.azureOpenAIApiVersion||"[api-version]";return`https://${L}.openai.azure.com/openai/deployments/${J}/${o?"embeddings":"chat/completions"}?api-version=${ne}`},le=Object.entries(rF).map(([L,J])=>({id:L,label:L.charAt(0).toUpperCase()+L.slice(1),description:J}));return Ye.default.createElement(Kqe,{open:t,onOpenChange:Y},Ye.default.createElement(Zfe,{className:"tw-max-h-[80vh] tw-overflow-y-auto sm:tw-max-w-[425px]",container:i,ref:L=>c(L)},Ye.default.createElement(Yfe,null,Ye.default.createElement(Qfe,null,"Add Custom ",o?"Embedding":"Chat"," Model"),Ye.default.createElement(epe,null,"Add a new model to your collection.")),Ye.default.createElement("div",{className:"tw-space-y-3"},Ye.default.createElement(ko,{label:"Model Name",required:!0,error:g.name,errorMessage:"Model name is required",description:E.provider==="amazon-bedrock"&&!o?"For Bedrock, use cross-region inference profile IDs (global., us., eu., or apac. prefix) for better reliability. Regional IDs without prefixes may fail.":void 0},Ye.default.createElement(ni,{type:"text",placeholder:`Enter model name (e.g. ${E.provider==="amazon-bedrock"&&!o?"global.anthropic.claude-sonnet-4-6-v1:0":o?"text-embedding-3-small":"gpt-4"})`,value:E.name,onChange:L=>{R({name:L.target.value}),_("name",!1)}})),Ye.default.createElement(ko,{label:Ye.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ye.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Ye.default.createElement(to,{content:Ye.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Ye.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Ye.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Ye.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Ye.default.createElement("li",null,"Direct-Paid:Ds-r1"),Ye.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Ye.default.createElement("li",null,"Perplexity-Paid:lg"))),contentClassName:"tw-max-w-96"}))},Ye.default.createElement(ni,{type:"text",placeholder:"Custom display name (optional)",value:E.displayName||"",onChange:L=>{P({...E,displayName:L.target.value})}})),Ye.default.createElement(ko,{label:"Provider"},Ye.default.createElement(L3,{value:E.provider,onValueChange:V},Ye.default.createElement(OU,null,Ye.default.createElement(F3,{placeholder:"Select provider"})),Ye.default.createElement(EU,{container:l},Object.values(o?ate(kC,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):ate(Mb,["COPILOT_PLUS"])).map(L=>Ye.default.createElement(PU,{key:L,value:L},wg(L)))))),Ye.default.createElement(ko,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Ye.default.createElement(ni,{type:"text",placeholder:ue()||"https://api.example.com/v1",value:E.baseUrl||"",onChange:L=>R({baseUrl:L.target.value})})),Ye.default.createElement(ko,{label:"API Key"},Ye.default.createElement(xN,{placeholder:`Enter ${A.label} API Key`,value:E.apiKey||"",onChange:L=>R({apiKey:L})}),A.keyManagementURL&&Ye.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Ye.default.createElement("a",{href:A.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",A.label," API Key"))),!o&&Ye.default.createElement(ko,{label:Ye.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ye.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Ye.default.createElement(to,{content:Ye.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality"),contentClassName:"tw-max-w-96"}))},Ye.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-items-center tw-gap-x-6 tw-gap-y-2"},le.map(({id:L,label:J,description:ne})=>Ye.default.createElement("div",{key:L,className:"tw-flex tw-items-center tw-gap-2"},Ye.default.createElement(Uu,{id:L,checked:E.capabilities?.includes(L),onCheckedChange:D=>{let N=E.capabilities||[];P({...E,capabilities:D?[...N,L]:N.filter(z=>z!==L)})}}),Ye.default.createElement(to,{content:ne},Ye.default.createElement(uc,{htmlFor:L,className:"tw-text-sm"},J)))))),re()),Ye.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},Ye.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-items-center tw-gap-3 sm:tw-flex-1"},Ye.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ye.default.createElement(Uu,{id:"enable-cors",checked:E.enableCors||!1,onCheckedChange:L=>P({...E,enableCors:L})}),Ye.default.createElement(uc,{htmlFor:"enable-cors",className:"tw-cursor-pointer"},Ye.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ye.default.createElement("span",{className:"tw-text-sm"},"CORS"),Ye.default.createElement(to,{content:Ye.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only check this option when prompted that CORS is needed"),contentClassName:"tw-max-w-96"})))),(E.provider==="3rd party (openai-format)"||E.provider==="lm-studio")&&Ye.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ye.default.createElement(Uu,{id:"stream-usage",checked:E.streamUsage||!1,onCheckedChange:L=>P({...E,streamUsage:L})}),Ye.default.createElement(uc,{htmlFor:"stream-usage",className:"tw-cursor-pointer"},Ye.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ye.default.createElement("span",{className:"tw-text-sm"},"Stream Usage"),Ye.default.createElement(to,{content:Ye.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Enable if your provider supports stream_options for token usage tracking. Disable for providers that do not support it (e.g., Databricks, MLFlow)."),contentClassName:"tw-max-w-96"})))),Ye.default.createElement(s_,null,Ye.default.createElement(vn,null,Ye.default.createElement(wn,{asChild:!0},Ye.default.createElement(me,{variant:"ghost",size:"sm",onClick:W,disabled:!E.name,className:"tw-text-muted hover:tw-text-normal"},"CURL")),Ye.default.createElement(pn,null,Ye.default.createElement("p",null,"Copy curl command for testing"))))),Ye.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-justify-end tw-gap-2"},h==="success"&&Ye.default.createElement(PF,{className:"tw-size-5 tw-text-success"}),h==="failed"&&Ye.default.createElement(wO,{className:"tw-size-5 tw-text-error"}),Ye.default.createElement(s_,null,Ye.default.createElement(vn,null,Ye.default.createElement(wn,{asChild:!0},Ye.default.createElement(me,{variant:"secondary",size:"sm",onClick:X,disabled:q(),className:"tw-min-w-[72px]"},p?Ye.default.createElement(Ye.default.Fragment,null,Ye.default.createElement(Us,{className:"tw-mr-1.5 tw-size-3.5 tw-animate-spin"}),"Test"):"Test")),Ye.default.createElement(pn,null,Ye.default.createElement("p",null,"Optional: test API call")))),Ye.default.createElement(me,{variant:"default",size:"sm",onClick:Z,disabled:q()},"Add Model")))))};xn();gr();zr();Qe();Dt();Mr();var Vt=$(K());g4();var w0i={reasoning:{icon:ex,color:"tw-text-model-capabilities-blue",tooltip:rF.reasoning},vision:{icon:S1,color:"tw-text-model-capabilities-green",tooltip:rF.vision},websearch:{icon:_l,color:"tw-text-model-capabilities-blue",tooltip:rF.websearch}},S0i=["reasoning","vision","websearch"],C0i=({title:t,onRefresh:e,onAdd:r})=>Vt.default.createElement("div",{className:"tw-mb-3 tw-flex tw-flex-col tw-gap-2 md:tw-flex-row md:tw-items-center md:tw-justify-between"},Vt.default.createElement("h3",{className:"tw-text-xl tw-font-bold"},t),Vt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-end"},e&&Vt.default.createElement(me,{onClick:e,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Vt.default.createElement(jF,{className:"tw-size-2 md:tw-size-4"}),"Refresh Built-ins"),Vt.default.createElement(me,{onClick:r,variant:"default",className:"tw-flex tw-items-center tw-gap-2"},Vt.default.createElement(Fb,{className:"tw-size-2 md:tw-size-4"}),"Add Model"))),x0i=t=>Vt.default.createElement("div",{className:"tw-mx-auto tw-grid tw-w-16 tw-grid-cols-3 tw-gap-1"},S0i.map(e=>{let r=w0i[e];if(!r)return Vt.default.createElement("div",{key:e,className:"tw-w-4"});let n=r.icon;return t.capabilities?.includes(e)?Vt.default.createElement(to,{key:e,content:r.tooltip,side:"bottom"},Vt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},Vt.default.createElement(n,{className:Se("tw-size-4",r.color)}))):Vt.default.createElement("div",{key:e,className:"tw-flex tw-items-center tw-justify-center"},Vt.default.createElement("div",{className:"tw-size-4"}))})),T0i=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,id:i,containerRef:a})=>{let s=[];e&&s.push({icon:Vt.default.createElement(NF,{className:"tw-size-4"}),label:"Edit",onClick:e}),r&&!t.core&&s.push({icon:Vt.default.createElement(U_,{className:"tw-size-4"}),label:"Copy",onClick:r}),t.core||s.push({icon:Vt.default.createElement(Iy,{className:"tw-size-4"}),label:"Delete",onClick:()=>n(no(t)),variant:"destructive"});let u=Vt.default.createElement("div",{className:"tw-flex tw-justify-around"},!t.isEmbeddingModel&&Vt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Vt.default.createElement("span",{className:"tw-text-sm"},"Enabled"),Vt.default.createElement(Uu,{checked:t.enabled,onCheckedChange:l=>o({...t,enabled:l})})),Vt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Vt.default.createElement("span",{className:"tw-text-sm"},"CORS"),Vt.default.createElement(Uu,{checked:t.enableCors,onCheckedChange:l=>o({...t,enableCors:l})})));return Vt.default.createElement(qqe,{id:i,item:t,title:t.displayName||t.name,subtitle:wg(t.provider,t),badge:t.capabilities&&t.capabilities.length>0?Vt.default.createElement(tgt,{capabilities:t.capabilities,iconSize:14}):void 0,isDraggable:!t.core,isExpandable:!0,expandedContent:u,primaryAction:e?{icon:Vt.default.createElement(DF,{className:"tw-size-4"}),onClick:e,tooltip:"Edit Model"}:void 0,dropdownActions:s,containerRef:a})},O0i=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,isEmbeddingModel:i,containerRef:a})=>{let{attributes:s,listeners:u,setNodeRef:l,transform:c,transition:d,isDragging:f}=cQ({id:no(t),disabled:t.core}),p={transform:gC.Transform.toString(c),transition:d},m=e||!t.core||r&&!t.core;return Vt.default.createElement(dz,{ref:l,style:p,className:Se("tw-transition-colors tw-duration-200 hover:tw-bg-interactive-accent/10",f&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50 tw-bg-primary/90")},Vt.default.createElement(hb,{className:"tw-w-6 tw-px-2"},!t.core&&Vt.default.createElement(me,{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",...s,...u},Vt.default.createElement(QC,{className:"tw-size-4 tw-transition-colors"}))),Vt.default.createElement(hb,{className:"tw-pl-0"},t.displayName||t.name),Vt.default.createElement(hb,null,wg(t.provider,t)),Vt.default.createElement(hb,null,x0i(t)),!i&&Vt.default.createElement(hb,{className:"tw-text-center"},Vt.default.createElement(Uu,{id:`${no(t)}-enabled`,checked:t.enabled,disabled:t.enabled&&lNt(t),onCheckedChange:h=>o({...t,enabled:h}),className:"tw-mx-auto"})),Vt.default.createElement(hb,{className:"tw-text-center"},Vt.default.createElement(Uu,{id:`${no(t)}-enableCors`,checked:t.enableCors,onCheckedChange:h=>o({...t,enableCors:h}),className:"tw-mx-auto"})),Vt.default.createElement(hb,{className:"tw-text-center"},Vt.default.createElement("div",{className:"tw-flex tw-justify-center tw-gap-2"},e&&Vt.default.createElement(me,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"tw-shadow-sm tw-transition-shadow hover:tw-shadow-md"},Vt.default.createElement(DF,{className:"tw-size-4"})),m&&Vt.default.createElement(sN,null,Vt.default.createElement(uN,{asChild:!0},Vt.default.createElement(me,{variant:"ghost",size:"icon"},Vt.default.createElement(SO,{className:"tw-size-4"}))),Vt.default.createElement(Ev,{align:"end",container:a.current},e&&Vt.default.createElement(Ai,{onClick:()=>e(t)},Vt.default.createElement(NF,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&Vt.default.createElement(Ai,{onClick:()=>r(t)},Vt.default.createElement(U_,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&Vt.default.createElement(Ai,{onClick:()=>n(no(t)),className:"tw-text-error"},Vt.default.createElement(Iy,{className:"tw-mr-2 tw-size-4"}),"Delete"))))))},XSt=({models:t,onEdit:e,onCopy:r,onDelete:n,onAdd:o,onUpdateModel:i,onReorderModels:a,onRefresh:s,title:u})=>{let l=!!(t.length>0&&t[0].isEmbeddingModel),c=Aqe(iQ(cz),iQ(lz,{coordinateGetter:kqe})),d=(0,Vt.useRef)(null),f=t.findIndex(y=>!y.core),p=y=>g=>{let{transform:b,active:_,activeNodeRect:w,over:T}=g;if(!_||!w)return b;let O=t.findIndex(A=>no(A)===_.id),E=t.filter(A=>!A.core).length,P=w.height,R=(f-O)*P,I=(f+E-1-O)*P;if(y&&T){let A=t.findIndex(k=>no(k)===T.id);if(t[A].core||A<f)return{...b,x:0,y:0}}return{...b,x:0,y:Math.min(Math.max(R,b.y),I)}},m=y=>{let{active:g,over:b}=y;if(b&&g.id!==b.id){let _=t.findIndex(E=>no(E)===g.id),w=t.findIndex(E=>no(E)===b.id),T=t[w];if(w<f||T.core)return;let O=Fqe(t,_,w);a?.(O)}},h=()=>Vt.default.createElement("div",{className:"tw-relative md:tw-hidden"},Vt.default.createElement(sQ,{sensors:c,collisionDetection:aQ,onDragEnd:m,modifiers:[p(!0)],autoScroll:{enabled:!0,acceleration:10,threshold:{x:0,y:.2}}},Vt.default.createElement(lQ,{items:t.map(y=>no(y)),strategy:uQ},Vt.default.createElement("div",{className:"tw-relative tw-touch-auto tw-space-y-2 tw-overflow-auto tw-pb-2"},t.map(y=>Vt.default.createElement(T0i,{key:no(y),id:no(y),containerRef:d,model:y,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i}))))));return Vt.default.createElement("div",{ref:d,className:"tw-mb-4"},Vt.default.createElement(C0i,{title:u,onRefresh:s,onAdd:o}),Vt.default.createElement("div",{className:"tw-hidden md:tw-block"},Vt.default.createElement(sQ,{sensors:c,collisionDetection:aQ,onDragEnd:m,modifiers:[p(!1)]},Vt.default.createElement("div",{className:"tw-relative tw-overflow-hidden"},Vt.default.createElement(Jfe,null,Vt.default.createElement(Kfe,null,Vt.default.createElement(dz,null,Vt.default.createElement(m_,{className:"tw-w-6 tw-px-2"}),Vt.default.createElement(m_,{className:"tw-pl-0"},"Model"),Vt.default.createElement(m_,null,"Provider"),Vt.default.createElement(m_,{className:"tw-text-center"},"Capabilities"),!l&&Vt.default.createElement(m_,{className:"tw-text-center"},"Enable"),Vt.default.createElement(m_,{className:"tw-text-center"},"CORS"),Vt.default.createElement(m_,{className:"tw-w-[100px] tw-text-center"},"Actions"))),Vt.default.createElement(Gfe,{className:"tw-relative"},Vt.default.createElement(lQ,{items:t.map(y=>no(y)),strategy:uQ},t.map(y=>Vt.default.createElement(O0i,{key:no(y),containerRef:d,model:y,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i,isEmbeddingModel:l})))))))),h())};Dt();var eBe=require("obsidian"),Uv=$(K()),Hin=()=>{let t=kr(),[e,r]=(0,Uv.useState)(!1),[n,o]=(0,Uv.useState)(!1),i=(h,y=!1)=>{let g={...ate(h,["isBuiltIn","core","projectEnabled","plusExclusive","believerExclusive","capabilities","displayName","dimensions"]),name:`${h.name} (copy)`},b=y?"activeEmbeddingModels":"activeModels";Re(b,[...t[b],g])},a=(h,y=!1)=>{Re(y?"activeEmbeddingModels":"activeModels",h)},s=h=>{let[y,g]=h.split("|"),b=t.activeModels.filter(w=>!(w.name===y&&w.provider===g)),_=t.defaultModelKey;if(h===t.defaultModelKey){let w=b.find(T=>T.enabled);_=w?`${w.name}|${w.provider}`:""}A_({activeModels:b,defaultModelKey:_})},u=(h,y,g)=>{let b=h?"activeEmbeddingModels":"activeModels",_=t[b].findIndex(w=>w.name===y.name&&w.provider===y.provider);if(_!==-1){let w=[...t[b]];w[_]=g,Re(b,w)}else new eBe.Notice("Could not find model to update"),ie("Could not find model to update:",y)},l=h=>{let y=t.activeModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);Re("activeModels",y)},c=h=>{let[y,g]=h.split("|"),b=t.activeEmbeddingModels.filter(_=>!(_.name===y&&_.provider===g));Re("activeEmbeddingModels",b)},d=h=>{let y=t.activeEmbeddingModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);Re("activeEmbeddingModels",y)},f=()=>{let h=t.activeModels.filter(g=>!g.isBuiltIn),y=[...aO,...h];Re("activeModels",y),new eBe.Notice("Chat models refreshed successfully")},p=()=>{let h=t.activeEmbeddingModels.filter(g=>!g.isBuiltIn),y=[...m4,...h];Re("activeEmbeddingModels",y),new eBe.Notice("Embedding models refreshed successfully")},m=(h,y=!1)=>{new FY(app,h,y,u).open()};return Uv.default.createElement("div",{className:"tw-space-y-4"},Uv.default.createElement("section",null,Uv.default.createElement(XSt,{models:t.activeModels,onEdit:h=>m(h),onCopy:h=>i(h),onDelete:s,onAdd:()=>r(!0),onUpdateModel:l,onReorderModels:h=>a(h),onRefresh:f,title:"Chat Models"}),Uv.default.createElement(GSt,{open:e,onOpenChange:r,onAdd:h=>{let y=[...t.activeModels,h];Re("activeModels",y)},ping:h=>Vg.instance.getCurrentChainManager().chatModelManager.ping(h)}),Uv.default.createElement("div",{className:"tw-space-y-4"},Uv.default.createElement(Rr,{type:"slider",title:"Conversation turns in context",description:"The number of previous conversation turns to include in the context. Default is 15 turns, i.e. 30 messages.",value:t.contextTurns,onChange:h=>Re("contextTurns",h),min:1,max:50,step:1}),Uv.default.createElement(Rr,{type:"slider",title:"Auto-compact threshold",description:"Automatically summarize context when it exceeds this token count. Set to maximum to make it less aggressive.",min:64e3,max:1e6,step:64e3,value:t.autoCompactThreshold,onChange:h=>Re("autoCompactThreshold",h)}))),Uv.default.createElement("section",null,Uv.default.createElement(XSt,{models:t.activeEmbeddingModels,onEdit:h=>m(h,!0),onDelete:c,onCopy:h=>i(h,!0),onAdd:()=>o(!0),onUpdateModel:d,onReorderModels:h=>a(h,!0),onRefresh:p,title:"Embedding Models"}),Uv.default.createElement(GSt,{open:n,onOpenChange:o,onAdd:h=>{let y=[...t.activeEmbeddingModels,h];Re("activeEmbeddingModels",y)},isEmbeddingModel:!0,ping:h=>dd.getInstance().ping(h)})))};var Cn=$(K()),Xin=require("obsidian");var tBe=class extends nu{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")}};gr();Qe();var cn=$(K());Mr();var nBe=require("obsidian");rd();Dt();gr();var rBe=class extends JY{constructor({app:e,onNoteSelect:r,excludeNotePaths:n,titleOnly:o=!1,chainType:i="copilot_plus"}){super(e,i),this.onNoteSelect=r,this.availableNotes=this.getOrderedNotes(n),this.titleOnly=o}getItems(){if(this.titleOnly){let e=new Map;return this.availableNotes.forEach(r=>{e.set(r.basename,r)}),Array.from(e.values())}return this.availableNotes}getItemText(e){let r=e.path===this.activeNote?.path;return this.formatNoteTitle(e.basename,r,e.extension)}onChooseItem(e,r){if(!LJ(e,this.chainType)){new nBe.Notice(zJ.NON_MARKDOWN_FILES_RESTRICTED);return}this.onNoteSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof nBe.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 Win=require("obsidian"),$T=$(K()),Jin=$(Im());xn();function E0i({onConfirm:t,onCancel:e}){let[r,n]=(0,$T.useState)("");return $T.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},$T.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},$T.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"),$T.default.createElement(ni,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),$T.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},$T.default.createElement(me,{variant:"secondary",onClick:e},"Cancel"),$T.default.createElement(me,{variant:"default",onClick:()=>t(r)},"Confirm")))}var oBe=class extends Win.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,Jin.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render($T.default.createElement(E0i,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var Kin=require("obsidian"),wC=$(K()),Gin=$(Im());xn();function P0i({onConfirm:t,onCancel:e}){let[r,n]=(0,wC.useState)(""),[o,i]=(0,wC.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return wC.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},wC.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},wC.default.createElement(ni,{placeholder:"Enter the extension (e.g. txt, excalidraw.md)",value:r,onChange:u=>{n(u.target.value),i(null)},onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),u.stopPropagation(),a(r))}}),o&&wC.default.createElement("p",{className:"tw-text-sm tw-text-error"},o)),wC.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},wC.default.createElement(me,{variant:"secondary",onClick:e},"Cancel"),wC.default.createElement(me,{variant:"default",onClick:()=>a(r)},"Confirm")))}var iBe=class extends Kin.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,Gin.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(wC.default.createElement(P0i,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};xn();zr();Wb();var M0i={folder:{icon:Am,label:"Folder",colorClass:"tw-text-context-manager-yellow"},tag:{icon:T1,label:"Tag",colorClass:"tw-text-context-manager-orange"},note:{icon:ju,label:"Note",colorClass:"tw-text-context-manager-blue"},extension:{icon:AF,label:"Extension",colorClass:"tw-text-context-manager-green"}},ZSt=({value:t,onChange:e,maxCollapsedHeight:r=84})=>{let[n,o]=(0,cn.useState)(!1),[i,a]=(0,cn.useState)(!1),[s,u]=(0,cn.useState)(0),l=(0,cn.useRef)(null),c=(0,cn.useRef)(null),d=(0,cn.useRef)(t);d.current=t;let f=V=>[...new Set(uA(V))],p=(0,cn.useMemo)(()=>f(t),[t]),{tagPatterns:m,extensionPatterns:h,folderPatterns:y,notePatterns:g}=(0,cn.useMemo)(()=>iH(p),[p]);(0,cn.useLayoutEffect)(()=>{let V=l.current;if(!V)return;let Y=()=>{let W=V.scrollHeight;u(W),a(W>r)};if(Y(),typeof ResizeObserver>"u")return;let X=new ResizeObserver(Y);return X.observe(V),()=>X.disconnect()},[r,p]);let b=i&&!n,_=n?s:r,w=V=>{let Y=sq({tagPatterns:V.tagPatterns??m,extensionPatterns:V.extensionPatterns??h,folderPatterns:V.folderPatterns??y,notePatterns:V.notePatterns??g});e(Y)},T=(V,Y)=>{let X=W=>W!==V;switch(Y){case"folder":w({folderPatterns:y.filter(X)});break;case"tag":w({tagPatterns:m.filter(X)});break;case"note":w({notePatterns:g.filter(X)});break;case"extension":w({extensionPatterns:h.filter(X)});break}},O=()=>iH(f(d.current)),E=(V,Y)=>{let X=O();if(!X[V].includes(Y)){let W=sq({...X,[V]:[...X[V],Y]});e(W)}},P=()=>{new WY(app,V=>{E("folderPatterns",V)}).open()},R=()=>{new KY(app,V=>{E("tagPatterns",eae(V))}).open()},I=()=>{new rBe({app,onNoteSelect:V=>{E("notePatterns",WG(V))},excludeNotePaths:[],titleOnly:!0}).open()},A=()=>{new iBe(app,V=>{E("extensionPatterns",fat(V))}).open()},B=()=>{new oBe(app,V=>{let Y=O(),X=f(V),{tagPatterns:W,extensionPatterns:re,folderPatterns:ue,notePatterns:le}=iH(X),L=sq({tagPatterns:[...Y.tagPatterns,...W.filter(J=>!Y.tagPatterns.includes(J))],extensionPatterns:[...Y.extensionPatterns,...re.filter(J=>!Y.extensionPatterns.includes(J))],folderPatterns:[...Y.folderPatterns,...ue.filter(J=>!Y.folderPatterns.includes(J))],notePatterns:[...Y.notePatterns,...le.filter(J=>!Y.notePatterns.includes(J))]});e(L)}).open()},k=(V,Y)=>{let X=M0i[Y],W=X.icon;return cn.default.createElement(Xc,{key:`${Y}:${V}`,variant:"secondary",className:"tw-group tw-flex tw-h-7 tw-items-center tw-gap-1.5 tw-py-1 tw-pl-2 tw-pr-1.5 sm:tw-h-6 sm:tw-py-0.5 sm:tw-pl-1.5"},cn.default.createElement(W,{className:Se("tw-size-4 tw-shrink-0 sm:tw-size-3",X.colorClass)}),cn.default.createElement(fc,{className:"tw-max-w-[100px] sm:tw-max-w-[120px]"},V),cn.default.createElement(me,{variant:"ghost2",size:"fit","aria-label":`Remove ${V}`,className:"tw-h-auto tw-p-0",onClick:()=>T(V,Y)},cn.default.createElement(Ho,{className:"tw-size-4 tw-shrink-0 tw-text-muted hover:tw-text-warning sm:tw-size-3"})))},q=(0,cn.useMemo)(()=>{let V=[];return y.forEach(Y=>V.push({pattern:Y,type:"folder"})),m.forEach(Y=>V.push({pattern:Y,type:"tag"})),g.forEach(Y=>V.push({pattern:Y,type:"note"})),h.forEach(Y=>V.push({pattern:Y,type:"extension"})),V},[y,m,g,h]),Z=p.length>0;return cn.default.createElement("div",{ref:c,className:"tw-flex tw-w-full tw-flex-col tw-gap-2"},cn.default.createElement("div",{className:"tw-relative tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2"},cn.default.createElement("div",{ref:l,className:"tw-overflow-hidden tw-transition-[max-height] tw-duration-300 tw-ease-in-out",style:{maxHeight:i?_:void 0}},!Z&&cn.default.createElement("div",{className:"tw-py-2 tw-text-center tw-text-sm tw-italic tw-text-muted"},"No patterns configured"),Z&&cn.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-1.5"},q.map(V=>k(V.pattern,V.type)))),b&&cn.default.createElement("div",{className:"copilot-fade-mask-bottom tw-pointer-events-none tw-absolute tw-inset-x-0 tw-bottom-0 tw-h-10 tw-rounded-b-md"})),cn.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-justify-between"},i?cn.default.createElement(me,{variant:"ghost2",size:"sm",onClick:()=>o(V=>!V),className:"tw-h-9 tw-gap-1 tw-px-3 tw-text-accent sm:tw-h-auto sm:tw-px-2"},n?cn.default.createElement(cn.default.Fragment,null,"Show less ",cn.default.createElement(Og,{className:"tw-size-4 sm:tw-size-3"})):cn.default.createElement(cn.default.Fragment,null,"Show ",q.length," items ",cn.default.createElement(Ji,{className:"tw-size-4 sm:tw-size-3"}))):cn.default.createElement("div",null),cn.default.createElement(sN,null,cn.default.createElement(uN,{asChild:!0},cn.default.createElement(me,{size:"sm",className:"tw-h-9 tw-gap-1 tw-px-3 sm:tw-h-auto sm:tw-px-2"},cn.default.createElement(Fb,{className:"tw-size-5 sm:tw-size-4"}),"Add...")),cn.default.createElement(Ev,{align:"end",container:c.current},cn.default.createElement(Ai,{onSelect:P,className:"tw-py-2.5 sm:tw-py-1.5"},cn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},cn.default.createElement(Am,{className:"tw-size-5 tw-text-context-manager-yellow sm:tw-size-4"}),"Folder")),cn.default.createElement(Ai,{onSelect:R,className:"tw-py-2.5 sm:tw-py-1.5"},cn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},cn.default.createElement(T1,{className:"tw-size-5 tw-text-context-manager-orange sm:tw-size-4"}),"Tag")),cn.default.createElement(Ai,{onSelect:I,className:"tw-py-2.5 sm:tw-py-1.5"},cn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},cn.default.createElement(ju,{className:"tw-size-5 tw-text-context-manager-blue sm:tw-size-4"}),"Note")),cn.default.createElement(Ai,{onSelect:A,className:"tw-py-2.5 sm:tw-py-1.5"},cn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},cn.default.createElement(AF,{className:"tw-size-5 tw-text-context-manager-green sm:tw-size-4"}),"Extension")),cn.default.createElement(Ai,{onSelect:B,className:"tw-py-2.5 sm:tw-py-1.5"},cn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},cn.default.createElement(mw,{className:"tw-size-5 tw-text-context-manager-purple sm:tw-size-4"}),"Custom"))))))};var Zin=()=>{let t=kr(),e=t.enableMiyo,r=t.activeEmbeddingModels,n=async o=>{if(o!==t.embeddingModelKey){if(t.enableSemanticSearchV3){new tBe(app,async()=>{Re("embeddingModelKey",o),await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0})}).open();return}Re("embeddingModelKey",o),new Xin.Notice("Embedding model saved. Enable Semantic Search to build the index.")}};return Cn.default.createElement("div",{className:"tw-space-y-4"},Cn.default.createElement("section",null,Cn.default.createElement("div",{className:"tw-space-y-4"},Cn.default.createElement(Rr,{type:"switch",title:"Enable Semantic Search",description:"Enable semantic search for meaning-based document retrieval. When disabled, uses fast lexical search only. Use 'Refresh Vault Index' or 'Force Reindex Vault' to build the embedding index.",checked:t.enableSemanticSearchV3,onCheckedChange:o=>{new HY(app,async()=>{Re("enableSemanticSearchV3",o),!o&&t.enableMiyo&&Re("enableMiyo",!1),o&&await(await Promise.resolve().then(()=>(El(),Bc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0})},o).open()}}),Cn.default.createElement(Rr,{type:"switch",title:"Enable Inline Citations (experimental)",description:"When enabled, AI responses will include footnote-style citations within the text and numbered sources at the end. This is an experimental feature and may not work as expected for all models.",checked:t.enableInlineCitations,onCheckedChange:o=>Re("enableInlineCitations",o)}),Cn.default.createElement(Rr,{type:"select",title:"Embedding Model",description:Cn.default.createElement("div",{className:"tw-space-y-2"},Cn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Cn.default.createElement("span",{className:"tw-font-medium tw-leading-none tw-text-accent"},"Powers Semantic Vault Search and Relevant Notes. Enable Semantic Search to use it."),Cn.default.createElement(to,{content:Cn.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Cn.default.createElement("div",{className:"tw-pt-2 tw-text-sm tw-text-muted"},"This model converts text into vector representations, essential for semantic search and Question Answering (QA) functionality. Changing the embedding model will:"),Cn.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Cn.default.createElement("li",null,"Require rebuilding your vault's vector index"),Cn.default.createElement("li",null,"Affect semantic search quality"),Cn.default.createElement("li",null,"Impact Question Answering feature performance")))})),e&&Cn.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Miyo search is enabled, so embeddings are generated by Miyo and this setting is ignored.")),value:t.embeddingModelKey,onChange:n,options:r.map(o=>({label:QX(o),value:no(o)})),placeholder:"Model",disabled:e}),Cn.default.createElement(Rr,{type:"select",title:"Auto-Index Strategy",description:Cn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Cn.default.createElement("span",{className:"tw-leading-none"},"Decide when you want the vault to be indexed."),Cn.default.createElement(to,{content:Cn.default.createElement("div",{className:"tw-space-y-2 tw-py-2"},Cn.default.createElement("div",{className:"tw-space-y-1"},Cn.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Choose when to index your vault:"),Cn.default.createElement("ul",{className:"tw-list-disc tw-space-y-1 tw-pl-2 tw-text-sm"},Cn.default.createElement("li",null,Cn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Cn.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"NEVER:"),Cn.default.createElement("span",null,"Manual indexing via command or refresh only"))),Cn.default.createElement("li",null,Cn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Cn.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON STARTUP:"),Cn.default.createElement("span",null,"Index updates when plugin loads or reloads"))),Cn.default.createElement("li",null,Cn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Cn.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON MODE SWITCH:"),Cn.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),Cn.default.createElement("p",{className:"tw-text-sm tw-text-callout-warning"},"Warning: Cost implications for large vaults with paid models"))})),value:t.indexVaultToVectorStore,onChange:o=>{Re("indexVaultToVectorStore",o)},options:ANt.map(o=>({label:o,value:o})),placeholder:"Strategy"}),Cn.default.createElement(Rr,{type:"slider",title:"Max Sources",description:"Copilot goes through your vault to find relevant notes and passes the top N to the LLM. Default for N is 30. Increase if you want more notes included in the answer generation step.",min:1,max:128,step:1,value:t.maxSourceChunks,onChange:o=>Re("maxSourceChunks",o)}),t.enableSemanticSearchV3&&Cn.default.createElement(Cn.default.Fragment,null,Cn.default.createElement(Rr,{type:"slider",title:"Requests per Minute",description:"Default is 60. Decrease if you are rate limited by your embedding provider.",min:10,max:60,step:10,value:Math.min(t.embeddingRequestsPerMin,60),onChange:o=>Re("embeddingRequestsPerMin",o)}),Cn.default.createElement(Rr,{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:o=>Re("embeddingBatchSize",o)}),Cn.default.createElement(Rr,{type:"select",title:"Number of Partitions",description:"Number of partitions for Copilot index. Default is 1. Increase if you have issues indexing large vaults. Warning: Changes require clearing and rebuilding the index!",value:String(t.numPartitions||1),onChange:o=>Re("numPartitions",Number(o)),options:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"4",value:"4"},{label:"8",value:"8"},{label:"16",value:"16"},{label:"32",value:"32"},{label:"40",value:"40"}],placeholder:"Select partitions"})),Cn.default.createElement(Rr,{type:"slider",title:"Lexical Search RAM Limit",description:"Maximum RAM usage for full-text search index. Lower values use less memory but may limit search performance on large vaults. Default is 100 MB.",min:20,max:1e3,step:20,value:t.lexicalSearchRamLimit||100,onChange:o=>Re("lexicalSearchRamLimit",o),suffix:" MB"}),Cn.default.createElement(Rr,{type:"switch",title:"Enable Folder and Graph Boosts",description:"Enable folder and graph-based relevance boosts for lexical search results. When disabled, provides pure keyword-based relevance scoring without folder or connection-based adjustments.",checked:t.enableLexicalBoosts,onCheckedChange:o=>Re("enableLexicalBoosts",o)}),Cn.default.createElement(Rr,{type:"custom",title:"Exclusions",description:"Exclude folders, tags, note titles or file extensions from being indexed. Previously indexed files will remain until a force re-index is performed."},Cn.default.createElement(ZSt,{value:t.qaExclusions,onChange:o=>Re("qaExclusions",o)})),Cn.default.createElement(Rr,{type:"custom",title:"Inclusions",description:"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."},Cn.default.createElement(ZSt,{value:t.qaInclusions,onChange:o=>Re("qaInclusions",o)})),Cn.default.createElement(Rr,{type:"switch",title:"Enable Obsidian Sync for Copilot index",description:"If enabled, store the semantic index in .obsidian so it syncs with Obsidian Sync. If disabled, store it under .copilot/ at the vault root.",checked:t.enableIndexSync,onCheckedChange:o=>Re("enableIndexSync",o)}),Cn.default.createElement(Rr,{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:o=>Re("disableIndexOnMobile",o)}))))};var Qin=["basic","model","QA","command","plus","advanced"],R0i={basic:zi.default.createElement(wre,{className:"tw-size-5"}),model:zi.default.createElement(Tre,{className:"tw-size-5"}),QA:zi.default.createElement(YC,{className:"tw-size-5"}),command:zi.default.createElement(Cre,{className:"tw-size-5"}),plus:zi.default.createElement(Ry,{className:"tw-size-5"}),advanced:zi.default.createElement(mw,{className:"tw-size-5"})},I0i={basic:()=>zi.default.createElement(qin,null),model:()=>zi.default.createElement(Hin,null),QA:()=>zi.default.createElement(Zin,null),command:()=>zi.default.createElement(Ein,null),plus:()=>zi.default.createElement(zin,null),advanced:()=>zi.default.createElement(Pin,null)},Yin=Qin.map(t=>({id:t,icon:R0i[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),A0i=()=>{let{selectedTab:t,setSelectedTab:e}=sz();return zi.default.createElement("div",{className:"tw-flex tw-flex-col"},zi.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-rounded-lg"},Yin.map((r,n)=>zi.default.createElement(ron,{key:r.id,tab:r,isSelected:t===r.id,onClick:()=>e(r.id),isFirst:n===0,isLast:n===Yin.length-1}))),zi.default.createElement("div",{className:"tw-w-full tw-border tw-border-solid"}),zi.default.createElement("div",null,Qin.map(r=>{let n=I0i[r];return zi.default.createElement(non,{key:r,id:r,isSelected:t===r},zi.default.createElement(n,null))})))},N0i=({plugin:t})=>{let[e,r]=zi.default.useState(0),{latestVersion:n,hasUpdate:o}=Yke(t.manifest.version),i=async()=>{new Cqe(app,async()=>{jWe(),r(s=>s+1)}).open()};return zi.default.createElement(ion,null,zi.default.createElement("div",null,zi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},zi.default.createElement("h1",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},zi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},zi.default.createElement("span",null,"Copilot Settings"),zi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},zi.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"v",t.manifest.version),n&&zi.default.createElement(zi.default.Fragment,null,o?zi.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,")"):zi.default.createElement("span",{className:"tw-text-xs tw-text-normal"}," (up to date)")))),zi.default.createElement("div",{className:"tw-self-end sm:tw-self-auto"},zi.default.createElement(me,{variant:"secondary",size:"sm",onClick:i},"Reset Settings")))),zi.default.createElement(A0i,{key:e})))},ean=N0i;var YSt=$(K()),tan=(0,YSt.createContext)(null);var aBe=class extends ope.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}async reloadPlugin(){try{let e=this.app.workspace.getLeavesOfType(Du)[0]?.view;if(e&&ee().enableRecentConversations)try{let o=this.plugin.projectManager.getCurrentChainManager().chatModelManager.getChatModel();this.plugin.userMemoryManager.addRecentConversation(this.plugin.chatUIState.getMessages(),o)}catch(n){F("Failed to analyze chat messages for memory:",n)}e&&ee().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 ope.Notice("Plugin reloaded successfully.")}catch(e){new ope.Notice("Failed to reload the plugin. Please reload manually."),ie("Error reloading plugin:",e)}}display(){let{containerEl:e}=this;e.empty(),e.style.userSelect="text";let r=e.createDiv("div");(0,ran.createRoot)(r).render(QSt.default.createElement(tan.Provider,{value:e},QSt.default.createElement(ean,{plugin:this.plugin})))}};Qe();Xe();var sBe=class{constructor(e){this.chatManager=e;this.listeners=new Set;this.chatManager.setOnMessageCreatedCallback(()=>{this.notifyListeners()})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notifyListeners(){this.listeners.forEach(e=>{try{e()}catch(r){F("[ChatUIState] Error in listener:",r)}})}async sendMessage(e,r,n,o=!1,i=!1,a,s){let u=await this.chatManager.sendMessage(e,r,n,o,i,a,s);return this.notifyListeners(),u}async editMessage(e,r,n,o=!1){let i=await this.chatManager.editMessage(e,r,n,o);return i&&this.notifyListeners(),i}async regenerateMessage(e,r,n){let o=await this.chatManager.regenerateMessage(e,r,i=>{n(i),this.notifyListeners()},()=>{this.notifyListeners()});return o&&this.notifyListeners(),o}async deleteMessage(e){let r=await this.chatManager.deleteMessage(e);return r&&this.notifyListeners(),r}clearMessages(){this.chatManager.clearMessages(),this.notifyListeners()}async truncateAfterMessageId(e){await this.chatManager.truncateAfterMessageId(e),this.notifyListeners()}getMessages(){return this.chatManager.getDisplayMessages()}getMessage(e){return this.chatManager.getMessage(e)}getLLMMessage(e){return this.chatManager.getLLMMessage(e)}getLLMMessages(){return this.chatManager.getLLMMessages()}get chatHistory(){return this.getMessages()}addMessage(e){this.chatManager.addMessage(e),this.notifyListeners()}clearChatHistory(){this.clearMessages()}replaceMessages(e){this.chatManager.loadMessages(e),this.notifyListeners()}getDebugInfo(){return this.chatManager.getDebugInfo()}async loadMessages(e){await this.chatManager.loadMessages(e),this.notifyListeners()}async handleProjectSwitch(){await this.chatManager.handleProjectSwitch(),this.notifyListeners()}async saveChat(e){await this.chatManager.saveChat(e)}async loadChatHistory(e){await this.chatManager.loadChatHistory(e),this.notifyListeners()}};var wan=require("obsidian");var _an=require("@codemirror/state"),van=require("@codemirror/view");var gan=$(K()),yan=$(Im());var ipe=new WeakMap;function D0i(t){return t.startsWith("--")?t:t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}var nan=new Set(["z-index","zIndex","opacity","flex","flex-grow","flexGrow","flex-shrink","flexShrink","font-weight","fontWeight","line-height","lineHeight","order","orphans","widows","tab-size","tabSize","column-count","columnCount"]);function j0i(t){let e=new Map;for(let[r,n]of Object.entries(t)){if(n==null)continue;let o=D0i(r),i;typeof n=="number"&&!r.startsWith("--")?i=nan.has(r)||nan.has(o)?String(n):`${n}px`:i=String(n),e.set(o,i)}return e}function oan(t,e){if(!e)return;let r=`${e}-`;Array.from(t.classList).filter(o=>o.startsWith(r)).forEach(o=>{t.classList.remove(o)})}function uBe(t,e,r){if(!t)return;let n=j0i(r),o=ipe.get(t);o&&o.prefix&&o.prefix!==e&&oan(t,o.prefix);let i=o?.properties??new Set,a=new Set;if(i.forEach(s=>{n.has(s)||t.style.removeProperty(s)}),n.forEach((s,u)=>{t.style.setProperty(u,s),a.add(u)}),a.size===0){ipe.delete(t);return}ipe.set(t,{properties:a,prefix:e})}function ian(t){let e=ipe.get(t);e&&(e.properties.forEach(r=>{t.style.removeProperty(r)}),e.prefix&&oan(t,e.prefix),ipe.delete(t))}var dn=$(K()),M6=require("obsidian");Mr();na();Qe();Dt();var lS=$(K()),e0t=require("obsidian");y_();Dt();Xe();function aan(t){let{selectedText:e,selectedModelKey:r,includeNoteContext:n,settings:o}=t,[i,a]=(0,lS.useState)([]),s=(0,lS.useRef)(!0);(0,lS.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let u=(0,lS.useMemo)(()=>{try{let b=PS(r,o.activeModels);return b.enabled?b:(Ce("Selected model is disabled; falling back to first enabled model.",{selectedModelKey:r}),o.activeModels.find(_=>_.enabled)??null)}catch{return Ce("Selected model not found; falling back to first enabled model."),o.activeModels.find(b=>b.enabled)??null}},[r,o.activeModels]),{isStreaming:l,streamingText:c,runTurn:d,stop:f,reset:p}=B$e({model:u,systemPrompt:Dje,excludeThinking:!0,onNoModel:()=>{ie("No active model is configured. Please configure a model in Copilot settings."),new e0t.Notice("No active model configured. Please configure a model in Copilot settings.")},onNonAbortError:b=>{ie("Error generating response:",b),new e0t.Notice("Error generating response. Please try again.")}}),m=(0,lS.useCallback)(async b=>{if(!b.trim())return;let _={id:gu(),role:"user",content:b,timestamp:Date.now()};a(T=>[...T,_]);let w=await d(async T=>{let O=b;return T.isFirstTurn&&(O=jje(b,n)),T.signal.aborted?"":await Fce(O,e,!T.isFirstTurn)});if(s.current)if(w){let T={id:gu(),role:"assistant",content:w,timestamp:Date.now()};a(O=>[...O,T])}else a(T=>T[T.length-1]?.id===_.id?T.slice(0,-1):T)},[n,d,e]),h=(0,lS.useCallback)(()=>{f()},[f]),y=(0,lS.useCallback)(()=>{a([]),p()},[p]);return{messages:(0,lS.useMemo)(()=>!l||!c?i:[...i,{id:"streaming",role:"assistant",content:c,timestamp:Date.now()}],[i,l,c]),isStreaming:l,sendMessage:m,stop:h,clear:y}}var yd=$(K()),san=require("obsidian");Mr();xn();Xe();var uan=yd.default.memo(function({message:e,isStreaming:r,isLastAssistantMessage:n,onCopy:o,onInsert:i,onReplace:a,hasSelection:s,isReplaceValid:u,replaceInvalidReason:l,isDisabledDueToStreaming:c,filePathSnapshot:d,plugin:f}){let p=(0,yd.useRef)(null);if((0,yd.useEffect)(()=>{if(e.role!=="assistant"||r)return;let h=!1;return(async()=>{let g=p.current;if(!g)return;g.empty();let b=d??"";try{let _=xZ(e.content);await san.MarkdownRenderer.renderMarkdown(_,g,b,f)}catch(_){if(ie("Failed to render markdown:",_),h)return;g.empty(),g.textContent=e.content}h||g.classList.add("markdown-rendered")})(),()=>{h=!0}},[e.content,e.role,r,d,f]),e.role==="user")return yd.default.createElement("div",{className:"tw-max-w-[85%] tw-self-end tw-rounded-lg tw-rounded-br-sm tw-bg-interactive-accent tw-px-3 tw-py-2 tw-text-on-accent"},yd.default.createElement("div",{"data-quick-ask-selectable":!0,className:"tw-whitespace-pre-wrap tw-break-words tw-text-sm"},e.content));if(r)return yd.default.createElement("div",{className:"tw-max-w-[95%] tw-self-start tw-rounded-lg tw-rounded-bl-sm tw-bg-secondary tw-px-3 tw-py-2"},yd.default.createElement("div",{"data-quick-ask-selectable":!0,className:"tw-whitespace-pre-wrap tw-break-words tw-text-sm tw-text-normal"},e.content,yd.default.createElement("span",{className:"tw-animate-pulse tw-text-accent"},"\u258A")));let m=n?"tw-opacity-100":"tw-opacity-0 group-hover/message:tw-opacity-100";return yd.default.createElement("div",{className:"tw-group/message tw-max-w-[95%] tw-self-start"},yd.default.createElement("div",{className:"tw-rounded-lg tw-rounded-bl-sm tw-bg-secondary tw-px-3 tw-py-2"},yd.default.createElement("div",{ref:p,"data-quick-ask-selectable":!0,className:"tw-text-sm [&.markdown-rendered]:tw-text-sm [&_code]:tw-text-xs [&_p]:tw-my-1 [&_pre]:tw-my-2"})),e.content&&yd.default.createElement("div",{className:`tw-mt-1 tw-flex tw-items-center tw-gap-0.5 tw-transition-opacity ${m}`},yd.default.createElement(me,{variant:"ghost2",size:"icon",className:"tw-size-5 hover:tw-bg-modifier-hover",onClick:()=>o(e.id),title:"Copy to clipboard"},yd.default.createElement(U_,{className:"tw-size-3"})),yd.default.createElement(me,{variant:"ghost2",size:"icon",className:"tw-size-5 hover:tw-bg-modifier-hover",onClick:()=>i(e.id),title:"Insert at cursor"},yd.default.createElement(vre,{className:"tw-size-3"})),s&&yd.default.createElement(me,{variant:"ghost2",size:"icon",className:"tw-size-5 hover:tw-bg-modifier-hover",onClick:()=>a(e.id),disabled:!u,title:c?"Stop generating to replace":u?"Replace selection":CZ(l)},yd.default.createElement(Bre,{className:"tw-size-3"}))))});var Wu=$(K());zr();Xe();gr();var lan=Wu.default.memo(function({value:e,onChange:r,onSubmit:n,sendShortcut:o="enter",placeholder:i="Ask a question...",disabled:a=!1,className:s="",onNotesChange:u,onNotesRemoved:l,onFoldersChange:c,onFoldersRemoved:d,onActiveNoteAdded:f,onActiveNoteRemoved:p,onEditorReady:m,currentActiveFile:h=null}){let[y,g]=(0,Wu.useState)(null),b=(0,Wu.useCallback)(O=>{g(()=>O)},[]);(0,Wu.useEffect)(()=>{if(y){let O=setTimeout(()=>{y()},50);return()=>clearTimeout(O)}},[y]);let _=Wu.default.useMemo(()=>({namespace:"QuickAskEditor",theme:{root:"tw-outline-none",paragraph:"tw-m-0"},nodes:[WU,JU,mL,hL,KU],onError:O=>{ie("QuickAskInput Lexical error:",O)},editable:!a}),[a]),w=(0,Wu.useCallback)(O=>{O.read(()=>{let P=Ci().getTextContent();r(P)})},[r]),T=(0,Wu.useCallback)(O=>{m?.(O)},[m]);return Wu.default.createElement(ike,{initialConfig:_},Wu.default.createElement(YFe,{currentActiveFile:h},Wu.default.createElement("div",{className:Se("tw-relative",s)},Wu.default.createElement(pke,{contentEditable:Wu.default.createElement(mke,{className:"tw-max-h-48 tw-min-h-12 tw-w-full tw-resize-none tw-overflow-y-auto tw-border-none tw-bg-transparent tw-px-1 tw-py-2 tw-pr-8 tw-text-sm tw-text-normal tw-outline-none","aria-label":"Quick Ask input"}),placeholder:Wu.default.createElement("div",{className:"tw-pointer-events-none tw-absolute tw-left-1 tw-top-2 tw-select-none tw-text-sm tw-text-muted/60"},i),ErrorBoundary:wke}),Wu.default.createElement(vke,{onChange:w}),Wu.default.createElement(bke,null),Wu.default.createElement(Mke,{onSubmit:n,sendShortcut:o}),Wu.default.createElement(Rke,{value:e}),Wu.default.createElement(Ike,{onFocus:b,onEditorReady:T}),Wu.default.createElement(Nke,{onNotesChange:u,onNotesRemoved:l}),Wu.default.createElement(Dke,{onFoldersChange:c,onFoldersRemoved:d}),Wu.default.createElement(jke,{onActiveNoteAdded:f,onActiveNoteRemoved:p}),Wu.default.createElement(Pke,null),Wu.default.createElement(Eke,{isCopilotPlus:!1,currentActiveFile:h}))))});xn();function can({plugin:t,view:e,selectedText:r,replaceGuard:n,onClose:o,onDragOffset:i,onResizeStart:a,hasCustomHeight:s}){let[u,l]=(0,dn.useState)(""),c=(0,dn.useRef)(null),d=(0,dn.useRef)(null),f=(0,dn.useRef)(!0),p=t.app.workspace.getActiveFile(),h=(0,dn.useRef)(p?.path??null).current,y=kr(),[g]=oF(),b=y.quickCommandModelKey??g,[_,w]=(0,dn.useState)(()=>y.quickCommandIncludeNoteContext),{messages:T,isStreaming:O,sendMessage:E,stop:P,clear:R}=aan({selectedText:r,selectedModelKey:b,includeNoteContext:_,settings:y}),I=T.length>0,A=n.getRange(),B=!!A&&A.from!==A.to,k=T[T.length-1]?.id,q=(0,dn.useMemo)(()=>T.reduce((Q,de,fe)=>de.role==="assistant"?fe:Q,-1),[T]),Z=(0,dn.useCallback)(()=>{let Q=d.current?.getBoundingClientRect();return Q?{x:Q.left,y:Q.top}:{x:0,y:0}},[]),V=(0,dn.useCallback)(Q=>{i?.(Q)},[i]),{handleMouseDown:Y}=Fje({dragRef:d,bounds:null,writeToDom:!1,getPosition:Z,onPositionChange:V}),X=(0,dn.useCallback)(Q=>de=>{de.preventDefault(),de.stopPropagation(),a?.(Q,{x:de.clientX,y:de.clientY})},[a]),W=(0,dn.useCallback)(async()=>{if(!u.trim()||O)return;let Q=u;l(""),await E(Q)},[u,O,E]),re=(0,dn.useCallback)(Q=>{Q.stopPropagation(),Q.key==="Escape"&&!Q.defaultPrevented&&(Q.preventDefault(),o())},[o]),ue=(0,dn.useCallback)(Q=>{Q.stopPropagation()},[]);(0,dn.useEffect)(()=>{let Q=c.current;if(!Q)return;let de=24,fe=()=>Q.scrollHeight-Q.scrollTop-Q.clientHeight<=de,De=()=>{f.current=fe()};return f.current=fe(),Q.addEventListener("scroll",De),()=>{Q.removeEventListener("scroll",De)}},[I]),(0,dn.useEffect)(()=>{let Q=c.current;Q&&f.current&&(Q.scrollTop=Q.scrollHeight)},[T]);let le=(0,dn.useCallback)(async Q=>{let de=T.find(fe=>fe.id===Q);if(de&&de.role==="assistant"){let fe=lO(de.content);try{await navigator.clipboard.writeText(fe),new M6.Notice("Copied to clipboard")}catch{new M6.Notice("Failed to copy to clipboard")}}},[T]),L=(0,dn.useCallback)(Q=>{let de=T.find(fe=>fe.id===Q);if(!(!de||de.role!=="assistant"))try{let fe=lO(de.content),De=e.state.selection.main.to,st=e.state.toText(fe);e.dispatch({changes:{from:De,to:De,insert:st},selection:{anchor:De,head:De+st.length}}),e.focus(),new M6.Notice("Inserted"),o()}catch{new M6.Notice("Failed to insert. Editor may have changed.")}},[T,e,o]),J=(0,dn.useCallback)(Q=>{let de=T.find(st=>st.id===Q);if(!de||de.role!=="assistant")return;let fe=lO(de.content),De=n.replace(fe);if(!De.ok){new M6.Notice(De.message??"Cannot replace.");return}new M6.Notice("Replaced"),o()},[T,n,o]),ne=(0,dn.useCallback)(Q=>{Re("quickCommandModelKey",Q)},[]),D=(0,dn.useCallback)(Q=>{w(Q),Re("quickCommandIncludeNoteContext",Q)},[]),N=B&&!O?n.validate():null,z=!!N?.ok,H=N?.reason??null,oe=B&&O;return dn.default.createElement("div",{ref:d,className:`tw-group tw-relative tw-flex tw-size-full tw-flex-col tw-rounded-lg tw-rounded-b-none tw-border tw-border-solid tw-border-border tw-bg-primary tw-shadow-lg${I&&!s?" tw-max-h-[min(500px,70vh)]":""}`,onKeyDown:re,onKeyUp:ue,onBeforeInput:ue,onInput:ue,onMouseDown:ue,onMouseUp:ue,onClick:ue},dn.default.createElement("div",{className:"tw-relative tw-flex-none"},dn.default.createElement("div",{className:"tw-flex tw-h-4 tw-cursor-grab tw-items-center tw-justify-center hover:tw-bg-[color-mix(in_srgb,var(--background-modifier-hover)_20%,transparent)] active:tw-cursor-grabbing",onMouseDown:Y},dn.default.createElement("div",{className:"tw-h-[5px] tw-w-16 tw-rounded-sm tw-bg-[color-mix(in_srgb,var(--text-muted)_40%,transparent)] hover:tw-bg-[color-mix(in_srgb,var(--text-muted)_65%,transparent)]"})),dn.default.createElement(me,{className:"tw-absolute tw-right-2 tw-top-1 tw-rounded tw-p-1 tw-text-normal",variant:"ghost2",onClick:o,title:"Close"},dn.default.createElement(Ho,{className:"tw-size-4"}))),I&&dn.default.createElement("div",{ref:c,"data-quick-ask-scroll":"true",className:"tw-flex tw-min-h-0 tw-flex-1 tw-flex-col tw-gap-2 tw-overflow-y-auto tw-px-3 tw-py-2"},T.map((Q,de)=>dn.default.createElement(uan,{key:Q.id,message:Q,isStreaming:O&&Q.id===k&&Q.role==="assistant",isLastAssistantMessage:Q.role==="assistant"&&de===q,onCopy:le,onInsert:L,onReplace:J,hasSelection:B,isReplaceValid:z,replaceInvalidReason:H,isDisabledDueToStreaming:oe,filePathSnapshot:h,plugin:t}))),!I&&s&&dn.default.createElement("div",{className:"tw-flex-1"}),dn.default.createElement("div",{className:"tw-px-3 tw-pb-1 tw-pt-2"},dn.default.createElement(lan,{value:u,onChange:l,onSubmit:W,sendShortcut:y.defaultSendShortcut,placeholder:O?"Generating...":"Ask a question... ",currentActiveFile:p})),dn.default.createElement("div",{className:"tw-mt-auto tw-flex tw-items-center tw-justify-between tw-gap-2 tw-border-t tw-border-solid tw-border-border tw-px-3 tw-py-1.5"},dn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},dn.default.createElement(vZ,{size:"sm",variant:"ghost",value:b,onChange:ne,disabled:O}),dn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},dn.default.createElement(Uu,{id:"quickAskIncludeContext",checked:_,onCheckedChange:Q=>D(!!Q),className:"tw-size-3.5",disabled:O}),dn.default.createElement("label",{htmlFor:"quickAskIncludeContext",className:"tw-cursor-pointer tw-text-xs tw-text-muted"},"Note"),dn.default.createElement(to,{content:"Include the active note's content as context",side:"top"}))),dn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},I&&dn.default.createElement(me,{variant:"ghost2",size:"icon",className:"hover:tw-bg-modifier-hover",onClick:R,title:"Clear conversation"},dn.default.createElement(Fre,{className:"tw-size-4"})),O?dn.default.createElement(me,{variant:"destructive",size:"icon",onClick:P,title:"Stop generating"},dn.default.createElement(z4,{className:"tw-size-4"})):dn.default.createElement(me,{variant:"default",size:"icon",onClick:W,disabled:!u.trim(),title:"Send message"},dn.default.createElement(U4,{className:"tw-size-4"})))),dn.default.createElement("div",{className:"tw-absolute tw-right-0 tw-top-4 tw-h-[calc(100%-16px)] tw-w-1 tw-cursor-ew-resize",onMouseDown:X("right")}),dn.default.createElement("div",{className:"tw-absolute tw-bottom-0 tw-left-0 tw-h-1 tw-w-full tw-cursor-ns-resize",onMouseDown:X("bottom")}),dn.default.createElement("div",{className:"quick-ask-resize-indicator-left tw-absolute tw-bottom-0 tw-left-0 tw-size-3 tw-cursor-nesw-resize",onMouseDown:X("bottom-left")}),dn.default.createElement("div",{className:"quick-ask-resize-indicator-right tw-absolute tw-bottom-0 tw-right-0 tw-z-[10] tw-size-3 tw-cursor-nwse-resize",onMouseDown:X("bottom-right")}))}var h_=12,mz=6,dan=.83,fan=.9,pan=420,man=560,t0t=300,han=200,vm=class vm{constructor(e){this.options=e;this.root=null;this.overlayContainer=null;this.cleanupCallbacks=[];this.overlayHost=null;this.ownerDocument=null;this.ownerWindow=null;this.rafId=null;this.panelRerenderRafId=null;this.resizeObserver=null;this.isClosing=!1;this.closeAnimationTimeout=null;this.dragPosition=null;this.resizeSize=null;this.hasUserResizedHeight=!1;this.bottomAnchorPos=null;this.topAnchorPos=null;this.focusAnchorPos=null;this.placementSide=null;this.isResizing=!1;this.resizeDirection=null;this.resizeStartRect=null;this.resizeStartMouse=null;this.resizeRafId=null;this.savedBodyUserSelect="";this.savedBodyCursor="";this.closeWithAnimation=()=>{if(!this.isClosing)if(this.isClosing=!0,this.overlayContainer){this.overlayContainer.classList.add("closing");let e=n=>{n.target!==this.overlayContainer||n.animationName!=="copilot-quick-ask-fade-out"||(this.overlayContainer?.removeEventListener("animationend",e),this.closeAnimationTimeout!==null&&(window.clearTimeout(this.closeAnimationTimeout),this.closeAnimationTimeout=null),this.options.onClose())};this.overlayContainer.addEventListener("animationend",e);let r=this.ownerWindow??window;this.closeAnimationTimeout=r.setTimeout(()=>{this.overlayContainer?.removeEventListener("animationend",e),this.closeAnimationTimeout=null,this.options.onClose()},300)}else this.options.onClose()};this.handleDragOffset=e=>{this.dragPosition=e,this.updateDragPosition()};this.handleResizeStart=(e,r)=>{if(this.isResizing)return;let n=this.overlayContainer?.getBoundingClientRect();if(!n)return;this.isResizing=!0,this.resizeDirection=e,this.resizeStartRect=n,this.resizeStartMouse=r;let o=this.ownerDocument??document,i=o.body;this.savedBodyUserSelect=i.style.userSelect,this.savedBodyCursor=i.style.cursor,i.classList.add("copilot-quick-ask-resizing"),i.style.userSelect="none";let a={right:"ew-resize",bottom:"ns-resize","bottom-left":"nesw-resize","bottom-right":"nwse-resize"};i.style.cursor=a[e]??"default",o.addEventListener("mousemove",this.handleResizeMove,!0),o.addEventListener("mouseup",this.handleResizeEnd,!0)};this.handleResizeMove=e=>{if(!this.isResizing||!this.resizeStartRect||!this.resizeStartMouse)return;let r=this.ownerWindow??window;this.resizeRafId!==null&&r.cancelAnimationFrame(this.resizeRafId),this.resizeRafId=r.requestAnimationFrame(()=>{this.resizeRafId=null,this.applyResize(e.clientX,e.clientY)})};this.handleResizeEnd=()=>{this.cleanupResize(),this.renderPanel()}}mount(e,r,n){this.bottomAnchorPos=e,this.topAnchorPos=typeof r=="number"?r:null,this.focusAnchorPos=typeof n=="number"?n:null,this.placementSide=null,vm.currentInstance=this,this.mountOverlay(),this.setupGlobalListeners(),this.schedulePositionUpdate()}destroy(){vm.currentInstance===this&&(vm.currentInstance=null);let e=this.ownerWindow??window;this.closeAnimationTimeout!==null&&(e.clearTimeout(this.closeAnimationTimeout),this.closeAnimationTimeout=null),this.cleanupResize();for(let n of this.cleanupCallbacks)try{n()}catch{}this.cleanupCallbacks=[],this.rafId!==null&&(e.cancelAnimationFrame(this.rafId),this.rafId=null),this.panelRerenderRafId!==null&&(e.cancelAnimationFrame(this.panelRerenderRafId),this.panelRerenderRafId=null),this.resizeObserver?.disconnect(),this.resizeObserver=null,this.root?.unmount(),this.root=null,this.overlayContainer?.parentNode&&this.overlayContainer.parentNode.removeChild(this.overlayContainer),this.overlayContainer&&ian(this.overlayContainer),this.overlayContainer=null;let r=vm.overlayRoot;if(r&&r.childElementCount===0){let n=r.parentElement;r.remove(),vm.overlayRoot=null,n?.classList.remove("copilot-quick-ask-overlay-host")}this.bottomAnchorPos=null,this.topAnchorPos=null,this.focusAnchorPos=null,this.placementSide=null,this.ownerDocument=null,this.ownerWindow=null}updatePosition(e,r,n){typeof e=="number"&&(this.bottomAnchorPos=e),typeof r=="number"?this.topAnchorPos=r:r===null&&(this.topAnchorPos=null),typeof n=="number"?this.focusAnchorPos=n:n===null&&(this.focusAnchorPos=null),this.placementSide=null,this.schedulePositionUpdate()}getReplaceGuard(){return this.options.replaceGuard}schedulePanelRerender(){if(this.panelRerenderRafId!==null)return;let e=this.ownerWindow??window;this.panelRerenderRafId=e.requestAnimationFrame(()=>{this.panelRerenderRafId=null,this.renderPanel()})}renderPanel(){this.root&&this.root.render(gan.default.createElement(can,{plugin:this.options.plugin,editor:this.options.editor,view:this.options.view,selectedText:this.options.selectedText,replaceGuard:this.options.replaceGuard,onClose:this.closeWithAnimation,onDragOffset:this.handleDragOffset,onResizeStart:this.handleResizeStart,hasCustomHeight:this.hasUserResizedHeight}))}static closeCurrentWithAnimation(){return vm.currentInstance?(vm.currentInstance.closeWithAnimation(),!0):!1}static getOverlayRoot(e){if(vm.overlayRoot&&vm.overlayRoot.parentElement!==e&&(vm.overlayRoot.parentElement?.classList.remove("copilot-quick-ask-overlay-host"),vm.overlayRoot.remove(),vm.overlayRoot=null),vm.overlayRoot)return vm.overlayRoot;let n=(e.ownerDocument??document).createElement("div");return n.className="copilot-quick-ask-overlay-root",e.appendChild(n),e.classList.add("copilot-quick-ask-overlay-host"),vm.overlayRoot=n,n}mountOverlay(){let e=this.options.view.dom??document.body;this.overlayHost=e;let r=e.ownerDocument??document,n=r.defaultView??window;this.ownerDocument=r,this.ownerWindow=n;let o=vm.getOverlayRoot(e),i=r.createElement("div");i.className="copilot-quick-ask-overlay",o.appendChild(i),this.overlayContainer=i,this.root=(0,yan.createRoot)(i),this.renderPanel();let a=()=>{this.placementSide=null,this.schedulePositionUpdate()};n.addEventListener("scroll",a,!0),this.cleanupCallbacks.push(()=>n.removeEventListener("scroll",a,!0));let s=()=>{this.placementSide=null,this.schedulePositionUpdate()};n.addEventListener("resize",s),this.cleanupCallbacks.push(()=>n.removeEventListener("resize",s));let u=this.options.view?.scrollDOM;u&&(u.addEventListener("scroll",a),this.cleanupCallbacks.push(()=>u.removeEventListener("scroll",a))),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>{this.placementSide=null,this.schedulePositionUpdate()}),u&&this.resizeObserver.observe(u))}setupGlobalListeners(){let e=n=>{if(n.key!=="Escape"||n.defaultPrevented)return;let i=(this.ownerDocument??document).activeElement;i&&this.overlayContainer?.contains(i)||(n.preventDefault(),n.stopPropagation(),this.closeWithAnimation())},r=this.ownerWindow??window;r.addEventListener("keydown",e),this.cleanupCallbacks.push(()=>r.removeEventListener("keydown",e))}schedulePositionUpdate(){if(this.rafId!==null)return;let e=this.ownerWindow??window;this.rafId=e.requestAnimationFrame(()=>{this.rafId=null,this.updateOverlayPosition()})}isAnchorRectVisible(e,r){return e.bottom>=r.top&&e.top<=r.bottom&&e.right>=r.left&&e.left<=r.right}resolveVisibleAnchors(e,r){let n=r??e,o=i=>{if(typeof i!="number")return null;let a=this.options.view.coordsAtPos(i);return a&&this.isAnchorRectVisible(a,n)?a:null};return{bottomRect:o(this.bottomAnchorPos),topRect:o(this.topAnchorPos),focusRect:o(this.focusAnchorPos)}}computeVerticalPlacement(e,r,n,o,i,a,s,u){let l;if(this.placementSide==="below"&&e)l=e.bottom-n.top+mz;else if(this.placementSide==="above"&&r)l=r.top-n.top-mz-s;else if(e){let f=e.bottom-n.top+mz;if(i-(e.bottom-n.top)-mz>=s+h_)l=f,this.placementSide="below";else if(r){let m=r.top-n.top-mz-s;r.top-n.top-mz-o>=s+h_?(l=m,this.placementSide="above"):(l=o+(a-s)/2,this.placementSide=null)}else l=o+(a-s)/2,this.placementSide=null}else if(r){let f=r.top-n.top-mz-s;r.top-n.top-mz-o>=s+h_?(l=f,this.placementSide="above"):(l=o+(a-s)/2,this.placementSide=null)}else l=o+(a-s)/2,this.placementSide=null;let c=i-h_-s,d=Math.max(u,c);return Math.max(u,Math.min(l,d))}updateOverlayPosition(){if(!this.overlayContainer||this.bottomAnchorPos===null)return;if(this.dragPosition){this.updateDragPosition();return}let e=this.ownerDocument??document,r=this.overlayHost?.getBoundingClientRect()??e.body.getBoundingClientRect(),n=r.width,o=this.options.view.scrollDOM,i=o?.getBoundingClientRect(),s=o?.querySelector(".cm-sizer")?.getBoundingClientRect(),{bottomRect:u,topRect:l,focusRect:c}=this.resolveVisibleAnchors(r,i),d=Math.min(pan,n*dan),f=Math.min(man,n*fan),p=Math.min(t0t,n-h_*2),m=this.resizeSize?.width??Math.max(p,Math.min(d,f)),h=this.resizeSize?.height,y=(s?.left??i?.left??r.left+h_)-r.left,g=s?.width??i?.width??n-h_*2,b=y+g,_=this.topAnchorPos!==null&&this.bottomAnchorPos!==null&&this.topAnchorPos===this.bottomAnchorPos,w=typeof this.topAnchorPos=="number"?this.options.view.coordsAtPos(this.topAnchorPos):null,T=typeof this.bottomAnchorPos=="number"?this.options.view.coordsAtPos(this.bottomAnchorPos):null,O=Math.min((w?.bottom??0)-(w?.top??0),(T?.bottom??0)-(T?.top??0)),E=!_&&!!w&&!!T&&Math.abs(w.top-T.top)>Math.max(O/2,2),P=c??u??l,R=E?y+(g-m)/2:P?P.left-r.left:y+(g-m)/2;R=Math.min(R,b-m),R=Math.max(R,y),R=Math.min(R,n-h_-m),R=Math.max(R,h_);let I=(i?.top??r.top)-r.top,A=(i?.bottom??r.bottom)-r.top,B=A-I,k=I+h_;uBe(this.overlayContainer,"copilot-quick-ask-overlay-pos",{width:m,...typeof h=="number"?{height:h}:{},left:Math.round(R),top:Math.round(k)});let q=typeof h=="number"?h:this.overlayContainer.getBoundingClientRect().height||han,Z=this.computeVerticalPlacement(u,l,r,I,A,B,q,k);uBe(this.overlayContainer,"copilot-quick-ask-overlay-pos",{width:m,...typeof h=="number"?{height:h}:{},left:Math.round(R),top:Math.round(Z)})}cleanupResize(){let e=this.ownerWindow??window;if(this.resizeRafId!==null&&(e.cancelAnimationFrame(this.resizeRafId),this.resizeRafId=null),this.isResizing){let r=this.ownerDocument??document,n=r.body;r.removeEventListener("mousemove",this.handleResizeMove,!0),r.removeEventListener("mouseup",this.handleResizeEnd,!0),n.classList.remove("copilot-quick-ask-resizing"),n.style.userSelect=this.savedBodyUserSelect,n.style.cursor=this.savedBodyCursor}this.isResizing=!1,this.resizeDirection=null,this.resizeStartRect=null,this.resizeStartMouse=null}applyResize(e,r){if(!this.resizeStartRect||!this.resizeStartMouse||!this.resizeDirection)return;let n=this.ownerDocument??document,o=this.overlayHost?.getBoundingClientRect()??n.body.getBoundingClientRect(),i=e-this.resizeStartMouse.x,a=r-this.resizeStartMouse.y,s=this.resizeStartRect,u=this.resizeDirection,l=o.width,c=Math.min(t0t,l-h_*2),d=han,f=o.left+h_,p=o.right-h_,m=o.bottom-h_,h=s.width,y=s.height,g,b,_=u!=="right";switch(u){case"right":h=s.width+i;break;case"bottom":y=s.height+a;break;case"bottom-right":h=s.width+i,y=s.height+a;break;case"bottom-left":h=s.width-i,y=s.height+a,g=s.left+i,b=s.top;break}let w=p-s.left,T=s.right-f,O=m-s.top;u==="bottom-left"?(h=Math.max(c,Math.min(h,T)),g=s.right-h,g<f&&(g=f,h=s.right-f)):h=Math.max(c,Math.min(h,w)),_&&(y=Math.max(d,Math.min(y,O)));let E=this.resizeSize?.height,P={width:h};_?P.height=y:this.hasUserResizedHeight&&typeof E=="number"&&(P.height=E),this.resizeSize=P;let R=this.hasUserResizedHeight;_&&(this.hasUserResizedHeight=!0),this.hasUserResizedHeight!==R&&this.renderPanel(),u==="bottom-left"&&g!==void 0?(this.dragPosition={x:g,y:b??s.top},this.updateDragPosition()):this.dragPosition?this.updateDragPosition():this.schedulePositionUpdate()}updateDragPosition(){if(!this.overlayContainer||!this.dragPosition)return;let e=this.ownerDocument??document,r=this.overlayHost?.getBoundingClientRect()??e.body.getBoundingClientRect(),n=r.width,o=Math.min(pan,n*dan),i=Math.min(man,n*fan),a=Math.min(t0t,n-h_*2),s=this.resizeSize?.width??Math.max(a,Math.min(o,i)),u=this.resizeSize?.height;uBe(this.overlayContainer,"copilot-quick-ask-overlay-pos",{width:s,...u?{height:u}:{},left:Math.round(this.dragPosition.x-r.left),top:Math.round(this.dragPosition.y-r.top)})}};vm.overlayRoot=null,vm.currentInstance=null;var hQ=vm;function ban(t,e){let{bottomAnchorPos:r,topAnchorPos:n,focusAnchorPos:o}=t;if(r!==null&&r===n){let a=e.mapPos(r,1);return{bottomAnchorPos:a,topAnchorPos:a,focusAnchorPos:a}}let i=o===n?1:-1;return{bottomAnchorPos:r!==null?e.mapPos(r,-1):null,topAnchorPos:n!==null?e.mapPos(n,1):null,focusAnchorPos:o!==null?e.mapPos(o,i):null}}var hz=_an.StateEffect.define(),r0t=van.ViewPlugin.fromClass(class{constructor(t){this.view=t;this.overlay=null;this.bottomAnchorPos=null;this.topAnchorPos=null;this.focusAnchorPos=null}update(t){for(let e of t.transactions)for(let r of e.effects){if(!r.is(hz))continue;let n=r.value;if(!n){this.overlay?.destroy(),this.overlay=null,this.bottomAnchorPos=null,this.topAnchorPos=null,this.focusAnchorPos=null;continue}this.overlay?.destroy(),this.bottomAnchorPos=n.bottomAnchorPos,this.topAnchorPos=typeof n.topAnchorPos=="number"?n.topAnchorPos:null,this.focusAnchorPos=typeof n.focusAnchorPos=="number"?n.focusAnchorPos:null,this.overlay=new hQ(n.options),this.overlay.mount(n.bottomAnchorPos,this.topAnchorPos,this.focusAnchorPos)}if(this.overlay&&t.docChanged){let e=this.overlay.getReplaceGuard();e?.onDocChanged&&e.onDocChanged(t.changes);let r=ban({bottomAnchorPos:this.bottomAnchorPos,topAnchorPos:this.topAnchorPos,focusAnchorPos:this.focusAnchorPos},t.changes);this.bottomAnchorPos=r.bottomAnchorPos,this.topAnchorPos=r.topAnchorPos,this.focusAnchorPos=r.focusAnchorPos,this.bottomAnchorPos!==null&&this.overlay.updatePosition(this.bottomAnchorPos,this.topAnchorPos,this.focusAnchorPos),this.overlay.schedulePanelRerender()}}destroy(){this.overlay?.destroy(),this.overlay=null,this.bottomAnchorPos=null,this.topAnchorPos=null,this.focusAnchorPos=null}});Xe();var ape=class{constructor(e){this.quickAskWidgetState=null;this.plugin=e}close(e=!0){let r=this.quickAskWidgetState;if(!r)return;if(!e){this.quickAskWidgetState=null;try{let o=[hz.of(null),...Mv.buildEffects(r.view,null)];r.view.dispatch({effects:o})}catch(o){Ce("Failed to dispatch close effect:",o)}return}if(this.quickAskWidgetState=null,!hQ.closeCurrentWithAnimation())try{let o=[hz.of(null),...Mv.buildEffects(r.view,null)];r.view.dispatch({effects:o}),r.view.focus()}catch(o){Ce("Failed to dispatch close effect or focus:",o)}}show(e,r){let n=r.state.selection.main,o=e.editor,i=e.leaf,a=e.file?.path??null,s=r.state.doc.sliceString(n.from,n.to),u=n.from,l=n.to;this.close(!1);let c=ZKr({editorView:r,leafSnapshot:i,filePathSnapshot:a,selectedTextSnapshot:s,initialRange:{from:u,to:l},getLeafState:()=>{let f=i.view;return f instanceof wan.MarkdownView?{leaf:i,editorView:f.editor?.cm??null,filePath:f.file?.path??null}:{leaf:null,editorView:null,filePath:null}}}),d=(f=!0)=>{let p=!this.quickAskWidgetState||this.quickAskWidgetState.view===r;p&&(this.quickAskWidgetState=null);try{let m=[hz.of(null),...Mv.buildEffects(r,null)];r.dispatch({effects:m}),p&&f&&r.focus()}catch(m){Ce("Failed to dispatch close effect or focus:",m)}};try{let f=q$e(n,r.state.doc);r.dispatch({effects:[hz.of(null),...Mv.buildEffects(r,null),hz.of({bottomAnchorPos:f.bottomPos,topAnchorPos:f.topPos,focusAnchorPos:f.focusPos,options:{plugin:this.plugin,editor:o,view:r,selectedText:s,selectionFrom:u,selectionTo:l,replaceGuard:c,onClose:()=>d(!0)}}),...Mv.buildEffects(r,{from:u,to:l})]}),this.quickAskWidgetState={view:r,close:d}}catch(f){Ce("Failed to show Quick Ask panel:",f),this.quickAskWidgetState=null}}isOpen(){return this.quickAskWidgetState!==null}createExtension(){return[r0t]}};var spe=require("obsidian");gr();Xe();var lBe=pde("copilot-chat-selection-highlight");function n0t(t){try{let e=lBe.buildEffects(t,null);e.length>0&&t.dispatch({effects:e})}catch{}}var upe=class{constructor(e,r){this.lastActiveMarkdownLeaf=null;this.lastActiveLeafWasMarkdown=!1;this.snapshot=null;this.plugin=e,this.closeQuickAskOnChatFocus=r?.closeQuickAskOnChatFocus??!1}initialize(){let e=this.plugin.app.workspace.activeLeaf??null;this.lastActiveLeafWasMarkdown=e?.view instanceof spe.MarkdownView,this.lastActiveLeafWasMarkdown&&e&&(this.lastActiveMarkdownLeaf=e)}cleanup(){this.clear(),this.lastActiveMarkdownLeaf=null,this.lastActiveLeafWasMarkdown=!1}handleActiveLeafChange(e){let r=this.lastActiveLeafWasMarkdown,n=e?.getViewState().type??null,o=e?.view instanceof spe.MarkdownView;this.lastActiveLeafWasMarkdown=o,o&&e&&(this.lastActiveMarkdownLeaf=e),this.snapshot&&n!==Du&&this.clear(),n===Du&&r&&(this.closeQuickAskOnChatFocus&&this.plugin.quickAskController?.close(!1),this.persist({useFallback:!0}))}persistFromPointerDown(){this.plugin.app.workspace.activeLeaf?.getViewState().type!==Du&&this.persist({useFallback:!1})}clearIfNoNoteContexts(e){e.some(r=>r.sourceType==="note")||this.clear()}clearForNewChat(){this.clear()}persist(e){let r=this.getEditorView(e.useFallback);if(!r)return;let n=r.state.selection.main;if(n.from===n.to)return;let o=n.from,i=n.to,a=this.getHighlightRange(r);if(this.snapshot?.view===r&&this.snapshot.from===o&&this.snapshot.to===i&&a?.from===o&&a?.to===i)return;this.snapshot&&this.snapshot.view!==r&&(this.hideHighlight(this.snapshot.view),this.snapshot=null),this.showHighlight(r,o,i)&&(this.snapshot={view:r,from:o,to:i})}clear(){this.snapshot&&(this.hideHighlight(this.snapshot.view),this.snapshot=null)}getEditorView(e){let r=this.plugin.app.workspace.getActiveViewOfType(spe.MarkdownView);return r?.editor?.cm?r.editor.cm:e&&this.lastActiveMarkdownLeaf?.view instanceof spe.MarkdownView?this.lastActiveMarkdownLeaf.view.editor?.cm??null:null}showHighlight(e,r,n){try{let o=lBe.buildEffects(e,{from:r,to:n});return o.length===0?!1:(e.dispatch({effects:o}),!0)}catch(o){return ie("ChatSelectionHighlight show failed:",o),!1}}hideHighlight(e){try{let r=lBe.buildEffects(e,null);r.length>0&&e.dispatch({effects:r})}catch(r){Ce("ChatSelectionHighlight hide failed (view may be destroyed):",r)}}getHighlightRange(e){return lBe.getRange(e)}};var bd=require("obsidian");t1();y_();var cBe=class extends bd.Plugin{constructor(){super(...arguments);this.userMessageHistory=[];this.chatHistoryLastAccessedAtManager=new MJ}async onload(){await this.loadSettings(),this.settingsUnsubscriber=ml(async(a,s)=>{s.enableEncryption?await this.saveData(await e1t(s)):await this.saveData(s),obt(this,a,s)}),this.addSettingTab(new aBe(this.app,this)),HX(this.app.vault),this.brevilabsClient=Xl.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),m0(),Lbr(),this.projectManager=Vg.getInstance(this.app,this),this.vectorStoreManager=p0.getInstance(),afe.getInstance().initialize(),this.fileParserManager=new pq(this.brevilabsClient,this.app.vault);let n=new tQ,o=this.projectManager.getCurrentChainManager(),i=new wqe(n,o,this.fileParserManager,this);if(this.chatUIState=new sBe(i),this.userMemoryManager=new $B(this.app),this.quickAskController=new ape(this),this.registerEditorExtension(this.quickAskController.createExtension()),this.chatSelectionHighlightController=new upe(this,{closeQuickAskOnChatFocus:!1}),this.chatSelectionHighlightController.initialize(),bd.Platform.isDesktopApp){let{activeLeafRef:a,layoutRef:s}=nbt(this.app,{preserveOnViewTypes:[Du]});this.registerEvent(a),this.registerEvent(s)}this.registerView(Du,a=>new iz(a,this)),this.registerView(dle,a=>new _De(a)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",a=>{this.activateView()}),obt(this,void 0,ee()),this.registerEvent(this.app.workspace.on("editor-menu",a=>{Bnn(a,this.app)})),this.registerEvent(this.app.workspace.on("active-leaf-change",a=>{if(this.chatSelectionHighlightController.handleActiveLeafChange(a??null),a&&a.view instanceof bd.MarkdownView&&a.view.file){let u=this.app.workspace.getLeavesOfType(Du).find(l=>l.view instanceof iz)?.view;if(u){let l=new CustomEvent(MS.ACTIVE_LEAF_CHANGE);u.eventTarget.dispatchEvent(l)}}})),this.customCommandRegister=new hqe(this,this.app.vault),this.systemPromptRegister=new bde(this,this.app.vault),this.app.workspace.onLayoutReady(()=>{this.customCommandRegister.initialize().then(znn).then(Vnn),this.systemPromptRegister.initialize().then(()=>dbt(this.app.vault))}),this.initSelectionHandler(),this.initWebSelectionWatcher()}async onunload(){this.clearAllPersistentSelectionHighlights(),this.chatSelectionHighlightController?.cleanup(),this.projectManager&&this.projectManager.onunload(),afe.getInstance().cleanup(),this.customCommandRegister.cleanup(),this.systemPromptRegister.cleanup(),this.settingsUnsubscriber?.(),this.cleanupSelectionHandler(),this.cleanupWebSelectionWatcher(),this.clearSelectionContext();try{md(this.app).stopActiveWebTabTracking()}catch{}await Em.flush(),F("Copilot plugin unloaded")}clearAllPersistentSelectionHighlights(){try{let r=this.app.workspace.getLeavesOfType("markdown");for(let n of r){let o=n.view;if(!(o instanceof bd.MarkdownView))continue;let i=o.editor?.cm;i&&(Mv.hide(i),n0t(i))}}catch(r){Ce("Failed to clear persistent selection highlights:",r)}}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(ee().autosaveChat){let r=this.app.workspace.getLeavesOfType(Du)[0]?.view;r&&await r.saveChat()}}async processText(r,n,o,i=!0){let a=await r.getSelection();this.app.workspace.getLeavesOfType(Du).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(Du).find(l=>l.view instanceof iz)?.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(Du).find(n=>n.view instanceof iz)?.view;if(r){let n=new CustomEvent(MS.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===Du&&this.emitChatIsVisible()}))}initSelectionHandler(){this.selectionChangeHandler=()=>{this.selectionDebounceTimer&&window.clearTimeout(this.selectionDebounceTimer),this.selectionDebounceTimer=window.setTimeout(()=>{this.handleSelectionChange()},500)},document.addEventListener("selectionchange",this.selectionChangeHandler)}cleanupSelectionHandler(){this.selectionDebounceTimer&&window.clearTimeout(this.selectionDebounceTimer),this.selectionChangeHandler&&document.removeEventListener("selectionchange",this.selectionChangeHandler)}clearSelectionContext(){pO([])}clearWebSelectionContextForUrl(r){let n=zC(),o=n.filter(i=>i.sourceType!=="web"||i.url!==r);o.length!==n.length&&pO(o)}setSelectionContext(r){pO([r])}handleSelectionChange(){if(!ee().autoAddSelectionToContext)return;let n=this.app.workspace.getActiveViewOfType(bd.MarkdownView);if(!n||!n.editor)return;let o=n.editor,i=this.app.workspace.getActiveFile(),a=o.listSelections()[0];if(!a)return;let s=i?`${i.path}:${a.anchor.line}:${a.anchor.ch}:${a.head.line}:${a.head.ch}`:"";if(s===this.lastSelectionSignature)return;this.lastSelectionSignature=s;let u=o.getSelection();if(!u||!u.trim()){let m=zC(),h=m.filter(y=>y.sourceType!=="note");m.length!==h.length&&pO(h);return}if(!i)return;let l=a.anchor.line+1,c=a.head.line+1,d=Math.min(l,c),f=Math.max(l,c),p={id:gu(),content:u,sourceType:"note",noteTitle:i.basename,notePath:i.path,startLine:d,endLine:f};this.setSelectionContext(p)}initWebSelectionWatcher(){if(!bd.Platform.isDesktopApp)return;let r=md(this.app);this.webSelectionTracker=new Sqe({intervalMs:500,emptySelectionDebounceCount:2,isEnabled:()=>ee().autoAddSelectionToContext,getLeaf:()=>r.getActiveLeaf()??r.getLastActiveLeaf(),getActiveLeaf:()=>r.getActiveLeaf(),onSelectionChange:n=>{this.setSelectionContext(n)},onSelectionClear:({url:n})=>{this.clearWebSelectionContextForUrl(n)}}),this.webSelectionTracker.start()}cleanupWebSelectionWatcher(){this.webSelectionTracker?.stop(),this.webSelectionTracker=void 0}suppressCurrentWebSelection(r){if(r&&r.trim()){this.webSelectionTracker?.suppressSelectionForUrl(r);return}this.webSelectionTracker?.suppressCurrentSelection()}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(bd.MarkdownView);return{getSelection:()=>{let n=r?.editor?.getSelection();if(n)return n;let o=this.app.workspace.getActiveFile();return o?this.app.vault.read(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(Du).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(Du);r.length===0?ee().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:Du,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:Du,active:!0}):this.app.workspace.revealLeaf(r[0]),setTimeout(()=>{this.emitChatIsVisible()},50)}async deactivateView(){this.app.workspace.detachLeavesOfType(Du)}async loadSettings(){let r=await this.loadData(),n=$We(r);A_(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=no(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 bd.Notice("No chat history found.");return}new mqe(this.app,r,this.chatHistoryLastAccessedAtManager,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=await _qe(this.app,ee().defaultSaveFolder);if(r.length===0)return[];let o=Gu()?.id;if(o){let i=`${o}__`;return r.filter(a=>a.basename.startsWith(i))}else return r.filter(i=>!i.basename.match(/^[a-zA-Z0-9-]+__/))}async getChatHistoryItems(){return(await this.getChatHistoryFiles()).map(n=>{let o=Nfe(n),i=Dfe(n),a=this.chatHistoryLastAccessedAtManager.getEffectiveLastUsedAt(n.path,i??o.getTime()),s=new Date(a);return{id:n.path,title:Afe(n),createdAt:o,lastAccessedAt:s}})}async touchChatHistoryLastAccessedAt(r){try{this.chatHistoryLastAccessedAtManager.touch(r.path);let n=Dfe(r),o=this.chatHistoryLastAccessedAtManager.shouldPersist(r.path,n);if(o===null)return;let i=o;this.app.fileManager?.processFrontMatter&&this.app.vault.getAbstractFileByPath(r.path)!=null?await this.app.fileManager.processFrontMatter(r,a=>{let s=Number(a.lastAccessedAt),u=Number.isFinite(s)&&s>0?s:0;i=Math.max(u,o),u!==i&&(a.lastAccessedAt=i)}):await $fe(this.app,r.path,{lastAccessedAt:i}),this.chatHistoryLastAccessedAtManager.markPersisted(r.path,i)}catch(n){Ce(`[CopilotPlugin] Failed to update chat lastAccessedAt for ${r.path}`,n)}}getChatHistoryLastAccessedAtManager(){return this.chatHistoryLastAccessedAtManager}async loadChatHistory(r){await this.autosaveCurrentChat();let n=this.app.workspace.getLeavesOfType(Du)[0];n||this.activateView(),await this.chatUIState.loadChatHistory(r),this.touchChatHistoryLastAccessedAt(r);let o=(n||this.app.workspace.getLeavesOfType(Du)[0])?.view;o&&o.updateView()}async loadChatById(r){let n=await CSt(this.app,r);if(n)await this.loadChatHistory(n);else throw new Error("Chat file not found.")}async openChatSourceFile(r){let n=this.app.vault.getAbstractFileByPath(r);if(n instanceof bd.TFile)await this.app.workspace.getLeaf(!0).openFile(n);else if(await this.app.vault.adapter.exists(r))new bd.Notice("Cannot open source files from hidden directories. To open chat notes in the editor, save them to a non-hidden folder in settings.");else throw new Error("Chat file not found.")}async updateChatTitle(r,n){let o=this.app.vault.getAbstractFileByPath(r);if(o instanceof bd.TFile)await this.app.fileManager.processFrontMatter(o,i=>{i.topic=n}),await new Promise(i=>{let a=u=>{u.path===r&&(this.app.metadataCache.off("changed",a),clearTimeout(s),i())};this.app.metadataCache.on("changed",a);let s=setTimeout(()=>{this.app.metadataCache.off("changed",a),i()},500)}),new bd.Notice("Chat title updated.");else if(await CSt(this.app,r))await $fe(this.app,r,{topic:n.trim()}),new bd.Notice("Chat title updated.");else throw new Error("Chat file not found.")}async deleteChatHistory(r){let n=this.app.vault.getAbstractFileByPath(r);if(n instanceof bd.TFile)await this.app.vault.delete(n),new bd.Notice("Chat deleted.");else if(await this.app.vault.adapter.exists(r))await this.app.vault.adapter.remove(r),new bd.Notice("Chat deleted.");else throw new Error("Chat file not found.")}async handleNewChat(){if(r9(),await Em.clear(),ee().enableRecentConversations)try{let o=this.projectManager.getCurrentChainManager().chatModelManager.getChatModel();this.userMemoryManager.addRecentConversation(this.chatUIState.getMessages(),o)}catch(n){F("Failed to analyze chat messages for memory:",n)}await this.autosaveCurrentChat();let r=this.app.workspace.getLeavesOfType(Du)[0];if(r){let n=r.view,o=new CustomEvent(MS.ABORT_STREAM,{detail:{reason:"new-chat"}});n.eventTarget.dispatchEvent(o)}this.chatUIState.clearMessages(),r?r.view.updateView():await this.activateView()}async newChat(){await this.handleNewChat()}async customSearchDB(r,n,o){let i=ee(),{FilterRetriever:a}=await Promise.resolve().then(()=>(aDe(),Rzr)),{mergeFilterAndSearchResults:s}=await Promise.resolve().then(()=>(sDe(),Izr)),l=await new a(this.app,{salientTerms:n,maxK:20}).getRelevantDocuments(r),d=await(i.enableSemanticSearchV3?new(await Promise.resolve().then(()=>(lmt(),Pzr))).MergedSemanticRetriever(this.app,{minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o,returnAll:!1}):new(await Promise.resolve().then(()=>(pX(),umt))).TieredLexicalRetriever(this.app,{minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o,returnAll:!1,useRerankerThreshold:void 0})).getRelevantDocuments(r),{filterResults:f,searchResults:p}=s(l,d);return[...f,...p].map(h=>({content:h.pageContent,metadata:h.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
  *)

@langchain/core/dist/utils/sax-js/sax.js:
  (*! http://mths.be/fromcodepoint v0.1.0 by @mathias *)

mustache/mustache.mjs:
  (*!
   * mustache.js - Logic-less {{mustache}} templates with JavaScript
   * http://github.com/janl/mustache.js
   *)

react/cjs/react.production.min.js:
  (**
   * @license React
   * react.production.min.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

moment/moment.js:
  (*! moment.js *)
  (*! version : 2.29.4 *)
  (*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
  (*! license : MIT *)
  (*! momentjs.com *)

ieee754/index.js:
  (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)

buffer/index.js:
  (*!
   * The buffer module from node.js, for the browser.
   *
   * @author   Feross Aboukhadijeh <https://feross.org>
   * @license  MIT
   *)

scheduler/cjs/scheduler.production.min.js:
  (**
   * @license React
   * scheduler.production.min.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

react-dom/cjs/react-dom.production.min.js:
  (**
   * @license React
   * react-dom.production.min.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

react/cjs/react-jsx-runtime.production.min.js:
  (**
   * @license React
   * react-jsx-runtime.production.min.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/shared/src/utils.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/defaultAttributes.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/Icon.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/createLucideIcon.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/arrow-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/arrow-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/book-open.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/brain.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/check.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/chevron-down.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/chevron-right.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/chevron-up.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/circle-alert.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/circle-check-big.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/circle-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/circle-dashed.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/circle-help.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/circle-plus.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/circle-stop.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/circle-x.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/circle.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/clipboard-paste.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/coins.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-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/copy.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/corner-down-left.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/cpu.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/database.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/download.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/ellipsis-vertical.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/ellipsis.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/external-link.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/eye-off.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/eye.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/file-audio.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/file-clock.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/file-image.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/file-input.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/file-output.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/file-text.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/file-video.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/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/hash.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-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-square-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/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/pause.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/play.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/replace.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/rotate-ccw.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/rotate-cw.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/search.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/send.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/settings.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/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/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/wrench.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/x.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/zap-off.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/icons/zap.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

lucide-react/dist/esm/lucide-react.js:
  (**
   * @license lucide-react v0.462.0 - ISC
   *
   * This source code is licensed under the ISC license.
   * See the LICENSE file in the root directory of this source tree.
   *)

safe-buffer/index.js:
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)

@langchain/core/dist/utils/js-sha256/hash.js:
  (**
  * [js-sha256]{@link https://github.com/emn178/js-sha256}
  *
  * @version 0.11.1
  * @author Chen, Yi-Cyuan [emn178@gmail.com]
  * @copyright Chen, Yi-Cyuan 2014-2025
  * @license MIT
  *)

@google/generative-ai/dist/index.mjs:
  (**
   * @license
   * Copyright 2024 Google LLC
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *)

crypto-js/ripemd160.js:
  (** @preserve
  	(c) 2012 by Cédric Mesnil. All rights reserved.
  
  	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  
  	    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  	    - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  
  	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  	*)

crypto-js/mode-ctr-gladman.js:
  (** @preserve
   * Counter block mode compatible with  Dr Brian Gladman fileenc.c
   * derived from CryptoJS.mode.CTR
   * Jan Hruby jhruby.web@gmail.com
   *)
*/

/* nosourcemap */